@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,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _VirtualTableBody = require("./VirtualTableBody");
|
|
8
|
+
/**
|
|
9
|
+
* Same as `rc-component/table` but we modify trigger children update logic instead.
|
|
10
|
+
*/
|
|
11
|
+
var RcVirtualTable = (0, _VirtualTableBody.genVirtualTable)(function (prev, next) {
|
|
12
|
+
var _ref = prev,
|
|
13
|
+
prevRenderTimes = _ref._renderTimes;
|
|
14
|
+
var _ref2 = next,
|
|
15
|
+
nextRenderTimes = _ref2._renderTimes;
|
|
16
|
+
return prevRenderTimes !== nextRenderTimes;
|
|
17
|
+
});
|
|
18
|
+
var _default = exports.default = RcVirtualTable;
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _context = require("../../../_util/context");
|
|
8
|
+
var _rcVirtualList = _interopRequireDefault(require("rc-virtual-list"));
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _TableContext = _interopRequireWildcard(require("../../shared/context/TableContext"));
|
|
11
|
+
var _useFlattenRecords = _interopRequireDefault(require("../../features/virtual/useFlattenRecords"));
|
|
12
|
+
var _BodyLine = _interopRequireDefault(require("./BodyLine"));
|
|
13
|
+
var _context2 = require("./context");
|
|
14
|
+
var _excluded = ["align", "offset"];
|
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
+
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); }
|
|
19
|
+
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; }
|
|
20
|
+
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; }
|
|
21
|
+
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; }
|
|
22
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
23
|
+
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); }
|
|
24
|
+
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; }
|
|
25
|
+
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; }
|
|
26
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
+
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."); }
|
|
28
|
+
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); }
|
|
29
|
+
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; }
|
|
30
|
+
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; } }
|
|
31
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
32
|
+
var ALIGN_MAP = {
|
|
33
|
+
start: 'top',
|
|
34
|
+
end: 'bottom',
|
|
35
|
+
nearest: 'auto'
|
|
36
|
+
};
|
|
37
|
+
var Grid = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
38
|
+
var data = props.data,
|
|
39
|
+
onScroll = props.onScroll;
|
|
40
|
+
var _useContext = (0, _context.useContext)(_TableContext.default, ['flattenColumns', 'onColumnResize', 'getRowKey', 'prefixCls', 'expandedKeys', 'childrenColumnName', 'scrollX', 'direction']),
|
|
41
|
+
flattenColumns = _useContext.flattenColumns,
|
|
42
|
+
onColumnResize = _useContext.onColumnResize,
|
|
43
|
+
getRowKey = _useContext.getRowKey,
|
|
44
|
+
expandedKeys = _useContext.expandedKeys,
|
|
45
|
+
prefixCls = _useContext.prefixCls,
|
|
46
|
+
childrenColumnName = _useContext.childrenColumnName,
|
|
47
|
+
scrollX = _useContext.scrollX,
|
|
48
|
+
direction = _useContext.direction;
|
|
49
|
+
var _useContext2 = (0, _context.useContext)(_context2.StaticContext),
|
|
50
|
+
sticky = _useContext2.sticky,
|
|
51
|
+
scrollY = _useContext2.scrollY,
|
|
52
|
+
listItemHeight = _useContext2.listItemHeight,
|
|
53
|
+
getComponent = _useContext2.getComponent,
|
|
54
|
+
onTablePropScroll = _useContext2.onScroll;
|
|
55
|
+
|
|
56
|
+
// =========================== Ref ============================
|
|
57
|
+
var listRef = React.useRef(null);
|
|
58
|
+
|
|
59
|
+
// =========================== Data ===========================
|
|
60
|
+
var flattenData = (0, _useFlattenRecords.default)(data, childrenColumnName, expandedKeys, getRowKey);
|
|
61
|
+
|
|
62
|
+
// ========================== Column ==========================
|
|
63
|
+
var columnsWidth = React.useMemo(function () {
|
|
64
|
+
var total = 0;
|
|
65
|
+
return flattenColumns.map(function (_ref) {
|
|
66
|
+
var width = _ref.width,
|
|
67
|
+
minWidth = _ref.minWidth,
|
|
68
|
+
key = _ref.key;
|
|
69
|
+
var finalWidth = Math.max(width || 0, minWidth || 0);
|
|
70
|
+
total += finalWidth;
|
|
71
|
+
return [key, finalWidth, total];
|
|
72
|
+
});
|
|
73
|
+
}, [flattenColumns]);
|
|
74
|
+
var columnsOffset = React.useMemo(function () {
|
|
75
|
+
return columnsWidth.map(function (colWidth) {
|
|
76
|
+
return colWidth[2];
|
|
77
|
+
});
|
|
78
|
+
}, [columnsWidth]);
|
|
79
|
+
React.useEffect(function () {
|
|
80
|
+
columnsWidth.forEach(function (_ref2) {
|
|
81
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
82
|
+
key = _ref3[0],
|
|
83
|
+
width = _ref3[1];
|
|
84
|
+
onColumnResize(key, width);
|
|
85
|
+
});
|
|
86
|
+
}, [columnsWidth]);
|
|
87
|
+
|
|
88
|
+
// =========================== Ref ============================
|
|
89
|
+
React.useImperativeHandle(ref, function () {
|
|
90
|
+
var _listRef$current2;
|
|
91
|
+
var obj = {
|
|
92
|
+
scrollTo: function scrollTo(config) {
|
|
93
|
+
var _ref4, _listRef$current;
|
|
94
|
+
var align = config.align,
|
|
95
|
+
offset = config.offset,
|
|
96
|
+
restConfig = _objectWithoutProperties(config, _excluded);
|
|
97
|
+
var virtualAlign = (_ref4 = align && ALIGN_MAP[align]) !== null && _ref4 !== void 0 ? _ref4 : offset ? 'top' : 'auto';
|
|
98
|
+
(_listRef$current = listRef.current) === null || _listRef$current === void 0 || _listRef$current.scrollTo(_objectSpread(_objectSpread({}, restConfig), {}, {
|
|
99
|
+
offset: offset,
|
|
100
|
+
align: virtualAlign
|
|
101
|
+
}));
|
|
102
|
+
},
|
|
103
|
+
nativeElement: (_listRef$current2 = listRef.current) === null || _listRef$current2 === void 0 ? void 0 : _listRef$current2.nativeElement
|
|
104
|
+
};
|
|
105
|
+
Object.defineProperty(obj, 'scrollLeft', {
|
|
106
|
+
get: function get() {
|
|
107
|
+
var _listRef$current3;
|
|
108
|
+
return ((_listRef$current3 = listRef.current) === null || _listRef$current3 === void 0 ? void 0 : _listRef$current3.getScrollInfo().x) || 0;
|
|
109
|
+
},
|
|
110
|
+
set: function set(value) {
|
|
111
|
+
var _listRef$current4;
|
|
112
|
+
(_listRef$current4 = listRef.current) === null || _listRef$current4 === void 0 || _listRef$current4.scrollTo({
|
|
113
|
+
left: value
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// https://github.com/ant-design/ant-design/issues/54734
|
|
119
|
+
Object.defineProperty(obj, 'scrollTop', {
|
|
120
|
+
get: function get() {
|
|
121
|
+
var _listRef$current5;
|
|
122
|
+
return ((_listRef$current5 = listRef.current) === null || _listRef$current5 === void 0 ? void 0 : _listRef$current5.getScrollInfo().y) || 0;
|
|
123
|
+
},
|
|
124
|
+
set: function set(value) {
|
|
125
|
+
var _listRef$current6;
|
|
126
|
+
(_listRef$current6 = listRef.current) === null || _listRef$current6 === void 0 || _listRef$current6.scrollTo({
|
|
127
|
+
top: value
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
return obj;
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
// ======================= Col/Row Span =======================
|
|
135
|
+
var getRowSpan = function getRowSpan(column, index) {
|
|
136
|
+
var _flattenData$index;
|
|
137
|
+
var record = (_flattenData$index = flattenData[index]) === null || _flattenData$index === void 0 ? void 0 : _flattenData$index.record;
|
|
138
|
+
var onCell = column.onCell;
|
|
139
|
+
if (onCell) {
|
|
140
|
+
var _cellProps$rowSpan;
|
|
141
|
+
var cellProps = onCell(record, index);
|
|
142
|
+
return (_cellProps$rowSpan = cellProps === null || cellProps === void 0 ? void 0 : cellProps.rowSpan) !== null && _cellProps$rowSpan !== void 0 ? _cellProps$rowSpan : 1;
|
|
143
|
+
}
|
|
144
|
+
return 1;
|
|
145
|
+
};
|
|
146
|
+
var extraRender = function extraRender(info) {
|
|
147
|
+
var start = info.start,
|
|
148
|
+
end = info.end,
|
|
149
|
+
getSize = info.getSize,
|
|
150
|
+
offsetY = info.offsetY;
|
|
151
|
+
|
|
152
|
+
// Do nothing if no data
|
|
153
|
+
if (end < 0) {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Find first rowSpan column
|
|
158
|
+
var firstRowSpanColumns = flattenColumns.filter(
|
|
159
|
+
// rowSpan is 0
|
|
160
|
+
function (column) {
|
|
161
|
+
return getRowSpan(column, start) === 0;
|
|
162
|
+
});
|
|
163
|
+
var startIndex = start;
|
|
164
|
+
var _loop = function _loop(i) {
|
|
165
|
+
firstRowSpanColumns = firstRowSpanColumns.filter(function (column) {
|
|
166
|
+
return getRowSpan(column, i) === 0;
|
|
167
|
+
});
|
|
168
|
+
if (!firstRowSpanColumns.length) {
|
|
169
|
+
startIndex = i;
|
|
170
|
+
return 1; // break
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
for (var i = start; i >= 0; i -= 1) {
|
|
174
|
+
if (_loop(i)) break;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Find last rowSpan column
|
|
178
|
+
var lastRowSpanColumns = flattenColumns.filter(
|
|
179
|
+
// rowSpan is not 1
|
|
180
|
+
function (column) {
|
|
181
|
+
return getRowSpan(column, end) !== 1;
|
|
182
|
+
});
|
|
183
|
+
var endIndex = end;
|
|
184
|
+
var _loop2 = function _loop2(_i) {
|
|
185
|
+
lastRowSpanColumns = lastRowSpanColumns.filter(function (column) {
|
|
186
|
+
return getRowSpan(column, _i) !== 1;
|
|
187
|
+
});
|
|
188
|
+
if (!lastRowSpanColumns.length) {
|
|
189
|
+
endIndex = Math.max(_i - 1, end);
|
|
190
|
+
return 1; // break
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
for (var _i = end; _i < flattenData.length; _i += 1) {
|
|
194
|
+
if (_loop2(_i)) break;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Collect the line who has rowSpan
|
|
198
|
+
var spanLines = [];
|
|
199
|
+
var _loop3 = function _loop3(_i2) {
|
|
200
|
+
var item = flattenData[_i2];
|
|
201
|
+
|
|
202
|
+
// This code will never reach, just incase
|
|
203
|
+
if (!item) {
|
|
204
|
+
return 1; // continue
|
|
205
|
+
}
|
|
206
|
+
if (flattenColumns.some(function (column) {
|
|
207
|
+
return getRowSpan(column, _i2) > 1;
|
|
208
|
+
})) {
|
|
209
|
+
spanLines.push(_i2);
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
for (var _i2 = startIndex; _i2 <= endIndex; _i2 += 1) {
|
|
213
|
+
if (_loop3(_i2)) continue;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Patch extra line on the page
|
|
217
|
+
var nodes = spanLines.map(function (index) {
|
|
218
|
+
var item = flattenData[index];
|
|
219
|
+
var rowKey = getRowKey(item.record, index);
|
|
220
|
+
var getHeight = function getHeight(rowSpan) {
|
|
221
|
+
var endItemIndex = index + rowSpan - 1;
|
|
222
|
+
var endItem = flattenData[endItemIndex];
|
|
223
|
+
if (!endItem || !endItem.record) {
|
|
224
|
+
// clamp 到当前可用的最后一行,或退化为默认高度
|
|
225
|
+
var safeEndIndex = Math.min(endItemIndex, flattenData.length - 1);
|
|
226
|
+
var safeEndItem = flattenData[safeEndIndex];
|
|
227
|
+
var _endItemKey = getRowKey(safeEndItem.record, safeEndIndex);
|
|
228
|
+
var _sizeInfo = getSize(rowKey, _endItemKey);
|
|
229
|
+
return _sizeInfo.bottom - _sizeInfo.top;
|
|
230
|
+
}
|
|
231
|
+
var endItemKey = getRowKey(endItem.record, endItemIndex);
|
|
232
|
+
var sizeInfo = getSize(rowKey, endItemKey);
|
|
233
|
+
return sizeInfo.bottom - sizeInfo.top;
|
|
234
|
+
};
|
|
235
|
+
var sizeInfo = getSize(rowKey);
|
|
236
|
+
return /*#__PURE__*/React.createElement(_BodyLine.default, {
|
|
237
|
+
key: index,
|
|
238
|
+
data: item,
|
|
239
|
+
rowKey: rowKey,
|
|
240
|
+
index: index,
|
|
241
|
+
style: {
|
|
242
|
+
top: -offsetY + sizeInfo.top
|
|
243
|
+
},
|
|
244
|
+
extra: true,
|
|
245
|
+
getHeight: getHeight
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
return nodes;
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
// ========================= Context ==========================
|
|
252
|
+
var gridContext = React.useMemo(function () {
|
|
253
|
+
return {
|
|
254
|
+
columnsOffset: columnsOffset
|
|
255
|
+
};
|
|
256
|
+
}, [columnsOffset]);
|
|
257
|
+
|
|
258
|
+
// ========================== Render ==========================
|
|
259
|
+
var tblPrefixCls = "".concat(prefixCls, "-tbody");
|
|
260
|
+
|
|
261
|
+
// default 'div' in rc-virtual-list
|
|
262
|
+
var wrapperComponent = getComponent(['body', 'wrapper']);
|
|
263
|
+
|
|
264
|
+
// ========================== Sticky Scroll Bar ==========================
|
|
265
|
+
var horizontalScrollBarStyle = {};
|
|
266
|
+
if (sticky) {
|
|
267
|
+
horizontalScrollBarStyle.position = 'sticky';
|
|
268
|
+
horizontalScrollBarStyle.bottom = 0;
|
|
269
|
+
if (_typeof(sticky) === 'object' && sticky.offsetScroll) {
|
|
270
|
+
horizontalScrollBarStyle.bottom = sticky.offsetScroll;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return /*#__PURE__*/React.createElement(_context2.GridContext.Provider, {
|
|
274
|
+
value: gridContext
|
|
275
|
+
}, /*#__PURE__*/React.createElement(_rcVirtualList.default, {
|
|
276
|
+
fullHeight: false,
|
|
277
|
+
ref: listRef,
|
|
278
|
+
prefixCls: "".concat(tblPrefixCls, "-virtual"),
|
|
279
|
+
styles: {
|
|
280
|
+
horizontalScrollBar: horizontalScrollBarStyle
|
|
281
|
+
},
|
|
282
|
+
className: tblPrefixCls,
|
|
283
|
+
height: scrollY,
|
|
284
|
+
itemHeight: listItemHeight || 24,
|
|
285
|
+
data: flattenData,
|
|
286
|
+
itemKey: function itemKey(item) {
|
|
287
|
+
return getRowKey(item.record);
|
|
288
|
+
},
|
|
289
|
+
component: wrapperComponent,
|
|
290
|
+
scrollWidth: scrollX,
|
|
291
|
+
direction: direction,
|
|
292
|
+
onVirtualScroll: function onVirtualScroll(_ref5) {
|
|
293
|
+
var _listRef$current7;
|
|
294
|
+
var x = _ref5.x;
|
|
295
|
+
onScroll({
|
|
296
|
+
currentTarget: (_listRef$current7 = listRef.current) === null || _listRef$current7 === void 0 ? void 0 : _listRef$current7.nativeElement,
|
|
297
|
+
scrollLeft: x
|
|
298
|
+
});
|
|
299
|
+
},
|
|
300
|
+
onScroll: onTablePropScroll,
|
|
301
|
+
extraRender: extraRender
|
|
302
|
+
}, function (item, index, itemProps) {
|
|
303
|
+
var rowKey = getRowKey(item.record, index);
|
|
304
|
+
return /*#__PURE__*/React.createElement(_BodyLine.default, {
|
|
305
|
+
data: item,
|
|
306
|
+
rowKey: rowKey,
|
|
307
|
+
index: index,
|
|
308
|
+
style: itemProps.style
|
|
309
|
+
});
|
|
310
|
+
}));
|
|
311
|
+
});
|
|
312
|
+
var ResponseGrid = (0, _TableContext.responseImmutable)(Grid);
|
|
313
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
314
|
+
ResponseGrid.displayName = 'ResponseGrid';
|
|
315
|
+
}
|
|
316
|
+
var _default = exports.default = ResponseGrid;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _context = require("../../../_util/context");
|
|
9
|
+
var _clsx3 = require("clsx");
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _Cell = _interopRequireDefault(require("../Cell"));
|
|
12
|
+
var _TableContext = _interopRequireWildcard(require("../../shared/context/TableContext"));
|
|
13
|
+
var _useRowInfo = _interopRequireDefault(require("../../shared/hooks/useRowInfo"));
|
|
14
|
+
var _VirtualCell = _interopRequireDefault(require("./VirtualCell"));
|
|
15
|
+
var _context2 = require("./context");
|
|
16
|
+
var _expandUtil = require("../../features/expand/expandUtil");
|
|
17
|
+
var _excluded = ["data", "index", "className", "rowKey", "style", "extra", "getHeight"];
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
|
+
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); }
|
|
22
|
+
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; }
|
|
23
|
+
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; }
|
|
24
|
+
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; }
|
|
25
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
26
|
+
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); }
|
|
27
|
+
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; }
|
|
28
|
+
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; }
|
|
29
|
+
var BodyLine = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
30
|
+
var _classNames$body, _styles$body;
|
|
31
|
+
var data = props.data,
|
|
32
|
+
index = props.index,
|
|
33
|
+
className = props.className,
|
|
34
|
+
rowKey = props.rowKey,
|
|
35
|
+
style = props.style,
|
|
36
|
+
extra = props.extra,
|
|
37
|
+
getHeight = props.getHeight,
|
|
38
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
39
|
+
var record = data.record,
|
|
40
|
+
indent = data.indent,
|
|
41
|
+
renderIndex = data.index;
|
|
42
|
+
var _useContext = (0, _context.useContext)(_TableContext.default, ['prefixCls', 'flattenColumns', 'fixColumn', 'componentWidth', 'scrollX', 'classNames', 'styles']),
|
|
43
|
+
scrollX = _useContext.scrollX,
|
|
44
|
+
flattenColumns = _useContext.flattenColumns,
|
|
45
|
+
prefixCls = _useContext.prefixCls,
|
|
46
|
+
fixColumn = _useContext.fixColumn,
|
|
47
|
+
componentWidth = _useContext.componentWidth,
|
|
48
|
+
classNames = _useContext.classNames,
|
|
49
|
+
styles = _useContext.styles;
|
|
50
|
+
var _useContext2 = (0, _context.useContext)(_context2.StaticContext, ['getComponent']),
|
|
51
|
+
getComponent = _useContext2.getComponent;
|
|
52
|
+
var rowInfo = (0, _useRowInfo.default)(record, rowKey, index, indent);
|
|
53
|
+
var RowComponent = getComponent(['body', 'row'], 'div');
|
|
54
|
+
var cellComponent = getComponent(['body', 'cell'], 'div');
|
|
55
|
+
|
|
56
|
+
// ========================== Expand ==========================
|
|
57
|
+
var rowSupportExpand = rowInfo.rowSupportExpand,
|
|
58
|
+
expanded = rowInfo.expanded,
|
|
59
|
+
rowProps = rowInfo.rowProps,
|
|
60
|
+
expandedRowRender = rowInfo.expandedRowRender,
|
|
61
|
+
expandedRowClassName = rowInfo.expandedRowClassName;
|
|
62
|
+
var expandedClsName = (0, _expandUtil.computedExpandedClassName)(expandedRowClassName, record, index, indent);
|
|
63
|
+
var expandRowNode = null;
|
|
64
|
+
if (rowSupportExpand && expanded) {
|
|
65
|
+
var expandContent = expandedRowRender(record, index, indent + 1, expanded);
|
|
66
|
+
var additionalProps = {};
|
|
67
|
+
if (fixColumn) {
|
|
68
|
+
additionalProps = {
|
|
69
|
+
style: _defineProperty({}, '--virtual-width', "".concat(componentWidth, "px"))
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
var rowCellCls = "".concat(prefixCls, "-expanded-row-cell");
|
|
73
|
+
expandRowNode = /*#__PURE__*/React.createElement(RowComponent, {
|
|
74
|
+
className: (0, _clsx3.clsx)("".concat(prefixCls, "-expanded-row"), "".concat(prefixCls, "-expanded-row-level-").concat(indent + 1), expandedClsName)
|
|
75
|
+
}, /*#__PURE__*/React.createElement(_Cell.default, {
|
|
76
|
+
component: cellComponent,
|
|
77
|
+
prefixCls: prefixCls,
|
|
78
|
+
className: (0, _clsx3.clsx)(rowCellCls, _defineProperty({}, "".concat(rowCellCls, "-fixed"), fixColumn)),
|
|
79
|
+
additionalProps: additionalProps
|
|
80
|
+
}, expandContent));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// ========================== Render ==========================
|
|
84
|
+
var rowStyle = _objectSpread(_objectSpread({}, style), {}, {
|
|
85
|
+
width: scrollX
|
|
86
|
+
});
|
|
87
|
+
if (extra) {
|
|
88
|
+
rowStyle.position = 'absolute';
|
|
89
|
+
rowStyle.pointerEvents = 'none';
|
|
90
|
+
}
|
|
91
|
+
var rowNode = /*#__PURE__*/React.createElement(RowComponent, _extends({}, rowProps, restProps, {
|
|
92
|
+
"data-row-key": rowKey,
|
|
93
|
+
ref: rowSupportExpand ? null : ref,
|
|
94
|
+
className: (0, _clsx3.clsx)(className, "".concat(prefixCls, "-row"), rowProps === null || rowProps === void 0 ? void 0 : rowProps.className, classNames === null || classNames === void 0 || (_classNames$body = classNames.body) === null || _classNames$body === void 0 ? void 0 : _classNames$body.row, _defineProperty(_defineProperty({}, expandedClsName, indent >= 1), "".concat(prefixCls, "-row-extra"), extra)),
|
|
95
|
+
style: _objectSpread(_objectSpread(_objectSpread({}, rowStyle), rowProps === null || rowProps === void 0 ? void 0 : rowProps.style), styles === null || styles === void 0 || (_styles$body = styles.body) === null || _styles$body === void 0 ? void 0 : _styles$body.row)
|
|
96
|
+
}), flattenColumns.map(function (column, colIndex) {
|
|
97
|
+
var _classNames$body2, _styles$body2;
|
|
98
|
+
return /*#__PURE__*/React.createElement(_VirtualCell.default, {
|
|
99
|
+
key: column.key != null ? String(column.key) : "cell-".concat(colIndex),
|
|
100
|
+
className: classNames === null || classNames === void 0 || (_classNames$body2 = classNames.body) === null || _classNames$body2 === void 0 ? void 0 : _classNames$body2.cell,
|
|
101
|
+
style: styles === null || styles === void 0 || (_styles$body2 = styles.body) === null || _styles$body2 === void 0 ? void 0 : _styles$body2.cell,
|
|
102
|
+
component: cellComponent,
|
|
103
|
+
rowInfo: rowInfo,
|
|
104
|
+
column: column,
|
|
105
|
+
colIndex: colIndex,
|
|
106
|
+
indent: indent,
|
|
107
|
+
index: index,
|
|
108
|
+
renderIndex: renderIndex,
|
|
109
|
+
record: record,
|
|
110
|
+
inverse: extra,
|
|
111
|
+
getHeight: getHeight
|
|
112
|
+
});
|
|
113
|
+
}));
|
|
114
|
+
if (rowSupportExpand) {
|
|
115
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
116
|
+
ref: ref
|
|
117
|
+
}, rowNode, expandRowNode);
|
|
118
|
+
}
|
|
119
|
+
return rowNode;
|
|
120
|
+
});
|
|
121
|
+
var ResponseBodyLine = (0, _TableContext.responseImmutable)(BodyLine);
|
|
122
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
123
|
+
ResponseBodyLine.displayName = 'BodyLine';
|
|
124
|
+
}
|
|
125
|
+
var _default = exports.default = ResponseBodyLine;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
exports.getColumnWidth = getColumnWidth;
|
|
8
|
+
var _context = require("../../../_util/context");
|
|
9
|
+
var _clsx = require("clsx");
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _BodyRow = require("../Body/BodyRow");
|
|
12
|
+
var _Cell = _interopRequireDefault(require("../Cell"));
|
|
13
|
+
var _context2 = require("./context");
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
|
+
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); }
|
|
18
|
+
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); }
|
|
19
|
+
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; }
|
|
20
|
+
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; }
|
|
21
|
+
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; }
|
|
22
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
23
|
+
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); }
|
|
24
|
+
/**
|
|
25
|
+
* Return the width of the column by `colSpan`.
|
|
26
|
+
* When `colSpan` is `0` will be trade as `1`.
|
|
27
|
+
*/
|
|
28
|
+
function getColumnWidth(colIndex, colSpan, columnsOffset) {
|
|
29
|
+
var mergedColSpan = colSpan || 1;
|
|
30
|
+
return columnsOffset[colIndex + mergedColSpan] - (columnsOffset[colIndex] || 0);
|
|
31
|
+
}
|
|
32
|
+
var VirtualCell = function VirtualCell(props) {
|
|
33
|
+
var rowInfo = props.rowInfo,
|
|
34
|
+
column = props.column,
|
|
35
|
+
colIndex = props.colIndex,
|
|
36
|
+
indent = props.indent,
|
|
37
|
+
index = props.index,
|
|
38
|
+
component = props.component,
|
|
39
|
+
renderIndex = props.renderIndex,
|
|
40
|
+
record = props.record,
|
|
41
|
+
style = props.style,
|
|
42
|
+
className = props.className,
|
|
43
|
+
inverse = props.inverse,
|
|
44
|
+
getHeight = props.getHeight;
|
|
45
|
+
var render = column.render,
|
|
46
|
+
dataIndex = column.dataIndex,
|
|
47
|
+
columnClassName = column.className,
|
|
48
|
+
colWidth = column.width;
|
|
49
|
+
var _useContext = (0, _context.useContext)(_context2.GridContext, ['columnsOffset']),
|
|
50
|
+
columnsOffset = _useContext.columnsOffset;
|
|
51
|
+
|
|
52
|
+
// TODO: support `expandableRowOffset`
|
|
53
|
+
var _getCellProps = (0, _BodyRow.getCellProps)(rowInfo, column, colIndex, indent, index),
|
|
54
|
+
key = _getCellProps.key,
|
|
55
|
+
fixedInfo = _getCellProps.fixedInfo,
|
|
56
|
+
appendCellNode = _getCellProps.appendCellNode,
|
|
57
|
+
additionalCellProps = _getCellProps.additionalCellProps;
|
|
58
|
+
var cellStyle = additionalCellProps.style,
|
|
59
|
+
_additionalCellProps$ = additionalCellProps.colSpan,
|
|
60
|
+
colSpan = _additionalCellProps$ === void 0 ? 1 : _additionalCellProps$,
|
|
61
|
+
_additionalCellProps$2 = additionalCellProps.rowSpan,
|
|
62
|
+
rowSpan = _additionalCellProps$2 === void 0 ? 1 : _additionalCellProps$2;
|
|
63
|
+
|
|
64
|
+
// ========================= ColWidth =========================
|
|
65
|
+
// column width
|
|
66
|
+
var startColIndex = colIndex - 1;
|
|
67
|
+
var concatColWidth = getColumnWidth(startColIndex, colSpan, columnsOffset);
|
|
68
|
+
|
|
69
|
+
// margin offset
|
|
70
|
+
var marginOffset = colSpan > 1 ? colWidth - concatColWidth : 0;
|
|
71
|
+
|
|
72
|
+
// ========================== Style ===========================
|
|
73
|
+
var mergedStyle = _objectSpread(_objectSpread(_objectSpread({}, cellStyle), style), {}, {
|
|
74
|
+
flex: "0 0 ".concat(concatColWidth, "px"),
|
|
75
|
+
width: "".concat(concatColWidth, "px"),
|
|
76
|
+
marginRight: marginOffset,
|
|
77
|
+
pointerEvents: 'auto'
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// When `colSpan` or `rowSpan` is `0`, should skip render.
|
|
81
|
+
var needHide = React.useMemo(function () {
|
|
82
|
+
if (inverse) {
|
|
83
|
+
return rowSpan <= 1;
|
|
84
|
+
} else {
|
|
85
|
+
return colSpan === 0 || rowSpan === 0 || rowSpan > 1;
|
|
86
|
+
}
|
|
87
|
+
}, [rowSpan, colSpan, inverse]);
|
|
88
|
+
|
|
89
|
+
// 0 rowSpan or colSpan should not render
|
|
90
|
+
if (needHide) {
|
|
91
|
+
mergedStyle.visibility = 'hidden';
|
|
92
|
+
} else if (inverse) {
|
|
93
|
+
mergedStyle.height = getHeight === null || getHeight === void 0 ? void 0 : getHeight(rowSpan);
|
|
94
|
+
}
|
|
95
|
+
var mergedRender = needHide ? function () {
|
|
96
|
+
return null;
|
|
97
|
+
} : render;
|
|
98
|
+
|
|
99
|
+
// ========================== Render ==========================
|
|
100
|
+
var cellSpan = {};
|
|
101
|
+
|
|
102
|
+
// Virtual should reset `colSpan` & `rowSpan`
|
|
103
|
+
if (rowSpan === 0 || colSpan === 0) {
|
|
104
|
+
cellSpan.rowSpan = 1;
|
|
105
|
+
cellSpan.colSpan = 1;
|
|
106
|
+
}
|
|
107
|
+
return /*#__PURE__*/React.createElement(_Cell.default, _extends({
|
|
108
|
+
className: (0, _clsx.clsx)(columnClassName, className),
|
|
109
|
+
ellipsis: column.ellipsis,
|
|
110
|
+
align: column.align,
|
|
111
|
+
scope: column.rowScope,
|
|
112
|
+
component: component,
|
|
113
|
+
prefixCls: rowInfo.prefixCls,
|
|
114
|
+
key: key,
|
|
115
|
+
record: record,
|
|
116
|
+
index: index,
|
|
117
|
+
renderIndex: renderIndex,
|
|
118
|
+
dataIndex: dataIndex,
|
|
119
|
+
render: mergedRender,
|
|
120
|
+
shouldCellUpdate: column.shouldCellUpdate
|
|
121
|
+
}, fixedInfo, {
|
|
122
|
+
appendNode: appendCellNode,
|
|
123
|
+
additionalProps: _objectSpread(_objectSpread({}, additionalCellProps), {}, {
|
|
124
|
+
style: mergedStyle
|
|
125
|
+
}, cellSpan)
|
|
126
|
+
}));
|
|
127
|
+
};
|
|
128
|
+
var _default = exports.default = VirtualCell;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StaticContext = exports.GridContext = void 0;
|
|
7
|
+
var _context = require("../../../_util/context");
|
|
8
|
+
var StaticContext = exports.StaticContext = (0, _context.createContext)();
|
|
9
|
+
var GridContext = exports.GridContext = (0, _context.createContext)();
|