diff --git a/build/config/eslint.json b/build/config/eslint.json index 27b7b20ca..a38d149ca 100644 --- a/build/config/eslint.json +++ b/build/config/eslint.json @@ -34,7 +34,7 @@ "quote-props": ["error", "consistent-as-needed", { "keywords": true }], "no-param-reassign": ["error", { "props": false }], "semi": "off", - "import/no-unresolved": ["error", {"ignore": ["nylas-exports", "nylas-component-kit", "electron", "nylas-store", "react-dom/server", "nylas-observables", "windows-shortcuts", "moment-round", "chrono-node", "event-kit"]}], + "import/no-unresolved": ["error", {"ignore": ["nylas-exports", "nylas-component-kit", "electron", "nylas-store", "react-dom/server", "nylas-observables", "windows-shortcuts", "moment-round", "chrono-node", "event-kit", "enzyme"]}], "react/no-multi-comp": "off", "react/prop-types": ["error", {"ignore": ["children"]}], "react/sort-comp": "error" diff --git a/internal_packages/composer/lib/decorators/inflates-draft-client-id.es6 b/internal_packages/composer/lib/decorators/inflates-draft-client-id.es6 index f19481b7c..71fcb6d88 100644 --- a/internal_packages/composer/lib/decorators/inflates-draft-client-id.es6 +++ b/internal_packages/composer/lib/decorators/inflates-draft-client-id.es6 @@ -94,7 +94,7 @@ function InflatesDraftClientId(ComposedComponent) { render() { if (!this.state.draft) { - return ; + return ; } return ; } diff --git a/spec/components/selectable-table-spec.jsx b/spec/components/selectable-table-spec.jsx index 8cfe9b249..ac4342a02 100644 --- a/spec/components/selectable-table-spec.jsx +++ b/spec/components/selectable-table-spec.jsx @@ -231,8 +231,8 @@ describe('SelectableTable Components', () => { }); it('renders with the correct props', () => { - const RowRenderer = () => - const CellRenderer = () => + const RowRenderer = () => + const CellRenderer = () => const onSetSelection = () => {} const onShiftSelection = () => {} const extraProps = {p1: 'p1'} diff --git a/spec/components/table/table-spec.jsx b/spec/components/table/table-spec.jsx index 514a5d473..a82349546 100644 --- a/spec/components/table/table-spec.jsx +++ b/spec/components/table/table-spec.jsx @@ -12,23 +12,23 @@ describe('Table Components', () => { }); it('renders a th when is header', () => { - const element = shallow() + const element = shallow() expect(element.type()).toEqual('th') }); it('renders a td when is not header', () => { - const element = shallow() + const element = shallow() expect(element.type()).toEqual('td') }); it('renders extra classNames', () => { - const element = shallow() + const element = shallow() expect(element.hasClass('my-cell')).toBe(true) }); it('passes additional props to cell', () => { const handler = () => {} - const element = shallow() + const element = shallow() expect(element.prop('onClick')).toBe(handler) }); }); @@ -116,7 +116,7 @@ describe('Table Components', () => { describe('Table', () => { function renderTable(props = {}) { - return shallow() + return shallow(
) } it('renders extra classNames', () => { @@ -163,7 +163,7 @@ describe('Table Components', () => { describe('renderRow', () => { it('renders row with the given RowRenderer', () => { - const RowRenderer = (props) =>
+ const RowRenderer = (props) =>
const table = renderTable({RowRenderer}) const Renderer = table.instance().renderRow const row = shallow() @@ -171,7 +171,7 @@ describe('Table Components', () => { }); it('passes the correct props to the row when displayHeader is true', () => { - const CellRenderer = (props) =>
+ const CellRenderer = (props) =>
const extraProps = {p1: 'p1'} const table = renderTable({displayHeader: true, displayNumbers: true, extraProps, CellRenderer}) const Renderer = table.instance().renderRow diff --git a/src/components/editable-table.jsx b/src/components/editable-table.jsx index 7b0c10c00..d8501aae9 100644 --- a/src/components/editable-table.jsx +++ b/src/components/editable-table.jsx @@ -148,66 +148,66 @@ export class EditableTableCell extends Component { } } -export default class EditableTable extends Component { - static displayName = 'EditableTable' +function EditableTable(props) { + const { + inputProps, + InputRenderer, + onCellEdited, + onAddRow, + onRemoveRow, + onAddColumn, + onRemoveColumn, + ...otherProps, + } = props - static propTypes = { - tableDataSource: SelectableTable.propTypes.tableDataSource, - inputProps: PropTypes.object, - InputRenderer: PropTypes.any, - onCellEdited: PropTypes.func.isRequired, - onAddColumn: PropTypes.func, - onRemoveColumn: PropTypes.func, - onAddRow: PropTypes.func, - onRemoveRow: PropTypes.func, - } - - render() { - const { - inputProps, - InputRenderer, - onCellEdited, + const tableProps = { + ...otherProps, + className: "editable-table", + extraProps: { onAddRow, onRemoveRow, - onAddColumn, - onRemoveColumn, - ...otherProps, - } = this.props + onCellEdited, + inputProps, + InputRenderer, + }, + CellRenderer: EditableTableCell, + } - const tableProps = { - ...otherProps, - className: "editable-table", - extraProps: { - onAddRow, - onRemoveRow, - onCellEdited, - inputProps, - InputRenderer, - }, - CellRenderer: EditableTableCell, - } - - if (!onAddColumn || !onRemoveColumn) { - return - } - return ( -
- -
-
- -
-
- -
+ if (!onAddColumn || !onRemoveColumn) { + return + } + return ( +
+ +
+
+ +
+
+
- ) - } +
+ ) } + +EditableTable.displayName = 'EditableTable' + +EditableTable.propTypes = { + tableDataSource: SelectableTable.propTypes.tableDataSource, + inputProps: PropTypes.object, + InputRenderer: PropTypes.any, + onCellEdited: PropTypes.func.isRequired, + onAddColumn: PropTypes.func, + onRemoveColumn: PropTypes.func, + onAddRow: PropTypes.func, + onRemoveRow: PropTypes.func, +} + +export default EditableTable diff --git a/src/components/table/table.jsx b/src/components/table/table.jsx index 3ea5fd041..b382cb3a9 100644 --- a/src/components/table/table.jsx +++ b/src/components/table/table.jsx @@ -60,11 +60,10 @@ const TablePropTypes = { } export function TableCell(props) { - const {className, isHeader, children} = props; - const continuedProps = _.omit(props, "className", "isHeader", "children") + const {className, isHeader, children, ...extraProps} = props; const CellTag = isHeader ? 'th' : 'td' return ( - + {children} ) @@ -73,7 +72,6 @@ export function TableCell(props) { TableCell.propTypes = { isHeader: PropTypes.bool, className: PropTypes.string, - children: PropTypes.children, }; export class TableRow extends Component { diff --git a/src/global/nylas-component-kit.coffee b/src/global/nylas-component-kit.coffee index 89249518d..b46fef15b 100644 --- a/src/global/nylas-component-kit.coffee +++ b/src/global/nylas-component-kit.coffee @@ -11,7 +11,7 @@ class NylasComponentKit @loadFrom = (prop, path) -> Object.defineProperty @prototype, prop, get: -> - exported = NylasComponentKit.default(require "../components/#{path}") + exported = require "../components/#{path}" return exported[prop] @loadDeprecated = (prop, path, {instead} = {}) -> @@ -60,13 +60,13 @@ class NylasComponentKit @load "DateInput", "date-input" @load "DatePicker", "date-picker" @load "TimePicker", "time-picker" - @loadFrom "Table", "table/table" + @load "Table", "table/table" @loadFrom "TableRow", "table/table" @loadFrom "TableCell", "table/table" - @loadFrom "SelectableTable", "selectable-table" + @load "SelectableTable", "selectable-table" @loadFrom "SelectableTableRow", "selectable-table" @loadFrom "SelectableTableCell", "selectable-table" - @loadFrom "EditableTable", "editable-table" + @load "EditableTable", "editable-table" @loadFrom "EditableTableCell", "editable-table" @load "LazyRenderedList", "lazy-rendered-list" diff --git a/src/pro b/src/pro index 5ea51b035..6e7135d50 160000 --- a/src/pro +++ b/src/pro @@ -1 +1 @@ -Subproject commit 5ea51b035478ea2912257f3a57d876d3e0c335b9 +Subproject commit 6e7135d50ed005e4b0e9a5ac54b8323ef031e0bd