From 4b073f689534f5771af5d016bddf2a5bcbf0ebe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andre=CC=81=20Rivet?= Date: Thu, 19 Sep 2019 15:19:40 -0400 Subject: [PATCH 1/5] - isolate row and column selection by table - additional tests against tables without id --- demo/App.tsx | 18 +- demo/AppMode.ts | 4 +- src/dash-table/components/CellFactory.tsx | 2 + src/dash-table/components/HeaderFactory.tsx | 2 + src/dash-table/derived/cell/operations.tsx | 7 +- src/dash-table/derived/header/content.tsx | 3 +- tests/cypress/src/DashTable.ts | 172 ++++++++++++++---- .../standalone/select_row_column_test.ts | 79 ++++++++ .../tests/standalone/select_row_test.ts | 32 ---- 9 files changed, 237 insertions(+), 82 deletions(-) create mode 100644 tests/cypress/tests/standalone/select_row_column_test.ts delete mode 100644 tests/cypress/tests/standalone/select_row_test.ts diff --git a/demo/App.tsx b/demo/App.tsx index 78c45ab60..e7f473eb6 100644 --- a/demo/App.tsx +++ b/demo/App.tsx @@ -50,14 +50,18 @@ class App extends Component { }} /> ); } else if (mode === AppMode.TaleOfTwoTables) { - const props: any = {}; - Object.entries(this.state.tableProps).forEach(([key, value]) => { - props[key] = this.propCache.get(key)(value); - }); + if (!this.state.tableProps2) { + this.setState({ + tableProps2: R.clone(this.state.tableProps) + }); + } - return (); + const baseId = this.state.tableProps2 && this.state.tableProps2.id; + + return (this.state.tableProps2 ? : null); } } diff --git a/demo/AppMode.ts b/demo/AppMode.ts index cfdbbcbd9..3a293b053 100644 --- a/demo/AppMode.ts +++ b/demo/AppMode.ts @@ -36,7 +36,8 @@ export enum AppFlavor { FixedColumnPlus1 = 'fixed_columns={ "headers": true, "data": 1 }', FixedRow = 'fixed_rows={ "headers": true }', FixedRowPlus1 = 'fixed_rows={ "headers": true, "data": 1 }', - Merged = 'merge_duplicate_headers=true' + Merged = 'merge_duplicate_headers=true', + NoId = 'id=null' } export const ReadWriteModes = [ @@ -346,6 +347,7 @@ function getModeState(mode: string | null) { case AppMode.SingleHeaders: return getSingleHeaderState(); case AppMode.TaleOfTwoTables: + return getActionableState(); case AppMode.Default: default: return getDefaultState(); diff --git a/src/dash-table/components/CellFactory.tsx b/src/dash-table/components/CellFactory.tsx index 1d866ae2a..bafb906fd 100644 --- a/src/dash-table/components/CellFactory.tsx +++ b/src/dash-table/components/CellFactory.tsx @@ -42,6 +42,7 @@ export default class CellFactory { dropdown, data, dropdown_data, + id, is_focused, row_deletable, row_selectable, @@ -94,6 +95,7 @@ export default class CellFactory { ); const operations = this.cellOperations( + id, data, virtualized.data, virtualized.indices, diff --git a/src/dash-table/components/HeaderFactory.tsx b/src/dash-table/components/HeaderFactory.tsx index 64b536b56..be8f03eeb 100644 --- a/src/dash-table/components/HeaderFactory.tsx +++ b/src/dash-table/components/HeaderFactory.tsx @@ -40,6 +40,7 @@ export default class HeaderFactory { columns, data, hidden_columns, + id, map, merge_duplicate_headers, page_action, @@ -93,6 +94,7 @@ export default class HeaderFactory { ); const contents = this.headerContent( + id, visibleColumns, columns, hidden_columns, diff --git a/src/dash-table/derived/cell/operations.tsx b/src/dash-table/derived/cell/operations.tsx index 3a70ad6c7..89f53bec3 100644 --- a/src/dash-table/derived/cell/operations.tsx +++ b/src/dash-table/derived/cell/operations.tsx @@ -33,7 +33,7 @@ function deleteRow(idx: number, data: Data, selectedRows: number[]) { return newProps; } -function rowSelectCell(idx: number, rowSelectable: Selection, selectedRows: number[], setProps: SetProps, data: Data) { +function rowSelectCell(id: string, idx: number, rowSelectable: Selection, selectedRows: number[], setProps: SetProps, data: Data) { return ( { const newSelectedRows = rowSelectable === 'single' ? @@ -73,6 +73,7 @@ function rowDeleteCell(doDelete: () => any) { } const getter = ( + id: string, data: Data, viewportData: Data, viewportIndices: Indices, @@ -83,7 +84,7 @@ const getter = ( ): JSX.Element[][] => R.addIndex(R.map)( (_, rowIndex) => [ ...(rowDeletable ? [rowDeleteCell(() => setProps(deleteRow(viewportIndices[rowIndex], data, selectedRows)))] : []), - ...(rowSelectable ? [rowSelectCell(viewportIndices[rowIndex], rowSelectable, selectedRows, setProps, data)] : []) + ...(rowSelectable ? [rowSelectCell(id, viewportIndices[rowIndex], rowSelectable, selectedRows, setProps, data)] : []) ], viewportData ); diff --git a/src/dash-table/derived/header/content.tsx b/src/dash-table/derived/header/content.tsx index b4d0769da..4a3a413c6 100644 --- a/src/dash-table/derived/header/content.tsx +++ b/src/dash-table/derived/header/content.tsx @@ -150,6 +150,7 @@ function getSortingIcon(columnId: ColumnId, sortBy: SortBy) { } function getter( + id: string, visibleColumns: Columns, columns: Columns, hiddenColumns: string[] | undefined, @@ -230,7 +231,7 @@ function getter( column_selectable === 'single', !allSelected )} - name='column-header--select' + name={`column-select-${id}`} type={column_selectable === 'single' ? 'radio' : 'checkbox' diff --git a/tests/cypress/src/DashTable.ts b/tests/cypress/src/DashTable.ts index 975ac3f01..d4aa707ea 100644 --- a/tests/cypress/src/DashTable.ts +++ b/tests/cypress/src/DashTable.ts @@ -19,90 +19,94 @@ const getSelector = (state: State) => { } }; -export default class DashTable { - static getCell(row: number, column: number, editable: State = State.Ready) { - return cy.get(`#table ${getSelector(editable)} tbody tr td.column-${column}`).eq(row); +export class DashTableHelper { + constructor(private readonly id) { + + } + + public getCell(row: number, column: number, editable: State = State.Ready) { + return cy.get(`#${this.id} ${getSelector(editable)} tbody tr td.column-${column}`).eq(row); } - static getCellById(row: number, column: string, editable: State = State.Ready) { - return cy.get(`#table ${getSelector(editable)} tbody tr td[data-dash-column="${column}"]`).eq(row); + public getCellById(row: number, column: string, editable: State = State.Ready) { + return cy.get(`#${this.id} ${getSelector(editable)} tbody tr td[data-dash-column="${column}"]`).eq(row); } - static getFilter(column: number, editable: State = State.Ready) { - return cy.get(`#table ${getSelector(editable)} tbody tr th.dash-filter.column-${column}`); + public getFilter(column: number, editable: State = State.Ready) { + return cy.get(`#${this.id} ${getSelector(editable)} tbody tr th.dash-filter.column-${column}`); } - static getFilterById(column: string, editable: State = State.Ready) { - return cy.get(`#table ${getSelector(editable)} tbody tr th.dash-filter[data-dash-column="${column}"]`); + public getFilterById(column: string, editable: State = State.Ready) { + return cy.get(`#${this.id} ${getSelector(editable)} tbody tr th.dash-filter[data-dash-column="${column}"]`); } - static getHeader(row: number, column: number, editable: State = State.Ready) { - return cy.get(`#table ${getSelector(editable)} tbody tr th.dash-header.column-${column}`).eq(row); + public getHeader(row: number, column: number, editable: State = State.Ready) { + return cy.get(`#${this.id} ${getSelector(editable)} tbody tr th.dash-header.column-${column}`).eq(row); } - static getHeaderById(row: number, column: string, editable: State = State.Ready) { - return cy.get(`#table ${getSelector(editable)} tbody tr th.dash-header[data-dash-column="${column}"]`).eq(row); + public getHeaderById(row: number, column: string, editable: State = State.Ready) { + return cy.get(`#${this.id} ${getSelector(editable)} tbody tr th.dash-header[data-dash-column="${column}"]`).eq(row); } - static focusCell(row: number, column: number) { + public focusCell(row: number, column: number) { // somehow we need to scrollIntoView AFTER click, or it doesn't // work right. Why? return this.getCell(row, column).click().scrollIntoView(); } - static focusCellById(row: number, column: string) { + public focusCellById(row: number, column: string) { return this.getCellById(row, column).click().scrollIntoView(); } - static clearColumnById(row: number, column: string, editable: State = State.Ready) { - return cy.get(`#table ${getSelector(editable)} tbody tr th.dash-header[data-dash-column="${column}"] .column-header--clear`).eq(row).click(); + public clearColumnById(row: number, column: string, editable: State = State.Ready) { + return cy.get(`#${this.id} ${getSelector(editable)} tbody tr th.dash-header[data-dash-column="${column}"] .column-header--clear`).eq(row).click(); } - static deleteColumnById(row: number, column: string, editable: State = State.Ready) { - return cy.get(`#table ${getSelector(editable)} tbody tr th.dash-header[data-dash-column="${column}"] .column-header--delete`).eq(row).click(); + public deleteColumnById(row: number, column: string, editable: State = State.Ready) { + return cy.get(`#${this.id} ${getSelector(editable)} tbody tr th.dash-header[data-dash-column="${column}"] .column-header--delete`).eq(row).click(); } - static hideColumnById(row: number, column: string, editable: State = State.Ready) { - return cy.get(`#table ${getSelector(editable)} tbody tr th.dash-header[data-dash-column="${column}"] .column-header--hide`).eq(row).click(); + public hideColumnById(row: number, column: string, editable: State = State.Ready) { + return cy.get(`#${this.id} ${getSelector(editable)} tbody tr th.dash-header[data-dash-column="${column}"] .column-header--hide`).eq(row).click(); } - static getSelectColumnById(row: number, column: string, editable: State = State.Ready) { - return cy.get(`#table ${getSelector(editable)} tbody tr th.dash-header[data-dash-column="${column}"] .column-header--select input`).eq(row); + public getSelectColumnById(row: number, column: string, editable: State = State.Ready) { + return cy.get(`#${this.id} ${getSelector(editable)} tbody tr th.dash-header[data-dash-column="${column}"] .column-header--select input`).eq(row); } - static selectColumnById(row: number, column: string) { - return DashTable.getSelectColumnById(row, column).click(); + public selectColumnById(row: number, column: string) { + return this.getSelectColumnById(row, column).click(); } - static getDelete(row: number, editable: State = State.Ready) { - return cy.get(`#table ${getSelector(editable)} tbody tr td.dash-delete-cell`).eq(row); + public getDelete(row: number, editable: State = State.Ready) { + return cy.get(`#${this.id} ${getSelector(editable)} tbody tr td.dash-delete-cell`).eq(row); } - static getSelect(row: number, editable: State = State.Ready) { - return cy.get(`#table ${getSelector(editable)} tbody tr td.dash-select-cell`).eq(row); + public getSelect(row: number, editable: State = State.Ready) { + return cy.get(`#${this.id} ${getSelector(editable)} tbody tr td.dash-select-cell`).eq(row); } - static getActiveCell(editable: State = State.Ready) { - return cy.get(`#table ${getSelector(editable)} tbody td.focused`); + public getActiveCell(editable: State = State.Ready) { + return cy.get(`#${this.id} ${getSelector(editable)} tbody td.focused`); } - static getSelectedCells(editable: State = State.Ready) { - return cy.get(`#table ${getSelector(editable)} tbody td.cell--selected`); + public getSelectedCells(editable: State = State.Ready) { + return cy.get(`#${this.id} ${getSelector(editable)} tbody td.cell--selected`); } - static scrollToTop() { + public scrollToTop() { cy.get(`.cell.cell-1-1.dash-fixed-content`).invoke(`outerHeight`).then(height => { cy.scrollTo(0, -height); }); } - static scrollToBottom() { + public scrollToBottom() { cy.get(`.cell.cell-1-1.dash-fixed-content`).invoke(`outerHeight`).then(height => { cy.scrollTo(0, height); }); } - static getCellInLastRowOfColumn(column: number) { + public getCellInLastRowOfColumn(column: number) { const cellInLastRow = cy.get(`td.dash-cell.column-${column}`).last().then(elem => { const lastRow = elem ? elem.attr(`data-dash-row`) : undefined; return lastRow ? cy.get(`td.dash-cell.column-${column}[data-dash-row="${lastRow}"`) : undefined; @@ -110,13 +114,105 @@ export default class DashTable { return cellInLastRow; } - static getCellFromDataDash(row: number, column: number) { + public getCellFromDataDash(row: number, column: number) { return cy.get(`td.column-${column}[data-dash-row="${row}"]`); } - static toggleScroll(toggled: boolean) { + public toggleScroll(toggled: boolean) { cy.get('.row-1').then($el => { $el[0].style.overflow = toggled ? '' : 'unset'; }); } } + +export default class DashTable { + private static __helper = new DashTableHelper('table'); + + static getCell(_row: number, _column: number, _editable: State = State.Ready) { + return this.__helper.getCell.apply(this.__helper, Array.from(arguments) as any); + } + + static getCellById(_row: number, _column: string, _editable: State = State.Ready) { + return this.__helper.getCellById.apply(this.__helper, Array.from(arguments) as any); + } + + static getFilter(_column: number, _editable: State = State.Ready) { + return this.__helper.getFilter.apply(this.__helper, Array.from(arguments) as any); + } + + static getFilterById(_column: string, _editable: State = State.Ready) { + return this.__helper.getFilterById.apply(this.__helper, Array.from(arguments) as any); + } + + static getHeader(_row: number, _column: number, _editable: State = State.Ready) { + return this.__helper.getHeader.apply(this.__helper, Array.from(arguments) as any); + } + + static getHeaderById(_row: number, _column: string, _editable: State = State.Ready) { + return this.__helper.getHeaderById.apply(this.__helper, Array.from(arguments) as any); + } + + static focusCell(_row: number, _column: number) { + return this.__helper.focusCell.apply(this.__helper, Array.from(arguments) as any); + } + + static focusCellById(_row: number, _column: string) { + return this.__helper.focusCellById.apply(this.__helper, Array.from(arguments) as any); + } + + static clearColumnById(_row: number, _column: string, _editable: State = State.Ready) { + return this.__helper.clearColumnById.apply(this.__helper, Array.from(arguments) as any); + } + + static deleteColumnById(_row: number, _column: string, _editable: State = State.Ready) { + return this.__helper.deleteColumnById.apply(this.__helper, Array.from(arguments) as any); + } + + static hideColumnById(_row: number, _column: string, _editable: State = State.Ready) { + return this.__helper.hideColumnById.apply(this.__helper, Array.from(arguments) as any); + } + + static getSelectColumnById(_row: number, _column: string, _editable: State = State.Ready) { + return this.__helper.getSelectColumnById.apply(this.__helper, Array.from(arguments) as any); + } + + static selectColumnById(_row: number, _column: string) { + return this.__helper.selectColumnById.apply(this.__helper, Array.from(arguments) as any); + } + + static getDelete(_row: number, _editable: State = State.Ready) { + return this.__helper.getDelete.apply(this.__helper, Array.from(arguments) as any); + } + + static getSelect(_row: number, _editable: State = State.Ready) { + return this.__helper.getSelect.apply(this.__helper, Array.from(arguments) as any); + } + + static getActiveCell(_editable: State = State.Ready) { + return this.__helper.getActiveCell.apply(this.__helper, Array.from(arguments) as any); + } + + static getSelectedCells(_editable: State = State.Ready) { + return this.__helper.getSelectedCells.apply(this.__helper, Array.from(arguments) as any); + } + + static scrollToTop() { + return this.__helper.scrollToTop.apply(this.__helper, Array.from(arguments) as any); + } + + static scrollToBottom() { + return this.__helper.scrollToBottom.apply(this.__helper, Array.from(arguments) as any); + } + + static getCellInLastRowOfColumn(_column: number) { + return this.__helper.getCellInLastRowOfColumn.apply(this.__helper, Array.from(arguments) as any); + } + + static getCellFromDataDash(_row: number, _column: number) { + return this.__helper.getCellFromDataDash.apply(this.__helper, Array.from(arguments) as any); + } + + static toggleScroll(_toggled: boolean) { + return this.__helper.toggleScroll.apply(this.__helper, Array.from(arguments) as any); + } +} diff --git a/tests/cypress/tests/standalone/select_row_column_test.ts b/tests/cypress/tests/standalone/select_row_column_test.ts new file mode 100644 index 000000000..d3968ad51 --- /dev/null +++ b/tests/cypress/tests/standalone/select_row_column_test.ts @@ -0,0 +1,79 @@ +import DashTable, { DashTableHelper } from 'cypress/DashTable'; + +import { BasicModes, AppMode, AppFlavor } from 'demo/AppMode'; + +Object.values(BasicModes).forEach(mode => { + describe(`select row, mode=${mode}`, () => { + beforeEach(() => { + cy.visit(`http://localhost:8080?mode=${mode}`); + DashTable.toggleScroll(false); + }); + + describe('fe pagination & sort', () => { + it('can select row', () => { + DashTable.getSelect(0).within(() => cy.get('input').click()); + DashTable.getSelect(0).within(() => cy.get('input').should('be.checked')); + }); + + it('can select row when sorted', () => { + cy.get('tr th.column-0 .column-header--sort').last().click({ force: true }); + DashTable.getSelect(0).within(() => cy.get('input').click()); + DashTable.getSelect(0).within(() => cy.get('input').should('be.checked')); + }); + + it('select, sort, new row is not selected', () => { + DashTable.getSelect(0).within(() => cy.get('input').click()); + DashTable.getSelect(0).within(() => cy.get('input').should('be.checked')); + cy.get('tr th.column-0 .column-header--sort').last().click({ force: true }).click({ force: true }); + DashTable.getSelect(0).within(() => cy.get('input').should('not.be.checked')); + }); + }); + }); +}); + +describe('select rows & columns in multiple tables without id', () => { + let table1: DashTableHelper; + let table2: DashTableHelper; + + beforeEach(() => { + cy.visit(`http://localhost:8080?mode=${AppMode.TaleOfTwoTables}&flavor=${[AppFlavor.ColumnSelectableSingle,AppFlavor.NoId].join(';')}`).then(() => { + const ids: string[] = []; + return cy.get('.dash-spreadsheet-container').parent().each(el => { + const id = el.attr('id'); + if (id) { + ids.push(id); + } + }).then(() => ids); + }).then(ids => { + cy.log('table ids', ids); + expect(ids.length).to.equal(2); + + table1 = new DashTableHelper(ids[0]); + table2 = new DashTableHelper(ids[1]); + }); + + DashTable.toggleScroll(false); + }); + + it('can select a row in both tables', () => { + table1.getSelect(0).within(() => cy.get('input').click()); + table1.getSelect(0).within(() => cy.get('input').should('be.checked')); + + table2.getSelect(1).within(() => cy.get('input').click()); + table2.getSelect(1).within(() => cy.get('input').should('be.checked')); + + table1.getSelect(0).within(() => cy.get('input').should('be.checked')); + table1.getSelect(1).within(() => cy.get('input').should('not.be.checked')); + }); + + it('can select a column in both tables', () => { + table1.selectColumnById(0, 'ccc'); + table1.getSelectColumnById(2, 'ccc').should('be.checked'); + + table2.selectColumnById(0, 'rows'); + table2.getSelectColumnById(2, 'rows').should('be.checked'); + + table1.getSelectColumnById(2, 'ccc').should('be.checked'); + table1.getSelectColumnById(2, 'rows').should('not.be.checked'); + }); +}); \ No newline at end of file diff --git a/tests/cypress/tests/standalone/select_row_test.ts b/tests/cypress/tests/standalone/select_row_test.ts deleted file mode 100644 index 2d6715f44..000000000 --- a/tests/cypress/tests/standalone/select_row_test.ts +++ /dev/null @@ -1,32 +0,0 @@ -import DashTable from 'cypress/DashTable'; - -import { BasicModes } from 'demo/AppMode'; - -Object.values(BasicModes).forEach(mode => { - describe(`select row, mode=${mode}`, () => { - beforeEach(() => { - cy.visit(`http://localhost:8080?mode=${mode}`); - DashTable.toggleScroll(false); - }); - - describe('fe pagination & sort', () => { - it('can select row', () => { - DashTable.getSelect(0).within(() => cy.get('input').click()); - DashTable.getSelect(0).within(() => cy.get('input').should('be.checked')); - }); - - it('can select row when sorted', () => { - cy.get('tr th.column-0 .column-header--sort').last().click({ force: true }); - DashTable.getSelect(0).within(() => cy.get('input').click()); - DashTable.getSelect(0).within(() => cy.get('input').should('be.checked')); - }); - - it('select, sort, new row is not selected', () => { - DashTable.getSelect(0).within(() => cy.get('input').click()); - DashTable.getSelect(0).within(() => cy.get('input').should('be.checked')); - cy.get('tr th.column-0 .column-header--sort').last().click({ force: true }).click({ force: true }); - DashTable.getSelect(0).within(() => cy.get('input').should('not.be.checked')); - }); - }); - }); -}); \ No newline at end of file From 4fb2bd2d1f19b4a3974e1838deb43b463074561d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andre=CC=81=20Rivet?= Date: Thu, 19 Sep 2019 15:51:10 -0400 Subject: [PATCH 2/5] changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5537fff0d..da249b6f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). - The `datestartswith` relational operator now supports number comparison - Fixed a bug where the implicit operator for columns was `equal` instead of the expected default for the column type +[#591](https://github.com/plotly/dash-table/issues/591) +- Fixed row and column selection when multiple tables are present + ## [4.3.0] - 2019-09-17 ### Added [#566](https://github.com/plotly/dash-table/pull/566) From 99ef37d5669110856b4f5efb51546876529e3a6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andre=CC=81=20Rivet?= Date: Thu, 19 Sep 2019 16:02:06 -0400 Subject: [PATCH 3/5] lint --- demo/App.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/demo/App.tsx b/demo/App.tsx index e7f473eb6..d3be5b59f 100644 --- a/demo/App.tsx +++ b/demo/App.tsx @@ -75,8 +75,6 @@ class App extends Component { ); } - private propCache = memoizerCache<[string]>()(R.clone); - private setProps = memoizeOne(() => { return (newProps: any) => { Logger.debug('--->', newProps); From bb4f2e039e07c3f4779423951bb15335ccccfe00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andre=CC=81=20Rivet?= Date: Thu, 19 Sep 2019 16:07:31 -0400 Subject: [PATCH 4/5] lint --- demo/App.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/demo/App.tsx b/demo/App.tsx index d3be5b59f..6a7ce3121 100644 --- a/demo/App.tsx +++ b/demo/App.tsx @@ -6,7 +6,6 @@ import Environment from 'core/environment'; import { memoizeOne } from 'core/memoizer'; import Logger from 'core/Logger'; import AppState, { AppMode, AppFlavor } from './AppMode'; -import memoizerCache from 'core/cache/memoizer'; import './style.less'; From 21ee9db4a03445084c2eaff6699777d5c2c28fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andre=CC=81=20Rivet?= Date: Thu, 19 Sep 2019 16:20:31 -0400 Subject: [PATCH 5/5] missing the forest for the tree --- tests/cypress/src/DashTable.ts | 92 +--------------------------------- 1 file changed, 1 insertion(+), 91 deletions(-) diff --git a/tests/cypress/src/DashTable.ts b/tests/cypress/src/DashTable.ts index d4aa707ea..2cde2eec2 100644 --- a/tests/cypress/src/DashTable.ts +++ b/tests/cypress/src/DashTable.ts @@ -125,94 +125,4 @@ export class DashTableHelper { } } -export default class DashTable { - private static __helper = new DashTableHelper('table'); - - static getCell(_row: number, _column: number, _editable: State = State.Ready) { - return this.__helper.getCell.apply(this.__helper, Array.from(arguments) as any); - } - - static getCellById(_row: number, _column: string, _editable: State = State.Ready) { - return this.__helper.getCellById.apply(this.__helper, Array.from(arguments) as any); - } - - static getFilter(_column: number, _editable: State = State.Ready) { - return this.__helper.getFilter.apply(this.__helper, Array.from(arguments) as any); - } - - static getFilterById(_column: string, _editable: State = State.Ready) { - return this.__helper.getFilterById.apply(this.__helper, Array.from(arguments) as any); - } - - static getHeader(_row: number, _column: number, _editable: State = State.Ready) { - return this.__helper.getHeader.apply(this.__helper, Array.from(arguments) as any); - } - - static getHeaderById(_row: number, _column: string, _editable: State = State.Ready) { - return this.__helper.getHeaderById.apply(this.__helper, Array.from(arguments) as any); - } - - static focusCell(_row: number, _column: number) { - return this.__helper.focusCell.apply(this.__helper, Array.from(arguments) as any); - } - - static focusCellById(_row: number, _column: string) { - return this.__helper.focusCellById.apply(this.__helper, Array.from(arguments) as any); - } - - static clearColumnById(_row: number, _column: string, _editable: State = State.Ready) { - return this.__helper.clearColumnById.apply(this.__helper, Array.from(arguments) as any); - } - - static deleteColumnById(_row: number, _column: string, _editable: State = State.Ready) { - return this.__helper.deleteColumnById.apply(this.__helper, Array.from(arguments) as any); - } - - static hideColumnById(_row: number, _column: string, _editable: State = State.Ready) { - return this.__helper.hideColumnById.apply(this.__helper, Array.from(arguments) as any); - } - - static getSelectColumnById(_row: number, _column: string, _editable: State = State.Ready) { - return this.__helper.getSelectColumnById.apply(this.__helper, Array.from(arguments) as any); - } - - static selectColumnById(_row: number, _column: string) { - return this.__helper.selectColumnById.apply(this.__helper, Array.from(arguments) as any); - } - - static getDelete(_row: number, _editable: State = State.Ready) { - return this.__helper.getDelete.apply(this.__helper, Array.from(arguments) as any); - } - - static getSelect(_row: number, _editable: State = State.Ready) { - return this.__helper.getSelect.apply(this.__helper, Array.from(arguments) as any); - } - - static getActiveCell(_editable: State = State.Ready) { - return this.__helper.getActiveCell.apply(this.__helper, Array.from(arguments) as any); - } - - static getSelectedCells(_editable: State = State.Ready) { - return this.__helper.getSelectedCells.apply(this.__helper, Array.from(arguments) as any); - } - - static scrollToTop() { - return this.__helper.scrollToTop.apply(this.__helper, Array.from(arguments) as any); - } - - static scrollToBottom() { - return this.__helper.scrollToBottom.apply(this.__helper, Array.from(arguments) as any); - } - - static getCellInLastRowOfColumn(_column: number) { - return this.__helper.getCellInLastRowOfColumn.apply(this.__helper, Array.from(arguments) as any); - } - - static getCellFromDataDash(_row: number, _column: number) { - return this.__helper.getCellFromDataDash.apply(this.__helper, Array.from(arguments) as any); - } - - static toggleScroll(_toggled: boolean) { - return this.__helper.toggleScroll.apply(this.__helper, Array.from(arguments) as any); - } -} +export default new DashTableHelper('table'); \ No newline at end of file