@kdcloudjs/table 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +568 -0
- package/README.md +111 -0
- package/dist/@kdcloudjs/table.css +422 -0
- package/dist/@kdcloudjs/table.css.map +1 -0
- package/dist/@kdcloudjs/table.js +38578 -0
- package/dist/@kdcloudjs/table.js.map +1 -0
- package/dist/@kdcloudjs/table.min.css +9 -0
- package/dist/@kdcloudjs/table.min.js +208 -0
- package/dist/@kdcloudjs/table.min.js.map +1 -0
- package/dist/default-theme.js +344 -0
- package/dist/kd-table.css +422 -0
- package/dist/kd-table.css.map +1 -0
- package/dist/kd-table.js +38578 -0
- package/dist/kd-table.js.map +1 -0
- package/dist/kd-table.min.css +9 -0
- package/dist/kd-table.min.js +208 -0
- package/dist/kd-table.min.js.map +1 -0
- package/dist/kd-ui-complete.less +779 -0
- package/dist/kd-ui.less +2 -0
- package/dist/theme.js +13 -0
- package/es/_utils/arrayUtil.d.ts +5 -0
- package/es/_utils/arrayUtil.js +17 -0
- package/es/_utils/devwarning.d.ts +1 -0
- package/es/_utils/devwarning.js +10 -0
- package/es/_utils/formatUtil.d.ts +46 -0
- package/es/_utils/formatUtil.js +346 -0
- package/es/_utils/hooks.d.ts +51 -0
- package/es/_utils/hooks.js +165 -0
- package/es/_utils/index.d.ts +8 -0
- package/es/_utils/index.js +15 -0
- package/es/_utils/numberUtil.d.ts +34 -0
- package/es/_utils/numberUtil.js +181 -0
- package/es/_utils/omit.d.ts +1 -0
- package/es/_utils/omit.js +11 -0
- package/es/_utils/react-children.d.ts +2 -0
- package/es/_utils/react-children.js +8 -0
- package/es/_utils/type.d.ts +12 -0
- package/es/_utils/type.js +15 -0
- package/es/_utils/usePopper.d.ts +29 -0
- package/es/_utils/usePopper.js +546 -0
- package/es/config-provider/ConfigContext.d.ts +22 -0
- package/es/config-provider/ConfigContext.js +7 -0
- package/es/config-provider/compDefaultProps.d.ts +8 -0
- package/es/config-provider/compDefaultProps.js +10 -0
- package/es/config-provider/configProvider.d.ts +11 -0
- package/es/config-provider/configProvider.js +40 -0
- package/es/config-provider/defaultConfig.d.ts +10 -0
- package/es/config-provider/defaultConfig.js +18 -0
- package/es/config-provider/index.d.ts +6 -0
- package/es/config-provider/index.js +6 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +4 -0
- package/es/locale/index.d.ts +3 -0
- package/es/locale/index.js +3 -0
- package/es/locale/locale.d.ts +50 -0
- package/es/locale/locale.js +251 -0
- package/es/locale/zh-CN.d.ts +8 -0
- package/es/locale/zh-CN.js +8 -0
- package/es/style/color/colors.less +2 -0
- package/es/style/core/index.less +2 -0
- package/es/style/core/motion/other.less +28 -0
- package/es/style/core/motion/slide.less +53 -0
- package/es/style/core/motion.less +2 -0
- package/es/style/core/reset.less +186 -0
- package/es/style/css.js +1 -0
- package/es/style/index.css +410 -0
- package/es/style/index.d.ts +1 -0
- package/es/style/index.js +1 -0
- package/es/style/index.less +2 -0
- package/es/style/mixins/index.less +19 -0
- package/es/style/mixins/overlay.less +22 -0
- package/es/style/mixins/reset.less +13 -0
- package/es/style/themes/default.less +445 -0
- package/es/style/themes/index.less +1 -0
- package/es/table/base/calculations.d.ts +5 -0
- package/es/table/base/calculations.js +364 -0
- package/es/table/base/colgroup.d.ts +5 -0
- package/es/table/base/colgroup.js +22 -0
- package/es/table/base/empty.d.ts +9 -0
- package/es/table/base/empty.js +38 -0
- package/es/table/base/header.d.ts +5 -0
- package/es/table/base/header.js +324 -0
- package/es/table/base/helpers/SpanManager.d.ts +9 -0
- package/es/table/base/helpers/SpanManager.js +50 -0
- package/es/table/base/helpers/TableDOMUtils.d.ts +18 -0
- package/es/table/base/helpers/TableDOMUtils.js +104 -0
- package/es/table/base/helpers/__test__/SpanManager.test.d.ts +1 -0
- package/es/table/base/helpers/__test__/SpanManager.test.js +18 -0
- package/es/table/base/helpers/__test__/TableDOMUtils.test.d.ts +1 -0
- package/es/table/base/helpers/__test__/TableDOMUtils.test.js +34 -0
- package/es/table/base/helpers/__test__/rowHeightManager.test.d.ts +1 -0
- package/es/table/base/helpers/__test__/rowHeightManager.test.js +30 -0
- package/es/table/base/helpers/__test__/visible-part.test.d.ts +1 -0
- package/es/table/base/helpers/__test__/visible-part.test.js +28 -0
- package/es/table/base/helpers/rowHeightManager.d.ts +7 -0
- package/es/table/base/helpers/rowHeightManager.js +157 -0
- package/es/table/base/helpers/visible-part.d.ts +23 -0
- package/es/table/base/helpers/visible-part.js +58 -0
- package/es/table/base/html-table.d.ts +15 -0
- package/es/table/base/html-table.js +132 -0
- package/es/table/base/index.d.ts +3 -0
- package/es/table/base/index.js +2 -0
- package/es/table/base/interfaces.d.ts +54 -0
- package/es/table/base/interfaces.js +0 -0
- package/es/table/base/loading.d.ts +13 -0
- package/es/table/base/loading.js +60 -0
- package/es/table/base/styles.d.ts +132 -0
- package/es/table/base/styles.js +112 -0
- package/es/table/base/table.d.ts +150 -0
- package/es/table/base/table.js +733 -0
- package/es/table/base/utils.d.ts +36 -0
- package/es/table/base/utils.js +193 -0
- package/es/table/common-views.d.ts +24 -0
- package/es/table/common-views.js +70 -0
- package/es/table/index.d.ts +6 -0
- package/es/table/index.js +6 -0
- package/es/table/interfaces.d.ts +98 -0
- package/es/table/interfaces.js +0 -0
- package/es/table/internals.d.ts +14 -0
- package/es/table/internals.js +56 -0
- package/es/table/pipeline/features/__test__/multiSelect.test.d.ts +1 -0
- package/es/table/pipeline/features/__test__/multiSelect.test.js +152 -0
- package/es/table/pipeline/features/__test__/rowDetail.test.d.ts +1 -0
- package/es/table/pipeline/features/__test__/rowDetail.test.js +223 -0
- package/es/table/pipeline/features/__test__/rowGrouping.test.d.ts +1 -0
- package/es/table/pipeline/features/__test__/rowGrouping.test.js +120 -0
- package/es/table/pipeline/features/__test__/singleSelect.test.d.ts +1 -0
- package/es/table/pipeline/features/__test__/singleSelect.test.js +191 -0
- package/es/table/pipeline/features/__test__/sort.test.d.ts +1 -0
- package/es/table/pipeline/features/__test__/sort.test.js +213 -0
- package/es/table/pipeline/features/__test__/tips.test.d.ts +1 -0
- package/es/table/pipeline/features/__test__/tips.test.js +123 -0
- package/es/table/pipeline/features/__test__/treeMode.test.d.ts +1 -0
- package/es/table/pipeline/features/__test__/treeMode.test.js +202 -0
- package/es/table/pipeline/features/autoFill.d.ts +4 -0
- package/es/table/pipeline/features/autoFill.js +63 -0
- package/es/table/pipeline/features/autoRowSpan.d.ts +2 -0
- package/es/table/pipeline/features/autoRowSpan.js +72 -0
- package/es/table/pipeline/features/buildTree.d.ts +2 -0
- package/es/table/pipeline/features/buildTree.js +8 -0
- package/es/table/pipeline/features/columnDrag.d.ts +6 -0
- package/es/table/pipeline/features/columnDrag.js +265 -0
- package/es/table/pipeline/features/columnFilter.d.ts +20 -0
- package/es/table/pipeline/features/columnFilter.js +173 -0
- package/es/table/pipeline/features/columnHover.d.ts +12 -0
- package/es/table/pipeline/features/columnHover.js +51 -0
- package/es/table/pipeline/features/columnRangeHover.d.ts +15 -0
- package/es/table/pipeline/features/columnRangeHover.js +83 -0
- package/es/table/pipeline/features/columnResizeWidth.d.ts +21 -0
- package/es/table/pipeline/features/columnResizeWidth.js +173 -0
- package/es/table/pipeline/features/contextMenu.d.ts +14 -0
- package/es/table/pipeline/features/contextMenu.js +370 -0
- package/es/table/pipeline/features/filter/DefaultFilterContent.d.ts +4 -0
- package/es/table/pipeline/features/filter/DefaultFilterContent.js +91 -0
- package/es/table/pipeline/features/filter/Filter.d.ts +17 -0
- package/es/table/pipeline/features/filter/Filter.js +111 -0
- package/es/table/pipeline/features/filter/FilterPanel.d.ts +20 -0
- package/es/table/pipeline/features/filter/FilterPanel.js +81 -0
- package/es/table/pipeline/features/filter/__test__/Filter.test.d.ts +1 -0
- package/es/table/pipeline/features/filter/__test__/Filter.test.js +29 -0
- package/es/table/pipeline/features/filter/index.d.ts +4 -0
- package/es/table/pipeline/features/filter/index.js +4 -0
- package/es/table/pipeline/features/filter/util.d.ts +10 -0
- package/es/table/pipeline/features/filter/util.js +67 -0
- package/es/table/pipeline/features/index.d.ts +16 -0
- package/es/table/pipeline/features/index.js +16 -0
- package/es/table/pipeline/features/multiSelect.d.ts +27 -0
- package/es/table/pipeline/features/multiSelect.js +208 -0
- package/es/table/pipeline/features/rowDetail.d.ts +35 -0
- package/es/table/pipeline/features/rowDetail.js +254 -0
- package/es/table/pipeline/features/rowGrouping.d.ts +14 -0
- package/es/table/pipeline/features/rowGrouping.js +200 -0
- package/es/table/pipeline/features/singleSelect.d.ts +23 -0
- package/es/table/pipeline/features/singleSelect.js +122 -0
- package/es/table/pipeline/features/sort.d.ts +40 -0
- package/es/table/pipeline/features/sort.js +332 -0
- package/es/table/pipeline/features/tips.d.ts +2 -0
- package/es/table/pipeline/features/tips.js +57 -0
- package/es/table/pipeline/features/treeMode.d.ts +37 -0
- package/es/table/pipeline/features/treeMode.js +234 -0
- package/es/table/pipeline/features/treeSelect.d.ts +38 -0
- package/es/table/pipeline/features/treeSelect.js +154 -0
- package/es/table/pipeline/index.d.ts +3 -0
- package/es/table/pipeline/index.js +3 -0
- package/es/table/pipeline/pipeline.d.ts +85 -0
- package/es/table/pipeline/pipeline.js +272 -0
- package/es/table/pivot/cross-table/buildCrossTable.d.ts +14 -0
- package/es/table/pivot/cross-table/buildCrossTable.js +294 -0
- package/es/table/pivot/cross-table/constants.d.ts +1 -0
- package/es/table/pivot/cross-table/constants.js +1 -0
- package/es/table/pivot/cross-table/cross-table.d.ts +18 -0
- package/es/table/pivot/cross-table/cross-table.js +55 -0
- package/es/table/pivot/cross-table/index.d.ts +4 -0
- package/es/table/pivot/cross-table/index.js +3 -0
- package/es/table/pivot/cross-table/interfaces.d.ts +29 -0
- package/es/table/pivot/cross-table/interfaces.js +0 -0
- package/es/table/pivot/cross-table/internals.d.ts +13 -0
- package/es/table/pivot/cross-table/internals.js +0 -0
- package/es/table/pivot/cross-tree-table/buildCrossTreeTable.d.ts +14 -0
- package/es/table/pivot/cross-tree-table/buildCrossTreeTable.js +219 -0
- package/es/table/pivot/cross-tree-table/cross-tree-table.d.ts +38 -0
- package/es/table/pivot/cross-tree-table/cross-tree-table.js +127 -0
- package/es/table/pivot/cross-tree-table/index.d.ts +2 -0
- package/es/table/pivot/cross-tree-table/index.js +2 -0
- package/es/table/pivot/pivot-utils/buildDrillTree.d.ts +16 -0
- package/es/table/pivot/pivot-utils/buildDrillTree.js +93 -0
- package/es/table/pivot/pivot-utils/builders.d.ts +26 -0
- package/es/table/pivot/pivot-utils/builders.js +252 -0
- package/es/table/pivot/pivot-utils/convert-utils.d.ts +31 -0
- package/es/table/pivot/pivot-utils/convert-utils.js +180 -0
- package/es/table/pivot/pivot-utils/index.d.ts +5 -0
- package/es/table/pivot/pivot-utils/index.js +4 -0
- package/es/table/pivot/pivot-utils/interfaces.d.ts +12 -0
- package/es/table/pivot/pivot-utils/interfaces.js +0 -0
- package/es/table/pivot/pivot-utils/simpleEncode.d.ts +1 -0
- package/es/table/pivot/pivot-utils/simpleEncode.js +7 -0
- package/es/table/style/css.js +2 -0
- package/es/table/style/index.css +0 -0
- package/es/table/style/index.d.ts +2 -0
- package/es/table/style/index.js +2 -0
- package/es/table/style/index.less +1 -0
- package/es/table/transforms/autoRowSpan.d.ts +3 -0
- package/es/table/transforms/autoRowSpan.js +73 -0
- package/es/table/transforms/autoWidth.d.ts +25 -0
- package/es/table/transforms/autoWidth.js +160 -0
- package/es/table/transforms/buildTree.d.ts +3 -0
- package/es/table/transforms/buildTree.js +15 -0
- package/es/table/transforms/columnHover.d.ts +17 -0
- package/es/table/transforms/columnHover.js +59 -0
- package/es/table/transforms/columnRangeHover.d.ts +17 -0
- package/es/table/transforms/columnRangeHover.js +94 -0
- package/es/table/transforms/columnResize.d.ts +27 -0
- package/es/table/transforms/columnResize.js +152 -0
- package/es/table/transforms/flatten.d.ts +3 -0
- package/es/table/transforms/flatten.js +16 -0
- package/es/table/transforms/index.d.ts +12 -0
- package/es/table/transforms/index.js +12 -0
- package/es/table/transforms/orderField.d.ts +3 -0
- package/es/table/transforms/orderField.js +22 -0
- package/es/table/transforms/sort.d.ts +43 -0
- package/es/table/transforms/sort.js +338 -0
- package/es/table/transforms/tips.d.ts +8 -0
- package/es/table/transforms/tips.js +54 -0
- package/es/table/transforms/treeMode.d.ts +30 -0
- package/es/table/transforms/treeMode.js +252 -0
- package/es/table/transforms/visible.d.ts +5 -0
- package/es/table/transforms/visible.js +19 -0
- package/es/table/transforms/warnTransformsDeprecated.d.ts +1 -0
- package/es/table/transforms/warnTransformsDeprecated.js +8 -0
- package/es/table/use/useResizeObserver.d.ts +2 -0
- package/es/table/use/useResizeObserver.js +20 -0
- package/es/table/utils/applyTransforms.d.ts +6 -0
- package/es/table/utils/applyTransforms.js +15 -0
- package/es/table/utils/buildTree.d.ts +36 -0
- package/es/table/utils/buildTree.js +119 -0
- package/es/table/utils/collectNodes.d.ts +8 -0
- package/es/table/utils/collectNodes.js +59 -0
- package/es/table/utils/console.d.ts +11 -0
- package/es/table/utils/console.js +58 -0
- package/es/table/utils/copyToClipboard.d.ts +3 -0
- package/es/table/utils/copyToClipboard.js +30 -0
- package/es/table/utils/element.d.ts +42 -0
- package/es/table/utils/element.js +228 -0
- package/es/table/utils/exportTableAsExcel.d.ts +4 -0
- package/es/table/utils/exportTableAsExcel.js +188 -0
- package/es/table/utils/getTreeDepth.d.ts +3 -0
- package/es/table/utils/getTreeDepth.js +41 -0
- package/es/table/utils/groupBy.d.ts +1 -0
- package/es/table/utils/groupBy.js +37 -0
- package/es/table/utils/index.d.ts +18 -0
- package/es/table/utils/index.js +18 -0
- package/es/table/utils/isGroupColumn.d.ts +2 -0
- package/es/table/utils/isGroupColumn.js +7 -0
- package/es/table/utils/isLeafNode.d.ts +2 -0
- package/es/table/utils/isLeafNode.js +4 -0
- package/es/table/utils/layeredFilter.d.ts +2 -0
- package/es/table/utils/layeredFilter.js +25 -0
- package/es/table/utils/layeredSort.d.ts +5 -0
- package/es/table/utils/layeredSort.js +26 -0
- package/es/table/utils/makeRecursiveMapper.d.ts +9 -0
- package/es/table/utils/makeRecursiveMapper.js +76 -0
- package/es/table/utils/mergeCellProps.d.ts +8 -0
- package/es/table/utils/mergeCellProps.js +67 -0
- package/es/table/utils/others.d.ts +16 -0
- package/es/table/utils/others.js +80 -0
- package/es/table/utils/proto.d.ts +21 -0
- package/es/table/utils/proto.js +106 -0
- package/es/table/utils/smartCompare.d.ts +9 -0
- package/es/table/utils/smartCompare.js +51 -0
- package/es/table/utils/traverseColumn.d.ts +11 -0
- package/es/table/utils/traverseColumn.js +88 -0
- package/es/table/utils/tree-data-helpers/StrictTreeDataHelper.d.ts +22 -0
- package/es/table/utils/tree-data-helpers/StrictTreeDataHelper.js +138 -0
- package/es/table/utils/tree-data-helpers/TreeDataHelper.d.ts +26 -0
- package/es/table/utils/tree-data-helpers/TreeDataHelper.js +337 -0
- package/lib/_utils/arrayUtil.d.ts +5 -0
- package/lib/_utils/arrayUtil.js +26 -0
- package/lib/_utils/devwarning.d.ts +1 -0
- package/lib/_utils/devwarning.js +21 -0
- package/lib/_utils/formatUtil.d.ts +46 -0
- package/lib/_utils/formatUtil.js +358 -0
- package/lib/_utils/hooks.d.ts +51 -0
- package/lib/_utils/hooks.js +187 -0
- package/lib/_utils/index.d.ts +8 -0
- package/lib/_utils/index.js +28 -0
- package/lib/_utils/numberUtil.d.ts +34 -0
- package/lib/_utils/numberUtil.js +202 -0
- package/lib/_utils/omit.d.ts +1 -0
- package/lib/_utils/omit.js +21 -0
- package/lib/_utils/react-children.d.ts +2 -0
- package/lib/_utils/react-children.js +20 -0
- package/lib/_utils/type.d.ts +12 -0
- package/lib/_utils/type.js +27 -0
- package/lib/_utils/usePopper.d.ts +29 -0
- package/lib/_utils/usePopper.js +574 -0
- package/lib/config-provider/ConfigContext.d.ts +22 -0
- package/lib/config-provider/ConfigContext.js +19 -0
- package/lib/config-provider/compDefaultProps.d.ts +8 -0
- package/lib/config-provider/compDefaultProps.js +17 -0
- package/lib/config-provider/configProvider.d.ts +11 -0
- package/lib/config-provider/configProvider.js +56 -0
- package/lib/config-provider/defaultConfig.d.ts +10 -0
- package/lib/config-provider/defaultConfig.js +30 -0
- package/lib/config-provider/index.d.ts +6 -0
- package/lib/config-provider/index.js +37 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +45 -0
- package/lib/locale/index.d.ts +3 -0
- package/lib/locale/index.js +25 -0
- package/lib/locale/locale.d.ts +50 -0
- package/lib/locale/locale.js +277 -0
- package/lib/locale/zh-CN.d.ts +8 -0
- package/lib/locale/zh-CN.js +15 -0
- package/lib/style/color/colors.less +2 -0
- package/lib/style/components.less +1 -0
- package/lib/style/core/index.less +2 -0
- package/lib/style/core/motion/other.less +28 -0
- package/lib/style/core/motion/slide.less +53 -0
- package/lib/style/core/motion.less +2 -0
- package/lib/style/core/reset.less +186 -0
- package/lib/style/css.js +3 -0
- package/lib/style/index.css +410 -0
- package/lib/style/index.d.ts +1 -0
- package/lib/style/index.js +3 -0
- package/lib/style/index.less +2 -0
- package/lib/style/mixins/index.less +19 -0
- package/lib/style/mixins/overlay.less +22 -0
- package/lib/style/mixins/reset.less +13 -0
- package/lib/style/themes/default.less +445 -0
- package/lib/style/themes/index.less +1 -0
- package/lib/table/base/calculations.d.ts +5 -0
- package/lib/table/base/calculations.js +385 -0
- package/lib/table/base/colgroup.d.ts +5 -0
- package/lib/table/base/colgroup.js +33 -0
- package/lib/table/base/empty.d.ts +9 -0
- package/lib/table/base/empty.js +54 -0
- package/lib/table/base/header.d.ts +5 -0
- package/lib/table/base/header.js +340 -0
- package/lib/table/base/helpers/SpanManager.d.ts +9 -0
- package/lib/table/base/helpers/SpanManager.js +59 -0
- package/lib/table/base/helpers/TableDOMUtils.d.ts +18 -0
- package/lib/table/base/helpers/TableDOMUtils.js +113 -0
- package/lib/table/base/helpers/__test__/SpanManager.test.d.ts +1 -0
- package/lib/table/base/helpers/__test__/SpanManager.test.js +23 -0
- package/lib/table/base/helpers/__test__/TableDOMUtils.test.d.ts +1 -0
- package/lib/table/base/helpers/__test__/TableDOMUtils.test.js +41 -0
- package/lib/table/base/helpers/__test__/rowHeightManager.test.d.ts +1 -0
- package/lib/table/base/helpers/__test__/rowHeightManager.test.js +33 -0
- package/lib/table/base/helpers/__test__/visible-part.test.d.ts +1 -0
- package/lib/table/base/helpers/__test__/visible-part.test.js +31 -0
- package/lib/table/base/helpers/rowHeightManager.d.ts +7 -0
- package/lib/table/base/helpers/rowHeightManager.js +170 -0
- package/lib/table/base/helpers/visible-part.d.ts +23 -0
- package/lib/table/base/helpers/visible-part.js +72 -0
- package/lib/table/base/html-table.d.ts +15 -0
- package/lib/table/base/html-table.js +149 -0
- package/lib/table/base/index.d.ts +3 -0
- package/lib/table/base/index.js +21 -0
- package/lib/table/base/interfaces.d.ts +54 -0
- package/lib/table/base/interfaces.js +0 -0
- package/lib/table/base/loading.d.ts +13 -0
- package/lib/table/base/loading.js +71 -0
- package/lib/table/base/styles.d.ts +132 -0
- package/lib/table/base/styles.js +136 -0
- package/lib/table/base/table.d.ts +150 -0
- package/lib/table/base/table.js +773 -0
- package/lib/table/base/utils.d.ts +36 -0
- package/lib/table/base/utils.js +234 -0
- package/lib/table/common-views.d.ts +24 -0
- package/lib/table/common-views.js +90 -0
- package/lib/table/index.d.ts +6 -0
- package/lib/table/index.js +85 -0
- package/lib/table/interfaces.d.ts +98 -0
- package/lib/table/interfaces.js +0 -0
- package/lib/table/internals.d.ts +14 -0
- package/lib/table/internals.js +64 -0
- package/lib/table/pipeline/features/__test__/multiSelect.test.d.ts +1 -0
- package/lib/table/pipeline/features/__test__/multiSelect.test.js +163 -0
- package/lib/table/pipeline/features/__test__/rowDetail.test.d.ts +1 -0
- package/lib/table/pipeline/features/__test__/rowDetail.test.js +230 -0
- package/lib/table/pipeline/features/__test__/rowGrouping.test.d.ts +1 -0
- package/lib/table/pipeline/features/__test__/rowGrouping.test.js +129 -0
- package/lib/table/pipeline/features/__test__/singleSelect.test.d.ts +1 -0
- package/lib/table/pipeline/features/__test__/singleSelect.test.js +201 -0
- package/lib/table/pipeline/features/__test__/sort.test.d.ts +1 -0
- package/lib/table/pipeline/features/__test__/sort.test.js +218 -0
- package/lib/table/pipeline/features/__test__/tips.test.d.ts +1 -0
- package/lib/table/pipeline/features/__test__/tips.test.js +133 -0
- package/lib/table/pipeline/features/__test__/treeMode.test.d.ts +1 -0
- package/lib/table/pipeline/features/__test__/treeMode.test.js +206 -0
- package/lib/table/pipeline/features/autoFill.d.ts +4 -0
- package/lib/table/pipeline/features/autoFill.js +80 -0
- package/lib/table/pipeline/features/autoRowSpan.d.ts +2 -0
- package/lib/table/pipeline/features/autoRowSpan.js +84 -0
- package/lib/table/pipeline/features/buildTree.d.ts +2 -0
- package/lib/table/pipeline/features/buildTree.js +16 -0
- package/lib/table/pipeline/features/columnDrag.d.ts +6 -0
- package/lib/table/pipeline/features/columnDrag.js +278 -0
- package/lib/table/pipeline/features/columnFilter.d.ts +20 -0
- package/lib/table/pipeline/features/columnFilter.js +197 -0
- package/lib/table/pipeline/features/columnHover.d.ts +12 -0
- package/lib/table/pipeline/features/columnHover.js +62 -0
- package/lib/table/pipeline/features/columnRangeHover.d.ts +15 -0
- package/lib/table/pipeline/features/columnRangeHover.js +95 -0
- package/lib/table/pipeline/features/columnResizeWidth.d.ts +21 -0
- package/lib/table/pipeline/features/columnResizeWidth.js +192 -0
- package/lib/table/pipeline/features/contextMenu.d.ts +14 -0
- package/lib/table/pipeline/features/contextMenu.js +397 -0
- package/lib/table/pipeline/features/filter/DefaultFilterContent.d.ts +4 -0
- package/lib/table/pipeline/features/filter/DefaultFilterContent.js +112 -0
- package/lib/table/pipeline/features/filter/Filter.d.ts +17 -0
- package/lib/table/pipeline/features/filter/Filter.js +129 -0
- package/lib/table/pipeline/features/filter/FilterPanel.d.ts +20 -0
- package/lib/table/pipeline/features/filter/FilterPanel.js +98 -0
- package/lib/table/pipeline/features/filter/__test__/Filter.test.d.ts +1 -0
- package/lib/table/pipeline/features/filter/__test__/Filter.test.js +36 -0
- package/lib/table/pipeline/features/filter/index.d.ts +4 -0
- package/lib/table/pipeline/features/filter/index.js +39 -0
- package/lib/table/pipeline/features/filter/util.d.ts +10 -0
- package/lib/table/pipeline/features/filter/util.js +77 -0
- package/lib/table/pipeline/features/index.d.ts +16 -0
- package/lib/table/pipeline/features/index.js +141 -0
- package/lib/table/pipeline/features/multiSelect.d.ts +27 -0
- package/lib/table/pipeline/features/multiSelect.js +227 -0
- package/lib/table/pipeline/features/rowDetail.d.ts +35 -0
- package/lib/table/pipeline/features/rowDetail.js +283 -0
- package/lib/table/pipeline/features/rowGrouping.d.ts +14 -0
- package/lib/table/pipeline/features/rowGrouping.js +227 -0
- package/lib/table/pipeline/features/singleSelect.d.ts +23 -0
- package/lib/table/pipeline/features/singleSelect.js +138 -0
- package/lib/table/pipeline/features/sort.d.ts +40 -0
- package/lib/table/pipeline/features/sort.js +361 -0
- package/lib/table/pipeline/features/tips.d.ts +2 -0
- package/lib/table/pipeline/features/tips.js +73 -0
- package/lib/table/pipeline/features/treeMode.d.ts +37 -0
- package/lib/table/pipeline/features/treeMode.js +266 -0
- package/lib/table/pipeline/features/treeSelect.d.ts +38 -0
- package/lib/table/pipeline/features/treeSelect.js +169 -0
- package/lib/table/pipeline/index.d.ts +3 -0
- package/lib/table/pipeline/index.js +26 -0
- package/lib/table/pipeline/pipeline.d.ts +85 -0
- package/lib/table/pipeline/pipeline.js +291 -0
- package/lib/table/pivot/cross-table/buildCrossTable.d.ts +14 -0
- package/lib/table/pivot/cross-table/buildCrossTable.js +313 -0
- package/lib/table/pivot/cross-table/constants.d.ts +1 -0
- package/lib/table/pivot/cross-table/constants.js +8 -0
- package/lib/table/pivot/cross-table/cross-table.d.ts +18 -0
- package/lib/table/pivot/cross-table/cross-table.js +71 -0
- package/lib/table/pivot/cross-table/index.d.ts +4 -0
- package/lib/table/pivot/cross-table/index.js +31 -0
- package/lib/table/pivot/cross-table/interfaces.d.ts +29 -0
- package/lib/table/pivot/cross-table/interfaces.js +0 -0
- package/lib/table/pivot/cross-table/internals.d.ts +13 -0
- package/lib/table/pivot/cross-table/internals.js +0 -0
- package/lib/table/pivot/cross-tree-table/buildCrossTreeTable.d.ts +14 -0
- package/lib/table/pivot/cross-tree-table/buildCrossTreeTable.js +240 -0
- package/lib/table/pivot/cross-tree-table/cross-tree-table.d.ts +38 -0
- package/lib/table/pivot/cross-tree-table/cross-tree-table.js +144 -0
- package/lib/table/pivot/cross-tree-table/index.d.ts +2 -0
- package/lib/table/pivot/cross-tree-table/index.js +23 -0
- package/lib/table/pivot/pivot-utils/buildDrillTree.d.ts +16 -0
- package/lib/table/pivot/pivot-utils/buildDrillTree.js +106 -0
- package/lib/table/pivot/pivot-utils/builders.d.ts +26 -0
- package/lib/table/pivot/pivot-utils/builders.js +272 -0
- package/lib/table/pivot/pivot-utils/convert-utils.d.ts +31 -0
- package/lib/table/pivot/pivot-utils/convert-utils.js +204 -0
- package/lib/table/pivot/pivot-utils/index.d.ts +5 -0
- package/lib/table/pivot/pivot-utils/index.js +59 -0
- package/lib/table/pivot/pivot-utils/interfaces.d.ts +12 -0
- package/lib/table/pivot/pivot-utils/interfaces.js +0 -0
- package/lib/table/pivot/pivot-utils/simpleEncode.d.ts +1 -0
- package/lib/table/pivot/pivot-utils/simpleEncode.js +14 -0
- package/lib/table/style/css.js +5 -0
- package/lib/table/style/index.css +0 -0
- package/lib/table/style/index.d.ts +2 -0
- package/lib/table/style/index.js +5 -0
- package/lib/table/style/index.less +1 -0
- package/lib/table/transforms/autoRowSpan.d.ts +3 -0
- package/lib/table/transforms/autoRowSpan.js +86 -0
- package/lib/table/transforms/autoWidth.d.ts +25 -0
- package/lib/table/transforms/autoWidth.js +187 -0
- package/lib/table/transforms/buildTree.d.ts +3 -0
- package/lib/table/transforms/buildTree.js +23 -0
- package/lib/table/transforms/columnHover.d.ts +17 -0
- package/lib/table/transforms/columnHover.js +74 -0
- package/lib/table/transforms/columnRangeHover.d.ts +17 -0
- package/lib/table/transforms/columnRangeHover.js +110 -0
- package/lib/table/transforms/columnResize.d.ts +27 -0
- package/lib/table/transforms/columnResize.js +176 -0
- package/lib/table/transforms/flatten.d.ts +3 -0
- package/lib/table/transforms/flatten.js +24 -0
- package/lib/table/transforms/index.d.ts +12 -0
- package/lib/table/transforms/index.js +131 -0
- package/lib/table/transforms/orderField.d.ts +3 -0
- package/lib/table/transforms/orderField.js +33 -0
- package/lib/table/transforms/sort.d.ts +43 -0
- package/lib/table/transforms/sort.js +369 -0
- package/lib/table/transforms/tips.d.ts +8 -0
- package/lib/table/transforms/tips.js +71 -0
- package/lib/table/transforms/treeMode.d.ts +30 -0
- package/lib/table/transforms/treeMode.js +286 -0
- package/lib/table/transforms/visible.d.ts +5 -0
- package/lib/table/transforms/visible.js +31 -0
- package/lib/table/transforms/warnTransformsDeprecated.d.ts +1 -0
- package/lib/table/transforms/warnTransformsDeprecated.js +19 -0
- package/lib/table/use/useResizeObserver.d.ts +2 -0
- package/lib/table/use/useResizeObserver.js +32 -0
- package/lib/table/utils/applyTransforms.d.ts +6 -0
- package/lib/table/utils/applyTransforms.js +24 -0
- package/lib/table/utils/buildTree.d.ts +36 -0
- package/lib/table/utils/buildTree.js +140 -0
- package/lib/table/utils/collectNodes.d.ts +8 -0
- package/lib/table/utils/collectNodes.js +72 -0
- package/lib/table/utils/console.d.ts +11 -0
- package/lib/table/utils/console.js +68 -0
- package/lib/table/utils/copyToClipboard.d.ts +3 -0
- package/lib/table/utils/copyToClipboard.js +40 -0
- package/lib/table/utils/element.d.ts +42 -0
- package/lib/table/utils/element.js +243 -0
- package/lib/table/utils/exportTableAsExcel.d.ts +4 -0
- package/lib/table/utils/exportTableAsExcel.js +205 -0
- package/lib/table/utils/getTreeDepth.d.ts +3 -0
- package/lib/table/utils/getTreeDepth.js +54 -0
- package/lib/table/utils/groupBy.d.ts +1 -0
- package/lib/table/utils/groupBy.js +48 -0
- package/lib/table/utils/index.d.ts +18 -0
- package/lib/table/utils/index.js +187 -0
- package/lib/table/utils/isGroupColumn.d.ts +2 -0
- package/lib/table/utils/isGroupColumn.js +17 -0
- package/lib/table/utils/isLeafNode.d.ts +2 -0
- package/lib/table/utils/isLeafNode.js +11 -0
- package/lib/table/utils/layeredFilter.d.ts +2 -0
- package/lib/table/utils/layeredFilter.js +38 -0
- package/lib/table/utils/layeredSort.d.ts +5 -0
- package/lib/table/utils/layeredSort.js +37 -0
- package/lib/table/utils/makeRecursiveMapper.d.ts +9 -0
- package/lib/table/utils/makeRecursiveMapper.js +94 -0
- package/lib/table/utils/mergeCellProps.d.ts +8 -0
- package/lib/table/utils/mergeCellProps.js +78 -0
- package/lib/table/utils/others.d.ts +16 -0
- package/lib/table/utils/others.js +108 -0
- package/lib/table/utils/proto.d.ts +21 -0
- package/lib/table/utils/proto.js +117 -0
- package/lib/table/utils/smartCompare.d.ts +9 -0
- package/lib/table/utils/smartCompare.js +58 -0
- package/lib/table/utils/traverseColumn.d.ts +11 -0
- package/lib/table/utils/traverseColumn.js +103 -0
- package/lib/table/utils/tree-data-helpers/StrictTreeDataHelper.d.ts +22 -0
- package/lib/table/utils/tree-data-helpers/StrictTreeDataHelper.js +154 -0
- package/lib/table/utils/tree-data-helpers/TreeDataHelper.d.ts +26 -0
- package/lib/table/utils/tree-data-helpers/TreeDataHelper.js +358 -0
- package/package.json +213 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { noop } from 'rxjs';
|
|
3
|
+
import { Table, TableProps } from '../../base';
|
|
4
|
+
import { CellProps } from '../../interfaces';
|
|
5
|
+
import { CrossTableLeftMetaColumn, LeftCrossTreeNode, TopCrossTreeNode } from '../cross-table';
|
|
6
|
+
export interface CrossTreeTableProps extends Omit<TableProps, 'dataSource' | 'columns' | 'primaryKey'> {
|
|
7
|
+
BaseTableComponent?: any;
|
|
8
|
+
baseTableRef?: React.Ref<Table>;
|
|
9
|
+
primaryColumn: CrossTableLeftMetaColumn;
|
|
10
|
+
leftTree: LeftCrossTreeNode[];
|
|
11
|
+
topTree: TopCrossTreeNode[];
|
|
12
|
+
defaultOpenKeys?: string[];
|
|
13
|
+
openKeys?: string[];
|
|
14
|
+
onChangeOpenKeys?(nextOpenKeys: string[]): void;
|
|
15
|
+
indentSize?: number;
|
|
16
|
+
isLeafNode?(node: any, nodeMeta: {
|
|
17
|
+
depth: number;
|
|
18
|
+
expanded: boolean;
|
|
19
|
+
rowKey: string;
|
|
20
|
+
}): boolean;
|
|
21
|
+
getValue(leftNode: LeftCrossTreeNode, topNode: TopCrossTreeNode, leftDepth: number, topDepth: number): any;
|
|
22
|
+
render?(value: any, leftNode: LeftCrossTreeNode, topNode: TopCrossTreeNode, leftDepth: number, topDepth: number): React.ReactNode;
|
|
23
|
+
getCellProps?(value: any, leftNode: LeftCrossTreeNode, topNode: TopCrossTreeNode, leftDepth: number, topDepth: number): CellProps;
|
|
24
|
+
}
|
|
25
|
+
export default class CrossTreeTable extends React.Component<CrossTreeTableProps, {
|
|
26
|
+
openKeys: string[];
|
|
27
|
+
}> {
|
|
28
|
+
static defaultProps: {
|
|
29
|
+
defaultOpenKeys: string[];
|
|
30
|
+
onChangeOpenKeys: typeof noop;
|
|
31
|
+
};
|
|
32
|
+
static getDerivedStateFromProps(nextProps: Readonly<CrossTreeTableProps>): {
|
|
33
|
+
openKeys: string[];
|
|
34
|
+
};
|
|
35
|
+
constructor(props: Readonly<CrossTreeTableProps>);
|
|
36
|
+
onChangeOpenKeys: (nextOpenKeys: string[]) => void;
|
|
37
|
+
render(): JSX.Element;
|
|
38
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/construct";
|
|
2
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
3
|
+
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
4
|
+
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
5
|
+
import _inherits from "@babel/runtime-corejs3/helpers/inherits";
|
|
6
|
+
import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
|
|
7
|
+
import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
|
|
8
|
+
|
|
9
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
+
|
|
11
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
|
+
|
|
13
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
14
|
+
|
|
15
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
16
|
+
var t = {};
|
|
17
|
+
|
|
18
|
+
for (var p in s) {
|
|
19
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (s != null && typeof _Object$getOwnPropertySymbols === "function") for (var i = 0, p = _Object$getOwnPropertySymbols(s); i < p.length; i++) {
|
|
23
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
24
|
+
}
|
|
25
|
+
return t;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
import React from 'react';
|
|
29
|
+
import { noop } from 'rxjs';
|
|
30
|
+
import { Table } from '../../base';
|
|
31
|
+
import { ROW_KEY } from '../cross-table';
|
|
32
|
+
import buildCrossTreeTable from './buildCrossTreeTable';
|
|
33
|
+
|
|
34
|
+
var CrossTreeTable = /*#__PURE__*/function (_React$Component) {
|
|
35
|
+
_inherits(CrossTreeTable, _React$Component);
|
|
36
|
+
|
|
37
|
+
var _super = _createSuper(CrossTreeTable);
|
|
38
|
+
|
|
39
|
+
function CrossTreeTable(props) {
|
|
40
|
+
var _this;
|
|
41
|
+
|
|
42
|
+
_classCallCheck(this, CrossTreeTable);
|
|
43
|
+
|
|
44
|
+
_this = _super.call(this, props);
|
|
45
|
+
|
|
46
|
+
_this.onChangeOpenKeys = function (nextOpenKeys) {
|
|
47
|
+
_this.props.onChangeOpenKeys(nextOpenKeys);
|
|
48
|
+
|
|
49
|
+
if (!('openKeys' in _this.props)) {
|
|
50
|
+
_this.setState({
|
|
51
|
+
openKeys: nextOpenKeys
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
_this.state = {
|
|
57
|
+
openKeys: props.defaultOpenKeys
|
|
58
|
+
};
|
|
59
|
+
return _this;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
_createClass(CrossTreeTable, [{
|
|
63
|
+
key: "render",
|
|
64
|
+
value: function render() {
|
|
65
|
+
var _a = this.props,
|
|
66
|
+
_a$BaseTableComponent = _a.BaseTableComponent,
|
|
67
|
+
BaseTableComponent = _a$BaseTableComponent === void 0 ? Table : _a$BaseTableComponent,
|
|
68
|
+
leftTree = _a.leftTree,
|
|
69
|
+
topTree = _a.topTree,
|
|
70
|
+
getValue = _a.getValue,
|
|
71
|
+
getCellProps = _a.getCellProps,
|
|
72
|
+
primaryColumn = _a.primaryColumn,
|
|
73
|
+
render = _a.render,
|
|
74
|
+
openKeysProp = _a.openKeys,
|
|
75
|
+
defaultOpenKeys = _a.defaultOpenKeys,
|
|
76
|
+
onChangeOpenKeys = _a.onChangeOpenKeys,
|
|
77
|
+
indentSize = _a.indentSize,
|
|
78
|
+
isLeafNode = _a.isLeafNode,
|
|
79
|
+
baseTableRef = _a.baseTableRef,
|
|
80
|
+
others = __rest(_a, ["BaseTableComponent", "leftTree", "topTree", "getValue", "getCellProps", "primaryColumn", "render", "openKeys", "defaultOpenKeys", "onChangeOpenKeys", "indentSize", "isLeafNode", "baseTableRef"]);
|
|
81
|
+
|
|
82
|
+
var openKeys = openKeysProp !== null && openKeysProp !== void 0 ? openKeysProp : this.state.openKeys;
|
|
83
|
+
|
|
84
|
+
var _buildCrossTreeTable = buildCrossTreeTable({
|
|
85
|
+
leftTree: leftTree,
|
|
86
|
+
topTree: topTree,
|
|
87
|
+
getValue: getValue,
|
|
88
|
+
getCellProps: getCellProps,
|
|
89
|
+
render: render,
|
|
90
|
+
primaryColumn: primaryColumn,
|
|
91
|
+
openKeys: openKeys,
|
|
92
|
+
onChangeOpenKeys: this.onChangeOpenKeys,
|
|
93
|
+
indentSize: indentSize,
|
|
94
|
+
isLeafNode: isLeafNode
|
|
95
|
+
}),
|
|
96
|
+
dataSource = _buildCrossTreeTable.dataSource,
|
|
97
|
+
columns = _buildCrossTreeTable.columns;
|
|
98
|
+
|
|
99
|
+
return /*#__PURE__*/React.createElement(BaseTableComponent, _extends({
|
|
100
|
+
ref: baseTableRef
|
|
101
|
+
}, others, {
|
|
102
|
+
primaryKey: ROW_KEY,
|
|
103
|
+
dataSource: dataSource,
|
|
104
|
+
columns: columns
|
|
105
|
+
}));
|
|
106
|
+
}
|
|
107
|
+
}], [{
|
|
108
|
+
key: "getDerivedStateFromProps",
|
|
109
|
+
value: function getDerivedStateFromProps(nextProps) {
|
|
110
|
+
if ('openKeys' in nextProps) {
|
|
111
|
+
return {
|
|
112
|
+
openKeys: nextProps.openKeys
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
}]);
|
|
119
|
+
|
|
120
|
+
return CrossTreeTable;
|
|
121
|
+
}(React.Component);
|
|
122
|
+
|
|
123
|
+
export { CrossTreeTable as default };
|
|
124
|
+
CrossTreeTable.defaultProps = {
|
|
125
|
+
defaultOpenKeys: [],
|
|
126
|
+
onChangeOpenKeys: noop
|
|
127
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DrillNode } from './interfaces';
|
|
2
|
+
export interface BuildDrillTreeOptions<T extends DrillNode> {
|
|
3
|
+
/** 是否生成顶层的「总计」节点,默认不生成 */
|
|
4
|
+
includeTopWrapper?: boolean;
|
|
5
|
+
/** 生成顶层节点时,顶层节点内的文本值,默认为「总计」 */
|
|
6
|
+
totalValue?: string;
|
|
7
|
+
/** 自定义的编码函数,用于根据下钻的值序列生成唯一的字符串.
|
|
8
|
+
* 该参数留空 表示使用默认的编码方式 */
|
|
9
|
+
encode?(path: string[]): string;
|
|
10
|
+
/** 判断一个节点是否展开,没有展开的节点将不进行下钻 */
|
|
11
|
+
isExpand?(key: string): boolean;
|
|
12
|
+
/** 是否强制展开总计节点,默认为 true */
|
|
13
|
+
enforceExpandTotalNode?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** 根据指定的 code 序列计算下钻树 */
|
|
16
|
+
export default function buildDrillTree(data: any[], codes: string[], { encode, totalValue, includeTopWrapper, isExpand, enforceExpandTotalNode, }?: BuildDrillTreeOptions<DrillNode>): DrillNode[];
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import _Object$keys2 from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
2
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
3
|
+
import { groupBy } from '../../utils';
|
|
4
|
+
import { always } from '../../utils/others';
|
|
5
|
+
import simpleEncode from './simpleEncode';
|
|
6
|
+
/** 根据指定的 code 序列计算下钻树 */
|
|
7
|
+
|
|
8
|
+
export default function buildDrillTree(data, codes) {
|
|
9
|
+
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
10
|
+
_ref$encode = _ref.encode,
|
|
11
|
+
encode = _ref$encode === void 0 ? simpleEncode : _ref$encode,
|
|
12
|
+
_ref$totalValue = _ref.totalValue,
|
|
13
|
+
totalValue = _ref$totalValue === void 0 ? '总计' : _ref$totalValue,
|
|
14
|
+
_ref$includeTopWrappe = _ref.includeTopWrapper,
|
|
15
|
+
includeTopWrapper = _ref$includeTopWrappe === void 0 ? false : _ref$includeTopWrappe,
|
|
16
|
+
_ref$isExpand = _ref.isExpand,
|
|
17
|
+
isExpand = _ref$isExpand === void 0 ? always(true) : _ref$isExpand,
|
|
18
|
+
_ref$enforceExpandTot = _ref.enforceExpandTotalNode,
|
|
19
|
+
enforceExpandTotalNode = _ref$enforceExpandTot === void 0 ? true : _ref$enforceExpandTot;
|
|
20
|
+
|
|
21
|
+
var emptyPath = [];
|
|
22
|
+
var totalKey = encode(emptyPath);
|
|
23
|
+
var array;
|
|
24
|
+
var hasChild = false;
|
|
25
|
+
|
|
26
|
+
if (codes.length === 0) {
|
|
27
|
+
array = [];
|
|
28
|
+
} else if (!enforceExpandTotalNode && !isExpand(totalKey)) {
|
|
29
|
+
array = [];
|
|
30
|
+
hasChild = data.length > 0;
|
|
31
|
+
} else {
|
|
32
|
+
array = dfs(data, []);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (includeTopWrapper) {
|
|
36
|
+
var rootNode = {
|
|
37
|
+
key: totalKey,
|
|
38
|
+
value: totalValue,
|
|
39
|
+
path: emptyPath,
|
|
40
|
+
children: array
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
if (hasChild) {
|
|
44
|
+
rootNode.hasChild = hasChild;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return [rootNode];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (includeTopWrapper) {
|
|
51
|
+
return [{
|
|
52
|
+
key: totalKey,
|
|
53
|
+
value: totalValue,
|
|
54
|
+
path: emptyPath,
|
|
55
|
+
children: array
|
|
56
|
+
}];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return array;
|
|
60
|
+
|
|
61
|
+
function dfs(slice, path) {
|
|
62
|
+
var depth = path.length;
|
|
63
|
+
var array = [];
|
|
64
|
+
var code = codes[depth];
|
|
65
|
+
var groups = groupBy(slice, function (row) {
|
|
66
|
+
return row[code];
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
for (var _i = 0, _Object$keys = _Object$keys2(groups); _i < _Object$keys.length; _i++) {
|
|
70
|
+
var groupKey = _Object$keys[_i];
|
|
71
|
+
path.push(groupKey);
|
|
72
|
+
var node = {
|
|
73
|
+
key: encode(path),
|
|
74
|
+
value: groupKey,
|
|
75
|
+
path: _sliceInstanceProperty(path).call(path)
|
|
76
|
+
};
|
|
77
|
+
array.push(node);
|
|
78
|
+
var group = groups[groupKey];
|
|
79
|
+
|
|
80
|
+
if (group.length > 0 && depth < codes.length - 1) {
|
|
81
|
+
if (isExpand(node.key)) {
|
|
82
|
+
node.children = dfs(group, path);
|
|
83
|
+
} else {
|
|
84
|
+
node.hasChild = true;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
path.pop();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return array;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DrillNode, RecordMatrix } from './interfaces';
|
|
2
|
+
export interface BuildingCtx {
|
|
3
|
+
peculiarity: Set<string>;
|
|
4
|
+
}
|
|
5
|
+
export interface BuildRecordMatrixConfig {
|
|
6
|
+
leftCodes: string[];
|
|
7
|
+
topCodes: string[];
|
|
8
|
+
data: any[];
|
|
9
|
+
aggregate?(slice: any[], ctx: BuildingCtx): any;
|
|
10
|
+
encode?(valuePath: string[]): string;
|
|
11
|
+
isLeftExpand?(key: string): boolean;
|
|
12
|
+
isTopExpand?(key: string): boolean;
|
|
13
|
+
prebuiltLeftTree?: DrillNode[];
|
|
14
|
+
prebuiltTopTree?: DrillNode[];
|
|
15
|
+
}
|
|
16
|
+
/** 根据表格左侧与上方的下钻树,从全量明细数据中计算对应的数据立方 */
|
|
17
|
+
export declare function buildRecordMatrix({ data, leftCodes, topCodes, aggregate, encode, isLeftExpand, isTopExpand, prebuiltLeftTree, prebuiltTopTree, }: BuildRecordMatrixConfig): RecordMatrix;
|
|
18
|
+
/** buildRecordMatrix 的简化版本,只能处理一个维度序列,返回一个 Map。
|
|
19
|
+
* 相当于只处理 matrix 的第一行(汇总行) */
|
|
20
|
+
export declare function buildRecordMap({ codes, encode, data, aggregate, isExpand, }: {
|
|
21
|
+
codes: string[];
|
|
22
|
+
data: any[];
|
|
23
|
+
aggregate?(slice: any[], ctx: BuildingCtx): any;
|
|
24
|
+
encode?(valuePath: string[]): string;
|
|
25
|
+
isExpand?(key: string): boolean;
|
|
26
|
+
}): Map<string, any>;
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
2
|
+
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
3
|
+
import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
4
|
+
import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
|
|
5
|
+
import _getIterator from "@babel/runtime-corejs3/core-js/get-iterator";
|
|
6
|
+
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
7
|
+
|
|
8
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof _Symbol === "undefined" || _getIteratorMethod(o) == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = _getIterator(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
9
|
+
|
|
10
|
+
function _unsupportedIterableToArray(o, minLen) { var _context5; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context5 = Object.prototype.toString.call(o)).call(_context5, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
|
+
|
|
12
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
13
|
+
|
|
14
|
+
import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
15
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
16
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
17
|
+
import _Map from "@babel/runtime-corejs3/core-js-stable/map";
|
|
18
|
+
import { groupBy, isLeafNode } from '../../utils';
|
|
19
|
+
import { always, fromEntries } from '../../utils/others';
|
|
20
|
+
import buildDrillTree from './buildDrillTree';
|
|
21
|
+
import simpleEncode from './simpleEncode';
|
|
22
|
+
|
|
23
|
+
function fallbackAggregate(slice) {
|
|
24
|
+
return slice.length === 1 ? slice[0] : {};
|
|
25
|
+
}
|
|
26
|
+
/** 根据表格左侧与上方的下钻树,从全量明细数据中计算对应的数据立方 */
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
export function buildRecordMatrix(_ref) {
|
|
30
|
+
var data = _ref.data,
|
|
31
|
+
leftCodes = _ref.leftCodes,
|
|
32
|
+
topCodes = _ref.topCodes,
|
|
33
|
+
_ref$aggregate = _ref.aggregate,
|
|
34
|
+
aggregate = _ref$aggregate === void 0 ? fallbackAggregate : _ref$aggregate,
|
|
35
|
+
_ref$encode = _ref.encode,
|
|
36
|
+
encode = _ref$encode === void 0 ? simpleEncode : _ref$encode,
|
|
37
|
+
_ref$isLeftExpand = _ref.isLeftExpand,
|
|
38
|
+
isLeftExpand = _ref$isLeftExpand === void 0 ? always(true) : _ref$isLeftExpand,
|
|
39
|
+
_ref$isTopExpand = _ref.isTopExpand,
|
|
40
|
+
isTopExpand = _ref$isTopExpand === void 0 ? always(true) : _ref$isTopExpand,
|
|
41
|
+
prebuiltLeftTree = _ref.prebuiltLeftTree,
|
|
42
|
+
prebuiltTopTree = _ref.prebuiltTopTree;
|
|
43
|
+
var ctx = {
|
|
44
|
+
peculiarity: new _Set()
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
var _ref2 = prebuiltLeftTree !== null && prebuiltLeftTree !== void 0 ? prebuiltLeftTree : buildDrillTree(data, leftCodes, {
|
|
48
|
+
encode: encode,
|
|
49
|
+
includeTopWrapper: true,
|
|
50
|
+
isExpand: isLeftExpand
|
|
51
|
+
}),
|
|
52
|
+
_ref3 = _slicedToArray(_ref2, 1),
|
|
53
|
+
leftRootDrillNode = _ref3[0];
|
|
54
|
+
|
|
55
|
+
var _ref4 = prebuiltTopTree !== null && prebuiltTopTree !== void 0 ? prebuiltTopTree : buildDrillTree(data, topCodes, {
|
|
56
|
+
encode: encode,
|
|
57
|
+
includeTopWrapper: true,
|
|
58
|
+
isExpand: isTopExpand
|
|
59
|
+
}),
|
|
60
|
+
_ref5 = _slicedToArray(_ref4, 1),
|
|
61
|
+
topRootDrillNode = _ref5[0];
|
|
62
|
+
|
|
63
|
+
var transientMatrixRow = buildByLeft(ctx, data, leftRootDrillNode, 0);
|
|
64
|
+
return makeMatrix(transientMatrixRow);
|
|
65
|
+
|
|
66
|
+
function buildByLeft(ctx, slice, drillNode, depth) {
|
|
67
|
+
var children = null;
|
|
68
|
+
var col;
|
|
69
|
+
|
|
70
|
+
if (isLeafNode(drillNode)) {
|
|
71
|
+
col = buildByTop(ctx, slice, topRootDrillNode, 0);
|
|
72
|
+
} else {
|
|
73
|
+
children = [];
|
|
74
|
+
var code = leftCodes[depth];
|
|
75
|
+
var groups = groupBy(slice, function (dwdRow) {
|
|
76
|
+
return dwdRow[code];
|
|
77
|
+
});
|
|
78
|
+
ctx.peculiarity.add(code);
|
|
79
|
+
|
|
80
|
+
var _iterator = _createForOfIteratorHelper(drillNode.children),
|
|
81
|
+
_step;
|
|
82
|
+
|
|
83
|
+
try {
|
|
84
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
85
|
+
var child = _step.value;
|
|
86
|
+
var group = groups[child.value];
|
|
87
|
+
|
|
88
|
+
if (group) {
|
|
89
|
+
children.push(buildByLeft(ctx, group, child, depth + 1));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
} catch (err) {
|
|
93
|
+
_iterator.e(err);
|
|
94
|
+
} finally {
|
|
95
|
+
_iterator.f();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
ctx.peculiarity.delete(code);
|
|
99
|
+
col = mergeColsByTopTree(ctx, _mapInstanceProperty(children).call(children, function (child) {
|
|
100
|
+
return child.col;
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
leftKey: drillNode.key,
|
|
106
|
+
children: children,
|
|
107
|
+
col: col
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function buildByTop(ctx, slice, drillNode, depth) {
|
|
112
|
+
var children = null;
|
|
113
|
+
var record;
|
|
114
|
+
|
|
115
|
+
if (isLeafNode(drillNode)) {
|
|
116
|
+
record = aggregate(slice, ctx);
|
|
117
|
+
} else {
|
|
118
|
+
children = [];
|
|
119
|
+
var code = topCodes[depth];
|
|
120
|
+
var groups = groupBy(slice, function (dwdRow) {
|
|
121
|
+
return dwdRow[code];
|
|
122
|
+
});
|
|
123
|
+
ctx.peculiarity.add(code);
|
|
124
|
+
|
|
125
|
+
var _iterator2 = _createForOfIteratorHelper(drillNode.children),
|
|
126
|
+
_step2;
|
|
127
|
+
|
|
128
|
+
try {
|
|
129
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
130
|
+
var child = _step2.value;
|
|
131
|
+
var group = groups[child.value];
|
|
132
|
+
|
|
133
|
+
if (group) {
|
|
134
|
+
children.push(buildByTop(ctx, group, child, depth + 1));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
} catch (err) {
|
|
138
|
+
_iterator2.e(err);
|
|
139
|
+
} finally {
|
|
140
|
+
_iterator2.f();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
ctx.peculiarity.delete(code);
|
|
144
|
+
record = aggregate(_mapInstanceProperty(children).call(children, function (child) {
|
|
145
|
+
return child.record;
|
|
146
|
+
}), ctx);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return {
|
|
150
|
+
topKey: drillNode.key,
|
|
151
|
+
topValue: drillNode.value,
|
|
152
|
+
children: children,
|
|
153
|
+
record: record
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function mergeColsByTopTree(ctx, colsToMerge) {
|
|
158
|
+
return dfs(ctx, colsToMerge, topRootDrillNode, 0);
|
|
159
|
+
|
|
160
|
+
function dfs(ctx, cols, topDrillNode, depth) {
|
|
161
|
+
var children = null;
|
|
162
|
+
var record = aggregate(_mapInstanceProperty(cols).call(cols, function (c) {
|
|
163
|
+
return c.record;
|
|
164
|
+
}), ctx);
|
|
165
|
+
|
|
166
|
+
if (!isLeafNode(topDrillNode)) {
|
|
167
|
+
var _context, _context3;
|
|
168
|
+
|
|
169
|
+
var topCode = topCodes[depth];
|
|
170
|
+
ctx.peculiarity.add(topCode);
|
|
171
|
+
var drillChildDict = fromEntries(_mapInstanceProperty(_context = topDrillNode.children).call(_context, function (child) {
|
|
172
|
+
return [child.value, child];
|
|
173
|
+
}));
|
|
174
|
+
|
|
175
|
+
var colChildDictArray = _mapInstanceProperty(cols).call(cols, function (col) {
|
|
176
|
+
var _context2;
|
|
177
|
+
|
|
178
|
+
return fromEntries(_mapInstanceProperty(_context2 = col.children).call(_context2, function (child) {
|
|
179
|
+
return [child.topValue, child];
|
|
180
|
+
}));
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
children = _mapInstanceProperty(_context3 = topDrillNode.children).call(_context3, function (item) {
|
|
184
|
+
var _context4;
|
|
185
|
+
|
|
186
|
+
var childCols = _filterInstanceProperty(_context4 = _mapInstanceProperty(colChildDictArray).call(colChildDictArray, function (colChildDict) {
|
|
187
|
+
return colChildDict[item.value];
|
|
188
|
+
})).call(_context4, Boolean);
|
|
189
|
+
|
|
190
|
+
return dfs(ctx, childCols, drillChildDict[item.value], depth + 1);
|
|
191
|
+
});
|
|
192
|
+
ctx.peculiarity.delete(topCode);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return {
|
|
196
|
+
topKey: topDrillNode.key,
|
|
197
|
+
topValue: topDrillNode.value,
|
|
198
|
+
record: record,
|
|
199
|
+
children: children
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function makeMatrix(rootRow) {
|
|
205
|
+
var result = new _Map();
|
|
206
|
+
dfsRow(result, rootRow);
|
|
207
|
+
return result;
|
|
208
|
+
|
|
209
|
+
function dfsRow(matrix, row) {
|
|
210
|
+
var subMap = new _Map();
|
|
211
|
+
matrix.set(row.leftKey, subMap);
|
|
212
|
+
dfsCol(subMap, row.col);
|
|
213
|
+
|
|
214
|
+
if (!isLeafNode(row)) {
|
|
215
|
+
row.children.forEach(function (childRow) {
|
|
216
|
+
dfsRow(matrix, childRow);
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function dfsCol(subMap, col) {
|
|
222
|
+
subMap.set(col.topKey, col.record);
|
|
223
|
+
|
|
224
|
+
if (!isLeafNode(col)) {
|
|
225
|
+
col.children.forEach(function (childCol) {
|
|
226
|
+
dfsCol(subMap, childCol);
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
/** buildRecordMatrix 的简化版本,只能处理一个维度序列,返回一个 Map。
|
|
233
|
+
* 相当于只处理 matrix 的第一行(汇总行) */
|
|
234
|
+
|
|
235
|
+
export function buildRecordMap(_ref6) {
|
|
236
|
+
var codes = _ref6.codes,
|
|
237
|
+
_ref6$encode = _ref6.encode,
|
|
238
|
+
encode = _ref6$encode === void 0 ? simpleEncode : _ref6$encode,
|
|
239
|
+
data = _ref6.data,
|
|
240
|
+
aggregate = _ref6.aggregate,
|
|
241
|
+
isExpand = _ref6.isExpand;
|
|
242
|
+
var matrix = buildRecordMatrix({
|
|
243
|
+
data: data,
|
|
244
|
+
leftCodes: [],
|
|
245
|
+
topCodes: codes,
|
|
246
|
+
isTopExpand: isExpand,
|
|
247
|
+
aggregate: aggregate,
|
|
248
|
+
encode: encode
|
|
249
|
+
});
|
|
250
|
+
var totalKey = encode([]);
|
|
251
|
+
return matrix.get(totalKey);
|
|
252
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CrossTableIndicator, CrossTreeNode } from '../cross-table';
|
|
2
|
+
import { DrillNode } from './interfaces';
|
|
3
|
+
declare type ConvertOptions<T extends CrossTreeNode = CrossTreeNode> = {
|
|
4
|
+
/** 需要在子节点处附加的 指标节点 */
|
|
5
|
+
indicators?: CrossTableIndicator[];
|
|
6
|
+
/** 自定义的编码函数,用于根据下钻的值序列生成唯一的字符串.
|
|
7
|
+
* 该参数留空 表示使用默认的编码方式 */
|
|
8
|
+
encode?(valuePath: string[]): string;
|
|
9
|
+
/** 为一个值序列生成小计(sub-total)节点.
|
|
10
|
+
* 针对每一个父节点,该函数都将被调用一次;
|
|
11
|
+
* * 函数返回 null, 表示对应父节点不需要小计节点;
|
|
12
|
+
* * 返回 `{ position: 'start' | 'end', value: string; data?: any }`
|
|
13
|
+
* 表明所要生成的小计节点的摆放位置、文本、附加的数据
|
|
14
|
+
*
|
|
15
|
+
* 该参数留空 表示所有节点均不需要生成小计节点 */
|
|
16
|
+
generateSubtotalNode?(drillNode: DrillNode): null | {
|
|
17
|
+
position: 'start' | 'end';
|
|
18
|
+
value: string;
|
|
19
|
+
};
|
|
20
|
+
/** 是否支持节点的展开与收拢,默认为 false。
|
|
21
|
+
* 当该选项为 true 时,展开/收拢才会开启,相关的按钮也才会被渲染 */
|
|
22
|
+
supportsExpand?: boolean;
|
|
23
|
+
/** 展开的节点的 key 数组 */
|
|
24
|
+
expandKeys?: string[];
|
|
25
|
+
/** 展开节点发生变化时的回调 */
|
|
26
|
+
onChangeExpandKeys?(nextKeys: string[], targetNode: DrillNode, action: 'collapse' | 'expand'): void;
|
|
27
|
+
/** 是否强制展开总计节点,默认为 true */
|
|
28
|
+
enforceExpandTotalNode?: boolean;
|
|
29
|
+
};
|
|
30
|
+
export declare function convertDrillTreeToCrossTree<T extends CrossTreeNode = CrossTreeNode>(drillTree: DrillNode[], { indicators, encode, generateSubtotalNode, enforceExpandTotalNode, expandKeys, onChangeExpandKeys, supportsExpand, }?: ConvertOptions<T>): T[];
|
|
31
|
+
export {};
|