es-grid-template 1.8.71 → 1.8.73
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/es/grid-component/TempTable.js +2 -1
- package/es/grid-component/type.d.ts +1 -3
- package/es/group-component/ColumnsChoose.d.ts +13 -0
- package/es/group-component/ColumnsChoose.js +211 -0
- package/es/group-component/ColumnsGroup/ColumnsGroup.d.ts +12 -0
- package/es/group-component/ColumnsGroup/ColumnsGroup.js +230 -0
- package/es/group-component/ColumnsGroup/index.d.ts +1 -0
- package/es/group-component/ColumnsGroup/index.js +1 -0
- package/es/group-component/ContextMenu.d.ts +19 -0
- package/es/group-component/ContextMenu.js +74 -0
- package/es/group-component/InternalTable.d.ts +8 -0
- package/es/group-component/InternalTable.js +224 -0
- package/es/group-component/TableContainer.d.ts +49 -0
- package/es/group-component/TableContainer.js +375 -0
- package/es/group-component/TableContainerEdit.d.ts +48 -0
- package/es/group-component/TableContainerEdit.js +2068 -0
- package/es/group-component/body/EditableCell.d.ts +16 -0
- package/es/group-component/body/EditableCell.js +1066 -0
- package/es/group-component/body/TableBody.d.ts +14 -0
- package/es/group-component/body/TableBody.js +82 -0
- package/es/group-component/body/TableBodyCell.d.ts +12 -0
- package/es/group-component/body/TableBodyCell.js +587 -0
- package/es/group-component/body/TableBodyCellEdit.d.ts +17 -0
- package/es/group-component/body/TableBodyCellEdit.js +1398 -0
- package/es/group-component/body/TableBodyCellEmpty.d.ts +12 -0
- package/es/group-component/body/TableBodyCellEmpty.js +149 -0
- package/es/group-component/body/TableBodyRow.d.ts +21 -0
- package/es/group-component/body/TableBodyRow.js +199 -0
- package/es/group-component/body/TableBodyRowGroupCell.d.ts +12 -0
- package/es/group-component/body/TableBodyRowGroupCell.js +567 -0
- package/es/group-component/components/ControlCheckbox.d.ts +13 -0
- package/es/group-component/components/ControlCheckbox.js +84 -0
- package/es/group-component/components/EditForm/EditForm.d.ts +27 -0
- package/es/group-component/components/EditForm/EditForm.js +394 -0
- package/es/group-component/components/EditForm/index.d.ts +1 -0
- package/es/group-component/components/EditForm/index.js +1 -0
- package/es/group-component/components/InputControl/InputControl.d.ts +27 -0
- package/es/group-component/components/InputControl/InputControl.js +118 -0
- package/es/group-component/components/InputControl/index.d.ts +1 -0
- package/es/group-component/components/InputControl/index.js +1 -0
- package/es/group-component/components/async-select/index.d.ts +11 -0
- package/es/group-component/components/async-select/index.js +38 -0
- package/es/group-component/components/async-table-select/index.d.ts +11 -0
- package/es/group-component/components/async-table-select/index.js +40 -0
- package/es/group-component/components/checkbox-control/index.d.ts +13 -0
- package/es/group-component/components/checkbox-control/index.js +40 -0
- package/es/group-component/components/checkbox-filter/CheckboxFilter.d.ts +18 -0
- package/es/group-component/components/checkbox-filter/CheckboxFilter.js +258 -0
- package/es/group-component/components/checkbox-filter/FilterSearch.d.ts +12 -0
- package/es/group-component/components/checkbox-filter/FilterSearch.js +36 -0
- package/es/group-component/components/command/Command.d.ts +10 -0
- package/es/group-component/components/command/Command.js +35 -0
- package/es/group-component/components/number/index.d.ts +12 -0
- package/es/group-component/components/number/index.js +42 -0
- package/es/group-component/components/number-range/index.d.ts +13 -0
- package/es/group-component/components/number-range/index.js +79 -0
- package/es/group-component/features/operator.d.ts +24 -0
- package/es/group-component/features/operator.js +62 -0
- package/es/group-component/footer/TableFooter.d.ts +7 -0
- package/es/group-component/footer/TableFooter.js +34 -0
- package/es/group-component/footer/TableFooterCell.d.ts +7 -0
- package/es/group-component/footer/TableFooterCell.js +66 -0
- package/es/group-component/footer/TableFooterRow.d.ts +8 -0
- package/es/group-component/footer/TableFooterRow.js +30 -0
- package/es/group-component/header/TableHead.d.ts +15 -0
- package/es/group-component/header/TableHead.js +98 -0
- package/es/group-component/header/TableHeadCell.d.ts +15 -0
- package/es/group-component/header/TableHeadCell.js +310 -0
- package/es/group-component/header/TableHeadCell2.d.ts +17 -0
- package/es/group-component/header/TableHeadCell2.js +321 -0
- package/es/group-component/header/TableHeadGroupCell.d.ts +17 -0
- package/es/group-component/header/TableHeadGroupCell.js +94 -0
- package/es/group-component/header/TableHeadRow.d.ts +15 -0
- package/es/group-component/header/TableHeadRow.js +52 -0
- package/es/group-component/header/renderFilter.d.ts +20 -0
- package/es/group-component/header/renderFilter.js +291 -0
- package/es/group-component/hook/convert.d.ts +1 -0
- package/es/group-component/hook/convert.js +28 -0
- package/es/group-component/hook/useColumns.d.ts +28 -0
- package/es/group-component/hook/useColumns.js +306 -0
- package/es/group-component/hook/useFilterOperator.d.ts +7 -0
- package/es/group-component/hook/useFilterOperator.js +33 -0
- package/es/group-component/hook/utils.d.ts +220 -0
- package/es/group-component/hook/utils.js +2340 -0
- package/es/group-component/index.d.ts +2 -0
- package/es/group-component/index.js +2 -0
- package/es/group-component/style.d.ts +22 -0
- package/es/group-component/style.js +48 -0
- package/es/group-component/style.scss +1438 -0
- package/es/group-component/table/Grid.d.ts +33 -0
- package/es/group-component/table/Grid.js +439 -0
- package/es/group-component/table/TableWrapper.d.ts +33 -0
- package/es/group-component/table/TableWrapper.js +250 -0
- package/es/group-component/useContext.d.ts +100 -0
- package/es/group-component/useContext.js +21 -0
- package/es/table-component/InternalTable.js +9 -2
- package/es/table-component/TableContainer.d.ts +1 -0
- package/es/table-component/TableContainer.js +6 -2
- package/es/table-component/TableContainerEdit.d.ts +1 -0
- package/es/table-component/TableContainerEdit.js +4 -2
- package/es/table-component/body/TableBodyCell.js +49 -40
- package/es/table-component/body/TableBodyCellEdit.js +9 -6
- package/es/table-component/body/TableBodyRow.js +4 -1
- package/es/table-component/header/TableHeadCell2.js +39 -3
- package/es/table-component/hook/utils.d.ts +1 -0
- package/es/table-component/hook/utils.js +15 -7
- package/es/table-component/style.js +1 -1
- package/es/table-component/table/Grid.d.ts +1 -0
- package/es/table-component/table/Grid.js +10 -3
- package/es/table-component/useContext.d.ts +6 -0
- package/es/table-component/useContext.js +2 -1
- package/es/table-virtuoso/InternalTable.js +2 -2
- package/es/table-virtuoso/body/TableBodyCell.js +2 -7
- package/es/table-virtuoso/body/TableBodyCellRowGroup.d.ts +14 -0
- package/es/table-virtuoso/body/TableBodyCellRowGroup.js +196 -0
- package/es/table-virtuoso/body/TableBodyRow.d.ts +1 -1
- package/es/table-virtuoso/body/TableBodyRow.js +43 -1
- package/es/table-virtuoso/hook/utils.d.ts +1 -0
- package/es/table-virtuoso/hook/utils.js +29 -0
- package/es/table-virtuoso/style.js +3 -1
- package/es/table-virtuoso/table/Grid.js +2 -2
- package/es/table-virtuoso/table/TableWrapper.d.ts +7 -1
- package/es/table-virtuoso/table/TableWrapper.js +24 -5
- package/es/table-virtuoso/useContext.d.ts +6 -3
- package/es/table-virtuoso/useContext.js +18 -0
- package/lib/grid-component/TempTable.js +2 -1
- package/lib/grid-component/type.d.ts +1 -3
- package/lib/group-component/ColumnsChoose.d.ts +13 -0
- package/lib/group-component/ColumnsChoose.js +221 -0
- package/lib/group-component/ColumnsGroup/ColumnsGroup.d.ts +12 -0
- package/lib/group-component/ColumnsGroup/ColumnsGroup.js +241 -0
- package/lib/group-component/ColumnsGroup/index.d.ts +1 -0
- package/lib/group-component/ColumnsGroup/index.js +16 -0
- package/lib/group-component/ContextMenu.d.ts +19 -0
- package/lib/group-component/ContextMenu.js +83 -0
- package/lib/group-component/InternalTable.d.ts +8 -0
- package/lib/group-component/InternalTable.js +233 -0
- package/lib/group-component/TableContainer.d.ts +49 -0
- package/lib/group-component/TableContainer.js +382 -0
- package/lib/group-component/TableContainerEdit.d.ts +48 -0
- package/lib/group-component/TableContainerEdit.js +2075 -0
- package/lib/group-component/body/EditableCell.d.ts +16 -0
- package/lib/group-component/body/EditableCell.js +1075 -0
- package/lib/group-component/body/TableBody.d.ts +14 -0
- package/lib/group-component/body/TableBody.js +91 -0
- package/lib/group-component/body/TableBodyCell.d.ts +12 -0
- package/lib/group-component/body/TableBodyCell.js +595 -0
- package/lib/group-component/body/TableBodyCellEdit.d.ts +17 -0
- package/lib/group-component/body/TableBodyCellEdit.js +1405 -0
- package/lib/group-component/body/TableBodyCellEmpty.d.ts +12 -0
- package/lib/group-component/body/TableBodyCellEmpty.js +156 -0
- package/lib/group-component/body/TableBodyRow.d.ts +21 -0
- package/lib/group-component/body/TableBodyRow.js +206 -0
- package/lib/group-component/body/TableBodyRowGroupCell.d.ts +12 -0
- package/lib/group-component/body/TableBodyRowGroupCell.js +575 -0
- package/lib/group-component/components/ControlCheckbox.d.ts +13 -0
- package/lib/group-component/components/ControlCheckbox.js +92 -0
- package/lib/group-component/components/EditForm/EditForm.d.ts +27 -0
- package/lib/group-component/components/EditForm/EditForm.js +404 -0
- package/lib/group-component/components/EditForm/index.d.ts +1 -0
- package/lib/group-component/components/EditForm/index.js +16 -0
- package/lib/group-component/components/InputControl/InputControl.d.ts +27 -0
- package/lib/group-component/components/InputControl/InputControl.js +127 -0
- package/lib/group-component/components/InputControl/index.d.ts +1 -0
- package/lib/group-component/components/InputControl/index.js +16 -0
- package/lib/group-component/components/async-select/index.d.ts +11 -0
- package/lib/group-component/components/async-select/index.js +47 -0
- package/lib/group-component/components/async-table-select/index.d.ts +11 -0
- package/lib/group-component/components/async-table-select/index.js +49 -0
- package/lib/group-component/components/checkbox-control/index.d.ts +13 -0
- package/lib/group-component/components/checkbox-control/index.js +48 -0
- package/lib/group-component/components/checkbox-filter/CheckboxFilter.d.ts +18 -0
- package/lib/group-component/components/checkbox-filter/CheckboxFilter.js +267 -0
- package/lib/group-component/components/checkbox-filter/FilterSearch.d.ts +12 -0
- package/lib/group-component/components/checkbox-filter/FilterSearch.js +44 -0
- package/lib/group-component/components/command/Command.d.ts +10 -0
- package/lib/group-component/components/command/Command.js +44 -0
- package/lib/group-component/components/number/index.d.ts +12 -0
- package/lib/group-component/components/number/index.js +50 -0
- package/lib/group-component/components/number-range/index.d.ts +13 -0
- package/lib/group-component/components/number-range/index.js +87 -0
- package/lib/group-component/features/operator.d.ts +24 -0
- package/lib/group-component/features/operator.js +67 -0
- package/lib/group-component/footer/TableFooter.d.ts +7 -0
- package/lib/group-component/footer/TableFooter.js +44 -0
- package/lib/group-component/footer/TableFooterCell.d.ts +7 -0
- package/lib/group-component/footer/TableFooterCell.js +75 -0
- package/lib/group-component/footer/TableFooterRow.d.ts +8 -0
- package/lib/group-component/footer/TableFooterRow.js +37 -0
- package/lib/group-component/header/TableHead.d.ts +15 -0
- package/lib/group-component/header/TableHead.js +107 -0
- package/lib/group-component/header/TableHeadCell.d.ts +15 -0
- package/lib/group-component/header/TableHeadCell.js +319 -0
- package/lib/group-component/header/TableHeadCell2.d.ts +17 -0
- package/lib/group-component/header/TableHeadCell2.js +330 -0
- package/lib/group-component/header/TableHeadGroupCell.d.ts +17 -0
- package/lib/group-component/header/TableHeadGroupCell.js +103 -0
- package/lib/group-component/header/TableHeadRow.d.ts +15 -0
- package/lib/group-component/header/TableHeadRow.js +59 -0
- package/lib/group-component/header/renderFilter.d.ts +20 -0
- package/lib/group-component/header/renderFilter.js +301 -0
- package/lib/group-component/hook/convert.d.ts +1 -0
- package/lib/group-component/hook/convert.js +34 -0
- package/lib/group-component/hook/useColumns.d.ts +28 -0
- package/lib/group-component/hook/useColumns.js +318 -0
- package/lib/group-component/hook/useFilterOperator.d.ts +7 -0
- package/lib/group-component/hook/useFilterOperator.js +40 -0
- package/lib/group-component/hook/utils.d.ts +220 -0
- package/lib/group-component/hook/utils.js +2468 -0
- package/lib/group-component/index.d.ts +2 -0
- package/lib/group-component/index.js +9 -0
- package/lib/group-component/style.d.ts +22 -0
- package/lib/group-component/style.js +55 -0
- package/lib/group-component/style.scss +1438 -0
- package/lib/group-component/table/Grid.d.ts +33 -0
- package/lib/group-component/table/Grid.js +444 -0
- package/lib/group-component/table/TableWrapper.d.ts +33 -0
- package/lib/group-component/table/TableWrapper.js +259 -0
- package/lib/group-component/useContext.d.ts +100 -0
- package/lib/group-component/useContext.js +27 -0
- package/lib/table-component/InternalTable.js +9 -2
- package/lib/table-component/TableContainer.d.ts +1 -0
- package/lib/table-component/TableContainer.js +6 -2
- package/lib/table-component/TableContainerEdit.d.ts +1 -0
- package/lib/table-component/TableContainerEdit.js +4 -2
- package/lib/table-component/body/TableBodyCell.js +49 -40
- package/lib/table-component/body/TableBodyCellEdit.js +9 -6
- package/lib/table-component/body/TableBodyRow.js +4 -1
- package/lib/table-component/header/TableHeadCell2.js +38 -2
- package/lib/table-component/hook/utils.d.ts +1 -0
- package/lib/table-component/hook/utils.js +16 -7
- package/lib/table-component/style.js +1 -1
- package/lib/table-component/table/Grid.d.ts +1 -0
- package/lib/table-component/table/Grid.js +10 -3
- package/lib/table-component/useContext.d.ts +6 -0
- package/lib/table-component/useContext.js +2 -1
- package/lib/table-virtuoso/InternalTable.js +2 -2
- package/lib/table-virtuoso/body/TableBodyCell.js +2 -7
- package/lib/table-virtuoso/body/TableBodyCellRowGroup.d.ts +14 -0
- package/lib/table-virtuoso/body/TableBodyCellRowGroup.js +203 -0
- package/lib/table-virtuoso/body/TableBodyRow.d.ts +1 -1
- package/lib/table-virtuoso/body/TableBodyRow.js +43 -1
- package/lib/table-virtuoso/hook/utils.d.ts +1 -0
- package/lib/table-virtuoso/hook/utils.js +32 -1
- package/lib/table-virtuoso/style.js +3 -1
- package/lib/table-virtuoso/table/Grid.js +2 -2
- package/lib/table-virtuoso/table/TableWrapper.d.ts +7 -1
- package/lib/table-virtuoso/table/TableWrapper.js +24 -5
- package/lib/table-virtuoso/useContext.d.ts +6 -3
- package/lib/table-virtuoso/useContext.js +18 -0
- package/package.json +1 -1
|
@@ -59,7 +59,9 @@ exports.sortByType = exports.shouldInclude = exports.removeVietnameseTones = voi
|
|
|
59
59
|
exports.sortData = sortData;
|
|
60
60
|
exports.sumSize = void 0;
|
|
61
61
|
exports.toggleRowAndChildren = toggleRowAndChildren;
|
|
62
|
-
exports.
|
|
62
|
+
exports.unFlattenData = void 0;
|
|
63
|
+
exports.unGroupData = unGroupData;
|
|
64
|
+
exports.updateArrayByKey = void 0;
|
|
63
65
|
exports.updateColumnWidthsRecursive = updateColumnWidthsRecursive;
|
|
64
66
|
exports.updateColumnsByGroup = exports.updateColumns1 = void 0;
|
|
65
67
|
exports.updateOrInsert = updateOrInsert;
|
|
@@ -354,6 +356,35 @@ function groupArrayByColumns(arr, columns) {
|
|
|
354
356
|
return arr;
|
|
355
357
|
}
|
|
356
358
|
}
|
|
359
|
+
function unGroupData(groupedArray, originData) {
|
|
360
|
+
const result = [];
|
|
361
|
+
function traverse(arr) {
|
|
362
|
+
arr.forEach(item => {
|
|
363
|
+
if (item.children && item.children.length > 0) {
|
|
364
|
+
traverse(item.children);
|
|
365
|
+
} else {
|
|
366
|
+
// Đây là data item, không phải group item
|
|
367
|
+
result.push(item);
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
traverse(groupedArray);
|
|
372
|
+
|
|
373
|
+
// Tạo map từ id đến index trong originData
|
|
374
|
+
const indexMap = new Map();
|
|
375
|
+
originData.forEach((item, index) => {
|
|
376
|
+
const id = item.id ?? item.rowId;
|
|
377
|
+
indexMap.set(id, index);
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
// Sort result theo thứ tự trong originData
|
|
381
|
+
result.sort((a, b) => {
|
|
382
|
+
const aIndex = indexMap.get(a.id ?? a.rowId) ?? -1;
|
|
383
|
+
const bIndex = indexMap.get(b.id ?? b.rowId) ?? -1;
|
|
384
|
+
return aIndex - bIndex;
|
|
385
|
+
});
|
|
386
|
+
return result;
|
|
387
|
+
}
|
|
357
388
|
const flatColumns2 = columns => {
|
|
358
389
|
return columns.reduce((list, column) => {
|
|
359
390
|
const subColumns = column.children;
|
|
@@ -9,6 +9,8 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
9
9
|
const color = "#000000de";
|
|
10
10
|
const BgColor = "#ffffff";
|
|
11
11
|
const rowSelectedBg = "#FEF2EF";
|
|
12
|
+
const cellSelectedBg = "#F3F8FF";
|
|
13
|
+
const borderSelectedColor = "#0550C5";
|
|
12
14
|
const tableBorderColor = "#e0e0e0";
|
|
13
15
|
const tableBorderColorDark = "#44485E";
|
|
14
16
|
const BgColorDark = "#343e59";
|
|
@@ -16,4 +18,4 @@ const colorDark = "#e6e4f3e6";
|
|
|
16
18
|
const GridStyle = exports.GridStyle = _styledComponents.default.div.withConfig({
|
|
17
19
|
displayName: "GridStyle",
|
|
18
20
|
componentId: "es-grid-template__sc-rs980s-0"
|
|
19
|
-
})(["&.", "-grid{color:", ";font-size:13px;background-color:", ";table{table-layout:fixed;border-collapse:separate;border-spacing:0;}.", "-grid-container{border:1px solid ", ";.", "-grid-thead{&:has(.resizer.isResizing){.", "-grid-cell{touch-action:none;user-select:none;}}.", "-grid-cell{background-color:#ffffff;&:has(.resizer.isResizing){touch-action:none;user-select:none;}.resizer{cursor:col-resize;height:100%;position:absolute;right:0;top:0;touch-action:none;user-select:none;width:5px;}}}tbody{.", "-grid-row{&.", "-grid-row-parent{.", "-grid-cell{font-weight:600;background-color:#f5f5f5;}}}}.", "-grid-tfoot{z-index:3 !important;.ui-rc-grid-footer-row{.ui-rc-grid-cell{border-top:1px solid ", ";border-bottom:1px solid ", ";}}}.", "-grid-cell{padding:7px 8px;.class-content:has(*){background:lightblue;}.class-content:not(:has(*)){background:lightgreen;}&.", "-grid-cell-text-center{text-align:center;justify-content:center;}&.", "-grid-cell-text-righ{text-align:right;justify-content:flex-end;}}.", "-grid-cell:not(:has(*)){&.", "-grid-cell-text-center{text-align:center;justify-content:center;}&.", "-grid-cell-text-right{text-align:right;justify-content:flex-end;}&.", "-grid-cell-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}}&.", "-grid-light{.", "-grid-container{.", "-grid-thead{z-index:3 !important;background-color:", ";font-weight:500;.", "-grid-cell{font-weight:inherit;color:", ";background-color:#ffffff;border-inline-end:1px solid ", ";border-bottom:1px solid ", ";&.ui-rc-grid-cell-ellipsis{.ui-rc-table-column-title,.", "-grid-cell-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}&.ui-rc-grid-cell-wrap{.ui-rc-table-column-title,.", "-grid-cell-text-wrap{white-space:normal;word-break:break-word;overflow:hidden;}}&:hover{.ui-rc-header-trigger{.ui-rc-table-column-sorter-cancel{opacity:1;}}}.", "-grid-filter-column{display:flex;justify-content:space-between;width:100%;align-items:center;position:relative;}.ui-rc-header-trigger{padding-left:6px;display:flex;align-items:center;.ui-rc-table-column-sorter-cancel{opacity:0;}}.resizer{cursor:col-resize;height:100%;position:absolute;right:0;top:0;touch-action:none;user-select:none;width:5px;}.resizer.isResizing{opacity:1;}}}.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";}}tbody{background-color:", ";color:", ";.", "-grid-row{&.ui-rc-grid-row-selected{.", "-grid-cell{background-color:", ";}}}.", "-grid-cell{outline:none;background-color:#ffffff;border-inline-end:1px solid ", ";border-bottom:1px solid ", ";&.ui-rc-grid-cell-selected{background-color
|
|
21
|
+
})(["&.", "-grid{color:", ";font-size:13px;background-color:", ";table{table-layout:fixed;border-collapse:separate;border-spacing:0;}.", "-grid-container{border:1px solid ", ";.", "-grid-thead{&:has(.resizer.isResizing){.", "-grid-cell{touch-action:none;user-select:none;}}.", "-grid-cell{background-color:#ffffff;&:has(.resizer.isResizing){touch-action:none;user-select:none;}.resizer{cursor:col-resize;height:100%;position:absolute;right:0;top:0;touch-action:none;user-select:none;width:5px;}}}tbody{.", "-grid-row{&.", "-grid-row-parent{.", "-grid-cell{font-weight:600;background-color:#f5f5f5;}}}}.", "-grid-tfoot{z-index:3 !important;.ui-rc-grid-footer-row{.ui-rc-grid-cell{border-top:1px solid ", ";border-bottom:1px solid ", ";}}}.", "-grid-cell{padding:7px 8px;.class-content:has(*){background:lightblue;}.class-content:not(:has(*)){background:lightgreen;}&.", "-grid-cell-text-center{text-align:center;justify-content:center;}&.", "-grid-cell-text-righ{text-align:right;justify-content:flex-end;}}.", "-grid-cell:not(:has(*)){&.", "-grid-cell-text-center{text-align:center;justify-content:center;}&.", "-grid-cell-text-right{text-align:right;justify-content:flex-end;}&.", "-grid-cell-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}}&.", "-grid-light{.", "-grid-container{.", "-grid-thead{z-index:3 !important;background-color:", ";font-weight:500;.", "-grid-cell{font-weight:inherit;color:", ";background-color:#ffffff;border-inline-end:1px solid ", ";border-bottom:1px solid ", ";&.ui-rc-grid-cell-ellipsis{.ui-rc-table-column-title,.", "-grid-cell-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}&.ui-rc-grid-cell-wrap{.ui-rc-table-column-title,.", "-grid-cell-text-wrap{white-space:normal;word-break:break-word;overflow:hidden;}}&:hover{.ui-rc-header-trigger{.ui-rc-table-column-sorter-cancel{opacity:1;}}}.", "-grid-filter-column{display:flex;justify-content:space-between;width:100%;align-items:center;position:relative;}.ui-rc-header-trigger{padding-left:6px;display:flex;align-items:center;.ui-rc-table-column-sorter-cancel{opacity:0;}}.resizer{cursor:col-resize;height:100%;position:absolute;right:0;top:0;touch-action:none;user-select:none;width:5px;}.resizer.isResizing{opacity:1;}}}.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";}}tbody{background-color:", ";color:", ";.", "-grid-row{&.ui-rc-grid-row-selected{.", "-grid-cell{background-color:", ";}}}.", "-grid-cell{outline:none;background-color:#ffffff;border-inline-end:1px solid ", ";border-bottom:1px solid ", ";&.ui-rc-grid-cell-selected{background-color:", " !important;}&.disable{background-color:#f0f0f0;}&.cell-editable{user-select:none;&.cell-border-top{&::after{content:\"\";position:absolute;top:0px;left:0;height:1px;width:100%;border-top:1px solid ", ";pointer-events:none;z-index:1;}}&.cell-border-bottom{border-bottom:1px solid ", ";}&.cell-border-left{&::before{content:\"\";position:absolute;top:0;left:0;height:102%;width:1px;border-left:1px solid ", ";pointer-events:none;z-index:1;}}&.cell-border-right{border-inline-end:1px solid ", ";}&.cell-paste-border-top{&::after{content:\"\";position:absolute;top:0px;left:0;height:1px;width:100%;border-top:1px dashed #949494;pointer-events:none;z-index:1;}&.ui-rc-grid-cell-fix-left-last{&::after{left:-100%;}}&.ui-rc-grid-cell-fix-right-first{&::after{left:100%;}}}&.cell-paste-border-bottom{border-bottom:1px dashed #949494;}&.cell-paste-border-left{&::before{content:\"\";position:absolute;top:0;left:0;height:102%;width:1px;border-left:1px dashed #949494;pointer-events:none;z-index:1;}}&.cell-paste-border-right{border-inline-end:1px dashed #949494;}.dragging-point{width:6px;height:6px;position:absolute;cursor:crosshair;right:0px;bottom:0px;&.hidden{display:none;}.dot-point{position:absolute;width:6px;height:6px;border-radius:0px;background-color:", ";bottom:0;right:0;}}}&.cell-editing{padding:0;&:focus-visible{outline:none;}.ant-form-item,.ant-row.ant-form-item-row,.ant-col.ant-form-item-control,.ant-form-item-control-input,.ant-form-item-control-input-content,.ant-input{height:100% !important;&:focus-visible{outline:none;}}textarea.ant-input{line-height:1.8;height:36px !important;min-height:36px !important;}input.be-cell-editing,.ant-picker,.ui-rc-select-selector,.ui-rc-table-select-selector{padding-inline:7px;}.", "-checkbox-wrapper{.", "-checkbox{background-color:red;}.", "-checkbox-input{&:focus-visible{outline:none;}}}.ant-input,.ant-picker{border-radius:0;}.ant-color-picker-trigger{height:100%;border-radius:0;.ant-color-picker-color-block{height:100%;width:100%;}}.", "-table-select-single .", "-table-select-selector,.", "-select-single .", "-select-selector,.ui-rc-table-select-selector{border-radius:0 !important;}.", "-table-select-single:not(.", "-table-select-customize-input){.", "-table-select-selector{.", "-table-select-selection-search-input{height:auto;}}}}}}.", "-grid-tfoot{.", "-grid-footer-row{border-bottom-width:1px;border-bottom-color:", ";border-bottom-style:solid;border-top-width:1px;border-top-color:", ";border-top-style:solid;background-color:#fafafa;}.", "-grid-cell{background-color:inherit;border-inline-end:1px solid ", ";}}}}&.", "-grid-dark{background-color:", ";color:", ";.", "-grid-container{border-color:", ";&::after{border-right-color:", ";}}}}"], props => props.$prefix, color, BgColor, props => props.$prefix, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => props.$prefix, props => `${props.$theme.color ? props.$theme.color : color}`, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, rowSelectedBg, props => props.$prefix, tableBorderColor, tableBorderColor, cellSelectedBg, borderSelectedColor, borderSelectedColor, borderSelectedColor, borderSelectedColor, borderSelectedColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, tableBorderColor, props => props.$prefix, BgColorDark, colorDark, props => props.$prefix, tableBorderColorDark, tableBorderColorDark);
|
|
@@ -182,7 +182,7 @@ const Grid = props => {
|
|
|
182
182
|
t: t,
|
|
183
183
|
windowSize: windowSize,
|
|
184
184
|
table: table,
|
|
185
|
-
editAble:
|
|
185
|
+
editAble: false,
|
|
186
186
|
dataSource: dataSource,
|
|
187
187
|
originData: originData,
|
|
188
188
|
prefix: prefix,
|
|
@@ -252,7 +252,7 @@ const Grid = props => {
|
|
|
252
252
|
id: _faker.faker.string.alpha(20),
|
|
253
253
|
t: t,
|
|
254
254
|
table: table,
|
|
255
|
-
editAble:
|
|
255
|
+
editAble: false,
|
|
256
256
|
dataSource: dataSource,
|
|
257
257
|
originData: originData,
|
|
258
258
|
prefix: prefix,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ColumnDef, Table } from "@tanstack/react-table";
|
|
3
|
-
import type { CommandClick } from '../../grid-component/type';
|
|
3
|
+
import type { CommandClick, ContextInfo, PaginationConfig } from '../../grid-component/type';
|
|
4
|
+
import type { ContextMenuItem } from "../..";
|
|
4
5
|
type Props<T> = {
|
|
5
6
|
tableContainerRef: React.RefObject<HTMLDivElement>;
|
|
6
7
|
table: Table<T>;
|
|
@@ -14,9 +15,14 @@ type Props<T> = {
|
|
|
14
15
|
loading?: boolean;
|
|
15
16
|
commandClick?: (args: Omit<CommandClick<T>, 'rows'>) => void;
|
|
16
17
|
editAble?: boolean;
|
|
18
|
+
contextMenuItems?: ContextMenuItem[];
|
|
17
19
|
showEmptyText?: boolean;
|
|
18
20
|
contextMenuClick?: any;
|
|
21
|
+
contextMenuOpen?: (args: Omit<ContextInfo<T>, 'item'>) => void;
|
|
22
|
+
contextMenuHidden?: string[] | ((args?: Omit<ContextInfo<T>, 'item' | 'event'>) => string[]);
|
|
19
23
|
next?: () => void;
|
|
24
|
+
pagination?: false | PaginationConfig;
|
|
25
|
+
infiniteScroll?: boolean;
|
|
20
26
|
};
|
|
21
27
|
declare const TableWrapper: <RecordType extends object>(props: Props<RecordType>) => React.JSX.Element;
|
|
22
28
|
export default TableWrapper;
|
|
@@ -29,10 +29,13 @@ const TableWrapper = props => {
|
|
|
29
29
|
table,
|
|
30
30
|
height,
|
|
31
31
|
id,
|
|
32
|
-
commandClick
|
|
32
|
+
commandClick,
|
|
33
|
+
editAble
|
|
33
34
|
} = props;
|
|
34
35
|
const {
|
|
35
|
-
prefix
|
|
36
|
+
prefix,
|
|
37
|
+
editingKey,
|
|
38
|
+
rowEditable
|
|
36
39
|
} = (0, _react.useContext)(_useContext.TableContext); //onRowHeaderStyles
|
|
37
40
|
|
|
38
41
|
// ref cho scroll container
|
|
@@ -79,22 +82,38 @@ const TableWrapper = props => {
|
|
|
79
82
|
TableHead: props => /*#__PURE__*/_react.default.createElement("thead", (0, _extends2.default)({}, props, {
|
|
80
83
|
className: `${prefix}-grid-thead`
|
|
81
84
|
})),
|
|
85
|
+
// TableBody: (props) => (
|
|
86
|
+
// <tbody {...props} className={`${prefix}-grid-tbody1`} />
|
|
87
|
+
// ),
|
|
88
|
+
|
|
82
89
|
TableFoot: props => /*#__PURE__*/_react.default.createElement("tfoot", (0, _extends2.default)({}, props, {
|
|
83
90
|
className: `${prefix}-grid-tfoot`
|
|
84
91
|
})),
|
|
85
92
|
TableRow: props => {
|
|
93
|
+
const {
|
|
94
|
+
item,
|
|
95
|
+
...rest
|
|
96
|
+
} = props;
|
|
86
97
|
const index = props["data-index"];
|
|
87
98
|
const rowheight = props["data-known-size"];
|
|
88
99
|
const row = rows[index];
|
|
100
|
+
const isEditing = row.id === editingKey;
|
|
101
|
+
const isRowEditable = rowEditable ? rowEditable(row.original) : true;
|
|
89
102
|
return /*#__PURE__*/_react.default.createElement(_TableBodyRow.default, (0, _extends2.default)({
|
|
90
103
|
tableId: id,
|
|
91
104
|
row: row,
|
|
92
105
|
table: table,
|
|
93
106
|
commandClick: commandClick,
|
|
94
|
-
rowheight: rowheight
|
|
95
|
-
|
|
107
|
+
rowheight: editAble ? 37 : rowheight,
|
|
108
|
+
isEditing: isEditing,
|
|
109
|
+
isRowEditable: isRowEditable,
|
|
110
|
+
editAble: editAble
|
|
111
|
+
}, rest));
|
|
96
112
|
}
|
|
97
|
-
}
|
|
113
|
+
},
|
|
114
|
+
defaultItemHeight: 37,
|
|
115
|
+
fixedItemHeight: 37,
|
|
116
|
+
itemSize: () => 37
|
|
98
117
|
|
|
99
118
|
// overscan={{
|
|
100
119
|
// main: 10,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Dispatch, SetStateAction } from 'react';
|
|
2
|
-
import type { ColumnTable, ExpandableConfig, IFormat, IGroupSetting, IWrapSettings, Locale, PaginationConfig, RangeState, RecordDoubleClickEventArgs, RowClassName, SelectionSettings } from "../grid-component/type";
|
|
2
|
+
import type { ColumnTable, ExpandableConfig, IFormat, IGroupSetting, IWrapSettings, Locale, PaginationConfig, RangeState, RecordDoubleClickEventArgs, RowClassName, SelectionSettings, SourceFilter } from "../grid-component/type";
|
|
3
3
|
import type { SubmitHandler } from "react-hook-form";
|
|
4
4
|
import type { ExpandedState, Row, Table } from '@tanstack/react-table';
|
|
5
5
|
export type IPositionCell = {
|
|
6
6
|
rowId: string;
|
|
7
7
|
colId: string;
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
9
|
export interface IContext<T> {
|
|
10
10
|
t?: any;
|
|
11
11
|
prefix: string;
|
|
@@ -48,6 +48,7 @@ export interface IContext<T> {
|
|
|
48
48
|
reset?: any;
|
|
49
49
|
setValue?: any;
|
|
50
50
|
handleCellChange?: (args: ContextCellChange) => void;
|
|
51
|
+
handleCellChangeAndAddRow?: (args: ContextCellChange) => void;
|
|
51
52
|
editingKey?: string;
|
|
52
53
|
setEditingKey?: Dispatch<SetStateAction<string>>;
|
|
53
54
|
rangeState?: RangeState;
|
|
@@ -68,6 +69,7 @@ export interface IContext<T> {
|
|
|
68
69
|
setIsPasting?: Dispatch<SetStateAction<boolean>>;
|
|
69
70
|
focusedCell?: IPositionCell;
|
|
70
71
|
setFocusedCell?: Dispatch<SetStateAction<IPositionCell | undefined>>;
|
|
72
|
+
cellActive?: any;
|
|
71
73
|
triggerPaste?: (pastedRows: T[], pastedColumnsArray: string[], newData: T[], copyRows: T[]) => void;
|
|
72
74
|
handleDeleteContent?: () => void;
|
|
73
75
|
handleAddMulti?: (item: any, n: number, id?: string) => void;
|
|
@@ -82,12 +84,13 @@ export interface IContext<T> {
|
|
|
82
84
|
onRowHeaderStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | (() => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
|
|
83
85
|
onRowFooterStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | (() => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
|
|
84
86
|
groupSetting?: IGroupSetting;
|
|
87
|
+
dataSourceFilter?: SourceFilter[];
|
|
85
88
|
}
|
|
86
89
|
export declare const TableContext: import("react").Context<IContext<any>>;
|
|
87
90
|
export type ContextCellChange = {
|
|
88
91
|
key: string;
|
|
89
92
|
record: any;
|
|
90
|
-
field: string
|
|
93
|
+
field: string;
|
|
91
94
|
option: any;
|
|
92
95
|
indexRow: number;
|
|
93
96
|
indexCol: number;
|
|
@@ -24,4 +24,22 @@ const TableContext = exports.TableContext = /*#__PURE__*/(0, _react.createContex
|
|
|
24
24
|
setFilterChange: () => {},
|
|
25
25
|
setExpanded: () => {},
|
|
26
26
|
handleCellClick: () => {}
|
|
27
|
+
|
|
28
|
+
// startCellRef: { current: undefined } as React.MutableRefObject<IPositionCell | undefined>,
|
|
29
|
+
// endCellRef: { current: undefined } as React.MutableRefObject<IPositionCell | undefined>,
|
|
30
|
+
// focusedCellRef: { current: undefined } as React.MutableRefObject<IPositionCell | undefined>,
|
|
31
|
+
// isSelectingRef: { current: false } as React.MutableRefObject<boolean>,
|
|
32
|
+
|
|
33
|
+
// rangeStateRef: {
|
|
34
|
+
// current: {
|
|
35
|
+
// startRowIndex: undefined,
|
|
36
|
+
// endRowIndex: undefined,
|
|
37
|
+
// startColIndex: undefined,
|
|
38
|
+
// endColIndex: undefined,
|
|
39
|
+
// rowIds: [],
|
|
40
|
+
// colIds: [],
|
|
41
|
+
// colRange: [],
|
|
42
|
+
// rowRange: []
|
|
43
|
+
// }
|
|
44
|
+
// } as React.MutableRefObject<RangeState>
|
|
27
45
|
});
|