es-grid-template 1.8.25 → 1.8.27
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.
- package/LICENSE +21 -21
- package/README.md +1 -1
- package/assets/index.scss +1170 -1170
- package/es/grid-component/hooks/constant.js +6 -6
- package/es/grid-component/hooks/useColumns.d.ts +3 -1
- package/es/grid-component/styles.scss +1437 -1437
- package/es/table-component/TableContainerEdit.js +1 -1
- package/es/table-component/body/TableBodyCell.js +17 -9
- package/es/table-component/body/TableBodyRow.js +2 -2
- package/es/table-component/header/TableHeadCell2.js +6 -3
- package/es/table-component/hook/constant.js +6 -6
- package/es/table-component/hook/useColumns.js +5 -2
- package/es/table-component/hook/utils.d.ts +1 -1
- package/es/table-component/hook/utils.js +42 -7
- package/es/table-component/style.scss +1220 -1220
- package/es/table-component/table/Grid.js +4 -0
- package/es/table-component/type.d.ts +2 -0
- package/lib/grid-component/hooks/constant.js +6 -6
- package/lib/grid-component/hooks/useColumns.d.ts +3 -1
- package/lib/grid-component/styles.scss +1437 -1437
- package/lib/table-component/TableContainerEdit.js +1 -1
- package/lib/table-component/body/TableBodyCell.js +17 -9
- package/lib/table-component/body/TableBodyRow.js +2 -2
- package/lib/table-component/header/TableHeadCell2.js +6 -3
- package/lib/table-component/hook/constant.js +6 -6
- package/lib/table-component/hook/useColumns.js +5 -2
- package/lib/table-component/hook/utils.d.ts +1 -1
- package/lib/table-component/hook/utils.js +42 -7
- package/lib/table-component/style.scss +1220 -1220
- package/lib/table-component/table/Grid.js +4 -0
- package/lib/table-component/type.d.ts +2 -0
- package/package.json +116 -116
- package/CHANGELOG.md +0 -6
|
@@ -1164,7 +1164,7 @@ const TableContainerEdit = props => {
|
|
|
1164
1164
|
// const newData = [...dataSource]
|
|
1165
1165
|
const newData = [...originData];
|
|
1166
1166
|
let newElement;
|
|
1167
|
-
if (!record
|
|
1167
|
+
if (!record?.children || record?.children && record.children.length === 0) {
|
|
1168
1168
|
newElement = {
|
|
1169
1169
|
...record,
|
|
1170
1170
|
children: [{
|
|
@@ -274,6 +274,8 @@ const TableBodyCell = props => {
|
|
|
274
274
|
// maxWidth: cell.column.getSize(),
|
|
275
275
|
...getCommonPinningStyles(cell.column)
|
|
276
276
|
}
|
|
277
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
278
|
+
className: classNames('ui-rc_cell-content', {})
|
|
277
279
|
}, cell.column.getIndex() === expandIconColumnIndex && isDataTree && /*#__PURE__*/React.createElement("div", {
|
|
278
280
|
className: "ui-rc-table-row-expand-trigger",
|
|
279
281
|
style: {
|
|
@@ -316,7 +318,7 @@ const TableBodyCell = props => {
|
|
|
316
318
|
isDataTree,
|
|
317
319
|
setExpanded,
|
|
318
320
|
expandIconColumnIndex
|
|
319
|
-
}));
|
|
321
|
+
})));
|
|
320
322
|
}
|
|
321
323
|
return /*#__PURE__*/React.createElement("div", {
|
|
322
324
|
key: cell.id,
|
|
@@ -362,8 +364,11 @@ const TableBodyCell = props => {
|
|
|
362
364
|
if (e.target.firstChild?.clientWidth < e.target.firstChild?.scrollWidth) {
|
|
363
365
|
setIsOpenTooltip(true);
|
|
364
366
|
}
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// onMouseUp={() => { }}
|
|
370
|
+
,
|
|
371
|
+
|
|
367
372
|
onKeyDown: e => {
|
|
368
373
|
const flatRows = table.getRowModel().flatRows;
|
|
369
374
|
if (e.key === 'ArrowDown' && rowNumber < flatRows.length - 1) {
|
|
@@ -406,12 +411,15 @@ const TableBodyCell = props => {
|
|
|
406
411
|
onDoubleClick: () => {},
|
|
407
412
|
onClick: e => {
|
|
408
413
|
if (selectionSettings?.checkboxOnly !== true) {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
414
|
+
const isInsideCell = e.target.closest(".ui-rc-grid-cell");
|
|
415
|
+
if (isInsideCell) {
|
|
416
|
+
cell.row.getToggleSelectedHandler()(e);
|
|
417
|
+
setIsSelectionChange({
|
|
418
|
+
isChange: true,
|
|
419
|
+
type: 'rowSelected',
|
|
420
|
+
rowData: cell.row.original
|
|
421
|
+
});
|
|
422
|
+
}
|
|
415
423
|
}
|
|
416
424
|
}
|
|
417
425
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -63,8 +63,8 @@ const TableBodyRow = ({
|
|
|
63
63
|
// height: isEditing ? '36px' : undefined,
|
|
64
64
|
gridTemplateColumns: `${templateColumns.map(n => `${n}fr`).join(" ")}`,
|
|
65
65
|
// gridTemplateColumns: `repeat(${centerCOlumns.length + fixedLeftColumns.length + fixedRightColumns.length}, minmax(0, 1fr))`,
|
|
66
|
-
height: isEditing ? virtualRow.size : undefined
|
|
67
|
-
|
|
66
|
+
height: isEditing ? virtualRow.size : undefined,
|
|
67
|
+
minHeight: isEditing ? undefined : virtualRow.size
|
|
68
68
|
},
|
|
69
69
|
onDoubleClick: e => {
|
|
70
70
|
recordDoubleClick?.({
|
|
@@ -144,7 +144,10 @@ const TableHeadCell2 = props => {
|
|
|
144
144
|
destroyPopupOnHide: true,
|
|
145
145
|
dropdownRender: () => {
|
|
146
146
|
const type = getTypeFilter(originalColumn);
|
|
147
|
-
|
|
147
|
+
|
|
148
|
+
// const operatorValue = (column.getFilterOperator() ?? getDefaultOperator(originalColumn)) as string
|
|
149
|
+
|
|
150
|
+
const operatorValue = header.column.getFilterOperator() ?? getDefaultOperator(column.columnDef?.meta ?? {});
|
|
148
151
|
const operatorOptions = ['Checkbox', 'Dropdown', 'DropTree', 'CheckboxDropdown'].includes(type) ? booleanOperator : !type || type === 'Text' ? stringOperator : numberOperator;
|
|
149
152
|
return /*#__PURE__*/React.createElement("div", {
|
|
150
153
|
// className='ui-rc-table-filter-dropdown'
|
|
@@ -156,7 +159,7 @@ const TableHeadCell2 = props => {
|
|
|
156
159
|
minWidth: 275,
|
|
157
160
|
padding: '8px'
|
|
158
161
|
}
|
|
159
|
-
}, /*#__PURE__*/React.createElement("div", null), column.meta?.showOperator !== false && column.meta?.typeFilter !== 'DateRange' && column.meta?.typeFilter !== 'NumberRange' && /*#__PURE__*/React.createElement("div", {
|
|
162
|
+
}, /*#__PURE__*/React.createElement("div", null), column.columnDef.meta?.showOperator !== false && column.columnDef.meta?.typeFilter !== 'DateRange' && column.columnDef.meta?.typeFilter !== 'NumberRange' && /*#__PURE__*/React.createElement("div", {
|
|
160
163
|
className: 'mb-1'
|
|
161
164
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
162
165
|
options: translateOption(operatorOptions, t),
|
|
@@ -173,7 +176,7 @@ const TableHeadCell2 = props => {
|
|
|
173
176
|
marginBottom: 8
|
|
174
177
|
}
|
|
175
178
|
}, renderFilter({
|
|
176
|
-
column: column,
|
|
179
|
+
column: column.columnDef,
|
|
177
180
|
selectedKeys,
|
|
178
181
|
setSelectedKeys
|
|
179
182
|
// selectedKeys: (column.getFilterValue() ?? []) as string[],
|
|
@@ -213,16 +213,16 @@ export const optionFontSize = [{
|
|
|
213
213
|
label: '48'
|
|
214
214
|
}];
|
|
215
215
|
|
|
216
|
-
/**
|
|
217
|
-
* Sort order for BaseTable
|
|
216
|
+
/**
|
|
217
|
+
* Sort order for BaseTable
|
|
218
218
|
*/
|
|
219
219
|
const SortOrder = {
|
|
220
|
-
/**
|
|
221
|
-
* Sort data in ascending order
|
|
220
|
+
/**
|
|
221
|
+
* Sort data in ascending order
|
|
222
222
|
*/
|
|
223
223
|
ascend: 'Ascending',
|
|
224
|
-
/**
|
|
225
|
-
* Sort data in descending order
|
|
224
|
+
/**
|
|
225
|
+
* Sort data in descending order
|
|
226
226
|
*/
|
|
227
227
|
descend: 'Descending'
|
|
228
228
|
};
|
|
@@ -96,7 +96,8 @@ export function convertToTanStackColumns({
|
|
|
96
96
|
allowResizing,
|
|
97
97
|
minWidth,
|
|
98
98
|
template,
|
|
99
|
-
allowSorter
|
|
99
|
+
allowSorter,
|
|
100
|
+
allowFiltering
|
|
100
101
|
} = col;
|
|
101
102
|
const {
|
|
102
103
|
children,
|
|
@@ -148,7 +149,9 @@ export function convertToTanStackColumns({
|
|
|
148
149
|
sortDescFirst: false,
|
|
149
150
|
minSize: minWidth,
|
|
150
151
|
// maxSize: maxWidth,
|
|
151
|
-
enableSorting: allowSorter !== false || col.sorter !== false
|
|
152
|
+
enableSorting: allowSorter !== false || col.sorter !== false,
|
|
153
|
+
// enableColumnFilter: allowFiltering !== false && !nonActionColumn.includes(field)
|
|
154
|
+
enableColumnFilter: allowFiltering !== false
|
|
152
155
|
};
|
|
153
156
|
if (children) {
|
|
154
157
|
// @ts-ignore
|
|
@@ -137,7 +137,7 @@ export declare const convertToObjTrue: (arr: any) => {
|
|
|
137
137
|
export declare const getDiffent2Array: (a: any[], b: any[]) => any[];
|
|
138
138
|
export declare function isTree(arr: any[]): boolean;
|
|
139
139
|
export declare function findFirst(items: Column<any>[]): Column<any, unknown>;
|
|
140
|
-
export declare function isTreeArray(arr: any[]): boolean;
|
|
140
|
+
export declare function isTreeArray(arr: any[], options?: any): boolean;
|
|
141
141
|
export declare function updateColumnWidthsRecursive(columns: any[], sizing: Record<string, number>): any[];
|
|
142
142
|
export declare function updateWidthsByOther(source: any[], target: any[]): any[];
|
|
143
143
|
export declare function findAllChildrenKeys2<RecordType>(data: readonly RecordType[], rowKey: any, childrenColumnName: string): Key[];
|
|
@@ -1935,14 +1935,49 @@ export function findFirst(items) {
|
|
|
1935
1935
|
if (leftItem) return leftItem;
|
|
1936
1936
|
return null;
|
|
1937
1937
|
}
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1938
|
+
|
|
1939
|
+
// export function isTreeArray(arr: any[]): boolean {
|
|
1940
|
+
|
|
1941
|
+
// // if (!Array.isArray(arr)) return false;
|
|
1942
|
+
|
|
1943
|
+
// // return arr.every(item => {
|
|
1944
|
+
// // if ("children" in item) {
|
|
1945
|
+
// // return Array.isArray(item.children) && item.children.length > 0;
|
|
1946
|
+
// // }
|
|
1947
|
+
// // return true; // node lá thì hợp lệ
|
|
1948
|
+
// // });
|
|
1949
|
+
|
|
1950
|
+
// if (!Array.isArray(arr)) return false;
|
|
1951
|
+
|
|
1952
|
+
// return arr.every(item => {
|
|
1953
|
+
// if (typeof item !== "object" || item === null) return false;
|
|
1954
|
+
|
|
1955
|
+
// if ("children" in item) {
|
|
1956
|
+
// return Array.isArray(item.children);
|
|
1957
|
+
// }
|
|
1958
|
+
|
|
1959
|
+
// return false; // node lá thì hợp lệ
|
|
1960
|
+
// });
|
|
1961
|
+
|
|
1962
|
+
// }
|
|
1963
|
+
|
|
1964
|
+
export function isTreeArray(arr, options) {
|
|
1965
|
+
if (!Array.isArray(arr) || arr.length === 0) return false;
|
|
1966
|
+
const requireNonEmpty = options?.requireNonEmptyChildren ?? false;
|
|
1967
|
+
let hasParent = false;
|
|
1968
|
+
for (const item of arr) {
|
|
1969
|
+
if (typeof item !== 'object' || item === null) return false;
|
|
1970
|
+
if ('children' in item) {
|
|
1971
|
+
const children = item.children;
|
|
1972
|
+
if (!Array.isArray(children)) return false;
|
|
1973
|
+
if (requireNonEmpty) {
|
|
1974
|
+
if (children.length > 0) hasParent = true;
|
|
1975
|
+
} else {
|
|
1976
|
+
hasParent = true;
|
|
1977
|
+
}
|
|
1943
1978
|
}
|
|
1944
|
-
|
|
1945
|
-
|
|
1979
|
+
}
|
|
1980
|
+
return hasParent;
|
|
1946
1981
|
}
|
|
1947
1982
|
export function updateColumnWidthsRecursive(columns, sizing) {
|
|
1948
1983
|
return columns.map(col => {
|