@dtjoy/dt-design 1.1.2 → 1.1.5
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/README.md +161 -141
- package/dist/dt-design.min.css +1 -0
- package/dist/dt-design.min.js +1 -0
- package/es/_util/context/createContextSelector.d.ts +28 -0
- package/es/_util/context/createContextSelector.js +110 -0
- package/es/_util/context/immutable.d.ts +10 -0
- package/es/_util/context/immutable.js +84 -0
- package/es/_util/context/index.d.ts +3 -0
- package/es/_util/context/index.js +3 -0
- package/es/_util/easings.d.ts +1 -0
- package/es/_util/gapSize.d.ts +3 -0
- package/es/_util/getScroll.d.ts +3 -0
- package/{esm → es}/_util/getScroll.js +1 -1
- package/es/_util/hooks/index.d.ts +11 -0
- package/es/_util/hooks/index.js +11 -0
- package/es/_util/hooks/useBreakpoint.d.ts +5 -0
- package/es/_util/hooks/useBreakpoint.js +75 -0
- package/es/_util/hooks/useCssVar.d.ts +3 -0
- package/es/_util/hooks/useCssVar.js +28 -0
- package/es/_util/hooks/useEvent.d.ts +1 -0
- package/es/_util/hooks/useEvent.js +1 -0
- package/es/_util/hooks/useForceUpdate.d.ts +2 -0
- package/es/_util/hooks/useLayoutEffect.d.ts +1 -0
- package/es/_util/hooks/useLayoutEffect.js +1 -0
- package/es/_util/hooks/useMultipleSelect.d.ts +2 -0
- package/es/_util/hooks/useMultipleSelect.js +37 -0
- package/es/_util/hooks/useOrientation.d.ts +2 -0
- package/es/_util/hooks/useProxyImperativeHandle.d.ts +4 -0
- package/{esm → es}/_util/hooks/useProxyImperativeHandle.js +10 -3
- package/es/_util/hooks/useSyncState.d.ts +3 -0
- package/es/_util/hooks/useTimeoutLock.d.ts +1 -0
- package/es/_util/hooks/useTimeoutLock.js +26 -0
- package/es/_util/index.d.ts +11 -0
- package/{esm → es}/_util/index.js +9 -1
- package/es/_util/is.d.ts +5 -0
- package/es/_util/is.js +16 -0
- package/es/_util/rcUtil.d.ts +17 -0
- package/es/_util/rcUtil.js +58 -0
- package/es/_util/scrollTo.d.ts +10 -0
- package/{esm → es}/_util/scrollTo.js +1 -1
- package/es/_util/scrollbar.d.ts +1 -0
- package/es/_util/scrollbar.js +32 -0
- package/es/_util/type.d.ts +53 -0
- package/es/_util/validate.d.ts +2 -0
- package/es/_util/validate.js +10 -0
- package/es/_util/warning.d.ts +31 -0
- package/{esm → es}/_util/warning.js +5 -6
- package/es/block-header/index.d.ts +58 -0
- package/{esm/blockHeader → es/block-header}/index.js +1 -1
- package/es/block-header/style/index.d.ts +2 -0
- package/{lib/blockHeader → es/block-header}/style/index.less +167 -143
- package/es/button/index.d.ts +10 -0
- package/{esm → es}/button/index.js +16 -4
- package/es/button/style/index.d.ts +2 -0
- package/{esm → es}/button/style/index.less +62 -59
- package/{esm → es}/button/style/mixin.less +40 -39
- package/es/collapsible/index.d.ts +102 -0
- package/{esm → es}/collapsible/index.js +3 -2
- package/es/collapsible/style/index.d.ts +1 -0
- package/{esm → es}/collapsible/style/index.less +24 -24
- package/es/collapsible-action-items/index.d.ts +24 -0
- package/{esm/collapsibleActionItems → es/collapsible-action-items}/index.js +21 -19
- package/es/collapsible-action-items/style/index.d.ts +2 -0
- package/{lib/collapsibleActionItems → es/collapsible-action-items}/style/index.less +7 -7
- package/es/flex/index.d.ts +7 -0
- package/{esm → es}/flex/index.js +3 -3
- package/es/flex/interface.d.ts +16 -0
- package/es/flex/style/index.d.ts +2 -0
- package/{esm → es}/flex/style/index.less +80 -76
- package/es/flex/utils.d.ts +7 -0
- package/es/form-list/index.d.ts +87 -0
- package/{esm/formList → es/form-list}/index.js +18 -8
- package/es/form-list/style/index.d.ts +2 -0
- package/{esm/formList → es/form-list}/style/index.less +45 -45
- package/es/index.d.ts +26 -0
- package/es/index.js +21 -0
- package/es/overflow-list/index.d.ts +43 -0
- package/{esm/overflowList → es/overflow-list}/index.js +37 -9
- package/es/overflow-list/style/index.d.ts +2 -0
- package/{esm/overflowList → es/overflow-list}/style/index.less +9 -9
- package/es/resize/index.d.ts +9 -0
- package/es/resize-observer/index.d.ts +45 -0
- package/{esm/resizeObserver → es/resize-observer}/index.js +8 -8
- package/es/splitter/Panel.d.ts +7 -0
- package/{esm → es}/splitter/Panel.js +12 -4
- package/es/splitter/SplitBar.d.ts +28 -0
- package/{esm → es}/splitter/SplitBar.js +82 -80
- package/es/splitter/Splitter.d.ts +5 -0
- package/{esm → es}/splitter/Splitter.js +52 -23
- package/es/splitter/hooks/sizeUtil.d.ts +3 -0
- package/{esm → es}/splitter/hooks/sizeUtil.js +1 -1
- package/es/splitter/hooks/useDragListeners.d.ts +14 -0
- package/es/splitter/hooks/useDragListeners.js +107 -0
- package/es/splitter/hooks/useItems.d.ts +20 -0
- package/es/splitter/hooks/useOrientation.d.ts +2 -0
- package/es/splitter/hooks/useOrientation.js +6 -0
- package/es/splitter/hooks/useResizable.d.ts +13 -0
- package/{esm → es}/splitter/hooks/useResizable.js +5 -2
- package/es/splitter/hooks/useResize.d.ts +6 -0
- package/{esm → es}/splitter/hooks/useResize.js +10 -3
- package/es/splitter/hooks/useSizes.d.ts +4 -0
- package/{esm → es}/splitter/hooks/useSizes.js +5 -6
- package/es/splitter/index.d.ts +9 -0
- package/es/splitter/interface.d.ts +45 -0
- package/es/splitter/style/index.d.ts +2 -0
- package/es/splitter/style/index.less +349 -0
- package/es/status-tag/index.d.ts +29 -0
- package/{esm/statusTag → es/status-tag}/index.js +1 -1
- package/es/status-tag/style/index.d.ts +2 -0
- package/{lib/statusTag → es/status-tag}/style/index.less +70 -70
- package/{esm/statusTag → es/status-tag}/style/mixin.less +48 -39
- package/es/style/index.d.ts +1 -0
- package/{esm → es}/style/index.less +1 -1
- package/es/style/themes/index.less +2 -0
- package/{esm → es}/style/themes/variable.less +5 -5
- package/es/table/Column.d.ts +2 -0
- package/es/table/Column.js +1 -0
- package/es/table/ColumnGroup.d.ts +2 -0
- package/es/table/ColumnGroup.js +1 -0
- package/es/table/InternalTable.d.ts +43 -0
- package/es/table/InternalTable.js +816 -0
- package/es/table/Table.d.ts +19 -0
- package/es/table/Table.js +30 -0
- package/es/table/TableMeasureRowContext.d.ts +3 -0
- package/es/table/TableMeasureRowContext.js +3 -0
- package/es/table/components/Body/BodyRow.d.ts +37 -0
- package/es/table/components/Body/BodyRow.js +182 -0
- package/es/table/components/Body/ExpandedRow.d.ts +15 -0
- package/es/table/components/Body/ExpandedRow.js +51 -0
- package/es/table/components/Body/MeasureCell.d.ts +8 -0
- package/es/table/components/Body/MeasureCell.js +33 -0
- package/es/table/components/Body/MeasureRow.d.ts +10 -0
- package/es/table/components/Body/MeasureRow.js +54 -0
- package/es/table/components/Body/index.d.ts +11 -0
- package/es/table/components/Body/index.js +123 -0
- package/es/table/components/Cell/index.d.ts +39 -0
- package/es/table/components/Cell/index.js +196 -0
- package/es/table/components/Cell/useCellRender.d.ts +3 -0
- package/es/table/components/Cell/useCellRender.js +69 -0
- package/es/table/components/Cell/useHoverState.d.ts +2 -0
- package/es/table/components/Cell/useHoverState.js +13 -0
- package/es/table/components/ColGroup.d.ts +9 -0
- package/es/table/components/ColGroup.js +53 -0
- package/es/table/components/ExpandIcon.d.ts +12 -0
- package/es/table/components/ExpandIcon.js +27 -0
- package/es/table/components/FixedHolder/index.d.ts +27 -0
- package/es/table/components/FixedHolder/index.js +186 -0
- package/es/table/components/Footer/Cell.d.ts +11 -0
- package/es/table/components/Footer/Cell.js +47 -0
- package/es/table/components/Footer/Row.d.ts +8 -0
- package/es/table/components/Footer/Row.js +10 -0
- package/es/table/components/Footer/Summary.d.ts +14 -0
- package/es/table/components/Footer/Summary.js +12 -0
- package/es/table/components/Footer/SummaryContext.d.ts +11 -0
- package/es/table/components/Footer/SummaryContext.js +3 -0
- package/es/table/components/Footer/index.d.ts +16 -0
- package/es/table/components/Footer/index.js +31 -0
- package/es/table/components/Header/Header.d.ts +10 -0
- package/es/table/components/Header/Header.js +110 -0
- package/es/table/components/Header/HeaderRow.d.ts +19 -0
- package/es/table/components/Header/HeaderRow.js +63 -0
- package/es/table/components/Panel.d.ts +7 -0
- package/es/table/components/Panel.js +11 -0
- package/es/table/components/RcTable.d.ts +114 -0
- package/es/table/components/RcTable.js +757 -0
- package/es/table/components/VirtualTable.d.ts +5 -0
- package/es/table/components/VirtualTable.js +12 -0
- package/es/table/components/VirtualTableBody/BodyGrid.d.ts +13 -0
- package/es/table/components/VirtualTableBody/BodyGrid.js +307 -0
- package/es/table/components/VirtualTableBody/BodyLine.d.ts +14 -0
- package/es/table/components/VirtualTableBody/BodyLine.js +116 -0
- package/es/table/components/VirtualTableBody/VirtualCell.d.ts +26 -0
- package/es/table/components/VirtualTableBody/VirtualCell.js +118 -0
- package/es/table/components/VirtualTableBody/context.d.ts +13 -0
- package/es/table/components/VirtualTableBody/context.js +3 -0
- package/es/table/components/VirtualTableBody/index.d.ts +16 -0
- package/es/table/components/VirtualTableBody/index.js +102 -0
- package/es/table/constant.d.ts +2 -0
- package/es/table/constant.js +2 -0
- package/es/table/features/columns/Column.d.ts +7 -0
- package/es/table/features/columns/Column.js +4 -0
- package/es/table/features/columns/ColumnGroup.d.ts +9 -0
- package/es/table/features/columns/ColumnGroup.js +4 -0
- package/es/table/features/columns/index.d.ts +8 -0
- package/es/table/features/columns/index.js +6 -0
- package/es/table/features/columns/useColumns.d.ts +31 -0
- package/es/table/features/columns/useColumns.js +227 -0
- package/es/table/features/columns/useFilledColumns.d.ts +4 -0
- package/es/table/features/columns/useFilledColumns.js +34 -0
- package/es/table/features/columns/useTitleColumns.d.ts +4 -0
- package/es/table/features/columns/useTitleColumns.js +26 -0
- package/es/table/features/columns/useWidthColumns.d.ts +5 -0
- package/es/table/features/columns/useWidthColumns.js +75 -0
- package/es/table/features/editable/BatchEditModal.d.ts +4 -0
- package/es/table/features/editable/BatchEditModal.js +786 -0
- package/es/table/features/editable/EditableCell.d.ts +42 -0
- package/es/table/features/editable/EditableCell.js +294 -0
- package/es/table/features/editable/EditableContext.d.ts +33 -0
- package/es/table/features/editable/EditableContext.js +20 -0
- package/es/table/features/editable/batchEditTypes.d.ts +55 -0
- package/es/table/features/editable/batchEditTypes.js +1 -0
- package/es/table/features/editable/batchEditUtils.d.ts +44 -0
- package/es/table/features/editable/batchEditUtils.js +258 -0
- package/es/table/features/editable/builtinEditors.d.ts +32 -0
- package/es/table/features/editable/builtinEditors.js +165 -0
- package/es/table/features/editable/index.d.ts +11 -0
- package/es/table/features/editable/index.js +10 -0
- package/es/table/features/editable/useBatchRules.d.ts +17 -0
- package/es/table/features/editable/useBatchRules.js +96 -0
- package/es/table/features/editable/useEditable.d.ts +51 -0
- package/es/table/features/editable/useEditable.js +693 -0
- package/es/table/features/expand/expandUtil.d.ts +5 -0
- package/es/table/features/expand/expandUtil.js +47 -0
- package/es/table/features/expand/index.d.ts +2 -0
- package/es/table/features/expand/index.js +2 -0
- package/es/table/features/expand/useExpand.d.ts +10 -0
- package/es/table/features/expand/useExpand.js +90 -0
- package/es/table/features/filter/FilterDropdown.d.ts +31 -0
- package/es/table/features/filter/FilterDropdown.js +494 -0
- package/es/table/features/filter/FilterSearch.d.ts +12 -0
- package/es/table/features/filter/FilterSearch.js +24 -0
- package/es/table/features/filter/FilterWrapper.d.ts +8 -0
- package/es/table/features/filter/FilterWrapper.js +23 -0
- package/es/table/features/filter/index.d.ts +4 -0
- package/es/table/features/filter/index.js +4 -0
- package/es/table/features/filter/useFilter.d.ts +22 -0
- package/es/table/features/filter/useFilter.js +240 -0
- package/es/table/features/fixed/fixUtil.d.ts +21 -0
- package/es/table/features/fixed/fixUtil.js +69 -0
- package/es/table/features/fixed/index.d.ts +4 -0
- package/es/table/features/fixed/index.js +4 -0
- package/es/table/features/fixed/offsetUtil.d.ts +4 -0
- package/es/table/features/fixed/offsetUtil.js +13 -0
- package/es/table/features/fixed/useFixedInfo.d.ts +2 -0
- package/es/table/features/fixed/useFixedInfo.js +16 -0
- package/es/table/features/fixed/useStickyOffsets.d.ts +6 -0
- package/es/table/features/fixed/useStickyOffsets.js +29 -0
- package/es/table/features/hover/index.d.ts +1 -0
- package/es/table/features/hover/index.js +1 -0
- package/es/table/features/hover/useHover.d.ts +2 -0
- package/es/table/features/hover/useHover.js +22 -0
- package/es/table/features/pagination/index.d.ts +1 -0
- package/es/table/features/pagination/index.js +1 -0
- package/es/table/features/pagination/usePagination.d.ts +5 -0
- package/es/table/features/pagination/usePagination.js +89 -0
- package/es/table/features/resize/ResizeHandle.d.ts +22 -0
- package/es/table/features/resize/ResizeHandle.js +99 -0
- package/es/table/features/resize/index.d.ts +5 -0
- package/es/table/features/resize/index.js +3 -0
- package/es/table/features/resize/transformResizableColumns.d.ts +11 -0
- package/es/table/features/resize/transformResizableColumns.js +52 -0
- package/es/table/features/resize/useResize.d.ts +52 -0
- package/es/table/features/resize/useResize.js +586 -0
- package/es/table/features/selection/index.d.ts +1 -0
- package/es/table/features/selection/index.js +1 -0
- package/es/table/features/selection/useSelection.d.ts +20 -0
- package/es/table/features/selection/useSelection.js +579 -0
- package/es/table/features/sort/index.d.ts +1 -0
- package/es/table/features/sort/index.js +1 -0
- package/es/table/features/sort/useSorter.d.ts +21 -0
- package/es/table/features/sort/useSorter.js +372 -0
- package/es/table/features/sticky/index.d.ts +2 -0
- package/es/table/features/sticky/index.js +2 -0
- package/es/table/features/sticky/stickyScrollBar.d.ts +12 -0
- package/es/table/features/sticky/stickyScrollBar.js +203 -0
- package/es/table/features/sticky/useSticky.d.ts +10 -0
- package/es/table/features/sticky/useSticky.js +34 -0
- package/es/table/features/summary/index.d.ts +1 -0
- package/es/table/features/summary/index.js +1 -0
- package/es/table/features/virtual/index.d.ts +2 -0
- package/es/table/features/virtual/index.js +2 -0
- package/es/table/features/virtual/useFlattenRecords.d.ts +19 -0
- package/es/table/features/virtual/useFlattenRecords.js +55 -0
- package/es/table/features/virtual/useFrame.d.ts +7 -0
- package/es/table/features/virtual/useFrame.js +67 -0
- package/es/table/immutableHelper.d.ts +9 -0
- package/es/table/immutableHelper.js +36 -0
- package/es/table/index.d.ts +24 -0
- package/es/table/index.js +23 -0
- package/es/table/interface.d.ts +438 -0
- package/es/table/interface.js +56 -0
- package/es/table/shared/context/PerfContext.d.ts +6 -0
- package/es/table/shared/context/PerfContext.js +6 -0
- package/es/table/shared/context/TableContext.d.ts +51 -0
- package/es/table/shared/context/TableContext.js +8 -0
- package/es/table/shared/hooks/useContainerWidth.d.ts +1 -0
- package/es/table/shared/hooks/useContainerWidth.js +14 -0
- package/es/table/shared/hooks/useLazyKVMap.d.ts +4 -0
- package/es/table/shared/hooks/useLazyKVMap.js +30 -0
- package/es/table/shared/hooks/useRenderTimes.d.ts +5 -0
- package/es/table/shared/hooks/useRenderTimes.js +39 -0
- package/es/table/shared/hooks/useRowInfo.d.ts +11 -0
- package/es/table/shared/hooks/useRowInfo.js +73 -0
- package/es/table/shared/utils/legacyUtil.d.ts +5 -0
- package/es/table/shared/utils/legacyUtil.js +30 -0
- package/es/table/shared/utils/util.d.ts +6 -0
- package/es/table/shared/utils/util.js +26 -0
- package/es/table/shared/utils/valueUtil.d.ts +8 -0
- package/es/table/shared/utils/valueUtil.js +29 -0
- package/es/table/style/base.less +164 -0
- package/es/table/style/bordered.less +83 -0
- package/es/table/style/editable.less +50 -0
- package/es/table/style/ellipsis.less +33 -0
- package/es/table/style/empty.less +16 -0
- package/es/table/style/expand.less +123 -0
- package/es/table/style/filter.less +34 -0
- package/es/table/style/fixed.less +85 -0
- package/es/table/style/index.d.ts +3 -0
- package/es/table/style/index.js +3 -0
- package/es/table/style/index.less +19 -0
- package/es/table/style/pagination.less +29 -0
- package/es/table/style/radius.less +64 -0
- package/es/table/style/resize.less +78 -0
- package/es/table/style/rtl.less +52 -0
- package/es/table/style/selection.less +63 -0
- package/es/table/style/size.less +54 -0
- package/es/table/style/sorter.less +99 -0
- package/es/table/style/sticky.less +45 -0
- package/es/table/style/summary.less +23 -0
- package/es/table/style/variables.less +80 -0
- package/es/table/style/virtual.less +95 -0
- package/lib/_util/context/createContextSelector.js +120 -0
- package/lib/_util/context/immutable.js +92 -0
- package/lib/_util/context/index.js +41 -0
- package/lib/_util/easings.js +1 -1
- package/lib/_util/getScroll.js +6 -6
- package/lib/_util/hooks/index.js +82 -5
- package/lib/_util/hooks/useBreakpoint.js +85 -0
- package/lib/_util/hooks/useCssVar.js +37 -0
- package/lib/_util/hooks/useEvent.js +13 -0
- package/lib/_util/hooks/useForceUpdate.js +5 -4
- package/lib/_util/hooks/useLayoutEffect.js +13 -0
- package/lib/_util/hooks/useMultipleSelect.js +43 -0
- package/lib/_util/hooks/useOrientation.js +7 -8
- package/lib/_util/hooks/useProxyImperativeHandle.js +18 -14
- package/lib/_util/hooks/useSyncState.js +19 -9
- package/lib/_util/hooks/useTimeoutLock.js +35 -0
- package/lib/_util/index.js +101 -1
- package/lib/_util/is.js +22 -0
- package/lib/_util/rcUtil.js +134 -0
- package/lib/_util/scrollTo.js +22 -18
- package/lib/_util/scrollbar.js +38 -0
- package/lib/_util/validate.js +17 -0
- package/lib/_util/warning.js +25 -27
- package/lib/block-header/index.js +141 -0
- package/{esm/blockHeader → lib/block-header}/style/index.less +167 -143
- package/lib/button/index.js +24 -9
- package/lib/button/style/index.less +62 -59
- package/lib/button/style/mixin.less +40 -39
- package/lib/collapsible/index.js +210 -169
- package/lib/collapsible/style/index.less +24 -24
- package/lib/collapsible-action-items/index.js +83 -0
- package/{esm/collapsibleActionItems → lib/collapsible-action-items}/style/index.less +7 -7
- package/lib/flex/index.js +43 -34
- package/lib/flex/style/index.less +80 -76
- package/lib/flex/utils.js +23 -23
- package/lib/form-list/index.js +163 -0
- package/lib/{formList → form-list}/style/index.less +45 -45
- package/lib/index.js +41 -63
- package/lib/overflow-list/index.js +203 -0
- package/lib/{overflowList → overflow-list}/style/index.less +9 -9
- package/lib/resize/index.js +13 -13
- package/lib/resize-observer/index.js +182 -0
- package/lib/splitter/Panel.js +36 -25
- package/lib/splitter/SplitBar.js +151 -134
- package/lib/splitter/Splitter.js +141 -89
- package/lib/splitter/hooks/sizeUtil.js +50 -33
- package/lib/splitter/hooks/useDragListeners.js +114 -0
- package/lib/splitter/hooks/useItems.js +27 -20
- package/lib/splitter/hooks/useOrientation.js +12 -0
- package/lib/splitter/hooks/useResizable.js +32 -30
- package/lib/splitter/hooks/useResize.js +76 -45
- package/lib/splitter/hooks/useSizes.js +55 -30
- package/lib/splitter/index.js +1 -1
- package/lib/splitter/style/index.less +349 -312
- package/lib/status-tag/index.js +131 -0
- package/{esm/statusTag → lib/status-tag}/style/index.less +70 -70
- package/lib/{statusTag → status-tag}/style/mixin.less +48 -39
- package/lib/style/index.less +1 -1
- package/lib/style/themes/index.less +2 -2
- package/lib/style/themes/variable.less +5 -5
- package/lib/table/Column.js +13 -0
- package/lib/table/ColumnGroup.js +13 -0
- package/lib/table/InternalTable.js +824 -0
- package/lib/table/Table.js +40 -0
- package/lib/table/TableMeasureRowContext.js +10 -0
- package/lib/table/components/Body/BodyRow.js +192 -0
- package/lib/table/components/Body/ExpandedRow.js +61 -0
- package/lib/table/components/Body/MeasureCell.js +43 -0
- package/lib/table/components/Body/MeasureRow.js +64 -0
- package/lib/table/components/Body/index.js +133 -0
- package/lib/table/components/Cell/index.js +205 -0
- package/lib/table/components/Cell/useCellRender.js +78 -0
- package/lib/table/components/Cell/useHoverState.js +20 -0
- package/lib/table/components/ColGroup.js +62 -0
- package/lib/table/components/ExpandIcon.js +35 -0
- package/lib/table/components/FixedHolder/index.js +195 -0
- package/lib/table/components/Footer/Cell.js +57 -0
- package/lib/table/components/Footer/Row.js +19 -0
- package/lib/table/components/Footer/Summary.js +19 -0
- package/lib/table/components/Footer/SummaryContext.js +12 -0
- package/lib/table/components/Footer/index.js +41 -0
- package/lib/table/components/Header/Header.js +120 -0
- package/lib/table/components/Header/HeaderRow.js +72 -0
- package/lib/table/components/Panel.js +20 -0
- package/lib/table/components/RcTable.js +764 -0
- package/lib/table/components/VirtualTable.js +18 -0
- package/lib/table/components/VirtualTableBody/BodyGrid.js +316 -0
- package/lib/table/components/VirtualTableBody/BodyLine.js +125 -0
- package/lib/table/components/VirtualTableBody/VirtualCell.js +128 -0
- package/lib/table/components/VirtualTableBody/context.js +9 -0
- package/lib/table/components/VirtualTableBody/index.js +111 -0
- package/lib/table/constant.js +8 -0
- package/lib/table/features/columns/Column.js +10 -0
- package/lib/table/features/columns/ColumnGroup.js +10 -0
- package/lib/table/features/columns/index.js +57 -0
- package/lib/table/features/columns/useColumns.js +237 -0
- package/lib/table/features/columns/useFilledColumns.js +42 -0
- package/lib/table/features/columns/useTitleColumns.js +34 -0
- package/lib/table/features/columns/useWidthColumns.js +83 -0
- package/lib/table/features/editable/BatchEditModal.js +794 -0
- package/lib/table/features/editable/EditableCell.js +303 -0
- package/lib/table/features/editable/EditableContext.js +28 -0
- package/lib/table/features/editable/batchEditTypes.js +5 -0
- package/lib/table/features/editable/batchEditUtils.js +264 -0
- package/lib/table/features/editable/builtinEditors.js +174 -0
- package/lib/table/features/editable/index.js +75 -0
- package/lib/table/features/editable/useBatchRules.js +103 -0
- package/lib/table/features/editable/useEditable.js +701 -0
- package/lib/table/features/expand/expandUtil.js +57 -0
- package/lib/table/features/expand/index.js +32 -0
- package/lib/table/features/expand/useExpand.js +99 -0
- package/lib/table/features/filter/FilterDropdown.js +504 -0
- package/lib/table/features/filter/FilterSearch.js +34 -0
- package/lib/table/features/filter/FilterWrapper.js +32 -0
- package/lib/table/features/filter/index.js +49 -0
- package/lib/table/features/filter/useFilter.js +254 -0
- package/lib/table/features/fixed/fixUtil.js +75 -0
- package/lib/table/features/fixed/index.js +34 -0
- package/lib/table/features/fixed/offsetUtil.js +19 -0
- package/lib/table/features/fixed/useFixedInfo.js +26 -0
- package/lib/table/features/fixed/useStickyOffsets.js +35 -0
- package/lib/table/features/hover/index.js +13 -0
- package/lib/table/features/hover/useHover.js +31 -0
- package/lib/table/features/pagination/index.js +27 -0
- package/lib/table/features/pagination/usePagination.js +96 -0
- package/lib/table/features/resize/ResizeHandle.js +109 -0
- package/lib/table/features/resize/index.js +27 -0
- package/lib/table/features/resize/transformResizableColumns.js +61 -0
- package/lib/table/features/resize/useResize.js +595 -0
- package/lib/table/features/selection/index.js +39 -0
- package/lib/table/features/selection/useSelection.js +588 -0
- package/lib/table/features/sort/index.js +21 -0
- package/lib/table/features/sort/useSorter.js +381 -0
- package/lib/table/features/sticky/index.js +20 -0
- package/lib/table/features/sticky/stickyScrollBar.js +212 -0
- package/lib/table/features/sticky/useSticky.js +43 -0
- package/lib/table/features/summary/index.js +13 -0
- package/lib/table/features/virtual/index.js +26 -0
- package/lib/table/features/virtual/useFlattenRecords.js +64 -0
- package/lib/table/features/virtual/useFrame.js +74 -0
- package/lib/table/immutableHelper.js +46 -0
- package/lib/table/index.js +124 -0
- package/lib/table/interface.js +60 -0
- package/lib/table/shared/context/PerfContext.js +15 -0
- package/lib/table/shared/context/TableContext.js +13 -0
- package/lib/table/shared/hooks/useContainerWidth.js +20 -0
- package/lib/table/shared/hooks/useLazyKVMap.js +39 -0
- package/lib/table/shared/hooks/useRenderTimes.js +49 -0
- package/lib/table/shared/hooks/useRowInfo.js +80 -0
- package/lib/table/shared/utils/legacyUtil.js +38 -0
- package/lib/table/shared/utils/util.js +34 -0
- package/lib/table/shared/utils/valueUtil.js +37 -0
- package/lib/table/style/base.less +164 -0
- package/lib/table/style/bordered.less +83 -0
- package/lib/table/style/editable.less +50 -0
- package/lib/table/style/ellipsis.less +33 -0
- package/lib/table/style/empty.less +16 -0
- package/lib/table/style/expand.less +123 -0
- package/lib/table/style/filter.less +34 -0
- package/lib/table/style/fixed.less +85 -0
- package/lib/table/style/index.js +5 -0
- package/lib/table/style/index.less +19 -0
- package/lib/table/style/pagination.less +29 -0
- package/lib/table/style/radius.less +64 -0
- package/lib/table/style/resize.less +78 -0
- package/lib/table/style/rtl.less +52 -0
- package/lib/table/style/selection.less +63 -0
- package/lib/table/style/size.less +54 -0
- package/lib/table/style/sorter.less +99 -0
- package/lib/table/style/sticky.less +45 -0
- package/lib/table/style/summary.less +23 -0
- package/lib/table/style/variables.less +80 -0
- package/lib/table/style/virtual.less +95 -0
- package/package.json +147 -152
- package/esm/_util/extendsObject.js +0 -17
- package/esm/_util/hooks/index.js +0 -4
- package/esm/_util/isNonNullable.js +0 -4
- package/esm/index.js +0 -22
- package/esm/splitter/style/index.less +0 -312
- package/esm/style/mixins/index.less +0 -0
- package/esm/style/themes/index.less +0 -2
- package/lib/_util/extendsObject.js +0 -20
- package/lib/_util/isNonNullable.js +0 -10
- package/lib/blockHeader/index.js +0 -121
- package/lib/collapsibleActionItems/index.js +0 -68
- package/lib/formList/index.js +0 -130
- package/lib/overflowList/index.js +0 -144
- package/lib/resizeObserver/index.js +0 -137
- package/lib/statusTag/index.js +0 -125
- package/lib/style/mixins/index.less +0 -0
- /package/{esm → es}/_util/easings.js +0 -0
- /package/{esm → es}/_util/gapSize.js +0 -0
- /package/{esm → es}/_util/hooks/useForceUpdate.js +0 -0
- /package/{esm → es}/_util/hooks/useOrientation.js +0 -0
- /package/{esm → es}/_util/hooks/useSyncState.js +0 -0
- /package/{esm → es}/_util/type.js +0 -0
- /package/{esm/blockHeader → es/block-header}/style/index.js +0 -0
- /package/{esm → es}/button/style/index.js +0 -0
- /package/{esm → es}/collapsible/style/index.js +0 -0
- /package/{esm/collapsibleActionItems → es/collapsible-action-items}/style/index.js +0 -0
- /package/{esm → es}/flex/interface.js +0 -0
- /package/{esm → es}/flex/style/index.js +0 -0
- /package/{esm → es}/flex/utils.js +0 -0
- /package/{esm/formList → es/form-list}/style/index.js +0 -0
- /package/{esm/overflowList → es/overflow-list}/style/index.js +0 -0
- /package/{esm → es}/resize/index.js +0 -0
- /package/{esm → es}/splitter/hooks/useItems.js +0 -0
- /package/{esm → es}/splitter/index.js +0 -0
- /package/{esm → es}/splitter/interface.js +0 -0
- /package/{esm → es}/splitter/style/index.js +0 -0
- /package/{esm/statusTag → es/status-tag}/style/index.js +0 -0
- /package/{esm → es}/style/index.js +0 -0
- /package/lib/{blockHeader → block-header}/style/index.js +0 -0
- /package/lib/{collapsibleActionItems → collapsible-action-items}/style/index.js +0 -0
- /package/lib/{formList → form-list}/style/index.js +0 -0
- /package/lib/{overflowList → overflow-list}/style/index.js +0 -0
- /package/lib/{statusTag → status-tag}/style/index.js +0 -0
|
@@ -0,0 +1,757 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(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); }
|
|
6
|
+
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; }
|
|
7
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
8
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
13
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
14
|
+
/**
|
|
15
|
+
* Feature:
|
|
16
|
+
* - fixed not need to set width
|
|
17
|
+
* - support `rowExpandable` to config row expand logic
|
|
18
|
+
* - add `summary` to support `() => ReactNode`
|
|
19
|
+
*
|
|
20
|
+
* Update:
|
|
21
|
+
* - `dataIndex` is `array[]` now
|
|
22
|
+
* - `expandable` wrap all the expand related props
|
|
23
|
+
*
|
|
24
|
+
* Removed:
|
|
25
|
+
* - expandIconAsCell
|
|
26
|
+
* - useFixedHeader
|
|
27
|
+
* - rowRef
|
|
28
|
+
* - columns[number].onCellClick
|
|
29
|
+
* - onRowClick
|
|
30
|
+
* - onRowDoubleClick
|
|
31
|
+
* - onRowMouseEnter
|
|
32
|
+
* - onRowMouseLeave
|
|
33
|
+
* - getBodyWrapper
|
|
34
|
+
* - bodyStyle
|
|
35
|
+
*
|
|
36
|
+
* Deprecated:
|
|
37
|
+
* - All expanded props, move into expandable
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
import { clsx } from 'clsx';
|
|
41
|
+
import ResizeObserver from 'rc-resize-observer';
|
|
42
|
+
import { getDOM } from 'rc-util/lib/Dom/findDOMNode';
|
|
43
|
+
import getValue from 'rc-util/lib/utils/get';
|
|
44
|
+
import { getTargetScrollBarSize } from 'rc-util/lib/getScrollBarSize';
|
|
45
|
+
import isEqual from 'rc-util/lib/isEqual';
|
|
46
|
+
import { pickAttrs } from "../../_util/rcUtil";
|
|
47
|
+
import useEvent from "../../_util/hooks/useEvent";
|
|
48
|
+
import useLayoutEffect from "../../_util/hooks/useLayoutEffect";
|
|
49
|
+
import warning from 'rc-util/lib/warning';
|
|
50
|
+
import * as React from 'react';
|
|
51
|
+
import Body from "./Body";
|
|
52
|
+
import ColGroup from "./ColGroup";
|
|
53
|
+
import { INTERNAL_HOOKS } from "../constant";
|
|
54
|
+
import TableContext, { makeImmutable } from "../shared/context/TableContext";
|
|
55
|
+
import FixedHolder from "./FixedHolder";
|
|
56
|
+
import Footer from "./Footer";
|
|
57
|
+
import Summary from "./Footer/Summary";
|
|
58
|
+
import Header from "./Header/Header";
|
|
59
|
+
import useColumns from "../features/columns/useColumns";
|
|
60
|
+
import useExpand from "../features/expand/useExpand";
|
|
61
|
+
import useFixedInfo from "../features/fixed/useFixedInfo";
|
|
62
|
+
import { useTimeoutLock } from "../features/virtual/useFrame";
|
|
63
|
+
import useHover from "../features/hover/useHover";
|
|
64
|
+
import useSticky from "../features/sticky/useSticky";
|
|
65
|
+
import useStickyOffsets from "../features/fixed/useStickyOffsets";
|
|
66
|
+
import Panel from "./Panel";
|
|
67
|
+
import StickyScrollBar from "../features/sticky/stickyScrollBar";
|
|
68
|
+
import { getColumnsKey, validateValue, validNumberValue } from "../shared/utils/valueUtil";
|
|
69
|
+
export var DEFAULT_PREFIX = 'rc-table';
|
|
70
|
+
|
|
71
|
+
// Used for conditions cache
|
|
72
|
+
var EMPTY_DATA = [];
|
|
73
|
+
|
|
74
|
+
// Used for customize scroll
|
|
75
|
+
var EMPTY_SCROLL_TARGET = {};
|
|
76
|
+
function defaultEmpty() {
|
|
77
|
+
return 'No Data';
|
|
78
|
+
}
|
|
79
|
+
var Table = function Table(tableProps, ref) {
|
|
80
|
+
var _flattenColumns$, _flattenColumns, _clsx, _styles$title, _styles$footer;
|
|
81
|
+
var props = _objectSpread({
|
|
82
|
+
rowKey: 'key',
|
|
83
|
+
prefixCls: DEFAULT_PREFIX,
|
|
84
|
+
emptyText: defaultEmpty
|
|
85
|
+
}, tableProps);
|
|
86
|
+
var prefixCls = props.prefixCls,
|
|
87
|
+
className = props.className,
|
|
88
|
+
rowClassName = props.rowClassName,
|
|
89
|
+
style = props.style,
|
|
90
|
+
classNames = props.classNames,
|
|
91
|
+
styles = props.styles,
|
|
92
|
+
data = props.data,
|
|
93
|
+
rowKey = props.rowKey,
|
|
94
|
+
scroll = props.scroll,
|
|
95
|
+
tableLayout = props.tableLayout,
|
|
96
|
+
direction = props.direction,
|
|
97
|
+
title = props.title,
|
|
98
|
+
footer = props.footer,
|
|
99
|
+
summary = props.summary,
|
|
100
|
+
caption = props.caption,
|
|
101
|
+
id = props.id,
|
|
102
|
+
showHeader = props.showHeader,
|
|
103
|
+
components = props.components,
|
|
104
|
+
emptyText = props.emptyText,
|
|
105
|
+
onRow = props.onRow,
|
|
106
|
+
onHeaderRow = props.onHeaderRow,
|
|
107
|
+
measureRowRender = props.measureRowRender,
|
|
108
|
+
onScroll = props.onScroll,
|
|
109
|
+
internalHooks = props.internalHooks,
|
|
110
|
+
transformColumns = props.transformColumns,
|
|
111
|
+
internalRefs = props.internalRefs,
|
|
112
|
+
tailor = props.tailor,
|
|
113
|
+
getContainerWidth = props.getContainerWidth,
|
|
114
|
+
sticky = props.sticky,
|
|
115
|
+
_props$rowHoverable = props.rowHoverable,
|
|
116
|
+
rowHoverable = _props$rowHoverable === void 0 ? true : _props$rowHoverable;
|
|
117
|
+
var mergedData = data || EMPTY_DATA;
|
|
118
|
+
var hasData = !!mergedData.length;
|
|
119
|
+
var useInternalHooks = internalHooks === INTERNAL_HOOKS;
|
|
120
|
+
|
|
121
|
+
// ===================== Warning ======================
|
|
122
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
123
|
+
['onRowClick', 'onRowDoubleClick', 'onRowContextMenu', 'onRowMouseEnter', 'onRowMouseLeave'].forEach(function (name) {
|
|
124
|
+
warning(props[name] === undefined, "`".concat(name, "` is removed, please use `onRow` instead."));
|
|
125
|
+
});
|
|
126
|
+
warning(!('getBodyWrapper' in props), '`getBodyWrapper` is deprecated, please use custom `components` instead.');
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// ==================== Customize =====================
|
|
130
|
+
var getComponent = React.useCallback(function (path, defaultComponent) {
|
|
131
|
+
return getValue(components, path) || defaultComponent;
|
|
132
|
+
}, [components]);
|
|
133
|
+
var getRowKey = React.useMemo(function () {
|
|
134
|
+
if (typeof rowKey === 'function') {
|
|
135
|
+
return rowKey;
|
|
136
|
+
}
|
|
137
|
+
return function (record) {
|
|
138
|
+
var key = record && record[rowKey];
|
|
139
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
140
|
+
warning(key !== undefined, 'Each record in table should have a unique `key` prop, or set `rowKey` to an unique primary key.');
|
|
141
|
+
}
|
|
142
|
+
return key;
|
|
143
|
+
};
|
|
144
|
+
}, [rowKey]);
|
|
145
|
+
var customizeScrollBody = getComponent(['body']);
|
|
146
|
+
|
|
147
|
+
// ====================== Hover =======================
|
|
148
|
+
var _useHover = useHover(),
|
|
149
|
+
_useHover2 = _slicedToArray(_useHover, 3),
|
|
150
|
+
startRow = _useHover2[0],
|
|
151
|
+
endRow = _useHover2[1],
|
|
152
|
+
onHover = _useHover2[2];
|
|
153
|
+
|
|
154
|
+
// ====================== Expand ======================
|
|
155
|
+
var _useExpand = useExpand(props, mergedData, getRowKey),
|
|
156
|
+
_useExpand2 = _slicedToArray(_useExpand, 6),
|
|
157
|
+
expandableConfig = _useExpand2[0],
|
|
158
|
+
expandableType = _useExpand2[1],
|
|
159
|
+
mergedExpandedKeys = _useExpand2[2],
|
|
160
|
+
mergedExpandIcon = _useExpand2[3],
|
|
161
|
+
mergedChildrenColumnName = _useExpand2[4],
|
|
162
|
+
onTriggerExpand = _useExpand2[5];
|
|
163
|
+
|
|
164
|
+
// ====================== Column ======================
|
|
165
|
+
var scrollX = scroll === null || scroll === void 0 ? void 0 : scroll.x;
|
|
166
|
+
var _React$useState = React.useState(0),
|
|
167
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
168
|
+
componentWidth = _React$useState2[0],
|
|
169
|
+
setComponentWidth = _React$useState2[1];
|
|
170
|
+
var _useColumns = useColumns(_objectSpread(_objectSpread(_objectSpread({}, props), expandableConfig), {}, {
|
|
171
|
+
expandable: !!expandableConfig.expandedRowRender,
|
|
172
|
+
columnTitle: expandableConfig.columnTitle,
|
|
173
|
+
expandedKeys: mergedExpandedKeys,
|
|
174
|
+
getRowKey: getRowKey,
|
|
175
|
+
// https://github.com/ant-design/ant-design/issues/23894
|
|
176
|
+
onTriggerExpand: onTriggerExpand,
|
|
177
|
+
expandIcon: mergedExpandIcon,
|
|
178
|
+
expandIconColumnIndex: expandableConfig.expandIconColumnIndex,
|
|
179
|
+
direction: direction,
|
|
180
|
+
scrollWidth: useInternalHooks && tailor && typeof scrollX === 'number' ? scrollX : undefined,
|
|
181
|
+
clientWidth: componentWidth
|
|
182
|
+
}),
|
|
183
|
+
// `useColumns` guards the call with `if (transformColumns)`, so `null`
|
|
184
|
+
// ("no transform") is a valid runtime value here.
|
|
185
|
+
useInternalHooks ? transformColumns : null),
|
|
186
|
+
_useColumns2 = _slicedToArray(_useColumns, 3),
|
|
187
|
+
columns = _useColumns2[0],
|
|
188
|
+
flattenColumns = _useColumns2[1],
|
|
189
|
+
flattenScrollX = _useColumns2[2];
|
|
190
|
+
var mergedScrollX = flattenScrollX !== null && flattenScrollX !== void 0 ? flattenScrollX : scrollX;
|
|
191
|
+
var columnContext = React.useMemo(function () {
|
|
192
|
+
return {
|
|
193
|
+
columns: columns,
|
|
194
|
+
flattenColumns: flattenColumns
|
|
195
|
+
};
|
|
196
|
+
}, [columns, flattenColumns]);
|
|
197
|
+
|
|
198
|
+
// ======================= Refs =======================
|
|
199
|
+
var fullTableRef = React.useRef(null);
|
|
200
|
+
var scrollHeaderRef = React.useRef(null);
|
|
201
|
+
var scrollBodyRef = React.useRef(null);
|
|
202
|
+
var scrollBodyContainerRef = React.useRef(null);
|
|
203
|
+
React.useImperativeHandle(ref, function () {
|
|
204
|
+
return {
|
|
205
|
+
nativeElement: fullTableRef.current,
|
|
206
|
+
scrollTo: function scrollTo(config) {
|
|
207
|
+
var _scrollBodyRef$curren2;
|
|
208
|
+
if (scrollBodyRef.current instanceof HTMLElement) {
|
|
209
|
+
// Native scroll
|
|
210
|
+
var index = config.index,
|
|
211
|
+
top = config.top,
|
|
212
|
+
key = config.key,
|
|
213
|
+
offset = config.offset,
|
|
214
|
+
_config$align = config.align,
|
|
215
|
+
align = _config$align === void 0 ? 'nearest' : _config$align;
|
|
216
|
+
if (validNumberValue(top)) {
|
|
217
|
+
var _scrollBodyRef$curren;
|
|
218
|
+
// In top mode, offset is ignored
|
|
219
|
+
(_scrollBodyRef$curren = scrollBodyRef.current) === null || _scrollBodyRef$curren === void 0 || _scrollBodyRef$curren.scrollTo({
|
|
220
|
+
top: top
|
|
221
|
+
});
|
|
222
|
+
} else {
|
|
223
|
+
var mergedKey = key !== null && key !== void 0 ? key : index !== undefined ? getRowKey(mergedData[index]) : undefined;
|
|
224
|
+
var targetElement = scrollBodyRef.current.querySelector("[data-row-key=\"".concat(mergedKey, "\"]"));
|
|
225
|
+
if (targetElement) {
|
|
226
|
+
targetElement.scrollIntoView({
|
|
227
|
+
block: align
|
|
228
|
+
});
|
|
229
|
+
if (offset) {
|
|
230
|
+
var _container = scrollBodyRef.current;
|
|
231
|
+
_container.scrollTo({
|
|
232
|
+
top: _container.scrollTop + offset
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
} else if ((_scrollBodyRef$curren2 = scrollBodyRef.current) !== null && _scrollBodyRef$curren2 !== void 0 && _scrollBodyRef$curren2.scrollTo) {
|
|
238
|
+
// Pass to proxy
|
|
239
|
+
scrollBodyRef.current.scrollTo(config);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
// `validate` / `resetErrors` / `resetColumnWidths` are provided by the
|
|
243
|
+
// `InternalTable` wrapper, which spreads this handle and overrides them
|
|
244
|
+
// (see InternalTable.tsx). `nativeElement` is attached after mount.
|
|
245
|
+
};
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
// ====================== Scroll ======================
|
|
249
|
+
var scrollSummaryRef = React.useRef(null);
|
|
250
|
+
var _React$useState3 = React.useState(false),
|
|
251
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
252
|
+
shadowStart = _React$useState4[0],
|
|
253
|
+
setShadowStart = _React$useState4[1];
|
|
254
|
+
var _React$useState5 = React.useState(false),
|
|
255
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
256
|
+
shadowEnd = _React$useState6[0],
|
|
257
|
+
setShadowEnd = _React$useState6[1];
|
|
258
|
+
var _React$useState7 = React.useState(function () {
|
|
259
|
+
return new Map();
|
|
260
|
+
}),
|
|
261
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
262
|
+
colsWidths = _React$useState8[0],
|
|
263
|
+
updateColsWidths = _React$useState8[1];
|
|
264
|
+
|
|
265
|
+
// Convert map to number width
|
|
266
|
+
var colsKeys = getColumnsKey(flattenColumns);
|
|
267
|
+
var pureColWidths = colsKeys.map(function (columnKey) {
|
|
268
|
+
return colsWidths.get(columnKey);
|
|
269
|
+
});
|
|
270
|
+
// `Map.get` may yield `undefined` for unmeasured columns; all consumers
|
|
271
|
+
// (`useStickyOffsets`, `FixedHolder`, `ColGroup`) tolerate that at runtime.
|
|
272
|
+
var colWidths = React.useMemo(function () {
|
|
273
|
+
return pureColWidths;
|
|
274
|
+
}, [pureColWidths.join('_')]);
|
|
275
|
+
var stickyOffsets = useStickyOffsets(colWidths, flattenColumns);
|
|
276
|
+
var fixHeader = !!scroll && validateValue(scroll.y);
|
|
277
|
+
var horizonScroll = scroll && validateValue(mergedScrollX) || Boolean(expandableConfig.fixed);
|
|
278
|
+
var fixColumn = horizonScroll && flattenColumns.some(function (_ref) {
|
|
279
|
+
var fixed = _ref.fixed;
|
|
280
|
+
return fixed;
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
// Sticky
|
|
284
|
+
var stickyRef = React.useRef(null);
|
|
285
|
+
var _useSticky = useSticky(sticky !== null && sticky !== void 0 ? sticky : false, prefixCls),
|
|
286
|
+
isSticky = _useSticky.isSticky,
|
|
287
|
+
offsetHeader = _useSticky.offsetHeader,
|
|
288
|
+
offsetSummary = _useSticky.offsetSummary,
|
|
289
|
+
offsetScroll = _useSticky.offsetScroll,
|
|
290
|
+
stickyClassName = _useSticky.stickyClassName,
|
|
291
|
+
container = _useSticky.container;
|
|
292
|
+
|
|
293
|
+
// Footer (Fix footer must fixed header)
|
|
294
|
+
var summaryNode = React.useMemo(function () {
|
|
295
|
+
return summary === null || summary === void 0 ? void 0 : summary(mergedData);
|
|
296
|
+
}, [summary, mergedData]);
|
|
297
|
+
var fixFooter = (fixHeader || isSticky) && /*#__PURE__*/React.isValidElement(summaryNode) && summaryNode.type === Summary && summaryNode.props.fixed;
|
|
298
|
+
|
|
299
|
+
// Scroll
|
|
300
|
+
var scrollXStyle = {};
|
|
301
|
+
var scrollYStyle = {};
|
|
302
|
+
var scrollTableStyle = {};
|
|
303
|
+
if (fixHeader) {
|
|
304
|
+
scrollYStyle = {
|
|
305
|
+
overflowY: hasData ? 'scroll' : 'auto',
|
|
306
|
+
maxHeight: scroll.y
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
if (horizonScroll) {
|
|
310
|
+
scrollXStyle = {
|
|
311
|
+
overflowX: 'auto'
|
|
312
|
+
};
|
|
313
|
+
// When no vertical scrollbar, should hide it
|
|
314
|
+
// https://github.com/ant-design/ant-design/pull/20705
|
|
315
|
+
// https://github.com/ant-design/ant-design/issues/21879
|
|
316
|
+
if (!fixHeader) {
|
|
317
|
+
scrollYStyle = {
|
|
318
|
+
overflowY: 'hidden'
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
scrollTableStyle = {
|
|
322
|
+
width: mergedScrollX === true ? 'auto' : mergedScrollX,
|
|
323
|
+
minWidth: '100%'
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
var onColumnResize = React.useCallback(function (columnKey, width) {
|
|
327
|
+
updateColsWidths(function (widths) {
|
|
328
|
+
if (widths.get(columnKey) !== width) {
|
|
329
|
+
var newWidths = new Map(widths);
|
|
330
|
+
newWidths.set(columnKey, width);
|
|
331
|
+
return newWidths;
|
|
332
|
+
}
|
|
333
|
+
return widths;
|
|
334
|
+
});
|
|
335
|
+
}, []);
|
|
336
|
+
var _useTimeoutLock = useTimeoutLock(null),
|
|
337
|
+
_useTimeoutLock2 = _slicedToArray(_useTimeoutLock, 2),
|
|
338
|
+
setScrollTarget = _useTimeoutLock2[0],
|
|
339
|
+
getScrollTarget = _useTimeoutLock2[1];
|
|
340
|
+
function forceScroll(scrollLeft, target) {
|
|
341
|
+
if (!target) {
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
if (typeof target === 'function') {
|
|
345
|
+
target(scrollLeft);
|
|
346
|
+
} else if (target.scrollLeft !== scrollLeft) {
|
|
347
|
+
target.scrollLeft = scrollLeft;
|
|
348
|
+
|
|
349
|
+
// Delay to force scroll position if not sync
|
|
350
|
+
// ref: https://github.com/ant-design/ant-design/issues/37179
|
|
351
|
+
if (target.scrollLeft !== scrollLeft) {
|
|
352
|
+
setTimeout(function () {
|
|
353
|
+
target.scrollLeft = scrollLeft;
|
|
354
|
+
}, 0);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
var _React$useState9 = React.useState([0, 0]),
|
|
359
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
360
|
+
scrollInfo = _React$useState10[0],
|
|
361
|
+
setScrollInfo = _React$useState10[1];
|
|
362
|
+
var onInternalScroll = useEvent(function (_ref2) {
|
|
363
|
+
var _currentTarget$scroll;
|
|
364
|
+
var currentTarget = _ref2.currentTarget,
|
|
365
|
+
scrollLeft = _ref2.scrollLeft;
|
|
366
|
+
var mergedScrollLeft = typeof scrollLeft === 'number' ? scrollLeft : (_currentTarget$scroll = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.scrollLeft) !== null && _currentTarget$scroll !== void 0 ? _currentTarget$scroll : 0;
|
|
367
|
+
var compareTarget = currentTarget || EMPTY_SCROLL_TARGET;
|
|
368
|
+
if (!getScrollTarget() || getScrollTarget() === compareTarget) {
|
|
369
|
+
var _stickyRef$current;
|
|
370
|
+
setScrollTarget(compareTarget);
|
|
371
|
+
forceScroll(mergedScrollLeft, scrollHeaderRef.current);
|
|
372
|
+
forceScroll(mergedScrollLeft, scrollBodyRef.current);
|
|
373
|
+
forceScroll(mergedScrollLeft, scrollSummaryRef.current);
|
|
374
|
+
forceScroll(mergedScrollLeft, (_stickyRef$current = stickyRef.current) === null || _stickyRef$current === void 0 ? void 0 : _stickyRef$current.setScrollLeft);
|
|
375
|
+
}
|
|
376
|
+
var measureTarget = currentTarget || scrollHeaderRef.current;
|
|
377
|
+
if (measureTarget) {
|
|
378
|
+
var scrollWidth =
|
|
379
|
+
// Should use mergedScrollX in virtual table(useInternalHooks && tailor === true)
|
|
380
|
+
useInternalHooks && tailor && typeof mergedScrollX === 'number' ? mergedScrollX : measureTarget.scrollWidth;
|
|
381
|
+
var clientWidth = measureTarget.clientWidth;
|
|
382
|
+
var absScrollStart = Math.abs(mergedScrollLeft);
|
|
383
|
+
setScrollInfo(function (ori) {
|
|
384
|
+
var nextScrollInfo = [absScrollStart, scrollWidth - clientWidth];
|
|
385
|
+
return isEqual(ori, nextScrollInfo) ? ori : nextScrollInfo;
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
// There is no space to scroll
|
|
389
|
+
if (scrollWidth === clientWidth) {
|
|
390
|
+
setShadowStart(false);
|
|
391
|
+
setShadowEnd(false);
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
setShadowStart(absScrollStart > 0);
|
|
395
|
+
setShadowEnd(absScrollStart < scrollWidth - clientWidth - 1);
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
var onBodyScroll = useEvent(function (e) {
|
|
399
|
+
onInternalScroll(e);
|
|
400
|
+
onScroll === null || onScroll === void 0 || onScroll(e);
|
|
401
|
+
});
|
|
402
|
+
var triggerOnScroll = function triggerOnScroll() {
|
|
403
|
+
if (horizonScroll && scrollBodyRef.current) {
|
|
404
|
+
var _scrollBodyRef$curren3;
|
|
405
|
+
onInternalScroll({
|
|
406
|
+
currentTarget: getDOM(scrollBodyRef.current),
|
|
407
|
+
scrollLeft: (_scrollBodyRef$curren3 = scrollBodyRef.current) === null || _scrollBodyRef$curren3 === void 0 ? void 0 : _scrollBodyRef$curren3.scrollLeft
|
|
408
|
+
});
|
|
409
|
+
} else {
|
|
410
|
+
setShadowStart(false);
|
|
411
|
+
setShadowEnd(false);
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
var onFullTableResize = function onFullTableResize(offsetWidth) {
|
|
415
|
+
var _stickyRef$current2, _ref3, _fullTableRef$current;
|
|
416
|
+
(_stickyRef$current2 = stickyRef.current) === null || _stickyRef$current2 === void 0 || _stickyRef$current2.checkScrollBarVisible();
|
|
417
|
+
var mergedWidth = (_ref3 = offsetWidth !== null && offsetWidth !== void 0 ? offsetWidth : (_fullTableRef$current = fullTableRef.current) === null || _fullTableRef$current === void 0 ? void 0 : _fullTableRef$current.offsetWidth) !== null && _ref3 !== void 0 ? _ref3 : 0;
|
|
418
|
+
if (useInternalHooks && getContainerWidth && fullTableRef.current) {
|
|
419
|
+
mergedWidth = getContainerWidth(fullTableRef.current, mergedWidth) || mergedWidth;
|
|
420
|
+
}
|
|
421
|
+
if (mergedWidth !== componentWidth) {
|
|
422
|
+
triggerOnScroll();
|
|
423
|
+
setComponentWidth(mergedWidth);
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
// fix https://github.com/ant-design/ant-design/issues/49279
|
|
428
|
+
useLayoutEffect(function () {
|
|
429
|
+
if (horizonScroll) {
|
|
430
|
+
onFullTableResize();
|
|
431
|
+
}
|
|
432
|
+
}, [horizonScroll]);
|
|
433
|
+
|
|
434
|
+
// Sync scroll bar when init or `horizonScroll`, `data` and `columns.length` changed
|
|
435
|
+
var mounted = React.useRef(false);
|
|
436
|
+
React.useEffect(function () {
|
|
437
|
+
// onFullTableResize will be trigger once when ResizeObserver is mounted
|
|
438
|
+
// This will reduce one duplicated triggerOnScroll time
|
|
439
|
+
if (mounted.current) {
|
|
440
|
+
triggerOnScroll();
|
|
441
|
+
}
|
|
442
|
+
}, [horizonScroll, data, columns.length]);
|
|
443
|
+
React.useEffect(function () {
|
|
444
|
+
mounted.current = true;
|
|
445
|
+
}, []);
|
|
446
|
+
|
|
447
|
+
// ===================== Effects ======================
|
|
448
|
+
var _React$useState11 = React.useState(0),
|
|
449
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
450
|
+
scrollbarSize = _React$useState12[0],
|
|
451
|
+
setScrollbarSize = _React$useState12[1];
|
|
452
|
+
useLayoutEffect(function () {
|
|
453
|
+
if (!tailor || !useInternalHooks) {
|
|
454
|
+
if (scrollBodyRef.current instanceof Element) {
|
|
455
|
+
setScrollbarSize(getTargetScrollBarSize(scrollBodyRef.current).width);
|
|
456
|
+
} else {
|
|
457
|
+
setScrollbarSize(getTargetScrollBarSize(scrollBodyContainerRef.current).width);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}, []);
|
|
461
|
+
|
|
462
|
+
// ================== INTERNAL HOOKS ==================
|
|
463
|
+
React.useEffect(function () {
|
|
464
|
+
if (useInternalHooks && internalRefs) {
|
|
465
|
+
internalRefs.body.current = scrollBodyRef.current;
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
// ========================================================================
|
|
470
|
+
// == Render ==
|
|
471
|
+
// ========================================================================
|
|
472
|
+
// =================== Render: Func ===================
|
|
473
|
+
var renderFixedHeaderTable = React.useCallback(function (fixedHolderPassProps) {
|
|
474
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Header, fixedHolderPassProps), fixFooter === 'top' && /*#__PURE__*/React.createElement(Footer, fixedHolderPassProps, summaryNode));
|
|
475
|
+
}, [fixFooter, summaryNode]);
|
|
476
|
+
var renderFixedFooterTable = React.useCallback(function (fixedHolderPassProps) {
|
|
477
|
+
return /*#__PURE__*/React.createElement(Footer, fixedHolderPassProps, summaryNode);
|
|
478
|
+
}, [summaryNode]);
|
|
479
|
+
|
|
480
|
+
// =================== Render: Node ===================
|
|
481
|
+
var TableComponent = getComponent(['table'], 'table');
|
|
482
|
+
|
|
483
|
+
// Table layout
|
|
484
|
+
var mergedTableLayout = React.useMemo(function () {
|
|
485
|
+
if (tableLayout) {
|
|
486
|
+
return tableLayout;
|
|
487
|
+
}
|
|
488
|
+
// https://github.com/ant-design/ant-design/issues/25227
|
|
489
|
+
// When scroll.x is max-content, no need to fix table layout
|
|
490
|
+
// it's width should stretch out to fit content
|
|
491
|
+
if (fixColumn) {
|
|
492
|
+
return mergedScrollX === 'max-content' ? 'auto' : 'fixed';
|
|
493
|
+
}
|
|
494
|
+
if (fixHeader || isSticky || flattenColumns.some(function (_ref4) {
|
|
495
|
+
var ellipsis = _ref4.ellipsis;
|
|
496
|
+
return ellipsis;
|
|
497
|
+
})) {
|
|
498
|
+
return 'fixed';
|
|
499
|
+
}
|
|
500
|
+
return 'auto';
|
|
501
|
+
}, [fixHeader, fixColumn, flattenColumns, tableLayout, isSticky]);
|
|
502
|
+
var groupTableNode;
|
|
503
|
+
|
|
504
|
+
// Header props
|
|
505
|
+
var headerProps = {
|
|
506
|
+
colWidths: colWidths,
|
|
507
|
+
columCount: flattenColumns.length,
|
|
508
|
+
stickyOffsets: stickyOffsets,
|
|
509
|
+
// `HeaderRow` guards `onHeaderRow` with a truthiness check, so `undefined`
|
|
510
|
+
// is a valid runtime value here.
|
|
511
|
+
onHeaderRow: onHeaderRow,
|
|
512
|
+
fixHeader: fixHeader,
|
|
513
|
+
scroll: scroll
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
// Empty
|
|
517
|
+
var emptyNode = React.useMemo(function () {
|
|
518
|
+
if (hasData) {
|
|
519
|
+
return null;
|
|
520
|
+
}
|
|
521
|
+
if (typeof emptyText === 'function') {
|
|
522
|
+
return emptyText();
|
|
523
|
+
}
|
|
524
|
+
return emptyText;
|
|
525
|
+
}, [hasData, emptyText]);
|
|
526
|
+
|
|
527
|
+
// Body
|
|
528
|
+
var bodyTable = /*#__PURE__*/React.createElement(Body, {
|
|
529
|
+
data: mergedData,
|
|
530
|
+
measureColumnWidth: fixHeader || horizonScroll || isSticky
|
|
531
|
+
});
|
|
532
|
+
var bodyColGroup =
|
|
533
|
+
/*#__PURE__*/
|
|
534
|
+
// A column without `width` renders an unset `<col>` width; `ColGroup`
|
|
535
|
+
// treats falsy widths as "no width", so the value is safe at runtime.
|
|
536
|
+
React.createElement(ColGroup, {
|
|
537
|
+
colWidths: flattenColumns.map(function (_ref5) {
|
|
538
|
+
var width = _ref5.width;
|
|
539
|
+
return width;
|
|
540
|
+
}),
|
|
541
|
+
columns: flattenColumns
|
|
542
|
+
});
|
|
543
|
+
var captionElement = caption !== null && caption !== undefined ? /*#__PURE__*/React.createElement("caption", {
|
|
544
|
+
className: "".concat(prefixCls, "-caption")
|
|
545
|
+
}, caption) : undefined;
|
|
546
|
+
var dataProps = pickAttrs(props, {
|
|
547
|
+
data: true
|
|
548
|
+
});
|
|
549
|
+
var ariaProps = pickAttrs(props, {
|
|
550
|
+
aria: true
|
|
551
|
+
});
|
|
552
|
+
if (fixHeader || isSticky) {
|
|
553
|
+
// >>>>>> Fixed Header
|
|
554
|
+
var bodyContent;
|
|
555
|
+
if (typeof customizeScrollBody === 'function') {
|
|
556
|
+
bodyContent = customizeScrollBody(mergedData, {
|
|
557
|
+
scrollbarSize: scrollbarSize,
|
|
558
|
+
ref: scrollBodyRef,
|
|
559
|
+
onScroll: onInternalScroll
|
|
560
|
+
});
|
|
561
|
+
headerProps.colWidths = flattenColumns.map(function (_ref6, index) {
|
|
562
|
+
var width = _ref6.width;
|
|
563
|
+
var colWidth = index === flattenColumns.length - 1 ? width - scrollbarSize : width;
|
|
564
|
+
if (typeof colWidth === 'number' && !Number.isNaN(colWidth)) {
|
|
565
|
+
return colWidth;
|
|
566
|
+
}
|
|
567
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
568
|
+
var _props$columns;
|
|
569
|
+
warning(((_props$columns = props.columns) === null || _props$columns === void 0 ? void 0 : _props$columns.length) === 0, 'When use `components.body` with render props. Each column should have a fixed `width` value.');
|
|
570
|
+
}
|
|
571
|
+
return 0;
|
|
572
|
+
});
|
|
573
|
+
} else {
|
|
574
|
+
bodyContent = /*#__PURE__*/React.createElement("div", {
|
|
575
|
+
style: _objectSpread(_objectSpread({}, scrollXStyle), scrollYStyle),
|
|
576
|
+
onScroll: onBodyScroll,
|
|
577
|
+
ref: scrollBodyRef,
|
|
578
|
+
className: "".concat(prefixCls, "-body")
|
|
579
|
+
}, /*#__PURE__*/React.createElement(TableComponent, _extends({
|
|
580
|
+
style: _objectSpread(_objectSpread({}, scrollTableStyle), {}, {
|
|
581
|
+
tableLayout: mergedTableLayout
|
|
582
|
+
})
|
|
583
|
+
}, ariaProps), captionElement, bodyColGroup, bodyTable, !fixFooter && summaryNode && /*#__PURE__*/React.createElement(Footer, {
|
|
584
|
+
stickyOffsets: stickyOffsets,
|
|
585
|
+
flattenColumns: flattenColumns
|
|
586
|
+
}, summaryNode)));
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// Fixed holder share the props
|
|
590
|
+
var fixedHolderProps = _objectSpread(_objectSpread(_objectSpread({
|
|
591
|
+
noData: !mergedData.length,
|
|
592
|
+
maxContentScroll: horizonScroll && mergedScrollX === 'max-content'
|
|
593
|
+
}, headerProps), columnContext), {}, {
|
|
594
|
+
// `FixedHolder` only compares `direction === 'rtl'`, so the `'ltr'`
|
|
595
|
+
// fallback behaves exactly like `undefined`.
|
|
596
|
+
direction: direction !== null && direction !== void 0 ? direction : 'ltr',
|
|
597
|
+
stickyClassName: stickyClassName,
|
|
598
|
+
scrollX: mergedScrollX,
|
|
599
|
+
tableLayout: mergedTableLayout,
|
|
600
|
+
onScroll: onInternalScroll
|
|
601
|
+
});
|
|
602
|
+
groupTableNode = /*#__PURE__*/React.createElement(React.Fragment, null, showHeader !== false && /*#__PURE__*/React.createElement(FixedHolder, _extends({}, fixedHolderProps, {
|
|
603
|
+
stickyTopOffset: offsetHeader,
|
|
604
|
+
className: "".concat(prefixCls, "-header"),
|
|
605
|
+
ref: scrollHeaderRef,
|
|
606
|
+
colGroup: bodyColGroup
|
|
607
|
+
}), renderFixedHeaderTable), bodyContent, fixFooter && fixFooter !== 'top' && /*#__PURE__*/React.createElement(FixedHolder, _extends({}, fixedHolderProps, {
|
|
608
|
+
stickyBottomOffset: offsetSummary,
|
|
609
|
+
className: "".concat(prefixCls, "-summary"),
|
|
610
|
+
ref: scrollSummaryRef,
|
|
611
|
+
colGroup: bodyColGroup
|
|
612
|
+
}), renderFixedFooterTable), isSticky && scrollBodyRef.current && scrollBodyRef.current instanceof Element && /*#__PURE__*/React.createElement(StickyScrollBar, {
|
|
613
|
+
ref: stickyRef,
|
|
614
|
+
offsetScroll: offsetScroll,
|
|
615
|
+
scrollBodyRef: scrollBodyRef,
|
|
616
|
+
onScroll: onInternalScroll,
|
|
617
|
+
container: container
|
|
618
|
+
// Only compared against `'rtl'` inside `StickyScrollBar`, so the
|
|
619
|
+
// `'ltr'` fallback behaves exactly like `undefined`.
|
|
620
|
+
,
|
|
621
|
+
direction: direction !== null && direction !== void 0 ? direction : 'ltr'
|
|
622
|
+
}));
|
|
623
|
+
} else {
|
|
624
|
+
// >>>>>> Unique table
|
|
625
|
+
groupTableNode = /*#__PURE__*/React.createElement("div", {
|
|
626
|
+
style: _objectSpread(_objectSpread(_objectSpread({}, scrollXStyle), scrollYStyle), styles === null || styles === void 0 ? void 0 : styles.content),
|
|
627
|
+
className: clsx("".concat(prefixCls, "-content"), classNames === null || classNames === void 0 ? void 0 : classNames.content),
|
|
628
|
+
onScroll: onInternalScroll,
|
|
629
|
+
ref: scrollBodyRef
|
|
630
|
+
}, /*#__PURE__*/React.createElement(TableComponent, _extends({
|
|
631
|
+
style: _objectSpread(_objectSpread({}, scrollTableStyle), {}, {
|
|
632
|
+
tableLayout: mergedTableLayout
|
|
633
|
+
})
|
|
634
|
+
}, ariaProps), captionElement, bodyColGroup, showHeader !== false && /*#__PURE__*/React.createElement(Header, _extends({}, headerProps, columnContext)), bodyTable, summaryNode && /*#__PURE__*/React.createElement(Footer, {
|
|
635
|
+
stickyOffsets: stickyOffsets,
|
|
636
|
+
flattenColumns: flattenColumns
|
|
637
|
+
}, summaryNode)));
|
|
638
|
+
}
|
|
639
|
+
var tableStyle = _objectSpread({}, style);
|
|
640
|
+
|
|
641
|
+
// Add css var for sticky header `zIndex` calc
|
|
642
|
+
if (isSticky) {
|
|
643
|
+
tableStyle['--columns-count'] = flattenColumns.length;
|
|
644
|
+
}
|
|
645
|
+
var fullTable = /*#__PURE__*/React.createElement("div", _extends({
|
|
646
|
+
className: clsx(prefixCls, className, (_clsx = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_clsx, "".concat(prefixCls, "-rtl"), direction === 'rtl'), "".concat(prefixCls, "-fix-start-shadow"), horizonScroll), "".concat(prefixCls, "-fix-end-shadow"), horizonScroll), "".concat(prefixCls, "-fix-start-shadow-show"), horizonScroll && shadowStart), "".concat(prefixCls, "-fix-end-shadow-show"), horizonScroll && shadowEnd), "".concat(prefixCls, "-layout-fixed"), tableLayout === 'fixed'), "".concat(prefixCls, "-fixed-header"), fixHeader), "".concat(prefixCls, "-fixed-column"), fixColumn), "".concat(prefixCls, "-scroll-horizontal"), horizonScroll), "".concat(prefixCls, "-has-fix-start"), (_flattenColumns$ = flattenColumns[0]) === null || _flattenColumns$ === void 0 ? void 0 : _flattenColumns$.fixed), _defineProperty(_clsx, "".concat(prefixCls, "-has-fix-end"), ((_flattenColumns = flattenColumns[flattenColumns.length - 1]) === null || _flattenColumns === void 0 ? void 0 : _flattenColumns.fixed) === 'end'))),
|
|
647
|
+
style: tableStyle,
|
|
648
|
+
id: id,
|
|
649
|
+
ref: fullTableRef
|
|
650
|
+
}, dataProps), title && /*#__PURE__*/React.createElement(Panel, {
|
|
651
|
+
className: clsx("".concat(prefixCls, "-title"), classNames === null || classNames === void 0 ? void 0 : classNames.title),
|
|
652
|
+
style: (_styles$title = styles === null || styles === void 0 ? void 0 : styles.title) !== null && _styles$title !== void 0 ? _styles$title : {}
|
|
653
|
+
}, title(mergedData)), /*#__PURE__*/React.createElement("div", {
|
|
654
|
+
ref: scrollBodyContainerRef,
|
|
655
|
+
className: clsx("".concat(prefixCls, "-container"), classNames === null || classNames === void 0 ? void 0 : classNames.section),
|
|
656
|
+
style: styles === null || styles === void 0 ? void 0 : styles.section
|
|
657
|
+
}, groupTableNode), footer && /*#__PURE__*/React.createElement(Panel, {
|
|
658
|
+
className: clsx("".concat(prefixCls, "-footer"), classNames === null || classNames === void 0 ? void 0 : classNames.footer),
|
|
659
|
+
style: (_styles$footer = styles === null || styles === void 0 ? void 0 : styles.footer) !== null && _styles$footer !== void 0 ? _styles$footer : {}
|
|
660
|
+
}, footer(mergedData)));
|
|
661
|
+
if (horizonScroll) {
|
|
662
|
+
fullTable = /*#__PURE__*/React.createElement(ResizeObserver, {
|
|
663
|
+
onResize: function onResize(_ref7) {
|
|
664
|
+
var offsetWidth = _ref7.offsetWidth;
|
|
665
|
+
return onFullTableResize(offsetWidth);
|
|
666
|
+
}
|
|
667
|
+
}, fullTable);
|
|
668
|
+
}
|
|
669
|
+
var fixedInfoList = useFixedInfo(flattenColumns, stickyOffsets);
|
|
670
|
+
var TableContextValue = React.useMemo(function () {
|
|
671
|
+
return {
|
|
672
|
+
// Scroll
|
|
673
|
+
scrollX: mergedScrollX,
|
|
674
|
+
scrollInfo: scrollInfo,
|
|
675
|
+
classNames: classNames,
|
|
676
|
+
styles: styles,
|
|
677
|
+
// Table
|
|
678
|
+
prefixCls: prefixCls,
|
|
679
|
+
getComponent: getComponent,
|
|
680
|
+
scrollbarSize: scrollbarSize,
|
|
681
|
+
direction: direction,
|
|
682
|
+
fixedInfoList: fixedInfoList,
|
|
683
|
+
isSticky: isSticky,
|
|
684
|
+
componentWidth: componentWidth,
|
|
685
|
+
fixHeader: fixHeader,
|
|
686
|
+
fixColumn: fixColumn,
|
|
687
|
+
horizonScroll: horizonScroll,
|
|
688
|
+
// Body
|
|
689
|
+
tableLayout: mergedTableLayout,
|
|
690
|
+
rowClassName: rowClassName,
|
|
691
|
+
expandedRowClassName: expandableConfig.expandedRowClassName,
|
|
692
|
+
expandIcon: mergedExpandIcon,
|
|
693
|
+
expandableType: expandableType,
|
|
694
|
+
expandRowByClick: expandableConfig.expandRowByClick,
|
|
695
|
+
expandedRowRender: expandableConfig.expandedRowRender,
|
|
696
|
+
expandedRowOffset: expandableConfig.expandedRowOffset,
|
|
697
|
+
onTriggerExpand: onTriggerExpand,
|
|
698
|
+
expandIconColumnIndex: expandableConfig.expandIconColumnIndex,
|
|
699
|
+
indentSize: expandableConfig.indentSize,
|
|
700
|
+
allColumnsFixedLeft: flattenColumns.every(function (col) {
|
|
701
|
+
return col.fixed === 'start';
|
|
702
|
+
}),
|
|
703
|
+
emptyNode: emptyNode,
|
|
704
|
+
// Column
|
|
705
|
+
columns: columns,
|
|
706
|
+
flattenColumns: flattenColumns,
|
|
707
|
+
onColumnResize: onColumnResize,
|
|
708
|
+
colWidths: colWidths,
|
|
709
|
+
// Row
|
|
710
|
+
hoverStartRow: startRow,
|
|
711
|
+
hoverEndRow: endRow,
|
|
712
|
+
onHover: onHover,
|
|
713
|
+
rowExpandable: expandableConfig.rowExpandable,
|
|
714
|
+
onRow: onRow,
|
|
715
|
+
getRowKey: getRowKey,
|
|
716
|
+
expandedKeys: mergedExpandedKeys,
|
|
717
|
+
childrenColumnName: mergedChildrenColumnName,
|
|
718
|
+
rowHoverable: rowHoverable,
|
|
719
|
+
// Measure Row
|
|
720
|
+
measureRowRender: measureRowRender
|
|
721
|
+
};
|
|
722
|
+
}, [
|
|
723
|
+
// Scroll
|
|
724
|
+
mergedScrollX, scrollInfo, classNames, styles,
|
|
725
|
+
// Table
|
|
726
|
+
prefixCls, getComponent, scrollbarSize, direction, fixedInfoList, isSticky, componentWidth, fixHeader, fixColumn, horizonScroll,
|
|
727
|
+
// Body
|
|
728
|
+
mergedTableLayout, rowClassName, expandableConfig.expandedRowClassName, mergedExpandIcon, expandableType, expandableConfig.expandRowByClick, expandableConfig.expandedRowRender, expandableConfig.expandedRowOffset, onTriggerExpand, expandableConfig.expandIconColumnIndex, expandableConfig.indentSize, emptyNode,
|
|
729
|
+
// Column
|
|
730
|
+
columns, flattenColumns, onColumnResize, colWidths,
|
|
731
|
+
// Row
|
|
732
|
+
startRow, endRow, onHover, expandableConfig.rowExpandable, onRow, getRowKey, mergedExpandedKeys, mergedChildrenColumnName, rowHoverable, measureRowRender]);
|
|
733
|
+
return (
|
|
734
|
+
/*#__PURE__*/
|
|
735
|
+
// Several fields (e.g. `scrollX`, `direction`, `indentSize`) can be
|
|
736
|
+
// `undefined` at runtime and all context consumers already guard them;
|
|
737
|
+
// the context type (declared outside this file) marks them required.
|
|
738
|
+
React.createElement(TableContext.Provider, {
|
|
739
|
+
value: TableContextValue
|
|
740
|
+
}, fullTable)
|
|
741
|
+
);
|
|
742
|
+
};
|
|
743
|
+
var RefTable = /*#__PURE__*/React.forwardRef(Table);
|
|
744
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
745
|
+
RefTable.displayName = 'Table';
|
|
746
|
+
}
|
|
747
|
+
export var genTable = function genTable(shouldTriggerRender) {
|
|
748
|
+
return makeImmutable(RefTable, shouldTriggerRender);
|
|
749
|
+
};
|
|
750
|
+
var RcTable = genTable(function (prev, next) {
|
|
751
|
+
var _ref8 = prev,
|
|
752
|
+
prevRenderTimes = _ref8._renderTimes;
|
|
753
|
+
var _ref9 = next,
|
|
754
|
+
nextRenderTimes = _ref9._renderTimes;
|
|
755
|
+
return prevRenderTimes !== nextRenderTimes;
|
|
756
|
+
});
|
|
757
|
+
export default RcTable;
|