@kdcloudjs/table 1.2.1-canary.6 → 1.2.1-canary.7
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 +0 -0
- package/README.md +0 -0
- package/dist/@kdcloudjs/table.css +1 -1
- package/dist/@kdcloudjs/table.css.map +0 -0
- package/dist/@kdcloudjs/table.js +4588 -5991
- package/dist/@kdcloudjs/table.js.map +1 -1
- package/dist/@kdcloudjs/table.min.css +1 -1
- package/dist/@kdcloudjs/table.min.js +16 -24
- package/dist/@kdcloudjs/table.min.js.map +1 -1
- package/dist/default-theme.js +0 -0
- package/dist/kd-ui-complete.less +0 -0
- package/dist/kd-ui.less +0 -0
- package/dist/theme.js +0 -0
- package/es/_utils/arrayUtil.d.ts +0 -0
- package/es/_utils/arrayUtil.js +0 -3
- package/es/_utils/devwarning.d.ts +0 -0
- package/es/_utils/devwarning.js +0 -1
- package/es/_utils/formatUtil.d.ts +0 -0
- package/es/_utils/formatUtil.js +36 -101
- package/es/_utils/hooks.d.ts +0 -0
- package/es/_utils/hooks.js +21 -45
- package/es/_utils/index.d.ts +0 -0
- package/es/_utils/index.js +0 -2
- package/es/_utils/numberUtil.d.ts +0 -0
- package/es/_utils/numberUtil.js +32 -55
- package/es/_utils/omit.d.ts +0 -0
- package/es/_utils/omit.js +0 -2
- package/es/_utils/react-children.d.ts +0 -0
- package/es/_utils/react-children.js +0 -0
- package/es/_utils/type.d.ts +0 -0
- package/es/_utils/type.js +0 -2
- package/es/_utils/usePopper.d.ts +0 -0
- package/es/_utils/usePopper.js +81 -144
- package/es/config-provider/ConfigContext.d.ts +0 -0
- package/es/config-provider/ConfigContext.js +0 -0
- package/es/config-provider/compDefaultProps.d.ts +0 -0
- package/es/config-provider/compDefaultProps.js +0 -1
- package/es/config-provider/configProvider.d.ts +0 -0
- package/es/config-provider/configProvider.js +2 -7
- package/es/config-provider/defaultConfig.d.ts +0 -0
- package/es/config-provider/defaultConfig.js +0 -1
- package/es/config-provider/index.d.ts +0 -0
- package/es/config-provider/index.js +0 -0
- package/es/index.d.ts +0 -0
- package/es/index.js +0 -2
- package/es/locale/index.d.ts +0 -0
- package/es/locale/index.js +0 -0
- package/es/locale/locale.d.ts +0 -0
- package/es/locale/locale.js +9 -48
- package/es/locale/zh-CN.d.ts +0 -0
- package/es/locale/zh-CN.js +0 -0
- package/es/style/color/colors.less +0 -0
- package/es/style/core/index.less +0 -0
- package/es/style/core/motion/other.less +0 -0
- package/es/style/core/motion/slide.less +0 -0
- package/es/style/core/motion.less +0 -0
- package/es/style/core/reset.less +0 -0
- package/es/style/css.js +0 -0
- package/es/style/index.css +0 -0
- package/es/style/index.d.ts +0 -0
- package/es/style/index.js +0 -0
- package/es/style/index.less +0 -0
- package/es/style/mixins/index.less +0 -0
- package/es/style/mixins/overlay.less +0 -0
- package/es/style/mixins/reset.less +0 -0
- package/es/style/themes/default.less +0 -0
- package/es/style/themes/index.less +0 -0
- package/es/table/base/calculations.d.ts +0 -0
- package/es/table/base/calculations.js +25 -75
- package/es/table/base/colgroup.d.ts +0 -0
- package/es/table/base/colgroup.js +0 -1
- package/es/table/base/empty.d.ts +0 -0
- package/es/table/base/empty.js +6 -6
- package/es/table/base/header.d.ts +0 -0
- package/es/table/base/header.js +21 -76
- package/es/table/base/helpers/SpanManager.d.ts +0 -0
- package/es/table/base/helpers/SpanManager.js +4 -11
- package/es/table/base/helpers/TableDOMUtils.d.ts +0 -0
- package/es/table/base/helpers/TableDOMUtils.js +9 -34
- package/es/table/base/helpers/__test__/SpanManager.test.d.ts +0 -0
- package/es/table/base/helpers/__test__/SpanManager.test.js +2 -2
- package/es/table/base/helpers/__test__/TableDOMUtils.test.d.ts +0 -0
- package/es/table/base/helpers/__test__/TableDOMUtils.test.js +0 -1
- package/es/table/base/helpers/__test__/rowHeightManager.test.d.ts +0 -0
- package/es/table/base/helpers/__test__/rowHeightManager.test.js +0 -0
- package/es/table/base/helpers/getRichVisibleRectsStream.d.ts +0 -0
- package/es/table/base/helpers/getRichVisibleRectsStream.js +13 -45
- package/es/table/base/helpers/rowHeightManager.d.ts +0 -0
- package/es/table/base/helpers/rowHeightManager.js +0 -28
- package/es/table/base/html-table.d.ts +0 -0
- package/es/table/base/html-table.js +17 -39
- package/es/table/base/index.d.ts +0 -0
- package/es/table/base/index.js +0 -0
- package/es/table/base/interfaces.d.ts +0 -0
- package/es/table/base/interfaces.js +0 -0
- package/es/table/base/loading.d.ts +0 -0
- package/es/table/base/loading.js +8 -10
- package/es/table/base/renderTemplates.d.ts +0 -0
- package/es/table/base/renderTemplates.js +41 -59
- package/es/table/base/styles.d.ts +0 -0
- package/es/table/base/styles.js +0 -9
- package/es/table/base/table.d.ts +0 -0
- package/es/table/base/table.js +110 -199
- package/es/table/base/utils.d.ts +0 -0
- package/es/table/base/utils.js +17 -57
- package/es/table/common-views.d.ts +0 -0
- package/es/table/common-views.js +0 -7
- package/es/table/index.d.ts +0 -0
- package/es/table/index.js +0 -0
- package/es/table/interfaces.d.ts +0 -0
- package/es/table/interfaces.js +0 -0
- package/es/table/internals.d.ts +0 -0
- package/es/table/internals.js +0 -13
- package/es/table/pipeline/features/autoFill.d.ts +0 -0
- package/es/table/pipeline/features/autoFill.js +11 -40
- package/es/table/pipeline/features/autoRowSpan.d.ts +0 -0
- package/es/table/pipeline/features/autoRowSpan.js +1 -14
- package/es/table/pipeline/features/buildTree.d.ts +0 -0
- package/es/table/pipeline/features/buildTree.js +0 -0
- package/es/table/pipeline/features/colGroupExtendable.d.ts +0 -0
- package/es/table/pipeline/features/colGroupExtendable.js +4 -19
- package/es/table/pipeline/features/columnDrag.d.ts +0 -0
- package/es/table/pipeline/features/columnDrag.js +41 -97
- package/es/table/pipeline/features/columnFilter.d.ts +0 -0
- package/es/table/pipeline/features/columnFilter.js +12 -51
- package/es/table/pipeline/features/columnHover.d.ts +0 -0
- package/es/table/pipeline/features/columnHover.js +1 -7
- package/es/table/pipeline/features/columnRangeHover.d.ts +0 -0
- package/es/table/pipeline/features/columnRangeHover.js +1 -8
- package/es/table/pipeline/features/columnResizeWidth.d.ts +0 -0
- package/es/table/pipeline/features/columnResizeWidth.js +13 -39
- package/es/table/pipeline/features/contextMenu.d.ts +0 -0
- package/es/table/pipeline/features/contextMenu.js +22 -95
- package/es/table/pipeline/features/filter/DefaultFilterContent.d.ts +0 -0
- package/es/table/pipeline/features/filter/DefaultFilterContent.js +14 -30
- package/es/table/pipeline/features/filter/DefaultFilterIcon.d.ts +0 -0
- package/es/table/pipeline/features/filter/DefaultFilterIcon.js +1 -1
- package/es/table/pipeline/features/filter/Filter.d.ts +0 -0
- package/es/table/pipeline/features/filter/Filter.js +26 -50
- package/es/table/pipeline/features/filter/FilterPanel.d.ts +0 -0
- package/es/table/pipeline/features/filter/FilterPanel.js +11 -25
- package/es/table/pipeline/features/filter/index.d.ts +0 -0
- package/es/table/pipeline/features/filter/index.js +0 -0
- package/es/table/pipeline/features/filter/util.d.ts +0 -0
- package/es/table/pipeline/features/filter/util.js +0 -4
- package/es/table/pipeline/features/footerDataSource.d.ts +0 -0
- package/es/table/pipeline/features/footerDataSource.js +0 -3
- package/es/table/pipeline/features/index.d.ts +0 -0
- package/es/table/pipeline/features/index.js +0 -0
- package/es/table/pipeline/features/mergeCellHover.d.ts +0 -0
- package/es/table/pipeline/features/mergeCellHover.js +0 -1
- package/es/table/pipeline/features/multiSelect.d.ts +0 -0
- package/es/table/pipeline/features/multiSelect.js +15 -57
- package/es/table/pipeline/features/rangeSelection.d.ts +0 -0
- package/es/table/pipeline/features/rangeSelection.js +73 -152
- package/es/table/pipeline/features/rowDetail.d.ts +0 -0
- package/es/table/pipeline/features/rowDetail.js +4 -43
- package/es/table/pipeline/features/rowDrag.d.ts +0 -0
- package/es/table/pipeline/features/rowDrag.js +39 -78
- package/es/table/pipeline/features/rowGrouping.d.ts +0 -0
- package/es/table/pipeline/features/rowGrouping.js +4 -37
- package/es/table/pipeline/features/singleSelect.d.ts +0 -0
- package/es/table/pipeline/features/singleSelect.js +0 -24
- package/es/table/pipeline/features/sort.d.ts +0 -0
- package/es/table/pipeline/features/sort.js +38 -96
- package/es/table/pipeline/features/tips.d.ts +0 -0
- package/es/table/pipeline/features/tips.js +4 -10
- package/es/table/pipeline/features/treeMode.d.ts +0 -0
- package/es/table/pipeline/features/treeMode.js +14 -49
- package/es/table/pipeline/features/treeSelect.d.ts +0 -0
- package/es/table/pipeline/features/treeSelect.js +2 -28
- package/es/table/pipeline/index.d.ts +0 -0
- package/es/table/pipeline/index.js +0 -0
- package/es/table/pipeline/pipeline.d.ts +0 -0
- package/es/table/pipeline/pipeline.js +12 -53
- package/es/table/pivot/cross-table/buildCrossTable.d.ts +0 -0
- package/es/table/pivot/cross-table/buildCrossTable.js +21 -72
- package/es/table/pivot/cross-table/constants.d.ts +0 -0
- package/es/table/pivot/cross-table/constants.js +0 -0
- package/es/table/pivot/cross-table/cross-table.d.ts +0 -0
- package/es/table/pivot/cross-table/cross-table.js +23 -31
- package/es/table/pivot/cross-table/index.d.ts +0 -0
- package/es/table/pivot/cross-table/index.js +0 -0
- package/es/table/pivot/cross-table/interfaces.d.ts +0 -0
- package/es/table/pivot/cross-table/interfaces.js +0 -0
- package/es/table/pivot/cross-table/internals.d.ts +0 -0
- package/es/table/pivot/cross-table/internals.js +0 -0
- package/es/table/pivot/cross-tree-table/buildCrossTreeTable.d.ts +0 -0
- package/es/table/pivot/cross-tree-table/buildCrossTreeTable.js +22 -57
- package/es/table/pivot/cross-tree-table/cross-tree-table.d.ts +0 -0
- package/es/table/pivot/cross-tree-table/cross-tree-table.js +36 -61
- package/es/table/pivot/cross-tree-table/index.d.ts +0 -0
- package/es/table/pivot/cross-tree-table/index.js +0 -0
- package/es/table/pivot/pivot-utils/buildDrillTree.d.ts +0 -0
- package/es/table/pivot/pivot-utils/buildDrillTree.js +10 -23
- package/es/table/pivot/pivot-utils/builders.d.ts +0 -0
- package/es/table/pivot/pivot-utils/builders.js +34 -74
- package/es/table/pivot/pivot-utils/convert-utils.d.ts +0 -0
- package/es/table/pivot/pivot-utils/convert-utils.js +16 -42
- package/es/table/pivot/pivot-utils/index.d.ts +0 -0
- package/es/table/pivot/pivot-utils/index.js +0 -0
- package/es/table/pivot/pivot-utils/interfaces.d.ts +0 -0
- package/es/table/pivot/pivot-utils/interfaces.js +0 -0
- package/es/table/pivot/pivot-utils/simpleEncode.d.ts +0 -0
- package/es/table/pivot/pivot-utils/simpleEncode.js +0 -1
- package/es/table/style/css.js +0 -0
- package/es/table/style/index.css +0 -0
- package/es/table/style/index.d.ts +0 -0
- package/es/table/style/index.js +0 -0
- package/es/table/style/index.less +0 -0
- package/es/table/transforms/autoRowSpan.d.ts +0 -0
- package/es/table/transforms/autoRowSpan.js +1 -15
- package/es/table/transforms/autoWidth.d.ts +0 -0
- package/es/table/transforms/autoWidth.js +13 -35
- package/es/table/transforms/buildTree.d.ts +0 -0
- package/es/table/transforms/buildTree.js +1 -2
- package/es/table/transforms/columnHover.d.ts +0 -0
- package/es/table/transforms/columnHover.js +9 -15
- package/es/table/transforms/columnRangeHover.d.ts +0 -0
- package/es/table/transforms/columnRangeHover.js +12 -19
- package/es/table/transforms/columnResize.d.ts +0 -0
- package/es/table/transforms/columnResize.js +18 -42
- package/es/table/transforms/flatten.d.ts +0 -0
- package/es/table/transforms/flatten.js +0 -3
- package/es/table/transforms/index.d.ts +0 -0
- package/es/table/transforms/index.js +0 -0
- package/es/table/transforms/orderField.d.ts +0 -0
- package/es/table/transforms/orderField.js +0 -3
- package/es/table/transforms/sort.d.ts +0 -0
- package/es/table/transforms/sort.js +42 -101
- package/es/table/transforms/tips.d.ts +0 -0
- package/es/table/transforms/tips.js +5 -10
- package/es/table/transforms/treeMode.d.ts +0 -0
- package/es/table/transforms/treeMode.js +36 -77
- package/es/table/transforms/visible.d.ts +0 -0
- package/es/table/transforms/visible.js +0 -2
- package/es/table/transforms/warnTransformsDeprecated.d.ts +0 -0
- package/es/table/transforms/warnTransformsDeprecated.js +0 -0
- package/es/table/use/useResizeObserver.d.ts +0 -0
- package/es/table/use/useResizeObserver.js +1 -4
- package/es/table/utils/applyTransforms.d.ts +0 -0
- package/es/table/utils/applyTransforms.js +0 -1
- package/es/table/utils/browserType.d.ts +0 -0
- package/es/table/utils/browserType.js +12 -19
- package/es/table/utils/buildTree.d.ts +0 -0
- package/es/table/utils/buildTree.js +7 -22
- package/es/table/utils/collectNodes.d.ts +0 -0
- package/es/table/utils/collectNodes.js +4 -13
- package/es/table/utils/console.d.ts +0 -0
- package/es/table/utils/console.js +0 -14
- package/es/table/utils/copyToClipboard.d.ts +0 -0
- package/es/table/utils/copyToClipboard.js +0 -4
- package/es/table/utils/element.d.ts +0 -0
- package/es/table/utils/element.js +14 -41
- package/es/table/utils/exportTableAsExcel.d.ts +0 -0
- package/es/table/utils/exportTableAsExcel.js +7 -43
- package/es/table/utils/getTreeDepth.d.ts +0 -0
- package/es/table/utils/getTreeDepth.js +4 -12
- package/es/table/utils/groupBy.d.ts +0 -0
- package/es/table/utils/groupBy.js +4 -13
- package/es/table/utils/index.d.ts +0 -0
- package/es/table/utils/index.js +0 -0
- package/es/table/utils/isGroupColumn.d.ts +0 -0
- package/es/table/utils/isGroupColumn.js +0 -0
- package/es/table/utils/isLeafNode.d.ts +0 -0
- package/es/table/utils/isLeafNode.js +0 -0
- package/es/table/utils/keyCode.d.ts +0 -0
- package/es/table/utils/keyCode.js +0 -0
- package/es/table/utils/layeredFilter.d.ts +0 -0
- package/es/table/utils/layeredFilter.js +0 -4
- package/es/table/utils/layeredSort.d.ts +0 -0
- package/es/table/utils/layeredSort.js +0 -5
- package/es/table/utils/makeRecursiveMapper.d.ts +0 -0
- package/es/table/utils/makeRecursiveMapper.js +4 -15
- package/es/table/utils/mergeCellProps.d.ts +0 -0
- package/es/table/utils/mergeCellProps.js +6 -14
- package/es/table/utils/others.d.ts +0 -0
- package/es/table/utils/others.js +6 -19
- package/es/table/utils/proto.d.ts +0 -0
- package/es/table/utils/proto.js +2 -30
- package/es/table/utils/selectColumn.d.ts +0 -0
- package/es/table/utils/selectColumn.js +0 -0
- package/es/table/utils/smartCompare.d.ts +0 -0
- package/es/table/utils/smartCompare.js +4 -12
- package/es/table/utils/traverseColumn.d.ts +0 -0
- package/es/table/utils/traverseColumn.js +5 -18
- package/es/table/utils/tree-data-helpers/StrictTreeDataHelper.d.ts +0 -0
- package/es/table/utils/tree-data-helpers/StrictTreeDataHelper.js +8 -30
- package/es/table/utils/tree-data-helpers/TreeDataHelper.d.ts +0 -0
- package/es/table/utils/tree-data-helpers/TreeDataHelper.js +19 -74
- package/es/table/utils/uiDegrade.d.ts +0 -0
- package/es/table/utils/uiDegrade.js +0 -5
- package/lib/_utils/arrayUtil.d.ts +0 -0
- package/lib/_utils/arrayUtil.js +2 -8
- package/lib/_utils/devwarning.d.ts +0 -0
- package/lib/_utils/devwarning.js +0 -5
- package/lib/_utils/formatUtil.d.ts +0 -0
- package/lib/_utils/formatUtil.js +36 -105
- package/lib/_utils/hooks.d.ts +0 -0
- package/lib/_utils/hooks.js +21 -56
- package/lib/_utils/index.d.ts +0 -0
- package/lib/_utils/index.js +2 -9
- package/lib/_utils/numberUtil.d.ts +0 -0
- package/lib/_utils/numberUtil.js +32 -63
- package/lib/_utils/omit.d.ts +0 -0
- package/lib/_utils/omit.js +0 -5
- package/lib/_utils/react-children.d.ts +0 -0
- package/lib/_utils/react-children.js +0 -5
- package/lib/_utils/type.d.ts +0 -0
- package/lib/_utils/type.js +3 -11
- package/lib/_utils/usePopper.d.ts +0 -0
- package/lib/_utils/usePopper.js +86 -173
- package/lib/config-provider/ConfigContext.d.ts +0 -0
- package/lib/config-provider/ConfigContext.js +2 -6
- package/lib/config-provider/compDefaultProps.d.ts +0 -0
- package/lib/config-provider/compDefaultProps.js +1 -3
- package/lib/config-provider/configProvider.d.ts +0 -0
- package/lib/config-provider/configProvider.js +6 -22
- package/lib/config-provider/defaultConfig.d.ts +0 -0
- package/lib/config-provider/defaultConfig.js +1 -7
- package/lib/config-provider/index.d.ts +0 -0
- package/lib/config-provider/index.js +1 -8
- package/lib/index.d.ts +0 -0
- package/lib/index.js +2 -8
- package/lib/locale/index.d.ts +0 -0
- package/lib/locale/index.js +3 -11
- package/lib/locale/locale.d.ts +0 -0
- package/lib/locale/locale.js +13 -69
- package/lib/locale/zh-CN.d.ts +0 -0
- package/lib/locale/zh-CN.js +1 -2
- package/lib/style/color/colors.less +0 -0
- package/lib/style/components.less +0 -0
- package/lib/style/core/index.less +0 -0
- package/lib/style/core/motion/other.less +0 -0
- package/lib/style/core/motion/slide.less +0 -0
- package/lib/style/core/motion.less +0 -0
- package/lib/style/core/reset.less +0 -0
- package/lib/style/css.js +0 -0
- package/lib/style/index.css +0 -0
- package/lib/style/index.d.ts +0 -0
- package/lib/style/index.js +0 -0
- package/lib/style/index.less +0 -0
- package/lib/style/mixins/index.less +0 -0
- package/lib/style/mixins/overlay.less +0 -0
- package/lib/style/mixins/reset.less +0 -0
- package/lib/style/themes/default.less +0 -0
- package/lib/style/themes/index.less +0 -0
- package/lib/table/base/calculations.d.ts +0 -0
- package/lib/table/base/calculations.js +25 -86
- package/lib/table/base/colgroup.d.ts +0 -0
- package/lib/table/base/colgroup.js +0 -5
- package/lib/table/base/empty.d.ts +0 -0
- package/lib/table/base/empty.js +8 -20
- package/lib/table/base/header.d.ts +0 -0
- package/lib/table/base/header.js +21 -86
- package/lib/table/base/helpers/SpanManager.d.ts +0 -0
- package/lib/table/base/helpers/SpanManager.js +6 -16
- package/lib/table/base/helpers/TableDOMUtils.d.ts +0 -0
- package/lib/table/base/helpers/TableDOMUtils.js +9 -37
- package/lib/table/base/helpers/__test__/SpanManager.test.d.ts +0 -0
- package/lib/table/base/helpers/__test__/SpanManager.test.js +2 -4
- package/lib/table/base/helpers/__test__/TableDOMUtils.test.d.ts +0 -0
- package/lib/table/base/helpers/__test__/TableDOMUtils.test.js +0 -5
- package/lib/table/base/helpers/__test__/rowHeightManager.test.d.ts +0 -0
- package/lib/table/base/helpers/__test__/rowHeightManager.test.js +0 -1
- package/lib/table/base/helpers/getRichVisibleRectsStream.d.ts +0 -0
- package/lib/table/base/helpers/getRichVisibleRectsStream.js +15 -65
- package/lib/table/base/helpers/rowHeightManager.d.ts +0 -0
- package/lib/table/base/helpers/rowHeightManager.js +0 -33
- package/lib/table/base/html-table.d.ts +0 -0
- package/lib/table/base/html-table.js +17 -49
- package/lib/table/base/index.d.ts +0 -0
- package/lib/table/base/index.js +0 -2
- package/lib/table/base/interfaces.d.ts +0 -0
- package/lib/table/base/interfaces.js +0 -0
- package/lib/table/base/loading.d.ts +0 -0
- package/lib/table/base/loading.js +8 -14
- package/lib/table/base/renderTemplates.d.ts +0 -0
- package/lib/table/base/renderTemplates.js +44 -75
- package/lib/table/base/styles.d.ts +0 -0
- package/lib/table/base/styles.js +9 -37
- package/lib/table/base/table.d.ts +0 -0
- package/lib/table/base/table.js +122 -243
- package/lib/table/base/utils.d.ts +0 -0
- package/lib/table/base/utils.js +27 -109
- package/lib/table/common-views.d.ts +0 -0
- package/lib/table/common-views.js +4 -24
- package/lib/table/index.d.ts +0 -0
- package/lib/table/index.js +0 -13
- package/lib/table/interfaces.d.ts +0 -0
- package/lib/table/interfaces.js +0 -0
- package/lib/table/internals.d.ts +0 -0
- package/lib/table/internals.js +2 -17
- package/lib/table/pipeline/features/autoFill.d.ts +0 -0
- package/lib/table/pipeline/features/autoFill.js +14 -53
- package/lib/table/pipeline/features/autoRowSpan.d.ts +0 -0
- package/lib/table/pipeline/features/autoRowSpan.js +1 -19
- package/lib/table/pipeline/features/buildTree.d.ts +0 -0
- package/lib/table/pipeline/features/buildTree.js +0 -2
- package/lib/table/pipeline/features/colGroupExtendable.d.ts +0 -0
- package/lib/table/pipeline/features/colGroupExtendable.js +6 -35
- package/lib/table/pipeline/features/columnDrag.d.ts +0 -0
- package/lib/table/pipeline/features/columnDrag.js +41 -103
- package/lib/table/pipeline/features/columnFilter.d.ts +0 -0
- package/lib/table/pipeline/features/columnFilter.js +12 -65
- package/lib/table/pipeline/features/columnHover.d.ts +0 -0
- package/lib/table/pipeline/features/columnHover.js +1 -11
- package/lib/table/pipeline/features/columnRangeHover.d.ts +0 -0
- package/lib/table/pipeline/features/columnRangeHover.js +1 -13
- package/lib/table/pipeline/features/columnResizeWidth.d.ts +0 -0
- package/lib/table/pipeline/features/columnResizeWidth.js +18 -63
- package/lib/table/pipeline/features/contextMenu.d.ts +0 -0
- package/lib/table/pipeline/features/contextMenu.js +24 -121
- package/lib/table/pipeline/features/filter/DefaultFilterContent.d.ts +0 -0
- package/lib/table/pipeline/features/filter/DefaultFilterContent.js +17 -52
- package/lib/table/pipeline/features/filter/DefaultFilterIcon.d.ts +0 -0
- package/lib/table/pipeline/features/filter/DefaultFilterIcon.js +1 -4
- package/lib/table/pipeline/features/filter/Filter.d.ts +0 -0
- package/lib/table/pipeline/features/filter/Filter.js +29 -76
- package/lib/table/pipeline/features/filter/FilterPanel.d.ts +0 -0
- package/lib/table/pipeline/features/filter/FilterPanel.js +14 -44
- package/lib/table/pipeline/features/filter/index.d.ts +0 -0
- package/lib/table/pipeline/features/filter/index.js +0 -5
- package/lib/table/pipeline/features/filter/util.d.ts +0 -0
- package/lib/table/pipeline/features/filter/util.js +2 -10
- package/lib/table/pipeline/features/footerDataSource.d.ts +0 -0
- package/lib/table/pipeline/features/footerDataSource.js +1 -12
- package/lib/table/pipeline/features/index.d.ts +0 -0
- package/lib/table/pipeline/features/index.js +0 -23
- package/lib/table/pipeline/features/mergeCellHover.d.ts +0 -0
- package/lib/table/pipeline/features/mergeCellHover.js +0 -5
- package/lib/table/pipeline/features/multiSelect.d.ts +0 -0
- package/lib/table/pipeline/features/multiSelect.js +15 -71
- package/lib/table/pipeline/features/rangeSelection.d.ts +0 -0
- package/lib/table/pipeline/features/rangeSelection.js +75 -173
- package/lib/table/pipeline/features/rowDetail.d.ts +0 -0
- package/lib/table/pipeline/features/rowDetail.js +4 -67
- package/lib/table/pipeline/features/rowDrag.d.ts +0 -0
- package/lib/table/pipeline/features/rowDrag.js +41 -93
- package/lib/table/pipeline/features/rowGrouping.d.ts +0 -0
- package/lib/table/pipeline/features/rowGrouping.js +4 -57
- package/lib/table/pipeline/features/singleSelect.d.ts +0 -0
- package/lib/table/pipeline/features/singleSelect.js +0 -34
- package/lib/table/pipeline/features/sort.d.ts +0 -0
- package/lib/table/pipeline/features/sort.js +37 -115
- package/lib/table/pipeline/features/tips.d.ts +0 -0
- package/lib/table/pipeline/features/tips.js +4 -19
- package/lib/table/pipeline/features/treeMode.d.ts +0 -0
- package/lib/table/pipeline/features/treeMode.js +15 -72
- package/lib/table/pipeline/features/treeSelect.d.ts +0 -0
- package/lib/table/pipeline/features/treeSelect.js +2 -36
- package/lib/table/pipeline/index.d.ts +0 -0
- package/lib/table/pipeline/index.js +2 -10
- package/lib/table/pipeline/pipeline.d.ts +0 -0
- package/lib/table/pipeline/pipeline.js +13 -64
- package/lib/table/pivot/cross-table/buildCrossTable.d.ts +0 -0
- package/lib/table/pivot/cross-table/buildCrossTable.js +21 -83
- package/lib/table/pivot/cross-table/constants.d.ts +0 -0
- package/lib/table/pivot/cross-table/constants.js +1 -2
- package/lib/table/pivot/cross-table/cross-table.d.ts +0 -0
- package/lib/table/pivot/cross-table/cross-table.js +25 -42
- package/lib/table/pivot/cross-table/index.d.ts +0 -0
- package/lib/table/pivot/cross-table/index.js +0 -4
- package/lib/table/pivot/cross-table/interfaces.d.ts +0 -0
- package/lib/table/pivot/cross-table/interfaces.js +0 -0
- package/lib/table/pivot/cross-table/internals.d.ts +0 -0
- package/lib/table/pivot/cross-table/internals.js +0 -0
- package/lib/table/pivot/cross-tree-table/buildCrossTreeTable.d.ts +0 -0
- package/lib/table/pivot/cross-tree-table/buildCrossTreeTable.js +22 -70
- package/lib/table/pivot/cross-tree-table/cross-tree-table.d.ts +0 -0
- package/lib/table/pivot/cross-tree-table/cross-tree-table.js +37 -73
- package/lib/table/pivot/cross-tree-table/index.d.ts +0 -0
- package/lib/table/pivot/cross-tree-table/index.js +0 -3
- package/lib/table/pivot/pivot-utils/buildDrillTree.d.ts +0 -0
- package/lib/table/pivot/pivot-utils/buildDrillTree.js +10 -29
- package/lib/table/pivot/pivot-utils/builders.d.ts +0 -0
- package/lib/table/pivot/pivot-utils/builders.js +34 -85
- package/lib/table/pivot/pivot-utils/convert-utils.d.ts +0 -0
- package/lib/table/pivot/pivot-utils/convert-utils.js +16 -60
- package/lib/table/pivot/pivot-utils/index.d.ts +0 -0
- package/lib/table/pivot/pivot-utils/index.js +0 -7
- package/lib/table/pivot/pivot-utils/interfaces.d.ts +0 -0
- package/lib/table/pivot/pivot-utils/interfaces.js +0 -0
- package/lib/table/pivot/pivot-utils/simpleEncode.d.ts +0 -0
- package/lib/table/pivot/pivot-utils/simpleEncode.js +0 -2
- package/lib/table/style/css.js +0 -1
- package/lib/table/style/index.css +0 -0
- package/lib/table/style/index.d.ts +0 -0
- package/lib/table/style/index.js +0 -1
- package/lib/table/style/index.less +0 -0
- package/lib/table/transforms/autoRowSpan.d.ts +0 -0
- package/lib/table/transforms/autoRowSpan.js +1 -21
- package/lib/table/transforms/autoWidth.d.ts +0 -0
- package/lib/table/transforms/autoWidth.js +15 -58
- package/lib/table/transforms/buildTree.d.ts +0 -0
- package/lib/table/transforms/buildTree.js +1 -4
- package/lib/table/transforms/columnHover.d.ts +0 -0
- package/lib/table/transforms/columnHover.js +9 -22
- package/lib/table/transforms/columnRangeHover.d.ts +0 -0
- package/lib/table/transforms/columnRangeHover.js +12 -27
- package/lib/table/transforms/columnResize.d.ts +0 -0
- package/lib/table/transforms/columnResize.js +20 -63
- package/lib/table/transforms/flatten.d.ts +0 -0
- package/lib/table/transforms/flatten.js +0 -5
- package/lib/table/transforms/index.d.ts +0 -0
- package/lib/table/transforms/index.js +0 -12
- package/lib/table/transforms/orderField.d.ts +0 -0
- package/lib/table/transforms/orderField.js +0 -7
- package/lib/table/transforms/sort.d.ts +0 -0
- package/lib/table/transforms/sort.js +44 -127
- package/lib/table/transforms/tips.d.ts +0 -0
- package/lib/table/transforms/tips.js +5 -20
- package/lib/table/transforms/treeMode.d.ts +0 -0
- package/lib/table/transforms/treeMode.js +38 -106
- package/lib/table/transforms/visible.d.ts +0 -0
- package/lib/table/transforms/visible.js +0 -7
- package/lib/table/transforms/warnTransformsDeprecated.d.ts +0 -0
- package/lib/table/transforms/warnTransformsDeprecated.js +0 -4
- package/lib/table/use/useResizeObserver.d.ts +0 -0
- package/lib/table/use/useResizeObserver.js +2 -10
- package/lib/table/utils/applyTransforms.d.ts +0 -0
- package/lib/table/utils/applyTransforms.js +0 -2
- package/lib/table/utils/browserType.d.ts +0 -0
- package/lib/table/utils/browserType.js +14 -23
- package/lib/table/utils/buildTree.d.ts +0 -0
- package/lib/table/utils/buildTree.js +7 -33
- package/lib/table/utils/collectNodes.d.ts +0 -0
- package/lib/table/utils/collectNodes.js +4 -18
- package/lib/table/utils/console.d.ts +0 -0
- package/lib/table/utils/console.js +2 -19
- package/lib/table/utils/copyToClipboard.d.ts +0 -0
- package/lib/table/utils/copyToClipboard.js +1 -8
- package/lib/table/utils/element.d.ts +0 -0
- package/lib/table/utils/element.js +14 -46
- package/lib/table/utils/exportTableAsExcel.d.ts +0 -0
- package/lib/table/utils/exportTableAsExcel.js +7 -52
- package/lib/table/utils/getTreeDepth.d.ts +0 -0
- package/lib/table/utils/getTreeDepth.js +4 -17
- package/lib/table/utils/groupBy.d.ts +0 -0
- package/lib/table/utils/groupBy.js +4 -17
- package/lib/table/utils/index.d.ts +0 -0
- package/lib/table/utils/index.js +0 -22
- package/lib/table/utils/isGroupColumn.d.ts +0 -0
- package/lib/table/utils/isGroupColumn.js +0 -3
- package/lib/table/utils/isLeafNode.d.ts +0 -0
- package/lib/table/utils/isLeafNode.js +0 -1
- package/lib/table/utils/keyCode.d.ts +0 -0
- package/lib/table/utils/keyCode.js +1 -2
- package/lib/table/utils/layeredFilter.d.ts +0 -0
- package/lib/table/utils/layeredFilter.js +0 -10
- package/lib/table/utils/layeredSort.d.ts +0 -0
- package/lib/table/utils/layeredSort.js +0 -10
- package/lib/table/utils/makeRecursiveMapper.d.ts +0 -0
- package/lib/table/utils/makeRecursiveMapper.js +4 -24
- package/lib/table/utils/mergeCellProps.d.ts +0 -0
- package/lib/table/utils/mergeCellProps.js +6 -18
- package/lib/table/utils/others.d.ts +0 -0
- package/lib/table/utils/others.js +7 -36
- package/lib/table/utils/proto.d.ts +0 -0
- package/lib/table/utils/proto.js +3 -35
- package/lib/table/utils/selectColumn.d.ts +0 -0
- package/lib/table/utils/selectColumn.js +2 -5
- package/lib/table/utils/smartCompare.d.ts +0 -0
- package/lib/table/utils/smartCompare.js +4 -13
- package/lib/table/utils/traverseColumn.d.ts +0 -0
- package/lib/table/utils/traverseColumn.js +5 -25
- package/lib/table/utils/tree-data-helpers/StrictTreeDataHelper.d.ts +0 -0
- package/lib/table/utils/tree-data-helpers/StrictTreeDataHelper.js +10 -41
- package/lib/table/utils/tree-data-helpers/TreeDataHelper.d.ts +0 -0
- package/lib/table/utils/tree-data-helpers/TreeDataHelper.js +21 -90
- package/lib/table/utils/uiDegrade.d.ts +0 -0
- package/lib/table/utils/uiDegrade.js +1 -8
- package/package.json +1 -1
package/es/table/base/table.js
CHANGED
|
@@ -7,24 +7,17 @@ import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
|
7
7
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
8
8
|
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
9
9
|
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
10
|
-
import _inherits from "@babel/runtime-corejs3/helpers/inherits";
|
|
11
10
|
import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
|
|
12
11
|
import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
|
|
13
|
-
|
|
14
|
-
function _createForOfIteratorHelper(
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
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; }
|
|
19
|
-
|
|
12
|
+
import _inherits from "@babel/runtime-corejs3/helpers/inherits";
|
|
13
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof _Symbol && _getIteratorMethod(r) || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
14
|
+
function _unsupportedIterableToArray(r, a) { if (r) { var _context2; if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = _sliceInstanceProperty(_context2 = {}.toString.call(r)).call(_context2, 8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? _Array$from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
15
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
20
16
|
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
21
17
|
import _flatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/flat";
|
|
22
18
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
27
|
-
|
|
19
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
20
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
28
21
|
import cx from 'classnames';
|
|
29
22
|
import React from 'react';
|
|
30
23
|
import { BehaviorSubject, combineLatest, noop, Subscription, Subject, from } from 'rxjs';
|
|
@@ -42,75 +35,58 @@ import { addResizeObserver, getScrollbarSize, OVERSCAN_SIZE, shallowEqual, STYLE
|
|
|
42
35
|
import { console, browserType, isStickyUIDegrade } from '../utils';
|
|
43
36
|
import getTableRenderTemplate from './renderTemplates';
|
|
44
37
|
var propsDotEmptyContentDeprecatedWarned = false;
|
|
45
|
-
|
|
46
38
|
function warnPropsDotEmptyContentIsDeprecated() {
|
|
47
39
|
if (!propsDotEmptyContentDeprecatedWarned) {
|
|
48
40
|
propsDotEmptyContentDeprecatedWarned = true;
|
|
49
41
|
console.warn('BaseTable props.emptyContent 已经过时,请使用 props.components.EmptyContent 来自定义数据为空时的表格表现');
|
|
50
42
|
}
|
|
51
43
|
}
|
|
52
|
-
|
|
53
44
|
export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
54
|
-
_inherits(BaseTable, _React$Component);
|
|
55
|
-
|
|
56
|
-
var _super = _createSuper(BaseTable);
|
|
57
|
-
|
|
58
45
|
function BaseTable(props) {
|
|
59
46
|
var _this;
|
|
60
|
-
|
|
61
47
|
_classCallCheck(this, BaseTable);
|
|
62
|
-
|
|
63
|
-
_this = _super.call(this, props);
|
|
48
|
+
_this = _callSuper(this, BaseTable, [props]);
|
|
64
49
|
_this.rowHeightManager = makeRowHeightManager(_this.props.dataSource.length, _this.props.estimatedRowHeight);
|
|
65
50
|
_this.artTableWrapperRef = /*#__PURE__*/React.createRef();
|
|
66
51
|
_this.hasScrollY = false;
|
|
67
52
|
_this.offsetY = 0;
|
|
68
|
-
|
|
69
53
|
_this.handleRowMouseEnter = function (e) {
|
|
70
54
|
var nodeList = _this.domHelper.getRowNodeListByEvent(e);
|
|
71
|
-
|
|
72
55
|
nodeList && nodeList.forEach(function (node) {
|
|
73
56
|
node.classList.add('row-hover');
|
|
74
57
|
});
|
|
75
58
|
};
|
|
76
|
-
|
|
77
59
|
_this.handleRowMouseLeave = function (e) {
|
|
78
60
|
var nodeList = _this.domHelper.getRowNodeListByEvent(e);
|
|
79
|
-
|
|
80
61
|
nodeList && nodeList.forEach(function (node) {
|
|
81
62
|
node.classList.remove('row-hover');
|
|
82
63
|
});
|
|
83
64
|
};
|
|
84
|
-
|
|
85
65
|
_this.renderTableBody = function (info) {
|
|
86
66
|
// console.log('render body')
|
|
87
67
|
var _this$props = _this.props,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
var tableBodyClassName = cx(Classes.tableBody, Classes.horizontalScrollContainer);
|
|
95
|
-
|
|
68
|
+
dataSource = _this$props.dataSource,
|
|
69
|
+
getRowProps = _this$props.getRowProps,
|
|
70
|
+
primaryKey = _this$props.primaryKey,
|
|
71
|
+
isLoading = _this$props.isLoading,
|
|
72
|
+
emptyCellHeight = _this$props.emptyCellHeight,
|
|
73
|
+
footerDataSource = _this$props.footerDataSource;
|
|
74
|
+
var tableBodyClassName = cx(Classes.tableBody, Classes.horizontalScrollContainer);
|
|
75
|
+
// 低版本Edge浏览器下也会出现双滚动条,这里设置overflow: 'hidden',先去掉edge的方向键控制滚动条的功能
|
|
96
76
|
var virtualStyle = browserType.isIE || browserType.isEdge ? {
|
|
97
77
|
overflow: 'hidden'
|
|
98
78
|
} : {};
|
|
99
|
-
|
|
100
79
|
if (dataSource.length === 0) {
|
|
101
80
|
var _this$props2 = _this.props,
|
|
102
|
-
|
|
103
|
-
|
|
81
|
+
components = _this$props2.components,
|
|
82
|
+
emptyContent = _this$props2.emptyContent;
|
|
104
83
|
var EmptyContent = components.EmptyContent;
|
|
105
|
-
|
|
106
84
|
if (EmptyContent == null && emptyContent != null) {
|
|
107
85
|
warnPropsDotEmptyContentIsDeprecated();
|
|
108
|
-
|
|
109
86
|
EmptyContent = function EmptyContent() {
|
|
110
87
|
return emptyContent;
|
|
111
88
|
};
|
|
112
89
|
}
|
|
113
|
-
|
|
114
90
|
return /*#__PURE__*/React.createElement("div", {
|
|
115
91
|
className: cx(tableBodyClassName, 'empty')
|
|
116
92
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -124,14 +100,12 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
124
100
|
emptyCellHeight: emptyCellHeight
|
|
125
101
|
})));
|
|
126
102
|
}
|
|
127
|
-
|
|
128
103
|
var _info$verticalRenderR = info.verticalRenderRange,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
104
|
+
topIndex = _info$verticalRenderR.topIndex,
|
|
105
|
+
bottomBlank = _info$verticalRenderR.bottomBlank,
|
|
106
|
+
topBlank = _info$verticalRenderR.topBlank,
|
|
107
|
+
bottomIndex = _info$verticalRenderR.bottomIndex;
|
|
133
108
|
var renderBody = getTableRenderTemplate('body');
|
|
134
|
-
|
|
135
109
|
if (typeof renderBody === 'function') {
|
|
136
110
|
return renderBody(info, _this.props, {
|
|
137
111
|
rowProps: {
|
|
@@ -140,20 +114,19 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
140
114
|
}
|
|
141
115
|
});
|
|
142
116
|
}
|
|
143
|
-
|
|
144
117
|
return /*#__PURE__*/React.createElement("div", {
|
|
145
118
|
className: tableBodyClassName
|
|
146
119
|
}, /*#__PURE__*/React.createElement("div", {
|
|
147
120
|
className: Classes.virtual,
|
|
148
121
|
tabIndex: -1,
|
|
149
122
|
style: virtualStyle
|
|
150
|
-
}, topBlank > 0 && /*#__PURE__*/React.createElement("div", {
|
|
123
|
+
}, topBlank > 0 && ( /*#__PURE__*/React.createElement("div", {
|
|
151
124
|
key: "top-blank",
|
|
152
125
|
className: cx(Classes.virtualBlank, 'top'),
|
|
153
126
|
style: {
|
|
154
127
|
height: topBlank
|
|
155
128
|
}
|
|
156
|
-
}), /*#__PURE__*/React.createElement(HtmlTable, {
|
|
129
|
+
})), /*#__PURE__*/React.createElement(HtmlTable, {
|
|
157
130
|
tbodyHtmlTag: "tbody",
|
|
158
131
|
getRowProps: getRowProps,
|
|
159
132
|
primaryKey: primaryKey,
|
|
@@ -165,15 +138,14 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
165
138
|
limit: bottomIndex,
|
|
166
139
|
last: dataSource.length - 1
|
|
167
140
|
}
|
|
168
|
-
}), bottomBlank > 0 && /*#__PURE__*/React.createElement("div", {
|
|
141
|
+
}), bottomBlank > 0 && ( /*#__PURE__*/React.createElement("div", {
|
|
169
142
|
key: "bottom-blank",
|
|
170
143
|
className: cx(Classes.virtualBlank, 'bottom'),
|
|
171
144
|
style: {
|
|
172
145
|
height: bottomBlank
|
|
173
146
|
}
|
|
174
|
-
})));
|
|
147
|
+
}))));
|
|
175
148
|
};
|
|
176
|
-
|
|
177
149
|
_this.state = {
|
|
178
150
|
hasScroll: true,
|
|
179
151
|
hasScrollY: true,
|
|
@@ -189,43 +161,37 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
189
161
|
return _this;
|
|
190
162
|
}
|
|
191
163
|
/** @deprecated BaseTable.getDoms() 已经过时,请勿调用 */
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
_createClass(BaseTable, [{
|
|
164
|
+
_inherits(BaseTable, _React$Component);
|
|
165
|
+
return _createClass(BaseTable, [{
|
|
195
166
|
key: "getDoms",
|
|
196
167
|
value: function getDoms() {
|
|
197
168
|
console.warn('[kd-table] BaseTable.getDoms() 已经过时');
|
|
198
169
|
return this.domHelper;
|
|
199
170
|
}
|
|
200
171
|
/** 自定义滚动条宽度为table宽度,使滚动条滑块宽度相同 */
|
|
201
|
-
|
|
202
172
|
}, {
|
|
203
173
|
key: "updateStickyScroll",
|
|
204
174
|
value: function updateStickyScroll() {
|
|
205
175
|
var _a, _b;
|
|
206
|
-
|
|
207
176
|
var _this$domHelper = this.domHelper,
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
177
|
+
stickyScroll = _this$domHelper.stickyScroll,
|
|
178
|
+
artTable = _this$domHelper.artTable,
|
|
179
|
+
stickyScrollItem = _this$domHelper.stickyScrollItem;
|
|
211
180
|
var _lastHasScrollY = this.hasScrollY;
|
|
212
|
-
|
|
213
181
|
if (!artTable) {
|
|
214
182
|
return;
|
|
215
183
|
}
|
|
216
|
-
|
|
217
184
|
var tableBodyHtmlTable = this.domHelper.getTableBodyHtmlTable();
|
|
218
185
|
var innerTableWidth = tableBodyHtmlTable.offsetWidth;
|
|
219
186
|
var artTableWidth = artTable.offsetWidth;
|
|
220
|
-
var artTableHeight = artTable.offsetHeight;
|
|
221
|
-
|
|
187
|
+
var artTableHeight = artTable.offsetHeight;
|
|
188
|
+
// 表格隐藏后,不需要对表格的滚动条做额外的逻辑处理
|
|
222
189
|
if (artTableWidth === 0 && artTableHeight === 0) return;
|
|
223
190
|
var stickyScrollHeightProp = this.props.stickyScrollHeight;
|
|
224
|
-
var stickyScrollHeight = stickyScrollHeightProp === 'auto' ? this.getScrollBarWidth() : stickyScrollHeightProp;
|
|
191
|
+
var stickyScrollHeight = stickyScrollHeightProp === 'auto' ? this.getScrollBarWidth() : stickyScrollHeightProp;
|
|
192
|
+
// stickyScroll.style.marginTop = `-${stickyScrollHeight + 1}px`
|
|
225
193
|
// 设置滚动条高度
|
|
226
|
-
|
|
227
194
|
stickyScroll.style.height = "".concat(stickyScrollHeight, "px");
|
|
228
|
-
|
|
229
195
|
if (artTableWidth >= innerTableWidth) {
|
|
230
196
|
if (this.state.hasScroll) {
|
|
231
197
|
this.setState({
|
|
@@ -240,7 +206,6 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
240
206
|
});
|
|
241
207
|
}
|
|
242
208
|
}
|
|
243
|
-
|
|
244
209
|
if (this.domHelper.virtual.offsetHeight > this.domHelper.tableBody.offsetHeight) {
|
|
245
210
|
// if (!this.state.hasScroll) {
|
|
246
211
|
// this.setState({
|
|
@@ -255,34 +220,30 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
255
220
|
// })
|
|
256
221
|
this.hasScrollY = false;
|
|
257
222
|
}
|
|
258
|
-
|
|
259
223
|
if (_lastHasScrollY !== this.hasScrollY) {
|
|
260
224
|
(_b = (_a = this.props).setTableWidth) === null || _b === void 0 ? void 0 : _b.call(_a, this.domHelper.tableBody.clientWidth);
|
|
261
225
|
}
|
|
262
|
-
|
|
263
226
|
var _this$lastInfo = this.lastInfo,
|
|
264
|
-
|
|
265
|
-
|
|
227
|
+
leftLockTotalWidth = _this$lastInfo.leftLockTotalWidth,
|
|
228
|
+
rightLockTotalWidth = _this$lastInfo.rightLockTotalWidth;
|
|
266
229
|
var lockTotalWidth = leftLockTotalWidth + rightLockTotalWidth;
|
|
267
|
-
var stickyRightOffset = this.hasScrollY ? this.getScrollBarWidth() : 0;
|
|
268
|
-
|
|
230
|
+
var stickyRightOffset = this.hasScrollY ? this.getScrollBarWidth() : 0;
|
|
231
|
+
// 设置子节点宽度
|
|
269
232
|
stickyScrollItem.style.width = "".concat(innerTableWidth - lockTotalWidth + stickyRightOffset, "px");
|
|
270
233
|
}
|
|
271
234
|
}, {
|
|
272
235
|
key: "renderTableHeader",
|
|
273
236
|
value: function renderTableHeader(info) {
|
|
274
237
|
var _this$props3 = this.props,
|
|
275
|
-
|
|
276
|
-
|
|
238
|
+
stickyTop = _this$props3.stickyTop,
|
|
239
|
+
hasHeader = _this$props3.hasHeader;
|
|
277
240
|
var renderHeader = getTableRenderTemplate('header');
|
|
278
241
|
var stickyRightOffset = this.hasScrollY ? this.getScrollBarWidth() : 0;
|
|
279
|
-
|
|
280
242
|
if (typeof renderHeader === 'function') {
|
|
281
243
|
return renderHeader(info, this.props, {
|
|
282
244
|
stickyRightOffset: stickyRightOffset
|
|
283
245
|
});
|
|
284
246
|
}
|
|
285
|
-
|
|
286
247
|
return /*#__PURE__*/React.createElement("div", {
|
|
287
248
|
className: cx(Classes.tableHeader, 'no-scrollbar'),
|
|
288
249
|
style: {
|
|
@@ -316,31 +277,23 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
316
277
|
this.syncHorizontalScroll(this.domHelper.virtual.scrollLeft);
|
|
317
278
|
}
|
|
318
279
|
/** 同步横向滚动偏移量 */
|
|
319
|
-
|
|
320
280
|
}, {
|
|
321
281
|
key: "syncHorizontalScroll",
|
|
322
282
|
value: function syncHorizontalScroll(x) {
|
|
323
283
|
this.updateOffsetX(x);
|
|
324
|
-
|
|
325
284
|
var flat = _flatInstanceProperty(this.lastInfo);
|
|
326
|
-
|
|
327
285
|
var leftLockShadow = this.domHelper.getLeftLockShadow();
|
|
328
|
-
|
|
329
286
|
if (leftLockShadow) {
|
|
330
287
|
var shouldShowLeftLockShadow = flat.left.length > 0 && this.state.needRenderLock && x > 0;
|
|
331
|
-
|
|
332
288
|
if (shouldShowLeftLockShadow) {
|
|
333
289
|
leftLockShadow.classList.add('show-shadow');
|
|
334
290
|
} else {
|
|
335
291
|
leftLockShadow.classList.remove('show-shadow');
|
|
336
292
|
}
|
|
337
293
|
}
|
|
338
|
-
|
|
339
294
|
var rightLockShadow = this.domHelper.getRightLockShadow();
|
|
340
|
-
|
|
341
295
|
if (rightLockShadow) {
|
|
342
296
|
var shouldShowRightLockShadow = flat.right.length > 0 && this.state.needRenderLock && x < this.domHelper.virtual.scrollWidth - this.domHelper.virtual.clientWidth;
|
|
343
|
-
|
|
344
297
|
if (shouldShowRightLockShadow) {
|
|
345
298
|
rightLockShadow.classList.add('show-shadow');
|
|
346
299
|
} else {
|
|
@@ -353,10 +306,9 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
353
306
|
value: function getVerticalRenderRange(useVirtual) {
|
|
354
307
|
var dataSource = this.props.dataSource;
|
|
355
308
|
var _this$state = this.state,
|
|
356
|
-
|
|
357
|
-
|
|
309
|
+
offsetY = _this$state.offsetY,
|
|
310
|
+
maxRenderHeight = _this$state.maxRenderHeight;
|
|
358
311
|
var rowCount = dataSource.length;
|
|
359
|
-
|
|
360
312
|
if (useVirtual.vertical) {
|
|
361
313
|
return this.rowHeightManager.getRenderRange(offsetY, maxRenderHeight, rowCount);
|
|
362
314
|
} else {
|
|
@@ -368,14 +320,13 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
368
320
|
value: function renderTableFooter(info) {
|
|
369
321
|
// console.log('render footer')
|
|
370
322
|
var _this$props4 = this.props,
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
323
|
+
_this$props4$footerDa = _this$props4.footerDataSource,
|
|
324
|
+
footerDataSource = _this$props4$footerDa === void 0 ? [] : _this$props4$footerDa,
|
|
325
|
+
getRowProps = _this$props4.getRowProps,
|
|
326
|
+
primaryKey = _this$props4.primaryKey,
|
|
327
|
+
stickyBottom = _this$props4.stickyBottom;
|
|
376
328
|
var stickyRightOffset = this.hasScrollY ? this.getScrollBarWidth() : 0;
|
|
377
329
|
var renderFooter = getTableRenderTemplate('footer');
|
|
378
|
-
|
|
379
330
|
if (typeof renderFooter === 'function') {
|
|
380
331
|
return renderFooter(info, this.props, {
|
|
381
332
|
rowProps: {
|
|
@@ -385,7 +336,6 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
385
336
|
stickyRightOffset: stickyRightOffset
|
|
386
337
|
});
|
|
387
338
|
}
|
|
388
|
-
|
|
389
339
|
return /*#__PURE__*/React.createElement("div", {
|
|
390
340
|
className: cx(Classes.tableFooter, Classes.horizontalScrollContainer),
|
|
391
341
|
style: {
|
|
@@ -415,8 +365,8 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
415
365
|
}, {
|
|
416
366
|
key: "renderLockShadows",
|
|
417
367
|
value: function renderLockShadows(info) {
|
|
418
|
-
var stickyRightOffset = this.hasScrollY ? this.getScrollBarWidth() : 0;
|
|
419
|
-
|
|
368
|
+
var stickyRightOffset = this.hasScrollY ? this.getScrollBarWidth() : 0;
|
|
369
|
+
// console.log('render LockShadows')
|
|
420
370
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
421
371
|
className: Classes.lockShadowMask,
|
|
422
372
|
style: {
|
|
@@ -440,8 +390,8 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
440
390
|
value: function renderStickyScroll(info) {
|
|
441
391
|
// console.log('render stickyscroll')
|
|
442
392
|
var _this$props5 = this.props,
|
|
443
|
-
|
|
444
|
-
|
|
393
|
+
hasStickyScroll = _this$props5.hasStickyScroll,
|
|
394
|
+
stickyBottom = _this$props5.stickyBottom;
|
|
445
395
|
var hasScroll = this.state.hasScroll;
|
|
446
396
|
var isScroll = hasStickyScroll && hasScroll;
|
|
447
397
|
var stickyScrollContainerStyle = this.getStickyScrollContainerStyle();
|
|
@@ -479,8 +429,8 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
479
429
|
key: "getStickyScrollContainerStyle",
|
|
480
430
|
value: function getStickyScrollContainerStyle() {
|
|
481
431
|
var _this$props6 = this.props,
|
|
482
|
-
|
|
483
|
-
|
|
432
|
+
hasStickyScroll = _this$props6.hasStickyScroll,
|
|
433
|
+
stickyScrollHeight = _this$props6.stickyScrollHeight;
|
|
484
434
|
var hasScroll = this.state.hasScroll;
|
|
485
435
|
var isScroll = hasStickyScroll && hasScroll;
|
|
486
436
|
var height = stickyScrollHeight === 'auto' ? this.getScrollBarWidth() : stickyScrollHeight;
|
|
@@ -494,26 +444,24 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
494
444
|
}, {
|
|
495
445
|
key: "render",
|
|
496
446
|
value: function render() {
|
|
497
|
-
var _cx;
|
|
498
|
-
|
|
499
447
|
// console.log('render table')
|
|
500
448
|
var info = calculateRenderInfo(this);
|
|
501
449
|
this.lastInfo = info;
|
|
502
450
|
var _this$props7 = this.props,
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
var artTableWrapperClassName = cx(Classes.artTableWrapper, (
|
|
451
|
+
dataSource = _this$props7.dataSource,
|
|
452
|
+
className = _this$props7.className,
|
|
453
|
+
style = _this$props7.style,
|
|
454
|
+
hasHeader = _this$props7.hasHeader,
|
|
455
|
+
useOuterBorder = _this$props7.useOuterBorder,
|
|
456
|
+
isStickyHead = _this$props7.isStickyHead,
|
|
457
|
+
isStickyHeader = _this$props7.isStickyHeader,
|
|
458
|
+
isStickyFooter = _this$props7.isStickyFooter,
|
|
459
|
+
isLoading = _this$props7.isLoading,
|
|
460
|
+
getTableProps = _this$props7.getTableProps,
|
|
461
|
+
footerDataSource = _this$props7.footerDataSource,
|
|
462
|
+
components = _this$props7.components,
|
|
463
|
+
bordered = _this$props7.bordered;
|
|
464
|
+
var artTableWrapperClassName = cx(Classes.artTableWrapper, _defineProperty(_defineProperty(_defineProperty({
|
|
517
465
|
'use-outer-border': useOuterBorder,
|
|
518
466
|
empty: dataSource.length === 0,
|
|
519
467
|
lock: info.hasLockColumn,
|
|
@@ -521,13 +469,11 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
521
469
|
'sticky-header': isStickyHeader !== null && isStickyHeader !== void 0 ? isStickyHeader : isStickyHead,
|
|
522
470
|
'has-footer': footerDataSource.length > 0,
|
|
523
471
|
'sticky-footer': isStickyFooter
|
|
524
|
-
},
|
|
525
|
-
|
|
472
|
+
}, Classes.artTableBordered, bordered), 'ie-polyfill-wrapper', browserType.isIE), 'sticky-polyfill-wrapper', isStickyUIDegrade()), className);
|
|
526
473
|
var artTableWrapperProps = _defineProperty({
|
|
527
474
|
className: artTableWrapperClassName,
|
|
528
475
|
style: style
|
|
529
476
|
}, STYLED_REF_PROP, this.artTableWrapperRef);
|
|
530
|
-
|
|
531
477
|
var tableProps = getTableProps() || {};
|
|
532
478
|
return /*#__PURE__*/React.createElement(StyledArtTableWrapper, _extends({}, artTableWrapperProps), /*#__PURE__*/React.createElement(Loading, {
|
|
533
479
|
visible: isLoading,
|
|
@@ -541,18 +487,17 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
541
487
|
key: "componentDidMount",
|
|
542
488
|
value: function componentDidMount() {
|
|
543
489
|
var _a, _b, _c, _d, _e, _f;
|
|
544
|
-
|
|
545
490
|
this.rootSubscription = new Subscription();
|
|
546
491
|
this.resizeSubject = new Subject();
|
|
547
492
|
this.updateDOMHelper();
|
|
548
493
|
this.props$ = new BehaviorSubject(this.props);
|
|
549
494
|
this.initSubscriptions();
|
|
550
|
-
this.didMountOrUpdate();
|
|
551
|
-
|
|
495
|
+
this.didMountOrUpdate();
|
|
496
|
+
// console.log('did mount end')
|
|
552
497
|
var _this$props8 = this.props,
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
498
|
+
cssVariables = _this$props8.cssVariables,
|
|
499
|
+
enableCSSVariables = _this$props8.enableCSSVariables,
|
|
500
|
+
bordered = _this$props8.bordered;
|
|
556
501
|
cssPolifill({
|
|
557
502
|
variables: cssVariables || {},
|
|
558
503
|
enableCSSVariables: enableCSSVariables,
|
|
@@ -565,14 +510,12 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
565
510
|
}, {
|
|
566
511
|
key: "componentDidUpdate",
|
|
567
512
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
568
|
-
var _a;
|
|
569
|
-
|
|
570
|
-
|
|
513
|
+
var _a;
|
|
514
|
+
// console.log('did update start')
|
|
571
515
|
var _this$props9 = this.props,
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
516
|
+
cssVariables = _this$props9.cssVariables,
|
|
517
|
+
enableCSSVariables = _this$props9.enableCSSVariables,
|
|
518
|
+
bordered = _this$props9.bordered;
|
|
576
519
|
if (!shallowEqual(prevProps === null || prevProps === void 0 ? void 0 : prevProps.cssVariables, (_a = this.props) === null || _a === void 0 ? void 0 : _a.cssVariables)) {
|
|
577
520
|
cssPolifill({
|
|
578
521
|
variables: cssVariables || {},
|
|
@@ -580,10 +523,10 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
580
523
|
bordered: bordered
|
|
581
524
|
});
|
|
582
525
|
}
|
|
583
|
-
|
|
584
526
|
this.updateDOMHelper();
|
|
585
527
|
this.props$.next(this.props);
|
|
586
|
-
this.didMountOrUpdate(prevProps, prevState);
|
|
528
|
+
this.didMountOrUpdate(prevProps, prevState);
|
|
529
|
+
// console.log('did update end')
|
|
587
530
|
}
|
|
588
531
|
}, {
|
|
589
532
|
key: "didMountOrUpdate",
|
|
@@ -602,11 +545,9 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
602
545
|
this.domHelper.stickyScroll.scrollLeft = 0;
|
|
603
546
|
}
|
|
604
547
|
}
|
|
605
|
-
|
|
606
548
|
if (prevProps != null) {
|
|
607
549
|
var prevHasFooter = prevProps.footerDataSource.length > 0;
|
|
608
550
|
var currentHasFooter = this.props.footerDataSource.length > 0;
|
|
609
|
-
|
|
610
551
|
if (!prevHasFooter && currentHasFooter) {
|
|
611
552
|
getTableScrollFooterDOM(this.domHelper).scrollLeft = this.domHelper.virtual.scrollLeft;
|
|
612
553
|
}
|
|
@@ -616,64 +557,55 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
616
557
|
key: "initSubscriptions",
|
|
617
558
|
value: function initSubscriptions() {
|
|
618
559
|
var _this2 = this;
|
|
619
|
-
|
|
620
560
|
var _this$domHelper2 = this.domHelper,
|
|
621
|
-
|
|
622
|
-
|
|
561
|
+
virtual = _this$domHelper2.virtual,
|
|
562
|
+
stickyScroll = _this$domHelper2.stickyScroll;
|
|
623
563
|
this.rootSubscription.add(throttledWindowResize$.subscribe(function () {
|
|
624
564
|
_this2.updateStickyScroll();
|
|
625
|
-
|
|
626
565
|
_this2.adjustNeedRenderLock();
|
|
627
566
|
}));
|
|
628
567
|
this.resizeSubject.pipe(op.debounceTime(100)).subscribe(function () {
|
|
629
568
|
var _a, _b;
|
|
630
|
-
|
|
631
569
|
(_b = (_a = _this2.props).setTableWidth) === null || _b === void 0 ? void 0 : _b.call(_a, _this2.domHelper.tableBody.clientWidth);
|
|
632
570
|
});
|
|
633
|
-
|
|
634
571
|
var handleTableWrapperResize = function handleTableWrapperResize() {
|
|
635
572
|
_this2.resizeSubject.next();
|
|
636
573
|
};
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
574
|
+
this.resizeObserver = addResizeObserver(this.domHelper.artTableWrapper, handleTableWrapperResize);
|
|
575
|
+
// 滚动同步
|
|
640
576
|
this.rootSubscription.add(syncScrollLeft([getTableScrollHeaderDOM(this.domHelper), virtual, getTableScrollFooterDOM(this.domHelper), stickyScroll], function (scrollLeft) {
|
|
641
577
|
_this2.syncHorizontalScroll(scrollLeft);
|
|
642
578
|
}));
|
|
643
|
-
var richVisibleRects$ = getRichVisibleRectsStream(this.domHelper.virtual, this.props$.pipe(op.skip(1), op.mapTo('structure-may-change')), this.props.virtualDebugLabel).pipe(op.shareReplay());
|
|
644
|
-
|
|
579
|
+
var richVisibleRects$ = getRichVisibleRectsStream(this.domHelper.virtual, this.props$.pipe(op.skip(1), op.mapTo('structure-may-change')), this.props.virtualDebugLabel).pipe(op.shareReplay());
|
|
580
|
+
// 每当可见部分发生变化的时候,调整 loading icon 的未知(如果 loading icon 存在的话)
|
|
645
581
|
this.rootSubscription.add(combineLatest([richVisibleRects$.pipe(op.map(function (p) {
|
|
646
582
|
return p.clipRect;
|
|
647
583
|
}), op.distinctUntilChanged(shallowEqual)), this.props$.pipe(op.startWith(null), op.pairwise(), op.filter(function (_ref) {
|
|
648
584
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
585
|
+
prevProps = _ref2[0],
|
|
586
|
+
props = _ref2[1];
|
|
652
587
|
return prevProps == null || !prevProps.isLoading && props.isLoading;
|
|
653
588
|
}))]).subscribe(function (_ref3) {
|
|
654
589
|
var _ref4 = _slicedToArray(_ref3, 1),
|
|
655
|
-
|
|
656
|
-
|
|
590
|
+
clipRect = _ref4[0];
|
|
657
591
|
var loadingIndicator = _this2.domHelper.getLoadingIndicator();
|
|
658
|
-
|
|
659
592
|
if (!loadingIndicator) {
|
|
660
593
|
return;
|
|
661
594
|
}
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
595
|
+
var height = clipRect.bottom - clipRect.top;
|
|
596
|
+
// fixme 这里的定位在有些特殊情况下可能会出错 see #132
|
|
665
597
|
loadingIndicator.style.top = "".concat(height / 2, "px");
|
|
666
598
|
loadingIndicator.style.marginTop = "".concat(height / 2, "px");
|
|
667
|
-
}));
|
|
668
|
-
|
|
599
|
+
}));
|
|
600
|
+
// 每当可见部分发生变化的时候,如果开启了虚拟滚动,则重新触发 render
|
|
669
601
|
this.rootSubscription.add(richVisibleRects$.pipe(op.filter(function () {
|
|
670
602
|
var _this2$lastInfo$useVi = _this2.lastInfo.useVirtual,
|
|
671
|
-
|
|
672
|
-
|
|
603
|
+
horizontal = _this2$lastInfo$useVi.horizontal,
|
|
604
|
+
vertical = _this2$lastInfo$useVi.vertical;
|
|
673
605
|
return horizontal || vertical;
|
|
674
606
|
}), op.map(function (_ref5) {
|
|
675
607
|
var clipRect = _ref5.clipRect,
|
|
676
|
-
|
|
608
|
+
offsetY = _ref5.offsetY;
|
|
677
609
|
return {
|
|
678
610
|
maxRenderHeight: clipRect.bottom - clipRect.top,
|
|
679
611
|
maxRenderWidth: clipRect.right - clipRect.left,
|
|
@@ -683,16 +615,15 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
683
615
|
// 如果表格区域被隐藏, 不需要触发组件重渲染
|
|
684
616
|
if (y.maxRenderHeight === 0 && y.maxRenderWidth === 0) {
|
|
685
617
|
return true;
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
|
|
618
|
+
}
|
|
619
|
+
// 因为 overscan 的存在,滚动较小的距离时不需要触发组件重渲染
|
|
689
620
|
return Math.abs(x.maxRenderWidth - y.maxRenderWidth) < OVERSCAN_SIZE / 2 && Math.abs(x.maxRenderHeight - y.maxRenderHeight) < OVERSCAN_SIZE / 2 && Math.abs(x.offsetY - y.offsetY) < OVERSCAN_SIZE / 2;
|
|
690
621
|
})).subscribe(function (sizeAndOffset) {
|
|
691
622
|
_this2.setState(sizeAndOffset);
|
|
692
623
|
}));
|
|
693
624
|
this.rootSubscription.add(richVisibleRects$.pipe(op.map(function (_ref6) {
|
|
694
625
|
var clipRect = _ref6.clipRect,
|
|
695
|
-
|
|
626
|
+
offsetY = _ref6.offsetY;
|
|
696
627
|
return {
|
|
697
628
|
maxRenderHeight: clipRect.bottom - clipRect.top,
|
|
698
629
|
maxRenderWidth: clipRect.right - clipRect.left,
|
|
@@ -700,20 +631,18 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
700
631
|
};
|
|
701
632
|
}), op.distinctUntilChanged(function (x, y) {
|
|
702
633
|
return x.offsetY - y.offsetY === 0;
|
|
703
|
-
}),
|
|
634
|
+
}),
|
|
635
|
+
// 计算得到当前行索引对应的数据块,blocks改成数组的形式,兼容快速拖动可视区域出现两个数据块的情况
|
|
704
636
|
op.map(function (sizeAndOffset) {
|
|
705
637
|
var _a;
|
|
706
|
-
|
|
707
638
|
var offsetY = sizeAndOffset.offsetY,
|
|
708
|
-
|
|
639
|
+
maxRenderHeight = sizeAndOffset.maxRenderHeight;
|
|
709
640
|
var scrollDirection = offsetY - _this2.offsetY >= 0 ? 'down' : 'up';
|
|
710
641
|
_this2.offsetY = offsetY;
|
|
711
642
|
var rowCount = _this2.props.dataSource.length;
|
|
712
|
-
|
|
713
643
|
var vertical = _this2.rowHeightManager.getRenderRange(offsetY, maxRenderHeight, rowCount);
|
|
714
|
-
|
|
715
644
|
var topIndex = vertical.topIndex,
|
|
716
|
-
|
|
645
|
+
bottomIndex = vertical.bottomIndex;
|
|
717
646
|
var blockSize = ((_a = _this2.props.scrollLoad) === null || _a === void 0 ? void 0 : _a.blockSize) || 200;
|
|
718
647
|
var topBlockStartIndex = Math.floor(Math.max(topIndex - 1, 0) / blockSize) * blockSize;
|
|
719
648
|
var bottomBlockStartIndex = Math.floor((bottomIndex + 1) / blockSize) * blockSize;
|
|
@@ -725,10 +654,10 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
725
654
|
return event$.pipe(op.map(function (startIndex) {
|
|
726
655
|
return startIndex;
|
|
727
656
|
}));
|
|
728
|
-
}),
|
|
657
|
+
}),
|
|
658
|
+
// 过滤掉重复掉值
|
|
729
659
|
op.distinctUntilChanged()).subscribe(function (startIndex) {
|
|
730
660
|
var _a;
|
|
731
|
-
|
|
732
661
|
(_a = _this2.props.scrollLoad) === null || _a === void 0 ? void 0 : _a.callback(startIndex);
|
|
733
662
|
}));
|
|
734
663
|
}
|
|
@@ -736,13 +665,11 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
736
665
|
key: "componentWillUnmount",
|
|
737
666
|
value: function componentWillUnmount() {
|
|
738
667
|
var _a;
|
|
739
|
-
|
|
740
668
|
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
741
669
|
this.rootSubscription.unsubscribe();
|
|
742
670
|
this.resizeSubject.unsubscribe();
|
|
743
671
|
}
|
|
744
672
|
/** 更新 DOM 节点的引用,方便其他方法直接操作 DOM */
|
|
745
|
-
|
|
746
673
|
}, {
|
|
747
674
|
key: "updateDOMHelper",
|
|
748
675
|
value: function updateDOMHelper() {
|
|
@@ -752,51 +679,42 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
752
679
|
key: "updateRowHeightManager",
|
|
753
680
|
value: function updateRowHeightManager() {
|
|
754
681
|
var _a;
|
|
755
|
-
|
|
756
682
|
var virtualTop = this.domHelper.getVirtualTop();
|
|
757
683
|
var virtualTopHeight = (_a = virtualTop === null || virtualTop === void 0 ? void 0 : virtualTop.clientHeight) !== null && _a !== void 0 ? _a : 0;
|
|
758
684
|
var maxTrRowIndex = -1;
|
|
759
685
|
var maxTrBottom = -1;
|
|
760
686
|
var zeroHeightRowCount = 0;
|
|
761
|
-
|
|
762
687
|
var _iterator = _createForOfIteratorHelper(this.domHelper.getTableRows()),
|
|
763
|
-
|
|
764
|
-
|
|
688
|
+
_step;
|
|
765
689
|
try {
|
|
766
690
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
767
691
|
var tr = _step.value;
|
|
768
692
|
var rowIndex = Number(tr.dataset.rowindex);
|
|
769
|
-
|
|
770
693
|
if (isNaN(rowIndex)) {
|
|
771
694
|
continue;
|
|
772
695
|
}
|
|
773
|
-
|
|
774
696
|
maxTrRowIndex = Math.max(maxTrRowIndex, rowIndex);
|
|
775
697
|
var offset = tr.offsetTop + virtualTopHeight;
|
|
776
698
|
var size = tr.offsetHeight;
|
|
777
|
-
|
|
778
699
|
if (size === 0) {
|
|
779
700
|
zeroHeightRowCount += 1;
|
|
780
701
|
} else {
|
|
781
702
|
// 渲染出来的行高度为0,说明是display=none情况,行高不存在该种异常情况,不保存当前的高度
|
|
782
703
|
this.rowHeightManager.updateRow(rowIndex, offset, size);
|
|
783
704
|
}
|
|
784
|
-
|
|
785
705
|
maxTrBottom = Math.max(maxTrBottom, offset + size);
|
|
786
|
-
}
|
|
706
|
+
}
|
|
707
|
+
// 当 estimatedRowHeight 过大时,可能出现「渲染行数过少,无法覆盖可视范围」的情况
|
|
787
708
|
// 出现这种情况时,我们判断「下一次渲染能够渲染更多行」是否满足,满足的话就直接调用 forceUpdate
|
|
788
709
|
// zeroHeightRowCount === 0 用于确保当前没有 display=none 的情况
|
|
789
|
-
|
|
790
710
|
} catch (err) {
|
|
791
711
|
_iterator.e(err);
|
|
792
712
|
} finally {
|
|
793
713
|
_iterator.f();
|
|
794
714
|
}
|
|
795
|
-
|
|
796
715
|
if (maxTrRowIndex !== -1 && zeroHeightRowCount === 0) {
|
|
797
716
|
if (maxTrBottom < this.state.offsetY + this.state.maxRenderHeight) {
|
|
798
717
|
var vertical = this.getVerticalRenderRange(this.lastInfo.useVirtual);
|
|
799
|
-
|
|
800
718
|
if (vertical.bottomIndex - 1 > maxTrRowIndex) {
|
|
801
719
|
this.forceUpdate();
|
|
802
720
|
}
|
|
@@ -804,24 +722,19 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
804
722
|
}
|
|
805
723
|
}
|
|
806
724
|
/** 计算表格所有列的渲染宽度之和,判断表格是否需要渲染锁列 */
|
|
807
|
-
|
|
808
725
|
}, {
|
|
809
726
|
key: "adjustNeedRenderLock",
|
|
810
727
|
value: function adjustNeedRenderLock() {
|
|
811
728
|
var needRenderLock = this.state.needRenderLock;
|
|
812
|
-
|
|
813
729
|
var _this$lastInfo2 = this.lastInfo,
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
730
|
+
flat = _flatInstanceProperty(_this$lastInfo2),
|
|
731
|
+
hasLockColumn = _this$lastInfo2.hasLockColumn;
|
|
817
732
|
if (hasLockColumn) {
|
|
818
733
|
var _context;
|
|
819
|
-
|
|
820
734
|
var sumOfColWidth = sum(_mapInstanceProperty(_context = flat.full).call(_context, function (col) {
|
|
821
735
|
return col.width;
|
|
822
736
|
}));
|
|
823
737
|
var nextNeedRenderLock = sumOfColWidth > this.domHelper.artTable.clientWidth;
|
|
824
|
-
|
|
825
738
|
if (needRenderLock !== nextNeedRenderLock) {
|
|
826
739
|
this.setState({
|
|
827
740
|
needRenderLock: nextNeedRenderLock
|
|
@@ -836,8 +749,6 @@ export var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
836
749
|
}
|
|
837
750
|
}
|
|
838
751
|
}]);
|
|
839
|
-
|
|
840
|
-
return BaseTable;
|
|
841
752
|
}(React.Component);
|
|
842
753
|
BaseTable.defaultProps = {
|
|
843
754
|
hasHeader: true,
|