es-grid-template 1.7.26 → 1.7.28

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 (93) hide show
  1. package/es/grid-component/InternalTable.js +31 -36
  2. package/es/grid-component/TempTable.d.ts +4 -0
  3. package/es/grid-component/TempTable.js +21 -0
  4. package/es/grid-component/hooks/columns/index.js +3 -1
  5. package/es/grid-component/index.d.ts +2 -2
  6. package/es/grid-component/index.js +6 -4
  7. package/es/grid-component/styles.scss +0 -1
  8. package/es/grid-component/table/GridEdit.js +112 -96
  9. package/es/grid-component/type.d.ts +7 -1
  10. package/es/table-component/InternalTable.js +160 -122
  11. package/es/table-component/TableContainer.d.ts +6 -0
  12. package/es/table-component/TableContainer.js +74 -70
  13. package/es/table-component/TableContainerEdit.d.ts +6 -0
  14. package/es/table-component/TableContainerEdit.js +372 -92
  15. package/es/table-component/body/TableBody.d.ts +2 -8
  16. package/es/table-component/body/TableBody.js +28 -0
  17. package/es/table-component/body/TableBodyCell.d.ts +1 -1
  18. package/es/table-component/body/TableBodyCell.js +28 -14
  19. package/es/table-component/body/TableBodyCellEdit.d.ts +1 -1
  20. package/es/table-component/body/TableBodyCellEdit.js +44 -28
  21. package/es/table-component/body/TableBodyRow.d.ts +3 -3
  22. package/es/table-component/body/TableBodyRow.js +4 -6
  23. package/es/table-component/footer/TableFooter.d.ts +2 -8
  24. package/es/table-component/footer/TableFooter.js +14 -13
  25. package/es/table-component/footer/TableFooterCell.d.ts +3 -6
  26. package/es/table-component/footer/TableFooterCell.js +14 -11
  27. package/es/table-component/footer/TableFooterRow.d.ts +2 -8
  28. package/es/table-component/footer/TableFooterRow.js +23 -48
  29. package/es/table-component/header/TableHead.d.ts +4 -3
  30. package/es/table-component/header/TableHead.js +6 -28
  31. package/es/table-component/header/TableHeadCell.d.ts +2 -3
  32. package/es/table-component/header/TableHeadCell.js +25 -55
  33. package/es/table-component/header/TableHeadRow.d.ts +6 -7
  34. package/es/table-component/header/TableHeadRow.js +37 -62
  35. package/es/table-component/hook/convert.d.ts +1 -0
  36. package/es/table-component/hook/convert.js +28 -0
  37. package/es/table-component/hook/useColumns.js +1 -0
  38. package/es/table-component/hook/utils.js +3 -0
  39. package/es/table-component/style.scss +61 -50
  40. package/es/table-component/table/Grid.d.ts +3 -0
  41. package/es/table-component/table/Grid.js +9 -5
  42. package/es/table-component/table/TableWrapper.d.ts +32 -0
  43. package/es/table-component/table/TableWrapper.js +242 -0
  44. package/es/table-component/type.d.ts +9 -4
  45. package/es/table-component/useContext.d.ts +4 -0
  46. package/es/table-component/useContext.js +4 -0
  47. package/lib/grid-component/InternalTable.js +30 -35
  48. package/lib/grid-component/TempTable.d.ts +4 -0
  49. package/lib/grid-component/TempTable.js +30 -0
  50. package/lib/grid-component/hooks/columns/index.js +3 -1
  51. package/lib/grid-component/index.d.ts +2 -2
  52. package/lib/grid-component/index.js +5 -3
  53. package/lib/grid-component/styles.scss +0 -1
  54. package/lib/grid-component/table/GridEdit.js +112 -96
  55. package/lib/grid-component/type.d.ts +7 -1
  56. package/lib/table-component/InternalTable.js +161 -122
  57. package/lib/table-component/TableContainer.d.ts +6 -0
  58. package/lib/table-component/TableContainer.js +76 -70
  59. package/lib/table-component/TableContainerEdit.d.ts +6 -0
  60. package/lib/table-component/TableContainerEdit.js +368 -90
  61. package/lib/table-component/body/TableBody.d.ts +2 -8
  62. package/lib/table-component/body/TableBody.js +29 -0
  63. package/lib/table-component/body/TableBodyCell.d.ts +1 -1
  64. package/lib/table-component/body/TableBodyCell.js +28 -14
  65. package/lib/table-component/body/TableBodyCellEdit.d.ts +1 -1
  66. package/lib/table-component/body/TableBodyCellEdit.js +44 -28
  67. package/lib/table-component/body/TableBodyRow.d.ts +3 -3
  68. package/lib/table-component/body/TableBodyRow.js +4 -6
  69. package/lib/table-component/footer/TableFooter.d.ts +2 -8
  70. package/lib/table-component/footer/TableFooter.js +15 -13
  71. package/lib/table-component/footer/TableFooterCell.d.ts +3 -6
  72. package/lib/table-component/footer/TableFooterCell.js +15 -11
  73. package/lib/table-component/footer/TableFooterRow.d.ts +2 -8
  74. package/lib/table-component/footer/TableFooterRow.js +23 -48
  75. package/lib/table-component/header/TableHead.d.ts +4 -3
  76. package/lib/table-component/header/TableHead.js +6 -28
  77. package/lib/table-component/header/TableHeadCell.d.ts +2 -3
  78. package/lib/table-component/header/TableHeadCell.js +25 -54
  79. package/lib/table-component/header/TableHeadRow.d.ts +6 -7
  80. package/lib/table-component/header/TableHeadRow.js +37 -62
  81. package/lib/table-component/hook/convert.d.ts +1 -0
  82. package/lib/table-component/hook/convert.js +34 -0
  83. package/lib/table-component/hook/useColumns.js +1 -0
  84. package/lib/table-component/hook/utils.js +3 -0
  85. package/lib/table-component/style.scss +61 -50
  86. package/lib/table-component/table/Grid.d.ts +3 -0
  87. package/lib/table-component/table/Grid.js +9 -5
  88. package/lib/table-component/table/TableWrapper.d.ts +32 -0
  89. package/lib/table-component/table/TableWrapper.js +251 -0
  90. package/lib/table-component/type.d.ts +9 -4
  91. package/lib/table-component/useContext.d.ts +4 -0
  92. package/lib/table-component/useContext.js +4 -0
  93. package/package.json +1 -1
@@ -1,14 +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';
5
4
  interface TableHeadCellProps<T> {
6
5
  t?: any;
7
6
  table: Table<T>;
8
7
  header: Header<T, unknown>;
9
8
  getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
10
- columnVirtualizer: Virtualizer<HTMLDivElement, HTMLTableCellElement>;
11
- rowHeaderVirtualizer: Virtualizer<HTMLDivElement, HTMLTableRowElement>;
9
+ colSpan: any;
10
+ rowSpan: any;
12
11
  }
13
12
  declare const TableHeadCell: <RecordType extends object>(props: TableHeadCellProps<RecordType>) => React.JSX.Element;
14
13
  export default TableHeadCell;
@@ -3,7 +3,7 @@
3
3
  import { flexRender } from '@tanstack/react-table';
4
4
  import React, { useContext } from 'react';
5
5
  // import { CSS } from '@dnd-kit/utilities'
6
-
6
+ // import type { Virtualizer } from '@tanstack/react-virtual'
7
7
  import { Button, Space } from 'antd';
8
8
  import { ArrowDown, ArrowUp, FilterFill, SortCancel } from 'becoxy-icons';
9
9
  import classNames from 'classnames';
@@ -23,8 +23,10 @@ const TableHeadCell = props => {
23
23
  getPopupContainer,
24
24
  table,
25
25
  t,
26
- columnVirtualizer,
27
- rowHeaderVirtualizer
26
+ // columnVirtualizer,
27
+ // rowHeaderVirtualizer,
28
+ colSpan,
29
+ rowSpan
28
30
  } = props;
29
31
  const {
30
32
  prefix,
@@ -37,7 +39,7 @@ const TableHeadCell = props => {
37
39
  locale
38
40
  } = useContext(TableContext);
39
41
  const isPinned = header.column.getIsPinned();
40
- const isLastLeftPinnedColumn = isPinned === 'left' && header.column.getIsLastColumn('left');
42
+ // const isLastLeftPinnedColumn = isPinned === 'left' && header.column.getIsLastColumn('left')
41
43
  const isFirstRightPinnedColumn = isPinned === 'right' && header.column.getIsFirstColumn('right');
42
44
  const [selectedKeys, setSelectedKeys] = React.useState([]);
43
45
  const [visible, setVisible] = React.useState(false);
@@ -110,9 +112,9 @@ const TableHeadCell = props => {
110
112
  };
111
113
  const doFilter = type => {
112
114
  if (type) {
113
- header.column.setFilterValue(selectedKeys);
115
+ header.column.setFilterValue(!originalColumn.typeFilter || originalColumn.typeFilter === 'Text' ? [''] : selectedKeys);
114
116
  } else {
115
- header.column.setFilterValue('');
117
+ header.column.setFilterValue(undefined);
116
118
  setSelectedKeys([]);
117
119
  }
118
120
  setFilterChange(true);
@@ -200,57 +202,24 @@ const TableHeadCell = props => {
200
202
  // return dropdownContent;
201
203
  }
202
204
  });
203
-
204
- // if (header.column.id === "#" || header.column.id === "selection_column") {
205
- // return (
206
- // <th
207
- // ref={el => {
208
- // if (el) columnVirtualizer.measureElement(el)
209
- // }}
210
- // data-index={header.id}
211
- // // ref={setNodeRef}
212
- // key={header.id}
213
- // colSpan={header.colSpan}
214
- // style={{
215
- // display: 'flex',
216
- // ...getCommonPinningStyles(header.column),
217
- // ...style,
218
- // width: header?.getSize() ?? header.column.getSize()
219
- // }}
220
- // >
221
-
222
- // {header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext())}
223
- // {/* <div> */}
224
-
225
- // <div
226
- // {...{
227
- // onDoubleClick: () => header.column.resetSize(),
228
-
229
- // onMouseDown: header.getResizeHandler(),
230
- // onTouchStart: header.getResizeHandler(),
231
-
232
- // className: `resizer ${header.column.getIsResizing() ? "isResizing" : ""
233
- // }`,
234
- // }}
235
- // />
236
-
237
- // {/* </div> */}
238
- // </th>
239
- // )
240
- // }
241
-
242
205
  return /*#__PURE__*/React.createElement("th", {
243
206
  // ref={setNodeRef}
244
207
  className: classNames(`${prefix}-grid-cell`, {
245
208
  [`${prefix}-grid-cell-ellipsis`]: !wrapSettings || !(wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Header')),
246
209
  [`${prefix}-grid-cell-wrap`]: wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Header'),
247
- [`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
248
- [`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn
210
+ // [`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
211
+ [`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
212
+ [`${prefix}-grid-cell-text-center`]: originalColumn?.headerTextAlign === 'center',
213
+ [`${prefix}-grid-cell-text-right`]: originalColumn?.headerTextAlign === 'right'
249
214
  }),
215
+ colSpan: colSpan,
216
+ rowSpan: rowSpan,
250
217
  key: header.id,
251
218
  style: {
252
- display: 'flex',
219
+ // display: 'flex',
253
220
  width: header.getSize(),
221
+ minWidth: header.getSize(),
222
+ maxWidth: header.getSize(),
254
223
  ...getCommonPinningStyles(header.column),
255
224
  ...style
256
225
  },
@@ -282,7 +251,7 @@ const TableHeadCell = props => {
282
251
  [`${prefix}-grid-cell-ellipsis`]: !wrapSettings || !(wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Header')),
283
252
  [`${prefix}-grid-cell-text-wrap`]: wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Header')
284
253
  })
285
- }, cellContent)), !nonActionColumn.includes(header.id) && /*#__PURE__*/React.createElement("span", {
254
+ }, cellContent)), !nonActionColumn.includes(header.column.id) && header.subHeaders.length < 2 && /*#__PURE__*/React.createElement("span", {
286
255
  className: "ui-rc-header-trigger"
287
256
  }, header.column.getCanSort() && /*#__PURE__*/React.createElement("div", {
288
257
  style: {
@@ -331,12 +300,13 @@ const TableHeadCell = props => {
331
300
  onDoubleClick: () => header.column.resetSize(),
332
301
  onMouseDown: header.getResizeHandler(),
333
302
  onTouchStart: header.getResizeHandler(),
334
- onMouseUp: () => {
335
- requestAnimationFrame(() => {
336
- columnVirtualizer.measure();
337
- rowHeaderVirtualizer.measure();
338
- });
339
- },
303
+ // onMouseUp: () => {
304
+ // requestAnimationFrame(() => {
305
+ // columnVirtualizer.measure()
306
+ // rowHeaderVirtualizer.measure()
307
+ // })
308
+ // },
309
+
340
310
  className: `resizer ${header.column.getIsResizing() ? 'isResizing' : ''}`
341
311
  }));
342
312
  };
@@ -1,16 +1,15 @@
1
- import type { Column, HeaderGroup, Table } from '@tanstack/react-table';
2
- import type { VirtualItem, Virtualizer } from '@tanstack/react-virtual';
1
+ import type { Column } from '@tanstack/react-table';
2
+ import { type HeaderGroup, type Table } from '@tanstack/react-table';
3
3
  import React from 'react';
4
+ import type { Virtualizer } from '@tanstack/react-virtual';
4
5
  interface TableHeadRowProps<T> {
5
- columnVirtualizer: Virtualizer<HTMLDivElement, HTMLTableCellElement>;
6
- rowHeaderVirtualizer: Virtualizer<HTMLDivElement, HTMLTableRowElement>;
7
6
  headerGroup: HeaderGroup<T>;
7
+ table: Table<T>;
8
+ columnVirtualizer: Virtualizer<HTMLDivElement, HTMLTableCellElement>;
8
9
  virtualPaddingLeft: number | undefined;
9
10
  virtualPaddingRight: number | undefined;
10
- table: Table<T>;
11
11
  fixedLeftColumns: Column<T, unknown>[];
12
12
  fixedRightColumns: Column<T, unknown>[];
13
- rowHeaderVirtual: VirtualItem;
14
13
  }
15
- declare const TableHeadRow: ({ table, columnVirtualizer, rowHeaderVirtualizer, headerGroup, virtualPaddingLeft, virtualPaddingRight, fixedLeftColumns, fixedRightColumns, rowHeaderVirtual }: TableHeadRowProps<any>) => React.JSX.Element;
14
+ declare const TableHeadRow: ({ table, headerGroup, }: TableHeadRowProps<any>) => React.JSX.Element;
16
15
  export default TableHeadRow;
@@ -1,90 +1,65 @@
1
1
  import { horizontalListSortingStrategy, SortableContext } from '@dnd-kit/sortable';
2
+ // import type { Virtualizer } from '@tanstack/react-virtual'
2
3
  // import type { Person } from "../../tanstack-table/makeData"
3
4
  import React from 'react';
4
5
  import { TableContext } from "../useContext";
5
6
  import TableHeadCell from "./TableHeadCell";
7
+ // import { getCommonPinningStyles } from '../hook/utils'
8
+
6
9
  const TableHeadRow = ({
7
10
  table,
8
- columnVirtualizer,
9
- rowHeaderVirtualizer,
10
- headerGroup,
11
- virtualPaddingLeft,
12
- virtualPaddingRight,
13
- fixedLeftColumns,
14
- fixedRightColumns,
15
- rowHeaderVirtual
11
+ headerGroup
12
+
13
+ // columnVirtualizer,
14
+ // virtualPaddingLeft,
15
+ // virtualPaddingRight,
16
+ // fixedLeftColumns,
17
+ // fixedRightColumns
16
18
  }) => {
17
19
  const {
18
20
  prefix
19
21
  } = React.useContext(TableContext);
20
- const virtualColumns = columnVirtualizer.getVirtualItems();
21
- // const virtualColumns = columnVirtualizer.measurementsCache
22
22
 
23
- // console.log('virtualColumns', virtualColumns)
23
+ // const virtualColumns = columnVirtualizer.getVirtualItems()
24
24
 
25
25
  const columnOrder = table.getState().columnOrder;
26
26
  return /*#__PURE__*/React.createElement("tr", {
27
- key: headerGroup.id,
28
- ref: el => {
29
- if (el) rowHeaderVirtualizer.measureElement(el);
30
- }
27
+ key: headerGroup.id
28
+ // ref={el => {
29
+ // if (el) rowHeaderVirtualizer.measureElement(el)
30
+ // }}
31
31
  // data-index={rowHeaderVirtual?.index}
32
32
  ,
33
33
  "data-index": headerGroup.id,
34
34
  className: `${prefix}-grid-row`,
35
35
  style: {
36
- display: 'flex',
37
- width: '100%',
38
- minHeight: rowHeaderVirtual?.size
36
+ // display: 'flex',
37
+ width: '100%'
38
+ // minHeight: rowHeaderVirtual?.size
39
39
  }
40
40
  }, /*#__PURE__*/React.createElement(SortableContext, {
41
41
  items: columnOrder,
42
42
  strategy: horizontalListSortingStrategy
43
- }, fixedLeftColumns.length > 0 ? fixedLeftColumns.map(column => {
44
- return /*#__PURE__*/React.createElement(TableHeadCell, {
45
- columnVirtualizer: columnVirtualizer,
46
- rowHeaderVirtualizer: rowHeaderVirtualizer,
47
- key: column.id,
48
- table: table,
49
- header: headerGroup.headers.find(h => h.column.id === column.id)
50
- // column={column as any}
51
- });
52
- }) : null, virtualPaddingLeft ? /*#__PURE__*/React.createElement("th", {
53
- className: "",
54
- style: {
55
- display: 'flex',
56
- width: virtualPaddingLeft
57
- }
58
- }) : null, virtualColumns.map(virtualColumn => {
59
- const header = headerGroup.headers[virtualColumn.index];
60
- const isFixed = table.getState().columnPinning.left?.includes(header?.column?.id) || table.getState().columnPinning.right?.includes(header?.column?.id);
61
- if (header && !isFixed) {
62
- return /*#__PURE__*/React.createElement(TableHeadCell, {
63
- key: header.id,
64
- header: header,
65
- table: table,
66
- columnVirtualizer: columnVirtualizer,
67
- rowHeaderVirtualizer: rowHeaderVirtualizer
68
- });
43
+ }, headerGroup.headers.map(header => {
44
+ const columnRelativeDepth = header.depth - header.column.depth;
45
+ if (columnRelativeDepth > 1) {
46
+ return null;
69
47
  }
70
- }),
71
- //fake empty column to the right for virtualization scroll padding
72
- fixedRightColumns.length > 0 ? fixedRightColumns.map(column => /*#__PURE__*/React.createElement(TableHeadCell, {
73
- columnVirtualizer: columnVirtualizer,
74
- rowHeaderVirtualizer: rowHeaderVirtualizer,
75
- table: table,
76
- key: column.id,
77
- header: headerGroup.headers.find(h => h.column.id === column.id)
78
- // column={column as any}
79
- })) : null, virtualPaddingRight ?
80
- /*#__PURE__*/
81
- //fake empty column to the right for virtualization scroll padding
82
- React.createElement("th", {
83
- className: "nnnnnnnnnnnn",
84
- style: {
85
- display: 'flex',
86
- width: virtualPaddingRight
48
+ let rowSpan = 1;
49
+ if (header.isPlaceholder) {
50
+ const leafs = header.getLeafHeaders();
51
+ rowSpan = leafs[leafs.length - 1].depth - header.depth;
87
52
  }
88
- }) : null));
53
+ return /*#__PURE__*/React.createElement(TableHeadCell, {
54
+ key: header.id,
55
+ header: header,
56
+ table: table
57
+ // columnVirtualizer={columnVirtualizer}
58
+ // rowHeaderVirtualizer={rowHeaderVirtualizer}
59
+ ,
60
+ colSpan: header.colSpan,
61
+ rowSpan: rowSpan
62
+ });
63
+ })));
89
64
  };
90
65
  export default TableHeadRow;
@@ -0,0 +1 @@
1
+ export declare function convertColumns(columns: any[]): any[];
@@ -0,0 +1,28 @@
1
+ import { createColumnHelper } from '@tanstack/react-table';
2
+ const columnHelper = createColumnHelper();
3
+ export function convertColumns(columns) {
4
+ return columns.map(col => {
5
+ if (col.columns) {
6
+ // Group column
7
+ return columnHelper.group({
8
+ ...col,
9
+ columns: convertColumns(col.columns) // đệ quy
10
+ });
11
+ } else {
12
+ // Accessor column
13
+ let accessor;
14
+
15
+ // Ưu tiên accessorKey nếu có, nếu không thì dùng hàm row => row[col.id]
16
+ if (col.accessorKey) {
17
+ accessor = col.accessorKey;
18
+ } else if (col.id) {
19
+ accessor = row => row[col.id];
20
+ } else {
21
+ throw new Error('Column không có accessorKey hoặc id');
22
+ }
23
+ return columnHelper.accessor(accessor, {
24
+ ...col
25
+ });
26
+ }
27
+ });
28
+ }
@@ -112,6 +112,7 @@ export function convertToTanStackColumns({
112
112
  }
113
113
  } else {
114
114
  return t ? t(headerText) : headerText;
115
+ // return field
115
116
  }
116
117
  },
117
118
  cell: props => {
@@ -44,6 +44,9 @@ export const getCommonPinningStyles = column => {
44
44
  position: isPinned ? "sticky" : "relative",
45
45
  width: column.getSize(),
46
46
  zIndex: isPinned ? 2 : 0
47
+ // border: '1px solid #e5e7eb',
48
+ // borderTop: 0,
49
+ // borderBottom: 0
47
50
  };
48
51
  };
49
52
  export const sumSize = items => {
@@ -47,48 +47,23 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
47
47
  .#{$prefix}-grid-cell {
48
48
 
49
49
  padding: 7px 8px;
50
- border-inline-end: 1px solid $tableBorderColor;
51
- // border-bottom: 1px solid $tableBorderColor;
52
- // &.#{$prefix}-grid-cell-fix-left-last {
53
- // &::after {
54
- // position: absolute;
55
- // top: 0;
56
- // right: 0;
57
- // bottom: -1px;
58
- // width: 30px;
59
- // transform: translateX(100%);
60
- // transition: box-shadow 0.3s;
61
- // content: "";
62
- // pointer-events: none;
63
- // box-shadow: inset 10px 0 8px -8px rgba(5, 5, 5, 0.09);
64
- // }
65
- // }
66
- // &.#{$prefix}-grid-cell-fix-right-first {
67
- // &::after {
68
- // position: absolute;
69
- // top: 0;
70
- // bottom: -1px;
71
- // left: 0;
72
- // width: 30px;
73
- // transform: translateX(-100%);
74
- // transition: box-shadow 0.3s;
75
- // content: "";
76
- // pointer-events: none;
77
- // box-shadow: inset -10px 0 8px -8px rgba(5, 5, 5, 0.09);
78
- // }
79
- // &::before {
80
- // content: "";
81
- // position: absolute;
82
- // inset-block: 0;
83
- // inset-inline-start: -1px;
84
- // border-inline-start: 1px solid #e0e0e0;
85
- // }
86
- // }
50
+
51
+ &.#{$prefix}-grid-cell-text-center {
52
+ text-align: center;
53
+
54
+ }
55
+
56
+ &.#{$prefix}-grid-cell-text-right {
57
+ justify-content: flex-end;
58
+ text-align: right;
59
+
60
+ }
87
61
 
88
62
 
89
63
 
90
64
  &.#{$prefix}-grid-cell-ellipsis {
91
65
 
66
+
92
67
  .ui-rc_cell-content {
93
68
  width: 100%;
94
69
  overflow: hidden;
@@ -124,6 +99,7 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
124
99
 
125
100
  }
126
101
 
102
+
127
103
 
128
104
  &.#{$prefix}-grid-cell-wrap {
129
105
  white-space: normal;
@@ -152,6 +128,16 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
152
128
  .#{$prefix}-grid-cell {
153
129
 
154
130
  background-color: $body-color;
131
+ // border-inline-end: 1px solid #e0e0e0;
132
+
133
+ &::before {
134
+ content: "";
135
+ position: absolute;
136
+ inset-block: 0;
137
+ right: 0;
138
+ inset-inline-start: 0px;
139
+ border-inline-end: 1px solid #e0e0e0;
140
+ }
155
141
 
156
142
  &.ui-rc-grid-cell-ellipsis {
157
143
 
@@ -195,6 +181,8 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
195
181
  justify-content: space-between;
196
182
  width: 100%;
197
183
  align-items: center;
184
+ position: relative;
185
+ z-index: 3;
198
186
  }
199
187
 
200
188
  .ui-rc-header-trigger {
@@ -216,6 +204,7 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
216
204
  position: absolute;
217
205
  right: 0;
218
206
  top: 0;
207
+ z-index: 3;
219
208
  touch-action: none;
220
209
  user-select: none;
221
210
  width: 5px;
@@ -267,9 +256,20 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
267
256
 
268
257
  .#{$prefix}-grid-cell {
269
258
  outline: none;
259
+ border-inline-end: 1px solid $tableBorderColor;
270
260
 
271
261
  background-color: $body-color;
272
262
 
263
+ &.#{$prefix}-grid-cell-ellipsis:not(:has(>.ui-rc_cell-content)) {
264
+ overflow: hidden;
265
+ white-space: nowrap;
266
+ text-overflow: ellipsis;
267
+ word-break: keep-all;
268
+
269
+ }
270
+
271
+
272
+
273
273
  &.cell-editable {
274
274
 
275
275
  // padding: 0;
@@ -519,19 +519,19 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
519
519
  }
520
520
 
521
521
 
522
- &.isValid {
523
- &::after {
524
- content: "";
525
- position: absolute;
526
- top: 0;
527
- right: 0;
528
- width: 0;
529
- height: 0;
530
- border-top: 0 solid transparent;
531
- border-right: 8px solid red;
532
- border-bottom: 8px solid transparent;
533
- }
534
- }
522
+ // &.isValid {
523
+ // &::after {
524
+ // content: "";
525
+ // position: absolute;
526
+ // top: 0;
527
+ // right: 0;
528
+ // width: 0;
529
+ // height: 0;
530
+ // border-top: 0 solid transparent;
531
+ // border-right: 8px solid red;
532
+ // border-bottom: 8px solid transparent;
533
+ // }
534
+ // }
535
535
  }
536
536
 
537
537
  }
@@ -539,6 +539,7 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
539
539
  .#{$prefix}-grid-tfoot {
540
540
  .#{$prefix}-grid-cell {
541
541
  background-color: $body-color;
542
+ border-inline-end: 1px solid $tableBorderColor;
542
543
  }
543
544
  }
544
545
 
@@ -786,6 +787,16 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
786
787
  }
787
788
  }
788
789
 
790
+ .spinner-loading {
791
+ position: absolute;
792
+ top: 0;
793
+ left: 0;
794
+ width: 100%;
795
+ height: 100%;
796
+ z-index: 4;
797
+ background-color: #ffffff80;
798
+ }
799
+
789
800
 
790
801
 
791
802
  }
@@ -15,10 +15,13 @@ type Props<T> = Omit<TableProps<T>, 'columns'> & {
15
15
  originData: T[];
16
16
  mergedFilterKeys: any;
17
17
  setMergedFilterKeys: any;
18
+ isFullScreen: boolean;
19
+ setIsFullScreen: Dispatch<SetStateAction<boolean>>;
18
20
  triggerFilter: Dispatch<SetStateAction<any>>;
19
21
  triggerSorter: Dispatch<SetStateAction<Sorter[]>>;
20
22
  onContextMenu?: (data: T) => (event: any) => void;
21
23
  triggerChangeColumns?: (args: any, keys: any) => void;
24
+ windowSize: any;
22
25
  };
23
26
  declare const Grid: <RecordType extends object>(props: Props<RecordType>) => React.JSX.Element;
24
27
  export default Grid;
@@ -45,6 +45,7 @@ const Grid = props => {
45
45
  height = 700,
46
46
  editAble,
47
47
  triggerChangeColumns,
48
+ infiniteScroll,
48
49
  ...rest
49
50
  } = props;
50
51
  const [columnResizeMode] = React.useState('onChange');
@@ -78,7 +79,8 @@ const Grid = props => {
78
79
  expanded,
79
80
  columnPinning,
80
81
  columnVisibility: columnHidden,
81
- pagination: pagination ? paginationState : undefined,
82
+ pagination: pagination && !infiniteScroll ? paginationState : undefined,
83
+ // pagination: pagination ? paginationState : undefined,
82
84
  grouping,
83
85
  columnSizing,
84
86
  columnOrder,
@@ -120,12 +122,13 @@ const Grid = props => {
120
122
  getGroupedRowModel: getGroupedRowModel(),
121
123
  // onExpandedChange: setExpanded,
122
124
  getExpandedRowModel: getExpandedRowModel(),
123
- getPaginationRowModel: pagination ? getPaginationRowModel() : undefined,
124
- onPaginationChange: setPagination,
125
+ getPaginationRowModel: pagination && !infiniteScroll ? getPaginationRowModel() : undefined,
126
+ onPaginationChange: setPagination
127
+
125
128
  // onColumnVisibilityChange: setColumnVisibility,
126
129
  // onColumnPinningChange,
127
130
 
128
- debugTable: true
131
+ // debugTable: true
129
132
  });
130
133
  React.useEffect(() => {
131
134
  if (isSelectionChange.isChange) {
@@ -229,7 +232,8 @@ const Grid = props => {
229
232
  triggerChangeColumns: triggerChangeColumns,
230
233
  columnHidden: columnHidden,
231
234
  setExpanded: setExpanded,
232
- expanded: expanded
235
+ expanded: expanded,
236
+ infiniteScroll: infiniteScroll
233
237
  }))));
234
238
  };
235
239
  export default Grid;
@@ -0,0 +1,32 @@
1
+ import { type Table } from "@tanstack/react-table";
2
+ import type { CommandClick, ContextInfo, ContextMenuItem, PaginationConfig } from "../type";
3
+ import React from "react";
4
+ import type { Virtualizer } from "@tanstack/react-virtual";
5
+ import type { Column } from "@tanstack/react-table";
6
+ type Props<T> = {
7
+ prefix: string;
8
+ id: string;
9
+ tableContainerRef: React.RefObject<HTMLDivElement>;
10
+ height: number;
11
+ table: Table<T>;
12
+ summary?: boolean;
13
+ loading?: boolean;
14
+ commandClick?: (args: Omit<CommandClick<T>, 'rows'>) => void;
15
+ editAble?: boolean;
16
+ contextMenuItems?: ContextMenuItem[];
17
+ showEmptyText?: boolean;
18
+ contextMenuClick?: any;
19
+ contextMenuOpen?: (args: Omit<ContextInfo<T>, 'item'>) => void;
20
+ contextMenuHidden?: string[] | ((args?: Omit<ContextInfo<T>, 'item' | 'event'>) => string[]);
21
+ next?: () => void;
22
+ dataSource: T[];
23
+ pagination?: false | PaginationConfig;
24
+ infiniteScroll?: boolean;
25
+ columnVirtualizer: Virtualizer<HTMLDivElement, HTMLTableCellElement>;
26
+ virtualPaddingLeft: number | undefined;
27
+ virtualPaddingRight: number | undefined;
28
+ fixedLeftColumns: Column<T, unknown>[];
29
+ fixedRightColumns: Column<T, unknown>[];
30
+ };
31
+ declare const TableWrapper: <RecordType extends object>(props: Props<RecordType>) => React.JSX.Element;
32
+ export default TableWrapper;