Skip to content

Commit

Permalink
Merge branch 'dev-4.2.3' of https://code.alipay.com/oceanbase/oceanba…
Browse files Browse the repository at this point in the history
…se-developer-center into dev-4.2.3
  • Loading branch information
HSunboy committed Dec 8, 2023
2 parents 8b11eef + 9bcd26a commit 8160c25
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 47 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 9 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ const JDBCParams: React.FC<IProps> = function ({ value, onChange }) {
enableColumnRecord={false}
enableFilterRow={false}
enableSortRow={false}
enableFlushDelete={true}
minHeight="370px"
initialColumns={columns}
initialRows={initialRows as RowType<any>[]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
47 changes: 16 additions & 31 deletions src/page/Workspace/components/DDLResultSet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -483,20 +483,12 @@ const DDLResultSet: React.FC<IProps> = 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 && {
Expand All @@ -507,19 +499,11 @@ const DDLResultSet: React.FC<IProps> = 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 && {
Expand Down Expand Up @@ -551,19 +535,13 @@ const DDLResultSet: React.FC<IProps> = 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',
Expand Down Expand Up @@ -627,6 +605,13 @@ const DDLResultSet: React.FC<IProps> = function (props) {
originRows,
session?.connection?.dialectType,
);

useEffect(() => {
if (rgdColumns?.length) {
gridRef.current.setColumns(rgdColumns);
}
}, [rgdColumns]);

const pasteFormatter = useCallback(
function pasteFormatter(
row: RowType<any>,
Expand Down
3 changes: 3 additions & 0 deletions src/page/Workspace/components/EditableTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ interface IProps<R extends RowType<R>, SR> extends PickDataGridProps<R, SR> {
enableFilterRow?: boolean;
enableSortRow?: boolean;
enableFrozenRow?: boolean;
enableFlushDelete?: boolean;
searchKey?: string;
/**
* 只要cell或者rows选择改变,都会触发。
Expand Down Expand Up @@ -84,6 +85,7 @@ export default inject('settingStore')(
bordered = true,
enableColumnRecord = true,
enableFrozenRow,
enableFlushDelete,
searchKey,
settingStore,
theme,
Expand Down Expand Up @@ -112,6 +114,7 @@ export default inject('settingStore')(
readonly,
enableFrozenRow,
enableColumnRecord,
enableFlushDelete,
theme: theme || (settingStore.theme.sheetTheme as any),
searchKey,
rowHeight: 24,
Expand Down

0 comments on commit 8160c25

Please sign in to comment.