Added logging, changed some directory structure

This commit is contained in:
2018-01-13 21:33:40 -05:00
parent f079a5f067
commit 8e72ffb917
73656 changed files with 35284 additions and 53718 deletions

View File

@@ -0,0 +1,15 @@
import * as React from 'react';
import { StandardProps } from '..';
export interface TableProps extends StandardProps<
React.TableHTMLAttributes<HTMLTableElement>,
TableClassKey
> {}
export type TableClassKey =
| 'root'
;
declare const Table: React.ComponentType<TableProps>;
export default Table;

View File

@@ -0,0 +1,56 @@
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
export const styles = theme => ({
root: {
fontFamily: theme.typography.fontFamily,
width: '100%',
borderCollapse: 'collapse',
borderSpacing: 0,
overflow: 'hidden'
}
});
class Table extends React.Component {
getChildContext() {
// eslint-disable-line class-methods-use-this
return {
table: {}
};
}
render() {
const _props = this.props,
{
classes,
className: classNameProp,
children,
component: ComponentProp
} = _props,
other = _objectWithoutProperties(_props, ['classes', 'className', 'children', 'component']);
const className = classNames(classes.root, classNameProp);
return React.createElement(
ComponentProp,
_extends({ className: className }, other),
children
);
}
}
Table.defaultProps = {
component: 'table'
};
Table.childContextTypes = {
table: PropTypes.object
};
export default withStyles(styles, { name: 'MuiTable' })(Table);

View File

@@ -0,0 +1,15 @@
import * as React from 'react';
import { StandardProps } from '..';
export interface TableBodyProps extends StandardProps<
React.HTMLAttributes<HTMLTableSectionElement>,
TableBodyClassKey
> {}
export type TableBodyClassKey =
| 'root'
;
declare const TableBody: React.ComponentType<TableBodyProps>;
export default TableBody;

View File

@@ -0,0 +1,55 @@
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
export const styles = theme => ({
root: {
fontSize: theme.typography.pxToRem(13),
color: theme.palette.text.primary
}
});
class TableBody extends React.Component {
getChildContext() {
// eslint-disable-line class-methods-use-this
return {
table: {
body: true
}
};
}
render() {
const _props = this.props,
{
classes,
className: classNameProp,
children,
component: ComponentProp
} = _props,
other = _objectWithoutProperties(_props, ['classes', 'className', 'children', 'component']);
const className = classNames(classes.root, classNameProp);
return React.createElement(
ComponentProp,
_extends({ className: className }, other),
children
);
}
}
TableBody.defaultProps = {
component: 'tbody'
};
TableBody.childContextTypes = {
table: PropTypes.object
};
export default withStyles(styles, { name: 'MuiTableBody' })(TableBody);

View File

@@ -0,0 +1,39 @@
import * as React from 'react';
import { StandardProps } from '..';
/**
* `<TableCell>` will be rendered as an `<th>`or `<td>` depending
* on the context it is used in. Where context literally is the
* React `context`.
*
* Since it is not decided via prop, we have create loose typings
* here.
*/
export interface TableCellProps extends StandardProps<
React.ThHTMLAttributes<HTMLTableHeaderCellElement> & React.TdHTMLAttributes<HTMLTableDataCellElement>,
TableCellClassKey
> {
padding?: Padding;
numeric?: boolean;
}
export type Padding =
| 'default'
| 'checkbox'
| 'dense'
| 'none'
;
export type TableCellClassKey =
| 'root'
| 'numeric'
| 'head'
| 'paddingDefault'
| 'paddingCompact'
| 'paddingCheckbox'
| 'footer'
;
declare const TableCell: React.ComponentType<TableCellProps>;
export default TableCell;

View File

@@ -0,0 +1,85 @@
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
import { capitalizeFirstLetter } from '../utils/helpers';
export const styles = theme => ({
root: {
borderBottom: `1px solid ${theme.palette.text.lightDivider}`,
textAlign: 'left'
},
numeric: {
textAlign: 'right',
flexDirection: 'row-reverse' // can be dynamically inherited at runtime by contents
},
head: {
fontWeight: theme.typography.fontWeightMedium,
position: 'relative' // Workaround for Tooltip positioning issue.
},
paddingDefault: {
padding: `${theme.spacing.unit / 2}px ${theme.spacing.unit * 7}px ${theme.spacing.unit / 2}px ${theme.spacing.unit * 3}px`,
'&:last-child': {
paddingRight: theme.spacing.unit * 3
}
},
paddingDense: {
paddingRight: theme.spacing.unit * 3
},
paddingCheckbox: {
padding: '0 12px'
},
footer: {
borderBottom: 0
}
});
function TableCell(props, context) {
const {
classes,
className: classNameProp,
children,
numeric,
padding,
component
} = props,
other = _objectWithoutProperties(props, ['classes', 'className', 'children', 'numeric', 'padding', 'component']);
const { table } = context;
let Component;
if (component) {
Component = component;
} else {
Component = table && table.head ? 'th' : 'td';
}
const className = classNames(classes.root, {
[classes.numeric]: numeric,
[classes[`padding${capitalizeFirstLetter(padding)}`]]: padding !== 'none' && padding !== 'default',
[classes.paddingDefault]: padding !== 'none',
[classes.head]: table && table.head,
[classes.footer]: table && table.footer
}, classNameProp);
return React.createElement(
Component,
_extends({ className: className }, other),
children
);
}
TableCell.defaultProps = {
numeric: false,
padding: 'default'
};
TableCell.contextTypes = {
table: PropTypes.object.isRequired
};
export default withStyles(styles, { name: 'MuiTableCell' })(TableCell);

View File

@@ -0,0 +1,15 @@
import * as React from 'react';
import { StandardProps } from '..';
export interface TableFooterProps extends StandardProps<
React.HTMLAttributes<HTMLTableSectionElement>,
TableFooterClassKey
> {}
export type TableFooterClassKey =
| 'root'
;
declare const TableFooter: React.ComponentType<TableFooterProps>;
export default TableFooter;

View File

@@ -0,0 +1,54 @@
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
export const styles = theme => ({
root: {
fontSize: theme.typography.pxToRem(12),
color: theme.palette.text.secondary
}
});
class TableFooter extends React.Component {
getChildContext() {
// eslint-disable-line class-methods-use-this
return {
table: {
footer: true
}
};
}
render() {
const _props = this.props,
{
classes,
className: classNameProp,
children,
component: ComponentProp
} = _props,
other = _objectWithoutProperties(_props, ['classes', 'className', 'children', 'component']);
return React.createElement(
ComponentProp,
_extends({ className: classNames(classes.root, classNameProp) }, other),
children
);
}
}
TableFooter.defaultProps = {
component: 'tfoot'
};
TableFooter.childContextTypes = {
table: PropTypes.object
};
export default withStyles(styles, { name: 'MuiTableFooter' })(TableFooter);

View File

@@ -0,0 +1,15 @@
import * as React from 'react';
import { StandardProps } from '..';
export interface TableHeadProps extends StandardProps<
React.HTMLAttributes<HTMLTableSectionElement>,
TableHeadClassKey
> {}
export type TableHeadClassKey =
| 'root'
;
declare const TableHead: React.ComponentType<TableHeadProps>;
export default TableHead;

View File

@@ -0,0 +1,56 @@
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
export const styles = theme => ({
root: {
fontSize: theme.typography.pxToRem(12),
fontWeight: theme.typography.fontWeightMedium,
color: theme.palette.text.secondary
}
});
class TableHead extends React.Component {
getChildContext() {
// eslint-disable-line class-methods-use-this
return {
table: {
head: true
}
};
}
render() {
const _props = this.props,
{
classes,
className: classNameProp,
children,
component: ComponentProp
} = _props,
other = _objectWithoutProperties(_props, ['classes', 'className', 'children', 'component']);
const className = classNames(classes.root, classNameProp);
return React.createElement(
ComponentProp,
_extends({ className: className }, other),
children
);
}
}
TableHead.defaultProps = {
component: 'thead'
};
TableHead.childContextTypes = {
table: PropTypes.object
};
export default withStyles(styles, { name: 'MuiTableHead' })(TableHead);

View File

@@ -0,0 +1,38 @@
import * as React from 'react';
import { StandardProps } from '..';
import { TableCellProps, TableCellClassKey } from './TableCell.d'
interface LabelDisplayedRowsArgs {
from: number;
to: number;
count: number;
page: number;
}
export interface TablePaginationProps extends StandardProps<
TableCellProps,
TablePaginationClassKey
> {
count: number;
labelDisplayedRows?: (paginationInfo: LabelDisplayedRowsArgs) => Node;
labelRowsPerPage?: Node;
onChangePage: (event: React.MouseEvent<HTMLButtonElement> | null, page: number) => void;
onChangeRowsPerPage: React.ChangeEventHandler<HTMLTextAreaElement | HTMLInputElement>;
page: number;
rowsPerPage: number;
rowsPerPageOptions?: number[];
}
export type TablePaginationClassKey =
| TableCellClassKey
| 'cell'
| 'toolbar'
| 'spacer'
| 'select'
| 'selectRoot'
| 'actions'
;
declare const TablePagination: React.ComponentType<TablePaginationProps>;
export default TablePagination;

View File

@@ -0,0 +1,172 @@
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
// @inheritedComponent TableCell
import React from 'react';
import withStyles from '../styles/withStyles';
import IconButton from '../IconButton';
import Input from '../Input';
import { MenuItem } from '../Menu';
import Select from '../Select';
import TableCell from './TableCell';
import Toolbar from '../Toolbar';
import Typography from '../Typography';
import KeyboardArrowLeft from '../svg-icons/KeyboardArrowLeft';
import KeyboardArrowRight from '../svg-icons/KeyboardArrowRight';
export const styles = theme => ({
root: {
// Increase the specificity to override TableCell.
'&:last-child': {
padding: 0
}
},
toolbar: {
height: 56,
minHeight: 56,
paddingRight: 2
},
spacer: {
flex: '1 1 100%'
},
caption: {
flexShrink: 0
},
input: {
fontSize: 'inherit'
},
selectRoot: {
marginRight: theme.spacing.unit * 4
},
select: {
marginLeft: theme.spacing.unit,
width: 34,
textAlign: 'right',
paddingRight: 22,
color: theme.palette.text.secondary,
height: 32,
lineHeight: '32px'
},
actions: {
flexShrink: 0,
color: theme.palette.text.secondary,
marginLeft: theme.spacing.unit * 2.5
}
});
/**
* A `TableRow` based component for placing inside `TableFooter` for pagination.
*/
class TablePagination extends React.Component {
constructor(...args) {
var _temp;
return _temp = super(...args), this.handleBackButtonClick = event => {
this.props.onChangePage(event, this.props.page - 1);
}, this.handleNextButtonClick = event => {
this.props.onChangePage(event, this.props.page + 1);
}, _temp;
}
componentWillReceiveProps({ count, onChangePage, rowsPerPage }) {
const newLastPage = Math.max(0, Math.ceil(count / rowsPerPage) - 1);
if (this.props.page > newLastPage) {
onChangePage(null, newLastPage);
}
}
render() {
const _props = this.props,
{
classes,
component: Component,
colSpan: colSpanProp,
count,
labelDisplayedRows,
labelRowsPerPage,
onChangePage,
onChangeRowsPerPage,
page,
rowsPerPage,
rowsPerPageOptions,
theme
} = _props,
other = _objectWithoutProperties(_props, ['classes', 'component', 'colSpan', 'count', 'labelDisplayedRows', 'labelRowsPerPage', 'onChangePage', 'onChangeRowsPerPage', 'page', 'rowsPerPage', 'rowsPerPageOptions', 'theme']);
let colSpan;
if (Component === TableCell || Component === 'td') {
colSpan = colSpanProp || 9001; // col-span over everything
}
return React.createElement(
Component,
_extends({ className: classes.root, colSpan: colSpan }, other),
React.createElement(
Toolbar,
{ className: classes.toolbar },
React.createElement('div', { className: classes.spacer }),
React.createElement(
Typography,
{ type: 'caption', className: classes.caption },
labelRowsPerPage
),
React.createElement(
Select,
{
classes: { root: classes.selectRoot, select: classes.select },
InputClasses: {
root: classes.input
},
input: React.createElement(Input, { disableUnderline: true }),
value: rowsPerPage,
onChange: onChangeRowsPerPage
},
rowsPerPageOptions.map(rowsPerPageOption => React.createElement(
MenuItem,
{ key: rowsPerPageOption, value: rowsPerPageOption },
rowsPerPageOption
))
),
React.createElement(
Typography,
{ type: 'caption', className: classes.caption },
labelDisplayedRows({
from: count === 0 ? 0 : page * rowsPerPage + 1,
to: Math.min(count, (page + 1) * rowsPerPage),
count,
page
})
),
React.createElement(
'div',
{ className: classes.actions },
React.createElement(
IconButton,
{ onClick: this.handleBackButtonClick, disabled: page === 0 },
theme.direction === 'rtl' ? React.createElement(KeyboardArrowRight, null) : React.createElement(KeyboardArrowLeft, null)
),
React.createElement(
IconButton,
{
onClick: this.handleNextButtonClick,
disabled: page >= Math.ceil(count / rowsPerPage) - 1
},
theme.direction === 'rtl' ? React.createElement(KeyboardArrowLeft, null) : React.createElement(KeyboardArrowRight, null)
)
)
)
);
}
}
TablePagination.defaultProps = {
component: TableCell,
labelRowsPerPage: 'Rows per page:',
labelDisplayedRows: ({ from, to, count }) => `${from}-${to} of ${count}`,
rowsPerPageOptions: [5, 10, 25]
};
export default withStyles(styles, { withTheme: true, name: 'MuiTablePagination' })(TablePagination);

View File

@@ -0,0 +1,22 @@
import * as React from 'react';
import { StandardProps } from '..';
export interface TableRowProps extends StandardProps<
React.HTMLAttributes<HTMLTableRowElement>,
TableRowClassKey
> {
hover?: boolean;
selected?: boolean;
}
export type TableRowClassKey =
| 'root'
| 'head'
| 'footer'
| 'hover'
| 'selected'
;
declare const TableRow: React.ComponentType<TableRowProps>;
export default TableRow;

View File

@@ -0,0 +1,77 @@
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
export const styles = theme => ({
root: {
color: 'inherit',
display: 'table-row',
height: 48,
'&:focus': {
outline: 'none'
},
verticalAlign: 'middle'
},
head: {
height: 56
},
footer: {
height: 56
},
hover: {
'&:hover': {
background: theme.palette.background.contentFrame
}
},
selected: {
background: theme.palette.background.appBar
}
});
/**
* Will automatically set dynamic row height
* based on the material table element parent (head, body, etc).
*/
function TableRow(props, context) {
const {
classes,
className: classNameProp,
children,
component: Component,
hover,
selected
} = props,
other = _objectWithoutProperties(props, ['classes', 'className', 'children', 'component', 'hover', 'selected']);
const { table } = context;
const className = classNames(classes.root, {
[classes.head]: table && table.head,
[classes.footer]: table && table.footer,
[classes.hover]: table && hover,
[classes.selected]: table && selected
}, classNameProp);
return React.createElement(
Component,
_extends({ className: className }, other),
children
);
}
TableRow.defaultProps = {
hover: false,
selected: false,
component: 'tr'
};
TableRow.contextTypes = {
table: PropTypes.object
};
export default withStyles(styles, { name: 'MuiTableRow' })(TableRow);

View File

@@ -0,0 +1,23 @@
import * as React from 'react';
import { StandardProps } from '..';
import { ButtonBaseProps, ButtonBaseClassKey } from '../ButtonBase';
export interface TableSortLabelProps extends StandardProps<
ButtonBaseProps,
TableSortLabelClassKey
> {
active?: boolean;
direction?: 'asc' | 'desc';
}
export type TableSortLabelClassKey =
| ButtonBaseClassKey
| 'active'
| 'icon'
| 'desc'
| 'asc'
;
declare const TableSortLabel: React.ComponentType<TableSortLabelProps>;
export default TableSortLabel;

View File

@@ -0,0 +1,80 @@
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
// @inheritedComponent ButtonBase
import React from 'react';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
import ButtonBase from '../ButtonBase';
import ArrowDownwardIcon from '../svg-icons/ArrowDownward';
export const styles = theme => ({
root: {
cursor: 'pointer',
display: 'inline-flex',
justifyContent: 'flex-start',
flexDirection: 'inherit',
alignItems: 'center',
'&:hover': {
color: theme.palette.text.primary
},
'&:focus': {
color: theme.palette.text.primary
}
},
active: {
color: theme.palette.text.primary,
'& $icon': {
opacity: 1
}
},
icon: {
height: 16,
marginRight: 4,
marginLeft: 4,
opacity: 0,
transition: theme.transitions.create(['opacity', 'transform'], {
duration: theme.transitions.duration.shorter
}),
userSelect: 'none',
width: 16
},
desc: {
transform: 'rotate(0deg)'
},
asc: {
transform: 'rotate(180deg)'
}
});
/**
* A button based label for placing inside `TableCell` for column sorting.
*/
function TableSortLabel(props) {
const { active, classes, className: classNameProp, children, direction } = props,
other = _objectWithoutProperties(props, ['active', 'classes', 'className', 'children', 'direction']);
const className = classNames(classes.root, {
[classes.active]: active
}, classNameProp);
const iconClassName = classNames(classes.icon, {
[classes[direction]]: !!direction
});
return React.createElement(
ButtonBase,
_extends({ className: className, component: 'span', disableRipple: true }, other),
children,
React.createElement(ArrowDownwardIcon, { className: iconClassName })
);
}
TableSortLabel.defaultProps = {
active: false,
direction: 'desc'
};
export default withStyles(styles, { name: 'MuiTableSortLabel' })(TableSortLabel);

View File

@@ -0,0 +1,16 @@
export { default } from './Table';
export * from './Table';
export { default as TableFooter } from './TableFooter';
export * from './TableFooter';
export { default as TableHead } from './TableHead';
export * from './TableHead';
export { default as TableBody } from './TableBody';
export * from './TableBody';
export { default as TablePagination } from './TablePagination';
export * from './TablePagination';
export { default as TableRow } from './TableRow';
export * from './TableRow';
export { default as TableCell } from './TableCell';
export * from './TableCell';
export { default as TableSortLabel } from './TableSortLabel';
export * from './TableSortLabel';

View File

@@ -0,0 +1,8 @@
export { default } from './Table';
export { default as TableBody } from './TableBody';
export { default as TableCell } from './TableCell';
export { default as TableFooter } from './TableFooter';
export { default as TableHead } from './TableHead';
export { default as TablePagination } from './TablePagination';
export { default as TableRow } from './TableRow';
export { default as TableSortLabel } from './TableSortLabel';