Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3cdc31f

Browse files
committed
fix: table column auto/fix width problem
fix: compile error
1 parent 63c64fa commit 3cdc31f

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

client/packages/openblocks/src/comps/comps/tableComp/tableCompView.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -379,21 +379,22 @@ function ResizeableTable<RecordType extends object>(props: CustomTableProps<Reco
379379
index: -1,
380380
width: -1,
381381
});
382+
let allColumnFixed = true;
382383
const columns = props.columns.map((col, index) => {
383384
const { width, ...restCol } = col;
384385
const resizeWidth = (resizeData.index === index ? resizeData.width : col.width) ?? 0;
385386
let colWidth: number | string = "auto";
386387
let minWidth: number | string = COL_MIN_WIDTH;
387388
if (resizeWidth > 0) {
388-
// fixed width
389-
if (index === props.columns.length - 1) {
390-
// the last column auto width
391-
colWidth = "100%";
392-
minWidth = resizeWidth;
393-
} else {
394-
minWidth = "unset";
395-
colWidth = resizeWidth;
396-
}
389+
minWidth = "unset";
390+
colWidth = resizeWidth;
391+
} else {
392+
allColumnFixed = false;
393+
}
394+
if (allColumnFixed && index === props.columns.length - 1) {
395+
// all column fixed, the last column fill extra space
396+
colWidth = "auto";
397+
minWidth = resizeWidth;
397398
}
398399
return {
399400
...restCol,

client/packages/openblocks/src/comps/queries/sqlQuery/SQLQuery.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { TableNameComp } from "./tableNameComp";
1919
import { ChangeSetComp } from "./changeSetComp";
2020
import { FilterComp } from "./FilterComp";
2121
import { trans } from "i18n";
22-
import { ResourceType } from "@openblocks-ee/constants/queryConstants";
2322
import { ColumnNameDropdown } from "./columnNameDropdown";
2423
import React, { useContext } from "react";
2524
import { QueryContext } from "util/context/QueryContext";
@@ -247,13 +246,13 @@ export const SQLQuery = class extends SQLTmpQuery {
247246
}
248247
};
249248

250-
export const NOT_SUPPORT_GUI_SQL_QUERY: ResourceType[] = [
249+
export const NOT_SUPPORT_GUI_SQL_QUERY: string[] = [
251250
"clickHouse",
252251
"snowflake",
253252
"tdengine",
254253
"dameng",
255254
];
256-
const SUPPORT_UPSERT_SQL_QUERY: ResourceType[] = [
255+
const SUPPORT_UPSERT_SQL_QUERY: string[] = [
257256
"mysql",
258257
"oceanBase",
259258
"tidb",

0 commit comments

Comments
 (0)