@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
package/dist/kd-ui.less
ADDED
package/dist/theme.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const defaultTheme = require('./default-theme.js');
|
|
2
|
+
|
|
3
|
+
function getThemeVariables(options = {}) {
|
|
4
|
+
let themeVar = {
|
|
5
|
+
'hack': `true;@import "${require.resolve('kd-ui/lib/style/color/colorPalette.less')}";`,
|
|
6
|
+
...defaultTheme
|
|
7
|
+
};
|
|
8
|
+
return themeVar;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
module.exports = {
|
|
12
|
+
getThemeVariables
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 检查数组value的值是否唯一
|
|
3
|
+
* @param value 需要检查值是否唯一的数组
|
|
4
|
+
*/
|
|
5
|
+
export var isArrayValueRepeat = function isArrayValueRepeat(value) {
|
|
6
|
+
var hash = {};
|
|
7
|
+
|
|
8
|
+
for (var i in value) {
|
|
9
|
+
if (hash[value[i]]) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
hash[value[i]] = true;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return false;
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (valid: boolean, component: string, message: string): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
2
|
+
var warned = {};
|
|
3
|
+
export default function (valid, component, message) {
|
|
4
|
+
if (process.env.NODE_ENV !== 'production' && valid && !warned[message]) {
|
|
5
|
+
var _context;
|
|
6
|
+
|
|
7
|
+
warned[message] = true;
|
|
8
|
+
console.warn(_concatInstanceProperty(_context = "Warning: [kd-ui]-".concat(component, ": ")).call(_context, message));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -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;
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
2
|
+
import _Number$parseFloat from "@babel/runtime-corejs3/core-js-stable/number/parse-float";
|
|
3
|
+
import _Number$isNaN from "@babel/runtime-corejs3/core-js-stable/number/is-nan";
|
|
4
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
5
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
6
|
+
|
|
7
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
8
|
+
var t = {};
|
|
9
|
+
|
|
10
|
+
for (var p in s) {
|
|
11
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (s != null && typeof _Object$getOwnPropertySymbols === "function") for (var i = 0, p = _Object$getOwnPropertySymbols(s); i < p.length; i++) {
|
|
15
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
16
|
+
}
|
|
17
|
+
return t;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
import { toFixed, exponentToFloat, isExp } from './numberUtil';
|
|
21
|
+
/**
|
|
22
|
+
* [数值类型格式化]
|
|
23
|
+
* @param {[type]} num [待格式化的数字]
|
|
24
|
+
* @param {String} mask [数值掩码
|
|
25
|
+
* 0:必须输入数字(0—9)
|
|
26
|
+
* 9:可选择输入数字(0—9)或空格
|
|
27
|
+
* #:可选择输入数字(0—9) 递归
|
|
28
|
+
* .: 小数点
|
|
29
|
+
* ,: 千位符
|
|
30
|
+
* %: 对最终值除以100处理
|
|
31
|
+
* %%: 对最终值不做处理
|
|
32
|
+
* //A: [a-zA-Z0-9]
|
|
33
|
+
* //S: [a-zA-Z]
|
|
34
|
+
* //&:必须输入任一字符或空格
|
|
35
|
+
* //C:可选择输入任一字符或空格
|
|
36
|
+
* $: 货币
|
|
37
|
+
* ]
|
|
38
|
+
* @param {Boolean} zeroShow [为零显示]
|
|
39
|
+
* @param {[type]} decimalLength [小数精度的位数]
|
|
40
|
+
* @param {Boolean} showDecimalTailZero [是否显示尾部零]
|
|
41
|
+
* @return [格式化后的数值]
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
export function formatNumber(num, formatParams) {
|
|
45
|
+
var _context;
|
|
46
|
+
|
|
47
|
+
var _formatParams$mask = formatParams.mask,
|
|
48
|
+
mask = _formatParams$mask === void 0 ? '' : _formatParams$mask,
|
|
49
|
+
_formatParams$zeroSho = formatParams.zeroShow,
|
|
50
|
+
zeroShow = _formatParams$zeroSho === void 0 ? false : _formatParams$zeroSho,
|
|
51
|
+
decimalLength = formatParams.decimalLength,
|
|
52
|
+
_formatParams$showDec = formatParams.showDecimalTailZero,
|
|
53
|
+
showDecimalTailZero = _formatParams$showDec === void 0 ? false : _formatParams$showDec,
|
|
54
|
+
isRound = formatParams.isRound,
|
|
55
|
+
param = __rest(formatParams, ["mask", "zeroShow", "decimalLength", "showDecimalTailZero", "isRound"]);
|
|
56
|
+
|
|
57
|
+
if (decimalLength !== undefined && (decimalLength < 0 || decimalLength > 100)) return num + '';
|
|
58
|
+
if (num === undefined || num === null) num = '';
|
|
59
|
+
var numInfo = {
|
|
60
|
+
numStr: '',
|
|
61
|
+
intStr: '',
|
|
62
|
+
decimalStr: ''
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
if (typeof num === 'number') {
|
|
66
|
+
numInfo.numStr = num + '';
|
|
67
|
+
} else {
|
|
68
|
+
numInfo.numStr = num.replace(/,/g, '');
|
|
69
|
+
|
|
70
|
+
if (isExp(numInfo.numStr)) {
|
|
71
|
+
numInfo.numStr = exponentToFloat(numInfo.numStr);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
var floatNum = _Number$parseFloat(numInfo.numStr); // 非纯数字不处理,直接返回''
|
|
76
|
+
// if (Number.isNaN(floatNum)) return ''
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
if (_Number$isNaN(Number(num))) {
|
|
80
|
+
// throw new Error('toFixed() number argument must be a valid number')
|
|
81
|
+
return num + '';
|
|
82
|
+
} // 为零不显示,且等于零,直接返回''
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
if (!zeroShow && Number(num) === 0) return '';
|
|
86
|
+
var maskInfo = analyzMask(mask);
|
|
87
|
+
if (maskInfo.errorMask) return numInfo.numStr;
|
|
88
|
+
|
|
89
|
+
var isIncludePercent = _includesInstanceProperty(_context = numInfo.numStr).call(_context, '%');
|
|
90
|
+
|
|
91
|
+
if (maskInfo.percent) {
|
|
92
|
+
if (!isIncludePercent) {
|
|
93
|
+
var _context2;
|
|
94
|
+
|
|
95
|
+
var point = numInfo.numStr.indexOf('.');
|
|
96
|
+
var length = numInfo.numStr.length;
|
|
97
|
+
|
|
98
|
+
if (point < 0) {
|
|
99
|
+
numInfo.numStr = numInfo.numStr + '00';
|
|
100
|
+
} else if (point === length - 1) {
|
|
101
|
+
numInfo.numStr = numInfo.numStr.replace('.', '') + '00';
|
|
102
|
+
} else if (point === length - 2) {
|
|
103
|
+
numInfo.numStr = numInfo.numStr.replace('.', '') + '0';
|
|
104
|
+
} else {
|
|
105
|
+
var numStr = numInfo.numStr.replace('.', '');
|
|
106
|
+
numInfo.numStr = numStr.substring(0, point + 2) + '.' + numStr.substring(point + 2);
|
|
107
|
+
} // 去掉数字前面的零
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
numInfo.numStr = numInfo.numStr.replace(/^0+/, '');
|
|
111
|
+
if (numInfo.numStr === '.') numInfo.numStr = '0';
|
|
112
|
+
|
|
113
|
+
if (_includesInstanceProperty(_context2 = numInfo.numStr).call(_context2, '-')) {
|
|
114
|
+
// 负数的情况 去掉前面的0
|
|
115
|
+
numInfo.numStr = numInfo.numStr.replace('-', '');
|
|
116
|
+
numInfo.numStr = numInfo.numStr.replace(/^0+/, '');
|
|
117
|
+
numInfo.numStr = '-' + numInfo.numStr;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
floatNum = floatNum * 100;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
var isNegativeNumber = floatNum < 0; // 是否是负数
|
|
125
|
+
|
|
126
|
+
if (isNegativeNumber) {
|
|
127
|
+
var _context3;
|
|
128
|
+
|
|
129
|
+
floatNum = Math.abs(floatNum);
|
|
130
|
+
numInfo.numStr = _sliceInstanceProperty(_context3 = numInfo.numStr).call(_context3, 1); // 去除第一个负号
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
var numStrArr = numInfo.numStr.split('.');
|
|
134
|
+
numInfo.intStr = numStrArr[0];
|
|
135
|
+
numInfo.decimalStr = numStrArr[1] || '';
|
|
136
|
+
|
|
137
|
+
if (!showDecimalTailZero) {
|
|
138
|
+
numInfo = cutTailZero(numInfo);
|
|
139
|
+
} // 小数部分处理。暂时不考虑其他。只校验位数和尾数补零问题,整数
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
if (decimalLength !== undefined && decimalLength >= 0) {
|
|
143
|
+
// floatNum = Number.parseFloat(numInfo.numStr) // 当整数位数大于16位时,parseFloat会丢掉末尾的值,有问题!!!
|
|
144
|
+
numInfo.numStr = toFixed(numInfo.numStr, decimalLength, isRound);
|
|
145
|
+
numStrArr = numInfo.numStr.split('.'); // 去除整数部分多余的 0
|
|
146
|
+
|
|
147
|
+
var intStr = numStrArr[0].replace(/^0+/, '');
|
|
148
|
+
numInfo.intStr = intStr === '' ? '0' : intStr;
|
|
149
|
+
numInfo.decimalStr = numStrArr[1] || '';
|
|
150
|
+
|
|
151
|
+
if (!showDecimalTailZero) {
|
|
152
|
+
numInfo = cutTailZero(numInfo);
|
|
153
|
+
}
|
|
154
|
+
} // 整数部分格式化
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
var formatValue = intFormatMask(maskInfo.intMask, numInfo.intStr);
|
|
158
|
+
var currencySign = maskInfo.currencySign ? '$' : '';
|
|
159
|
+
|
|
160
|
+
if (param.symbol) {
|
|
161
|
+
currencySign = param.symbol;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return currencySign + (isNegativeNumber ? '-' : '') + (formatValue || numInfo.intStr || '0') + (numInfo.decimalStr.length > 0 ? '.' : '') + numInfo.decimalStr + (maskInfo.percent ? '%' : '');
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* 格式化数字字段编辑态的值
|
|
168
|
+
* 不支持掩码的格式化信息
|
|
169
|
+
* @param {*} num
|
|
170
|
+
* @param {*} param
|
|
171
|
+
*/
|
|
172
|
+
|
|
173
|
+
export function formatEditNumber(num, _ref) {
|
|
174
|
+
var _ref$zeroShow = _ref.zeroShow,
|
|
175
|
+
zeroShow = _ref$zeroShow === void 0 ? false : _ref$zeroShow,
|
|
176
|
+
decimalLength = _ref.decimalLength,
|
|
177
|
+
_ref$showDecimalTailZ = _ref.showDecimalTailZero,
|
|
178
|
+
showDecimalTailZero = _ref$showDecimalTailZ === void 0 ? false : _ref$showDecimalTailZ,
|
|
179
|
+
_ref$roundMethod = _ref.roundMethod,
|
|
180
|
+
roundMethod = _ref$roundMethod === void 0 ? '0' : _ref$roundMethod,
|
|
181
|
+
symbol = _ref.symbol;
|
|
182
|
+
// 如果精度超过100,直接返回数值
|
|
183
|
+
if (decimalLength && (decimalLength < 0 || decimalLength > 100)) return num + '';
|
|
184
|
+
if (num === undefined || num === null) num = '';
|
|
185
|
+
var numInfo = {
|
|
186
|
+
numStr: '',
|
|
187
|
+
intStr: '',
|
|
188
|
+
decimalStr: ''
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
if (typeof num === 'number') {
|
|
192
|
+
numInfo.numStr = num + '';
|
|
193
|
+
} else {
|
|
194
|
+
numInfo.numStr = num.replace(/,/g, '');
|
|
195
|
+
|
|
196
|
+
if (isExp(numInfo.numStr)) {
|
|
197
|
+
numInfo.numStr = exponentToFloat(numInfo.numStr);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (symbol && numInfo.numStr.indexOf(symbol) === 0) {
|
|
201
|
+
numInfo.numStr = numInfo.numStr.replace(symbol, '');
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
var floatNum = _Number$parseFloat(numInfo.numStr); // 非纯数字不处理,直接返回''
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
if (_Number$isNaN(floatNum)) return ''; // 为零不显示,且等于零,直接返回''
|
|
209
|
+
|
|
210
|
+
if (!zeroShow && floatNum === 0) return '';
|
|
211
|
+
var isNegativeNumber = floatNum < 0; // 是否是负数
|
|
212
|
+
|
|
213
|
+
if (isNegativeNumber) {
|
|
214
|
+
var _context4;
|
|
215
|
+
|
|
216
|
+
floatNum = Math.abs(floatNum);
|
|
217
|
+
numInfo.numStr = _sliceInstanceProperty(_context4 = numInfo.numStr).call(_context4, 1); // 去除第一个负号
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
var numStrArr = numInfo.numStr.split('.');
|
|
221
|
+
numInfo.intStr = numStrArr[0];
|
|
222
|
+
numInfo.decimalStr = numStrArr[1] || '';
|
|
223
|
+
|
|
224
|
+
if (!showDecimalTailZero) {
|
|
225
|
+
numInfo = cutTailZero(numInfo);
|
|
226
|
+
} // 小数部分处理。暂时不考虑其他。只校验位数和尾数补零问题,整数
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
if (decimalLength != null && decimalLength >= 0) {
|
|
230
|
+
// floatNum = Number.parseFloat(numInfo.numStr) // 当整数位数大于16位时,parseFloat会丢掉末尾的值
|
|
231
|
+
var isRound = roundMethod.toString() === '1'; // 是否四舍五入
|
|
232
|
+
|
|
233
|
+
numInfo.numStr = toFixed(numInfo.numStr, decimalLength, isRound);
|
|
234
|
+
numStrArr = numInfo.numStr.split('.');
|
|
235
|
+
numInfo.intStr = numStrArr[0];
|
|
236
|
+
numInfo.decimalStr = numStrArr[1] || '';
|
|
237
|
+
|
|
238
|
+
if (!showDecimalTailZero) {
|
|
239
|
+
numInfo = cutTailZero(numInfo);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
return (isNegativeNumber ? '-' : '') + (numInfo.intStr || '0') + (numInfo.decimalStr.length > 0 ? '.' : '') + numInfo.decimalStr;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function analyzMask(mask) {
|
|
247
|
+
var maskInfo = {
|
|
248
|
+
errorMask: false,
|
|
249
|
+
currencySign: false,
|
|
250
|
+
percent: false,
|
|
251
|
+
intMask: '',
|
|
252
|
+
decimalMask: '',
|
|
253
|
+
formatMask: ''
|
|
254
|
+
};
|
|
255
|
+
mask = mask.replace(/%%/g, '');
|
|
256
|
+
maskInfo.currencySign = mask.indexOf('$') >= 0; // 是否显示货币标识
|
|
257
|
+
|
|
258
|
+
maskInfo.percent = mask.indexOf('%') >= 0; // 是否有百分号
|
|
259
|
+
|
|
260
|
+
mask = mask.replace(/%/g, '').replace(/\$/g, ''); // 清楚上面的特殊字符
|
|
261
|
+
|
|
262
|
+
var masks = mask.split('.'); // 以小数点为界切分掩码
|
|
263
|
+
|
|
264
|
+
if (masks.length > 2) {
|
|
265
|
+
maskInfo.errorMask = true;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
maskInfo.intMask = masks[0];
|
|
269
|
+
maskInfo.decimalMask = masks[1];
|
|
270
|
+
maskInfo.formatMask = mask;
|
|
271
|
+
return maskInfo;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function cutTailZero(numInfo) {
|
|
275
|
+
var decimalStr = numInfo.decimalStr;
|
|
276
|
+
var len = decimalStr.length;
|
|
277
|
+
|
|
278
|
+
if (len > 0) {
|
|
279
|
+
for (var i = len - 1; i >= 0; i--) {
|
|
280
|
+
if (decimalStr[i] === '0') {
|
|
281
|
+
decimalStr = _sliceInstanceProperty(decimalStr).call(decimalStr, 0, i);
|
|
282
|
+
} else {
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
numInfo.decimalStr = decimalStr;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
return numInfo;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function intFormatMask(intMask, intValue) {
|
|
294
|
+
var numGroupFormat = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
295
|
+
var index = 0;
|
|
296
|
+
var firstHashIndex = intMask.indexOf('#');
|
|
297
|
+
var lastHashIndex = intMask.lastIndexOf('#');
|
|
298
|
+
var formatValue = '';
|
|
299
|
+
|
|
300
|
+
if (intMask.split(',').length > 1) {
|
|
301
|
+
// 如果包含多个分隔符,则认为是末尾分隔符为分组数
|
|
302
|
+
lastHashIndex = intMask.length - 1 - intMask.lastIndexOf(',');
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
for (var i = intMask.length - 1; i >= 0;) {
|
|
306
|
+
var char = intMask.charAt(i);
|
|
307
|
+
|
|
308
|
+
switch (char) {
|
|
309
|
+
case '0':
|
|
310
|
+
// 数字必录
|
|
311
|
+
formatValue = (intValue.charAt(intValue.length - 1 - index) || '0') + formatValue;
|
|
312
|
+
index++;
|
|
313
|
+
i--;
|
|
314
|
+
break;
|
|
315
|
+
|
|
316
|
+
case '9':
|
|
317
|
+
// 数字可选
|
|
318
|
+
formatValue = intValue.charAt(intValue.length - 1 - index) + formatValue;
|
|
319
|
+
index++;
|
|
320
|
+
i--;
|
|
321
|
+
break;
|
|
322
|
+
|
|
323
|
+
case '#':
|
|
324
|
+
// 递归
|
|
325
|
+
formatValue = intValue.charAt(intValue.length - 1 - index) + formatValue;
|
|
326
|
+
index++;
|
|
327
|
+
i = i === firstHashIndex ? lastHashIndex : i - 1;
|
|
328
|
+
break;
|
|
329
|
+
|
|
330
|
+
default:
|
|
331
|
+
if (numGroupFormat) char = numGroupFormat;
|
|
332
|
+
formatValue = char + formatValue;
|
|
333
|
+
i--;
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
if (index >= intValue.length) break;
|
|
338
|
+
} // 如果第一个字符不是数字,去掉
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
if (formatValue && !/^[0-9]*$/.test(formatValue.charAt(0))) {
|
|
342
|
+
formatValue = formatValue.substring(1);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
return formatValue;
|
|
346
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @description 点击指定区域外执行回调
|
|
4
|
+
*
|
|
5
|
+
* @export
|
|
6
|
+
* @param {RefObject<HTMLElement>[]} refs
|
|
7
|
+
* @param {(e: Event) => void} handler
|
|
8
|
+
*/
|
|
9
|
+
export declare function useOnClickOutside(refs: RefObject<HTMLElement>[], handler: (e: Event) => void): void;
|
|
10
|
+
/**
|
|
11
|
+
* @description 合并状态
|
|
12
|
+
*
|
|
13
|
+
* @export
|
|
14
|
+
* @template T
|
|
15
|
+
* @template R
|
|
16
|
+
* @param {(T | (() => T))} defaultStateValue
|
|
17
|
+
* @param {({
|
|
18
|
+
* defaultValue?: T | (() => T)
|
|
19
|
+
* value?: T
|
|
20
|
+
* onChange?: (value: T, prevValue: T) => void
|
|
21
|
+
* postState?: (value: T) => T
|
|
22
|
+
* })} [option]
|
|
23
|
+
* @returns {[R, (value: T) => void]}
|
|
24
|
+
*/
|
|
25
|
+
export declare function useMergedState<T, R = T>(defaultStateValue: T | (() => T), // 初始state
|
|
26
|
+
option?: {
|
|
27
|
+
defaultValue?: T | (() => T);
|
|
28
|
+
value?: T;
|
|
29
|
+
onChange?: (value: T, prevValue: T) => void;
|
|
30
|
+
postState?: (value: T) => T;
|
|
31
|
+
}): [R, (value: T) => void];
|
|
32
|
+
/**
|
|
33
|
+
* @description 获取之前的值
|
|
34
|
+
*
|
|
35
|
+
* @export
|
|
36
|
+
* @param {P} value
|
|
37
|
+
*/
|
|
38
|
+
export declare function usePrevious<P>(value: P): P;
|
|
39
|
+
interface ContentRectType {
|
|
40
|
+
hide: boolean;
|
|
41
|
+
bottom: number;
|
|
42
|
+
height: number;
|
|
43
|
+
left: number;
|
|
44
|
+
right: number;
|
|
45
|
+
top: number;
|
|
46
|
+
width: number;
|
|
47
|
+
x: number;
|
|
48
|
+
y: number;
|
|
49
|
+
}
|
|
50
|
+
export declare function useResizeObserver(element: HTMLElement | null, handler?: (react: ContentRectType) => void): void;
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,165 @@
|
|
|
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 _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
7
|
+
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
8
|
+
|
|
9
|
+
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; } } }; }
|
|
10
|
+
|
|
11
|
+
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); }
|
|
12
|
+
|
|
13
|
+
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; }
|
|
14
|
+
|
|
15
|
+
import { useEffect, useState, useRef } from 'react';
|
|
16
|
+
import ResizeObserver from 'resize-observer-polyfill';
|
|
17
|
+
import devWarning from './devwarning';
|
|
18
|
+
/**
|
|
19
|
+
* @description 点击指定区域外执行回调
|
|
20
|
+
*
|
|
21
|
+
* @export
|
|
22
|
+
* @param {RefObject<HTMLElement>[]} refs
|
|
23
|
+
* @param {(e: Event) => void} handler
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
export function useOnClickOutside(refs, handler) {
|
|
27
|
+
useEffect(function () {
|
|
28
|
+
var listener = function listener(event) {
|
|
29
|
+
var _iterator = _createForOfIteratorHelper(refs),
|
|
30
|
+
_step;
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
34
|
+
var ref = _step.value;
|
|
35
|
+
|
|
36
|
+
if (!ref.current || ref.current.contains(event.target)) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
} catch (err) {
|
|
41
|
+
_iterator.e(err);
|
|
42
|
+
} finally {
|
|
43
|
+
_iterator.f();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
handler(event);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
document.addEventListener('mousedown', listener);
|
|
50
|
+
document.addEventListener('touchstart', listener);
|
|
51
|
+
return function () {
|
|
52
|
+
document.removeEventListener('mousedown', listener);
|
|
53
|
+
document.removeEventListener('touchstart', listener);
|
|
54
|
+
};
|
|
55
|
+
}, [refs, handler]);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @description 合并状态
|
|
59
|
+
*
|
|
60
|
+
* @export
|
|
61
|
+
* @template T
|
|
62
|
+
* @template R
|
|
63
|
+
* @param {(T | (() => T))} defaultStateValue
|
|
64
|
+
* @param {({
|
|
65
|
+
* defaultValue?: T | (() => T)
|
|
66
|
+
* value?: T
|
|
67
|
+
* onChange?: (value: T, prevValue: T) => void
|
|
68
|
+
* postState?: (value: T) => T
|
|
69
|
+
* })} [option]
|
|
70
|
+
* @returns {[R, (value: T) => void]}
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
export function useMergedState(defaultStateValue, // 初始state
|
|
74
|
+
option) {
|
|
75
|
+
var _ref = option || {},
|
|
76
|
+
defaultValue = _ref.defaultValue,
|
|
77
|
+
value = _ref.value,
|
|
78
|
+
onChange = _ref.onChange,
|
|
79
|
+
postState = _ref.postState;
|
|
80
|
+
|
|
81
|
+
var _useState = useState(function () {
|
|
82
|
+
if (value !== undefined) {
|
|
83
|
+
return value;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (defaultValue !== undefined) {
|
|
87
|
+
return typeof defaultValue === 'function' ? defaultValue() : defaultValue;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return typeof defaultStateValue === 'function' ? defaultStateValue() : defaultStateValue;
|
|
91
|
+
}),
|
|
92
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
93
|
+
innerValue = _useState2[0],
|
|
94
|
+
setInnerValue = _useState2[1];
|
|
95
|
+
|
|
96
|
+
var mergedValue = value !== undefined ? value : innerValue;
|
|
97
|
+
|
|
98
|
+
if (postState) {
|
|
99
|
+
mergedValue = postState(mergedValue);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function triggerChange(newValue) {
|
|
103
|
+
setInnerValue(newValue);
|
|
104
|
+
|
|
105
|
+
if (mergedValue !== newValue && onChange) {
|
|
106
|
+
onChange(newValue, mergedValue);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
var firstRenderRef = useRef(true);
|
|
111
|
+
useEffect(function () {
|
|
112
|
+
if (firstRenderRef.current) {
|
|
113
|
+
firstRenderRef.current = false;
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (value === undefined) {
|
|
118
|
+
setInnerValue(value);
|
|
119
|
+
}
|
|
120
|
+
}, [value]);
|
|
121
|
+
return [mergedValue, triggerChange];
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* @description 获取之前的值
|
|
125
|
+
*
|
|
126
|
+
* @export
|
|
127
|
+
* @param {P} value
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
export function usePrevious(value) {
|
|
131
|
+
var ref = useRef(value);
|
|
132
|
+
useEffect(function () {
|
|
133
|
+
ref.current = value;
|
|
134
|
+
}, [value]);
|
|
135
|
+
return ref.current;
|
|
136
|
+
}
|
|
137
|
+
export function useResizeObserver(element, handler) {
|
|
138
|
+
useEffect(function () {
|
|
139
|
+
if (!element) {
|
|
140
|
+
devWarning(!element && element !== null, 'useResizeMeasure', 'useResizeMeasure指定的元素不存在');
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
var measure = function measure(entries) {
|
|
145
|
+
if (!entries[0] || !entries[0].contentRect) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
var contentRect = entries[0].contentRect;
|
|
150
|
+
var hide = contentRect.width === 0 && contentRect.height === 0; // 隐藏条件:高宽都为0
|
|
151
|
+
|
|
152
|
+
var rect = _extends({
|
|
153
|
+
hide: hide
|
|
154
|
+
}, contentRect);
|
|
155
|
+
|
|
156
|
+
handler && handler(rect);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
var resizeObserver = new ResizeObserver(measure);
|
|
160
|
+
resizeObserver && resizeObserver.observe(element);
|
|
161
|
+
return function () {
|
|
162
|
+
resizeObserver && resizeObserver.disconnect();
|
|
163
|
+
};
|
|
164
|
+
}, [element, handler]);
|
|
165
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import compDefaultProps from '../config-provider/compDefaultProps';
|
|
2
|
+
/**
|
|
3
|
+
* 结合compDefaultProps、用户自定义默认属性和组件当前属性获取组件实际应用属性
|
|
4
|
+
* @param {keyof typeof compDefaultProps} compName 组件名
|
|
5
|
+
* @param {any} userDefaultProps 用户自定义组件默认属性
|
|
6
|
+
* @param {any} compProps 组件接收到的属性
|
|
7
|
+
*/
|
|
8
|
+
export declare const getCompProps: (compName: keyof typeof compDefaultProps, userDefaultProps?: any, compProps?: any) => any;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
|
+
import compDefaultProps from '../config-provider/compDefaultProps'; // kd-ui提供组件默认属性
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 结合compDefaultProps、用户自定义默认属性和组件当前属性获取组件实际应用属性
|
|
6
|
+
* @param {keyof typeof compDefaultProps} compName 组件名
|
|
7
|
+
* @param {any} userDefaultProps 用户自定义组件默认属性
|
|
8
|
+
* @param {any} compProps 组件接收到的属性
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export var getCompProps = function getCompProps(compName, userDefaultProps, compProps) {
|
|
12
|
+
var defaultProps = compDefaultProps[compName];
|
|
13
|
+
var userProps = userDefaultProps && userDefaultProps[compName] || {};
|
|
14
|
+
return _extends({}, defaultProps, userProps, compProps || {});
|
|
15
|
+
};
|