-
Notifications
You must be signed in to change notification settings - Fork 450
dbeaver/dbeaver-vscode#83 refactor: data grid #3265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
...pp/packages/plugin-data-viewer-result-trace-details/src/DVResultTraceDetailsPresentation.tsx
Outdated
Show resolved
Hide resolved
...atasource-transaction-manager/src/TransactionLog/TransactionLogTable/TransactionLogTable.tsx
Outdated
Show resolved
Hide resolved
...s/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/Table/ObjectMenuCell.tsx
Show resolved
Hide resolved
...p/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/Table/Table.tsx
Show resolved
Hide resolved
webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/TableColumnHeader/OrderButton.tsx
Outdated
Show resolved
Hide resolved
...pp/packages/plugin-data-spreadsheet-new/src/DataGrid/TableColumnHeader/TableColumnHeader.tsx
Outdated
Show resolved
Hide resolved
function getCell(rowIdx: number, colIdx: number) { | ||
switch (colIdx) { | ||
case 0: | ||
return trace![rowIdx]?.name ?? ''; | ||
case 1: | ||
return trace![rowIdx]?.value ?? ''; | ||
case 2: | ||
return trace![rowIdx]?.description ?? ''; | ||
} | ||
|
||
return ''; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very unusual way of setting the columns. Can we rearrange the columns order in grid? Will it work?
@@ -125,28 +65,70 @@ export const Table = observer<TableProps>(function Table({ objects, hasNextPage, | |||
return null; | |||
} | |||
|
|||
function getCell(rowIdx: number, colIdx: number) { | |||
colIdx--; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we move this mutation to the DataGrid props
so getCell={(r, c) => getCell(r, c--)}
?
function getHeaderText(colIdx: number) { | ||
colIdx--; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and same here: remove mutation from the getter
...p/packages/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/Table/Table.tsx
Outdated
Show resolved
Hide resolved
...ges/plugin-object-viewer/src/ObjectPropertiesPage/ObjectPropertyTable/Table/Table.module.css
Show resolved
Hide resolved
// const colIdx = tableData.getColumnIndexFromColumnKey(cell.column); | ||
// const rowIdx = tableData.getRowIndexFromKey(cell.row); | ||
// const editingState = tableData.editor.getElementState(cell); | ||
|
||
// switch (event.nativeEvent.code) { | ||
// case 'Delete': { | ||
// const filteredRows = activeRows.filter(cell => tableData.editor.getElementState(cell) !== DatabaseEditChangeType.delete); | ||
|
||
// if (filteredRows.length > 0) { | ||
// const editor = tableData.editor; | ||
// const firstRow = filteredRows[0]!; | ||
// const editingState = tableData.editor.getElementState(firstRow); | ||
|
||
// editor.delete(...filteredRows); | ||
|
||
// if (editingState === DatabaseEditChangeType.add) { | ||
// if (rowIdx - 1 > 0) { | ||
// handlers.selectCell({ colIdx, rowIdx: rowIdx - 1 }); | ||
// } | ||
// } else { | ||
// if (rowIdx + 1 < tableData.rows.length) { | ||
// handlers.selectCell({ colIdx, rowIdx: rowIdx + 1 }); | ||
// } | ||
// } | ||
// } | ||
|
||
// return; | ||
// } | ||
// case 'KeyV': { | ||
// if (editingState === DatabaseEditChangeType.delete) { | ||
// return; | ||
// } | ||
|
||
// if (event.ctrlKey || event.metaKey) { | ||
// if (!clipboardService.clipboardAvailable || clipboardService.state === 'denied' || tableData.isCellReadonly(cell)) { | ||
// return; | ||
// } | ||
|
||
// clipboardService | ||
// .read() | ||
// .then(value => tableData.editor.set(cell, value)) | ||
// .catch(); | ||
// return; | ||
// } | ||
// } | ||
// } | ||
|
||
// if (editingState === DatabaseEditChangeType.delete) { | ||
// return; | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do we do with this feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to test and if all works we will just remove this, if not we will return this code back (I think I can just remove it for now and revert if needed)
const trace = state.trace; | ||
|
||
const columnsCount = useCreateGridReactiveValue(() => 3, null, []); | ||
const rowCount = useCreateGridReactiveValue( | ||
() => trace?.length || 0, | ||
onValueChange => reaction(() => trace?.length || 0, onValueChange), | ||
[trace], | ||
); | ||
|
||
function getCell(rowIdx: number, colIdx: number) { | ||
switch (colIdx) { | ||
case 0: | ||
return trace![rowIdx]?.name ?? ''; | ||
case 1: | ||
return trace![rowIdx]?.value ?? ''; | ||
case 2: | ||
return trace![rowIdx]?.description ?? ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need this trace
variable and why do we access it with trace?
and trace!
at the same time?
* dbeaver/dbeaver-vscode#83 refactor: data grid * chore: try to fix build scripts * chore: commit artifacts * chore: update yarn.lock * fix: adjust grid auto-sizing * chore: fix prettier * chore: add documentation about typescript crashes * fix: cell menu * fix: grid inline editor styles * fix: cell menu styles * fix: cell items alignment * fix: data sync * feat: support reactive values in grid * chore: try to fix strange build bug * chore: restore original file name * fix: add specific to inline editor styles * fix: remove delete row shortcut (not working) * chore: enable common cache
No description provided.