Conversation
- duplicate component contract in TS
- bump version to rc6
- 3 tables for fixed rows/columns and content - update TS props
| { | ||
| "name": "dash-table", | ||
| "version": "3.0.0rc5", | ||
| "version": "3.0.0rc6", |
There was a problem hiding this comment.
Bumping the version
| ev.clipboardData.getData('text/plain') : | ||
| undefined; | ||
| } | ||
| } No newline at end of file |
There was a problem hiding this comment.
Wrapper around the clipboard implementation details (especially the copy portion) -- nothing here is dash or dash table specific
| let safeSeed = seed !== undefined ? lcg(seed) : lcg(Math.random()); | ||
|
|
||
| return () => (safeSeed = lcg(safeSeed)) / 2147483648; | ||
| }; No newline at end of file |
There was a problem hiding this comment.
There's no seed in Math.random.. useful for testing purposes
| })} | ||
| /> | ||
| ); | ||
| return (<RealTable {...this.props} />); |
There was a problem hiding this comment.
This is the dash wrapper for the Dash Table.
| tableId={id} | ||
| type={column.type} | ||
| value={datum[column.id]} | ||
| />); |
There was a problem hiding this comment.
Refactored from the RowFactory, since there are no rows anymore.
| })} | ||
| </tr> | ||
| )); | ||
| return R.range(0, headerDepth).map(i => ([ |
There was a problem hiding this comment.
Mostly the same but headers are not returned as a two dimensional array of headers instead of an array of rows
| } | ||
|
|
||
| get virtualization(): string { | ||
| get virtualization(): Virtualization { |
There was a problem hiding this comment.
Just slowly improving the typing
|
|
||
| virtualizer.refresh(); | ||
|
|
||
| return (<ControlledTable |
There was a problem hiding this comment.
This is the actual Table implementation used by the Dash wrapper --from this point on we are (in theory) in pure Typescript land
| virtual_dataframe_indices: number[]; | ||
| virtualization: Virtualization; | ||
| virtualization_settings: IVirtualizationSettings; | ||
| } |
There was a problem hiding this comment.
PropsWithDefaults, IDefaultProps, IProps are the TS equivalent of the PropTypes impl in the table wrapper. Since the wrapper is responsible for the default props, there's no default props impl in the table itself -- still good to keep them divided.
|
|
||
| export function colIsEditable(editable, column) { | ||
| return !(!editable || (R.has('editable', column) && !column.editable)); | ||
| return editable && (!R.has('editable', column) || column.editable); |
There was a problem hiding this comment.
De Morgan and nested De Morgan..
| import { ActiveCell, Columns, Dataframe, SelectedCells } from 'dash-table/components/Table/props'; | ||
|
|
||
| export default class TableClipboardHelper { | ||
| public static toClipboard(selectedCells: SelectedCells, columns: Columns, dataframe: Dataframe) { |
There was a problem hiding this comment.
Dash table specific copy/paste implementation. Isolating the logic from the rest of the table impl
|
|
||
| await Resolve(DashTable.getCell(1, 0).click()); | ||
| await Resolve(DOM.focused.type(`${Key.Control}v`)); | ||
| // it('can do BE roundtrip on copy-paste', () => { |
There was a problem hiding this comment.
Commenting but keep it as I am hopeful that they will resolve the issue above.
| it('does not change column width', async () => { | ||
| const startWidth = await Resolve(DashTable.getCell(3, 3)).then(res => res.outerWidth()); | ||
| it('does not change column width', () => { | ||
| DashTable.getCell(3, 3).then(startCell => { |
There was a problem hiding this comment.
the async/await + promise resolve impl was working well locally but for some reason it failed in CircleCI.. returning to the suggested way of doing things even-though it feels a bit archaic :)
| } | ||
|
|
||
| switchCell(event) { | ||
| switchCell = (event: any) => { |
There was a problem hiding this comment.
Switching to class level lambda functions, no need to rebind this in ctor
| fixedColumnCells.splice(0, fixedRows) : | ||
| null; | ||
|
|
||
| return [ |
There was a problem hiding this comment.
The matrix of all cells, slice through it for fixed rows and columns, make a sub-table with each fragment
| onScroll = (ev: any) => { | ||
| const { r0c1 } = this.refs as { [key: string]: HTMLElement }; | ||
|
|
||
| r0c1.style.marginLeft = `${-ev.target.scrollLeft}`; |
There was a problem hiding this comment.
Keep the fixed rows synced with the main content
| } | ||
|
|
||
| componentDidUpdate() { | ||
| const { r0c0, r0c1, r1c0, r1c1 } = this.refs as { [key: string]: HTMLElement }; |
There was a problem hiding this comment.
After render, make sure the styling between the various table-fragments is consistent -- mostly about row height now.
|
@valentijnnieman @T4rk1n @bpostlethwaite Please have a look if you have some time. Thx. |
| "build:py": "./extract-meta src/dash-table/Table.js > dash_table/metadata.json && cp package.json dash_table", | ||
| "lint": "run-s private::lint.js private::lint.ts", | ||
| "test": "run-p --race private::host* private::runtests private::snapshots", | ||
| "test": "run-s private::test-*", |
There was a problem hiding this comment.
Turns out the e2e tests and visual tests were racing one another -- visual tests are very short, so e2e tests were never run in CircleCI 😞
- fix scrolling issue in prod environment
| return log ? | ||
| (LogLevel as any)[log] || LogLevel.ERROR : | ||
| LogLevel.ERROR; | ||
| } |
There was a problem hiding this comment.
Making it possible to use cookies or additional params to override dash component behavior. In this case, toggling debug & log levels. Useful when testing against deployed component.
- additional visual tests for merged, fixed, hidden combo
| ]; | ||
|
|
||
| // slice out fixed columns | ||
| const fixedColumnCells = fixedColumns ? |
There was a problem hiding this comment.
Take into consideration the "weight" of the merged cells when slicing the cells for the fixed columns
| // Move outside the screen to make it invisible | ||
| // el.style.left = '-9999px'; | ||
| // Append the <textarea> element to the HTML document | ||
| document.body.appendChild(el); |
There was a problem hiding this comment.
Copying this over / refactoring, leaving comments as is.
This review is about making it possible to have both fixed columns and fixed rows at the same time -- previously, we could only use one at a time.