es-grid-template 1.8.87 → 1.8.89
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/ali-table/Grid.d.ts +21 -0
- package/es/ali-table/Grid.js +333 -0
- package/es/ali-table/InternalTable.d.ts +5 -0
- package/es/ali-table/InternalTable.js +284 -0
- package/es/ali-table/assets/WebsiteBaseTable.d.ts +4 -0
- package/es/ali-table/assets/WebsiteBaseTable.js +18 -0
- package/es/ali-table/base-table/ColumnResizer.js +133 -0
- package/es/ali-table/base-table/calculations.d.ts +3 -0
- package/es/ali-table/base-table/calculations.js +274 -0
- package/es/ali-table/base-table/colgroup.d.ts +5 -0
- package/es/ali-table/base-table/colgroup.js +21 -0
- package/es/ali-table/base-table/empty.d.ts +12 -0
- package/es/ali-table/base-table/empty.js +36 -0
- package/es/ali-table/base-table/header.d.ts +5 -0
- package/es/ali-table/base-table/header.js +255 -0
- package/es/ali-table/base-table/helpers/SpanManager.d.ts +14 -0
- package/es/ali-table/base-table/helpers/SpanManager.js +30 -0
- package/es/ali-table/base-table/helpers/TableDOMUtils.d.ts +16 -0
- package/es/ali-table/base-table/helpers/TableDOMUtils.js +93 -0
- package/es/ali-table/base-table/helpers/getRichVisibleRectsStream.d.ts +23 -0
- package/es/ali-table/base-table/helpers/getRichVisibleRectsStream.js +185 -0
- package/es/ali-table/base-table/helpers/rowHeightManager.d.ts +7 -0
- package/es/ali-table/base-table/helpers/rowHeightManager.js +137 -0
- package/es/ali-table/base-table/html-table.d.ts +20 -0
- package/es/ali-table/base-table/html-table.js +224 -0
- package/es/ali-table/base-table/interfaces.d.ts +54 -0
- package/es/ali-table/base-table/interfaces.js +1 -0
- package/es/ali-table/base-table/loading.d.ts +14 -0
- package/es/ali-table/base-table/loading.js +29 -0
- package/es/ali-table/base-table/renderFilter.d.ts +21 -0
- package/es/ali-table/base-table/renderFilter.js +306 -0
- package/es/ali-table/base-table/styles.d.ts +82 -0
- package/es/ali-table/base-table/styles.js +51 -0
- package/es/ali-table/base-table/styles.scss +19 -0
- package/es/ali-table/base-table/table.d.ts +181 -0
- package/es/ali-table/base-table/table.js +521 -0
- package/es/ali-table/base-table/utils.d.ts +24 -0
- package/es/ali-table/base-table/utils.js +157 -0
- package/es/ali-table/common-views.d.ts +25 -0
- package/es/ali-table/common-views.js +65 -0
- package/es/ali-table/index.d.ts +2 -0
- package/es/ali-table/index.js +2 -0
- package/es/ali-table/interfaces.d.ts +97 -0
- package/es/ali-table/interfaces.js +1 -0
- package/es/ali-table/internals.d.ts +17 -0
- package/es/ali-table/internals.js +76 -0
- package/es/ali-table/pipeline/features/ColumnsChoose.d.ts +14 -0
- package/es/ali-table/pipeline/features/ColumnsChoose.js +185 -0
- package/es/ali-table/pipeline/features/autoRowSpan.d.ts +2 -0
- package/es/ali-table/pipeline/features/autoRowSpan.js +59 -0
- package/es/ali-table/pipeline/features/buildTree.d.ts +2 -0
- package/es/ali-table/pipeline/features/buildTree.js +4 -0
- package/es/ali-table/pipeline/features/columnCustom.d.ts +51 -0
- package/es/ali-table/pipeline/features/columnCustom.js +609 -0
- package/es/ali-table/pipeline/features/columnHover.d.ts +12 -0
- package/es/ali-table/pipeline/features/columnHover.js +43 -0
- package/es/ali-table/pipeline/features/columnRangeHover.d.ts +15 -0
- package/es/ali-table/pipeline/features/columnRangeHover.js +75 -0
- package/es/ali-table/pipeline/features/hiddenColumns.d.ts +6 -0
- package/es/ali-table/pipeline/features/hiddenColumns.js +19 -0
- package/es/ali-table/pipeline/features/index.d.ts +25 -0
- package/es/ali-table/pipeline/features/index.js +14 -0
- package/es/ali-table/pipeline/features/multiSelect.d.ts +27 -0
- package/es/ali-table/pipeline/features/multiSelect.js +161 -0
- package/es/ali-table/pipeline/features/pagination.d.ts +6 -0
- package/es/ali-table/pipeline/features/pagination.js +33 -0
- package/es/ali-table/pipeline/features/rowDetail.d.ts +28 -0
- package/es/ali-table/pipeline/features/rowDetail.js +160 -0
- package/es/ali-table/pipeline/features/rowGrouping.d.ts +14 -0
- package/es/ali-table/pipeline/features/rowGrouping.js +149 -0
- package/es/ali-table/pipeline/features/singleSelect.d.ts +23 -0
- package/es/ali-table/pipeline/features/singleSelect.js +106 -0
- package/es/ali-table/pipeline/features/tips.d.ts +2 -0
- package/es/ali-table/pipeline/features/tips.js +48 -0
- package/es/ali-table/pipeline/features/treeMode.d.ts +20 -0
- package/es/ali-table/pipeline/features/treeMode.js +187 -0
- package/es/ali-table/pipeline/features/treeSelect.d.ts +40 -0
- package/es/ali-table/pipeline/features/treeSelect.js +298 -0
- package/es/ali-table/pipeline/index.d.ts +3 -0
- package/es/ali-table/pipeline/index.js +3 -0
- package/es/ali-table/pipeline/pipeline.d.ts +78 -0
- package/es/ali-table/pipeline/pipeline.js +177 -0
- package/es/ali-table/useContext.d.ts +43 -0
- package/es/ali-table/useContext.js +13 -0
- package/es/ali-table/utils/applyTransforms.d.ts +6 -0
- package/es/ali-table/utils/applyTransforms.js +7 -0
- package/es/ali-table/utils/buildTree.d.ts +37 -0
- package/es/ali-table/utils/buildTree.js +71 -0
- package/es/ali-table/utils/collectNodes.d.ts +9 -0
- package/es/ali-table/utils/collectNodes.js +34 -0
- package/es/ali-table/utils/convertColumnsChoose.d.ts +5 -0
- package/es/ali-table/utils/convertColumnsChoose.js +97 -0
- package/es/ali-table/utils/exportTableAsExcel.d.ts +4 -0
- package/es/ali-table/utils/exportTableAsExcel.js +132 -0
- package/es/ali-table/utils/getTreeDepth.d.ts +3 -0
- package/es/ali-table/utils/getTreeDepth.js +17 -0
- package/es/ali-table/utils/groupBy.d.ts +1 -0
- package/es/ali-table/utils/groupBy.js +11 -0
- package/es/ali-table/utils/groupBy2.d.ts +1 -0
- package/es/ali-table/utils/groupBy2.js +12 -0
- package/es/ali-table/utils/index.d.ts +14 -0
- package/es/ali-table/utils/index.js +14 -0
- package/es/ali-table/utils/isLeafNode.d.ts +2 -0
- package/es/ali-table/utils/isLeafNode.js +3 -0
- package/es/ali-table/utils/layeredSort.d.ts +6 -0
- package/es/ali-table/utils/layeredSort.js +22 -0
- package/es/ali-table/utils/makeRecursiveMapper.d.ts +9 -0
- package/es/ali-table/utils/makeRecursiveMapper.js +46 -0
- package/es/ali-table/utils/mergeCellProps.d.ts +9 -0
- package/es/ali-table/utils/mergeCellProps.js +53 -0
- package/es/ali-table/utils/others.d.ts +11 -0
- package/es/ali-table/utils/others.js +27 -0
- package/es/ali-table/utils/proto.d.ts +21 -0
- package/es/ali-table/utils/proto.js +67 -0
- package/es/ali-table/utils/selected.d.ts +40 -0
- package/es/ali-table/utils/selected.js +1038 -0
- package/es/ali-table/utils/smartCompare.d.ts +9 -0
- package/es/ali-table/utils/smartCompare.js +45 -0
- package/es/ali-table/utils/traverseColumn.d.ts +11 -0
- package/es/ali-table/utils/traverseColumn.js +61 -0
- package/es/ali-table/utils/tree-data-helpers/StrictTreeDataHelper.d.ts +22 -0
- package/es/ali-table/utils/tree-data-helpers/StrictTreeDataHelper.js +97 -0
- package/es/ali-table/utils/tree-data-helpers/TreeDataHelper.d.ts +25 -0
- package/es/ali-table/utils/tree-data-helpers/TreeDataHelper.js +217 -0
- package/es/grid-component/hooks/constant.d.ts +1 -0
- package/es/grid-component/hooks/constant.js +2 -1
- package/es/grid-component/hooks/utils.d.ts +1 -1
- package/es/grid-component/type.d.ts +72 -43
- package/es/group-component/ColumnsChoose.d.ts +1 -0
- package/es/group-component/ColumnsChoose.js +6 -6
- package/es/group-component/TableContainerEdit.js +3 -2
- package/es/group-component/body/EditableCell.js +0 -2
- package/es/group-component/body/TableBodyCell.js +13 -13
- package/es/group-component/body/TableBodyCellEdit.js +14 -6
- package/es/group-component/body/TableBodyCellEmpty.js +0 -2
- package/es/group-component/body/TableBodyRowGroupCell.js +13 -13
- package/es/group-component/header/TableHead.js +0 -1
- package/es/group-component/header/TableHeadCell.js +4 -6
- package/es/group-component/header/TableHeadCell2.js +4 -6
- package/es/group-component/header/TableHeadGroupCell.js +6 -7
- package/es/group-component/hook/utils.d.ts +12 -10
- package/es/group-component/style.js +0 -1
- package/es/group-component/table/TableWrapper.js +8 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/table-component/body/TableBodyCell.js +32 -15
- package/es/table-component/body/TableBodyCellEdit.js +14 -8
- package/es/table-component/header/TableHead.js +0 -33
- package/es/table-component/header/TableHeadCell.js +4 -6
- package/es/table-component/header/TableHeadCell2.js +10 -9
- package/es/table-component/header/TableHeadGroupCell.js +5 -6
- package/es/table-component/hook/utils.d.ts +5 -3
- package/es/table-component/hook/utils.js +61 -1
- package/es/table-component/table/Grid.js +1 -1
- package/es/table-component/table/TableWrapper.js +8 -2
- package/es/table-virtuoso/ColumnsGroup/ColumnsGroup.d.ts +1 -0
- package/es/table-virtuoso/ColumnsGroup/ColumnsGroup.js +7 -7
- package/es/table-virtuoso/body/TableBodyCell.js +15 -9
- package/es/table-virtuoso/body/TableBodyCellRowGroup.js +2 -5
- package/es/table-virtuoso/header/TableHeadCell.js +4 -6
- package/es/table-virtuoso/hook/utils.d.ts +1 -1
- package/es/table-virtuoso/table/TableContainer.js +2 -1
- package/es/table-virtuoso/table/TableWrapper.js +8 -2
- package/lib/ali-table/Grid.d.ts +21 -0
- package/lib/ali-table/Grid.js +342 -0
- package/lib/ali-table/InternalTable.d.ts +5 -0
- package/lib/ali-table/InternalTable.js +293 -0
- package/lib/ali-table/assets/WebsiteBaseTable.d.ts +4 -0
- package/lib/ali-table/assets/WebsiteBaseTable.js +25 -0
- package/lib/ali-table/base-table/ColumnResizer.js +140 -0
- package/lib/ali-table/base-table/calculations.d.ts +3 -0
- package/lib/ali-table/base-table/calculations.js +280 -0
- package/lib/ali-table/base-table/colgroup.d.ts +5 -0
- package/lib/ali-table/base-table/colgroup.js +28 -0
- package/lib/ali-table/base-table/empty.d.ts +12 -0
- package/lib/ali-table/base-table/empty.js +43 -0
- package/lib/ali-table/base-table/header.d.ts +5 -0
- package/lib/ali-table/base-table/header.js +262 -0
- package/lib/ali-table/base-table/helpers/SpanManager.d.ts +14 -0
- package/lib/ali-table/base-table/helpers/SpanManager.js +37 -0
- package/lib/ali-table/base-table/helpers/TableDOMUtils.d.ts +16 -0
- package/lib/ali-table/base-table/helpers/TableDOMUtils.js +99 -0
- package/lib/ali-table/base-table/helpers/getRichVisibleRectsStream.d.ts +23 -0
- package/lib/ali-table/base-table/helpers/getRichVisibleRectsStream.js +194 -0
- package/lib/ali-table/base-table/helpers/rowHeightManager.d.ts +7 -0
- package/lib/ali-table/base-table/helpers/rowHeightManager.js +144 -0
- package/lib/ali-table/base-table/html-table.d.ts +20 -0
- package/lib/ali-table/base-table/html-table.js +231 -0
- package/lib/ali-table/base-table/interfaces.d.ts +54 -0
- package/lib/ali-table/base-table/interfaces.js +5 -0
- package/lib/ali-table/base-table/loading.d.ts +14 -0
- package/lib/ali-table/base-table/loading.js +36 -0
- package/lib/ali-table/base-table/renderFilter.d.ts +21 -0
- package/lib/ali-table/base-table/renderFilter.js +316 -0
- package/lib/ali-table/base-table/styles.d.ts +82 -0
- package/lib/ali-table/base-table/styles.js +59 -0
- package/lib/ali-table/base-table/styles.scss +19 -0
- package/lib/ali-table/base-table/table.d.ts +181 -0
- package/lib/ali-table/base-table/table.js +531 -0
- package/lib/ali-table/base-table/utils.d.ts +24 -0
- package/lib/ali-table/base-table/utils.js +170 -0
- package/lib/ali-table/common-views.d.ts +25 -0
- package/lib/ali-table/common-views.js +72 -0
- package/lib/ali-table/index.d.ts +2 -0
- package/lib/ali-table/index.js +9 -0
- package/lib/ali-table/interfaces.d.ts +97 -0
- package/lib/ali-table/interfaces.js +5 -0
- package/lib/ali-table/internals.d.ts +17 -0
- package/lib/ali-table/internals.js +82 -0
- package/lib/ali-table/pipeline/features/ColumnsChoose.d.ts +14 -0
- package/lib/ali-table/pipeline/features/ColumnsChoose.js +195 -0
- package/lib/ali-table/pipeline/features/autoRowSpan.d.ts +2 -0
- package/lib/ali-table/pipeline/features/autoRowSpan.js +65 -0
- package/lib/ali-table/pipeline/features/buildTree.d.ts +2 -0
- package/lib/ali-table/pipeline/features/buildTree.js +10 -0
- package/lib/ali-table/pipeline/features/columnCustom.d.ts +51 -0
- package/lib/ali-table/pipeline/features/columnCustom.js +616 -0
- package/lib/ali-table/pipeline/features/columnHover.d.ts +12 -0
- package/lib/ali-table/pipeline/features/columnHover.js +49 -0
- package/lib/ali-table/pipeline/features/columnRangeHover.d.ts +15 -0
- package/lib/ali-table/pipeline/features/columnRangeHover.js +81 -0
- package/lib/ali-table/pipeline/features/hiddenColumns.d.ts +6 -0
- package/lib/ali-table/pipeline/features/hiddenColumns.js +25 -0
- package/lib/ali-table/pipeline/features/index.d.ts +25 -0
- package/lib/ali-table/pipeline/features/index.js +109 -0
- package/lib/ali-table/pipeline/features/multiSelect.d.ts +27 -0
- package/lib/ali-table/pipeline/features/multiSelect.js +168 -0
- package/lib/ali-table/pipeline/features/pagination.d.ts +6 -0
- package/lib/ali-table/pipeline/features/pagination.js +39 -0
- package/lib/ali-table/pipeline/features/rowDetail.d.ts +28 -0
- package/lib/ali-table/pipeline/features/rowDetail.js +167 -0
- package/lib/ali-table/pipeline/features/rowGrouping.d.ts +14 -0
- package/lib/ali-table/pipeline/features/rowGrouping.js +156 -0
- package/lib/ali-table/pipeline/features/singleSelect.d.ts +23 -0
- package/lib/ali-table/pipeline/features/singleSelect.js +113 -0
- package/lib/ali-table/pipeline/features/tips.d.ts +2 -0
- package/lib/ali-table/pipeline/features/tips.js +55 -0
- package/lib/ali-table/pipeline/features/treeMode.d.ts +20 -0
- package/lib/ali-table/pipeline/features/treeMode.js +195 -0
- package/lib/ali-table/pipeline/features/treeSelect.d.ts +40 -0
- package/lib/ali-table/pipeline/features/treeSelect.js +297 -0
- package/lib/ali-table/pipeline/index.d.ts +3 -0
- package/lib/ali-table/pipeline/index.js +23 -0
- package/lib/ali-table/pipeline/pipeline.d.ts +78 -0
- package/lib/ali-table/pipeline/pipeline.js +185 -0
- package/lib/ali-table/useContext.d.ts +43 -0
- package/lib/ali-table/useContext.js +19 -0
- package/lib/ali-table/utils/applyTransforms.d.ts +6 -0
- package/lib/ali-table/utils/applyTransforms.js +13 -0
- package/lib/ali-table/utils/buildTree.d.ts +37 -0
- package/lib/ali-table/utils/buildTree.js +77 -0
- package/lib/ali-table/utils/collectNodes.d.ts +9 -0
- package/lib/ali-table/utils/collectNodes.js +40 -0
- package/lib/ali-table/utils/convertColumnsChoose.d.ts +5 -0
- package/lib/ali-table/utils/convertColumnsChoose.js +105 -0
- package/lib/ali-table/utils/exportTableAsExcel.d.ts +4 -0
- package/lib/ali-table/utils/exportTableAsExcel.js +139 -0
- package/lib/ali-table/utils/getTreeDepth.d.ts +3 -0
- package/lib/ali-table/utils/getTreeDepth.js +23 -0
- package/lib/ali-table/utils/groupBy.d.ts +1 -0
- package/lib/ali-table/utils/groupBy.js +17 -0
- package/lib/ali-table/utils/groupBy2.d.ts +1 -0
- package/lib/ali-table/utils/groupBy2.js +18 -0
- package/lib/ali-table/utils/index.d.ts +14 -0
- package/lib/ali-table/utils/index.js +104 -0
- package/lib/ali-table/utils/isLeafNode.d.ts +2 -0
- package/lib/ali-table/utils/isLeafNode.js +9 -0
- package/lib/ali-table/utils/layeredSort.d.ts +6 -0
- package/lib/ali-table/utils/layeredSort.js +29 -0
- package/lib/ali-table/utils/makeRecursiveMapper.d.ts +9 -0
- package/lib/ali-table/utils/makeRecursiveMapper.js +53 -0
- package/lib/ali-table/utils/mergeCellProps.d.ts +9 -0
- package/lib/ali-table/utils/mergeCellProps.js +60 -0
- package/lib/ali-table/utils/others.d.ts +11 -0
- package/lib/ali-table/utils/others.js +36 -0
- package/lib/ali-table/utils/proto.d.ts +21 -0
- package/lib/ali-table/utils/proto.js +73 -0
- package/lib/ali-table/utils/selected.d.ts +40 -0
- package/lib/ali-table/utils/selected.js +1070 -0
- package/lib/ali-table/utils/smartCompare.d.ts +9 -0
- package/lib/ali-table/utils/smartCompare.js +51 -0
- package/lib/ali-table/utils/traverseColumn.d.ts +11 -0
- package/lib/ali-table/utils/traverseColumn.js +68 -0
- package/lib/ali-table/utils/tree-data-helpers/StrictTreeDataHelper.d.ts +22 -0
- package/lib/ali-table/utils/tree-data-helpers/StrictTreeDataHelper.js +105 -0
- package/lib/ali-table/utils/tree-data-helpers/TreeDataHelper.d.ts +25 -0
- package/lib/ali-table/utils/tree-data-helpers/TreeDataHelper.js +225 -0
- package/lib/grid-component/hooks/constant.d.ts +1 -0
- package/lib/grid-component/hooks/constant.js +3 -2
- package/lib/grid-component/hooks/utils.d.ts +1 -1
- package/lib/grid-component/type.d.ts +72 -43
- package/lib/group-component/ColumnsChoose.d.ts +1 -0
- package/lib/group-component/ColumnsChoose.js +5 -5
- package/lib/group-component/TableContainerEdit.js +11 -10
- package/lib/group-component/body/EditableCell.js +0 -2
- package/lib/group-component/body/TableBodyCell.js +13 -13
- package/lib/group-component/body/TableBodyCellEdit.js +14 -6
- package/lib/group-component/body/TableBodyCellEmpty.js +0 -2
- package/lib/group-component/body/TableBodyRowGroupCell.js +13 -13
- package/lib/group-component/header/TableHead.js +0 -1
- package/lib/group-component/header/TableHeadCell.js +4 -6
- package/lib/group-component/header/TableHeadCell2.js +4 -6
- package/lib/group-component/header/TableHeadGroupCell.js +6 -7
- package/lib/group-component/hook/utils.d.ts +4 -2
- package/lib/group-component/style.js +0 -1
- package/lib/group-component/table/TableWrapper.js +8 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -2
- package/lib/table-component/body/TableBodyCell.js +31 -14
- package/lib/table-component/body/TableBodyCellEdit.js +13 -7
- package/lib/table-component/header/TableHead.js +0 -33
- package/lib/table-component/header/TableHeadCell.js +4 -6
- package/lib/table-component/header/TableHeadCell2.js +10 -9
- package/lib/table-component/header/TableHeadGroupCell.js +5 -6
- package/lib/table-component/hook/utils.d.ts +5 -3
- package/lib/table-component/hook/utils.js +62 -1
- package/lib/table-component/table/Grid.js +1 -1
- package/lib/table-component/table/TableWrapper.js +8 -2
- package/lib/table-virtuoso/ColumnsGroup/ColumnsGroup.d.ts +1 -0
- package/lib/table-virtuoso/ColumnsGroup/ColumnsGroup.js +6 -6
- package/lib/table-virtuoso/body/TableBodyCell.js +14 -8
- package/lib/table-virtuoso/body/TableBodyCellRowGroup.js +2 -5
- package/lib/table-virtuoso/header/TableHeadCell.js +4 -6
- package/lib/table-virtuoso/hook/utils.d.ts +1 -1
- package/lib/table-virtuoso/table/TableContainer.js +2 -1
- package/lib/table-virtuoso/table/TableWrapper.js +8 -2
- package/package.json +4 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TablePipeline } from "./pipeline";
|
|
2
|
+
import type { Dispatch, SetStateAction } from "react";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import './base-table/styles.scss';
|
|
5
|
+
import type { TableProps } from "../table-component";
|
|
6
|
+
import type { BaseTable } from "./base-table/table";
|
|
7
|
+
import type { VirtualEnum } from "./base-table/interfaces";
|
|
8
|
+
declare const Grid: React.ForwardRefExoticComponent<Omit<TableProps, "useVirtual"> & {
|
|
9
|
+
isFullScreen: boolean;
|
|
10
|
+
setIsFullScreen: Dispatch<SetStateAction<boolean>>;
|
|
11
|
+
pipeline: TablePipeline;
|
|
12
|
+
originData: any[];
|
|
13
|
+
originColumns: any[];
|
|
14
|
+
setVisibleKeys: Dispatch<SetStateAction<any>>;
|
|
15
|
+
useVirtual?: VirtualEnum | {
|
|
16
|
+
horizontal?: VirtualEnum;
|
|
17
|
+
vertical?: VirtualEnum;
|
|
18
|
+
header?: VirtualEnum;
|
|
19
|
+
};
|
|
20
|
+
} & React.RefAttributes<BaseTable>>;
|
|
21
|
+
export default Grid;
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { WebsiteBaseTable } from "./assets/WebsiteBaseTable";
|
|
3
|
+
import { useLocale } from "rc-master-ui/es/locale";
|
|
4
|
+
import React, { useContext } from "react";
|
|
5
|
+
import { Tooltip } from "react-tooltip";
|
|
6
|
+
import "./base-table/styles.scss";
|
|
7
|
+
import { Toolbar } from 'rc-master-ui';
|
|
8
|
+
import classNames from "classnames";
|
|
9
|
+
import Pagination from "rc-master-ui/es/pagination";
|
|
10
|
+
import { Maximize, Minimize } from "becoxy-icons";
|
|
11
|
+
import { numericFormatter } from "react-numeric-component";
|
|
12
|
+
import { pageSizeOptions } from "../grid-component/hooks";
|
|
13
|
+
import ContextMenu from "../table-component/ContextMenu";
|
|
14
|
+
import { TableContext } from "./useContext";
|
|
15
|
+
import { ColumnsChoose } from "./pipeline/features/ColumnsChoose";
|
|
16
|
+
// const Grid = (props: GridProps) => {
|
|
17
|
+
const Grid = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
18
|
+
const {
|
|
19
|
+
id,
|
|
20
|
+
t,
|
|
21
|
+
isFullScreen,
|
|
22
|
+
setIsFullScreen,
|
|
23
|
+
className: tableClassNames,
|
|
24
|
+
title,
|
|
25
|
+
showToolbar,
|
|
26
|
+
toolbarItems,
|
|
27
|
+
pagination,
|
|
28
|
+
infiniteScroll,
|
|
29
|
+
dataSource,
|
|
30
|
+
originData,
|
|
31
|
+
format,
|
|
32
|
+
locale,
|
|
33
|
+
fullScreen,
|
|
34
|
+
actionTemplate,
|
|
35
|
+
theme,
|
|
36
|
+
height,
|
|
37
|
+
minHeight,
|
|
38
|
+
pipeline,
|
|
39
|
+
contextMenuItems: propContextMenuItems,
|
|
40
|
+
contextMenuHidden,
|
|
41
|
+
contextMenuOpen,
|
|
42
|
+
recordDoubleClick,
|
|
43
|
+
contextMenuClick,
|
|
44
|
+
commandClick,
|
|
45
|
+
onRowStyles,
|
|
46
|
+
showColumnChoose,
|
|
47
|
+
originColumns,
|
|
48
|
+
columns,
|
|
49
|
+
groupColumns,
|
|
50
|
+
setVisibleKeys,
|
|
51
|
+
footerDataSource,
|
|
52
|
+
loading,
|
|
53
|
+
useVirtual
|
|
54
|
+
|
|
55
|
+
// onRowFooterStyles,
|
|
56
|
+
// onRowHeaderStyles
|
|
57
|
+
} = props;
|
|
58
|
+
const prefix = 'ui-rc';
|
|
59
|
+
const stateKeyPager = 'pagination';
|
|
60
|
+
const [tableLocal] = useLocale('Table');
|
|
61
|
+
const [paginationLocal] = useLocale('Pagination');
|
|
62
|
+
const menuRef = React.useRef(null);
|
|
63
|
+
const {
|
|
64
|
+
windowSize
|
|
65
|
+
} = useContext(TableContext);
|
|
66
|
+
const [menuVisible, setMenuVisible] = React.useState(false);
|
|
67
|
+
const [selectedRowData, setSelectedRowData] = React.useState(undefined);
|
|
68
|
+
const [position, setPosition] = React.useState({
|
|
69
|
+
x: 0,
|
|
70
|
+
y: 0,
|
|
71
|
+
viewportWidth: windowSize.innerWidth,
|
|
72
|
+
viewportHeight: windowSize.innerHeight
|
|
73
|
+
});
|
|
74
|
+
const contextMenuItems = React.useMemo(() => {
|
|
75
|
+
if (typeof contextMenuHidden === 'function' && propContextMenuItems && selectedRowData) {
|
|
76
|
+
const hiddenItems = contextMenuHidden({
|
|
77
|
+
rowInfo: {
|
|
78
|
+
rowData: selectedRowData.rowData
|
|
79
|
+
},
|
|
80
|
+
field: selectedRowData.field
|
|
81
|
+
});
|
|
82
|
+
return propContextMenuItems.filter(item => !hiddenItems.includes(item?.key));
|
|
83
|
+
}
|
|
84
|
+
if (contextMenuHidden && typeof contextMenuHidden !== 'function' && propContextMenuItems) {
|
|
85
|
+
return propContextMenuItems.filter(item => !contextMenuHidden.includes(item?.key));
|
|
86
|
+
}
|
|
87
|
+
return propContextMenuItems;
|
|
88
|
+
}, [propContextMenuItems, contextMenuHidden, selectedRowData]);
|
|
89
|
+
const onResizeEnd = () => {};
|
|
90
|
+
const onContextMenu = args => event => {
|
|
91
|
+
event.preventDefault(); // Ngăn chặn menu mặc định của trình duyệt
|
|
92
|
+
|
|
93
|
+
setSelectedRowData(args);
|
|
94
|
+
contextMenuOpen?.({
|
|
95
|
+
rowInfo: {
|
|
96
|
+
rowData: args.rowData
|
|
97
|
+
},
|
|
98
|
+
field: args.field,
|
|
99
|
+
event
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// Đợi DOM cập nhật và lấy kích thước menu
|
|
103
|
+
setTimeout(() => {
|
|
104
|
+
setMenuVisible(true);
|
|
105
|
+
const menuElement = menuRef.current; // Lấy menu từ DOM
|
|
106
|
+
const menuWidth = menuElement?.offsetWidth || 200; // Mặc định 200px nếu chưa render
|
|
107
|
+
// const menuHeight = menuElement?.offsetHeight // Mặc định 450px nếu chưa render
|
|
108
|
+
|
|
109
|
+
// Điều chỉnh vị trí menu
|
|
110
|
+
let x = event.clientX;
|
|
111
|
+
let y = event.pageY;
|
|
112
|
+
const pageY = event.pageY;
|
|
113
|
+
if (x + menuWidth > windowSize.innerWidth) {
|
|
114
|
+
x = x - menuWidth - 10; // Cách cạnh phải 10px
|
|
115
|
+
}
|
|
116
|
+
if (pageY > windowSize.innerHeight) {
|
|
117
|
+
y = windowSize.innerHeight;
|
|
118
|
+
}
|
|
119
|
+
setPosition(prevState => ({
|
|
120
|
+
...prevState,
|
|
121
|
+
x,
|
|
122
|
+
y
|
|
123
|
+
}));
|
|
124
|
+
}, 100);
|
|
125
|
+
};
|
|
126
|
+
React.useEffect(() => {
|
|
127
|
+
const handleClickOutside = event => {
|
|
128
|
+
const element = event.target;
|
|
129
|
+
const containerContextMenu = document.querySelector(".popup-context-menu");
|
|
130
|
+
const isInsideContainerContext = containerContextMenu && element.closest(".popup-context-menu");
|
|
131
|
+
if (isInsideContainerContext) {
|
|
132
|
+
return;
|
|
133
|
+
} else {
|
|
134
|
+
setMenuVisible(false);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
138
|
+
return () => {
|
|
139
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
140
|
+
};
|
|
141
|
+
}, []);
|
|
142
|
+
const triggerChangeColumns = (nextColumn, _, nextVisibleKeys) => {
|
|
143
|
+
setVisibleKeys(nextVisibleKeys);
|
|
144
|
+
};
|
|
145
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
146
|
+
className: classNames(`${prefix}-grid ${tableClassNames}`, {
|
|
147
|
+
[`${prefix}-grid-light`]: !theme || theme.theme === 'light',
|
|
148
|
+
[`${prefix}-grid-dark`]: theme?.theme === 'dark'
|
|
149
|
+
}),
|
|
150
|
+
style: {
|
|
151
|
+
height: height ?? 700,
|
|
152
|
+
minHeight,
|
|
153
|
+
display: 'flex',
|
|
154
|
+
flexDirection: 'column'
|
|
155
|
+
}
|
|
156
|
+
}, (showToolbar !== false || fullScreen !== false || title) && /*#__PURE__*/React.createElement("div", {
|
|
157
|
+
className: classNames(`${prefix}-grid-top-toolbar`, {})
|
|
158
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
159
|
+
style: {
|
|
160
|
+
display: 'flex',
|
|
161
|
+
justifyContent: 'space-between',
|
|
162
|
+
alignItems: 'center'
|
|
163
|
+
}
|
|
164
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
165
|
+
style: {
|
|
166
|
+
flex: 1,
|
|
167
|
+
overflow: 'hidden'
|
|
168
|
+
}
|
|
169
|
+
}, /*#__PURE__*/React.createElement(Toolbar, {
|
|
170
|
+
items: (toolbarItems ?? []).filter(it => it.position !== 'Bottom'),
|
|
171
|
+
mode: 'scroll'
|
|
172
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
173
|
+
style: {
|
|
174
|
+
display: 'flex',
|
|
175
|
+
justifyContent: 'space-between',
|
|
176
|
+
alignItems: 'center',
|
|
177
|
+
gap: '.25rem'
|
|
178
|
+
}
|
|
179
|
+
}, pagination && pagination.onChange && pagination?.position && pagination?.position[0] === 'topRight' && /*#__PURE__*/React.createElement(Pagination, _extends({
|
|
180
|
+
showSizeChanger: true,
|
|
181
|
+
responsive: true,
|
|
182
|
+
size: 'small',
|
|
183
|
+
rootClassName: 'top-pagination',
|
|
184
|
+
showTotal: (totalItems, range) =>
|
|
185
|
+
// @ts-ignore
|
|
186
|
+
`${range[0]}-${range[1]} / ${totalItems} ${t ? t(pagination?.locale?.items ?? 'items') : 'items'}`
|
|
187
|
+
}, pagination)), typeof actionTemplate === 'function' ? actionTemplate() : actionTemplate, fullScreen !== false && (isFullScreen ? /*#__PURE__*/React.createElement(Minimize, {
|
|
188
|
+
fontSize: 16,
|
|
189
|
+
onClick: () => {
|
|
190
|
+
setIsFullScreen(!isFullScreen);
|
|
191
|
+
},
|
|
192
|
+
"data-tooltip-id": `${id}-tooltip-content`,
|
|
193
|
+
"data-tooltip-content": locale?.table?.minimized || tableLocal?.minimized || 'Minimized'
|
|
194
|
+
}) : /*#__PURE__*/React.createElement(Maximize, {
|
|
195
|
+
fontSize: 16,
|
|
196
|
+
onClick: () => {
|
|
197
|
+
setIsFullScreen(!isFullScreen);
|
|
198
|
+
},
|
|
199
|
+
"data-tooltip-id": `${id}-tooltip-content`,
|
|
200
|
+
"data-tooltip-content": locale?.table?.fullScreen || tableLocal?.fullScreen || 'Full screen'
|
|
201
|
+
})), showColumnChoose && /*#__PURE__*/React.createElement(ColumnsChoose, {
|
|
202
|
+
id: id ?? '',
|
|
203
|
+
locale: locale,
|
|
204
|
+
tableLocal: tableLocal,
|
|
205
|
+
columns: columns,
|
|
206
|
+
originColumns: originColumns,
|
|
207
|
+
t: t,
|
|
208
|
+
columnsGroup: groupColumns,
|
|
209
|
+
triggerChangeColumns: triggerChangeColumns
|
|
210
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
211
|
+
style: {
|
|
212
|
+
textAlign: 'center'
|
|
213
|
+
}
|
|
214
|
+
}, typeof title === 'function' ? title?.(dataSource) : title)), /*#__PURE__*/React.createElement(WebsiteBaseTable, _extends({
|
|
215
|
+
ref: ref,
|
|
216
|
+
id: id,
|
|
217
|
+
commandClick: commandClick,
|
|
218
|
+
isLoading: loading,
|
|
219
|
+
useVirtual: useVirtual,
|
|
220
|
+
hasStickyScroll: true,
|
|
221
|
+
isStickyFooter: true,
|
|
222
|
+
isStickyHeader: true,
|
|
223
|
+
stickyBottom: 0,
|
|
224
|
+
stickyTop: 0,
|
|
225
|
+
defaultColumnWidth: 100,
|
|
226
|
+
originData: originData,
|
|
227
|
+
format: format
|
|
228
|
+
|
|
229
|
+
// estimatedRowHeight={50}
|
|
230
|
+
,
|
|
231
|
+
useOuterBorder: true
|
|
232
|
+
// style={{ height: 700, overflow: 'auto' }}
|
|
233
|
+
,
|
|
234
|
+
style: minHeight ? {
|
|
235
|
+
flex: 1,
|
|
236
|
+
overflow: 'auto'
|
|
237
|
+
} : {
|
|
238
|
+
overflow: 'auto'
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// columnResizeMode={'onChange'}
|
|
242
|
+
,
|
|
243
|
+
onResizeEnd: onResizeEnd
|
|
244
|
+
}, pipeline.getProps(), {
|
|
245
|
+
getRowProps: (row, rowIndex) => {
|
|
246
|
+
const prevRowProps = pipeline.getProps().getRowProps?.(row, rowIndex);
|
|
247
|
+
const rowStyle = onRowStyles ? typeof onRowStyles === 'function' ? onRowStyles(row) : onRowStyles : undefined;
|
|
248
|
+
return {
|
|
249
|
+
...prevRowProps,
|
|
250
|
+
className: classNames(``, {
|
|
251
|
+
[`${prefix}-grid-row-parent`]: row.children && row.children.length > 0 || Array.isArray(row.children)
|
|
252
|
+
}),
|
|
253
|
+
style: {
|
|
254
|
+
...prevRowProps?.style,
|
|
255
|
+
...rowStyle
|
|
256
|
+
},
|
|
257
|
+
onContextMenu: e => {
|
|
258
|
+
if (contextMenuItems && contextMenuItems.length) {
|
|
259
|
+
const cell = e.target.closest('[data-col-key]');
|
|
260
|
+
const colKey = cell?.getAttribute('data-col-key');
|
|
261
|
+
onContextMenu?.({
|
|
262
|
+
rowData: row,
|
|
263
|
+
field: colKey
|
|
264
|
+
})(e);
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
onDoubleClick: e => {
|
|
268
|
+
recordDoubleClick?.({
|
|
269
|
+
e,
|
|
270
|
+
rowData: row,
|
|
271
|
+
rowIndex: rowIndex
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
},
|
|
276
|
+
footerDataSource: footerDataSource
|
|
277
|
+
})), pagination && !infiniteScroll && /*#__PURE__*/React.createElement(Pagination, _extends({
|
|
278
|
+
pageSizeOptions: pageSizeOptions,
|
|
279
|
+
rootClassName: 'pagination-template',
|
|
280
|
+
showSizeChanger: true,
|
|
281
|
+
size: 'small',
|
|
282
|
+
total: pagination.total,
|
|
283
|
+
pageSize: pagination.onChange ? pagination.pageSize : pipeline.getStateAtKey(stateKeyPager)?.pageSize ?? pageSizeOptions[0],
|
|
284
|
+
showTotal: (totalItems, range) => `${numericFormatter((range[0] ?? 0).toString(), {
|
|
285
|
+
thousandSeparator: '.'
|
|
286
|
+
})}-${numericFormatter((range[1] ?? 0).toString(), {
|
|
287
|
+
thousandSeparator: '.'
|
|
288
|
+
})} / ${numericFormatter((totalItems ?? 0).toString(), {
|
|
289
|
+
thousandSeparator: '.'
|
|
290
|
+
})} ${pagination?.locale?.items || paginationLocal?.items || ''}`,
|
|
291
|
+
current: pagination.onChange ? pagination.currentPage : pipeline.getStateAtKey(stateKeyPager)?.currentPage
|
|
292
|
+
}, pagination, {
|
|
293
|
+
onChange: (page, pageSize1) => {
|
|
294
|
+
if (pagination.onChange) {
|
|
295
|
+
pagination.onChange(page, pageSize1);
|
|
296
|
+
} else {
|
|
297
|
+
pipeline.setStateAtKey(stateKeyPager, {
|
|
298
|
+
currentPage: page,
|
|
299
|
+
pageSize: pageSize1
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
responsive: true
|
|
304
|
+
}))), /*#__PURE__*/React.createElement(Tooltip, {
|
|
305
|
+
id: `${id}-tooltip-content`,
|
|
306
|
+
style: {
|
|
307
|
+
zIndex: 1999,
|
|
308
|
+
maxWidth: 450,
|
|
309
|
+
whiteSpace: 'normal',
|
|
310
|
+
wordWrap: 'break-word'
|
|
311
|
+
},
|
|
312
|
+
delayShow: 100,
|
|
313
|
+
render: ({
|
|
314
|
+
content,
|
|
315
|
+
activeAnchor
|
|
316
|
+
}) => activeAnchor?.getAttribute('data-tooltip-sort') || content
|
|
317
|
+
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
318
|
+
id: `${id}-tooltip-error`,
|
|
319
|
+
style: {
|
|
320
|
+
zIndex: 1999,
|
|
321
|
+
maxWidth: 450
|
|
322
|
+
}
|
|
323
|
+
}), menuVisible && /*#__PURE__*/React.createElement(ContextMenu, {
|
|
324
|
+
open: menuVisible,
|
|
325
|
+
pos: position,
|
|
326
|
+
setOpen: setMenuVisible,
|
|
327
|
+
menuRef: menuRef,
|
|
328
|
+
contextMenuItems: contextMenuItems,
|
|
329
|
+
contextMenuClick: contextMenuClick,
|
|
330
|
+
rowData: selectedRowData
|
|
331
|
+
}));
|
|
332
|
+
});
|
|
333
|
+
export default Grid;
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { features, useTablePipeline } from "./pipeline";
|
|
3
|
+
import * as fusion from '@alifd/next';
|
|
4
|
+
import { useLocale } from "rc-master-ui/es/locale";
|
|
5
|
+
import { faker } from "@faker-js/faker";
|
|
6
|
+
import React from "react";
|
|
7
|
+
import "./base-table/styles.scss";
|
|
8
|
+
import { addRowIdArray, filterDataByColumns, groupArrayByColumns, isTreeArray, sortByType, sumFields } from "../table-component/hook/utils";
|
|
9
|
+
import { CustomProvider, ConfigProvider } from 'rc-master-ui';
|
|
10
|
+
import { Modal } from 'antd';
|
|
11
|
+
import { getLocale, getLocales } from "../locale/useLocale";
|
|
12
|
+
import { TableContext } from "./useContext";
|
|
13
|
+
import Grid from "./Grid";
|
|
14
|
+
import { getParentKeysLarge, getRowsByKeysKeepTreeOrder } from "./utils/selected";
|
|
15
|
+
const InternalTable = props => {
|
|
16
|
+
const {
|
|
17
|
+
t,
|
|
18
|
+
columns: propColumns,
|
|
19
|
+
dataSource,
|
|
20
|
+
allowFiltering,
|
|
21
|
+
allowSortering,
|
|
22
|
+
groupAble,
|
|
23
|
+
groupColumns,
|
|
24
|
+
groupSetting,
|
|
25
|
+
lang,
|
|
26
|
+
pagination,
|
|
27
|
+
locale,
|
|
28
|
+
fullScreenTitle,
|
|
29
|
+
wrapSettings,
|
|
30
|
+
ignoreAccents,
|
|
31
|
+
rowSelected,
|
|
32
|
+
selectionSettings,
|
|
33
|
+
expandable,
|
|
34
|
+
sortMultiple,
|
|
35
|
+
onFilter,
|
|
36
|
+
onSorter,
|
|
37
|
+
footerDataSource,
|
|
38
|
+
summary,
|
|
39
|
+
useVirtual,
|
|
40
|
+
...rest
|
|
41
|
+
} = props;
|
|
42
|
+
const prefix = 'ui-rc';
|
|
43
|
+
const rowKey = 'rowId';
|
|
44
|
+
const childrenKey = 'children';
|
|
45
|
+
const [tableLocal] = useLocale('Table');
|
|
46
|
+
const id = React.useMemo(() => {
|
|
47
|
+
return faker.string.alpha(20);
|
|
48
|
+
}, []);
|
|
49
|
+
const language = React.useMemo(() => {
|
|
50
|
+
return getLocale(lang);
|
|
51
|
+
}, [lang]);
|
|
52
|
+
const languages = React.useMemo(() => {
|
|
53
|
+
return getLocales(lang);
|
|
54
|
+
}, [lang]);
|
|
55
|
+
const getWindowSize = () => {
|
|
56
|
+
const {
|
|
57
|
+
innerWidth,
|
|
58
|
+
innerHeight
|
|
59
|
+
} = window;
|
|
60
|
+
return {
|
|
61
|
+
innerWidth,
|
|
62
|
+
innerHeight
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
const [windowSize, setWindowSize] = React.useState(getWindowSize());
|
|
66
|
+
React.useEffect(() => {
|
|
67
|
+
const handleWindowResize = () => {
|
|
68
|
+
setWindowSize(getWindowSize());
|
|
69
|
+
};
|
|
70
|
+
document.addEventListener('resize', handleWindowResize);
|
|
71
|
+
return () => {
|
|
72
|
+
document.removeEventListener('resize', handleWindowResize);
|
|
73
|
+
};
|
|
74
|
+
}, []);
|
|
75
|
+
const isDataTree = React.useMemo(() => {
|
|
76
|
+
return isTreeArray(dataSource);
|
|
77
|
+
}, [dataSource]);
|
|
78
|
+
const [visibleKeys, setVisibleKeys] = React.useState(undefined);
|
|
79
|
+
const [filterState, setFilterState] = React.useState(undefined);
|
|
80
|
+
const [sortState, setSortState] = React.useState(undefined);
|
|
81
|
+
const columns = React.useMemo(() => {
|
|
82
|
+
return sortByType(propColumns);
|
|
83
|
+
}, [propColumns]);
|
|
84
|
+
const convertData = React.useMemo(() => {
|
|
85
|
+
if (groupAble && groupSetting && groupSetting.client !== false) {
|
|
86
|
+
return groupArrayByColumns(dataSource, groupColumns);
|
|
87
|
+
}
|
|
88
|
+
return addRowIdArray(dataSource);
|
|
89
|
+
}, [dataSource, groupAble, groupColumns, groupSetting]);
|
|
90
|
+
const mergedData = React.useMemo(() => {
|
|
91
|
+
if (sortState || filterState) {
|
|
92
|
+
return filterDataByColumns(convertData, filterState ?? [], sortState ?? [], [], ignoreAccents);
|
|
93
|
+
}
|
|
94
|
+
return convertData;
|
|
95
|
+
}, [convertData, filterState, ignoreAccents, sortState]);
|
|
96
|
+
const footerData = React.useMemo(() => {
|
|
97
|
+
if (!summary) {
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
if (footerDataSource) {
|
|
101
|
+
return footerDataSource;
|
|
102
|
+
}
|
|
103
|
+
const a = sumFields(columns, dataSource, childrenKey);
|
|
104
|
+
return [a];
|
|
105
|
+
}, [columns, dataSource, footerDataSource, summary]);
|
|
106
|
+
const expandAllKeys = React.useMemo(() => {
|
|
107
|
+
if (expandable?.defaultExpandAllRows && isDataTree) {
|
|
108
|
+
return getParentKeysLarge(convertData, rowKey, childrenKey);
|
|
109
|
+
}
|
|
110
|
+
return undefined;
|
|
111
|
+
}, [expandable?.defaultExpandAllRows, convertData, isDataTree]);
|
|
112
|
+
const [isFullScreen, setIsFullScreen] = React.useState(false);
|
|
113
|
+
const pipeline = useTablePipeline({
|
|
114
|
+
components: fusion
|
|
115
|
+
}).input({
|
|
116
|
+
dataSource: mergedData,
|
|
117
|
+
columns
|
|
118
|
+
}).primaryKey(rowKey)
|
|
119
|
+
// .mapDataSource((dta) => collectNodes(dta, 'pre'))
|
|
120
|
+
// .snapshot('flat')
|
|
121
|
+
.use(features.hiddenColumns({
|
|
122
|
+
columns,
|
|
123
|
+
visibleKeys
|
|
124
|
+
})).use(features.treeSelect({
|
|
125
|
+
tree: mergedData,
|
|
126
|
+
value: selectionSettings?.selectedRowKeys,
|
|
127
|
+
defaultValue: selectionSettings?.defaultSelectedRowKeys,
|
|
128
|
+
// rootKey: selectionSettings?.hideSelectAll,
|
|
129
|
+
rootKey: selectionSettings?.hideSelectAll || selectionSettings?.type === 'single' ? undefined : 'root',
|
|
130
|
+
// rootKey: 'root',
|
|
131
|
+
checkStrictly: selectionSettings?.checkStrictly,
|
|
132
|
+
// checkStrictly: true,
|
|
133
|
+
checkedStrategy: isDataTree ? selectionSettings?.checkedStrategy : 'all',
|
|
134
|
+
// checkedStrategy: 'parent',
|
|
135
|
+
|
|
136
|
+
mode: selectionSettings?.mode,
|
|
137
|
+
type: selectionSettings?.type,
|
|
138
|
+
highlightRowWhenSelected: true,
|
|
139
|
+
isDisabled(row) {
|
|
140
|
+
return !!selectionSettings?.getCheckboxProps?.(row)?.disabled;
|
|
141
|
+
},
|
|
142
|
+
checkboxColumn: {
|
|
143
|
+
lock: true
|
|
144
|
+
},
|
|
145
|
+
clickArea: selectionSettings?.checkboxOnly ? 'checkbox' : 'row',
|
|
146
|
+
// clickArea: 'row',
|
|
147
|
+
onChange: (nextValue, rowData, type) => {
|
|
148
|
+
const rs = getRowsByKeysKeepTreeOrder(nextValue, mergedData ?? [], rowKey);
|
|
149
|
+
rowSelected?.({
|
|
150
|
+
type,
|
|
151
|
+
rowData,
|
|
152
|
+
selected: rs
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// clickArea: 'checkbox'
|
|
157
|
+
})).use(features.treeMode({
|
|
158
|
+
clickArea: 'icon',
|
|
159
|
+
stopClickEventPropagation: true,
|
|
160
|
+
expandIconColumnIndex: expandable?.expandIconColumnIndex,
|
|
161
|
+
defaultOpenKeys: expandAllKeys ?? expandable?.defaultExpandedRowKeys
|
|
162
|
+
})).use(features.columnCustom({
|
|
163
|
+
id,
|
|
164
|
+
t,
|
|
165
|
+
columns,
|
|
166
|
+
mode: sortMultiple !== false ? 'multiple' : 'single',
|
|
167
|
+
dataSource: mergedData,
|
|
168
|
+
columnResizeMode: 'onChange',
|
|
169
|
+
disableUserSelectWhenResizing: true,
|
|
170
|
+
allowFiltering,
|
|
171
|
+
allowSortering,
|
|
172
|
+
tableLocal,
|
|
173
|
+
locale,
|
|
174
|
+
prefix,
|
|
175
|
+
wrapSettings,
|
|
176
|
+
ignoreAccents,
|
|
177
|
+
currentPage: pagination ? pagination?.currentPage : undefined,
|
|
178
|
+
pageSize: pagination ? pagination?.pageSize : undefined,
|
|
179
|
+
isDataTree,
|
|
180
|
+
onFilter(val) {
|
|
181
|
+
// const rs =
|
|
182
|
+
|
|
183
|
+
if (onFilter) {
|
|
184
|
+
onFilter(val);
|
|
185
|
+
} else {
|
|
186
|
+
setFilterState(val);
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
onSorter(val) {
|
|
190
|
+
if (onSorter) {
|
|
191
|
+
onSorter(val);
|
|
192
|
+
} else {
|
|
193
|
+
setSortState(val);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
})).use(features.paginationFeature({
|
|
197
|
+
pagination
|
|
198
|
+
}));
|
|
199
|
+
|
|
200
|
+
// const onResizeEnd = (args: any[]) => {
|
|
201
|
+
|
|
202
|
+
// }
|
|
203
|
+
|
|
204
|
+
return /*#__PURE__*/React.createElement(ConfigProvider, {
|
|
205
|
+
locale: language
|
|
206
|
+
}, /*#__PURE__*/React.createElement(CustomProvider, {
|
|
207
|
+
locale: languages
|
|
208
|
+
}, /*#__PURE__*/React.createElement(TableContext.Provider, {
|
|
209
|
+
value: {
|
|
210
|
+
prefix,
|
|
211
|
+
id,
|
|
212
|
+
rowKey,
|
|
213
|
+
dataSource: mergedData,
|
|
214
|
+
originData: convertData,
|
|
215
|
+
windowSize,
|
|
216
|
+
lang,
|
|
217
|
+
locale
|
|
218
|
+
}
|
|
219
|
+
}, /*#__PURE__*/React.createElement(Grid, _extends({}, rest, {
|
|
220
|
+
id: id,
|
|
221
|
+
useVirtual: {
|
|
222
|
+
header: false,
|
|
223
|
+
horizontal: useVirtual?.horizontal ?? true,
|
|
224
|
+
vertical: useVirtual?.vertical ?? true
|
|
225
|
+
},
|
|
226
|
+
isFullScreen: isFullScreen,
|
|
227
|
+
pagination: pagination,
|
|
228
|
+
setIsFullScreen: setIsFullScreen,
|
|
229
|
+
pipeline: pipeline
|
|
230
|
+
}, pipeline.getProps(), {
|
|
231
|
+
originData: convertData,
|
|
232
|
+
originColumns: columns,
|
|
233
|
+
groupColumns: groupColumns,
|
|
234
|
+
setVisibleKeys: setVisibleKeys,
|
|
235
|
+
footerDataSource: footerData
|
|
236
|
+
})), /*#__PURE__*/React.createElement(Modal, {
|
|
237
|
+
open: isFullScreen,
|
|
238
|
+
footer: null,
|
|
239
|
+
centered: true,
|
|
240
|
+
closable: true,
|
|
241
|
+
width: '100%',
|
|
242
|
+
style: {
|
|
243
|
+
maxWidth: '100%',
|
|
244
|
+
height: '100%'
|
|
245
|
+
},
|
|
246
|
+
onCancel: () => setIsFullScreen(false),
|
|
247
|
+
styles: {
|
|
248
|
+
content: {
|
|
249
|
+
height: '100vh',
|
|
250
|
+
borderRadius: 0,
|
|
251
|
+
padding: '15px 10px'
|
|
252
|
+
},
|
|
253
|
+
wrapper: {
|
|
254
|
+
zIndex: 1050
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
title: /*#__PURE__*/React.createElement("div", {
|
|
258
|
+
style: {
|
|
259
|
+
minHeight: 24
|
|
260
|
+
}
|
|
261
|
+
}, " ", typeof fullScreenTitle === 'function' ? fullScreenTitle?.() : fullScreenTitle, " "),
|
|
262
|
+
destroyOnClose: true
|
|
263
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
264
|
+
style: {}
|
|
265
|
+
}, /*#__PURE__*/React.createElement(Grid, _extends({}, rest, {
|
|
266
|
+
id: id,
|
|
267
|
+
useVirtual: {
|
|
268
|
+
header: false,
|
|
269
|
+
horizontal: useVirtual?.horizontal ?? true,
|
|
270
|
+
vertical: useVirtual?.vertical ?? true
|
|
271
|
+
},
|
|
272
|
+
isFullScreen: isFullScreen,
|
|
273
|
+
setIsFullScreen: setIsFullScreen,
|
|
274
|
+
pipeline: pipeline,
|
|
275
|
+
pagination: pagination
|
|
276
|
+
}, pipeline.getProps(), {
|
|
277
|
+
originData: convertData,
|
|
278
|
+
originColumns: columns,
|
|
279
|
+
groupColumns: groupColumns,
|
|
280
|
+
setVisibleKeys: setVisibleKeys,
|
|
281
|
+
footerDataSource: footerData
|
|
282
|
+
})))))));
|
|
283
|
+
};
|
|
284
|
+
export default InternalTable;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { BaseTable } from "../base-table/table";
|
|
6
|
+
const DarkSupportBaseTable = styled(BaseTable).withConfig({
|
|
7
|
+
displayName: "DarkSupportBaseTable",
|
|
8
|
+
componentId: "es-grid-template__sc-4ltmbz-0"
|
|
9
|
+
})(["", ";&.dark{--bgcolor:#333;--header-bgcolor:#45494f;--hover-bgcolor:#46484a;--header-hover-bgcolor:#606164;--highlight-bgcolor:#191a1b;--header-highlight-bgcolor:#191a1b;--color:#dadde1;--header-color:#dadde1;--lock-shadow:rgb(37 37 37 / 0.5) 0 0 6px 2px;--border-color:#3c4045;}"], props => props.css);
|
|
10
|
+
export const WebsiteBaseTable = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
11
|
+
const isDarkTheme = false;
|
|
12
|
+
return /*#__PURE__*/React.createElement(DarkSupportBaseTable, _extends({
|
|
13
|
+
ref: ref,
|
|
14
|
+
className: cx({
|
|
15
|
+
dark: isDarkTheme
|
|
16
|
+
}, props.className)
|
|
17
|
+
}, props));
|
|
18
|
+
});
|