es-grid-template 1.8.71 → 1.8.72
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/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 +438 -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 +6 -1
- package/es/table-component/TableContainer.js +4 -2
- package/es/table-component/body/TableBodyCell.js +49 -40
- package/es/table-component/body/TableBodyRow.js +4 -1
- 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.js +3 -0
- package/es/table-component/useContext.d.ts +5 -0
- 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/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 +443 -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 +6 -1
- package/lib/table-component/TableContainer.js +4 -2
- package/lib/table-component/body/TableBodyCell.js +49 -40
- package/lib/table-component/body/TableBodyRow.js +4 -1
- 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.js +3 -0
- package/lib/table-component/useContext.d.ts +5 -0
- 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
|
@@ -48,6 +48,7 @@ exports.isEqualSet = isEqualSet;
|
|
|
48
48
|
exports.isObjEmpty = exports.isNullOrUndefined = exports.isNameColor = exports.isFormattedNumber = void 0;
|
|
49
49
|
exports.isObjEqual = isObjEqual;
|
|
50
50
|
exports.isTreeArray = isTreeArray;
|
|
51
|
+
exports.isTreeArray2 = isTreeArray2;
|
|
51
52
|
exports.parseBooleanToValue = exports.onRemoveBgSelectedCell = exports.onAddBgSelectedCell = exports.newGuid = void 0;
|
|
52
53
|
exports.parseClipboardEvent = parseClipboardEvent;
|
|
53
54
|
exports.parseExcelClipboard = parseExcelClipboard;
|
|
@@ -2087,13 +2088,6 @@ const convertToObj = arr => {
|
|
|
2087
2088
|
};
|
|
2088
2089
|
exports.convertToObj = convertToObj;
|
|
2089
2090
|
const convertToObjTrue = arr => {
|
|
2090
|
-
// const result = Object.keys(obj).reduce((acc: any, key) => {
|
|
2091
|
-
// acc[key] = false;
|
|
2092
|
-
// return acc;
|
|
2093
|
-
// }, {});
|
|
2094
|
-
|
|
2095
|
-
// return result
|
|
2096
|
-
|
|
2097
2091
|
return Object.fromEntries(arr.map(key => [key, true]));
|
|
2098
2092
|
};
|
|
2099
2093
|
exports.convertToObjTrue = convertToObjTrue;
|
|
@@ -2102,11 +2096,26 @@ const getDiffent2Array = (a, b) => {
|
|
|
2102
2096
|
};
|
|
2103
2097
|
exports.getDiffent2Array = getDiffent2Array;
|
|
2104
2098
|
function findFirst(items) {
|
|
2099
|
+
// const leftItem = items.find(item => item.getIsPinned() === 'left')
|
|
2105
2100
|
const leftItem = items.find(item => item.getIsPinned() === 'left');
|
|
2106
2101
|
if (leftItem) return leftItem;
|
|
2107
2102
|
return null;
|
|
2108
2103
|
}
|
|
2109
2104
|
function isTreeArray(arr) {
|
|
2105
|
+
if (!Array.isArray(arr) || arr.length === 0) {
|
|
2106
|
+
return false;
|
|
2107
|
+
}
|
|
2108
|
+
for (const item of arr) {
|
|
2109
|
+
if (!item) {
|
|
2110
|
+
return false;
|
|
2111
|
+
}
|
|
2112
|
+
if (item.children) {
|
|
2113
|
+
return true;
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
return false;
|
|
2117
|
+
}
|
|
2118
|
+
function isTreeArray2(arr) {
|
|
2110
2119
|
if (!Array.isArray(arr) || arr.length === 0) {
|
|
2111
2120
|
return false;
|
|
2112
2121
|
}
|
|
@@ -52,4 +52,4 @@ const colorDark = "#e6e4f3e6 ";
|
|
|
52
52
|
const GridStyle = exports.GridStyle = _styledComponents.default.div.withConfig({
|
|
53
53
|
displayName: "GridStyle",
|
|
54
54
|
componentId: "es-grid-template__sc-hdqm5k-0"
|
|
55
|
-
})(["&.", "-grid{color:", ";font-size:13px;background-color:", ";table{table-layout:fixed;border-collapse:separate;border-spacing:0;}.", "-grid-container{border:1px solid ", ";border-right:0;&::after{position:absolute;top:0px;right:0;z-index:1;height:100%;border-right:1px solid ", ";content:\"\";pointer-events:none;}.", "-grid-tbody{.", "-grid-row{}}}&.", "-grid-light{.", "-grid-container{.", "-grid-thead{background-color:", ";font-weight:500;.", "-grid-cell{font-weight:inherit;color:", ";background-color:inherit;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;z-index:3;}.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;z-index:3;touch-action:none;user-select:none;width:5px;}.resizer.isResizing{opacity:1;}}}.", "-grid-tbody{.", "-grid-row{
|
|
55
|
+
})(["&.", "-grid{color:", ";font-size:13px;background-color:", ";table{table-layout:fixed;border-collapse:separate;border-spacing:0;}.", "-grid-container{border:1px solid ", ";border-right:0;&::after{position:absolute;top:0px;right:0;z-index:1;height:100%;border-right:1px solid ", ";content:\"\";pointer-events:none;}.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";&.", "-grid-row-parent{background-color:#f5f5f5;font-weight:500;}}}}&.", "-grid-light{.", "-grid-container{.", "-grid-thead{background-color:", ";font-weight:500;.", "-grid-cell{font-weight:inherit;color:", ";background-color:inherit;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;z-index:3;}.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;z-index:3;touch-action:none;user-select:none;width:5px;}.resizer.isResizing{opacity:1;}}}.", "-grid-tbody{.", "-grid-row{}}.", "-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, tableBorderColor, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, 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.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, tableBorderColor, props => props.$prefix, BgColorDark, colorDark, props => props.$prefix, tableBorderColorDark, tableBorderColorDark);
|
|
@@ -158,6 +158,9 @@ const Grid = props => {
|
|
|
158
158
|
onGroupingChange: setGrouping,
|
|
159
159
|
getGroupedRowModel: (0, _reactTable.getGroupedRowModel)(),
|
|
160
160
|
// onExpandedChange: setExpanded,
|
|
161
|
+
getRowCanExpand: row => {
|
|
162
|
+
return Array.isArray(row.original.children);
|
|
163
|
+
},
|
|
161
164
|
getExpandedRowModel: (0, _reactTable.getExpandedRowModel)(),
|
|
162
165
|
getPaginationRowModel: pagination && !infiniteScroll ? (0, _reactTable.getPaginationRowModel)() : undefined,
|
|
163
166
|
onPaginationChange: setPagination
|
|
@@ -83,6 +83,11 @@ export interface IContext<T> {
|
|
|
83
83
|
onRowHeaderStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | (() => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
|
|
84
84
|
onRowFooterStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | (() => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
|
|
85
85
|
dataSourceFilter?: SourceFilter[];
|
|
86
|
+
onExpandClick?: (args: {
|
|
87
|
+
expandedKeys: string[];
|
|
88
|
+
key: string;
|
|
89
|
+
rowData: any;
|
|
90
|
+
}) => void;
|
|
86
91
|
}
|
|
87
92
|
export declare const TableContext: import("react").Context<IContext<any>>;
|
|
88
93
|
export type ContextCellChange = {
|
|
@@ -278,7 +278,7 @@ const InternalTable = props => {
|
|
|
278
278
|
setExpanded((0, _utils.convertToObjTrue)(defaultExpandedRowKeys ?? []));
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
|
-
}, [defaultExpandAllRows, defaultExpandedRowKeys, tableData
|
|
281
|
+
}, [defaultExpandAllRows, defaultExpandedRowKeys, tableData]);
|
|
282
282
|
const triggerGroupColumns = groupedColumns => {
|
|
283
283
|
// const abc = updateColumnsByGroup(columns, groupedColumns)
|
|
284
284
|
|
|
@@ -378,7 +378,7 @@ const InternalTable = props => {
|
|
|
378
378
|
triggerSorter: triggerSorter,
|
|
379
379
|
setMergedFilterKeys: setMergedFilterKeys,
|
|
380
380
|
mergedFilterKeys: mergedFilterKeys,
|
|
381
|
-
editAble:
|
|
381
|
+
editAble: false,
|
|
382
382
|
triggerChangeColumns: triggerChangeColumns,
|
|
383
383
|
triggerGroupColumns: triggerGroupColumns,
|
|
384
384
|
expanded: expanded,
|
|
@@ -330,14 +330,9 @@ const TableBodyCell = props => {
|
|
|
330
330
|
tabIndex: focusedCell?.rowId === cell.row.id && focusedCell?.colId === cell.column.id ? 0 : -1,
|
|
331
331
|
"data-col-index": colIndex,
|
|
332
332
|
"data-row-index": rowNumber,
|
|
333
|
-
"data-col-key": cell.column.id
|
|
334
|
-
// data-row-key={cell.row.id}
|
|
335
|
-
,
|
|
333
|
+
"data-col-key": cell.column.id,
|
|
336
334
|
"data-tooltip-id": `${id}-tooltip-content`,
|
|
337
|
-
"data-tooltip-html": _server.default.renderToStaticMarkup( /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tooltipContent))
|
|
338
|
-
// data-tooltip-delay-show={500}
|
|
339
|
-
,
|
|
340
|
-
|
|
335
|
+
"data-tooltip-html": _server.default.renderToStaticMarkup( /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tooltipContent)),
|
|
341
336
|
className: (0, _classnames.default)(`${prefix}-grid-cell`, {
|
|
342
337
|
// [`${prefix}-grid-cell-ellipsis`]: true,
|
|
343
338
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Cell, Table } from "@tanstack/react-table";
|
|
2
|
+
import type { CommandClick } from "../../grid-component/type";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import type { VirtualItem } from "@tanstack/react-virtual";
|
|
5
|
+
interface TableBodyCellProps<T> {
|
|
6
|
+
table: Table<T>;
|
|
7
|
+
tableId: string;
|
|
8
|
+
cell: Cell<T, unknown>;
|
|
9
|
+
commandClick?: (args: CommandClick<T>) => void;
|
|
10
|
+
virtualRow: VirtualItem;
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
13
|
+
declare const TableBodyCellRowGroup: <RecordType extends object>(props: TableBodyCellProps<RecordType>) => React.JSX.Element;
|
|
14
|
+
export default TableBodyCellRowGroup;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _server = _interopRequireDefault(require("react-dom/server"));
|
|
9
|
+
var _utils = require("../hook/utils");
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _useContext = require("../useContext");
|
|
13
|
+
var _useColumns = require("../../table-component/hook/useColumns");
|
|
14
|
+
const TableBodyCellRowGroup = props => {
|
|
15
|
+
const {
|
|
16
|
+
cell,
|
|
17
|
+
table,
|
|
18
|
+
isEditing,
|
|
19
|
+
colSpan,
|
|
20
|
+
rowSpan,
|
|
21
|
+
sumValue
|
|
22
|
+
} = props;
|
|
23
|
+
const {
|
|
24
|
+
id,
|
|
25
|
+
prefix,
|
|
26
|
+
focusedCell,
|
|
27
|
+
setFocusedCell,
|
|
28
|
+
expanded,
|
|
29
|
+
setExpanded,
|
|
30
|
+
expandable,
|
|
31
|
+
isDataTree,
|
|
32
|
+
setIsSelectionChange,
|
|
33
|
+
isSelectionChange,
|
|
34
|
+
selectionSettings,
|
|
35
|
+
wrapSettings
|
|
36
|
+
// dataSource
|
|
37
|
+
} = _react.default.useContext(_useContext.TableContext);
|
|
38
|
+
const expandIconColumnIndex = expandable?.expandIconColumnIndex ?? 0;
|
|
39
|
+
const [isOpenTooltip, setIsOpenTooltip] = _react.default.useState(false);
|
|
40
|
+
const record = cell.row.original;
|
|
41
|
+
const columnMeta = cell.column.columnDef.meta ?? {};
|
|
42
|
+
const cellStyles = typeof columnMeta.onCellStyles === 'function' ? columnMeta.onCellStyles(cell.getValue(), cell) : columnMeta.onCellStyles;
|
|
43
|
+
|
|
44
|
+
// const tooltipContent = (isOpenTooltip === false || columnMeta.type === 'checkbox') ? '' : flexRender(cell.column.columnDef.cell, cell.getContext());
|
|
45
|
+
const tooltipContent = isOpenTooltip === false ? '' : columnMeta?.tooltipDescription ? typeof columnMeta.tooltipDescription === 'function' ? columnMeta.tooltipDescription({
|
|
46
|
+
value: cell.getValue(),
|
|
47
|
+
record
|
|
48
|
+
}) : columnMeta.tooltipDescription : columnMeta.template && typeof columnMeta.template !== 'function' ? columnMeta.template : cell.getValue();
|
|
49
|
+
const allRows = table.getRowModel().flatRows;
|
|
50
|
+
const rowNumber = allRows.findIndex(it => it.id === cell.row.id);
|
|
51
|
+
const colIndex = cell.column.getIndex();
|
|
52
|
+
const isPinned = cell.column.getIsPinned();
|
|
53
|
+
const isLastLeftPinnedColumn = isPinned === "left" && cell.column.getIsLastColumn("left");
|
|
54
|
+
const isFirstRightPinnedColumn = isPinned === "right" && cell.column.getIsFirstColumn("right");
|
|
55
|
+
const enableClick = typeof columnMeta.allowSelection === 'function' ? columnMeta.allowSelection(record) : columnMeta.allowSelection;
|
|
56
|
+
return /*#__PURE__*/_react.default.createElement("td", {
|
|
57
|
+
key: cell.id,
|
|
58
|
+
colSpan: colSpan,
|
|
59
|
+
rowSpan: rowSpan
|
|
60
|
+
// {...cellProps}
|
|
61
|
+
,
|
|
62
|
+
|
|
63
|
+
ref: el => {
|
|
64
|
+
if (focusedCell?.rowId === cell.row.id && focusedCell?.colId === cell.column.id && !isEditing) {
|
|
65
|
+
el?.focus();
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
tabIndex: focusedCell?.rowId === cell.row.id && focusedCell?.colId === cell.column.id ? 0 : -1,
|
|
69
|
+
"data-col-index": colIndex,
|
|
70
|
+
"data-row-index": rowNumber,
|
|
71
|
+
"data-col-key": cell.column.id,
|
|
72
|
+
"data-tooltip-id": `${id}-tooltip-content`,
|
|
73
|
+
"data-tooltip-html": _server.default.renderToStaticMarkup( /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tooltipContent)),
|
|
74
|
+
className: (0, _classnames.default)(`${prefix}-grid-cell`, {
|
|
75
|
+
// [`${prefix}-grid-cell-ellipsis`]: true,
|
|
76
|
+
|
|
77
|
+
[`${prefix}-grid-cell-ellipsis`]: !wrapSettings || !(wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Content')),
|
|
78
|
+
[`${prefix}-grid-cell-text-wrap`]: wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Content'),
|
|
79
|
+
// [`${prefix}-grid-cell-selected`]: isCellSelected,
|
|
80
|
+
|
|
81
|
+
[`${prefix}-grid-cell-fix-left-last`]: isLastLeftPinnedColumn,
|
|
82
|
+
[`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
|
|
83
|
+
[`${prefix}-grid-cell-text-center`]: columnMeta?.textAlign === 'center',
|
|
84
|
+
[`${prefix}-grid-cell-text-right`]: columnMeta?.textAlign === 'right' || columnMeta.type === 'number'
|
|
85
|
+
}),
|
|
86
|
+
style: {
|
|
87
|
+
...cellStyles,
|
|
88
|
+
// display: 'flex',
|
|
89
|
+
width: cell.column.getSize(),
|
|
90
|
+
minWidth: cell.column.getSize(),
|
|
91
|
+
minHeight: 36,
|
|
92
|
+
...(0, _utils.getCommonPinningStyles)(cell.column)
|
|
93
|
+
},
|
|
94
|
+
onMouseEnter: e => {
|
|
95
|
+
if (e.target.firstChild?.clientWidth < e.target.firstChild?.scrollWidth) {
|
|
96
|
+
setIsOpenTooltip(true);
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
onKeyDown: e => {
|
|
100
|
+
const flatRows = table.getRowModel().flatRows;
|
|
101
|
+
if (e.key === 'ArrowDown' && rowNumber < flatRows.length - 1) {
|
|
102
|
+
const nextIndex = cell.row.index + 1;
|
|
103
|
+
// const nextIndex = rowNumber + 1
|
|
104
|
+
|
|
105
|
+
const nextId = flatRows[nextIndex].id;
|
|
106
|
+
setFocusedCell?.({
|
|
107
|
+
colId: cell.column.id,
|
|
108
|
+
rowId: nextId
|
|
109
|
+
});
|
|
110
|
+
const row = document.querySelector(`.ui-rc-grid-row[data-row-key="${nextId}"]`);
|
|
111
|
+
const cellFocus = row?.querySelector('.ui-rc-grid-cell:not(.ui-rc-grid-cell-selection)');
|
|
112
|
+
if (cellFocus) {
|
|
113
|
+
cellFocus.focus();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (e.key === 'ArrowUp' && rowNumber > 0) {
|
|
117
|
+
const prevIndex = cell.row.index - 1;
|
|
118
|
+
const nextId = flatRows[prevIndex].id;
|
|
119
|
+
setFocusedCell?.({
|
|
120
|
+
colId: cell.column.id,
|
|
121
|
+
rowId: nextId
|
|
122
|
+
});
|
|
123
|
+
const row = document.querySelector(`.ui-rc-grid-row[data-row-key="${nextId}"]`);
|
|
124
|
+
const cellFocus = row?.querySelector('.ui-rc-grid-cell:not(.ui-rc-grid-cell-selection)');
|
|
125
|
+
if (cellFocus) {
|
|
126
|
+
cellFocus.focus();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (e.ctrlKey && e.code === 'Space' && cell.row.getCanSelect()) {
|
|
130
|
+
(0, _useColumns.toggleRowSelection)({
|
|
131
|
+
e,
|
|
132
|
+
cell,
|
|
133
|
+
setIsSelectionChange,
|
|
134
|
+
isSelectionChange,
|
|
135
|
+
selectionSettings
|
|
136
|
+
});
|
|
137
|
+
cell.row.getToggleSelectedHandler()(e);
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
onClick: e => {
|
|
141
|
+
const selection = window.getSelection();
|
|
142
|
+
const text = selection ? selection.toString() : "";
|
|
143
|
+
if (text.length > 0 || enableClick === false) {} else {
|
|
144
|
+
if (!selectionSettings || selectionSettings.checkboxOnly !== true) {
|
|
145
|
+
(0, _useColumns.toggleRowSelection)({
|
|
146
|
+
e,
|
|
147
|
+
cell,
|
|
148
|
+
setIsSelectionChange,
|
|
149
|
+
isSelectionChange,
|
|
150
|
+
selectionSettings
|
|
151
|
+
});
|
|
152
|
+
setFocusedCell?.({
|
|
153
|
+
colId: cell.column.id,
|
|
154
|
+
rowId: cell.row.id
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}, cell.column.getIndex() === expandIconColumnIndex && isDataTree ? /*#__PURE__*/_react.default.createElement("div", {
|
|
160
|
+
className: (0, _classnames.default)('ui-rc_cell-content', {})
|
|
161
|
+
}, cell.column.getIndex() === expandIconColumnIndex && isDataTree && /*#__PURE__*/_react.default.createElement("div", {
|
|
162
|
+
className: "ui-rc-table-row-expand-trigger",
|
|
163
|
+
style: {
|
|
164
|
+
paddingLeft: `${cell.row.depth * 25}px`
|
|
165
|
+
}
|
|
166
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, cell.row.getCanExpand() ? /*#__PURE__*/_react.default.createElement("button", {
|
|
167
|
+
// onClick: cell.row.getToggleExpandedHandler(),
|
|
168
|
+
|
|
169
|
+
// onClick: (e) => {
|
|
170
|
+
// e.stopPropagation()
|
|
171
|
+
// cell.row.toggleExpanded()
|
|
172
|
+
// },
|
|
173
|
+
|
|
174
|
+
onClick: e => {
|
|
175
|
+
e.stopPropagation();
|
|
176
|
+
const keys = Object.keys(expanded);
|
|
177
|
+
// @ts-ignore
|
|
178
|
+
const tmp = {
|
|
179
|
+
...expanded
|
|
180
|
+
};
|
|
181
|
+
if (keys.includes(cell.row.id)) {
|
|
182
|
+
delete tmp[cell.row.id];
|
|
183
|
+
setExpanded(tmp);
|
|
184
|
+
} else {
|
|
185
|
+
setExpanded(old => ({
|
|
186
|
+
...old,
|
|
187
|
+
[cell.row.id]: true
|
|
188
|
+
}));
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
style: {
|
|
192
|
+
cursor: "pointer"
|
|
193
|
+
},
|
|
194
|
+
className: "ui-rc-table-row-expand"
|
|
195
|
+
}, cell.row.getIsExpanded() ? /*#__PURE__*/_react.default.createElement("span", {
|
|
196
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-expanded"
|
|
197
|
+
}) : /*#__PURE__*/_react.default.createElement("span", {
|
|
198
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-collapsed"
|
|
199
|
+
})) : /*#__PURE__*/_react.default.createElement("span", {
|
|
200
|
+
className: "ui-rc-table-row-expand-icon ui-rc-table-row-expand-icon-spaced"
|
|
201
|
+
}))), sumValue) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, sumValue));
|
|
202
|
+
};
|
|
203
|
+
var _default = exports.default = TableBodyCellRowGroup;
|
|
@@ -9,5 +9,5 @@ interface TableBodyRowProps<T> {
|
|
|
9
9
|
editAble?: boolean;
|
|
10
10
|
[key: string]: any;
|
|
11
11
|
}
|
|
12
|
-
declare const TableBodyRow: <RecordType extends object>({ tableId, table, row, virtualRow, commandClick, contextMenuItems, onContextMenu, rowheight, ...rest }: TableBodyRowProps<RecordType>) => React.JSX.Element;
|
|
12
|
+
declare const TableBodyRow: <RecordType extends object>({ tableId, table, row, virtualRow, commandClick, contextMenuItems, onContextMenu, rowheight, editAble, isEditing, isRowEditable, ...rest }: TableBodyRowProps<RecordType>) => React.JSX.Element;
|
|
13
13
|
export default TableBodyRow;
|
|
@@ -11,6 +11,11 @@ var _reactTable = require("@tanstack/react-table");
|
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
12
|
var _useContext = require("../useContext");
|
|
13
13
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
|
+
var _utils = require("../hook/utils");
|
|
15
|
+
var _utils2 = require("../../table-component/hook/utils");
|
|
16
|
+
var _hooks = require("../../grid-component/hooks");
|
|
17
|
+
var _reactNumericComponent = require("react-numeric-component");
|
|
18
|
+
var _TableBodyCellRowGroup = _interopRequireDefault(require("./TableBodyCellRowGroup"));
|
|
14
19
|
const TableBodyRow = ({
|
|
15
20
|
tableId,
|
|
16
21
|
table,
|
|
@@ -20,6 +25,9 @@ const TableBodyRow = ({
|
|
|
20
25
|
contextMenuItems,
|
|
21
26
|
onContextMenu,
|
|
22
27
|
rowheight,
|
|
28
|
+
editAble,
|
|
29
|
+
isEditing,
|
|
30
|
+
isRowEditable,
|
|
23
31
|
...rest
|
|
24
32
|
}) => {
|
|
25
33
|
const {
|
|
@@ -28,7 +36,8 @@ const TableBodyRow = ({
|
|
|
28
36
|
focusedCell,
|
|
29
37
|
rowClassName,
|
|
30
38
|
onRowStyles,
|
|
31
|
-
groupSetting
|
|
39
|
+
groupSetting,
|
|
40
|
+
format
|
|
32
41
|
} = _react.default.useContext(_useContext.TableContext);
|
|
33
42
|
const rowClass = typeof rowClassName === 'function' ? rowClassName(row.original, row.index, row.depth) : rowClassName;
|
|
34
43
|
const rowStyles = typeof onRowStyles === 'function' ? onRowStyles(row.original, row) : onRowStyles;
|
|
@@ -38,6 +47,8 @@ const TableBodyRow = ({
|
|
|
38
47
|
key: row.id,
|
|
39
48
|
"data-row-key": row.id
|
|
40
49
|
}, rest, {
|
|
50
|
+
// data-known-size={37}
|
|
51
|
+
|
|
41
52
|
className: (0, _classnames.default)(`${prefix}-grid-row ${rowClass ?? ''}`, {
|
|
42
53
|
[`${prefix}-grid-row-selected`]: row.getIsSelected(),
|
|
43
54
|
[`${prefix}-grid-row-focus`]: row.id === focusedCell?.rowId,
|
|
@@ -118,6 +129,37 @@ const TableBodyRow = ({
|
|
|
118
129
|
groupValue: groupValue
|
|
119
130
|
}));
|
|
120
131
|
}
|
|
132
|
+
if (row.subRows.length > 0 && originCol.sumGroup === true && originCol.type === 'number') {
|
|
133
|
+
const colFormat = typeof originCol.format === 'function' ? originCol.format({}) : originCol.format;
|
|
134
|
+
const cellFormat = (0, _utils.getFormat)(colFormat, format);
|
|
135
|
+
const thousandSeparator = cellFormat?.thousandSeparator;
|
|
136
|
+
const decimalSeparator = cellFormat?.decimalSeparator;
|
|
137
|
+
const dec = cellFormat?.decimalScale;
|
|
138
|
+
const numericFormatProps = {
|
|
139
|
+
thousandSeparator: (0, _utils2.checkThousandSeparator)(thousandSeparator, decimalSeparator),
|
|
140
|
+
decimalSeparator: (0, _utils2.checkDecimalSeparator)(thousandSeparator, decimalSeparator),
|
|
141
|
+
allowNegative: cellFormat?.allowNegative ?? true,
|
|
142
|
+
prefix: cellFormat?.prefix,
|
|
143
|
+
suffix: cellFormat?.suffix,
|
|
144
|
+
decimalScale: dec,
|
|
145
|
+
fixedDecimalScale: cellFormat?.fixedDecimalScale ?? false
|
|
146
|
+
};
|
|
147
|
+
const childrenData = row.subRows.map(it => it.original);
|
|
148
|
+
const sumValue = (0, _hooks.sumByField)(childrenData, cell.column.id);
|
|
149
|
+
const sumValueFormat = (0, _reactNumericComponent.numericFormatter)(sumValue.toString(), numericFormatProps);
|
|
150
|
+
return /*#__PURE__*/_react.default.createElement(_TableBodyCellRowGroup.default, (0, _extends2.default)({
|
|
151
|
+
table: table,
|
|
152
|
+
tableId: tableId,
|
|
153
|
+
key: cell.id,
|
|
154
|
+
cell: cell,
|
|
155
|
+
commandClick: commandClick,
|
|
156
|
+
virtualRow: virtualRow,
|
|
157
|
+
isEditing: false,
|
|
158
|
+
colSpan: onCellColSpan ?? 1,
|
|
159
|
+
rowSpan: onCellRowSpan ?? 1,
|
|
160
|
+
sumValue: sumValueFormat
|
|
161
|
+
}, otherCellAttributes));
|
|
162
|
+
}
|
|
121
163
|
return /*#__PURE__*/_react.default.createElement(_TableBodyCell.default, (0, _extends2.default)({
|
|
122
164
|
table: table,
|
|
123
165
|
tableId: tableId,
|
|
@@ -40,6 +40,7 @@ export declare const getDateRangeFormat: (type: EditType | TypeFilter | IColumnT
|
|
|
40
40
|
export declare const getTypeFilter: (col: any) => TypeFilter;
|
|
41
41
|
export declare const addRowIdArray: (inputArray: any[]) => any[];
|
|
42
42
|
export declare function groupArrayByColumns(arr: any[], columns: string[] | undefined): any;
|
|
43
|
+
export declare function unGroupData(groupedArray: any[], originData: any[]): any[];
|
|
43
44
|
export declare const flatColumns2: <RecordType>(columns: ColumnsTable<RecordType>) => ColumnsTable<RecordType>;
|
|
44
45
|
export declare const checkThousandSeparator: (thousandSeparator: string | undefined, decimalSeparator: string | undefined) => string;
|
|
45
46
|
export declare const checkDecimalSeparator: (thousandSeparator: string | undefined, decimalSeparator: string | undefined) => string;
|
|
@@ -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,
|