@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,196 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
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); }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
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); }
|
|
8
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
+
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."); }
|
|
10
|
+
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); }
|
|
11
|
+
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; }
|
|
12
|
+
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; } }
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
import { useContext } from "../../../_util/context";
|
|
15
|
+
import { clsx } from 'clsx';
|
|
16
|
+
import * as React from 'react';
|
|
17
|
+
import TableContext from "../../shared/context/TableContext";
|
|
18
|
+
import devRenderTimes from "../../shared/hooks/useRenderTimes";
|
|
19
|
+
import useCellRender from "./useCellRender";
|
|
20
|
+
import useHoverState from "./useHoverState";
|
|
21
|
+
import useEvent from "../../../_util/hooks/useEvent";
|
|
22
|
+
var getTitleFromCellRenderChildren = function getTitleFromCellRenderChildren(_ref) {
|
|
23
|
+
var ellipsis = _ref.ellipsis,
|
|
24
|
+
rowType = _ref.rowType,
|
|
25
|
+
children = _ref.children;
|
|
26
|
+
var title;
|
|
27
|
+
var ellipsisConfig = ellipsis === true ? {
|
|
28
|
+
showTitle: true
|
|
29
|
+
} : ellipsis;
|
|
30
|
+
if (ellipsisConfig && (ellipsisConfig.showTitle || rowType === 'header')) {
|
|
31
|
+
var _children$props;
|
|
32
|
+
if (typeof children === 'string' || typeof children === 'number') {
|
|
33
|
+
title = children.toString();
|
|
34
|
+
} else if ( /*#__PURE__*/React.isValidElement(children) && typeof ((_children$props = children.props) === null || _children$props === void 0 ? void 0 : _children$props.children) === 'string') {
|
|
35
|
+
var _children$props2;
|
|
36
|
+
title = (_children$props2 = children.props) === null || _children$props2 === void 0 ? void 0 : _children$props2.children;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return title;
|
|
40
|
+
};
|
|
41
|
+
var Cell = function Cell(props) {
|
|
42
|
+
var _ref3, _ref4, _legacyCellProps$colS, _ref5, _ref6, _legacyCellProps$rowS, _additionalProps$titl, _clsx;
|
|
43
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
44
|
+
devRenderTimes(props);
|
|
45
|
+
}
|
|
46
|
+
var children = props.children,
|
|
47
|
+
ellipsis = props.ellipsis,
|
|
48
|
+
scope = props.scope,
|
|
49
|
+
prefixCls = props.prefixCls,
|
|
50
|
+
className = props.className,
|
|
51
|
+
style = props.style,
|
|
52
|
+
align = props.align,
|
|
53
|
+
record = props.record,
|
|
54
|
+
render = props.render,
|
|
55
|
+
dataIndex = props.dataIndex,
|
|
56
|
+
renderIndex = props.renderIndex,
|
|
57
|
+
shouldCellUpdate = props.shouldCellUpdate,
|
|
58
|
+
index = props.index,
|
|
59
|
+
rowType = props.rowType,
|
|
60
|
+
colSpan = props.colSpan,
|
|
61
|
+
rowSpan = props.rowSpan,
|
|
62
|
+
fixStart = props.fixStart,
|
|
63
|
+
fixEnd = props.fixEnd,
|
|
64
|
+
fixedStartShadow = props.fixedStartShadow,
|
|
65
|
+
fixedEndShadow = props.fixedEndShadow,
|
|
66
|
+
offsetFixedStartShadow = props.offsetFixedStartShadow,
|
|
67
|
+
offsetFixedEndShadow = props.offsetFixedEndShadow,
|
|
68
|
+
zIndex = props.zIndex,
|
|
69
|
+
zIndexReverse = props.zIndexReverse,
|
|
70
|
+
appendNode = props.appendNode,
|
|
71
|
+
_props$additionalProp = props.additionalProps,
|
|
72
|
+
additionalProps = _props$additionalProp === void 0 ? {} : _props$additionalProp,
|
|
73
|
+
isSticky = props.isSticky;
|
|
74
|
+
|
|
75
|
+
// `component` is optional in props but is always provided by call sites when rendering
|
|
76
|
+
var Component = props.component;
|
|
77
|
+
var cellPrefixCls = "".concat(prefixCls, "-cell");
|
|
78
|
+
var _useContext = useContext(TableContext, ['allColumnsFixedLeft', 'rowHoverable']),
|
|
79
|
+
allColumnsFixedLeft = _useContext.allColumnsFixedLeft,
|
|
80
|
+
rowHoverable = _useContext.rowHoverable;
|
|
81
|
+
|
|
82
|
+
// ====================== Value =======================
|
|
83
|
+
var _useCellRender = useCellRender(record, dataIndex, renderIndex, children, render, shouldCellUpdate),
|
|
84
|
+
_useCellRender2 = _slicedToArray(_useCellRender, 2),
|
|
85
|
+
childNode = _useCellRender2[0],
|
|
86
|
+
legacyCellProps = _useCellRender2[1];
|
|
87
|
+
|
|
88
|
+
// ====================== Fixed =======================
|
|
89
|
+
var fixedStyle = {};
|
|
90
|
+
var isFixStart = typeof fixStart === 'number' && !allColumnsFixedLeft;
|
|
91
|
+
var isFixEnd = typeof fixEnd === 'number' && !allColumnsFixedLeft;
|
|
92
|
+
var _useContext2 = useContext(TableContext, function (_ref2) {
|
|
93
|
+
var scrollInfo = _ref2.scrollInfo;
|
|
94
|
+
if (!isFixStart && !isFixEnd) {
|
|
95
|
+
return [false, false];
|
|
96
|
+
}
|
|
97
|
+
var _scrollInfo = _slicedToArray(scrollInfo, 2),
|
|
98
|
+
absScroll = _scrollInfo[0],
|
|
99
|
+
scrollWidth = _scrollInfo[1];
|
|
100
|
+
var showStartShadow = isFixStart && fixedStartShadow && absScroll - (offsetFixedStartShadow || 0) >= 1;
|
|
101
|
+
var showEndShadow = isFixEnd && fixedEndShadow && scrollWidth - absScroll - (offsetFixedEndShadow || 0) > 1;
|
|
102
|
+
return [showStartShadow, showEndShadow];
|
|
103
|
+
}),
|
|
104
|
+
_useContext3 = _slicedToArray(_useContext2, 2),
|
|
105
|
+
showFixStartShadow = _useContext3[0],
|
|
106
|
+
showFixEndShadow = _useContext3[1];
|
|
107
|
+
if (isFixStart) {
|
|
108
|
+
fixedStyle.insetInlineStart = fixStart;
|
|
109
|
+
fixedStyle['--z-offset'] = zIndex;
|
|
110
|
+
fixedStyle['--z-offset-reverse'] = zIndexReverse;
|
|
111
|
+
}
|
|
112
|
+
if (isFixEnd) {
|
|
113
|
+
fixedStyle.insetInlineEnd = fixEnd;
|
|
114
|
+
fixedStyle['--z-offset'] = zIndex;
|
|
115
|
+
fixedStyle['--z-offset-reverse'] = zIndexReverse;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// ================ RowSpan & ColSpan =================
|
|
119
|
+
var mergedColSpan = (_ref3 = (_ref4 = (_legacyCellProps$colS = legacyCellProps === null || legacyCellProps === void 0 ? void 0 : legacyCellProps.colSpan) !== null && _legacyCellProps$colS !== void 0 ? _legacyCellProps$colS : additionalProps.colSpan) !== null && _ref4 !== void 0 ? _ref4 : colSpan) !== null && _ref3 !== void 0 ? _ref3 : 1;
|
|
120
|
+
var mergedRowSpan = (_ref5 = (_ref6 = (_legacyCellProps$rowS = legacyCellProps === null || legacyCellProps === void 0 ? void 0 : legacyCellProps.rowSpan) !== null && _legacyCellProps$rowS !== void 0 ? _legacyCellProps$rowS : additionalProps.rowSpan) !== null && _ref6 !== void 0 ? _ref6 : rowSpan) !== null && _ref5 !== void 0 ? _ref5 : 1;
|
|
121
|
+
|
|
122
|
+
// ====================== Hover =======================
|
|
123
|
+
var _useHoverState = useHoverState(index, mergedRowSpan),
|
|
124
|
+
_useHoverState2 = _slicedToArray(_useHoverState, 2),
|
|
125
|
+
hovering = _useHoverState2[0],
|
|
126
|
+
onHover = _useHoverState2[1];
|
|
127
|
+
var onMouseEnter = useEvent(function (event) {
|
|
128
|
+
var _additionalProps$onMo;
|
|
129
|
+
if (record && index !== undefined) {
|
|
130
|
+
onHover(index, index + mergedRowSpan - 1);
|
|
131
|
+
}
|
|
132
|
+
additionalProps === null || additionalProps === void 0 || (_additionalProps$onMo = additionalProps.onMouseEnter) === null || _additionalProps$onMo === void 0 || _additionalProps$onMo.call(additionalProps, event);
|
|
133
|
+
});
|
|
134
|
+
var onMouseLeave = useEvent(function (event) {
|
|
135
|
+
var _additionalProps$onMo2;
|
|
136
|
+
if (record) {
|
|
137
|
+
onHover(-1, -1);
|
|
138
|
+
}
|
|
139
|
+
additionalProps === null || additionalProps === void 0 || (_additionalProps$onMo2 = additionalProps.onMouseLeave) === null || _additionalProps$onMo2 === void 0 || _additionalProps$onMo2.call(additionalProps, event);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
// ====================== Render ======================
|
|
143
|
+
if (mergedColSpan === 0 || mergedRowSpan === 0) {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// >>>>> Title
|
|
148
|
+
var title = (_additionalProps$titl = additionalProps.title) !== null && _additionalProps$titl !== void 0 ? _additionalProps$titl : getTitleFromCellRenderChildren({
|
|
149
|
+
rowType: rowType,
|
|
150
|
+
ellipsis: ellipsis,
|
|
151
|
+
children: childNode
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// >>>>> ClassName
|
|
155
|
+
var mergedClassName = clsx(cellPrefixCls, className, (_clsx = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_clsx, "".concat(cellPrefixCls, "-fix"), isFixStart || isFixEnd), "".concat(cellPrefixCls, "-fix-start"), isFixStart), "".concat(cellPrefixCls, "-fix-end"), isFixEnd), "".concat(cellPrefixCls, "-fix-start-shadow"), fixedStartShadow), "".concat(cellPrefixCls, "-fix-start-shadow-show"), fixedStartShadow && showFixStartShadow), "".concat(cellPrefixCls, "-fix-end-shadow"), fixedEndShadow), "".concat(cellPrefixCls, "-fix-end-shadow-show"), fixedEndShadow && showFixEndShadow), "".concat(cellPrefixCls, "-ellipsis"), ellipsis), "".concat(cellPrefixCls, "-with-append"), appendNode), "".concat(cellPrefixCls, "-fix-sticky"), (isFixStart || isFixEnd) && isSticky), _defineProperty(_clsx, "".concat(cellPrefixCls, "-row-hover"), !legacyCellProps && hovering)), additionalProps.className, legacyCellProps === null || legacyCellProps === void 0 ? void 0 : legacyCellProps.className);
|
|
156
|
+
|
|
157
|
+
// >>>>> Style
|
|
158
|
+
var alignStyle = {};
|
|
159
|
+
if (align) {
|
|
160
|
+
alignStyle.textAlign = align;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// The order is important since user can overwrite style.
|
|
164
|
+
// For example ant-design/ant-design#51763
|
|
165
|
+
var mergedStyle = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, legacyCellProps === null || legacyCellProps === void 0 ? void 0 : legacyCellProps.style), fixedStyle), alignStyle), additionalProps.style), style);
|
|
166
|
+
|
|
167
|
+
// >>>>> Children Node
|
|
168
|
+
var mergedChildNode = childNode;
|
|
169
|
+
|
|
170
|
+
// Not crash if final `childNode` is not validate ReactNode
|
|
171
|
+
if (_typeof(mergedChildNode) === 'object' && !Array.isArray(mergedChildNode) && ! /*#__PURE__*/React.isValidElement(mergedChildNode)) {
|
|
172
|
+
mergedChildNode = null;
|
|
173
|
+
}
|
|
174
|
+
if (ellipsis && (fixedStartShadow || fixedEndShadow)) {
|
|
175
|
+
mergedChildNode = /*#__PURE__*/React.createElement("span", {
|
|
176
|
+
className: "".concat(cellPrefixCls, "-content")
|
|
177
|
+
}, mergedChildNode);
|
|
178
|
+
}
|
|
179
|
+
return /*#__PURE__*/React.createElement(Component, _extends({}, legacyCellProps, additionalProps, {
|
|
180
|
+
className: mergedClassName,
|
|
181
|
+
style: mergedStyle
|
|
182
|
+
// A11y
|
|
183
|
+
,
|
|
184
|
+
title: title,
|
|
185
|
+
scope: scope
|
|
186
|
+
// Hover
|
|
187
|
+
,
|
|
188
|
+
onMouseEnter: rowHoverable ? onMouseEnter : undefined,
|
|
189
|
+
onMouseLeave: rowHoverable ? onMouseLeave : undefined
|
|
190
|
+
//Span
|
|
191
|
+
,
|
|
192
|
+
colSpan: mergedColSpan !== 1 ? mergedColSpan : undefined,
|
|
193
|
+
rowSpan: mergedRowSpan !== 1 ? mergedRowSpan : undefined
|
|
194
|
+
}), appendNode, mergedChildNode);
|
|
195
|
+
};
|
|
196
|
+
export default /*#__PURE__*/React.memo(Cell);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { CellType, ColumnType, DataIndex } from '../../interface';
|
|
3
|
+
export default function useCellRender<RecordType>(record: RecordType, dataIndex: DataIndex<RecordType> | undefined, renderIndex: number, children?: React.ReactNode, render?: ColumnType<RecordType>['render'], shouldCellUpdate?: ColumnType<RecordType>['shouldCellUpdate']): [React.ReactNode, CellType<RecordType> | undefined] | [React.ReactNode];
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
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); }
|
|
8
|
+
import getValue from 'rc-util/lib/utils/get';
|
|
9
|
+
import isEqual from 'rc-util/lib/isEqual';
|
|
10
|
+
import useMemo from 'rc-util/lib/hooks/useMemo';
|
|
11
|
+
import warning from 'rc-util/lib/warning';
|
|
12
|
+
import * as React from 'react';
|
|
13
|
+
import PerfContext from "../../shared/context/PerfContext";
|
|
14
|
+
import { validateValue } from "../../shared/utils/valueUtil";
|
|
15
|
+
import { useImmutableMark } from "../../shared/context/TableContext";
|
|
16
|
+
function isRenderCell(data) {
|
|
17
|
+
return !!data && _typeof(data) === 'object' && !Array.isArray(data) && ! /*#__PURE__*/React.isValidElement(data);
|
|
18
|
+
}
|
|
19
|
+
export default function useCellRender(record, dataIndex, renderIndex, children, render, shouldCellUpdate) {
|
|
20
|
+
// TODO: Remove this after next major version
|
|
21
|
+
var perfRecord = React.useContext(PerfContext);
|
|
22
|
+
var mark = useImmutableMark();
|
|
23
|
+
|
|
24
|
+
// ======================== Render ========================
|
|
25
|
+
var retData = useMemo(function () {
|
|
26
|
+
if (validateValue(children)) {
|
|
27
|
+
return [children];
|
|
28
|
+
}
|
|
29
|
+
var path = dataIndex === null || dataIndex === undefined || dataIndex === '' ? [] : Array.isArray(dataIndex) ? dataIndex : [dataIndex];
|
|
30
|
+
var value = getValue(record, path);
|
|
31
|
+
|
|
32
|
+
// Customize render node
|
|
33
|
+
var returnChildNode = value;
|
|
34
|
+
var returnCellProps;
|
|
35
|
+
if (render) {
|
|
36
|
+
var renderData = render(value, record, renderIndex);
|
|
37
|
+
if (isRenderCell(renderData)) {
|
|
38
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
39
|
+
warning(false, '`columns.render` return cell props is deprecated with perf issue, please use `onCell` instead.');
|
|
40
|
+
}
|
|
41
|
+
returnChildNode = renderData.children;
|
|
42
|
+
returnCellProps = renderData.props;
|
|
43
|
+
perfRecord.renderWithProps = true;
|
|
44
|
+
} else {
|
|
45
|
+
returnChildNode = renderData;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return [returnChildNode, returnCellProps];
|
|
49
|
+
}, [
|
|
50
|
+
// Force update deps
|
|
51
|
+
mark,
|
|
52
|
+
// Normal deps
|
|
53
|
+
record, children, dataIndex, render, renderIndex], function (prev, next) {
|
|
54
|
+
if (shouldCellUpdate) {
|
|
55
|
+
var _prev = _slicedToArray(prev, 2),
|
|
56
|
+
prevRecord = _prev[1];
|
|
57
|
+
var _next = _slicedToArray(next, 2),
|
|
58
|
+
nextRecord = _next[1];
|
|
59
|
+
return shouldCellUpdate(nextRecord, prevRecord);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Legacy mode should always update
|
|
63
|
+
if (perfRecord.renderWithProps) {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
return !isEqual(prev, next, true);
|
|
67
|
+
});
|
|
68
|
+
return retData;
|
|
69
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useContext } from "../../../_util/context";
|
|
2
|
+
import TableContext from "../../shared/context/TableContext";
|
|
3
|
+
/** Check if cell is in hover range */
|
|
4
|
+
function inHoverRange(cellStartRow, cellRowSpan, startRow, endRow) {
|
|
5
|
+
var cellEndRow = cellStartRow + cellRowSpan - 1;
|
|
6
|
+
return cellStartRow <= endRow && cellEndRow >= startRow;
|
|
7
|
+
}
|
|
8
|
+
export default function useHoverState(rowIndex, rowSpan) {
|
|
9
|
+
return useContext(TableContext, function (ctx) {
|
|
10
|
+
var hovering = inHoverRange(rowIndex, rowSpan || 1, ctx.hoverStartRow, ctx.hoverEndRow);
|
|
11
|
+
return [hovering, ctx.onHover];
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ColumnType } from '../interface';
|
|
3
|
+
export interface ColGroupProps<RecordType> {
|
|
4
|
+
colWidths: readonly (number | string)[];
|
|
5
|
+
columns?: readonly ColumnType<RecordType>[];
|
|
6
|
+
columCount?: number;
|
|
7
|
+
}
|
|
8
|
+
declare const ColGroup: <RecordType>(props: ColGroupProps<RecordType>) => React.JSX.Element | null;
|
|
9
|
+
export default ColGroup;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var _excluded = ["columnType"];
|
|
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 _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { INTERNAL_COL_DEFINE } from "../shared/utils/legacyUtil";
|
|
7
|
+
import { useContext } from "../../_util/context";
|
|
8
|
+
import TableContext from "../shared/context/TableContext";
|
|
9
|
+
|
|
10
|
+
/** Column injected with internal col props by internal features (e.g. expandable, selection) */
|
|
11
|
+
|
|
12
|
+
var ColGroup = function ColGroup(props) {
|
|
13
|
+
var colWidths = props.colWidths,
|
|
14
|
+
columns = props.columns,
|
|
15
|
+
columCount = props.columCount;
|
|
16
|
+
var _useContext = useContext(TableContext, ['tableLayout']),
|
|
17
|
+
tableLayout = _useContext.tableLayout;
|
|
18
|
+
var cols = [];
|
|
19
|
+
var len = columCount || (columns === null || columns === void 0 ? void 0 : columns.length) || 0;
|
|
20
|
+
|
|
21
|
+
// Only insert col with width & additional props
|
|
22
|
+
// Skip if rest col do not have any useful info
|
|
23
|
+
var mustInsert = false;
|
|
24
|
+
for (var i = len - 1; i >= 0; i -= 1) {
|
|
25
|
+
var width = colWidths[i];
|
|
26
|
+
var column = columns && columns[i];
|
|
27
|
+
var additionalProps = void 0;
|
|
28
|
+
var minWidth = void 0;
|
|
29
|
+
if (column) {
|
|
30
|
+
additionalProps = column[INTERNAL_COL_DEFINE];
|
|
31
|
+
|
|
32
|
+
// fixed will cause layout problems
|
|
33
|
+
if (tableLayout === 'auto') {
|
|
34
|
+
minWidth = column.minWidth;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (width || minWidth || additionalProps || mustInsert) {
|
|
38
|
+
var _ref = additionalProps || {},
|
|
39
|
+
columnType = _ref.columnType,
|
|
40
|
+
restAdditionalProps = _objectWithoutProperties(_ref, _excluded);
|
|
41
|
+
cols.unshift( /*#__PURE__*/React.createElement("col", _extends({
|
|
42
|
+
key: i,
|
|
43
|
+
style: {
|
|
44
|
+
width: width,
|
|
45
|
+
minWidth: minWidth
|
|
46
|
+
}
|
|
47
|
+
}, restAdditionalProps)));
|
|
48
|
+
mustInsert = true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return cols.length > 0 ? /*#__PURE__*/React.createElement("colgroup", null, cols) : null;
|
|
52
|
+
};
|
|
53
|
+
export default ColGroup;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { AnyObject } from '../../_util/type';
|
|
3
|
+
import type { TableLocale } from '../interface';
|
|
4
|
+
interface DefaultExpandIconProps<RecordType = AnyObject> {
|
|
5
|
+
prefixCls: string;
|
|
6
|
+
record: RecordType;
|
|
7
|
+
expanded: boolean;
|
|
8
|
+
expandable: boolean;
|
|
9
|
+
onExpand: (record: RecordType, e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
10
|
+
}
|
|
11
|
+
declare function renderExpandIcon(locale: TableLocale): <RecordType extends AnyObject = AnyObject>(props: DefaultExpandIconProps<RecordType>) => React.JSX.Element;
|
|
12
|
+
export default renderExpandIcon;
|
|
@@ -0,0 +1,27 @@
|
|
|
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 _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; }
|
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
4
|
+
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); }
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { clsx } from 'clsx';
|
|
7
|
+
function renderExpandIcon(locale) {
|
|
8
|
+
return function (props) {
|
|
9
|
+
var prefixCls = props.prefixCls,
|
|
10
|
+
onExpand = props.onExpand,
|
|
11
|
+
record = props.record,
|
|
12
|
+
expanded = props.expanded,
|
|
13
|
+
expandable = props.expandable;
|
|
14
|
+
var iconPrefix = "".concat(prefixCls, "-row-expand-icon");
|
|
15
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
16
|
+
type: "button",
|
|
17
|
+
onClick: function onClick(e) {
|
|
18
|
+
onExpand(record, e);
|
|
19
|
+
e.stopPropagation();
|
|
20
|
+
},
|
|
21
|
+
className: clsx(iconPrefix, _defineProperty(_defineProperty(_defineProperty({}, "".concat(iconPrefix, "-spaced"), !expandable), "".concat(iconPrefix, "-expanded"), expandable && expanded), "".concat(iconPrefix, "-collapsed"), expandable && !expanded)),
|
|
22
|
+
"aria-label": expanded ? locale.collapse : locale.expand,
|
|
23
|
+
"aria-expanded": expanded
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export default renderExpandIcon;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { HeaderProps } from '../Header/Header';
|
|
3
|
+
import type { Direction, TableLayout } from '../../interface';
|
|
4
|
+
export interface FixedHeaderProps<RecordType> extends HeaderProps<RecordType> {
|
|
5
|
+
className: string;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
noData: boolean;
|
|
8
|
+
maxContentScroll: boolean;
|
|
9
|
+
colWidths: readonly number[];
|
|
10
|
+
columCount: number;
|
|
11
|
+
direction: Direction;
|
|
12
|
+
fixHeader: boolean;
|
|
13
|
+
stickyTopOffset?: number;
|
|
14
|
+
stickyBottomOffset?: number;
|
|
15
|
+
stickyClassName?: string;
|
|
16
|
+
scrollX?: number | string | true;
|
|
17
|
+
tableLayout?: TableLayout;
|
|
18
|
+
onScroll: (info: {
|
|
19
|
+
currentTarget: HTMLDivElement;
|
|
20
|
+
scrollLeft?: number;
|
|
21
|
+
}) => void;
|
|
22
|
+
children: (info: HeaderProps<RecordType>) => React.ReactNode;
|
|
23
|
+
colGroup?: React.ReactNode;
|
|
24
|
+
}
|
|
25
|
+
/** Return a table in div as fixed element which contains sticky info */
|
|
26
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<FixedHeaderProps<any> & React.RefAttributes<HTMLDivElement>>>;
|
|
27
|
+
export default _default;
|
|
@@ -0,0 +1,186 @@
|
|
|
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
|
+
var _excluded = ["className", "style", "noData", "columns", "flattenColumns", "colWidths", "colGroup", "columCount", "stickyOffsets", "direction", "fixHeader", "stickyTopOffset", "stickyBottomOffset", "stickyClassName", "scrollX", "tableLayout", "onScroll", "maxContentScroll", "children"];
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
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); }
|
|
8
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
9
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
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); }
|
|
11
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
12
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
15
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
16
|
+
import { useContext } from "../../../_util/context";
|
|
17
|
+
import { clsx } from 'clsx';
|
|
18
|
+
import { fillRef } from 'rc-util/lib/ref';
|
|
19
|
+
import * as React from 'react';
|
|
20
|
+
import { useMemo } from 'react';
|
|
21
|
+
import ColGroup from "../ColGroup";
|
|
22
|
+
import TableContext from "../../shared/context/TableContext";
|
|
23
|
+
import devRenderTimes from "../../shared/hooks/useRenderTimes";
|
|
24
|
+
function useColumnWidth(colWidths, columCount) {
|
|
25
|
+
return useMemo(function () {
|
|
26
|
+
var cloneColumns = [];
|
|
27
|
+
for (var i = 0; i < columCount; i += 1) {
|
|
28
|
+
var val = colWidths[i];
|
|
29
|
+
if (val !== undefined) {
|
|
30
|
+
cloneColumns[i] = val;
|
|
31
|
+
} else {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return cloneColumns;
|
|
36
|
+
}, [colWidths.join('_'), columCount]);
|
|
37
|
+
}
|
|
38
|
+
var FixedHolder = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
39
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
40
|
+
devRenderTimes(props);
|
|
41
|
+
}
|
|
42
|
+
var className = props.className,
|
|
43
|
+
style = props.style,
|
|
44
|
+
noData = props.noData,
|
|
45
|
+
columns = props.columns,
|
|
46
|
+
flattenColumns = props.flattenColumns,
|
|
47
|
+
colWidths = props.colWidths,
|
|
48
|
+
colGroup = props.colGroup,
|
|
49
|
+
columCount = props.columCount,
|
|
50
|
+
stickyOffsets = props.stickyOffsets,
|
|
51
|
+
direction = props.direction,
|
|
52
|
+
fixHeader = props.fixHeader,
|
|
53
|
+
stickyTopOffset = props.stickyTopOffset,
|
|
54
|
+
stickyBottomOffset = props.stickyBottomOffset,
|
|
55
|
+
stickyClassName = props.stickyClassName,
|
|
56
|
+
scrollX = props.scrollX,
|
|
57
|
+
_props$tableLayout = props.tableLayout,
|
|
58
|
+
tableLayout = _props$tableLayout === void 0 ? 'fixed' : _props$tableLayout,
|
|
59
|
+
onScroll = props.onScroll,
|
|
60
|
+
maxContentScroll = props.maxContentScroll,
|
|
61
|
+
children = props.children,
|
|
62
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
63
|
+
var _useContext = useContext(TableContext, ['prefixCls', 'scrollbarSize', 'isSticky', 'getComponent']),
|
|
64
|
+
prefixCls = _useContext.prefixCls,
|
|
65
|
+
scrollbarSize = _useContext.scrollbarSize,
|
|
66
|
+
isSticky = _useContext.isSticky,
|
|
67
|
+
getComponent = _useContext.getComponent;
|
|
68
|
+
var TableComponent = getComponent(['header', 'table'], 'table');
|
|
69
|
+
var combinationScrollBarSize = isSticky && !fixHeader ? 0 : scrollbarSize;
|
|
70
|
+
|
|
71
|
+
// Pass wheel to scroll event
|
|
72
|
+
var scrollRef = React.useRef(null);
|
|
73
|
+
var setScrollRef = React.useCallback(function (element) {
|
|
74
|
+
fillRef(ref, element);
|
|
75
|
+
fillRef(scrollRef, element);
|
|
76
|
+
}, []);
|
|
77
|
+
React.useEffect(function () {
|
|
78
|
+
function onWheel(e) {
|
|
79
|
+
var _ref = e,
|
|
80
|
+
currentTarget = _ref.currentTarget,
|
|
81
|
+
deltaX = _ref.deltaX;
|
|
82
|
+
if (deltaX) {
|
|
83
|
+
var scrollLeft = currentTarget.scrollLeft,
|
|
84
|
+
scrollWidth = currentTarget.scrollWidth,
|
|
85
|
+
clientWidth = currentTarget.clientWidth;
|
|
86
|
+
var maxScrollWidth = scrollWidth - clientWidth;
|
|
87
|
+
var nextScroll = scrollLeft + deltaX;
|
|
88
|
+
if (direction === 'rtl') {
|
|
89
|
+
nextScroll = Math.max(-maxScrollWidth, nextScroll);
|
|
90
|
+
nextScroll = Math.min(0, nextScroll);
|
|
91
|
+
} else {
|
|
92
|
+
nextScroll = Math.min(maxScrollWidth, nextScroll);
|
|
93
|
+
nextScroll = Math.max(0, nextScroll);
|
|
94
|
+
}
|
|
95
|
+
onScroll({
|
|
96
|
+
currentTarget: currentTarget,
|
|
97
|
+
scrollLeft: nextScroll
|
|
98
|
+
});
|
|
99
|
+
e.preventDefault();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
var scrollEle = scrollRef.current;
|
|
103
|
+
scrollEle === null || scrollEle === void 0 || scrollEle.addEventListener('wheel', onWheel, {
|
|
104
|
+
passive: false
|
|
105
|
+
});
|
|
106
|
+
return function () {
|
|
107
|
+
scrollEle === null || scrollEle === void 0 || scrollEle.removeEventListener('wheel', onWheel);
|
|
108
|
+
};
|
|
109
|
+
}, []);
|
|
110
|
+
|
|
111
|
+
// Add scrollbar column
|
|
112
|
+
var lastColumn = flattenColumns[flattenColumns.length - 1];
|
|
113
|
+
var ScrollBarColumn = {
|
|
114
|
+
fixed: lastColumn === null || lastColumn === void 0 ? void 0 : lastColumn.fixed,
|
|
115
|
+
scrollbar: true,
|
|
116
|
+
onHeaderCell: function onHeaderCell() {
|
|
117
|
+
return {
|
|
118
|
+
className: "".concat(prefixCls, "-cell-scrollbar")
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
var columnsWithScrollbar = useMemo(function () {
|
|
123
|
+
return combinationScrollBarSize ? [].concat(_toConsumableArray(columns), [ScrollBarColumn]) : columns;
|
|
124
|
+
}, [combinationScrollBarSize, columns]);
|
|
125
|
+
var flattenColumnsWithScrollbar = useMemo(function () {
|
|
126
|
+
return combinationScrollBarSize ? [].concat(_toConsumableArray(flattenColumns), [ScrollBarColumn]) : flattenColumns;
|
|
127
|
+
}, [combinationScrollBarSize, flattenColumns]);
|
|
128
|
+
|
|
129
|
+
// Calculate the sticky offsets
|
|
130
|
+
var headerStickyOffsets = useMemo(function () {
|
|
131
|
+
var start = stickyOffsets.start,
|
|
132
|
+
end = stickyOffsets.end;
|
|
133
|
+
return _objectSpread(_objectSpread({}, stickyOffsets), {}, {
|
|
134
|
+
// left:
|
|
135
|
+
// direction === 'rtl' ? [...left.map(width => width + combinationScrollBarSize), 0] : left,
|
|
136
|
+
// right:
|
|
137
|
+
// direction === 'rtl' ? right : [...right.map(width => width + combinationScrollBarSize), 0],
|
|
138
|
+
start: start,
|
|
139
|
+
end: [].concat(_toConsumableArray(end.map(function (width) {
|
|
140
|
+
return width + combinationScrollBarSize;
|
|
141
|
+
})), [0]),
|
|
142
|
+
isSticky: isSticky
|
|
143
|
+
});
|
|
144
|
+
}, [combinationScrollBarSize, stickyOffsets, isSticky]);
|
|
145
|
+
var mergedColumnWidth = useColumnWidth(colWidths, columCount);
|
|
146
|
+
var isColGroupEmpty = useMemo(function () {
|
|
147
|
+
// use original ColGroup if no data or no calculated column width, otherwise use calculated column width
|
|
148
|
+
// Return original colGroup if no data, or mergedColumnWidth is empty, or all widths are falsy
|
|
149
|
+
var noWidth = !mergedColumnWidth || !mergedColumnWidth.length || mergedColumnWidth.every(function (w) {
|
|
150
|
+
return !w;
|
|
151
|
+
});
|
|
152
|
+
return noData || noWidth;
|
|
153
|
+
}, [noData, mergedColumnWidth]);
|
|
154
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
155
|
+
style: _objectSpread(_objectSpread({
|
|
156
|
+
overflow: 'hidden'
|
|
157
|
+
}, isSticky ? {
|
|
158
|
+
top: stickyTopOffset,
|
|
159
|
+
bottom: stickyBottomOffset
|
|
160
|
+
} : {}), style),
|
|
161
|
+
ref: setScrollRef,
|
|
162
|
+
className: clsx(className, stickyClassName)
|
|
163
|
+
}, /*#__PURE__*/React.createElement(TableComponent, {
|
|
164
|
+
style: {
|
|
165
|
+
tableLayout: tableLayout,
|
|
166
|
+
minWidth: '100%',
|
|
167
|
+
// https://github.com/ant-design/ant-design/issues/54894
|
|
168
|
+
width: scrollX
|
|
169
|
+
}
|
|
170
|
+
}, isColGroupEmpty ? colGroup : /*#__PURE__*/React.createElement(ColGroup, {
|
|
171
|
+
colWidths: [].concat(_toConsumableArray(mergedColumnWidth || []), [combinationScrollBarSize]),
|
|
172
|
+
columCount: columCount + 1,
|
|
173
|
+
columns: flattenColumnsWithScrollbar
|
|
174
|
+
}), children(_objectSpread(_objectSpread({}, restProps), {}, {
|
|
175
|
+
stickyOffsets: headerStickyOffsets,
|
|
176
|
+
columns: columnsWithScrollbar,
|
|
177
|
+
flattenColumns: flattenColumnsWithScrollbar
|
|
178
|
+
}))));
|
|
179
|
+
});
|
|
180
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
181
|
+
FixedHolder.displayName = 'FixedHolder';
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** Return a table in div as fixed element which contains sticky info */
|
|
185
|
+
// export default responseImmutable(FixedHolder);
|
|
186
|
+
export default /*#__PURE__*/React.memo(FixedHolder);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { AlignType } from '../../interface';
|
|
3
|
+
export interface SummaryCellProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
index: number;
|
|
6
|
+
colSpan?: number;
|
|
7
|
+
rowSpan?: number;
|
|
8
|
+
align?: AlignType;
|
|
9
|
+
}
|
|
10
|
+
declare const SummaryCell: React.FC<React.PropsWithChildren<SummaryCellProps>>;
|
|
11
|
+
export default SummaryCell;
|