@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,138 @@
|
|
|
1
|
+
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
2
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
3
|
+
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
4
|
+
|
|
5
|
+
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; } } }; }
|
|
6
|
+
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { var _context; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context = Object.prototype.toString.call(o)).call(_context, 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); }
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
|
|
11
|
+
import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
12
|
+
import _Map from "@babel/runtime-corejs3/core-js-stable/map";
|
|
13
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
14
|
+
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
15
|
+
import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
16
|
+
import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
|
|
17
|
+
import _getIterator from "@babel/runtime-corejs3/core-js/get-iterator";
|
|
18
|
+
import isLeafNode from '../isLeafNode';
|
|
19
|
+
import { arrayUtils } from '../others';
|
|
20
|
+
|
|
21
|
+
var Wrapper = function Wrapper(input) {
|
|
22
|
+
_classCallCheck(this, Wrapper);
|
|
23
|
+
|
|
24
|
+
_extends(this, input);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
var StrictTreeDataHelper = /*#__PURE__*/function () {
|
|
28
|
+
function StrictTreeDataHelper(opts) {
|
|
29
|
+
_classCallCheck(this, StrictTreeDataHelper);
|
|
30
|
+
|
|
31
|
+
this.opts = opts;
|
|
32
|
+
this.valueSet = new _Set(opts.value);
|
|
33
|
+
this.initWrapperTree();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
_createClass(StrictTreeDataHelper, [{
|
|
37
|
+
key: "initWrapperTree",
|
|
38
|
+
value: function initWrapperTree() {
|
|
39
|
+
var _this = this;
|
|
40
|
+
|
|
41
|
+
var getNodeValue = this.opts.getNodeValue;
|
|
42
|
+
this.rootWrapper = new Wrapper({
|
|
43
|
+
root: true,
|
|
44
|
+
children: []
|
|
45
|
+
});
|
|
46
|
+
this.wrapperMap = new _Map();
|
|
47
|
+
|
|
48
|
+
var dfs = function dfs(parentWrapper, nodes) {
|
|
49
|
+
var _iterator = _createForOfIteratorHelper(nodes),
|
|
50
|
+
_step;
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
54
|
+
var node = _step.value;
|
|
55
|
+
var wrapper = new Wrapper({
|
|
56
|
+
parent: parentWrapper,
|
|
57
|
+
node: node,
|
|
58
|
+
checked: _this.valueSet.has(getNodeValue(node))
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
_this.wrapperMap.set(getNodeValue(node), wrapper);
|
|
62
|
+
|
|
63
|
+
parentWrapper.children.push(wrapper);
|
|
64
|
+
|
|
65
|
+
if (!isLeafNode(node)) {
|
|
66
|
+
wrapper.children = [];
|
|
67
|
+
dfs(wrapper, node.children);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
} catch (err) {
|
|
71
|
+
_iterator.e(err);
|
|
72
|
+
} finally {
|
|
73
|
+
_iterator.f();
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
dfs(this.rootWrapper, this.opts.tree);
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
80
|
+
key: "value",
|
|
81
|
+
get: function get() {
|
|
82
|
+
return this.opts.value;
|
|
83
|
+
}
|
|
84
|
+
}, {
|
|
85
|
+
key: "isIndeterminate",
|
|
86
|
+
value: function isIndeterminate(nodeValue) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
}, {
|
|
90
|
+
key: "isChecked",
|
|
91
|
+
value: function isChecked(nodeValue) {
|
|
92
|
+
return this.valueSet.has(nodeValue);
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
key: "getValueAfterCheck",
|
|
96
|
+
value: function getValueAfterCheck(nodeValue) {
|
|
97
|
+
if (!this.isChecked(nodeValue)) {
|
|
98
|
+
return arrayUtils.merge(this.value, [nodeValue]);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return this.value;
|
|
102
|
+
}
|
|
103
|
+
}, {
|
|
104
|
+
key: "getValueAfterUncheck",
|
|
105
|
+
value: function getValueAfterUncheck(nodeValue) {
|
|
106
|
+
if (this.isChecked(nodeValue)) {
|
|
107
|
+
return arrayUtils.diff(this.value, [nodeValue]);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return this.value;
|
|
111
|
+
}
|
|
112
|
+
}, {
|
|
113
|
+
key: "getValueAfterToggle",
|
|
114
|
+
value: function getValueAfterToggle(nodeValue) {
|
|
115
|
+
if (this.isChecked(nodeValue)) {
|
|
116
|
+
return this.getValueAfterUncheck(nodeValue);
|
|
117
|
+
} else {
|
|
118
|
+
return this.getValueAfterCheck(nodeValue);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}, {
|
|
122
|
+
key: "getNode",
|
|
123
|
+
value: function getNode(nodeValue) {
|
|
124
|
+
var _a;
|
|
125
|
+
|
|
126
|
+
return (_a = this.wrapperMap.get(nodeValue)) === null || _a === void 0 ? void 0 : _a.node;
|
|
127
|
+
}
|
|
128
|
+
}, {
|
|
129
|
+
key: "getCleanValue",
|
|
130
|
+
value: function getCleanValue() {
|
|
131
|
+
return this.value;
|
|
132
|
+
}
|
|
133
|
+
}]);
|
|
134
|
+
|
|
135
|
+
return StrictTreeDataHelper;
|
|
136
|
+
}();
|
|
137
|
+
|
|
138
|
+
export { StrictTreeDataHelper as default };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AbstractTreeNode } from '../../interfaces';
|
|
2
|
+
export declare type CheckedStrategy = 'all' | 'parent' | 'child';
|
|
3
|
+
export interface TreeDataHelperOptions<N extends AbstractTreeNode> {
|
|
4
|
+
tree: N[];
|
|
5
|
+
getNodeValue(node: N): string;
|
|
6
|
+
value: string[];
|
|
7
|
+
checkedStrategy: CheckedStrategy;
|
|
8
|
+
isDetached?(node: N): boolean;
|
|
9
|
+
}
|
|
10
|
+
export default class TreeDataHelper<N extends AbstractTreeNode> {
|
|
11
|
+
private readonly opts;
|
|
12
|
+
private readonly valueSet;
|
|
13
|
+
private wrapperMap;
|
|
14
|
+
private rootWrapper;
|
|
15
|
+
constructor(opts: TreeDataHelperOptions<N>);
|
|
16
|
+
private get value();
|
|
17
|
+
private isDetached;
|
|
18
|
+
private initWrapperTree;
|
|
19
|
+
isIndeterminate(nodeValue: string): boolean;
|
|
20
|
+
isChecked(nodeValue: string): boolean;
|
|
21
|
+
getValueAfterCheck(nodeValue: string): string[];
|
|
22
|
+
getValueAfterUncheck(nodeValue: string): string[];
|
|
23
|
+
getValueAfterToggle(nodeValue: string): string[];
|
|
24
|
+
getNode(nodeValue: string): N;
|
|
25
|
+
getCleanValue(): string[];
|
|
26
|
+
}
|
|
@@ -0,0 +1,337 @@
|
|
|
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 _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
7
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
8
|
+
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
9
|
+
|
|
10
|
+
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; } } }; }
|
|
11
|
+
|
|
12
|
+
function _unsupportedIterableToArray(o, minLen) { var _context3; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context3 = Object.prototype.toString.call(o)).call(_context3, 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); }
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
17
|
+
import _Map from "@babel/runtime-corejs3/core-js-stable/map";
|
|
18
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
19
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
20
|
+
import isLeafNode from '../isLeafNode';
|
|
21
|
+
import { arrayUtils } from '../others';
|
|
22
|
+
import console from '../console';
|
|
23
|
+
|
|
24
|
+
var Wrapper = function Wrapper(input) {
|
|
25
|
+
_classCallCheck(this, Wrapper);
|
|
26
|
+
|
|
27
|
+
_extends(this, input);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var TreeDataHelper = /*#__PURE__*/function () {
|
|
31
|
+
function TreeDataHelper(opts) {
|
|
32
|
+
var _this = this;
|
|
33
|
+
|
|
34
|
+
_classCallCheck(this, TreeDataHelper);
|
|
35
|
+
|
|
36
|
+
this.isDetached = function (node) {
|
|
37
|
+
var _a, _b, _c;
|
|
38
|
+
|
|
39
|
+
return (_c = (_b = (_a = _this.opts).isDetached) === null || _b === void 0 ? void 0 : _b.call(_a, node)) !== null && _c !== void 0 ? _c : false;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
this.opts = opts;
|
|
43
|
+
this.valueSet = new _Set(opts.value);
|
|
44
|
+
this.initWrapperTree();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
_createClass(TreeDataHelper, [{
|
|
48
|
+
key: "value",
|
|
49
|
+
get: function get() {
|
|
50
|
+
return this.opts.value;
|
|
51
|
+
}
|
|
52
|
+
}, {
|
|
53
|
+
key: "initWrapperTree",
|
|
54
|
+
value: function initWrapperTree() {
|
|
55
|
+
var valueSet = new _Set(this.value);
|
|
56
|
+
this.rootWrapper = new Wrapper({
|
|
57
|
+
root: true,
|
|
58
|
+
children: []
|
|
59
|
+
});
|
|
60
|
+
this.wrapperMap = new _Map();
|
|
61
|
+
var getNodeValue = this.opts.getNodeValue;
|
|
62
|
+
var isDetached = this.isDetached,
|
|
63
|
+
wrapperMap = this.wrapperMap;
|
|
64
|
+
dfs(this.rootWrapper, this.opts.tree, false);
|
|
65
|
+
|
|
66
|
+
function dfs(parentWrapper, nodes, inheritParentChecked) {
|
|
67
|
+
// allChildrenChecked 先默认设置为 true
|
|
68
|
+
// dfs 过程中可能会更新 allChildrenChecked
|
|
69
|
+
parentWrapper.allChildrenChecked = true;
|
|
70
|
+
|
|
71
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
72
|
+
if (nodes.every(isDetached)) {
|
|
73
|
+
console.warn('TreeDataHelper 检测到部分节点的下所有子节点均为 detached 状态,这将导致该节点变为「无效节点」', parentWrapper.node);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
var _iterator = _createForOfIteratorHelper(nodes),
|
|
78
|
+
_step;
|
|
79
|
+
|
|
80
|
+
try {
|
|
81
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
82
|
+
var node = _step.value;
|
|
83
|
+
var detached = isDetached(node);
|
|
84
|
+
var exactChecked = valueSet.has(getNodeValue(node));
|
|
85
|
+
|
|
86
|
+
if (exactChecked && !detached) {
|
|
87
|
+
parentWrapper.anyDescendentsChecked = true;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
var parentChecked = !detached && inheritParentChecked;
|
|
91
|
+
var checked = exactChecked || parentChecked;
|
|
92
|
+
var wrapper = new Wrapper({
|
|
93
|
+
parent: parentWrapper,
|
|
94
|
+
node: node,
|
|
95
|
+
checked: checked,
|
|
96
|
+
exactChecked: exactChecked,
|
|
97
|
+
parentChecked: parentChecked,
|
|
98
|
+
anyDescendentsChecked: checked,
|
|
99
|
+
detached: detached
|
|
100
|
+
});
|
|
101
|
+
wrapperMap.set(getNodeValue(node), wrapper);
|
|
102
|
+
parentWrapper.children.push(wrapper);
|
|
103
|
+
|
|
104
|
+
if (!isLeafNode(node)) {
|
|
105
|
+
wrapper.children = [];
|
|
106
|
+
dfs(wrapper, node.children, checked);
|
|
107
|
+
|
|
108
|
+
if (wrapper.anyDescendentsChecked && !detached) {
|
|
109
|
+
parentWrapper.anyDescendentsChecked = true;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (wrapper.allChildrenChecked) {
|
|
113
|
+
wrapper.checked = true; // 当一个节点因为「子节点被全选」而变为 checked 时,我们需要更新子节点的 parentChecked 字段
|
|
114
|
+
|
|
115
|
+
var _iterator2 = _createForOfIteratorHelper(wrapper.children),
|
|
116
|
+
_step2;
|
|
117
|
+
|
|
118
|
+
try {
|
|
119
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
120
|
+
var child = _step2.value;
|
|
121
|
+
|
|
122
|
+
if (!child.detached) {
|
|
123
|
+
child.parentChecked = true;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
} catch (err) {
|
|
127
|
+
_iterator2.e(err);
|
|
128
|
+
} finally {
|
|
129
|
+
_iterator2.f();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (!wrapper.checked && !detached) {
|
|
135
|
+
parentWrapper.allChildrenChecked = false;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
} catch (err) {
|
|
139
|
+
_iterator.e(err);
|
|
140
|
+
} finally {
|
|
141
|
+
_iterator.f();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}, {
|
|
146
|
+
key: "isIndeterminate",
|
|
147
|
+
value: function isIndeterminate(nodeValue) {
|
|
148
|
+
var wrapper = this.wrapperMap.get(nodeValue);
|
|
149
|
+
return !wrapper.checked && wrapper.anyDescendentsChecked;
|
|
150
|
+
}
|
|
151
|
+
}, {
|
|
152
|
+
key: "isChecked",
|
|
153
|
+
value: function isChecked(nodeValue) {
|
|
154
|
+
var wrapper = this.wrapperMap.get(nodeValue);
|
|
155
|
+
return wrapper.checked;
|
|
156
|
+
}
|
|
157
|
+
}, {
|
|
158
|
+
key: "getValueAfterCheck",
|
|
159
|
+
value: function getValueAfterCheck(nodeValue) {
|
|
160
|
+
if (this.isChecked(nodeValue)) {
|
|
161
|
+
return this.getCleanValue();
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
var nextValue = arrayUtils.merge(this.value, [nodeValue]);
|
|
165
|
+
return new TreeDataHelper(_extends(_extends({}, this.opts), {
|
|
166
|
+
value: nextValue
|
|
167
|
+
})).getCleanValue();
|
|
168
|
+
}
|
|
169
|
+
}, {
|
|
170
|
+
key: "getValueAfterUncheck",
|
|
171
|
+
value: function getValueAfterUncheck(nodeValue) {
|
|
172
|
+
var _context;
|
|
173
|
+
|
|
174
|
+
if (!this.isChecked(nodeValue)) {
|
|
175
|
+
return this.getCleanValue();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
var wrapper = this.wrapperMap.get(nodeValue);
|
|
179
|
+
var getNodeValue = this.opts.getNodeValue;
|
|
180
|
+
var appendArray = getAppendArray(wrapper);
|
|
181
|
+
var removeSet = getRemoveSet(wrapper);
|
|
182
|
+
var nextValue = arrayUtils.diff(_concatInstanceProperty(_context = this.value).call(_context, appendArray), removeSet);
|
|
183
|
+
return new TreeDataHelper(_extends(_extends({}, this.opts), {
|
|
184
|
+
value: nextValue
|
|
185
|
+
})).getCleanValue();
|
|
186
|
+
|
|
187
|
+
function getAppendArray(startWrapper) {
|
|
188
|
+
var result = [];
|
|
189
|
+
var current = startWrapper;
|
|
190
|
+
|
|
191
|
+
while (current.parentChecked && !current.detached) {
|
|
192
|
+
var _iterator3 = _createForOfIteratorHelper(current.parent.children),
|
|
193
|
+
_step3;
|
|
194
|
+
|
|
195
|
+
try {
|
|
196
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
197
|
+
var sibling = _step3.value;
|
|
198
|
+
|
|
199
|
+
if (sibling === current || sibling.exactChecked || sibling.detached) {
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
result.push(getNodeValue(sibling.node));
|
|
204
|
+
}
|
|
205
|
+
} catch (err) {
|
|
206
|
+
_iterator3.e(err);
|
|
207
|
+
} finally {
|
|
208
|
+
_iterator3.f();
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
current = current.parent;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return result;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function getRemoveSet(startWrapper) {
|
|
218
|
+
var result = new _Set();
|
|
219
|
+
var wrapper = startWrapper; // 不断向上收集选中的父节点
|
|
220
|
+
|
|
221
|
+
while (true) {
|
|
222
|
+
result.add(getNodeValue(wrapper.node));
|
|
223
|
+
|
|
224
|
+
if (wrapper.detached || !wrapper.parentChecked) {
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
wrapper = wrapper.parent;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function dfs(wrappers) {
|
|
232
|
+
if (wrappers == null) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
var _iterator4 = _createForOfIteratorHelper(wrappers),
|
|
237
|
+
_step4;
|
|
238
|
+
|
|
239
|
+
try {
|
|
240
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
241
|
+
var _wrapper = _step4.value;
|
|
242
|
+
|
|
243
|
+
if (_wrapper.detached || !_wrapper.checked) {
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
result.add(getNodeValue(_wrapper.node));
|
|
248
|
+
|
|
249
|
+
if (!isLeafNode(_wrapper) && _wrapper.anyDescendentsChecked) {
|
|
250
|
+
dfs(_wrapper.children);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
} catch (err) {
|
|
254
|
+
_iterator4.e(err);
|
|
255
|
+
} finally {
|
|
256
|
+
_iterator4.f();
|
|
257
|
+
}
|
|
258
|
+
} // 收集所有的子孙节点
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
dfs(startWrapper.children);
|
|
262
|
+
return result;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}, {
|
|
266
|
+
key: "getValueAfterToggle",
|
|
267
|
+
value: function getValueAfterToggle(nodeValue) {
|
|
268
|
+
if (this.isChecked(nodeValue)) {
|
|
269
|
+
return this.getValueAfterUncheck(nodeValue);
|
|
270
|
+
} else {
|
|
271
|
+
return this.getValueAfterCheck(nodeValue);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}, {
|
|
275
|
+
key: "getNode",
|
|
276
|
+
value: function getNode(nodeValue) {
|
|
277
|
+
var _a;
|
|
278
|
+
|
|
279
|
+
return (_a = this.wrapperMap.get(nodeValue)) === null || _a === void 0 ? void 0 : _a.node;
|
|
280
|
+
}
|
|
281
|
+
}, {
|
|
282
|
+
key: "getCleanValue",
|
|
283
|
+
value: function getCleanValue() {
|
|
284
|
+
var _context2,
|
|
285
|
+
_this2 = this;
|
|
286
|
+
|
|
287
|
+
var _this$opts = this.opts,
|
|
288
|
+
checkedStrategy = _this$opts.checkedStrategy,
|
|
289
|
+
getNodeValue = _this$opts.getNodeValue;
|
|
290
|
+
|
|
291
|
+
var result = _filterInstanceProperty(_context2 = this.value).call(_context2, function (nodeValue) {
|
|
292
|
+
return !_this2.wrapperMap.has(nodeValue);
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
dfs(this.rootWrapper.children);
|
|
296
|
+
return result;
|
|
297
|
+
|
|
298
|
+
function dfs(wrappers) {
|
|
299
|
+
var _iterator5 = _createForOfIteratorHelper(wrappers),
|
|
300
|
+
_step5;
|
|
301
|
+
|
|
302
|
+
try {
|
|
303
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
304
|
+
var wrapper = _step5.value;
|
|
305
|
+
|
|
306
|
+
if (wrapper.checked) {
|
|
307
|
+
if (checkedStrategy === 'all') {
|
|
308
|
+
result.push(getNodeValue(wrapper.node));
|
|
309
|
+
} else if (checkedStrategy === 'parent') {
|
|
310
|
+
if (!wrapper.parentChecked) {
|
|
311
|
+
result.push(getNodeValue(wrapper.node));
|
|
312
|
+
}
|
|
313
|
+
} else {
|
|
314
|
+
// checkedStrategy === 'child'
|
|
315
|
+
if (isLeafNode(wrapper)) {
|
|
316
|
+
result.push(getNodeValue(wrapper.node));
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
if (!isLeafNode(wrapper)) {
|
|
322
|
+
dfs(wrapper.children);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
} catch (err) {
|
|
326
|
+
_iterator5.e(err);
|
|
327
|
+
} finally {
|
|
328
|
+
_iterator5.f();
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}]);
|
|
333
|
+
|
|
334
|
+
return TreeDataHelper;
|
|
335
|
+
}();
|
|
336
|
+
|
|
337
|
+
export { TreeDataHelper as default };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isArrayValueRepeat = void 0;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 检查数组value的值是否唯一
|
|
10
|
+
* @param value 需要检查值是否唯一的数组
|
|
11
|
+
*/
|
|
12
|
+
var isArrayValueRepeat = function isArrayValueRepeat(value) {
|
|
13
|
+
var hash = {};
|
|
14
|
+
|
|
15
|
+
for (var i in value) {
|
|
16
|
+
if (hash[value[i]]) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
hash[value[i]] = true;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return false;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
exports.isArrayValueRepeat = isArrayValueRepeat;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (valid: boolean, component: string, message: string): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = _default;
|
|
9
|
+
|
|
10
|
+
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
11
|
+
|
|
12
|
+
var warned = {};
|
|
13
|
+
|
|
14
|
+
function _default(valid, component, message) {
|
|
15
|
+
if (process.env.NODE_ENV !== 'production' && valid && !warned[message]) {
|
|
16
|
+
var _context;
|
|
17
|
+
|
|
18
|
+
warned[message] = true;
|
|
19
|
+
console.warn((0, _concat.default)(_context = "Warning: [kd-ui]-".concat(component, ": ")).call(_context, message));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export interface FormatParam {
|
|
2
|
+
mask?: string;
|
|
3
|
+
zeroShow?: boolean;
|
|
4
|
+
decimalLength?: number;
|
|
5
|
+
showDecimalTailZero?: boolean;
|
|
6
|
+
isRound?: boolean;
|
|
7
|
+
symbol?: string;
|
|
8
|
+
code?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface EditFormatParam {
|
|
11
|
+
zeroShow?: boolean;
|
|
12
|
+
decimalLength?: number;
|
|
13
|
+
showDecimalTailZero?: boolean;
|
|
14
|
+
roundMethod?: string;
|
|
15
|
+
symbol?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* [数值类型格式化]
|
|
19
|
+
* @param {[type]} num [待格式化的数字]
|
|
20
|
+
* @param {String} mask [数值掩码
|
|
21
|
+
* 0:必须输入数字(0—9)
|
|
22
|
+
* 9:可选择输入数字(0—9)或空格
|
|
23
|
+
* #:可选择输入数字(0—9) 递归
|
|
24
|
+
* .: 小数点
|
|
25
|
+
* ,: 千位符
|
|
26
|
+
* %: 对最终值除以100处理
|
|
27
|
+
* %%: 对最终值不做处理
|
|
28
|
+
* //A: [a-zA-Z0-9]
|
|
29
|
+
* //S: [a-zA-Z]
|
|
30
|
+
* //&:必须输入任一字符或空格
|
|
31
|
+
* //C:可选择输入任一字符或空格
|
|
32
|
+
* $: 货币
|
|
33
|
+
* ]
|
|
34
|
+
* @param {Boolean} zeroShow [为零显示]
|
|
35
|
+
* @param {[type]} decimalLength [小数精度的位数]
|
|
36
|
+
* @param {Boolean} showDecimalTailZero [是否显示尾部零]
|
|
37
|
+
* @return [格式化后的数值]
|
|
38
|
+
*/
|
|
39
|
+
export declare function formatNumber(num: string | number, formatParams: FormatParam): string;
|
|
40
|
+
/**
|
|
41
|
+
* 格式化数字字段编辑态的值
|
|
42
|
+
* 不支持掩码的格式化信息
|
|
43
|
+
* @param {*} num
|
|
44
|
+
* @param {*} param
|
|
45
|
+
*/
|
|
46
|
+
export declare function formatEditNumber(num: number | string, { zeroShow, decimalLength, showDecimalTailZero, roundMethod, symbol }: EditFormatParam): string;
|