es-grid-template 1.9.79 → 1.9.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,11 @@
1
+ import { nonActionColumn } from "../../grid-component/hooks";
1
2
  export function convertColumnsToTreeData(columns, groupColumns, t) {
2
3
  if (!columns) {
3
4
  return [];
4
5
  }
5
6
  return columns.filter(col => {
6
7
  const inGroup = groupColumns ? groupColumns.includes(String(col.field)) : false;
7
- if (col.showInColumnChoose === false) return false;
8
+ if (col.showInColumnChoose === false || nonActionColumn.includes(col.field)) return false;
8
9
  if (inGroup && !('children' in col && Array.isArray(col.children))) {
9
10
  return false;
10
11
  }
@@ -2023,7 +2023,25 @@ const TableContainerEdit = props => {
2023
2023
  }
2024
2024
  contextMenuClick?.(args);
2025
2025
  };
2026
+
2027
+ // Chống fire onCellClick trùng lặp: double-click = 2 lần mousedown nên callback sẽ bị gọi 2 lần.
2028
+ // Chỉ bỏ qua khi click LIÊN TIẾP cùng 1 cell trong khoảng thời gian rất ngắn.
2029
+ const lastCellClickRef = React.useRef({
2030
+ key: '',
2031
+ time: 0
2032
+ });
2026
2033
  const handleCellClick = (rowNumber, record, column, rowId, cellValue) => {
2034
+ const clickKey = `${rowId}::${column.field ?? ''}`;
2035
+ const now = Date.now();
2036
+
2037
+ // cùng cell && trong vòng 300ms => coi là double-click, bỏ qua lần lặp
2038
+ if (lastCellClickRef.current.key === clickKey && now - lastCellClickRef.current.time < 300) {
2039
+ return;
2040
+ }
2041
+ lastCellClickRef.current = {
2042
+ key: clickKey,
2043
+ time: now
2044
+ };
2027
2045
  const cellClickCallback = newOptions => {
2028
2046
  if (newOptions) {
2029
2047
  const newElem = {
@@ -1260,6 +1260,11 @@ const TableBodyCellEdit = props => {
1260
1260
  }
1261
1261
  } else {
1262
1262
  handleMouseDown(cell.row.id, cell.column.id);
1263
+
1264
+ // fire onCellClick ngay lần click đầu (trước đây chỉ fire khi cell đã ở trạng thái editing)
1265
+ if (canEdit) {
1266
+ handleCellClick?.(rowNumber, record, columnMeta, record[rowKey], record[columnMeta.field ?? '']);
1267
+ }
1263
1268
  if (editingKey) {
1264
1269
  setTimeout(() => {
1265
1270
  setEditingKey?.('');
@@ -196,10 +196,10 @@ export declare const fixColumnsLeft: <RecordType>(columns: ColumnTable<RecordTyp
196
196
  value: any;
197
197
  rowData: RecordType;
198
198
  }) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
199
- onCellStyles?: Omit<CSSProperties, "position" | "left" | "right" | "display" | "width" | "minWidth"> | ((cellValue: any, cell: import("@tanstack/react-table").Cell<RecordType, unknown>) => Omit<CSSProperties, "position" | "left" | "right" | "display" | "width" | "minWidth">);
200
- onCellHeaderStyles?: Omit<CSSProperties, "position" | "left" | "right" | "display" | "width" | "minWidth"> | ((cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "position" | "left" | "right" | "display" | "width" | "minWidth">);
199
+ onCellStyles?: Omit<CSSProperties, "left" | "right" | "display" | "minWidth" | "position" | "width"> | ((cellValue: any, cell: import("@tanstack/react-table").Cell<RecordType, unknown>) => Omit<CSSProperties, "left" | "right" | "display" | "minWidth" | "position" | "width">);
200
+ onCellHeaderStyles?: Omit<CSSProperties, "left" | "right" | "display" | "minWidth" | "position" | "width"> | ((cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "left" | "right" | "display" | "minWidth" | "position" | "width">);
201
201
  onCell?: (rowData: RecordType, index: number) => import("react").TdHTMLAttributes<HTMLTableCellElement>;
202
- onCellFooterStyles?: Omit<CSSProperties, "position" | "left" | "right" | "display" | "width" | "minWidth"> | ((cellValue: any, cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "position" | "left" | "right" | "display" | "width" | "minWidth">);
202
+ onCellFooterStyles?: Omit<CSSProperties, "left" | "right" | "display" | "minWidth" | "position" | "width"> | ((cellValue: any, cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "left" | "right" | "display" | "minWidth" | "position" | "width">);
203
203
  getValue?: (row: any, rowIndex: number) => any;
204
204
  getCellProps?: (value: any, row: any, rowIndex: number) => import("./../../grid-component/type").CellProps;
205
205
  headerCellProps?: import("./../../grid-component/type").CellProps;
@@ -1,3 +1,4 @@
1
+ import { nonActionColumn } from "./../../grid-component/hooks";
1
2
  import { v4 as uuidv4 } from 'uuid';
2
3
  import { presetPalettes } from "@ant-design/colors";
3
4
  import dayjs from "dayjs";
@@ -1916,8 +1917,8 @@ export function convertColumnsToTreeData(columns, groupColumns) {
1916
1917
 
1917
1918
  // Điều kiện filter:
1918
1919
  // - Nếu meta.showInColumnChoose = false => loại bỏ
1919
- // - Nếu không nằm trong groupColumns và không phải column group => loại bỏ
1920
- if (meta.showInColumnChoose === false) return false;
1920
+ // - Nếu là column đặc biệt (selection_column, #, command...) => loại bỏ
1921
+ if (meta.showInColumnChoose === false || nonActionColumn.includes(col.id)) return false;
1921
1922
  if (inGroup && !('columns' in col && Array.isArray(col.columns))) {
1922
1923
  return false;
1923
1924
  }
@@ -1948,6 +1949,15 @@ export const updateColumns1 = (columns, includes) => {
1948
1949
  if (!column.field) {
1949
1950
  return column;
1950
1951
  }
1952
+
1953
+ // Bỏ qua column đặc biệt (selection_column, #, command, drag-handle) — giữ nguyên visible
1954
+ // nhưng vẫn phải đệ quy children để không bỏ sót column con
1955
+ if (nonActionColumn.includes(newColumn.field)) {
1956
+ if (newColumn.children) {
1957
+ newColumn.children = updateColumns1(newColumn.children, includes);
1958
+ }
1959
+ return newColumn;
1960
+ }
1951
1961
  if (newColumn.children) {
1952
1962
  newColumn.children = updateColumns1(newColumn.children, includes);
1953
1963
  hasVisibleChild = newColumn.children.some(child => !child.hidden);
@@ -2078,7 +2078,25 @@ const TableContainerEdit = props => {
2078
2078
  }
2079
2079
  contextMenuClick?.(args);
2080
2080
  };
2081
+
2082
+ // Chống fire onCellClick trùng lặp: double-click = 2 lần mousedown nên callback sẽ bị gọi 2 lần.
2083
+ // Chỉ bỏ qua khi click LIÊN TIẾP cùng 1 cell trong khoảng thời gian rất ngắn.
2084
+ const lastCellClickRef = React.useRef({
2085
+ key: '',
2086
+ time: 0
2087
+ });
2081
2088
  const handleCellClick = (rowNumber, record, column, rowId, cellValue) => {
2089
+ const clickKey = `${rowId}::${column.field ?? ''}`;
2090
+ const now = Date.now();
2091
+
2092
+ // cùng cell && trong vòng 300ms => coi là double-click, bỏ qua lần lặp
2093
+ if (lastCellClickRef.current.key === clickKey && now - lastCellClickRef.current.time < 300) {
2094
+ return;
2095
+ }
2096
+ lastCellClickRef.current = {
2097
+ key: clickKey,
2098
+ time: now
2099
+ };
2082
2100
  const cellClickCallback = newOptions => {
2083
2101
  if (newOptions) {
2084
2102
  const newElem = {
@@ -1344,6 +1344,11 @@ const TableBodyCellEdit = props => {
1344
1344
  }
1345
1345
  } else {
1346
1346
  handleMouseDown(cell.row.id, cell.column.id);
1347
+
1348
+ // fire onCellClick ngay lần click đầu (trước đây chỉ fire khi cell đã ở trạng thái editing)
1349
+ if (canEdit) {
1350
+ handleCellClick?.(rowNumber, record, columnMeta, record[rowKey], record[columnMeta.field ?? '']);
1351
+ }
1347
1352
  if (editingKey) {
1348
1353
  setTimeout(() => {
1349
1354
  setEditingKey?.('');
@@ -2481,9 +2481,8 @@ export function convertColumnsToTreeData(columns, groupColumns) {
2481
2481
 
2482
2482
  // Điều kiện filter:
2483
2483
  // - Nếu meta.showInColumnChoose = false => loại bỏ
2484
- // - Nếu không nằm trong groupColumns và không phải column group => loại bỏ
2485
- // if (meta.showInColumnChoose === false || col.id === "selection_column") return false
2486
- if (meta.showInColumnChoose === false) return false;
2484
+ // - Nếu là column đặc biệt (selection_column, #, command...) => loại bỏ
2485
+ if (meta.showInColumnChoose === false || nonActionColumn.includes(col.id)) return false;
2487
2486
  // if (inGroup && !('columns' in col && Array.isArray((col as any).columns))) {
2488
2487
  if (inGroup && !('columns' in col && Array.isArray(col.columns))) {
2489
2488
  return false;
@@ -2515,6 +2514,15 @@ export const updateColumns1 = (columns, includes) => {
2515
2514
  if (!column.field) {
2516
2515
  return column;
2517
2516
  }
2517
+
2518
+ // Bỏ qua column đặc biệt (selection_column, #, command, drag-handle) — giữ nguyên visible
2519
+ // nhưng vẫn phải đệ quy children để không bỏ sót column con
2520
+ if (nonActionColumn.includes(newColumn.field)) {
2521
+ if (newColumn.children) {
2522
+ newColumn.children = updateColumns1(newColumn.children, includes);
2523
+ }
2524
+ return newColumn;
2525
+ }
2518
2526
  if (newColumn.children) {
2519
2527
  newColumn.children = updateColumns1(newColumn.children, includes);
2520
2528
  hasVisibleChild = newColumn.children.some(child => !child.hidden);
@@ -1,3 +1,4 @@
1
+ import { nonActionColumn } from "../../grid-component/hooks";
1
2
  import { SELECTION_COLUMN } from "rc-master-ui/es/table/hooks/useSelection";
2
3
  import { v4 as uuidv4 } from 'uuid';
3
4
  import { presetPalettes } from "@ant-design/colors";
@@ -1888,8 +1889,8 @@ export function convertColumnsToTreeData(columns, groupColumns) {
1888
1889
 
1889
1890
  // Điều kiện filter:
1890
1891
  // - Nếu meta.showInColumnChoose = false => loại bỏ
1891
- // - Nếu không nằm trong groupColumns và không phải column group => loại bỏ
1892
- if (meta.showInColumnChoose === false) return false;
1892
+ // - Nếu là column đặc biệt (selection_column, #, command...) => loại bỏ
1893
+ if (meta.showInColumnChoose === false || nonActionColumn.includes(col.id)) return false;
1893
1894
  if (inGroup && !('columns' in col && Array.isArray(col.columns))) {
1894
1895
  return false;
1895
1896
  }
@@ -1920,6 +1921,15 @@ export const updateColumns1 = (columns, includes) => {
1920
1921
  if (!column.field) {
1921
1922
  return column;
1922
1923
  }
1924
+
1925
+ // Bỏ qua column đặc biệt (selection_column, #, command, drag-handle) — giữ nguyên visible
1926
+ // nhưng vẫn phải đệ quy children để không bỏ sót column con
1927
+ if (nonActionColumn.includes(newColumn.field)) {
1928
+ if (newColumn.children) {
1929
+ newColumn.children = updateColumns1(newColumn.children, includes);
1930
+ }
1931
+ return newColumn;
1932
+ }
1923
1933
  if (newColumn.children) {
1924
1934
  newColumn.children = updateColumns1(newColumn.children, includes);
1925
1935
  hasVisibleChild = newColumn.children.some(child => !child.hidden);
@@ -6,13 +6,14 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.convertColumnsToTreeData = convertColumnsToTreeData;
7
7
  exports.filterColumnsByField = filterColumnsByField;
8
8
  exports.filterVisibleColumns = filterVisibleColumns;
9
+ var _hooks = require("../../grid-component/hooks");
9
10
  function convertColumnsToTreeData(columns, groupColumns, t) {
10
11
  if (!columns) {
11
12
  return [];
12
13
  }
13
14
  return columns.filter(col => {
14
15
  const inGroup = groupColumns ? groupColumns.includes(String(col.field)) : false;
15
- if (col.showInColumnChoose === false) return false;
16
+ if (col.showInColumnChoose === false || _hooks.nonActionColumn.includes(col.field)) return false;
16
17
  if (inGroup && !('children' in col && Array.isArray(col.children))) {
17
18
  return false;
18
19
  }
@@ -2031,7 +2031,25 @@ const TableContainerEdit = props => {
2031
2031
  }
2032
2032
  contextMenuClick?.(args);
2033
2033
  };
2034
+
2035
+ // Chống fire onCellClick trùng lặp: double-click = 2 lần mousedown nên callback sẽ bị gọi 2 lần.
2036
+ // Chỉ bỏ qua khi click LIÊN TIẾP cùng 1 cell trong khoảng thời gian rất ngắn.
2037
+ const lastCellClickRef = _react.default.useRef({
2038
+ key: '',
2039
+ time: 0
2040
+ });
2034
2041
  const handleCellClick = (rowNumber, record, column, rowId, cellValue) => {
2042
+ const clickKey = `${rowId}::${column.field ?? ''}`;
2043
+ const now = Date.now();
2044
+
2045
+ // cùng cell && trong vòng 300ms => coi là double-click, bỏ qua lần lặp
2046
+ if (lastCellClickRef.current.key === clickKey && now - lastCellClickRef.current.time < 300) {
2047
+ return;
2048
+ }
2049
+ lastCellClickRef.current = {
2050
+ key: clickKey,
2051
+ time: now
2052
+ };
2035
2053
  const cellClickCallback = newOptions => {
2036
2054
  if (newOptions) {
2037
2055
  const newElem = {
@@ -1267,6 +1267,11 @@ const TableBodyCellEdit = props => {
1267
1267
  }
1268
1268
  } else {
1269
1269
  handleMouseDown(cell.row.id, cell.column.id);
1270
+
1271
+ // fire onCellClick ngay lần click đầu (trước đây chỉ fire khi cell đã ở trạng thái editing)
1272
+ if (canEdit) {
1273
+ handleCellClick?.(rowNumber, record, columnMeta, record[rowKey], record[columnMeta.field ?? '']);
1274
+ }
1270
1275
  if (editingKey) {
1271
1276
  setTimeout(() => {
1272
1277
  setEditingKey?.('');
@@ -167,7 +167,7 @@ export declare const fixColumnsLeft: <RecordType>(columns: ColumnTable<RecordTyp
167
167
  haveSum?: boolean;
168
168
  isSummary?: boolean;
169
169
  sumGroup?: boolean;
170
- summaryTemplate?: (data: number, key: string) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode;
170
+ summaryTemplate?: (data: number, key: string) => import("react").ReactNode | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
171
171
  sorter?: boolean;
172
172
  allowFiltering?: boolean;
173
173
  allowSortering?: boolean;
@@ -179,27 +179,27 @@ export declare const fixColumnsLeft: <RecordType>(columns: ColumnTable<RecordTyp
179
179
  showFilterSearch?: boolean;
180
180
  hidden?: boolean;
181
181
  visible?: boolean;
182
- headerTooltip?: string | boolean | (() => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
182
+ headerTooltip?: string | boolean | (() => import("react").ReactNode | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>);
183
183
  columnGroupText?: string;
184
184
  headerTextAlign?: import("./../../grid-component/type").ITextAlign;
185
- headerTemplate?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode | ((column: ColumnTable<RecordType>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
185
+ headerTemplate?: import("react").ReactNode | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | ((column: ColumnTable<RecordType>) => import("react").ReactNode | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>);
186
186
  fixedType?: import("./../../grid-component/type").FixedType;
187
187
  headerTextWrap?: boolean;
188
188
  ellipsis?: boolean;
189
189
  allowResizing?: boolean;
190
190
  align?: import("./../../grid-component/type").ITextAlign;
191
191
  textAlign?: import("./../../grid-component/type").ITextAlign;
192
- template?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode | ((args: import("./../../grid-component/type").ColumnTemplate<RecordType>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
193
- linkTemplate?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode | ((args: import("./../../grid-component/type").ColumnTemplate<RecordType>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
192
+ template?: import("react").ReactNode | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | ((args: import("./../../grid-component/type").ColumnTemplate<RecordType>) => import("react").ReactNode | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>);
193
+ linkTemplate?: import("react").ReactNode | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | ((args: import("./../../grid-component/type").ColumnTemplate<RecordType>) => import("react").ReactNode | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>);
194
194
  showTooltip?: boolean;
195
195
  tooltipDescription?: string | ((args: {
196
196
  value: any;
197
197
  rowData: RecordType;
198
- }) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
199
- onCellStyles?: Omit<CSSProperties, "width" | "minWidth" | "left" | "right" | "position" | "display"> | ((cellValue: any, cell: import("@tanstack/react-table").Cell<RecordType, unknown>) => Omit<CSSProperties, "width" | "minWidth" | "left" | "right" | "position" | "display">);
200
- onCellHeaderStyles?: Omit<CSSProperties, "width" | "minWidth" | "left" | "right" | "position" | "display"> | ((cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "width" | "minWidth" | "left" | "right" | "position" | "display">);
198
+ }) => import("react").ReactNode | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>);
199
+ onCellStyles?: Omit<CSSProperties, "left" | "right" | "display" | "minWidth" | "position" | "width"> | ((cellValue: any, cell: import("@tanstack/react-table").Cell<RecordType, unknown>) => Omit<CSSProperties, "left" | "right" | "display" | "minWidth" | "position" | "width">);
200
+ onCellHeaderStyles?: Omit<CSSProperties, "left" | "right" | "display" | "minWidth" | "position" | "width"> | ((cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "left" | "right" | "display" | "minWidth" | "position" | "width">);
201
201
  onCell?: (rowData: RecordType, index: number) => import("react").TdHTMLAttributes<HTMLTableCellElement>;
202
- onCellFooterStyles?: Omit<CSSProperties, "width" | "minWidth" | "left" | "right" | "position" | "display"> | ((cellValue: any, cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "width" | "minWidth" | "left" | "right" | "position" | "display">);
202
+ onCellFooterStyles?: Omit<CSSProperties, "left" | "right" | "display" | "minWidth" | "position" | "width"> | ((cellValue: any, cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "left" | "right" | "display" | "minWidth" | "position" | "width">);
203
203
  getValue?: (row: any, rowIndex: number) => any;
204
204
  getCellProps?: (value: any, row: any, rowIndex: number) => import("./../../grid-component/type").CellProps;
205
205
  headerCellProps?: import("./../../grid-component/type").CellProps;
@@ -60,6 +60,7 @@ exports.updateColumnWidthsRecursive = updateColumnWidthsRecursive;
60
60
  exports.updateColumnsByGroup = exports.updateColumns1 = void 0;
61
61
  exports.updateOrInsert = updateOrInsert;
62
62
  exports.updateWidthsByOther = updateWidthsByOther;
63
+ var _hooks = require("./../../grid-component/hooks");
63
64
  var _uuid = require("uuid");
64
65
  var _colors = require("@ant-design/colors");
65
66
  var _dayjs = _interopRequireDefault(require("dayjs"));
@@ -2030,8 +2031,8 @@ function convertColumnsToTreeData(columns, groupColumns) {
2030
2031
 
2031
2032
  // Điều kiện filter:
2032
2033
  // - Nếu meta.showInColumnChoose = false => loại bỏ
2033
- // - Nếu không nằm trong groupColumns và không phải column group => loại bỏ
2034
- if (meta.showInColumnChoose === false) return false;
2034
+ // - Nếu là column đặc biệt (selection_column, #, command...) => loại bỏ
2035
+ if (meta.showInColumnChoose === false || _hooks.nonActionColumn.includes(col.id)) return false;
2035
2036
  if (inGroup && !('columns' in col && Array.isArray(col.columns))) {
2036
2037
  return false;
2037
2038
  }
@@ -2062,6 +2063,15 @@ const updateColumns1 = (columns, includes) => {
2062
2063
  if (!column.field) {
2063
2064
  return column;
2064
2065
  }
2066
+
2067
+ // Bỏ qua column đặc biệt (selection_column, #, command, drag-handle) — giữ nguyên visible
2068
+ // nhưng vẫn phải đệ quy children để không bỏ sót column con
2069
+ if (_hooks.nonActionColumn.includes(newColumn.field)) {
2070
+ if (newColumn.children) {
2071
+ newColumn.children = updateColumns1(newColumn.children, includes);
2072
+ }
2073
+ return newColumn;
2074
+ }
2065
2075
  if (newColumn.children) {
2066
2076
  newColumn.children = updateColumns1(newColumn.children, includes);
2067
2077
  hasVisibleChild = newColumn.children.some(child => !child.hidden);
@@ -2077,7 +2077,25 @@ const TableContainerEdit = props => {
2077
2077
  }
2078
2078
  contextMenuClick?.(args);
2079
2079
  };
2080
+
2081
+ // Chống fire onCellClick trùng lặp: double-click = 2 lần mousedown nên callback sẽ bị gọi 2 lần.
2082
+ // Chỉ bỏ qua khi click LIÊN TIẾP cùng 1 cell trong khoảng thời gian rất ngắn.
2083
+ const lastCellClickRef = _react.default.useRef({
2084
+ key: '',
2085
+ time: 0
2086
+ });
2080
2087
  const handleCellClick = (rowNumber, record, column, rowId, cellValue) => {
2088
+ const clickKey = `${rowId}::${column.field ?? ''}`;
2089
+ const now = Date.now();
2090
+
2091
+ // cùng cell && trong vòng 300ms => coi là double-click, bỏ qua lần lặp
2092
+ if (lastCellClickRef.current.key === clickKey && now - lastCellClickRef.current.time < 300) {
2093
+ return;
2094
+ }
2095
+ lastCellClickRef.current = {
2096
+ key: clickKey,
2097
+ time: now
2098
+ };
2081
2099
  const cellClickCallback = newOptions => {
2082
2100
  if (newOptions) {
2083
2101
  const newElem = {
@@ -1349,6 +1349,11 @@ const TableBodyCellEdit = props => {
1349
1349
  }
1350
1350
  } else {
1351
1351
  handleMouseDown(cell.row.id, cell.column.id);
1352
+
1353
+ // fire onCellClick ngay lần click đầu (trước đây chỉ fire khi cell đã ở trạng thái editing)
1354
+ if (canEdit) {
1355
+ handleCellClick?.(rowNumber, record, columnMeta, record[rowKey], record[columnMeta.field ?? '']);
1356
+ }
1352
1357
  if (editingKey) {
1353
1358
  setTimeout(() => {
1354
1359
  setEditingKey?.('');
@@ -2625,9 +2625,8 @@ function convertColumnsToTreeData(columns, groupColumns) {
2625
2625
 
2626
2626
  // Điều kiện filter:
2627
2627
  // - Nếu meta.showInColumnChoose = false => loại bỏ
2628
- // - Nếu không nằm trong groupColumns và không phải column group => loại bỏ
2629
- // if (meta.showInColumnChoose === false || col.id === "selection_column") return false
2630
- if (meta.showInColumnChoose === false) return false;
2628
+ // - Nếu là column đặc biệt (selection_column, #, command...) => loại bỏ
2629
+ if (meta.showInColumnChoose === false || _hooks.nonActionColumn.includes(col.id)) return false;
2631
2630
  // if (inGroup && !('columns' in col && Array.isArray((col as any).columns))) {
2632
2631
  if (inGroup && !('columns' in col && Array.isArray(col.columns))) {
2633
2632
  return false;
@@ -2659,6 +2658,15 @@ const updateColumns1 = (columns, includes) => {
2659
2658
  if (!column.field) {
2660
2659
  return column;
2661
2660
  }
2661
+
2662
+ // Bỏ qua column đặc biệt (selection_column, #, command, drag-handle) — giữ nguyên visible
2663
+ // nhưng vẫn phải đệ quy children để không bỏ sót column con
2664
+ if (_hooks.nonActionColumn.includes(newColumn.field)) {
2665
+ if (newColumn.children) {
2666
+ newColumn.children = updateColumns1(newColumn.children, includes);
2667
+ }
2668
+ return newColumn;
2669
+ }
2662
2670
  if (newColumn.children) {
2663
2671
  newColumn.children = updateColumns1(newColumn.children, includes);
2664
2672
  hasVisibleChild = newColumn.children.some(child => !child.hidden);
@@ -66,6 +66,7 @@ exports.updateColumnWidthsRecursive = updateColumnWidthsRecursive;
66
66
  exports.updateColumnsByGroup = exports.updateColumns1 = void 0;
67
67
  exports.updateOrInsert = updateOrInsert;
68
68
  exports.updateWidthsByOther = updateWidthsByOther;
69
+ var _hooks = require("../../grid-component/hooks");
69
70
  var _useSelection = require("rc-master-ui/es/table/hooks/useSelection");
70
71
  var _uuid = require("uuid");
71
72
  var _colors = require("@ant-design/colors");
@@ -2010,8 +2011,8 @@ function convertColumnsToTreeData(columns, groupColumns) {
2010
2011
 
2011
2012
  // Điều kiện filter:
2012
2013
  // - Nếu meta.showInColumnChoose = false => loại bỏ
2013
- // - Nếu không nằm trong groupColumns và không phải column group => loại bỏ
2014
- if (meta.showInColumnChoose === false) return false;
2014
+ // - Nếu là column đặc biệt (selection_column, #, command...) => loại bỏ
2015
+ if (meta.showInColumnChoose === false || _hooks.nonActionColumn.includes(col.id)) return false;
2015
2016
  if (inGroup && !('columns' in col && Array.isArray(col.columns))) {
2016
2017
  return false;
2017
2018
  }
@@ -2042,6 +2043,15 @@ const updateColumns1 = (columns, includes) => {
2042
2043
  if (!column.field) {
2043
2044
  return column;
2044
2045
  }
2046
+
2047
+ // Bỏ qua column đặc biệt (selection_column, #, command, drag-handle) — giữ nguyên visible
2048
+ // nhưng vẫn phải đệ quy children để không bỏ sót column con
2049
+ if (_hooks.nonActionColumn.includes(newColumn.field)) {
2050
+ if (newColumn.children) {
2051
+ newColumn.children = updateColumns1(newColumn.children, includes);
2052
+ }
2053
+ return newColumn;
2054
+ }
2045
2055
  if (newColumn.children) {
2046
2056
  newColumn.children = updateColumns1(newColumn.children, includes);
2047
2057
  hasVisibleChild = newColumn.children.some(child => !child.hidden);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-grid-template",
3
- "version": "1.9.79",
3
+ "version": "1.9.82",
4
4
  "description": "es-grid-template",
5
5
  "keywords": [
6
6
  "react",