diff --git a/package.json b/package.json index 1c4eb798a..0fd3bb8c1 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "@oceanbase-odc/monaco-plugin-ob": "^0.1.1", "@oceanbase-odc/ob-intl-cli": "^1.1.0", "@oceanbase-odc/ob-parser-js": "^3.0.1", - "@oceanbase-odc/ob-react-data-grid": "^3.0.2", + "@oceanbase-odc/ob-react-data-grid": "^3.0.3", "@svgr/webpack": "^6.5.1", "@testing-library/react": "^11.2.2", "@types/antlr4": "~4.7.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a51af25de..49d6e40b8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -50,8 +50,8 @@ devDependencies: specifier: ^3.0.1 version: 3.0.1 '@oceanbase-odc/ob-react-data-grid': - specifier: ^3.0.2 - version: 3.0.2(antd@4.24.14)(lodash@4.17.21)(react-dnd-html5-backend@11.1.3)(react-dnd@11.1.3)(react-dom@17.0.2)(react@17.0.2) + specifier: ^3.0.3 + version: 3.0.3(antd@4.24.14)(lodash@4.17.21)(react-dnd-html5-backend@11.1.3)(react-dnd@11.1.3)(react-dom@17.0.2)(react@17.0.2) '@svgr/webpack': specifier: ^6.5.1 version: 6.5.1 @@ -3916,8 +3916,8 @@ packages: lodash: 4.17.21 dev: true - /@oceanbase-odc/ob-react-data-grid@3.0.2(antd@4.24.14)(lodash@4.17.21)(react-dnd-html5-backend@11.1.3)(react-dnd@11.1.3)(react-dom@17.0.2)(react@17.0.2): - resolution: {integrity: sha512-l3+M89xlIxGTFaGauyUrFBWevZdE8udl8+/0PxQBRZVDcErwKZoBZhf6xDewBlCu3DScM2n8BPo/JSfYewaSHQ==} + /@oceanbase-odc/ob-react-data-grid@3.0.3(antd@4.24.14)(lodash@4.17.21)(react-dnd-html5-backend@11.1.3)(react-dnd@11.1.3)(react-dom@17.0.2)(react@17.0.2): + resolution: {integrity: sha512-WFD9Ms5Mrv8CJGt05hF0Z7cO997APr/FkJuS+eUbU4mgK2CdwnoZQC/7rMfZI/j5KCvBuLULOUDIYlPIqEPR+g==} engines: {node: '>=12.0.0'} peerDependencies: antd: ^4.15.3 @@ -5665,7 +5665,7 @@ packages: axios: 0.27.2 babel-plugin-import: 1.13.6 dayjs: 1.11.7 - dva-core: 2.0.4(redux@4.2.1) + dva-core: 2.0.4(redux@3.7.2) dva-immer: 1.0.0(dva@2.5.0-beta.2) dva-loading: 3.0.23(dva-core@2.0.4) event-emitter: 0.3.5 @@ -8650,7 +8650,7 @@ packages: warning: 3.0.0 dev: true - /dva-core@2.0.4(redux@4.2.1): + /dva-core@2.0.4(redux@3.7.2): resolution: {integrity: sha512-Zh39llFyItu9HKXKfCZVf9UFtDTcypdAjGBew1S+wK8BGVzFpm1GPTdd6uIMeg7O6STtCvt2Qv+RwUut1GFynA==} peerDependencies: redux: 4.x @@ -8660,7 +8660,7 @@ packages: global: 4.4.0 invariant: 2.2.4 is-plain-object: 2.0.4 - redux: 4.2.1 + redux: 3.7.2 redux-saga: 0.16.2 warning: 3.0.0 dev: true @@ -8681,7 +8681,7 @@ packages: dva-core: ^1.1.0 || ^1.5.0-0 || ^1.6.0-0 dependencies: '@babel/runtime': 7.23.2 - dva-core: 2.0.4(redux@4.2.1) + dva-core: 2.0.4(redux@3.7.2) dev: true /dva@2.5.0-beta.2(react-dom@17.0.2)(react@17.0.2): @@ -15836,7 +15836,7 @@ packages: /react-redux@8.0.5(@types/react-dom@16.9.18)(@types/react@16.14.35)(react-dom@17.0.2)(react@17.0.2)(redux@4.2.1): resolution: {integrity: sha512-Q2f6fCKxPFpkXt1qNRZdEDLlScsDWyrgSj0mliK59qU6W5gvBiKkdMEG2lJzhd1rCctf0hb6EtePPLZ2e0m1uw==} peerDependencies: - '@types/react': ^16.0.0 + '@types/react': ^16.8 || ^17.0 || ^18.0 '@types/react-dom': ^16.8 || ^17.0 || ^18.0 react: ^16.8 || ^17.0 || ^18.0 react-dom: ^16.8 || ^17.0 || ^18.0 diff --git a/src/page/Datasource/Datasource/NewDatasourceDrawer/Form/JDBCParamsItem/index.tsx b/src/page/Datasource/Datasource/NewDatasourceDrawer/Form/JDBCParamsItem/index.tsx index 9fd2e27e4..6f40e61d0 100644 --- a/src/page/Datasource/Datasource/NewDatasourceDrawer/Form/JDBCParamsItem/index.tsx +++ b/src/page/Datasource/Datasource/NewDatasourceDrawer/Form/JDBCParamsItem/index.tsx @@ -171,6 +171,7 @@ const JDBCParams: React.FC = function ({ value, onChange }) { enableColumnRecord={false} enableFilterRow={false} enableSortRow={false} + enableFlushDelete={true} minHeight="370px" initialColumns={columns} initialRows={initialRows as RowType[]} diff --git a/src/page/Workspace/components/DDLResultSet/hooks/components/BlobFormatter/index.less b/src/page/Workspace/components/DDLResultSet/hooks/components/BlobFormatter/index.less index 9d1f8bb8e..576877845 100644 --- a/src/page/Workspace/components/DDLResultSet/hooks/components/BlobFormatter/index.less +++ b/src/page/Workspace/components/DDLResultSet/hooks/components/BlobFormatter/index.less @@ -35,22 +35,22 @@ .contenttext-disabled { flex: 1; padding: 8px; - background: #f8f9fb; + background-color: var(--background-primary-color); border: none; white-space: pre; &:focus { box-shadow: none; } &:global(.ant-input-disabled) { - color: rgba(0, 0, 0, 0.85); - background-color: #f8f9fb; + color: var(--text-color-primary); + background-color: var(--background-primary-color); cursor: unset; } } .contenttext-disabled { - border: 1px solid #d9d9d9; + border: 1px solid var(--odc-border-color); overflow-y: scroll; - color: rgba(0, 0, 0, 0.85); - background-color: #f8f9fb; + color: var(--text-color-primary); + background-color: var(--background-primary-color); cursor: unset; } diff --git a/src/page/Workspace/components/DDLResultSet/index.tsx b/src/page/Workspace/components/DDLResultSet/index.tsx index f66e459c4..ead605491 100644 --- a/src/page/Workspace/components/DDLResultSet/index.tsx +++ b/src/page/Workspace/components/DDLResultSet/index.tsx @@ -483,20 +483,12 @@ const DDLResultSet: React.FC = function (props) { // 设置为 Null disabled: isNull(row[columnKey]) || column.readonly, onClick: () => { - const newRows = [...rows]; - const targetRowIndex = newRows.findIndex( - (newRow) => newRow._rowIndex === row._rowIndex, - ); - newRows[targetRowIndex] = { - ...newRows[targetRowIndex], + const targetRowIndex = rows.findIndex((newRow) => newRow._rowIndex === row._rowIndex); + gridRef?.current?.setCellsByRowIndex(targetRowIndex, { [columnKey]: null, [getBlobValueKey(columnKey)]: null, [getNlsValueKey(columnKey)]: null, - _originRow: originRows.find((row) => { - return row._rowIndex === newRows[targetRowIndex]?._rowIndex; - }), - }; - handleEditPropertyInCell(newRows); + }); }, }, isEditing && { @@ -507,19 +499,11 @@ const DDLResultSet: React.FC = function (props) { // 设置为默认值 disabled: isUndefined(row[columnKey]) || column.readonly, onClick: () => { - const newRows = [...rows]; - const targetRowIndex = newRows.findIndex( - (newRow) => newRow._rowIndex === row._rowIndex, - ); - newRows[targetRowIndex] = { - ...newRows[targetRowIndex], + const targetRowIndex = rows.findIndex((newRow) => newRow._rowIndex === row._rowIndex); + gridRef?.current?.setCellsByRowIndex(targetRowIndex, { [columnKey]: undefined, [getBlobValueKey(columnKey)]: null, - _originRow: originRows.find((row) => { - return row._rowIndex === newRows[targetRowIndex]?._rowIndex; - }), - }; - handleEditPropertyInCell(newRows); + }); }, }, showDownload && { @@ -551,19 +535,13 @@ const DDLResultSet: React.FC = function (props) { if (file) { const serverFileName = await uploadTableObject(file, sessionId); if (serverFileName) { - const newRows = [...rowsRef.current]; - const targetRowIndex = newRows.findIndex( + const targetRowIndex = rowsRef.current?.findIndex( (newRow) => newRow._rowIndex === row._rowIndex, ); - newRows[targetRowIndex] = { - ...newRows[targetRowIndex], + gridRef?.current?.setCellsByRowIndex(targetRowIndex, { [columnKey]: serverFileName, [getBlobValueKey(columnKey)]: new LobExt(serverFileName, RSModifyDataType.FILE), - _originRow: originRows.find((row) => { - return row._rowIndex === newRows[targetRowIndex]?._rowIndex; - }), - }; - handleEditPropertyInCell(newRows); + }); message.success( `${file.name} ${formatMessage({ id: 'workspace.window.table.object.upload.success', @@ -627,6 +605,13 @@ const DDLResultSet: React.FC = function (props) { originRows, session?.connection?.dialectType, ); + + useEffect(() => { + if (rgdColumns?.length) { + gridRef.current.setColumns(rgdColumns); + } + }, [rgdColumns]); + const pasteFormatter = useCallback( function pasteFormatter( row: RowType, diff --git a/src/page/Workspace/components/EditableTable/index.tsx b/src/page/Workspace/components/EditableTable/index.tsx index f11adfe21..5f98b7af5 100644 --- a/src/page/Workspace/components/EditableTable/index.tsx +++ b/src/page/Workspace/components/EditableTable/index.tsx @@ -57,6 +57,7 @@ interface IProps, SR> extends PickDataGridProps { enableFilterRow?: boolean; enableSortRow?: boolean; enableFrozenRow?: boolean; + enableFlushDelete?: boolean; searchKey?: string; /** * 只要cell或者rows选择改变,都会触发。 @@ -84,6 +85,7 @@ export default inject('settingStore')( bordered = true, enableColumnRecord = true, enableFrozenRow, + enableFlushDelete, searchKey, settingStore, theme, @@ -112,6 +114,7 @@ export default inject('settingStore')( readonly, enableFrozenRow, enableColumnRecord, + enableFlushDelete, theme: theme || (settingStore.theme.sheetTheme as any), searchKey, rowHeight: 24,