es-grid-template 1.7.31 → 1.7.33

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.
Files changed (45) hide show
  1. package/es/grid-component/ColumnsChoose.js +0 -3
  2. package/es/grid-component/InternalTable.js +0 -4
  3. package/es/grid-component/TableGrid.js +0 -4
  4. package/es/grid-component/TempTable.js +2 -0
  5. package/es/grid-component/hooks/columns/index.js +0 -8
  6. package/es/grid-component/hooks/utils.js +0 -14
  7. package/es/grid-component/table/GridEdit.js +3 -5
  8. package/es/table-component/TableContainer.js +7 -0
  9. package/es/table-component/TableContainerEdit.d.ts +0 -1
  10. package/es/table-component/TableContainerEdit.js +31 -12
  11. package/es/table-component/body/TableBodyCellEdit.js +9 -11
  12. package/es/table-component/body/TableBodyRow.js +5 -0
  13. package/es/table-component/header/TableHeadCell.d.ts +2 -0
  14. package/es/table-component/header/TableHeadCell.js +8 -4
  15. package/es/table-component/header/TableHeadRow.d.ts +1 -1
  16. package/es/table-component/header/TableHeadRow.js +4 -5
  17. package/es/table-component/hook/utils.js +4 -4
  18. package/es/table-component/style.scss +22 -0
  19. package/es/table-component/table/Grid.js +3 -1
  20. package/es/table-component/table/TableWrapper.js +5 -5
  21. package/es/table-component/type.d.ts +5 -0
  22. package/es/table-component/useContext.d.ts +1 -0
  23. package/lib/grid-component/ColumnsChoose.js +0 -3
  24. package/lib/grid-component/InternalTable.js +0 -4
  25. package/lib/grid-component/TableGrid.js +0 -4
  26. package/lib/grid-component/TempTable.js +2 -0
  27. package/lib/grid-component/hooks/columns/index.js +0 -8
  28. package/lib/grid-component/hooks/utils.js +0 -14
  29. package/lib/grid-component/table/GridEdit.js +3 -5
  30. package/lib/table-component/TableContainer.js +7 -0
  31. package/lib/table-component/TableContainerEdit.d.ts +0 -1
  32. package/lib/table-component/TableContainerEdit.js +31 -12
  33. package/lib/table-component/body/TableBodyCellEdit.js +9 -10
  34. package/lib/table-component/body/TableBodyRow.js +5 -0
  35. package/lib/table-component/header/TableHeadCell.d.ts +2 -0
  36. package/lib/table-component/header/TableHeadCell.js +7 -4
  37. package/lib/table-component/header/TableHeadRow.d.ts +1 -1
  38. package/lib/table-component/header/TableHeadRow.js +4 -5
  39. package/lib/table-component/hook/utils.js +4 -4
  40. package/lib/table-component/style.scss +22 -0
  41. package/lib/table-component/table/Grid.js +3 -1
  42. package/lib/table-component/table/TableWrapper.js +5 -5
  43. package/lib/table-component/type.d.ts +5 -0
  44. package/lib/table-component/useContext.d.ts +1 -0
  45. package/package.json +1 -1
@@ -211,7 +211,6 @@
211
211
  //
212
212
  // const onCheck = (keys: string[]) => {
213
213
  //
214
- // console.log('keys', keys)
215
214
  // // setSelectedKeys(keys)
216
215
  // setMergedSelectedKeys(keys)
217
216
  // // setIsManualUpdate(true)
@@ -220,12 +219,10 @@
220
219
  //
221
220
  // const handleAccept = () => {
222
221
  //
223
- // console.log('mergedSelectedKeys', mergedSelectedKeys)
224
222
  //
225
223
  // // const rs1 = updateColumns(propsColumns, selectedKeys)
226
224
  // const rs1 = updateColumns(propsColumns, mergedSelectedKeys)
227
225
  //
228
- // console.log('rs1', rs1)
229
226
  //
230
227
  // triggerChangeColumns?.(rs1, 'columnChoose')
231
228
  //
@@ -299,7 +299,6 @@ const InternalTable = props => {
299
299
  setColumns(propsColumns);
300
300
  }, [propsColumns]);
301
301
  const handleOnFilter = queries => {
302
- console.log('queries', queries);
303
302
  if (onFilter) {
304
303
  onFilter?.(convertFilters(queries));
305
304
  } else {
@@ -345,8 +344,6 @@ const InternalTable = props => {
345
344
  searchValue,
346
345
  setSearchValue
347
346
  }) => {
348
- // console.log('selectedKeys', selectedKeys)
349
-
350
347
  const type = getTypeFilter(column);
351
348
  // const operatorOptions = type === ('Checkbox' || 'Dropdown' || 'DropTree' || 'CheckboxDropdown') ? booleanOperator : (!type || type === 'Text' ? stringOperator : numberOperator)
352
349
 
@@ -899,7 +896,6 @@ const InternalTable = props => {
899
896
  }
900
897
  };
901
898
  const handleChange = (paging, filters, sorter) => {
902
- console.log('sorter', sorter);
903
899
  onSorter?.(sorter);
904
900
  };
905
901
 
@@ -351,10 +351,6 @@ const TableGrid = props => {
351
351
  hideSelectAll: !type || type === 'single' || mode === 'radio' ? true : hideSelectAll ?? type !== 'multiple'
352
352
  }
353
353
 
354
- // onScroll={(event) => {
355
- // console.log('event', event)
356
- // }}
357
-
358
354
  // onFilter={(val: any) => {
359
355
  // handleOnFilter(val)
360
356
  // // triggerFilter?.(convertFilters(val))
@@ -12,6 +12,8 @@ const TempTable = props => {
12
12
 
13
13
  // const TabComponent = groupAble ? InternalTable : Table
14
14
  const TabComponent = editAble ? Table : InternalTable;
15
+ // const TabComponent = InternalTable
16
+
15
17
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(TabComponent, _extends({}, rest, {
16
18
  infiniteScroll: infiniteScroll,
17
19
  groupAble: groupAble,
@@ -68,9 +68,6 @@ export const getValueCell = (column, value, record, rowIndex, colIndex, format)
68
68
  // const contentNumber = !isEmpty(value) ? ((dec || dec === 0) ? parseFloat(Number(value).toFixed(dec)).toString() : value.toString()) : '0'
69
69
 
70
70
  const tmpval = typeof value === 'string' ? Number(value) : value;
71
-
72
- // console.log('aaaaa', Number(value))
73
-
74
71
  const numericFormatProps = {
75
72
  thousandSeparator: checkThousandSeparator(thousandSeparator, decimalSeparator),
76
73
  decimalSeparator: checkDecimalSeparator(thousandSeparator, decimalSeparator),
@@ -84,7 +81,6 @@ export const getValueCell = (column, value, record, rowIndex, colIndex, format)
84
81
  // if ( typeof value === "string") {
85
82
  // const ttt = removeNumericFormat(value, undefined, numericFormatProps )
86
83
  //
87
- // console.log('ttt', ttt)
88
84
  // }
89
85
 
90
86
  const contentNumber = !isEmpty(value) ? dec || dec === 0 ? parseFloat(tmpval.toFixed(dec)).toString() : tmpval.toString() : '0';
@@ -128,9 +124,6 @@ export const renderValueCell = (column, value, record, rowIndex, colIndex, forma
128
124
  // const contentNumber = !isEmpty(value) ? ((dec || dec === 0) ? parseFloat(Number(value).toFixed(dec)).toString() : value.toString()) : '0'
129
125
 
130
126
  const tmpval = typeof value === 'string' ? Number(value) : value;
131
-
132
- // console.log('aaaaa', Number(value))
133
-
134
127
  const numericFormatProps = {
135
128
  thousandSeparator: checkThousandSeparator(thousandSeparator, decimalSeparator),
136
129
  decimalSeparator: checkDecimalSeparator(thousandSeparator, decimalSeparator),
@@ -144,7 +137,6 @@ export const renderValueCell = (column, value, record, rowIndex, colIndex, forma
144
137
  // if ( typeof value === "string") {
145
138
  // const ttt = removeNumericFormat(value, undefined, numericFormatProps )
146
139
  //
147
- // console.log('ttt', ttt)
148
140
  // }
149
141
 
150
142
  const contentNumber = !isEmpty(value) ? dec || dec === 0 ? parseFloat(tmpval.toFixed(dec)).toString() : tmpval.toString() : '0';
@@ -602,7 +602,6 @@ export function addRowsDownWithCtrl(arr, n) {
602
602
 
603
603
  // Hàm kiểm tra kiểu date hợp lệ
604
604
  const isValidDate = item => {
605
- // console.log('!isNaN(Date.parse(d))', !isNaN(Date.parse(d)))
606
605
  // return !isNaN(Date.parse(d))
607
606
 
608
607
  if (typeof item === 'number') {
@@ -742,7 +741,6 @@ export function addRowsDown(arr, n) {
742
741
  // const isValidDate = (item: any) => {
743
742
  //
744
743
  //
745
- // // console.log('!isNaN(Date.parse(d))', !isNaN(Date.parse(d)))
746
744
  // // return !isNaN(Date.parse(d))
747
745
  //
748
746
  // if (typeof item === 'number') {
@@ -889,7 +887,6 @@ export function addRowsUpWithCtrl(array, n) {
889
887
 
890
888
  // Hàm kiểm tra kiểu date hợp lệ
891
889
  const isValidDate = item => {
892
- // console.log('!isNaN(Date.parse(d))', !isNaN(Date.parse(d)))
893
890
  // return !isNaN(Date.parse(d))
894
891
 
895
892
  if (typeof item === 'number') {
@@ -1033,7 +1030,6 @@ export function addRowsUp(array, n) {
1033
1030
  // const isValidDate = (item: any) => {
1034
1031
  //
1035
1032
  //
1036
- // // console.log('!isNaN(Date.parse(d))', !isNaN(Date.parse(d)))
1037
1033
  // // return !isNaN(Date.parse(d))
1038
1034
  //
1039
1035
  // if (typeof item === 'number') {
@@ -2571,17 +2567,12 @@ export function mergeWithFilter(dataArray, dataFilter) {
2571
2567
  const result = [...dataArray];
2572
2568
  dataFilter.forEach((filterItem, i) => {
2573
2569
  const existsInArray = result.find(item => item.rowId === filterItem.rowId);
2574
-
2575
- // console.log('existsInArray', existsInArray)
2576
-
2577
2570
  if (!existsInArray) {
2578
2571
  // tìm index của phần tử trước đó trong dataFilter
2579
2572
  for (let j = i - 1; j >= 0; j--) {
2580
2573
  const prevFilterItem = dataFilter[j];
2581
2574
  const indexInResult = result.findIndex(item => item.rowId === prevFilterItem.rowId);
2582
2575
  if (indexInResult !== -1) {
2583
- // console.log('filterItem', filterItem)
2584
-
2585
2576
  result.splice(indexInResult + 1, 0, filterItem);
2586
2577
  return;
2587
2578
  }
@@ -2601,17 +2592,12 @@ export function mergeWithFilter2(dataArray, dataFilter) {
2601
2592
  const result = [...dataArray];
2602
2593
  dataFilter.forEach((filterItem, i) => {
2603
2594
  const existsInArray = result.find(item => item.rowId === filterItem.rowId);
2604
-
2605
- // console.log('existsInArray', existsInArray)
2606
-
2607
2595
  if (!existsInArray) {
2608
2596
  // tìm index của phần tử trước đó trong dataFilter
2609
2597
  for (let j = i - 1; j >= 0; j--) {
2610
2598
  const prevFilterItem = dataFilter[j];
2611
2599
  const indexInResult = result.findIndex(item => item.rowId === prevFilterItem.rowId);
2612
2600
  if (indexInResult !== -1) {
2613
- // console.log('filterItem', filterItem)
2614
-
2615
2601
  result.splice(indexInResult + 1, 0, filterItem);
2616
2602
  return;
2617
2603
  }
@@ -745,7 +745,7 @@ const GridEdit = props => {
745
745
  const newExpandedKeys = [...mergedExpandedKeys, key];
746
746
  setInnerExpandedKeys(newExpandedKeys);
747
747
  }
748
- }, [dataSource, defaultValue, getRowKey, mergedExpandedKeys, rowKey, rowsFocus, triggerChangeData]);
748
+ }, [dataSource, defaultValue, getRowKey, mergedExpandedKeys, mergedFilterKeys, originData, rowKey, rowsFocus, setMergedFilterKeys, triggerChangeData]);
749
749
  const handleDeleteRows = React.useCallback(item => {
750
750
  // setTimeout(() => {
751
751
  // onAddBgSelectedCell(selectedCells.current, id)
@@ -811,7 +811,6 @@ const GridEdit = props => {
811
811
  indexRow,
812
812
  key
813
813
  } = args;
814
- console.log('changeType', changeType);
815
814
  if (changeType === 'blur') {
816
815
  const handleChangeCallback = callbackData => {
817
816
  const callbackRecord = callbackData;
@@ -857,7 +856,7 @@ const GridEdit = props => {
857
856
  onSubmit(record);
858
857
  }
859
858
  };
860
- const handleDeleteContent = React.useCallback(() => {
859
+ const handleDeleteContent = () => {
861
860
  if (selectedCells.current.size > 0) {
862
861
  const newData = [...dataSource];
863
862
 
@@ -897,7 +896,7 @@ const GridEdit = props => {
897
896
  const rsFilterData = updateOrInsert(flattenArray([...originData]), newData);
898
897
  triggerChangeData?.([...rsFilterData], 'DELETE_CONTENT');
899
898
  }
900
- }, [dataSource, getRowKey, handleCellChange, originData, triggerChangeData, visibleCols]);
899
+ };
901
900
  const toolbarItemsBottom = useMemo(() => {
902
901
  if (!rowsFocus || rowsFocus.length === 0) {
903
902
  return toolbarItems?.filter(it => it.position === 'Bottom' && it.visible !== false && it.key !== 'DUPLICATE' && it.key !== 'INSERT_BEFORE' && it.key !== 'INSERT_AFTER' && it.key !== 'DELETE_ROWS' && it.key !== 'INSERT_CHILDREN').map(item => {
@@ -1470,7 +1469,6 @@ const GridEdit = props => {
1470
1469
  row.replace(/\r/g, "").split("\t")
1471
1470
 
1472
1471
  // {
1473
- // console.log('row', row)
1474
1472
  // return row.replace(/\r/g, "").split("\t")
1475
1473
  // }
1476
1474
  );
@@ -122,6 +122,12 @@ const TableContainer = props => {
122
122
  virtualPaddingRight = fixedRightColumns && fixedRightColumns.length > 0 ? pdRight - rightWidth > 0 ? pdRight - rightWidth : 0 : pdRight;
123
123
  // virtualPaddingRight = columnVirtualizer.getTotalSize() - (virtualColumns[virtualColumns.length - 1]?.end ?? 0)
124
124
  }
125
+ const columnSizingState = table.getState().columnSizing;
126
+ React.useEffect(() => {
127
+ requestAnimationFrame(() => {
128
+ columnVirtualizer.measure();
129
+ });
130
+ }, [columnSizingState, columnVirtualizer]);
125
131
  const triggerCommandClick = () => {};
126
132
  return /*#__PURE__*/React.createElement("div", {
127
133
  ref: containerRef,
@@ -182,6 +188,7 @@ const TableContainer = props => {
182
188
  triggerChangeColumns: triggerChangeColumns
183
189
  })))), /*#__PURE__*/React.createElement(TableContext.Provider, {
184
190
  value: {
191
+ t,
185
192
  locale,
186
193
  prefix,
187
194
  id,
@@ -22,7 +22,6 @@ type TableContainerProps<T> = Omit<TableProps<T>, 'columns'> & {
22
22
  innerHeight: number;
23
23
  innerWidth: number;
24
24
  };
25
- triggerPaste?: (pastedRows: T[], pastedColumnsArray: string[], newData: T[], copyRows: T[]) => void;
26
25
  mergedFilterKeys?: any;
27
26
  setMergedFilterKeys?: any;
28
27
  setExpanded?: any;
@@ -277,6 +277,8 @@ const TableContainerEdit = props => {
277
277
  }
278
278
  }, [validate, dataSource]);
279
279
  const visibleColumns = table.getVisibleLeafColumns();
280
+ // const visibleColumns = table.getVisibleFlatColumns();
281
+
280
282
  const fixedLeftColumns = table.getState().columnPinning.left ? visibleColumns.filter(vc => table.getState().columnPinning.left?.includes(vc.id)) : [];
281
283
  const fixedRightColumns = table.getState().columnPinning.right ? visibleColumns.filter(vc => table.getState().columnPinning.right?.includes(vc.id)) : [];
282
284
 
@@ -293,7 +295,7 @@ const TableContainerEdit = props => {
293
295
  // },
294
296
 
295
297
  measureElement: typeof window !== 'undefined' && navigator.userAgent.indexOf('Firefox') === -1 ? element => element?.getBoundingClientRect().height : undefined,
296
- overscan: 1 //how many columns to render on each side off screen each way (adjust this for performance)
298
+ overscan: 0 //how many columns to render on each side off screen each way (adjust this for performance)
297
299
  });
298
300
  const virtualColumns = columnVirtualizer.getVirtualItems();
299
301
  const cacheColumns = columnVirtualizer.measurementsCache;
@@ -380,7 +382,7 @@ const TableContainerEdit = props => {
380
382
  }, [onDataChange]);
381
383
  const triggerPaste = React.useCallback((pastedRows, pastedColumnsArray, newData, copyRows) => {
382
384
  const handlePasteCallback = callbackData => {
383
- const rsFilterData = updateOrInsert(flattenArray([...dataSource]), callbackData);
385
+ const rsFilterData = updateOrInsert(flattenArray([...originData]), callbackData);
384
386
  const rs = unFlattenData(rsFilterData);
385
387
  triggerChangeData(rs);
386
388
  };
@@ -391,7 +393,7 @@ const TableContainerEdit = props => {
391
393
  pasteData: pastedRows,
392
394
  copyRows,
393
395
  type: 'onPaste',
394
- data: dataSource,
396
+ data: originData,
395
397
  pastedColumns: pastedColumnsArray
396
398
  }, handlePasteCallback);
397
399
  } else {
@@ -400,7 +402,7 @@ const TableContainerEdit = props => {
400
402
  pasteData: pastedRows,
401
403
  type: 'onPaste',
402
404
  copyRows,
403
- data: dataSource,
405
+ data: originData,
404
406
  pastedColumns: pastedColumnsArray
405
407
  }, handlePasteCallback);
406
408
  triggerChangeData(newData);
@@ -408,7 +410,7 @@ const TableContainerEdit = props => {
408
410
  } else {
409
411
  triggerChangeData(newData);
410
412
  }
411
- }, [dataSource, onCellPaste, triggerChangeData]);
413
+ }, [onCellPaste, originData, triggerChangeData]);
412
414
  const handlePasted = React.useCallback(pasteData => {
413
415
  if (!startCell) {
414
416
  return;
@@ -606,7 +608,7 @@ const TableContainerEdit = props => {
606
608
  }, [startCell, endCell, table, copySelectionToClipboard]);
607
609
  React.useEffect(() => {
608
610
  const handlePaste = e => {
609
- if (startCell) {
611
+ if (startCell && !editingKey) {
610
612
  e.preventDefault(); // Chặn hành vi mặc định
611
613
  const clipboardText = e.clipboardData?.getData('text/plain') ?? '';
612
614
  handlePasteToTable(clipboardText);
@@ -614,7 +616,7 @@ const TableContainerEdit = props => {
614
616
  };
615
617
  window.addEventListener('paste', handlePaste);
616
618
  return () => window.removeEventListener('paste', handlePaste);
617
- }, [startCell, endCell, table, handlePasteToTable]);
619
+ }, [startCell, endCell, table, handlePasteToTable, editingKey]);
618
620
  React.useEffect(() => {
619
621
  const handleClickOutside = event => {
620
622
  const element = event.target;
@@ -627,7 +629,7 @@ const TableContainerEdit = props => {
627
629
  const isInsideContainerContext = containerContextMenu && element.closest(".popup-context-menu");
628
630
  const isInsideToolbar = element.closest(`.ui-rc-toolbar-selection-overflow-item`) && itemContainer;
629
631
  const isInsideHeader = itemHeader && itemHeader.contains(event.target);
630
- if (isInsideContainer || isInsideToolbar || isInsideHeader || isInsideContainerContext) {
632
+ if (isInsideContainer || isInsideToolbar || isInsideHeader || isInsideContainerContext || element.id === id) {
631
633
  return;
632
634
  }
633
635
  if (containerRef.current && tableBody && !tableBody.contains(event.target)) {
@@ -654,14 +656,30 @@ const TableContainerEdit = props => {
654
656
  // document.removeEventListener('touchstart', handleClickOutside)
655
657
  };
656
658
  }, [dataSource, editingKey, id, onBlur]);
659
+ const columnSizingState = table.getState().columnSizing;
660
+ React.useEffect(() => {
661
+ requestAnimationFrame(() => {
662
+ columnVirtualizer.measure();
663
+ });
664
+ }, [columnSizingState, columnVirtualizer]);
657
665
 
658
666
  // React.useEffect(() => {
659
- // const totalHeight = height
667
+ // if (!containerRef.current) return;
668
+
669
+ // const containerWidth = containerRef.current.offsetWidth - 2;
670
+ // const totalWidth = table.getTotalSize();
671
+
672
+ // if (totalWidth && totalWidth < containerWidth) {
673
+ // const factor = containerWidth / totalWidth;
660
674
 
661
- // if (totalHeight && topToolbarRef.current && bottomToolbarRef.current) {
662
- // settableHeight(totalHeight - topToolbarRef.current.offsetHeight - bottomToolbarRef.current.offsetHeight)
675
+ // table.setColumnSizing(
676
+ // table.getAllLeafColumns().reduce((acc, col) => {
677
+ // acc[col.id] = ((col.getSize() || col.columnDef.size || 150) * factor);
678
+ // return acc;
679
+ // }, {} as Record<string, number>)
680
+ // );
663
681
  // }
664
- // }, [id, height, editAble])
682
+ // }, [table.getTotalSize(), windowSize.innerWidth])
665
683
 
666
684
  React.useEffect(() => {
667
685
  const totalHeight = minHeight ?? height;
@@ -1484,6 +1502,7 @@ const TableContainerEdit = props => {
1484
1502
  onSubmit: handleSubmit(onSubmit)
1485
1503
  }, /*#__PURE__*/React.createElement(TableContext.Provider, {
1486
1504
  value: {
1505
+ t,
1487
1506
  locale,
1488
1507
  prefix,
1489
1508
  id,
@@ -1,9 +1,7 @@
1
1
  import { flexRender } from "@tanstack/react-table";
2
2
  import Space from "rc-master-ui/es/space";
3
3
  import Command from "../components/command/Command";
4
-
5
- // import ReactDOMServer from 'react-dom/server'
6
-
4
+ import ReactDOMServer from 'react-dom/server';
7
5
  import { addRowsDown, addRowsDownWithCtrl, addRowsUp, addRowsUpWithCtrl, flattenArray, flattenData,
8
6
  // getCellsByPosition,
9
7
  getColIdsBetween, getCommonPinningStyles, getEditType, getRowIdsBetween, getSelectedCellMatrix, isEditable, isObjEmpty, isObjEqual, newGuid, unFlattenData, updateOrInsert } from "../hook/utils";
@@ -46,7 +44,7 @@ const renderCommand = args => {
46
44
  visible: typeof it.visible === 'function' ? it.visible?.(record) : it.visible
47
45
  };
48
46
  }) : [];
49
- return /*#__PURE__*/React.createElement("span", {
47
+ return /*#__PURE__*/React.createElement("div", {
50
48
  className: "ui-rc_cell-content"
51
49
  }, /*#__PURE__*/React.createElement(Space, null, commands.filter(it => it.visible !== false).map(item => {
52
50
  return /*#__PURE__*/React.createElement(Command, {
@@ -134,8 +132,7 @@ const TableBodyCellEdit = props => {
134
132
  const expandIconColumnIndex = expandable?.expandIconColumnIndex ?? 0;
135
133
  const record = cell.row.original;
136
134
  const columnMeta = cell.column.columnDef.meta ?? {};
137
-
138
- // const cellContent = columnMeta.type === 'checkbox' ? '' : flexRender(cell.column.columnDef.cell, cell.getContext());
135
+ const cellContent = columnMeta.type === 'checkbox' ? '' : flexRender(cell.column.columnDef.cell, cell.getContext());
139
136
  // const html = ReactDOMServer.renderToStaticMarkup(<>{cellContent}</>);
140
137
  // const hasValue = html.trim().length > 0;
141
138
 
@@ -205,7 +202,7 @@ const TableBodyCellEdit = props => {
205
202
  colSelectIds.forEach(colId => {
206
203
  const cellll = row.getVisibleCells().find(c => c.column.id === colId);
207
204
  const value = cellll?.getValue();
208
- rowData.push(value !== undefined ? String(value) : '');
205
+ rowData.push(value !== undefined ? value : '');
209
206
  });
210
207
  dataSelected.push(rowData);
211
208
  });
@@ -595,7 +592,7 @@ const TableBodyCellEdit = props => {
595
592
  handleEdit(e);
596
593
  return;
597
594
  }
598
- if (e.key.length === 1) {
595
+ if (e.key.length === 1 && !e.ctrlKey) {
599
596
  e.preventDefault();
600
597
  e.stopPropagation();
601
598
  handleEdit(e);
@@ -728,7 +725,7 @@ const TableBodyCellEdit = props => {
728
725
  if (cell.column.id === "command") {
729
726
  return /*#__PURE__*/React.createElement("td", {
730
727
  key: cell.id,
731
- className: classNames(`${prefix}-grid-cell`, {
728
+ className: classNames(`${prefix}-grid-cell ${prefix}-grid-cell-command`, {
732
729
  [`${prefix}-grid-cell-ellipsis`]: true,
733
730
  [`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
734
731
  [`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
@@ -840,8 +837,9 @@ const TableBodyCellEdit = props => {
840
837
  "data-tooltip-id": `${id}-tooltip-content`
841
838
  // data-tooltip-html={!isEditing && !hasValue && !message ? undefined : ReactDOMServer.renderToStaticMarkup(<>{rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : cellContent}</>)}
842
839
  // data-tooltip-content={!isEditing && !message ? undefined : rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : record[columnMeta.field ?? '']}
840
+ // data-tooltip-content={isEditing && message ? message : rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : record[columnMeta.field ?? '']}
843
841
  ,
844
- "data-tooltip-content": isEditing && message ? message : rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : record[columnMeta.field ?? ''],
842
+ "data-tooltip-html": isEditing && message ? message : rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : ReactDOMServer.renderToStaticMarkup( /*#__PURE__*/React.createElement(React.Fragment, null, cellContent)),
845
843
  className: classNames(`${prefix}-grid-cell cell-editable `, {
846
844
  [`${prefix}-grid-cell-ellipsis`]: true,
847
845
  'cell-editing': isEditing,
@@ -1032,7 +1030,7 @@ const TableBodyCellEdit = props => {
1032
1030
  handleEdit(e);
1033
1031
  // setEditingKey?.(cell.row.id)
1034
1032
  }
1035
- })), !isSelecting && !isEditing && cell.row.id === endCell?.rowId && cell.column.getIndex() === rangeState?.endColIndex && /*#__PURE__*/React.createElement("div", {
1033
+ })), !isSelecting && !isEditing && rowNumber === rangeState?.endRowIndex && cell.column.getIndex() === rangeState?.endColIndex && /*#__PURE__*/React.createElement("div", {
1036
1034
  className: 'dragging-point',
1037
1035
  onMouseDown: e => {
1038
1036
  e.preventDefault();
@@ -27,8 +27,13 @@ const TableBodyRow = ({
27
27
  recordDoubleClick
28
28
  } = React.useContext(TableContext);
29
29
  const visibleCells = row.getVisibleCells();
30
+
31
+ // console.log('visibleCells', visibleCells)
32
+
30
33
  const virtualColumns = columnVirtualizer.getVirtualItems();
31
34
 
35
+ // console.log('virtualColumns', virtualColumns)
36
+
32
37
  // table.options.set
33
38
 
34
39
  return /*#__PURE__*/React.createElement("tr", {
@@ -1,11 +1,13 @@
1
1
  import type { Table } from '@tanstack/react-table';
2
2
  import { type Header } from '@tanstack/react-table';
3
3
  import React from 'react';
4
+ import type { Virtualizer } from '@tanstack/react-virtual';
4
5
  interface TableHeadCellProps<T> {
5
6
  t?: any;
6
7
  table: Table<T>;
7
8
  header: Header<T, unknown>;
8
9
  getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
10
+ columnVirtualizer: Virtualizer<HTMLDivElement, HTMLTableCellElement>;
9
11
  colSpan: any;
10
12
  rowSpan: any;
11
13
  }
@@ -13,6 +13,7 @@ import { extendsObject, getCommonPinningStyles, getDefaultOperator, getTypeFilte
13
13
  import { TableContext } from "../useContext";
14
14
  import { renderFilter } from "./renderFilter";
15
15
  import ReactDOMServer from 'react-dom/server';
16
+
16
17
  // import { ColumnTable } from "../type";
17
18
 
18
19
  // import { Tooltip } from 'react-tooltip'
@@ -22,13 +23,14 @@ const TableHeadCell = props => {
22
23
  header,
23
24
  getPopupContainer,
24
25
  table,
25
- t,
26
+ // t,
26
27
  // columnVirtualizer,
27
28
  // rowHeaderVirtualizer,
28
29
  colSpan,
29
30
  rowSpan
30
31
  } = props;
31
32
  const {
33
+ t,
32
34
  prefix,
33
35
  setSorterChange,
34
36
  setFilterChange,
@@ -112,13 +114,16 @@ const TableHeadCell = props => {
112
114
  };
113
115
  const doFilter = type => {
114
116
  if (type) {
115
- header.column.setFilterValue(!originalColumn.typeFilter || originalColumn.typeFilter === 'Text' ? [''] : selectedKeys);
117
+ header.column.setFilterValue(!originalColumn.typeFilter || originalColumn.typeFilter === 'Text' ? selectedKeys.length === 0 ? [''] : selectedKeys : selectedKeys);
116
118
  } else {
117
119
  header.column.setFilterValue(undefined);
118
120
  setSelectedKeys([]);
119
121
  }
120
122
  setFilterChange(true);
121
123
  triggerVisible(false);
124
+ setTimeout(() => {
125
+ setFilterChange(false);
126
+ }, 10);
122
127
  };
123
128
  const mergedDropdownProps = extendsObject({
124
129
  trigger: ['click'],
@@ -218,7 +223,6 @@ const TableHeadCell = props => {
218
223
  style: {
219
224
  // display: 'flex',
220
225
  width: header.getSize(),
221
- // width: 'inherit',
222
226
  minWidth: header.getSize(),
223
227
  maxWidth: header.getSize(),
224
228
  ...getCommonPinningStyles(header.column),
@@ -304,7 +308,7 @@ const TableHeadCell = props => {
304
308
  // onMouseUp: () => {
305
309
  // requestAnimationFrame(() => {
306
310
  // columnVirtualizer.measure()
307
- // rowHeaderVirtualizer.measure()
311
+ // // rowHeaderVirtualizer.measure()
308
312
  // })
309
313
  // },
310
314
 
@@ -11,5 +11,5 @@ interface TableHeadRowProps<T> {
11
11
  fixedLeftColumns: Column<T, unknown>[];
12
12
  fixedRightColumns: Column<T, unknown>[];
13
13
  }
14
- declare const TableHeadRow: ({ table, headerGroup, }: TableHeadRowProps<any>) => React.JSX.Element;
14
+ declare const TableHeadRow: ({ table, headerGroup, columnVirtualizer, }: TableHeadRowProps<any>) => React.JSX.Element;
15
15
  export default TableHeadRow;
@@ -8,9 +8,8 @@ import TableHeadCell from "./TableHeadCell";
8
8
 
9
9
  const TableHeadRow = ({
10
10
  table,
11
- headerGroup
12
-
13
- // columnVirtualizer,
11
+ headerGroup,
12
+ columnVirtualizer
14
13
  // virtualPaddingLeft,
15
14
  // virtualPaddingRight,
16
15
  // fixedLeftColumns,
@@ -53,8 +52,8 @@ const TableHeadRow = ({
53
52
  return /*#__PURE__*/React.createElement(TableHeadCell, {
54
53
  key: header.id,
55
54
  header: header,
56
- table: table
57
- // columnVirtualizer={columnVirtualizer}
55
+ table: table,
56
+ columnVirtualizer: columnVirtualizer
58
57
  // rowHeaderVirtualizer={rowHeaderVirtualizer}
59
58
  ,
60
59
  colSpan: header.colSpan,
@@ -309,7 +309,7 @@ export function getFixedFields(columns, type) {
309
309
  const result = [];
310
310
  function traverse(cols) {
311
311
  for (const col of cols) {
312
- if ((col.fixed ?? col.fixedType) === type && col.field && col.visible !== false) {
312
+ if ((col.fixed ?? col.fixedType) === type && col.field && (col.visible !== false || col.hidden !== true)) {
313
313
  result.push(col.field);
314
314
  }
315
315
  if (col.children && col.children.length > 0) {
@@ -1660,7 +1660,7 @@ export const convertFilters = filters => {
1660
1660
  export function getInvisibleColumns(columns) {
1661
1661
  const result = {};
1662
1662
  for (const col of columns) {
1663
- if (col.visible === false) {
1663
+ if (col.visible === false || col.hidden) {
1664
1664
  result[col.field ?? ''] = false;
1665
1665
  }
1666
1666
  }
@@ -1688,7 +1688,7 @@ export const getAllVisibleKeys1 = columns => {
1688
1688
  const keys = [];
1689
1689
  const traverse = (cols, parentHidden = false) => {
1690
1690
  for (const col of cols) {
1691
- if (col.visible === false || parentHidden) {
1691
+ if (col.visible === false || col.hidden || parentHidden) {
1692
1692
  continue;
1693
1693
  }
1694
1694
  if (col.field) {
@@ -1728,7 +1728,7 @@ export function getHiddenParentKeys1(columns, parentKeys = []) {
1728
1728
  childHiddenParents.forEach(key => hiddenParents.add(key));
1729
1729
  currentPath.forEach(key => hiddenParents.add(key));
1730
1730
  }
1731
- } else if (column.visible !== false) {
1731
+ } else if (column.visible !== false && column.hidden !== true) {
1732
1732
  parentKeys.forEach(key => hiddenParents.add(key));
1733
1733
  }
1734
1734
  }
@@ -42,7 +42,22 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
42
42
  }
43
43
 
44
44
  .#{$prefix}-grid-container {
45
+
45
46
  border: 1px solid $tableBorderColor;
47
+ border-right: 0;
48
+ font-size: 13px;
49
+
50
+ &::after {
51
+ content: "";
52
+ position: absolute;
53
+ top: 0px;
54
+ right: 0;
55
+ height: 100%;
56
+ // width: 100%;
57
+ border-right: 1px solid $tableBorderColor;
58
+ pointer-events: none;
59
+ z-index: 1;
60
+ }
46
61
 
47
62
  .#{$prefix}-grid-cell {
48
63
 
@@ -527,6 +542,13 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
527
542
  background-color: #f0f0f0;
528
543
  }
529
544
 
545
+ &.#{$prefix}-grid-cell-command {
546
+ padding: 2px 8px;
547
+ .ui-rc_cell-content {
548
+ display: flex;
549
+ }
550
+ }
551
+
530
552
 
531
553
  .isValid {
532
554
  &::after {
@@ -218,6 +218,7 @@ const Grid = props => {
218
218
  sensors: sensors
219
219
  }, /*#__PURE__*/React.createElement(ContainerComponent, _extends({}, rest, {
220
220
  id: id,
221
+ t: t,
221
222
  table: table,
222
223
  editAble: editAble,
223
224
  dataSource: dataSource,
@@ -236,7 +237,8 @@ const Grid = props => {
236
237
  columnHidden: columnHidden,
237
238
  setExpanded: setExpanded,
238
239
  expanded: expanded,
239
- infiniteScroll: infiniteScroll
240
+ infiniteScroll: infiniteScroll,
241
+ setMergedFilterKeys: setMergedFilterKeys
240
242
  }))));
241
243
  };
242
244
  export default Grid;