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
|
@@ -272,6 +272,35 @@ export function groupArrayByColumns(arr, columns) {
|
|
|
272
272
|
return arr;
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
|
+
export function unGroupData(groupedArray, originData) {
|
|
276
|
+
const result = [];
|
|
277
|
+
function traverse(arr) {
|
|
278
|
+
arr.forEach(item => {
|
|
279
|
+
if (item.children && item.children.length > 0) {
|
|
280
|
+
traverse(item.children);
|
|
281
|
+
} else {
|
|
282
|
+
// Đây là data item, không phải group item
|
|
283
|
+
result.push(item);
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
traverse(groupedArray);
|
|
288
|
+
|
|
289
|
+
// Tạo map từ id đến index trong originData
|
|
290
|
+
const indexMap = new Map();
|
|
291
|
+
originData.forEach((item, index) => {
|
|
292
|
+
const id = item.id ?? item.rowId;
|
|
293
|
+
indexMap.set(id, index);
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
// Sort result theo thứ tự trong originData
|
|
297
|
+
result.sort((a, b) => {
|
|
298
|
+
const aIndex = indexMap.get(a.id ?? a.rowId) ?? -1;
|
|
299
|
+
const bIndex = indexMap.get(b.id ?? b.rowId) ?? -1;
|
|
300
|
+
return aIndex - bIndex;
|
|
301
|
+
});
|
|
302
|
+
return result;
|
|
303
|
+
}
|
|
275
304
|
export const flatColumns2 = columns => {
|
|
276
305
|
return columns.reduce((list, column) => {
|
|
277
306
|
const subColumns = column.children;
|
|
@@ -2,6 +2,8 @@ import styled from "styled-components";
|
|
|
2
2
|
const color = "#000000de";
|
|
3
3
|
const BgColor = "#ffffff";
|
|
4
4
|
const rowSelectedBg = "#FEF2EF";
|
|
5
|
+
const cellSelectedBg = "#F3F8FF";
|
|
6
|
+
const borderSelectedColor = "#0550C5";
|
|
5
7
|
const tableBorderColor = "#e0e0e0";
|
|
6
8
|
const tableBorderColorDark = "#44485E";
|
|
7
9
|
const BgColorDark = "#343e59";
|
|
@@ -9,4 +11,4 @@ const colorDark = "#e6e4f3e6";
|
|
|
9
11
|
export const GridStyle = styled.div.withConfig({
|
|
10
12
|
displayName: "GridStyle",
|
|
11
13
|
componentId: "es-grid-template__sc-rs980s-0"
|
|
12
|
-
})(["&.", "-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
|
|
14
|
+
})(["&.", "-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);
|
|
@@ -173,7 +173,7 @@ const Grid = props => {
|
|
|
173
173
|
t: t,
|
|
174
174
|
windowSize: windowSize,
|
|
175
175
|
table: table,
|
|
176
|
-
editAble:
|
|
176
|
+
editAble: false,
|
|
177
177
|
dataSource: dataSource,
|
|
178
178
|
originData: originData,
|
|
179
179
|
prefix: prefix,
|
|
@@ -243,7 +243,7 @@ const Grid = props => {
|
|
|
243
243
|
id: faker.string.alpha(20),
|
|
244
244
|
t: t,
|
|
245
245
|
table: table,
|
|
246
|
-
editAble:
|
|
246
|
+
editAble: false,
|
|
247
247
|
dataSource: dataSource,
|
|
248
248
|
originData: originData,
|
|
249
249
|
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;
|
|
@@ -24,10 +24,13 @@ const TableWrapper = props => {
|
|
|
24
24
|
table,
|
|
25
25
|
height,
|
|
26
26
|
id,
|
|
27
|
-
commandClick
|
|
27
|
+
commandClick,
|
|
28
|
+
editAble
|
|
28
29
|
} = props;
|
|
29
30
|
const {
|
|
30
|
-
prefix
|
|
31
|
+
prefix,
|
|
32
|
+
editingKey,
|
|
33
|
+
rowEditable
|
|
31
34
|
} = useContext(TableContext); //onRowHeaderStyles
|
|
32
35
|
|
|
33
36
|
// ref cho scroll container
|
|
@@ -74,22 +77,38 @@ const TableWrapper = props => {
|
|
|
74
77
|
TableHead: props => /*#__PURE__*/React.createElement("thead", _extends({}, props, {
|
|
75
78
|
className: `${prefix}-grid-thead`
|
|
76
79
|
})),
|
|
80
|
+
// TableBody: (props) => (
|
|
81
|
+
// <tbody {...props} className={`${prefix}-grid-tbody1`} />
|
|
82
|
+
// ),
|
|
83
|
+
|
|
77
84
|
TableFoot: props => /*#__PURE__*/React.createElement("tfoot", _extends({}, props, {
|
|
78
85
|
className: `${prefix}-grid-tfoot`
|
|
79
86
|
})),
|
|
80
87
|
TableRow: props => {
|
|
88
|
+
const {
|
|
89
|
+
item,
|
|
90
|
+
...rest
|
|
91
|
+
} = props;
|
|
81
92
|
const index = props["data-index"];
|
|
82
93
|
const rowheight = props["data-known-size"];
|
|
83
94
|
const row = rows[index];
|
|
95
|
+
const isEditing = row.id === editingKey;
|
|
96
|
+
const isRowEditable = rowEditable ? rowEditable(row.original) : true;
|
|
84
97
|
return /*#__PURE__*/React.createElement(TableBodyRow, _extends({
|
|
85
98
|
tableId: id,
|
|
86
99
|
row: row,
|
|
87
100
|
table: table,
|
|
88
101
|
commandClick: commandClick,
|
|
89
|
-
rowheight: rowheight
|
|
90
|
-
|
|
102
|
+
rowheight: editAble ? 37 : rowheight,
|
|
103
|
+
isEditing: isEditing,
|
|
104
|
+
isRowEditable: isRowEditable,
|
|
105
|
+
editAble: editAble
|
|
106
|
+
}, rest));
|
|
91
107
|
}
|
|
92
|
-
}
|
|
108
|
+
},
|
|
109
|
+
defaultItemHeight: 37,
|
|
110
|
+
fixedItemHeight: 37,
|
|
111
|
+
itemSize: () => 37
|
|
93
112
|
|
|
94
113
|
// overscan={{
|
|
95
114
|
// 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;
|
|
@@ -18,4 +18,22 @@ export const TableContext = /*#__PURE__*/createContext({
|
|
|
18
18
|
setFilterChange: () => {},
|
|
19
19
|
setExpanded: () => {},
|
|
20
20
|
handleCellClick: () => {}
|
|
21
|
+
|
|
22
|
+
// startCellRef: { current: undefined } as React.MutableRefObject<IPositionCell | undefined>,
|
|
23
|
+
// endCellRef: { current: undefined } as React.MutableRefObject<IPositionCell | undefined>,
|
|
24
|
+
// focusedCellRef: { current: undefined } as React.MutableRefObject<IPositionCell | undefined>,
|
|
25
|
+
// isSelectingRef: { current: false } as React.MutableRefObject<boolean>,
|
|
26
|
+
|
|
27
|
+
// rangeStateRef: {
|
|
28
|
+
// current: {
|
|
29
|
+
// startRowIndex: undefined,
|
|
30
|
+
// endRowIndex: undefined,
|
|
31
|
+
// startColIndex: undefined,
|
|
32
|
+
// endColIndex: undefined,
|
|
33
|
+
// rowIds: [],
|
|
34
|
+
// colIds: [],
|
|
35
|
+
// colRange: [],
|
|
36
|
+
// rowRange: []
|
|
37
|
+
// }
|
|
38
|
+
// } as React.MutableRefObject<RangeState>
|
|
21
39
|
});
|
|
@@ -9,13 +9,14 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _tableComponent = _interopRequireDefault(require("../table-component"));
|
|
11
11
|
var _tableVirtuoso = _interopRequireDefault(require("../table-virtuoso"));
|
|
12
|
+
var _groupComponent = _interopRequireDefault(require("../group-component"));
|
|
12
13
|
const TempTable = props => {
|
|
13
14
|
const {
|
|
14
15
|
groupAble,
|
|
15
16
|
editAble,
|
|
16
17
|
...rest
|
|
17
18
|
} = props;
|
|
18
|
-
const TabComponent = groupAble ? _tableVirtuoso.default : _tableComponent.default;
|
|
19
|
+
const TabComponent = groupAble ? editAble ? _groupComponent.default : _tableVirtuoso.default : _tableComponent.default;
|
|
19
20
|
return /*#__PURE__*/_react.default.createElement(TabComponent, (0, _extends2.default)({}, rest, {
|
|
20
21
|
groupAble: groupAble,
|
|
21
22
|
editAble: editAble
|
|
@@ -290,14 +290,12 @@ export type ExpandableConfig<RecordType> = {
|
|
|
290
290
|
onExpand?: (expanded: boolean, record: RecordType) => void;
|
|
291
291
|
onExpandedRowsChange?: (expandedKeys: readonly Key[]) => void;
|
|
292
292
|
defaultExpandAllRows?: boolean;
|
|
293
|
-
indentSize?: number;
|
|
294
293
|
expandIconColumnIndex?: number;
|
|
294
|
+
showExpandAll?: boolean;
|
|
295
295
|
showExpandColumn?: boolean;
|
|
296
296
|
expandedRowClassName?: string | RowClassName<RecordType>;
|
|
297
297
|
childrenColumnName?: string;
|
|
298
298
|
rowExpandable?: (record: RecordType) => boolean;
|
|
299
|
-
columnWidth?: number | string;
|
|
300
|
-
fixed?: FixedType;
|
|
301
299
|
};
|
|
302
300
|
export type RenderExpandIcon<RecordType> = (props: RenderExpandIconProps<RecordType>) => React.ReactNode;
|
|
303
301
|
export interface RenderExpandIconProps<RecordType> {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ColumnsTable, ColumnTable } from "./../grid-component/type";
|
|
3
|
+
import type { ColumnDef } from "@tanstack/react-table";
|
|
4
|
+
export type IColumnsChoose<RecordType> = {
|
|
5
|
+
columns: ColumnDef<RecordType>[];
|
|
6
|
+
originColumns: ColumnTable[];
|
|
7
|
+
columnsGroup?: string[];
|
|
8
|
+
triggerChangeColumns?: (columns: ColumnsTable<RecordType>, keys: string[], type: string) => void;
|
|
9
|
+
t?: any;
|
|
10
|
+
triggerChangeKeys?: any;
|
|
11
|
+
columnHidden: any;
|
|
12
|
+
};
|
|
13
|
+
export declare const ColumnsChoose: <RecordType extends object>(props: IColumnsChoose<RecordType>) => React.JSX.Element;
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ColumnsChoose = void 0;
|
|
8
|
+
var _useMergedState = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState"));
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
+
var _antd = require("antd");
|
|
12
|
+
var _tree = _interopRequireDefault(require("rc-master-ui/es/tree"));
|
|
13
|
+
var _SearchOutlined = _interopRequireDefault(require("@ant-design/icons/SearchOutlined"));
|
|
14
|
+
var _utils = require("./hook/utils");
|
|
15
|
+
var _becoxyIcons = require("becoxy-icons");
|
|
16
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
+
const BoxAction = _styledComponents.default.div.withConfig({
|
|
19
|
+
displayName: "BoxAction",
|
|
20
|
+
componentId: "es-grid-template__sc-74bu9v-0"
|
|
21
|
+
})(["border-top:1px solid #c4c4c4;padding-top:.75rem;display:flex;justify-content:end;gap:10px;.btn-action{background:none !important;border:none !important;&.btn-action-submit{color:#df4318;&:disabled{background-color:#f0f0f0 !important;}&:hover{color:#df4318 !important;}}&:hover{background-color:#f0f0f0 !important;}}"]);
|
|
22
|
+
const ColumnsChoose = props => {
|
|
23
|
+
const {
|
|
24
|
+
columns: propsColumns,
|
|
25
|
+
originColumns,
|
|
26
|
+
columnHidden,
|
|
27
|
+
triggerChangeColumns,
|
|
28
|
+
// triggerChangeKeys,
|
|
29
|
+
t,
|
|
30
|
+
columnsGroup
|
|
31
|
+
} = props;
|
|
32
|
+
const treeColumns = _react.default.useMemo(() => {
|
|
33
|
+
return (0, _utils.convertColumnsToTreeData)(propsColumns, columnsGroup);
|
|
34
|
+
}, [propsColumns, columnsGroup]);
|
|
35
|
+
const defaultSelectedKeys = _react.default.useMemo(() => {
|
|
36
|
+
const defaultColumns = originColumns.filter(it => it.field && it.showInColumnChoose !== false && !columnsGroup?.includes(it.field));
|
|
37
|
+
const aa = Object.keys(columnHidden);
|
|
38
|
+
return (0, _utils.getVisibleColumnKeys1)(defaultColumns).filter(it => !aa.includes(it));
|
|
39
|
+
}, [columnHidden, columnsGroup, originColumns]);
|
|
40
|
+
const [mergedSelectedKeys, setMergedSelectedKeys] = (0, _useMergedState.default)(defaultSelectedKeys && defaultSelectedKeys.length ? defaultSelectedKeys : undefined, {
|
|
41
|
+
value: undefined
|
|
42
|
+
});
|
|
43
|
+
const [clicked, setClicked] = (0, _react.useState)(false);
|
|
44
|
+
const [autoExpandParent, setAutoExpandParent] = (0, _react.useState)(true);
|
|
45
|
+
|
|
46
|
+
// const treeData = useMemo(() => {
|
|
47
|
+
// const loop = (data: TreeDataNode[]): TreeDataNode[] =>
|
|
48
|
+
// data.map((item) => {
|
|
49
|
+
// const strTitle = item.title as string;
|
|
50
|
+
// const index = strTitle.indexOf(searchValue);
|
|
51
|
+
// const beforeStr = strTitle.substring(0, index);
|
|
52
|
+
// const afterStr = strTitle.slice(index + searchValue.length);
|
|
53
|
+
// const title =
|
|
54
|
+
// index > -1 ? (
|
|
55
|
+
// <span key={item.key}>
|
|
56
|
+
// {beforeStr}
|
|
57
|
+
// <span className="site-tree-search-value">{searchValue}</span>
|
|
58
|
+
// {afterStr}
|
|
59
|
+
// </span>
|
|
60
|
+
// ) : (
|
|
61
|
+
// <span key={item.key}>{strTitle}</span>
|
|
62
|
+
// );
|
|
63
|
+
// if (item.children) {
|
|
64
|
+
// return { title, key: item.key, children: loop(item.children) };
|
|
65
|
+
// }
|
|
66
|
+
//
|
|
67
|
+
// return {
|
|
68
|
+
// title,
|
|
69
|
+
// key: item.key,
|
|
70
|
+
// };
|
|
71
|
+
// });
|
|
72
|
+
//
|
|
73
|
+
// // return loop(defaultData);
|
|
74
|
+
// return loop(columns as any);
|
|
75
|
+
// }, [searchValue, columns]);
|
|
76
|
+
|
|
77
|
+
const hide = () => {
|
|
78
|
+
setClicked(false);
|
|
79
|
+
};
|
|
80
|
+
const handleClickChange = open => {
|
|
81
|
+
setClicked(open);
|
|
82
|
+
};
|
|
83
|
+
const onExpand = () => {
|
|
84
|
+
// setExpandedKeys(newExpandedKeys)
|
|
85
|
+
setAutoExpandParent(false);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// const getParentKey = (key: React.Key, tree: TreeDataNode[]): React.Key => {
|
|
89
|
+
// let parentKey: React.Key
|
|
90
|
+
// for (let i = 0; i < tree.length; i++) {
|
|
91
|
+
// const node = tree[i]
|
|
92
|
+
// if (node.children) {
|
|
93
|
+
// if (node.children.some((item) => item.key === key)) {
|
|
94
|
+
// parentKey = node.key
|
|
95
|
+
// } else if (getParentKey(key, node.children)) {
|
|
96
|
+
// parentKey = getParentKey(key, node.children)
|
|
97
|
+
// }
|
|
98
|
+
// }
|
|
99
|
+
// }
|
|
100
|
+
// return parentKey!
|
|
101
|
+
// }
|
|
102
|
+
|
|
103
|
+
// const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
104
|
+
const onChange = () => {
|
|
105
|
+
// const { value } = e.target
|
|
106
|
+
// const newExpandedKeys = dataList
|
|
107
|
+
// .map((item) => {
|
|
108
|
+
// if (item.title.indexOf(value) > -1) {
|
|
109
|
+
// return getParentKey(item.key, defaultData)
|
|
110
|
+
// }
|
|
111
|
+
// return null
|
|
112
|
+
// })
|
|
113
|
+
// .filter((item, i, self): item is React.Key => !!(item && self.indexOf(item) === i))
|
|
114
|
+
// setExpandedKeys(newExpandedKeys)
|
|
115
|
+
|
|
116
|
+
// setSearchValue(value)
|
|
117
|
+
setAutoExpandParent(true);
|
|
118
|
+
};
|
|
119
|
+
const onCheck = keys => {
|
|
120
|
+
// setSelectedKeys(keys)
|
|
121
|
+
// setIsManualUpdate(true)
|
|
122
|
+
setMergedSelectedKeys(keys);
|
|
123
|
+
};
|
|
124
|
+
const handleAccept = () => {
|
|
125
|
+
const rs1 = (0, _utils.updateColumns1)(originColumns, mergedSelectedKeys ?? []);
|
|
126
|
+
triggerChangeColumns?.(rs1, mergedSelectedKeys ?? [], 'columnChoose');
|
|
127
|
+
hide();
|
|
128
|
+
};
|
|
129
|
+
const handleCancel = () => {
|
|
130
|
+
setMergedSelectedKeys(defaultSelectedKeys);
|
|
131
|
+
hide();
|
|
132
|
+
};
|
|
133
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_antd.Popover, {
|
|
134
|
+
placement: 'bottomLeft',
|
|
135
|
+
content: /*#__PURE__*/_react.default.createElement("div", {
|
|
136
|
+
style: {
|
|
137
|
+
minWidth: 250,
|
|
138
|
+
maxWidth: 320
|
|
139
|
+
}
|
|
140
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Input, {
|
|
141
|
+
style: {
|
|
142
|
+
marginBottom: 8
|
|
143
|
+
},
|
|
144
|
+
placeholder: t ? t("Search") : 'Search',
|
|
145
|
+
prefix: /*#__PURE__*/_react.default.createElement(_SearchOutlined.default, null),
|
|
146
|
+
onChange: onChange
|
|
147
|
+
}), /*#__PURE__*/_react.default.createElement(_tree.default, {
|
|
148
|
+
onExpand: onExpand
|
|
149
|
+
// expandedKeys={expandedKeys}
|
|
150
|
+
,
|
|
151
|
+
autoExpandParent: autoExpandParent
|
|
152
|
+
// treeData={treeData}
|
|
153
|
+
// treeData={columns.filter((it) => !columnsGroup?.includes(it.field as string))}
|
|
154
|
+
,
|
|
155
|
+
treeData: treeColumns,
|
|
156
|
+
defaultExpandAll: true,
|
|
157
|
+
checkable: true
|
|
158
|
+
// onSelect={(keys, info) => {
|
|
159
|
+
// const key = info.node.key
|
|
160
|
+
//
|
|
161
|
+
// const find = findItemByKey(columns, 'key', key)
|
|
162
|
+
//
|
|
163
|
+
// // const tmpColumn
|
|
164
|
+
//
|
|
165
|
+
// // if (selectedKeys.includes(key as string)) {
|
|
166
|
+
// // const rssss = findKeyPath(columns, key as string)
|
|
167
|
+
// // const rs = selectedKeys.filter(item => !rssss.includes(item));
|
|
168
|
+
// //
|
|
169
|
+
// // setSelectedKeys(rs)
|
|
170
|
+
// // } else {
|
|
171
|
+
//
|
|
172
|
+
// // const rs = [...selectedKeys, keys[0]]
|
|
173
|
+
//
|
|
174
|
+
// // setSelectedKeys(keys)
|
|
175
|
+
// // }
|
|
176
|
+
// }}
|
|
177
|
+
,
|
|
178
|
+
onCheck: keys => onCheck(keys),
|
|
179
|
+
multiple: true
|
|
180
|
+
// checkedKeys={selectedKeys}
|
|
181
|
+
,
|
|
182
|
+
checkedKeys: mergedSelectedKeys || defaultSelectedKeys
|
|
183
|
+
|
|
184
|
+
// defaultCheckedKeys={selectedKeys}
|
|
185
|
+
,
|
|
186
|
+
defaultCheckedKeys: defaultSelectedKeys,
|
|
187
|
+
selectedKeys: []
|
|
188
|
+
|
|
189
|
+
// height={window.innerHeight - 200}
|
|
190
|
+
,
|
|
191
|
+
height: window.innerHeight / 2 > 450 ? 450 : window.innerHeight / 2 - 110
|
|
192
|
+
// style={{height: 300}}
|
|
193
|
+
}), /*#__PURE__*/_react.default.createElement(BoxAction, {
|
|
194
|
+
className: 'px-1'
|
|
195
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Button
|
|
196
|
+
// className={classnames('btn-action btn-action-submit', {
|
|
197
|
+
// // disable: !columns.find((item) => item.visible !== false || item.visible)
|
|
198
|
+
// })}
|
|
199
|
+
, {
|
|
200
|
+
onClick: handleAccept
|
|
201
|
+
// disabled={!columns.find((item) => item.visible !== false || item.visible)}
|
|
202
|
+
}, t ? t('OK') : 'OK'), /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
203
|
+
className: 'btn-action btn-action-cancel',
|
|
204
|
+
onClick: handleCancel
|
|
205
|
+
}, t ? t('Cancel') : 'Cancel'))),
|
|
206
|
+
trigger: "click",
|
|
207
|
+
open: clicked,
|
|
208
|
+
onOpenChange: handleClickChange,
|
|
209
|
+
arrow: false,
|
|
210
|
+
zIndex: 1065
|
|
211
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Tooltip, {
|
|
212
|
+
arrow: false,
|
|
213
|
+
title: 'Cài đặt'
|
|
214
|
+
}, /*#__PURE__*/_react.default.createElement(_becoxyIcons.Settings, {
|
|
215
|
+
fontSize: 16,
|
|
216
|
+
style: {
|
|
217
|
+
cursor: 'pointer'
|
|
218
|
+
}
|
|
219
|
+
}))));
|
|
220
|
+
};
|
|
221
|
+
exports.ColumnsChoose = ColumnsChoose;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type IColumnsGroup = {
|
|
3
|
+
columns: any[];
|
|
4
|
+
dataSource?: string[];
|
|
5
|
+
onSubmit: (value: any) => void;
|
|
6
|
+
t?: any;
|
|
7
|
+
columnsGrouped?: string[];
|
|
8
|
+
unClearableLevel?: number;
|
|
9
|
+
defaultGroupColumns?: string[];
|
|
10
|
+
};
|
|
11
|
+
export declare const ColumnsGroup: (props: IColumnsGroup) => React.JSX.Element;
|
|
12
|
+
export {};
|