@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/lib/table/base/table.js
CHANGED
|
@@ -1,166 +1,107 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
|
|
4
|
-
|
|
4
|
+
var _mapInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/map");
|
|
5
|
+
var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
|
5
6
|
var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
|
|
6
|
-
|
|
7
7
|
var _sliceInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
|
|
8
|
-
|
|
9
8
|
var _Array$from = require("@babel/runtime-corejs3/core-js-stable/array/from");
|
|
10
|
-
|
|
11
9
|
var _Symbol = require("@babel/runtime-corejs3/core-js-stable/symbol");
|
|
12
|
-
|
|
13
10
|
var _getIteratorMethod = require("@babel/runtime-corejs3/core-js/get-iterator-method");
|
|
14
|
-
|
|
15
11
|
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
|
16
|
-
|
|
17
12
|
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
18
|
-
|
|
19
13
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
20
|
-
|
|
21
14
|
Object.defineProperty(exports, "__esModule", {
|
|
22
15
|
value: true
|
|
23
16
|
});
|
|
24
17
|
exports.BaseTable = void 0;
|
|
25
|
-
|
|
26
18
|
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
|
27
|
-
|
|
28
19
|
var _flat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/flat"));
|
|
29
|
-
|
|
30
20
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
31
|
-
|
|
32
21
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
|
33
|
-
|
|
34
22
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
35
|
-
|
|
36
23
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
37
|
-
|
|
38
24
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
39
|
-
|
|
40
25
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
41
|
-
|
|
42
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
|
|
43
|
-
|
|
44
26
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
|
|
45
|
-
|
|
46
27
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
|
|
47
|
-
|
|
28
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
|
|
48
29
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
49
|
-
|
|
50
30
|
var _react = _interopRequireDefault(require("react"));
|
|
51
|
-
|
|
52
31
|
var _rxjs = require("rxjs");
|
|
53
|
-
|
|
54
32
|
var op = _interopRequireWildcard(require("rxjs/operators"));
|
|
55
|
-
|
|
56
33
|
var _calculations = require("./calculations");
|
|
57
|
-
|
|
58
34
|
var _empty = require("./empty");
|
|
59
|
-
|
|
60
35
|
var _header = _interopRequireDefault(require("./header"));
|
|
61
|
-
|
|
62
36
|
var _getRichVisibleRectsStream = require("./helpers/getRichVisibleRectsStream");
|
|
63
|
-
|
|
64
37
|
var _rowHeightManager = require("./helpers/rowHeightManager");
|
|
65
|
-
|
|
66
38
|
var _TableDOMUtils = require("./helpers/TableDOMUtils");
|
|
67
|
-
|
|
68
39
|
var _htmlTable = require("./html-table");
|
|
69
|
-
|
|
70
40
|
var _loading = _interopRequireDefault(require("./loading"));
|
|
71
|
-
|
|
72
41
|
var _styles = require("./styles");
|
|
73
|
-
|
|
74
42
|
var _utils = require("./utils");
|
|
75
|
-
|
|
76
43
|
var _utils2 = require("../utils");
|
|
77
|
-
|
|
78
44
|
var _renderTemplates = _interopRequireDefault(require("./renderTemplates"));
|
|
79
|
-
|
|
80
|
-
function
|
|
81
|
-
|
|
82
|
-
function
|
|
83
|
-
|
|
84
|
-
function
|
|
85
|
-
|
|
86
|
-
function _unsupportedIterableToArray(o, minLen) { var _context2; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty2(_context2 = Object.prototype.toString.call(o)).call(_context2, 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); }
|
|
87
|
-
|
|
88
|
-
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; }
|
|
89
|
-
|
|
90
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
91
|
-
|
|
92
|
-
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; } }
|
|
93
|
-
|
|
45
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof _WeakMap) return null; var r = new _WeakMap(), t = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
46
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && _Object$getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? _Object$getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
47
|
+
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; } } }; }
|
|
48
|
+
function _unsupportedIterableToArray(r, a) { if (r) { var _context2; if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = _sliceInstanceProperty2(_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; } }
|
|
49
|
+
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; }
|
|
50
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
51
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
94
52
|
var propsDotEmptyContentDeprecatedWarned = false;
|
|
95
|
-
|
|
96
53
|
function warnPropsDotEmptyContentIsDeprecated() {
|
|
97
54
|
if (!propsDotEmptyContentDeprecatedWarned) {
|
|
98
55
|
propsDotEmptyContentDeprecatedWarned = true;
|
|
99
|
-
|
|
100
56
|
_utils2.console.warn('BaseTable props.emptyContent 已经过时,请使用 props.components.EmptyContent 来自定义数据为空时的表格表现');
|
|
101
57
|
}
|
|
102
58
|
}
|
|
103
|
-
|
|
104
|
-
var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
105
|
-
(0, _inherits2.default)(BaseTable, _React$Component);
|
|
106
|
-
|
|
107
|
-
var _super = _createSuper(BaseTable);
|
|
108
|
-
|
|
59
|
+
var BaseTable = exports.BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
109
60
|
function BaseTable(props) {
|
|
110
61
|
var _this;
|
|
111
|
-
|
|
112
62
|
(0, _classCallCheck2.default)(this, BaseTable);
|
|
113
|
-
_this =
|
|
63
|
+
_this = _callSuper(this, BaseTable, [props]);
|
|
114
64
|
_this.rowHeightManager = (0, _rowHeightManager.makeRowHeightManager)(_this.props.dataSource.length, _this.props.estimatedRowHeight);
|
|
115
65
|
_this.artTableWrapperRef = /*#__PURE__*/_react.default.createRef();
|
|
116
66
|
_this.hasScrollY = false;
|
|
117
67
|
_this.offsetY = 0;
|
|
118
|
-
|
|
119
68
|
_this.handleRowMouseEnter = function (e) {
|
|
120
69
|
var nodeList = _this.domHelper.getRowNodeListByEvent(e);
|
|
121
|
-
|
|
122
70
|
nodeList && nodeList.forEach(function (node) {
|
|
123
71
|
node.classList.add('row-hover');
|
|
124
72
|
});
|
|
125
73
|
};
|
|
126
|
-
|
|
127
74
|
_this.handleRowMouseLeave = function (e) {
|
|
128
75
|
var nodeList = _this.domHelper.getRowNodeListByEvent(e);
|
|
129
|
-
|
|
130
76
|
nodeList && nodeList.forEach(function (node) {
|
|
131
77
|
node.classList.remove('row-hover');
|
|
132
78
|
});
|
|
133
79
|
};
|
|
134
|
-
|
|
135
80
|
_this.renderTableBody = function (info) {
|
|
136
81
|
// console.log('render body')
|
|
137
82
|
var _this$props = _this.props,
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
var tableBodyClassName = (0, _classnames.default)(_styles.Classes.tableBody, _styles.Classes.horizontalScrollContainer);
|
|
145
|
-
|
|
83
|
+
dataSource = _this$props.dataSource,
|
|
84
|
+
getRowProps = _this$props.getRowProps,
|
|
85
|
+
primaryKey = _this$props.primaryKey,
|
|
86
|
+
isLoading = _this$props.isLoading,
|
|
87
|
+
emptyCellHeight = _this$props.emptyCellHeight,
|
|
88
|
+
footerDataSource = _this$props.footerDataSource;
|
|
89
|
+
var tableBodyClassName = (0, _classnames.default)(_styles.Classes.tableBody, _styles.Classes.horizontalScrollContainer);
|
|
90
|
+
// 低版本Edge浏览器下也会出现双滚动条,这里设置overflow: 'hidden',先去掉edge的方向键控制滚动条的功能
|
|
146
91
|
var virtualStyle = _utils2.browserType.isIE || _utils2.browserType.isEdge ? {
|
|
147
92
|
overflow: 'hidden'
|
|
148
93
|
} : {};
|
|
149
|
-
|
|
150
94
|
if (dataSource.length === 0) {
|
|
151
95
|
var _this$props2 = _this.props,
|
|
152
|
-
|
|
153
|
-
|
|
96
|
+
components = _this$props2.components,
|
|
97
|
+
emptyContent = _this$props2.emptyContent;
|
|
154
98
|
var EmptyContent = components.EmptyContent;
|
|
155
|
-
|
|
156
99
|
if (EmptyContent == null && emptyContent != null) {
|
|
157
100
|
warnPropsDotEmptyContentIsDeprecated();
|
|
158
|
-
|
|
159
101
|
EmptyContent = function EmptyContent() {
|
|
160
102
|
return emptyContent;
|
|
161
103
|
};
|
|
162
104
|
}
|
|
163
|
-
|
|
164
105
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
165
106
|
className: (0, _classnames.default)(tableBodyClassName, 'empty')
|
|
166
107
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -174,14 +115,12 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
174
115
|
emptyCellHeight: emptyCellHeight
|
|
175
116
|
})));
|
|
176
117
|
}
|
|
177
|
-
|
|
178
118
|
var _info$verticalRenderR = info.verticalRenderRange,
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
119
|
+
topIndex = _info$verticalRenderR.topIndex,
|
|
120
|
+
bottomBlank = _info$verticalRenderR.bottomBlank,
|
|
121
|
+
topBlank = _info$verticalRenderR.topBlank,
|
|
122
|
+
bottomIndex = _info$verticalRenderR.bottomIndex;
|
|
183
123
|
var renderBody = (0, _renderTemplates.default)('body');
|
|
184
|
-
|
|
185
124
|
if (typeof renderBody === 'function') {
|
|
186
125
|
return renderBody(info, _this.props, {
|
|
187
126
|
rowProps: {
|
|
@@ -190,20 +129,19 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
190
129
|
}
|
|
191
130
|
});
|
|
192
131
|
}
|
|
193
|
-
|
|
194
132
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
195
133
|
className: tableBodyClassName
|
|
196
134
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
197
135
|
className: _styles.Classes.virtual,
|
|
198
136
|
tabIndex: -1,
|
|
199
137
|
style: virtualStyle
|
|
200
|
-
}, topBlank > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
138
|
+
}, topBlank > 0 && ( /*#__PURE__*/_react.default.createElement("div", {
|
|
201
139
|
key: "top-blank",
|
|
202
140
|
className: (0, _classnames.default)(_styles.Classes.virtualBlank, 'top'),
|
|
203
141
|
style: {
|
|
204
142
|
height: topBlank
|
|
205
143
|
}
|
|
206
|
-
}), /*#__PURE__*/_react.default.createElement(_htmlTable.HtmlTable, {
|
|
144
|
+
})), /*#__PURE__*/_react.default.createElement(_htmlTable.HtmlTable, {
|
|
207
145
|
tbodyHtmlTag: "tbody",
|
|
208
146
|
getRowProps: getRowProps,
|
|
209
147
|
primaryKey: primaryKey,
|
|
@@ -215,15 +153,14 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
215
153
|
limit: bottomIndex,
|
|
216
154
|
last: dataSource.length - 1
|
|
217
155
|
}
|
|
218
|
-
}), bottomBlank > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
156
|
+
}), bottomBlank > 0 && ( /*#__PURE__*/_react.default.createElement("div", {
|
|
219
157
|
key: "bottom-blank",
|
|
220
158
|
className: (0, _classnames.default)(_styles.Classes.virtualBlank, 'bottom'),
|
|
221
159
|
style: {
|
|
222
160
|
height: bottomBlank
|
|
223
161
|
}
|
|
224
|
-
})));
|
|
162
|
+
}))));
|
|
225
163
|
};
|
|
226
|
-
|
|
227
164
|
_this.state = {
|
|
228
165
|
hasScroll: true,
|
|
229
166
|
hasScrollY: true,
|
|
@@ -239,44 +176,37 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
239
176
|
return _this;
|
|
240
177
|
}
|
|
241
178
|
/** @deprecated BaseTable.getDoms() 已经过时,请勿调用 */
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
(0, _createClass2.default)(BaseTable, [{
|
|
179
|
+
(0, _inherits2.default)(BaseTable, _React$Component);
|
|
180
|
+
return (0, _createClass2.default)(BaseTable, [{
|
|
245
181
|
key: "getDoms",
|
|
246
182
|
value: function getDoms() {
|
|
247
183
|
_utils2.console.warn('[kd-table] BaseTable.getDoms() 已经过时');
|
|
248
|
-
|
|
249
184
|
return this.domHelper;
|
|
250
185
|
}
|
|
251
186
|
/** 自定义滚动条宽度为table宽度,使滚动条滑块宽度相同 */
|
|
252
|
-
|
|
253
187
|
}, {
|
|
254
188
|
key: "updateStickyScroll",
|
|
255
189
|
value: function updateStickyScroll() {
|
|
256
190
|
var _a, _b;
|
|
257
|
-
|
|
258
191
|
var _this$domHelper = this.domHelper,
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
192
|
+
stickyScroll = _this$domHelper.stickyScroll,
|
|
193
|
+
artTable = _this$domHelper.artTable,
|
|
194
|
+
stickyScrollItem = _this$domHelper.stickyScrollItem;
|
|
262
195
|
var _lastHasScrollY = this.hasScrollY;
|
|
263
|
-
|
|
264
196
|
if (!artTable) {
|
|
265
197
|
return;
|
|
266
198
|
}
|
|
267
|
-
|
|
268
199
|
var tableBodyHtmlTable = this.domHelper.getTableBodyHtmlTable();
|
|
269
200
|
var innerTableWidth = tableBodyHtmlTable.offsetWidth;
|
|
270
201
|
var artTableWidth = artTable.offsetWidth;
|
|
271
|
-
var artTableHeight = artTable.offsetHeight;
|
|
272
|
-
|
|
202
|
+
var artTableHeight = artTable.offsetHeight;
|
|
203
|
+
// 表格隐藏后,不需要对表格的滚动条做额外的逻辑处理
|
|
273
204
|
if (artTableWidth === 0 && artTableHeight === 0) return;
|
|
274
205
|
var stickyScrollHeightProp = this.props.stickyScrollHeight;
|
|
275
|
-
var stickyScrollHeight = stickyScrollHeightProp === 'auto' ? this.getScrollBarWidth() : stickyScrollHeightProp;
|
|
206
|
+
var stickyScrollHeight = stickyScrollHeightProp === 'auto' ? this.getScrollBarWidth() : stickyScrollHeightProp;
|
|
207
|
+
// stickyScroll.style.marginTop = `-${stickyScrollHeight + 1}px`
|
|
276
208
|
// 设置滚动条高度
|
|
277
|
-
|
|
278
209
|
stickyScroll.style.height = "".concat(stickyScrollHeight, "px");
|
|
279
|
-
|
|
280
210
|
if (artTableWidth >= innerTableWidth) {
|
|
281
211
|
if (this.state.hasScroll) {
|
|
282
212
|
this.setState({
|
|
@@ -291,7 +221,6 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
291
221
|
});
|
|
292
222
|
}
|
|
293
223
|
}
|
|
294
|
-
|
|
295
224
|
if (this.domHelper.virtual.offsetHeight > this.domHelper.tableBody.offsetHeight) {
|
|
296
225
|
// if (!this.state.hasScroll) {
|
|
297
226
|
// this.setState({
|
|
@@ -306,34 +235,30 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
306
235
|
// })
|
|
307
236
|
this.hasScrollY = false;
|
|
308
237
|
}
|
|
309
|
-
|
|
310
238
|
if (_lastHasScrollY !== this.hasScrollY) {
|
|
311
239
|
(_b = (_a = this.props).setTableWidth) === null || _b === void 0 ? void 0 : _b.call(_a, this.domHelper.tableBody.clientWidth);
|
|
312
240
|
}
|
|
313
|
-
|
|
314
241
|
var _this$lastInfo = this.lastInfo,
|
|
315
|
-
|
|
316
|
-
|
|
242
|
+
leftLockTotalWidth = _this$lastInfo.leftLockTotalWidth,
|
|
243
|
+
rightLockTotalWidth = _this$lastInfo.rightLockTotalWidth;
|
|
317
244
|
var lockTotalWidth = leftLockTotalWidth + rightLockTotalWidth;
|
|
318
|
-
var stickyRightOffset = this.hasScrollY ? this.getScrollBarWidth() : 0;
|
|
319
|
-
|
|
245
|
+
var stickyRightOffset = this.hasScrollY ? this.getScrollBarWidth() : 0;
|
|
246
|
+
// 设置子节点宽度
|
|
320
247
|
stickyScrollItem.style.width = "".concat(innerTableWidth - lockTotalWidth + stickyRightOffset, "px");
|
|
321
248
|
}
|
|
322
249
|
}, {
|
|
323
250
|
key: "renderTableHeader",
|
|
324
251
|
value: function renderTableHeader(info) {
|
|
325
252
|
var _this$props3 = this.props,
|
|
326
|
-
|
|
327
|
-
|
|
253
|
+
stickyTop = _this$props3.stickyTop,
|
|
254
|
+
hasHeader = _this$props3.hasHeader;
|
|
328
255
|
var renderHeader = (0, _renderTemplates.default)('header');
|
|
329
256
|
var stickyRightOffset = this.hasScrollY ? this.getScrollBarWidth() : 0;
|
|
330
|
-
|
|
331
257
|
if (typeof renderHeader === 'function') {
|
|
332
258
|
return renderHeader(info, this.props, {
|
|
333
259
|
stickyRightOffset: stickyRightOffset
|
|
334
260
|
});
|
|
335
261
|
}
|
|
336
|
-
|
|
337
262
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
338
263
|
className: (0, _classnames.default)(_styles.Classes.tableHeader, 'no-scrollbar'),
|
|
339
264
|
style: {
|
|
@@ -367,29 +292,23 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
367
292
|
this.syncHorizontalScroll(this.domHelper.virtual.scrollLeft);
|
|
368
293
|
}
|
|
369
294
|
/** 同步横向滚动偏移量 */
|
|
370
|
-
|
|
371
295
|
}, {
|
|
372
296
|
key: "syncHorizontalScroll",
|
|
373
297
|
value: function syncHorizontalScroll(x) {
|
|
374
298
|
this.updateOffsetX(x);
|
|
375
299
|
var flat = (0, _flat.default)(this.lastInfo);
|
|
376
300
|
var leftLockShadow = this.domHelper.getLeftLockShadow();
|
|
377
|
-
|
|
378
301
|
if (leftLockShadow) {
|
|
379
302
|
var shouldShowLeftLockShadow = flat.left.length > 0 && this.state.needRenderLock && x > 0;
|
|
380
|
-
|
|
381
303
|
if (shouldShowLeftLockShadow) {
|
|
382
304
|
leftLockShadow.classList.add('show-shadow');
|
|
383
305
|
} else {
|
|
384
306
|
leftLockShadow.classList.remove('show-shadow');
|
|
385
307
|
}
|
|
386
308
|
}
|
|
387
|
-
|
|
388
309
|
var rightLockShadow = this.domHelper.getRightLockShadow();
|
|
389
|
-
|
|
390
310
|
if (rightLockShadow) {
|
|
391
311
|
var shouldShowRightLockShadow = flat.right.length > 0 && this.state.needRenderLock && x < this.domHelper.virtual.scrollWidth - this.domHelper.virtual.clientWidth;
|
|
392
|
-
|
|
393
312
|
if (shouldShowRightLockShadow) {
|
|
394
313
|
rightLockShadow.classList.add('show-shadow');
|
|
395
314
|
} else {
|
|
@@ -402,10 +321,9 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
402
321
|
value: function getVerticalRenderRange(useVirtual) {
|
|
403
322
|
var dataSource = this.props.dataSource;
|
|
404
323
|
var _this$state = this.state,
|
|
405
|
-
|
|
406
|
-
|
|
324
|
+
offsetY = _this$state.offsetY,
|
|
325
|
+
maxRenderHeight = _this$state.maxRenderHeight;
|
|
407
326
|
var rowCount = dataSource.length;
|
|
408
|
-
|
|
409
327
|
if (useVirtual.vertical) {
|
|
410
328
|
return this.rowHeightManager.getRenderRange(offsetY, maxRenderHeight, rowCount);
|
|
411
329
|
} else {
|
|
@@ -417,14 +335,13 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
417
335
|
value: function renderTableFooter(info) {
|
|
418
336
|
// console.log('render footer')
|
|
419
337
|
var _this$props4 = this.props,
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
338
|
+
_this$props4$footerDa = _this$props4.footerDataSource,
|
|
339
|
+
footerDataSource = _this$props4$footerDa === void 0 ? [] : _this$props4$footerDa,
|
|
340
|
+
getRowProps = _this$props4.getRowProps,
|
|
341
|
+
primaryKey = _this$props4.primaryKey,
|
|
342
|
+
stickyBottom = _this$props4.stickyBottom;
|
|
425
343
|
var stickyRightOffset = this.hasScrollY ? this.getScrollBarWidth() : 0;
|
|
426
344
|
var renderFooter = (0, _renderTemplates.default)('footer');
|
|
427
|
-
|
|
428
345
|
if (typeof renderFooter === 'function') {
|
|
429
346
|
return renderFooter(info, this.props, {
|
|
430
347
|
rowProps: {
|
|
@@ -434,7 +351,6 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
434
351
|
stickyRightOffset: stickyRightOffset
|
|
435
352
|
});
|
|
436
353
|
}
|
|
437
|
-
|
|
438
354
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
439
355
|
className: (0, _classnames.default)(_styles.Classes.tableFooter, _styles.Classes.horizontalScrollContainer),
|
|
440
356
|
style: {
|
|
@@ -464,8 +380,8 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
464
380
|
}, {
|
|
465
381
|
key: "renderLockShadows",
|
|
466
382
|
value: function renderLockShadows(info) {
|
|
467
|
-
var stickyRightOffset = this.hasScrollY ? this.getScrollBarWidth() : 0;
|
|
468
|
-
|
|
383
|
+
var stickyRightOffset = this.hasScrollY ? this.getScrollBarWidth() : 0;
|
|
384
|
+
// console.log('render LockShadows')
|
|
469
385
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
470
386
|
className: _styles.Classes.lockShadowMask,
|
|
471
387
|
style: {
|
|
@@ -489,8 +405,8 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
489
405
|
value: function renderStickyScroll(info) {
|
|
490
406
|
// console.log('render stickyscroll')
|
|
491
407
|
var _this$props5 = this.props,
|
|
492
|
-
|
|
493
|
-
|
|
408
|
+
hasStickyScroll = _this$props5.hasStickyScroll,
|
|
409
|
+
stickyBottom = _this$props5.stickyBottom;
|
|
494
410
|
var hasScroll = this.state.hasScroll;
|
|
495
411
|
var isScroll = hasStickyScroll && hasScroll;
|
|
496
412
|
var stickyScrollContainerStyle = this.getStickyScrollContainerStyle();
|
|
@@ -528,8 +444,8 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
528
444
|
key: "getStickyScrollContainerStyle",
|
|
529
445
|
value: function getStickyScrollContainerStyle() {
|
|
530
446
|
var _this$props6 = this.props,
|
|
531
|
-
|
|
532
|
-
|
|
447
|
+
hasStickyScroll = _this$props6.hasStickyScroll,
|
|
448
|
+
stickyScrollHeight = _this$props6.stickyScrollHeight;
|
|
533
449
|
var hasScroll = this.state.hasScroll;
|
|
534
450
|
var isScroll = hasStickyScroll && hasScroll;
|
|
535
451
|
var height = stickyScrollHeight === 'auto' ? this.getScrollBarWidth() : stickyScrollHeight;
|
|
@@ -543,26 +459,24 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
543
459
|
}, {
|
|
544
460
|
key: "render",
|
|
545
461
|
value: function render() {
|
|
546
|
-
var _cx;
|
|
547
|
-
|
|
548
462
|
// console.log('render table')
|
|
549
463
|
var info = (0, _calculations.calculateRenderInfo)(this);
|
|
550
464
|
this.lastInfo = info;
|
|
551
465
|
var _this$props7 = this.props,
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
var artTableWrapperClassName = (0, _classnames.default)(_styles.Classes.artTableWrapper, (
|
|
466
|
+
dataSource = _this$props7.dataSource,
|
|
467
|
+
className = _this$props7.className,
|
|
468
|
+
style = _this$props7.style,
|
|
469
|
+
hasHeader = _this$props7.hasHeader,
|
|
470
|
+
useOuterBorder = _this$props7.useOuterBorder,
|
|
471
|
+
isStickyHead = _this$props7.isStickyHead,
|
|
472
|
+
isStickyHeader = _this$props7.isStickyHeader,
|
|
473
|
+
isStickyFooter = _this$props7.isStickyFooter,
|
|
474
|
+
isLoading = _this$props7.isLoading,
|
|
475
|
+
getTableProps = _this$props7.getTableProps,
|
|
476
|
+
footerDataSource = _this$props7.footerDataSource,
|
|
477
|
+
components = _this$props7.components,
|
|
478
|
+
bordered = _this$props7.bordered;
|
|
479
|
+
var artTableWrapperClassName = (0, _classnames.default)(_styles.Classes.artTableWrapper, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({
|
|
566
480
|
'use-outer-border': useOuterBorder,
|
|
567
481
|
empty: dataSource.length === 0,
|
|
568
482
|
lock: info.hasLockColumn,
|
|
@@ -570,7 +484,7 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
570
484
|
'sticky-header': isStickyHeader !== null && isStickyHeader !== void 0 ? isStickyHeader : isStickyHead,
|
|
571
485
|
'has-footer': footerDataSource.length > 0,
|
|
572
486
|
'sticky-footer': isStickyFooter
|
|
573
|
-
},
|
|
487
|
+
}, _styles.Classes.artTableBordered, bordered), 'ie-polyfill-wrapper', _utils2.browserType.isIE), 'sticky-polyfill-wrapper', (0, _utils2.isStickyUIDegrade)()), className);
|
|
574
488
|
var artTableWrapperProps = (0, _defineProperty2.default)({
|
|
575
489
|
className: artTableWrapperClassName,
|
|
576
490
|
style: style
|
|
@@ -588,18 +502,17 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
588
502
|
key: "componentDidMount",
|
|
589
503
|
value: function componentDidMount() {
|
|
590
504
|
var _a, _b, _c, _d, _e, _f;
|
|
591
|
-
|
|
592
505
|
this.rootSubscription = new _rxjs.Subscription();
|
|
593
506
|
this.resizeSubject = new _rxjs.Subject();
|
|
594
507
|
this.updateDOMHelper();
|
|
595
508
|
this.props$ = new _rxjs.BehaviorSubject(this.props);
|
|
596
509
|
this.initSubscriptions();
|
|
597
|
-
this.didMountOrUpdate();
|
|
598
|
-
|
|
510
|
+
this.didMountOrUpdate();
|
|
511
|
+
// console.log('did mount end')
|
|
599
512
|
var _this$props8 = this.props,
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
513
|
+
cssVariables = _this$props8.cssVariables,
|
|
514
|
+
enableCSSVariables = _this$props8.enableCSSVariables,
|
|
515
|
+
bordered = _this$props8.bordered;
|
|
603
516
|
(0, _utils.cssPolifill)({
|
|
604
517
|
variables: cssVariables || {},
|
|
605
518
|
enableCSSVariables: enableCSSVariables,
|
|
@@ -612,14 +525,12 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
612
525
|
}, {
|
|
613
526
|
key: "componentDidUpdate",
|
|
614
527
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
615
|
-
var _a;
|
|
616
|
-
|
|
617
|
-
|
|
528
|
+
var _a;
|
|
529
|
+
// console.log('did update start')
|
|
618
530
|
var _this$props9 = this.props,
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
531
|
+
cssVariables = _this$props9.cssVariables,
|
|
532
|
+
enableCSSVariables = _this$props9.enableCSSVariables,
|
|
533
|
+
bordered = _this$props9.bordered;
|
|
623
534
|
if (!(0, _utils.shallowEqual)(prevProps === null || prevProps === void 0 ? void 0 : prevProps.cssVariables, (_a = this.props) === null || _a === void 0 ? void 0 : _a.cssVariables)) {
|
|
624
535
|
(0, _utils.cssPolifill)({
|
|
625
536
|
variables: cssVariables || {},
|
|
@@ -627,10 +538,10 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
627
538
|
bordered: bordered
|
|
628
539
|
});
|
|
629
540
|
}
|
|
630
|
-
|
|
631
541
|
this.updateDOMHelper();
|
|
632
542
|
this.props$.next(this.props);
|
|
633
|
-
this.didMountOrUpdate(prevProps, prevState);
|
|
543
|
+
this.didMountOrUpdate(prevProps, prevState);
|
|
544
|
+
// console.log('did update end')
|
|
634
545
|
}
|
|
635
546
|
}, {
|
|
636
547
|
key: "didMountOrUpdate",
|
|
@@ -649,11 +560,9 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
649
560
|
this.domHelper.stickyScroll.scrollLeft = 0;
|
|
650
561
|
}
|
|
651
562
|
}
|
|
652
|
-
|
|
653
563
|
if (prevProps != null) {
|
|
654
564
|
var prevHasFooter = prevProps.footerDataSource.length > 0;
|
|
655
565
|
var currentHasFooter = this.props.footerDataSource.length > 0;
|
|
656
|
-
|
|
657
566
|
if (!prevHasFooter && currentHasFooter) {
|
|
658
567
|
(0, _utils.getTableScrollFooterDOM)(this.domHelper).scrollLeft = this.domHelper.virtual.scrollLeft;
|
|
659
568
|
}
|
|
@@ -663,64 +572,55 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
663
572
|
key: "initSubscriptions",
|
|
664
573
|
value: function initSubscriptions() {
|
|
665
574
|
var _this2 = this;
|
|
666
|
-
|
|
667
575
|
var _this$domHelper2 = this.domHelper,
|
|
668
|
-
|
|
669
|
-
|
|
576
|
+
virtual = _this$domHelper2.virtual,
|
|
577
|
+
stickyScroll = _this$domHelper2.stickyScroll;
|
|
670
578
|
this.rootSubscription.add(_utils.throttledWindowResize$.subscribe(function () {
|
|
671
579
|
_this2.updateStickyScroll();
|
|
672
|
-
|
|
673
580
|
_this2.adjustNeedRenderLock();
|
|
674
581
|
}));
|
|
675
582
|
this.resizeSubject.pipe(op.debounceTime(100)).subscribe(function () {
|
|
676
583
|
var _a, _b;
|
|
677
|
-
|
|
678
584
|
(_b = (_a = _this2.props).setTableWidth) === null || _b === void 0 ? void 0 : _b.call(_a, _this2.domHelper.tableBody.clientWidth);
|
|
679
585
|
});
|
|
680
|
-
|
|
681
586
|
var handleTableWrapperResize = function handleTableWrapperResize() {
|
|
682
587
|
_this2.resizeSubject.next();
|
|
683
588
|
};
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
589
|
+
this.resizeObserver = (0, _utils.addResizeObserver)(this.domHelper.artTableWrapper, handleTableWrapperResize);
|
|
590
|
+
// 滚动同步
|
|
687
591
|
this.rootSubscription.add((0, _utils.syncScrollLeft)([(0, _utils.getTableScrollHeaderDOM)(this.domHelper), virtual, (0, _utils.getTableScrollFooterDOM)(this.domHelper), stickyScroll], function (scrollLeft) {
|
|
688
592
|
_this2.syncHorizontalScroll(scrollLeft);
|
|
689
593
|
}));
|
|
690
|
-
var richVisibleRects$ = (0, _getRichVisibleRectsStream.getRichVisibleRectsStream)(this.domHelper.virtual, this.props$.pipe(op.skip(1), op.mapTo('structure-may-change')), this.props.virtualDebugLabel).pipe(op.shareReplay());
|
|
691
|
-
|
|
692
|
-
this.rootSubscription.add((0, _rxjs.combineLatest)([richVisibleRects$.pipe(op.
|
|
594
|
+
var richVisibleRects$ = (0, _getRichVisibleRectsStream.getRichVisibleRectsStream)(this.domHelper.virtual, this.props$.pipe(op.skip(1), op.mapTo('structure-may-change')), this.props.virtualDebugLabel).pipe(op.shareReplay());
|
|
595
|
+
// 每当可见部分发生变化的时候,调整 loading icon 的未知(如果 loading icon 存在的话)
|
|
596
|
+
this.rootSubscription.add((0, _rxjs.combineLatest)([richVisibleRects$.pipe(_mapInstanceProperty2(op).call(op, function (p) {
|
|
693
597
|
return p.clipRect;
|
|
694
|
-
}), op.distinctUntilChanged(_utils.shallowEqual)), this.props$.pipe(op.startWith(null), op.pairwise(), op.
|
|
598
|
+
}), op.distinctUntilChanged(_utils.shallowEqual)), this.props$.pipe(op.startWith(null), op.pairwise(), _filterInstanceProperty(op).call(op, function (_ref) {
|
|
695
599
|
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
600
|
+
prevProps = _ref2[0],
|
|
601
|
+
props = _ref2[1];
|
|
699
602
|
return prevProps == null || !prevProps.isLoading && props.isLoading;
|
|
700
603
|
}))]).subscribe(function (_ref3) {
|
|
701
604
|
var _ref4 = (0, _slicedToArray2.default)(_ref3, 1),
|
|
702
|
-
|
|
703
|
-
|
|
605
|
+
clipRect = _ref4[0];
|
|
704
606
|
var loadingIndicator = _this2.domHelper.getLoadingIndicator();
|
|
705
|
-
|
|
706
607
|
if (!loadingIndicator) {
|
|
707
608
|
return;
|
|
708
609
|
}
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
610
|
+
var height = clipRect.bottom - clipRect.top;
|
|
611
|
+
// fixme 这里的定位在有些特殊情况下可能会出错 see #132
|
|
712
612
|
loadingIndicator.style.top = "".concat(height / 2, "px");
|
|
713
613
|
loadingIndicator.style.marginTop = "".concat(height / 2, "px");
|
|
714
|
-
}));
|
|
715
|
-
|
|
716
|
-
this.rootSubscription.add(richVisibleRects$.pipe(op.
|
|
614
|
+
}));
|
|
615
|
+
// 每当可见部分发生变化的时候,如果开启了虚拟滚动,则重新触发 render
|
|
616
|
+
this.rootSubscription.add(richVisibleRects$.pipe(_filterInstanceProperty(op).call(op, function () {
|
|
717
617
|
var _this2$lastInfo$useVi = _this2.lastInfo.useVirtual,
|
|
718
|
-
|
|
719
|
-
|
|
618
|
+
horizontal = _this2$lastInfo$useVi.horizontal,
|
|
619
|
+
vertical = _this2$lastInfo$useVi.vertical;
|
|
720
620
|
return horizontal || vertical;
|
|
721
|
-
}), op.
|
|
621
|
+
}), _mapInstanceProperty2(op).call(op, function (_ref5) {
|
|
722
622
|
var clipRect = _ref5.clipRect,
|
|
723
|
-
|
|
623
|
+
offsetY = _ref5.offsetY;
|
|
724
624
|
return {
|
|
725
625
|
maxRenderHeight: clipRect.bottom - clipRect.top,
|
|
726
626
|
maxRenderWidth: clipRect.right - clipRect.left,
|
|
@@ -730,16 +630,15 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
730
630
|
// 如果表格区域被隐藏, 不需要触发组件重渲染
|
|
731
631
|
if (y.maxRenderHeight === 0 && y.maxRenderWidth === 0) {
|
|
732
632
|
return true;
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
|
|
633
|
+
}
|
|
634
|
+
// 因为 overscan 的存在,滚动较小的距离时不需要触发组件重渲染
|
|
736
635
|
return Math.abs(x.maxRenderWidth - y.maxRenderWidth) < _utils.OVERSCAN_SIZE / 2 && Math.abs(x.maxRenderHeight - y.maxRenderHeight) < _utils.OVERSCAN_SIZE / 2 && Math.abs(x.offsetY - y.offsetY) < _utils.OVERSCAN_SIZE / 2;
|
|
737
636
|
})).subscribe(function (sizeAndOffset) {
|
|
738
637
|
_this2.setState(sizeAndOffset);
|
|
739
638
|
}));
|
|
740
|
-
this.rootSubscription.add(richVisibleRects$.pipe(op.
|
|
639
|
+
this.rootSubscription.add(richVisibleRects$.pipe(_mapInstanceProperty2(op).call(op, function (_ref6) {
|
|
741
640
|
var clipRect = _ref6.clipRect,
|
|
742
|
-
|
|
641
|
+
offsetY = _ref6.offsetY;
|
|
743
642
|
return {
|
|
744
643
|
maxRenderHeight: clipRect.bottom - clipRect.top,
|
|
745
644
|
maxRenderWidth: clipRect.right - clipRect.left,
|
|
@@ -747,20 +646,18 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
747
646
|
};
|
|
748
647
|
}), op.distinctUntilChanged(function (x, y) {
|
|
749
648
|
return x.offsetY - y.offsetY === 0;
|
|
750
|
-
}),
|
|
751
|
-
|
|
649
|
+
}),
|
|
650
|
+
// 计算得到当前行索引对应的数据块,blocks改成数组的形式,兼容快速拖动可视区域出现两个数据块的情况
|
|
651
|
+
_mapInstanceProperty2(op).call(op, function (sizeAndOffset) {
|
|
752
652
|
var _a;
|
|
753
|
-
|
|
754
653
|
var offsetY = sizeAndOffset.offsetY,
|
|
755
|
-
|
|
654
|
+
maxRenderHeight = sizeAndOffset.maxRenderHeight;
|
|
756
655
|
var scrollDirection = offsetY - _this2.offsetY >= 0 ? 'down' : 'up';
|
|
757
656
|
_this2.offsetY = offsetY;
|
|
758
657
|
var rowCount = _this2.props.dataSource.length;
|
|
759
|
-
|
|
760
658
|
var vertical = _this2.rowHeightManager.getRenderRange(offsetY, maxRenderHeight, rowCount);
|
|
761
|
-
|
|
762
659
|
var topIndex = vertical.topIndex,
|
|
763
|
-
|
|
660
|
+
bottomIndex = vertical.bottomIndex;
|
|
764
661
|
var blockSize = ((_a = _this2.props.scrollLoad) === null || _a === void 0 ? void 0 : _a.blockSize) || 200;
|
|
765
662
|
var topBlockStartIndex = Math.floor(Math.max(topIndex - 1, 0) / blockSize) * blockSize;
|
|
766
663
|
var bottomBlockStartIndex = Math.floor((bottomIndex + 1) / blockSize) * blockSize;
|
|
@@ -769,13 +666,13 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
769
666
|
return x[0] === y[0] && x[1] === y[1];
|
|
770
667
|
}), op.switchMap(function (startIndexs) {
|
|
771
668
|
var event$ = (0, _rxjs.from)(startIndexs);
|
|
772
|
-
return event$.pipe(op.
|
|
669
|
+
return event$.pipe(_mapInstanceProperty2(op).call(op, function (startIndex) {
|
|
773
670
|
return startIndex;
|
|
774
671
|
}));
|
|
775
|
-
}),
|
|
672
|
+
}),
|
|
673
|
+
// 过滤掉重复掉值
|
|
776
674
|
op.distinctUntilChanged()).subscribe(function (startIndex) {
|
|
777
675
|
var _a;
|
|
778
|
-
|
|
779
676
|
(_a = _this2.props.scrollLoad) === null || _a === void 0 ? void 0 : _a.callback(startIndex);
|
|
780
677
|
}));
|
|
781
678
|
}
|
|
@@ -783,13 +680,11 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
783
680
|
key: "componentWillUnmount",
|
|
784
681
|
value: function componentWillUnmount() {
|
|
785
682
|
var _a;
|
|
786
|
-
|
|
787
683
|
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
788
684
|
this.rootSubscription.unsubscribe();
|
|
789
685
|
this.resizeSubject.unsubscribe();
|
|
790
686
|
}
|
|
791
687
|
/** 更新 DOM 节点的引用,方便其他方法直接操作 DOM */
|
|
792
|
-
|
|
793
688
|
}, {
|
|
794
689
|
key: "updateDOMHelper",
|
|
795
690
|
value: function updateDOMHelper() {
|
|
@@ -799,51 +694,42 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
799
694
|
key: "updateRowHeightManager",
|
|
800
695
|
value: function updateRowHeightManager() {
|
|
801
696
|
var _a;
|
|
802
|
-
|
|
803
697
|
var virtualTop = this.domHelper.getVirtualTop();
|
|
804
698
|
var virtualTopHeight = (_a = virtualTop === null || virtualTop === void 0 ? void 0 : virtualTop.clientHeight) !== null && _a !== void 0 ? _a : 0;
|
|
805
699
|
var maxTrRowIndex = -1;
|
|
806
700
|
var maxTrBottom = -1;
|
|
807
701
|
var zeroHeightRowCount = 0;
|
|
808
|
-
|
|
809
702
|
var _iterator = _createForOfIteratorHelper(this.domHelper.getTableRows()),
|
|
810
|
-
|
|
811
|
-
|
|
703
|
+
_step;
|
|
812
704
|
try {
|
|
813
705
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
814
706
|
var tr = _step.value;
|
|
815
707
|
var rowIndex = Number(tr.dataset.rowindex);
|
|
816
|
-
|
|
817
708
|
if (isNaN(rowIndex)) {
|
|
818
709
|
continue;
|
|
819
710
|
}
|
|
820
|
-
|
|
821
711
|
maxTrRowIndex = Math.max(maxTrRowIndex, rowIndex);
|
|
822
712
|
var offset = tr.offsetTop + virtualTopHeight;
|
|
823
713
|
var size = tr.offsetHeight;
|
|
824
|
-
|
|
825
714
|
if (size === 0) {
|
|
826
715
|
zeroHeightRowCount += 1;
|
|
827
716
|
} else {
|
|
828
717
|
// 渲染出来的行高度为0,说明是display=none情况,行高不存在该种异常情况,不保存当前的高度
|
|
829
718
|
this.rowHeightManager.updateRow(rowIndex, offset, size);
|
|
830
719
|
}
|
|
831
|
-
|
|
832
720
|
maxTrBottom = Math.max(maxTrBottom, offset + size);
|
|
833
|
-
}
|
|
721
|
+
}
|
|
722
|
+
// 当 estimatedRowHeight 过大时,可能出现「渲染行数过少,无法覆盖可视范围」的情况
|
|
834
723
|
// 出现这种情况时,我们判断「下一次渲染能够渲染更多行」是否满足,满足的话就直接调用 forceUpdate
|
|
835
724
|
// zeroHeightRowCount === 0 用于确保当前没有 display=none 的情况
|
|
836
|
-
|
|
837
725
|
} catch (err) {
|
|
838
726
|
_iterator.e(err);
|
|
839
727
|
} finally {
|
|
840
728
|
_iterator.f();
|
|
841
729
|
}
|
|
842
|
-
|
|
843
730
|
if (maxTrRowIndex !== -1 && zeroHeightRowCount === 0) {
|
|
844
731
|
if (maxTrBottom < this.state.offsetY + this.state.maxRenderHeight) {
|
|
845
732
|
var vertical = this.getVerticalRenderRange(this.lastInfo.useVirtual);
|
|
846
|
-
|
|
847
733
|
if (vertical.bottomIndex - 1 > maxTrRowIndex) {
|
|
848
734
|
this.forceUpdate();
|
|
849
735
|
}
|
|
@@ -851,23 +737,19 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
851
737
|
}
|
|
852
738
|
}
|
|
853
739
|
/** 计算表格所有列的渲染宽度之和,判断表格是否需要渲染锁列 */
|
|
854
|
-
|
|
855
740
|
}, {
|
|
856
741
|
key: "adjustNeedRenderLock",
|
|
857
742
|
value: function adjustNeedRenderLock() {
|
|
858
743
|
var needRenderLock = this.state.needRenderLock;
|
|
859
744
|
var _this$lastInfo2 = this.lastInfo,
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
745
|
+
flat = (0, _flat.default)(_this$lastInfo2),
|
|
746
|
+
hasLockColumn = _this$lastInfo2.hasLockColumn;
|
|
863
747
|
if (hasLockColumn) {
|
|
864
748
|
var _context;
|
|
865
|
-
|
|
866
749
|
var sumOfColWidth = (0, _utils.sum)((0, _map.default)(_context = flat.full).call(_context, function (col) {
|
|
867
750
|
return col.width;
|
|
868
751
|
}));
|
|
869
752
|
var nextNeedRenderLock = sumOfColWidth > this.domHelper.artTable.clientWidth;
|
|
870
|
-
|
|
871
753
|
if (needRenderLock !== nextNeedRenderLock) {
|
|
872
754
|
this.setState({
|
|
873
755
|
needRenderLock: nextNeedRenderLock
|
|
@@ -882,10 +764,7 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
882
764
|
}
|
|
883
765
|
}
|
|
884
766
|
}]);
|
|
885
|
-
return BaseTable;
|
|
886
767
|
}(_react.default.Component);
|
|
887
|
-
|
|
888
|
-
exports.BaseTable = BaseTable;
|
|
889
768
|
BaseTable.defaultProps = {
|
|
890
769
|
hasHeader: true,
|
|
891
770
|
isStickyHeader: true,
|