@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,213 @@
|
|
|
1
|
+
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
|
2
|
+
import { sort } from '../sort';
|
|
3
|
+
import { useTablePipeline } from '../../pipeline';
|
|
4
|
+
import { mount } from 'enzyme';
|
|
5
|
+
import { renderHook } from '@testing-library/react-hooks';
|
|
6
|
+
var dataSource = [{
|
|
7
|
+
id: '1',
|
|
8
|
+
prov: '湖北省',
|
|
9
|
+
confirm: 54406,
|
|
10
|
+
cure: 4793,
|
|
11
|
+
dead: 1457,
|
|
12
|
+
t: '2020-02-15 19:52:02'
|
|
13
|
+
}, {
|
|
14
|
+
id: '2',
|
|
15
|
+
prov: '广东省',
|
|
16
|
+
confirm: 1294,
|
|
17
|
+
cure: 409,
|
|
18
|
+
dead: 2,
|
|
19
|
+
t: '2020-02-15 19:52:02'
|
|
20
|
+
}, {
|
|
21
|
+
id: '3',
|
|
22
|
+
prov: '河南省',
|
|
23
|
+
confirm: 1212,
|
|
24
|
+
cure: 390,
|
|
25
|
+
dead: 13,
|
|
26
|
+
t: '2020-02-15 19:52:02'
|
|
27
|
+
}, {
|
|
28
|
+
id: '4',
|
|
29
|
+
prov: '浙江省',
|
|
30
|
+
confirm: 1000,
|
|
31
|
+
cure: 428,
|
|
32
|
+
dead: 0,
|
|
33
|
+
t: '2020-02-15 19:52:02'
|
|
34
|
+
}, {
|
|
35
|
+
id: '5',
|
|
36
|
+
prov: '湖南省',
|
|
37
|
+
confirm: 1000,
|
|
38
|
+
cure: 417,
|
|
39
|
+
dead: 2,
|
|
40
|
+
t: '2020-02-15 19:52:02'
|
|
41
|
+
}];
|
|
42
|
+
var columns = [{
|
|
43
|
+
code: 'prov',
|
|
44
|
+
name: '省份',
|
|
45
|
+
width: 150,
|
|
46
|
+
features: {
|
|
47
|
+
sortable: true
|
|
48
|
+
}
|
|
49
|
+
}, {
|
|
50
|
+
code: 'confirm',
|
|
51
|
+
name: '确诊',
|
|
52
|
+
width: 100,
|
|
53
|
+
align: 'right',
|
|
54
|
+
features: {
|
|
55
|
+
sortable: true
|
|
56
|
+
}
|
|
57
|
+
}, {
|
|
58
|
+
code: 'cure',
|
|
59
|
+
name: '治愈',
|
|
60
|
+
width: 100,
|
|
61
|
+
align: 'right',
|
|
62
|
+
features: {
|
|
63
|
+
sortable: true
|
|
64
|
+
}
|
|
65
|
+
}, {
|
|
66
|
+
code: 'dead',
|
|
67
|
+
name: '死亡',
|
|
68
|
+
width: 100,
|
|
69
|
+
align: 'right',
|
|
70
|
+
features: {
|
|
71
|
+
sortable: true
|
|
72
|
+
}
|
|
73
|
+
}, {
|
|
74
|
+
code: 't',
|
|
75
|
+
name: '更新时间',
|
|
76
|
+
width: 180,
|
|
77
|
+
features: {
|
|
78
|
+
sortable: true
|
|
79
|
+
}
|
|
80
|
+
}];
|
|
81
|
+
describe('sort 单元测试', function () {
|
|
82
|
+
var opts = {
|
|
83
|
+
defaultSorts: [{
|
|
84
|
+
code: 'cure',
|
|
85
|
+
order: 'asc'
|
|
86
|
+
}],
|
|
87
|
+
highlightColumnWhenActive: true,
|
|
88
|
+
mode: 'single',
|
|
89
|
+
keepDataSource: false,
|
|
90
|
+
onChangeSorts: jest.fn()
|
|
91
|
+
};
|
|
92
|
+
var newPipeline = null;
|
|
93
|
+
beforeEach(function () {
|
|
94
|
+
var _renderHook = renderHook(function () {
|
|
95
|
+
return useTablePipeline({
|
|
96
|
+
primaryKey: 'id'
|
|
97
|
+
}).input({
|
|
98
|
+
dataSource: dataSource,
|
|
99
|
+
columns: columns
|
|
100
|
+
});
|
|
101
|
+
}),
|
|
102
|
+
result = _renderHook.result;
|
|
103
|
+
|
|
104
|
+
var tablePipeline = result.current;
|
|
105
|
+
newPipeline = sort(opts)(tablePipeline);
|
|
106
|
+
});
|
|
107
|
+
afterEach(function () {
|
|
108
|
+
newPipeline = null;
|
|
109
|
+
opts.onChangeSorts.mockClear();
|
|
110
|
+
});
|
|
111
|
+
it('初始化数据', function () {
|
|
112
|
+
// 默认cure列升序排序
|
|
113
|
+
expect(newPipeline.getDataSource()[0]).toEqual({
|
|
114
|
+
id: '3',
|
|
115
|
+
prov: '河南省',
|
|
116
|
+
confirm: 1212,
|
|
117
|
+
cure: 390,
|
|
118
|
+
dead: 13,
|
|
119
|
+
t: '2020-02-15 19:52:02'
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
it('列头单元格渲染', function () {
|
|
123
|
+
var col = newPipeline.getColumns();
|
|
124
|
+
var wrapper = mount(col[0].title);
|
|
125
|
+
expect(_findInstanceProperty(wrapper).call(wrapper, 'SortIcon').length).toBe(1); // 列头单元格
|
|
126
|
+
|
|
127
|
+
var div = _findInstanceProperty(wrapper).call(wrapper, 'div').at(0);
|
|
128
|
+
|
|
129
|
+
div.simulate('click');
|
|
130
|
+
expect(opts.onChangeSorts).toBeCalledWith([{
|
|
131
|
+
code: 'prov',
|
|
132
|
+
order: 'desc'
|
|
133
|
+
}], {
|
|
134
|
+
code: 'prov',
|
|
135
|
+
order: 'desc'
|
|
136
|
+
});
|
|
137
|
+
expect(1).toBe(1);
|
|
138
|
+
});
|
|
139
|
+
it('getCellProps', function () {
|
|
140
|
+
var col = newPipeline.getColumns();
|
|
141
|
+
var cellProps = col[2].getCellProps(4793, newPipeline.getDataSource()[0], 0);
|
|
142
|
+
expect(cellProps.style).toEqual({
|
|
143
|
+
background: 'var(--highlight-bgcolor)'
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
it('keepDataSource为true,数据不变', function () {
|
|
147
|
+
var _renderHook2 = renderHook(function () {
|
|
148
|
+
return useTablePipeline({
|
|
149
|
+
primaryKey: 'id'
|
|
150
|
+
}).input({
|
|
151
|
+
dataSource: dataSource,
|
|
152
|
+
columns: columns
|
|
153
|
+
});
|
|
154
|
+
}),
|
|
155
|
+
result = _renderHook2.result;
|
|
156
|
+
|
|
157
|
+
var tablePipeline = result.current;
|
|
158
|
+
opts.keepDataSource = true;
|
|
159
|
+
var newPipeline = sort(opts)(tablePipeline);
|
|
160
|
+
expect(newPipeline.getDataSource()[0].id).toBe('1');
|
|
161
|
+
opts.keepDataSource = false;
|
|
162
|
+
});
|
|
163
|
+
it('多列排序', function () {
|
|
164
|
+
var _renderHook3 = renderHook(function () {
|
|
165
|
+
return useTablePipeline({
|
|
166
|
+
primaryKey: 'id'
|
|
167
|
+
}).input({
|
|
168
|
+
dataSource: dataSource,
|
|
169
|
+
columns: columns
|
|
170
|
+
});
|
|
171
|
+
}),
|
|
172
|
+
result = _renderHook3.result;
|
|
173
|
+
|
|
174
|
+
var tablePipeline = result.current;
|
|
175
|
+
opts.defaultSorts = [{
|
|
176
|
+
code: 'confirm',
|
|
177
|
+
order: 'desc'
|
|
178
|
+
}, {
|
|
179
|
+
code: 'cure',
|
|
180
|
+
order: 'asc'
|
|
181
|
+
}];
|
|
182
|
+
opts.mode = 'multiple';
|
|
183
|
+
var newPipeline = sort(opts)(tablePipeline); // confirm 降序,cure升序
|
|
184
|
+
|
|
185
|
+
expect(newPipeline.getDataSource()[3].confirm).toBe(1000);
|
|
186
|
+
expect(newPipeline.getDataSource()[3].cure).toBe(417);
|
|
187
|
+
expect(newPipeline.getDataSource()[4].confirm).toBe(1000);
|
|
188
|
+
expect(newPipeline.getDataSource()[4].cure).toBe(428);
|
|
189
|
+
var col = newPipeline.getColumns();
|
|
190
|
+
var confirmWrapper = mount(col[1].title); // 列头单元格
|
|
191
|
+
|
|
192
|
+
var div = _findInstanceProperty(confirmWrapper).call(confirmWrapper, 'div').at(0);
|
|
193
|
+
|
|
194
|
+
div.simulate('click'); // confirm 列初始是降序,点击后是升序
|
|
195
|
+
// calls[0][1]表示第1次调用的第二个参数
|
|
196
|
+
|
|
197
|
+
expect(opts.onChangeSorts.mock.calls[0][1]).toEqual({
|
|
198
|
+
code: 'confirm',
|
|
199
|
+
order: 'asc'
|
|
200
|
+
});
|
|
201
|
+
opts.onChangeSorts.mockClear();
|
|
202
|
+
var cureWrapper = mount(col[2].title);
|
|
203
|
+
|
|
204
|
+
var div1 = _findInstanceProperty(cureWrapper).call(cureWrapper, 'div').at(0);
|
|
205
|
+
|
|
206
|
+
div1.simulate('click'); // confirm 列初始是升序,点击后没有排序
|
|
207
|
+
|
|
208
|
+
expect(opts.onChangeSorts.mock.calls[0][1]).toEqual({
|
|
209
|
+
code: 'cure',
|
|
210
|
+
order: 'none'
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
|
2
|
+
import { tips } from '../tips';
|
|
3
|
+
import { useTablePipeline } from '../../pipeline';
|
|
4
|
+
import { mount } from 'enzyme';
|
|
5
|
+
import { renderHook } from '@testing-library/react-hooks';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
var dataSource = [{
|
|
8
|
+
id: '1',
|
|
9
|
+
prov: '湖北省',
|
|
10
|
+
confirm: 54406,
|
|
11
|
+
cure: 4793,
|
|
12
|
+
dead: 1457,
|
|
13
|
+
t: '2020-02-15 19:52:02'
|
|
14
|
+
}, {
|
|
15
|
+
id: '2',
|
|
16
|
+
prov: '广东省',
|
|
17
|
+
confirm: 1294,
|
|
18
|
+
cure: 409,
|
|
19
|
+
dead: 2,
|
|
20
|
+
t: '2020-02-15 19:52:02'
|
|
21
|
+
}, {
|
|
22
|
+
id: '3',
|
|
23
|
+
prov: '河南省',
|
|
24
|
+
confirm: 1212,
|
|
25
|
+
cure: 390,
|
|
26
|
+
dead: 13,
|
|
27
|
+
t: '2020-02-15 19:52:02'
|
|
28
|
+
}, {
|
|
29
|
+
id: '4',
|
|
30
|
+
prov: '浙江省',
|
|
31
|
+
confirm: 1000,
|
|
32
|
+
cure: 428,
|
|
33
|
+
dead: 0,
|
|
34
|
+
t: '2020-02-15 19:52:02'
|
|
35
|
+
}, {
|
|
36
|
+
id: '5',
|
|
37
|
+
prov: '湖南省',
|
|
38
|
+
confirm: 1000,
|
|
39
|
+
cure: 417,
|
|
40
|
+
dead: 2,
|
|
41
|
+
t: '2020-02-15 19:52:02'
|
|
42
|
+
}];
|
|
43
|
+
var columns = [{
|
|
44
|
+
code: 'prov',
|
|
45
|
+
name: '省份',
|
|
46
|
+
width: 150,
|
|
47
|
+
features: {
|
|
48
|
+
tips: '省份信息'
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
code: 'confirm',
|
|
52
|
+
name: '确诊',
|
|
53
|
+
width: 100,
|
|
54
|
+
align: 'right',
|
|
55
|
+
features: {
|
|
56
|
+
tips: '确诊数量'
|
|
57
|
+
}
|
|
58
|
+
}, {
|
|
59
|
+
code: 'cure',
|
|
60
|
+
name: '治愈',
|
|
61
|
+
width: 100,
|
|
62
|
+
align: 'right'
|
|
63
|
+
}, {
|
|
64
|
+
code: 'dead',
|
|
65
|
+
name: '死亡',
|
|
66
|
+
width: 100,
|
|
67
|
+
align: 'right'
|
|
68
|
+
}, {
|
|
69
|
+
code: 't',
|
|
70
|
+
name: '更新时间',
|
|
71
|
+
width: 180
|
|
72
|
+
}];
|
|
73
|
+
|
|
74
|
+
function Tooltip(_ref) {
|
|
75
|
+
var title = _ref.title,
|
|
76
|
+
children = _ref.children;
|
|
77
|
+
return /*#__PURE__*/React.createElement("div", null, title);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
describe('tips 单元测试', function () {
|
|
81
|
+
var newPipeline = null;
|
|
82
|
+
beforeEach(function () {
|
|
83
|
+
var _renderHook = renderHook(function () {
|
|
84
|
+
return useTablePipeline({
|
|
85
|
+
primaryKey: 'id',
|
|
86
|
+
components: {
|
|
87
|
+
Tooltip: Tooltip
|
|
88
|
+
}
|
|
89
|
+
}).input({
|
|
90
|
+
dataSource: dataSource,
|
|
91
|
+
columns: columns
|
|
92
|
+
});
|
|
93
|
+
}),
|
|
94
|
+
result = _renderHook.result;
|
|
95
|
+
|
|
96
|
+
var tablePipeline = result.current;
|
|
97
|
+
newPipeline = tips()(tablePipeline);
|
|
98
|
+
});
|
|
99
|
+
afterEach(function () {
|
|
100
|
+
newPipeline = null;
|
|
101
|
+
});
|
|
102
|
+
it('初始化时存在Tooltip组件', function () {
|
|
103
|
+
var col = newPipeline.getColumns();
|
|
104
|
+
var wrapper = mount(col[0].title);
|
|
105
|
+
expect(_findInstanceProperty(wrapper).call(wrapper, 'Tooltip').length).toBe(1);
|
|
106
|
+
});
|
|
107
|
+
it('不传Tooltip', function () {
|
|
108
|
+
var _renderHook2 = renderHook(function () {
|
|
109
|
+
return useTablePipeline({
|
|
110
|
+
primaryKey: 'id'
|
|
111
|
+
}).input({
|
|
112
|
+
dataSource: dataSource,
|
|
113
|
+
columns: columns
|
|
114
|
+
});
|
|
115
|
+
}),
|
|
116
|
+
result = _renderHook2.result;
|
|
117
|
+
|
|
118
|
+
var tablePipeline = result.current;
|
|
119
|
+
expect(function () {
|
|
120
|
+
return tips()(tablePipeline);
|
|
121
|
+
}).toThrow(Error);
|
|
122
|
+
});
|
|
123
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
|
2
|
+
import { treeMode } from '../treeMode';
|
|
3
|
+
import { useTablePipeline } from '../../pipeline';
|
|
4
|
+
import { mount } from 'enzyme';
|
|
5
|
+
import { renderHook } from '@testing-library/react-hooks';
|
|
6
|
+
|
|
7
|
+
function makeChildren(prefix) {
|
|
8
|
+
return [{
|
|
9
|
+
id: "".concat(prefix, "-1"),
|
|
10
|
+
title: '二级标题',
|
|
11
|
+
dept: '应用部',
|
|
12
|
+
dest: '云南大理',
|
|
13
|
+
guide: 'Douglas Lee',
|
|
14
|
+
children: [{
|
|
15
|
+
id: "".concat(prefix, "-1-1"),
|
|
16
|
+
title: '三级标题',
|
|
17
|
+
dept: '平台大前端-UED',
|
|
18
|
+
dest: '云南大理',
|
|
19
|
+
guide: 'Douglas Lee'
|
|
20
|
+
}, {
|
|
21
|
+
id: "".concat(prefix, "-1-2"),
|
|
22
|
+
title: '三级标题',
|
|
23
|
+
dept: '平台大前端-前端',
|
|
24
|
+
dest: '云南大理',
|
|
25
|
+
guide: 'Douglas Lee'
|
|
26
|
+
}]
|
|
27
|
+
}, {
|
|
28
|
+
id: "".concat(prefix, "-2"),
|
|
29
|
+
title: '二级标题',
|
|
30
|
+
dept: '应用部',
|
|
31
|
+
dest: '云南大理',
|
|
32
|
+
guide: 'Douglas Lee',
|
|
33
|
+
children: [{
|
|
34
|
+
id: "".concat(prefix, "-2-1"),
|
|
35
|
+
title: '三级标题',
|
|
36
|
+
dept: '平台大前端-UED',
|
|
37
|
+
dest: '云南大理',
|
|
38
|
+
guide: 'Douglas Lee'
|
|
39
|
+
}, {
|
|
40
|
+
id: "".concat(prefix, "-2-2"),
|
|
41
|
+
title: '三级标题',
|
|
42
|
+
dept: '平台大前端-前端',
|
|
43
|
+
dest: '云南大理',
|
|
44
|
+
guide: 'Douglas Lee'
|
|
45
|
+
}]
|
|
46
|
+
}, {
|
|
47
|
+
id: "".concat(prefix, "-3"),
|
|
48
|
+
title: '二级标题',
|
|
49
|
+
dept: '应用部',
|
|
50
|
+
dest: '云南大理',
|
|
51
|
+
guide: 'Douglas Lee'
|
|
52
|
+
}];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
var dataSource = [{
|
|
56
|
+
id: '1',
|
|
57
|
+
title: '一级标题',
|
|
58
|
+
dept: '云苍穹-前端',
|
|
59
|
+
dest: 'South Maddison',
|
|
60
|
+
guide: 'Don Moreno',
|
|
61
|
+
children: makeChildren('1')
|
|
62
|
+
}, {
|
|
63
|
+
id: '2',
|
|
64
|
+
title: '一级标题',
|
|
65
|
+
dept: '云苍穹-模型',
|
|
66
|
+
dest: 'Emilhaven',
|
|
67
|
+
guide: 'Douglas Richards',
|
|
68
|
+
children: makeChildren('2')
|
|
69
|
+
}, {
|
|
70
|
+
id: '3',
|
|
71
|
+
title: '一级标题',
|
|
72
|
+
dept: '云苍穹-基础',
|
|
73
|
+
dest: '云南大理',
|
|
74
|
+
guide: 'Douglas Lee',
|
|
75
|
+
children: makeChildren('3')
|
|
76
|
+
}, {
|
|
77
|
+
id: '4',
|
|
78
|
+
title: '一级标题',
|
|
79
|
+
dept: '云苍穹-体验',
|
|
80
|
+
dest: '杭州千岛湖',
|
|
81
|
+
guide: 'Eric Castillo',
|
|
82
|
+
children: makeChildren('4')
|
|
83
|
+
}, {
|
|
84
|
+
id: '5',
|
|
85
|
+
title: '一级标题',
|
|
86
|
+
dept: '云苍穹-运营',
|
|
87
|
+
dest: 'East Karl',
|
|
88
|
+
guide: 'Herbert Patton'
|
|
89
|
+
}];
|
|
90
|
+
var columns = [{
|
|
91
|
+
code: 'title',
|
|
92
|
+
name: '标题',
|
|
93
|
+
width: 200,
|
|
94
|
+
getCellProps: function getCellProps() {
|
|
95
|
+
return {
|
|
96
|
+
style: {
|
|
97
|
+
background: 'red'
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}, {
|
|
102
|
+
code: 'dept',
|
|
103
|
+
name: '部门名称',
|
|
104
|
+
width: 180
|
|
105
|
+
}, {
|
|
106
|
+
code: 'dest',
|
|
107
|
+
name: '团建目的地',
|
|
108
|
+
width: 160
|
|
109
|
+
}, {
|
|
110
|
+
code: 'guide',
|
|
111
|
+
name: '当地导游',
|
|
112
|
+
width: 160
|
|
113
|
+
}];
|
|
114
|
+
describe('treeMode 单元测试', function () {
|
|
115
|
+
var opts = {
|
|
116
|
+
openKeys: ['4', '4-2'],
|
|
117
|
+
clickArea: 'content',
|
|
118
|
+
onChangeOpenKeys: jest.fn()
|
|
119
|
+
};
|
|
120
|
+
var newPipeline = null;
|
|
121
|
+
beforeEach(function () {
|
|
122
|
+
var _renderHook = renderHook(function () {
|
|
123
|
+
return useTablePipeline({
|
|
124
|
+
primaryKey: 'id'
|
|
125
|
+
}).input({
|
|
126
|
+
dataSource: dataSource,
|
|
127
|
+
columns: columns
|
|
128
|
+
});
|
|
129
|
+
}),
|
|
130
|
+
result = _renderHook.result;
|
|
131
|
+
|
|
132
|
+
var tablePipeline = result.current;
|
|
133
|
+
newPipeline = treeMode(opts)(tablePipeline);
|
|
134
|
+
});
|
|
135
|
+
afterEach(function () {
|
|
136
|
+
newPipeline = null;
|
|
137
|
+
opts.onChangeOpenKeys.mockClear();
|
|
138
|
+
});
|
|
139
|
+
it('初始化展示', function () {
|
|
140
|
+
// 5 + 3 + 2
|
|
141
|
+
expect(newPipeline.getDataSource().length).toBe(10);
|
|
142
|
+
});
|
|
143
|
+
it('展开图标单元格渲染', function () {
|
|
144
|
+
var col = newPipeline.getColumns();
|
|
145
|
+
var wrapper = mount(col[0].render('一级标题', newPipeline.getDataSource()[0], 0));
|
|
146
|
+
expect(_findInstanceProperty(wrapper).call(wrapper, 'CaretRightIcon').length).toBe(1);
|
|
147
|
+
|
|
148
|
+
var div = _findInstanceProperty(wrapper).call(wrapper, 'div').at(0);
|
|
149
|
+
|
|
150
|
+
div.simulate('click');
|
|
151
|
+
expect(opts.onChangeOpenKeys).toHaveBeenCalled();
|
|
152
|
+
expect(opts.onChangeOpenKeys).toBeCalledWith(['4', '4-2', '1'], '1', 'expand');
|
|
153
|
+
opts.onChangeOpenKeys.mockClear(); // 展开列点击
|
|
154
|
+
|
|
155
|
+
var expandColWrapper = mount(col[0].render('一级标题', newPipeline.getDataSource()[3], 3));
|
|
156
|
+
|
|
157
|
+
var div1 = _findInstanceProperty(expandColWrapper).call(expandColWrapper, 'div').at(0);
|
|
158
|
+
|
|
159
|
+
div1.simulate('click');
|
|
160
|
+
expect(opts.onChangeOpenKeys).toBeCalledWith(['4-2'], '4', 'collapse'); // 叶子节点渲染
|
|
161
|
+
|
|
162
|
+
var leafWrapper = mount(col[0].render('一级标题', newPipeline.getDataSource()[9], 9));
|
|
163
|
+
expect(_findInstanceProperty(leafWrapper).call(leafWrapper, '.expansion-cell.leaf').length).toBe(2);
|
|
164
|
+
});
|
|
165
|
+
it('getCellProps', function () {
|
|
166
|
+
var col = newPipeline.getColumns(); // clickArea: 'content' 取默认的cellProps
|
|
167
|
+
|
|
168
|
+
expect(col[0].getCellProps()).toEqual({
|
|
169
|
+
style: {
|
|
170
|
+
background: 'red'
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
it('clickArea 为cell', function () {
|
|
175
|
+
var _renderHook2 = renderHook(function () {
|
|
176
|
+
return useTablePipeline({
|
|
177
|
+
primaryKey: 'id'
|
|
178
|
+
}).input({
|
|
179
|
+
dataSource: dataSource,
|
|
180
|
+
columns: columns
|
|
181
|
+
});
|
|
182
|
+
}),
|
|
183
|
+
result = _renderHook2.result;
|
|
184
|
+
|
|
185
|
+
var tablePipeline = result.current;
|
|
186
|
+
opts.clickArea = 'cell';
|
|
187
|
+
var newPipeline = treeMode(opts)(tablePipeline);
|
|
188
|
+
var col = newPipeline.getColumns();
|
|
189
|
+
var cellProps = col[0].getCellProps('一级标题', newPipeline.getDataSource()[0], 0);
|
|
190
|
+
expect(cellProps.style).toEqual({
|
|
191
|
+
background: 'red',
|
|
192
|
+
cursor: 'pointer'
|
|
193
|
+
});
|
|
194
|
+
cellProps.onClick();
|
|
195
|
+
expect(opts.onChangeOpenKeys).toHaveBeenCalled(); // 叶子节点cellProps
|
|
196
|
+
|
|
197
|
+
var leafCellProps = col[0].getCellProps('一级标题', newPipeline.getDataSource()[9], 9);
|
|
198
|
+
expect(leafCellProps.style).toEqual({
|
|
199
|
+
background: 'red'
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
|
2
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
3
|
+
import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/splice";
|
|
4
|
+
import { getLeftNestedLockCount } from '../../base/calculations';
|
|
5
|
+
import { isLeafNode, makeRecursiveMapper } from '../../utils';
|
|
6
|
+
export var FILL_COLUMN_CODE = '$_fill_column_&';
|
|
7
|
+
export var tableWidthKey = 'tableWidth';
|
|
8
|
+
var fillColumnWidthKey = 'fillColumnWidth';
|
|
9
|
+
export var autoFillTableWidth = function autoFillTableWidth() {
|
|
10
|
+
return function (pipeline) {
|
|
11
|
+
var width = pipeline.getStateAtKey(fillColumnWidthKey, 0);
|
|
12
|
+
var columns = pipeline.getColumns();
|
|
13
|
+
|
|
14
|
+
var fillColumns = _findInstanceProperty(columns).call(columns, function (col) {
|
|
15
|
+
return col.code === FILL_COLUMN_CODE;
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
if (fillColumns) {
|
|
19
|
+
fillColumns.width = width;
|
|
20
|
+
} else {
|
|
21
|
+
var rightNestedLockCount = getLeftNestedLockCount(_sliceInstanceProperty(columns).call(columns).reverse());
|
|
22
|
+
var spliceIndex = columns.length - rightNestedLockCount;
|
|
23
|
+
var _fillColumns = {
|
|
24
|
+
name: '',
|
|
25
|
+
code: FILL_COLUMN_CODE,
|
|
26
|
+
width: width,
|
|
27
|
+
features: {
|
|
28
|
+
resizeable: false
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
_spliceInstanceProperty(columns).call(columns, spliceIndex, 0, _fillColumns);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
pipeline.columns(columns);
|
|
36
|
+
setAutoFillWidth(pipeline);
|
|
37
|
+
return pipeline;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
var setAutoFillWidth = function setAutoFillWidth(pipeline) {
|
|
42
|
+
var tableWidth = pipeline.getStateAtKey(tableWidthKey);
|
|
43
|
+
if (!tableWidth) return;
|
|
44
|
+
var columnWidthSum = 0;
|
|
45
|
+
pipeline.mapColumns(makeRecursiveMapper(function (col) {
|
|
46
|
+
var width = col.width,
|
|
47
|
+
code = col.code;
|
|
48
|
+
|
|
49
|
+
if (isLeafNode(col) && code !== FILL_COLUMN_CODE) {
|
|
50
|
+
var resizeColumn = pipeline.getStateAtKey('columnResize');
|
|
51
|
+
columnWidthSum += resizeColumn && resizeColumn[code] || width;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return col;
|
|
55
|
+
}));
|
|
56
|
+
var fillColumnWidth = Math.floor(tableWidth - columnWidthSum);
|
|
57
|
+
fillColumnWidth = fillColumnWidth > 0 ? fillColumnWidth : 0;
|
|
58
|
+
var preWidth = pipeline.getStateAtKey(fillColumnWidthKey, 0);
|
|
59
|
+
|
|
60
|
+
if (preWidth !== fillColumnWidth) {
|
|
61
|
+
pipeline.setStateAtKey('fillColumnWidth', fillColumnWidth);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
|
+
import { internals } from '../../internals';
|
|
3
|
+
import { isLeafNode, makeRecursiveMapper } from '../../utils';
|
|
4
|
+
|
|
5
|
+
function isIdentity(x, y) {
|
|
6
|
+
return x === y;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function autoRowSpan() {
|
|
10
|
+
return function autoRowSpanStep(pipeline) {
|
|
11
|
+
var dataSource = pipeline.getDataSource();
|
|
12
|
+
return pipeline.mapColumns(makeRecursiveMapper(function (col, _ref) {
|
|
13
|
+
var startIndex = _ref.startIndex,
|
|
14
|
+
endIndex = _ref.endIndex;
|
|
15
|
+
|
|
16
|
+
var _a;
|
|
17
|
+
|
|
18
|
+
if (!((_a = col.features) === null || _a === void 0 ? void 0 : _a.autoRowSpan)) {
|
|
19
|
+
return col;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (!isLeafNode(col)) {
|
|
23
|
+
return col;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var isFunc = typeof col.features.autoRowSpan === 'function';
|
|
27
|
+
var shouldMergeCell = isFunc ? col.features.autoRowSpan : isIdentity;
|
|
28
|
+
var spanRects = [];
|
|
29
|
+
var lastBottom = 0;
|
|
30
|
+
var prevValue = null;
|
|
31
|
+
var prevRow = null;
|
|
32
|
+
|
|
33
|
+
for (var rowIndex = 0; rowIndex < dataSource.length; rowIndex++) {
|
|
34
|
+
var row = dataSource[rowIndex];
|
|
35
|
+
var value = internals.safeGetValue(col, row, rowIndex);
|
|
36
|
+
|
|
37
|
+
if (rowIndex === 0 || !shouldMergeCell(prevValue, value, prevRow, row)) {
|
|
38
|
+
var spanRect = {
|
|
39
|
+
top: lastBottom,
|
|
40
|
+
bottom: rowIndex,
|
|
41
|
+
left: startIndex,
|
|
42
|
+
right: endIndex
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
for (var i = lastBottom; i < rowIndex; i++) {
|
|
46
|
+
spanRects.push(spanRect);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
lastBottom = rowIndex;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
prevValue = value;
|
|
53
|
+
prevRow = row;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
for (var _i = lastBottom; _i < dataSource.length; _i++) {
|
|
57
|
+
spanRects.push({
|
|
58
|
+
top: lastBottom,
|
|
59
|
+
bottom: dataSource.length,
|
|
60
|
+
left: startIndex,
|
|
61
|
+
right: endIndex
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return _extends(_extends({}, col), {
|
|
66
|
+
getSpanRect: function getSpanRect(value, row, rowIndex) {
|
|
67
|
+
return spanRects[rowIndex];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}));
|
|
71
|
+
};
|
|
72
|
+
}
|