@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,324 @@
|
|
|
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 _toConsumableArray from "@babel/runtime-corejs3/helpers/toConsumableArray";
|
|
8
|
+
import _flatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/flat";
|
|
9
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
10
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
11
|
+
|
|
12
|
+
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; } } }; }
|
|
13
|
+
|
|
14
|
+
function _unsupportedIterableToArray(o, minLen) { var _context6; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context6 = Object.prototype.toString.call(o)).call(_context6, 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); }
|
|
15
|
+
|
|
16
|
+
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; }
|
|
17
|
+
|
|
18
|
+
import cx from 'classnames';
|
|
19
|
+
import React from 'react';
|
|
20
|
+
import { getTreeDepth, isLeafNode } from '../utils';
|
|
21
|
+
import { Classes } from './styles';
|
|
22
|
+
|
|
23
|
+
function range(n) {
|
|
24
|
+
var array = [];
|
|
25
|
+
|
|
26
|
+
for (var i = 0; i < n; i++) {
|
|
27
|
+
array.push(i);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return array;
|
|
31
|
+
}
|
|
32
|
+
/** 根据当前横向虚拟滚动 对 nested.center 进行过滤,结果只保留当前视野内可见的那些列配置 */
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
function filterNestedCenter(centerNested, hoz, leftFlatCount) {
|
|
36
|
+
return dfs(centerNested, leftFlatCount).filtered;
|
|
37
|
+
|
|
38
|
+
function dfs(cols, startColIndex) {
|
|
39
|
+
var leafCount = 0;
|
|
40
|
+
var filtered = [];
|
|
41
|
+
|
|
42
|
+
var _iterator = _createForOfIteratorHelper(cols),
|
|
43
|
+
_step;
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
47
|
+
var col = _step.value;
|
|
48
|
+
var colIndex = startColIndex + leafCount;
|
|
49
|
+
|
|
50
|
+
if (isLeafNode(col)) {
|
|
51
|
+
leafCount += 1;
|
|
52
|
+
|
|
53
|
+
if (leftFlatCount + hoz.leftIndex <= colIndex && colIndex < leftFlatCount + hoz.rightIndex) {
|
|
54
|
+
filtered.push({
|
|
55
|
+
colIndex: colIndex,
|
|
56
|
+
col: col
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
} else {
|
|
60
|
+
var dfsRes = dfs(col.children, colIndex);
|
|
61
|
+
leafCount += dfsRes.leafCount;
|
|
62
|
+
|
|
63
|
+
if (dfsRes.filtered.length > 0) {
|
|
64
|
+
filtered.push({
|
|
65
|
+
colIndex: colIndex,
|
|
66
|
+
col: col,
|
|
67
|
+
children: dfsRes.filtered
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
} catch (err) {
|
|
73
|
+
_iterator.e(err);
|
|
74
|
+
} finally {
|
|
75
|
+
_iterator.f();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
filtered: filtered,
|
|
80
|
+
leafCount: leafCount
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/** 根据输入的 nested 列配置,算出相应的 leveled & flat 配置方便渲染 */
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
function calculateLeveledAndFlat(inputNested, rowCount) {
|
|
88
|
+
var leveled = [];
|
|
89
|
+
|
|
90
|
+
for (var depth = 0; depth < rowCount; depth++) {
|
|
91
|
+
leveled.push([]);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
var flat = [];
|
|
95
|
+
dfs(inputNested, 0);
|
|
96
|
+
return {
|
|
97
|
+
flat: flat,
|
|
98
|
+
leveled: leveled
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
function dfs(input, depth) {
|
|
102
|
+
var leafCount = 0;
|
|
103
|
+
|
|
104
|
+
for (var i = 0; i < input.length; i++) {
|
|
105
|
+
var indexedCol = input[i];
|
|
106
|
+
|
|
107
|
+
if (isLeafNode(indexedCol)) {
|
|
108
|
+
leafCount += 1;
|
|
109
|
+
var wrapped = {
|
|
110
|
+
type: 'normal',
|
|
111
|
+
width: indexedCol.col.width,
|
|
112
|
+
col: indexedCol.col,
|
|
113
|
+
colIndex: indexedCol.colIndex,
|
|
114
|
+
colSpan: 1,
|
|
115
|
+
isLeaf: true
|
|
116
|
+
};
|
|
117
|
+
leveled[depth].push(wrapped);
|
|
118
|
+
flat.push(wrapped);
|
|
119
|
+
} else {
|
|
120
|
+
var dfsRes = dfs(indexedCol.children, depth + 1);
|
|
121
|
+
leafCount += dfsRes.leafCount;
|
|
122
|
+
|
|
123
|
+
if (dfsRes.leafCount > 0) {
|
|
124
|
+
leveled[depth].push({
|
|
125
|
+
type: 'normal',
|
|
126
|
+
width: indexedCol.col.width,
|
|
127
|
+
col: indexedCol.col,
|
|
128
|
+
colIndex: indexedCol.colIndex,
|
|
129
|
+
colSpan: dfsRes.leafCount,
|
|
130
|
+
isLeaf: false
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return {
|
|
137
|
+
leafCount: leafCount
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/** 包装列配置,附加上 colIndex 属性 */
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
function attachColIndex(inputNested, colIndexOffset) {
|
|
145
|
+
return dfs(inputNested, colIndexOffset).result;
|
|
146
|
+
|
|
147
|
+
function dfs(input, startColIndex) {
|
|
148
|
+
var result = [];
|
|
149
|
+
var leafCount = 0;
|
|
150
|
+
|
|
151
|
+
for (var i = 0; i < input.length; i++) {
|
|
152
|
+
var col = input[i];
|
|
153
|
+
var colIndex = startColIndex + leafCount;
|
|
154
|
+
|
|
155
|
+
if (isLeafNode(col)) {
|
|
156
|
+
leafCount += 1;
|
|
157
|
+
result.push({
|
|
158
|
+
colIndex: colIndex,
|
|
159
|
+
col: col
|
|
160
|
+
});
|
|
161
|
+
} else {
|
|
162
|
+
var sub = dfs(col.children, colIndex);
|
|
163
|
+
leafCount += sub.leafCount;
|
|
164
|
+
|
|
165
|
+
if (sub.leafCount > 0) {
|
|
166
|
+
result.push({
|
|
167
|
+
col: col,
|
|
168
|
+
colIndex: colIndex,
|
|
169
|
+
children: sub.result
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return {
|
|
176
|
+
result: result,
|
|
177
|
+
leafCount: leafCount
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/** 计算用于渲染表头的数据结构 */
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
function calculateHeaderRenderInfo(_ref, rowCount) {
|
|
185
|
+
var flat = _flatInstanceProperty(_ref),
|
|
186
|
+
nested = _ref.nested,
|
|
187
|
+
hoz = _ref.horizontalRenderRange,
|
|
188
|
+
useVirtual = _ref.useVirtual;
|
|
189
|
+
|
|
190
|
+
if (useVirtual.header) {
|
|
191
|
+
var _context, _context2;
|
|
192
|
+
|
|
193
|
+
var leftPart = calculateLeveledAndFlat(attachColIndex(nested.left, 0), rowCount);
|
|
194
|
+
var filtered = filterNestedCenter(nested.center, hoz, flat.left.length);
|
|
195
|
+
var centerPart = calculateLeveledAndFlat(filtered, rowCount);
|
|
196
|
+
var rightPart = calculateLeveledAndFlat(attachColIndex(nested.right, flat.left.length + flat.center.length), rowCount);
|
|
197
|
+
return {
|
|
198
|
+
flat: _concatInstanceProperty(_context = []).call(_context, _toConsumableArray(_flatInstanceProperty(leftPart)), [{
|
|
199
|
+
type: 'blank',
|
|
200
|
+
width: hoz.leftBlank,
|
|
201
|
+
blankSide: 'left'
|
|
202
|
+
}], _toConsumableArray(_flatInstanceProperty(centerPart)), [{
|
|
203
|
+
type: 'blank',
|
|
204
|
+
width: hoz.rightBlank,
|
|
205
|
+
blankSide: 'right'
|
|
206
|
+
}], _toConsumableArray(_flatInstanceProperty(rightPart))),
|
|
207
|
+
leveled: _mapInstanceProperty(_context2 = range(rowCount)).call(_context2, function (depth) {
|
|
208
|
+
var _context3;
|
|
209
|
+
|
|
210
|
+
return _concatInstanceProperty(_context3 = []).call(_context3, _toConsumableArray(leftPart.leveled[depth]), [{
|
|
211
|
+
type: 'blank',
|
|
212
|
+
width: hoz.leftBlank,
|
|
213
|
+
blankSide: 'left'
|
|
214
|
+
}], _toConsumableArray(centerPart.leveled[depth]), [{
|
|
215
|
+
type: 'blank',
|
|
216
|
+
width: hoz.rightBlank,
|
|
217
|
+
blankSide: 'right'
|
|
218
|
+
}], _toConsumableArray(rightPart.leveled[depth]));
|
|
219
|
+
})
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return calculateLeveledAndFlat(attachColIndex(nested.full, 0), rowCount);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export default function TableHeader(_ref2) {
|
|
227
|
+
var _context4, _context5;
|
|
228
|
+
|
|
229
|
+
var info = _ref2.info;
|
|
230
|
+
|
|
231
|
+
var nested = info.nested,
|
|
232
|
+
flat = _flatInstanceProperty(info),
|
|
233
|
+
stickyLeftMap = info.stickyLeftMap,
|
|
234
|
+
stickyRightMap = info.stickyRightMap;
|
|
235
|
+
|
|
236
|
+
var rowCount = getTreeDepth(nested.full) + 1;
|
|
237
|
+
var headerRenderInfo = calculateHeaderRenderInfo(info, rowCount);
|
|
238
|
+
var fullFlatCount = flat.full.length;
|
|
239
|
+
var leftFlatCount = flat.left.length;
|
|
240
|
+
var rightFlatCount = flat.right.length;
|
|
241
|
+
|
|
242
|
+
var thead = _mapInstanceProperty(_context4 = headerRenderInfo.leveled).call(_context4, function (wrappedCols, level) {
|
|
243
|
+
var headerCells = _mapInstanceProperty(wrappedCols).call(wrappedCols, function (wrapped, index) {
|
|
244
|
+
var _a, _b, _c;
|
|
245
|
+
|
|
246
|
+
if (wrapped.type === 'normal') {
|
|
247
|
+
var colIndex = wrapped.colIndex,
|
|
248
|
+
colSpan = wrapped.colSpan,
|
|
249
|
+
isLeaf = wrapped.isLeaf,
|
|
250
|
+
col = wrapped.col;
|
|
251
|
+
var headerCellProps = (_a = col.headerCellProps) !== null && _a !== void 0 ? _a : {};
|
|
252
|
+
var positionStyle = {};
|
|
253
|
+
|
|
254
|
+
if (colIndex < leftFlatCount) {
|
|
255
|
+
positionStyle.position = 'sticky';
|
|
256
|
+
positionStyle.left = stickyLeftMap.get(colIndex);
|
|
257
|
+
} else if (colIndex >= fullFlatCount - rightFlatCount) {
|
|
258
|
+
positionStyle.position = 'sticky';
|
|
259
|
+
positionStyle.right = stickyRightMap.get(colIndex);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
var cell = /*#__PURE__*/React.createElement("th", _extends({
|
|
263
|
+
key: colIndex
|
|
264
|
+
}, headerCellProps, {
|
|
265
|
+
className: cx(Classes.tableHeaderCell, headerCellProps.className, {
|
|
266
|
+
first: colIndex === 0,
|
|
267
|
+
last: colIndex + colSpan === fullFlatCount,
|
|
268
|
+
'lock-left': colIndex < leftFlatCount,
|
|
269
|
+
'lock-right': colIndex >= fullFlatCount - rightFlatCount,
|
|
270
|
+
leaf: wrapped.isLeaf
|
|
271
|
+
}),
|
|
272
|
+
colSpan: colSpan,
|
|
273
|
+
rowSpan: isLeaf ? rowCount - level : undefined,
|
|
274
|
+
style: _extends(_extends({
|
|
275
|
+
textAlign: col.align,
|
|
276
|
+
verticalAlign: (_b = col.verticalAlign) !== null && _b !== void 0 ? _b : 'middle'
|
|
277
|
+
}, headerCellProps.style), positionStyle),
|
|
278
|
+
"data-code": col.code
|
|
279
|
+
}), (_c = col.title) !== null && _c !== void 0 ? _c : col.name);
|
|
280
|
+
return cell;
|
|
281
|
+
} else {
|
|
282
|
+
if (wrapped.width > 0) {
|
|
283
|
+
return /*#__PURE__*/React.createElement("th", {
|
|
284
|
+
key: wrapped.blankSide
|
|
285
|
+
});
|
|
286
|
+
} else {
|
|
287
|
+
return null;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
return /*#__PURE__*/React.createElement("tr", {
|
|
293
|
+
key: level,
|
|
294
|
+
className: cx(Classes.tableHeaderRow, {
|
|
295
|
+
first: level === 0,
|
|
296
|
+
last: level === rowCount - 1
|
|
297
|
+
})
|
|
298
|
+
}, headerCells);
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
var colgroup = _mapInstanceProperty(_context5 = _flatInstanceProperty(headerRenderInfo)).call(_context5, function (wrapped) {
|
|
302
|
+
if (wrapped.type === 'blank') {
|
|
303
|
+
if (wrapped.width > 0) {
|
|
304
|
+
return /*#__PURE__*/React.createElement("col", {
|
|
305
|
+
key: wrapped.blankSide,
|
|
306
|
+
style: {
|
|
307
|
+
width: wrapped.width
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
} else {
|
|
311
|
+
return null;
|
|
312
|
+
}
|
|
313
|
+
} else {
|
|
314
|
+
return /*#__PURE__*/React.createElement("col", {
|
|
315
|
+
key: wrapped.colIndex,
|
|
316
|
+
style: {
|
|
317
|
+
width: wrapped.width
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
return /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("colgroup", null, colgroup), /*#__PURE__*/React.createElement("thead", null, thead));
|
|
324
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** 在表格的单元格的渲染过程中,先渲染的单元格的 colSpan/rowSpan 会影响到后续单元格是否被渲染
|
|
2
|
+
* `SpanManager` 会在内部维护一份状态来记录最近渲染单元格的 colSpan/rowSpan,
|
|
3
|
+
* 方便后续的单元格快速判断 "是否需要跳过渲染" */
|
|
4
|
+
export default class SpanManager {
|
|
5
|
+
private rects;
|
|
6
|
+
testSkip(rowIndex: number, colIndex: number): boolean;
|
|
7
|
+
stripUpwards(rowIndex: number): void;
|
|
8
|
+
add(rowIndex: number, colIndex: number, colSpan: number, rowSpan: number): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
3
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
4
|
+
|
|
5
|
+
/** 在表格的单元格的渲染过程中,先渲染的单元格的 colSpan/rowSpan 会影响到后续单元格是否被渲染
|
|
6
|
+
* `SpanManager` 会在内部维护一份状态来记录最近渲染单元格的 colSpan/rowSpan,
|
|
7
|
+
* 方便后续的单元格快速判断 "是否需要跳过渲染" */
|
|
8
|
+
var SpanManager = /*#__PURE__*/function () {
|
|
9
|
+
function SpanManager() {
|
|
10
|
+
_classCallCheck(this, SpanManager);
|
|
11
|
+
|
|
12
|
+
this.rects = [];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
_createClass(SpanManager, [{
|
|
16
|
+
key: "testSkip",
|
|
17
|
+
value: function testSkip(rowIndex, colIndex) {
|
|
18
|
+
return this.rects.some(function (_ref) {
|
|
19
|
+
var left = _ref.left,
|
|
20
|
+
right = _ref.right,
|
|
21
|
+
top = _ref.top,
|
|
22
|
+
bottom = _ref.bottom;
|
|
23
|
+
return left <= colIndex && colIndex < right && top <= rowIndex && rowIndex < bottom;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}, {
|
|
27
|
+
key: "stripUpwards",
|
|
28
|
+
value: function stripUpwards(rowIndex) {
|
|
29
|
+
var _context;
|
|
30
|
+
|
|
31
|
+
this.rects = _filterInstanceProperty(_context = this.rects).call(_context, function (rect) {
|
|
32
|
+
return rect.bottom > rowIndex;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}, {
|
|
36
|
+
key: "add",
|
|
37
|
+
value: function add(rowIndex, colIndex, colSpan, rowSpan) {
|
|
38
|
+
this.rects.push({
|
|
39
|
+
left: colIndex,
|
|
40
|
+
right: colIndex + colSpan,
|
|
41
|
+
top: rowIndex,
|
|
42
|
+
bottom: rowIndex + rowSpan
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}]);
|
|
46
|
+
|
|
47
|
+
return SpanManager;
|
|
48
|
+
}();
|
|
49
|
+
|
|
50
|
+
export { SpanManager as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare class TableDOMHelper {
|
|
2
|
+
readonly artTableWrapper: HTMLDivElement;
|
|
3
|
+
readonly artTable: HTMLDivElement;
|
|
4
|
+
readonly tableHeader: HTMLDivElement;
|
|
5
|
+
readonly tableBody: HTMLDivElement;
|
|
6
|
+
readonly virtual: HTMLDivElement;
|
|
7
|
+
readonly tableElement: HTMLTableElement;
|
|
8
|
+
readonly tableFooter: HTMLDivElement;
|
|
9
|
+
readonly stickyScroll: HTMLDivElement;
|
|
10
|
+
readonly stickyScrollItem: HTMLDivElement;
|
|
11
|
+
constructor(artTableWrapper: HTMLDivElement);
|
|
12
|
+
getVirtualTop(): HTMLDivElement;
|
|
13
|
+
getTableRows(): NodeListOf<HTMLTableRowElement>;
|
|
14
|
+
getTableBodyHtmlTable(): HTMLTableElement;
|
|
15
|
+
getLeftLockShadow(): HTMLDivElement;
|
|
16
|
+
getRightLockShadow(): HTMLDivElement;
|
|
17
|
+
getLoadingIndicator(): HTMLDivElement;
|
|
18
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
3
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
4
|
+
import { Classes } from '../styles'; // 表格 DOM 结构
|
|
5
|
+
// div.art-table-wrapper
|
|
6
|
+
// └── div.art-loading-wrapper
|
|
7
|
+
// ├── div.art-loading-indicator-wrapper
|
|
8
|
+
// │ └── div.art-loading-indicator
|
|
9
|
+
// │
|
|
10
|
+
// └── div.art-loading-content-wrapper
|
|
11
|
+
// ├── div.art-table
|
|
12
|
+
// │ │
|
|
13
|
+
// │ ├── div.art-table-header
|
|
14
|
+
// │ │ └── table
|
|
15
|
+
// │ │ ├── colgroup
|
|
16
|
+
// │ │ └── thead 注意这里会出现自定义内容,可能存在嵌套表格
|
|
17
|
+
// │ │
|
|
18
|
+
// │ ├── div.art-table-body
|
|
19
|
+
// │ │ ├── div.art-virtual-blank.top
|
|
20
|
+
// │ │ ├── table
|
|
21
|
+
// │ │ │ ├── colgroup
|
|
22
|
+
// │ │ │ └── tbody 注意这里会出现自定义内容,可能存在嵌套表格
|
|
23
|
+
// │ │ └── div.art-virtual-blank.bottom
|
|
24
|
+
// │ │
|
|
25
|
+
// │ ├── div.art-table-footer
|
|
26
|
+
// │ │ └── table
|
|
27
|
+
// │ │ ├── colgroup
|
|
28
|
+
// │ │ └── tfoot 注意这里会出现自定义内容,可能存在嵌套表格
|
|
29
|
+
// │ │
|
|
30
|
+
// │ ├── div.art-lock-shadow-mask
|
|
31
|
+
// │ │ └── div.art-left-lock-shadow
|
|
32
|
+
// │ └── div.art-lock-shadow-mask
|
|
33
|
+
// │ └── div.art-right-lock-shadow
|
|
34
|
+
// │
|
|
35
|
+
// └── div.art-sticky-scroll
|
|
36
|
+
// └── div.art-sticky-scroll-item
|
|
37
|
+
//
|
|
38
|
+
// 在「可能存在嵌套表格」的情况下,我们可以采用以下的方式来避免「querySelector 不小心获取到了的嵌套表格上的元素」:
|
|
39
|
+
// artTable.querySelector('.art-lock-shadow-mask .art-left-lock-shadow')
|
|
40
|
+
// 表格 DOM 结构辅助工具
|
|
41
|
+
|
|
42
|
+
export var TableDOMHelper = /*#__PURE__*/function () {
|
|
43
|
+
function TableDOMHelper(artTableWrapper) {
|
|
44
|
+
var _context;
|
|
45
|
+
|
|
46
|
+
_classCallCheck(this, TableDOMHelper);
|
|
47
|
+
|
|
48
|
+
this.artTableWrapper = artTableWrapper;
|
|
49
|
+
this.artTable = artTableWrapper.querySelector(".".concat(Classes.artTable));
|
|
50
|
+
this.tableHeader = this.artTable.querySelector(".".concat(Classes.tableHeader));
|
|
51
|
+
this.tableBody = this.artTable.querySelector(".".concat(Classes.tableBody));
|
|
52
|
+
this.virtual = this.artTable.querySelector(".".concat(Classes.virtual));
|
|
53
|
+
this.tableElement = this.artTable.querySelector(".".concat(Classes.tableBody, " table"));
|
|
54
|
+
this.tableFooter = this.artTable.querySelector(".".concat(Classes.tableFooter));
|
|
55
|
+
|
|
56
|
+
var stickyScrollSelector = _concatInstanceProperty(_context = ".".concat(Classes.artTable, " + .")).call(_context, Classes.stickyScroll);
|
|
57
|
+
|
|
58
|
+
this.stickyScroll = artTableWrapper.querySelector(stickyScrollSelector);
|
|
59
|
+
this.stickyScrollItem = this.stickyScroll.querySelector(".".concat(Classes.stickyScrollItem));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
_createClass(TableDOMHelper, [{
|
|
63
|
+
key: "getVirtualTop",
|
|
64
|
+
value: function getVirtualTop() {
|
|
65
|
+
return this.tableBody.querySelector(".".concat(Classes.virtualBlank, ".top"));
|
|
66
|
+
}
|
|
67
|
+
}, {
|
|
68
|
+
key: "getTableRows",
|
|
69
|
+
value: function getTableRows() {
|
|
70
|
+
var htmlTable = this.getTableBodyHtmlTable();
|
|
71
|
+
return htmlTable.querySelectorAll("tbody > .".concat(Classes.tableRow));
|
|
72
|
+
}
|
|
73
|
+
}, {
|
|
74
|
+
key: "getTableBodyHtmlTable",
|
|
75
|
+
value: function getTableBodyHtmlTable() {
|
|
76
|
+
return this.artTable.querySelector(".".concat(Classes.tableBody, " table"));
|
|
77
|
+
}
|
|
78
|
+
}, {
|
|
79
|
+
key: "getLeftLockShadow",
|
|
80
|
+
value: function getLeftLockShadow() {
|
|
81
|
+
var _context2;
|
|
82
|
+
|
|
83
|
+
var selector = _concatInstanceProperty(_context2 = ".".concat(Classes.lockShadowMask, " .")).call(_context2, Classes.leftLockShadow);
|
|
84
|
+
|
|
85
|
+
return this.artTable.querySelector(selector);
|
|
86
|
+
}
|
|
87
|
+
}, {
|
|
88
|
+
key: "getRightLockShadow",
|
|
89
|
+
value: function getRightLockShadow() {
|
|
90
|
+
var _context3;
|
|
91
|
+
|
|
92
|
+
var selector = _concatInstanceProperty(_context3 = ".".concat(Classes.lockShadowMask, " .")).call(_context3, Classes.rightLockShadow);
|
|
93
|
+
|
|
94
|
+
return this.artTable.querySelector(selector);
|
|
95
|
+
}
|
|
96
|
+
}, {
|
|
97
|
+
key: "getLoadingIndicator",
|
|
98
|
+
value: function getLoadingIndicator() {
|
|
99
|
+
return this.artTableWrapper.querySelector(".".concat(Classes.loadingIndicator));
|
|
100
|
+
}
|
|
101
|
+
}]);
|
|
102
|
+
|
|
103
|
+
return TableDOMHelper;
|
|
104
|
+
}();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import SpanManager from '../SpanManager';
|
|
2
|
+
var NAME = 'SpanManager';
|
|
3
|
+
describe("".concat(NAME), function () {
|
|
4
|
+
var spanManager = new SpanManager();
|
|
5
|
+
it('add span info', function () {
|
|
6
|
+
// 第一行,第一列,仅融合自身列,向下融合两行
|
|
7
|
+
spanManager.add(0, 0, 1, 2);
|
|
8
|
+
});
|
|
9
|
+
it('test skip', function () {
|
|
10
|
+
// 第二行,第一列跳过渲染
|
|
11
|
+
expect(spanManager.testSkip(1, 0)).toBe(true); // 第四行,第一列不跳过渲染
|
|
12
|
+
|
|
13
|
+
expect(spanManager.testSkip(3, 0)).toBe(false);
|
|
14
|
+
});
|
|
15
|
+
it('strip upwards span info', function () {
|
|
16
|
+
spanManager.stripUpwards(0);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
2
|
+
import { Classes } from '../../styles';
|
|
3
|
+
import { TableDOMHelper } from '../TableDOMUtils';
|
|
4
|
+
var NAME = 'TableDOMUtils';
|
|
5
|
+
describe("".concat(NAME), function () {
|
|
6
|
+
var tableDOMHelper;
|
|
7
|
+
var container;
|
|
8
|
+
beforeAll(function () {
|
|
9
|
+
var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17;
|
|
10
|
+
|
|
11
|
+
container = document.createElement('div');
|
|
12
|
+
container.innerHTML = _concatInstanceProperty(_context = _concatInstanceProperty(_context2 = _concatInstanceProperty(_context3 = _concatInstanceProperty(_context4 = _concatInstanceProperty(_context5 = _concatInstanceProperty(_context6 = _concatInstanceProperty(_context7 = _concatInstanceProperty(_context8 = _concatInstanceProperty(_context9 = _concatInstanceProperty(_context10 = _concatInstanceProperty(_context11 = _concatInstanceProperty(_context12 = _concatInstanceProperty(_context13 = _concatInstanceProperty(_context14 = _concatInstanceProperty(_context15 = _concatInstanceProperty(_context16 = _concatInstanceProperty(_context17 = "<div class='".concat(Classes.artTableWrapper, "'>\n <div class='")).call(_context17, Classes.loadingWrapper, "'>\n <div class='")).call(_context16, Classes.loadingIndicatorWrapper, "'>\n <div class='")).call(_context15, Classes.loadingIndicator, "'></div>\n </div> \n <div class='")).call(_context14, Classes.loadingContentWrapper, "'>\n <div class='")).call(_context13, Classes.artTable, "'>\n <div class='")).call(_context12, Classes.tableHeader, "'>\n \n </div>\n <div class='")).call(_context11, Classes.tableBody, "'>\n <div class='")).call(_context10, Classes.virtual, "'>\n <div class='")).call(_context9, Classes.virtualBlank, " top'></div>\n <table></table>\n <div class='")).call(_context8, Classes.virtualBlank, " bottom'></div>\n </div> \n </div>\n <div class='")).call(_context7, Classes.tableFooter, "'>\n </div>\n <div class='")).call(_context6, Classes.lockShadowMask, "'>\n <div class='")).call(_context5, Classes.leftLockShadow, "'></div>\n </div>\n <div class='")).call(_context4, Classes.lockShadowMask, "'>\n <div class='")).call(_context3, Classes.rightLockShadow, "'></div>\n </div>\n </div>\n <div class='")).call(_context2, Classes.stickyScroll, "'>\n <div class='")).call(_context, Classes.stickyScrollItem, "'></div>\n </div>\n </div> \n </div> \n </div>");
|
|
13
|
+
tableDOMHelper = new TableDOMHelper(container.querySelector(".".concat(Classes.artTableWrapper)));
|
|
14
|
+
});
|
|
15
|
+
afterAll(function () {
|
|
16
|
+
container = null;
|
|
17
|
+
tableDOMHelper = null;
|
|
18
|
+
});
|
|
19
|
+
it('getVirtualTop', function () {
|
|
20
|
+
expect(tableDOMHelper.getVirtualTop()).not.toBeNull();
|
|
21
|
+
});
|
|
22
|
+
it('getTableRows', function () {
|
|
23
|
+
expect(tableDOMHelper.getTableRows().length).toBe(0);
|
|
24
|
+
});
|
|
25
|
+
it('getLeftLockShadow', function () {
|
|
26
|
+
expect(tableDOMHelper.getLeftLockShadow()).not.toBeNull();
|
|
27
|
+
});
|
|
28
|
+
it('getRightLockShadow', function () {
|
|
29
|
+
expect(tableDOMHelper.getRightLockShadow()).not.toBeNull();
|
|
30
|
+
});
|
|
31
|
+
it('getLoadingIndicator', function () {
|
|
32
|
+
expect(tableDOMHelper.getLoadingIndicator()).not.toBeNull();
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { getFullRenderRange, makeRowHeightManager } from '../rowHeightManager';
|
|
2
|
+
var NAME = 'rowHeightManager';
|
|
3
|
+
describe("".concat(NAME), function () {
|
|
4
|
+
it('getFullRenderRange', function () {
|
|
5
|
+
var mockRowCount = 5;
|
|
6
|
+
expect(getFullRenderRange(mockRowCount).bottomIndex).toBe(mockRowCount);
|
|
7
|
+
});
|
|
8
|
+
});
|
|
9
|
+
describe("".concat(NAME, " makeRowHeightManager"), function () {
|
|
10
|
+
var rowHeightManager = makeRowHeightManager(10, 40);
|
|
11
|
+
beforeEach(function () {
|
|
12
|
+
rowHeightManager = makeRowHeightManager(10, 40);
|
|
13
|
+
});
|
|
14
|
+
afterAll(function () {
|
|
15
|
+
rowHeightManager = null;
|
|
16
|
+
});
|
|
17
|
+
it('has 10 rows, maxRenderHeight=-200 and getRenderRange ', function () {
|
|
18
|
+
rowHeightManager.getRenderRange(0, -200, 10);
|
|
19
|
+
});
|
|
20
|
+
it('has 10 rows, maxRenderHeight=-200, offset=100 and getRenderRange ', function () {
|
|
21
|
+
rowHeightManager.getRenderRange(100, -200, 10);
|
|
22
|
+
});
|
|
23
|
+
it('has 10 rows,participate rowCount greater than 10 and getRenderRange ', function () {
|
|
24
|
+
rowHeightManager.getRenderRange(0, 0, 11);
|
|
25
|
+
});
|
|
26
|
+
it('has 10 rows , add 1 row and getRenderRange ', function () {
|
|
27
|
+
rowHeightManager.updateRow(10, 0, 40);
|
|
28
|
+
rowHeightManager.getRenderRange(0, 200, 10);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { getVisiblePartObservable, getVisiblePart } from '../visible-part';
|
|
2
|
+
var NAME = 'visible-part';
|
|
3
|
+
describe("".concat(NAME), function () {
|
|
4
|
+
it('getVisiblePartObservable', function () {
|
|
5
|
+
var container = document.createElement('div');
|
|
6
|
+
container.setAttribute('id', 't1');
|
|
7
|
+
container.style.cssText = 'width:100px;height:100px;overflow:auto;';
|
|
8
|
+
var content = document.createElement('div');
|
|
9
|
+
content.style.cssText = 'width:200px;height:200px;';
|
|
10
|
+
container.appendChild(content);
|
|
11
|
+
document.body.appendChild(container); // todo: rxjs test
|
|
12
|
+
|
|
13
|
+
getVisiblePartObservable(content, container);
|
|
14
|
+
var event = new window.Event('scroll', {
|
|
15
|
+
cancelable: false
|
|
16
|
+
});
|
|
17
|
+
container.dispatchEvent(event);
|
|
18
|
+
document.body.removeChild(container);
|
|
19
|
+
container = content = null;
|
|
20
|
+
});
|
|
21
|
+
it('getVisiblePart', function () {
|
|
22
|
+
var container = document.createElement('div');
|
|
23
|
+
document.body.appendChild(container);
|
|
24
|
+
expect(getVisiblePart(container, window).offsetX).toBe(0);
|
|
25
|
+
document.body.removeChild(container);
|
|
26
|
+
container = null;
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { VerticalRenderRange } from '../interfaces';
|
|
2
|
+
export declare function getFullRenderRange(rowCount: number): VerticalRenderRange;
|
|
3
|
+
export declare function makeRowHeightManager(initRowCount: number, estimatedRowHeight: number): {
|
|
4
|
+
getRenderRange: (offset: number, maxRenderHeight: number, rowCount: number) => VerticalRenderRange;
|
|
5
|
+
updateRow: (index: number, offset: number, size: number) => void;
|
|
6
|
+
cache: number[];
|
|
7
|
+
};
|