@dtjoy/dt-design 1.1.1 → 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 +44 -24
- 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/{esm → es}/_util/gapSize.d.ts +1 -1
- 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/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/useProxyImperativeHandle.d.ts +4 -0
- package/{esm → es}/_util/hooks/useProxyImperativeHandle.js +10 -3
- 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/{esm → es}/_util/scrollTo.js +1 -1
- package/es/_util/scrollbar.d.ts +1 -0
- package/es/_util/scrollbar.js +32 -0
- package/{esm → es}/_util/type.d.ts +1 -0
- package/es/_util/validate.d.ts +2 -0
- package/es/_util/validate.js +10 -0
- package/{esm → es}/_util/warning.js +5 -6
- package/{lib/blockHeader → es/block-header}/index.d.ts +1 -1
- package/{esm/blockHeader → es/block-header}/index.js +1 -1
- package/{lib/blockHeader → es/block-header}/style/index.less +167 -143
- package/{esm → es}/button/index.d.ts +3 -3
- package/{esm → es}/button/index.js +16 -4
- package/{esm → es}/button/style/index.less +62 -59
- package/{esm → es}/button/style/mixin.less +40 -39
- package/{esm → es}/collapsible/index.js +3 -2
- package/{esm → es}/collapsible/style/index.less +24 -24
- package/{esm/collapsibleActionItems → es/collapsible-action-items}/index.d.ts +1 -1
- package/{esm/collapsibleActionItems → es/collapsible-action-items}/index.js +21 -19
- package/{lib/collapsibleActionItems → es/collapsible-action-items}/style/index.less +7 -7
- package/{lib → es}/flex/index.d.ts +2 -2
- package/{esm → es}/flex/index.js +3 -3
- package/{esm → es}/flex/style/index.less +80 -76
- package/{esm/formList → es/form-list}/index.d.ts +9 -0
- package/{esm/formList → es/form-list}/index.js +18 -8
- package/{lib/formList → es/form-list}/style/index.less +45 -45
- package/es/index.d.ts +26 -0
- package/es/index.js +21 -0
- package/{lib/overflowList → es/overflow-list}/index.d.ts +4 -1
- package/{esm/overflowList → es/overflow-list}/index.js +37 -9
- package/{esm/overflowList → es/overflow-list}/style/index.less +9 -9
- package/{lib/resizeObserver → es/resize-observer}/index.d.ts +1 -1
- package/{esm/resizeObserver → es/resize-observer}/index.js +8 -8
- package/{esm → es}/splitter/Panel.d.ts +1 -1
- package/{esm → es}/splitter/Panel.js +12 -4
- package/{esm → es}/splitter/SplitBar.d.ts +6 -2
- package/{esm → es}/splitter/SplitBar.js +82 -80
- package/{esm → es}/splitter/Splitter.js +52 -23
- 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/{esm → es}/splitter/hooks/useItems.d.ts +6 -0
- package/es/splitter/hooks/useOrientation.d.ts +2 -0
- package/es/splitter/hooks/useOrientation.js +6 -0
- package/{esm → es}/splitter/hooks/useResizable.d.ts +3 -0
- package/{esm → es}/splitter/hooks/useResizable.js +5 -2
- package/{esm → es}/splitter/hooks/useResize.d.ts +1 -1
- package/{esm → es}/splitter/hooks/useResize.js +10 -3
- package/{esm → es}/splitter/hooks/useSizes.js +5 -6
- package/{lib → es}/splitter/index.d.ts +2 -1
- package/es/splitter/interface.d.ts +45 -0
- package/es/splitter/style/index.less +349 -0
- package/{esm/statusTag → es/status-tag}/index.js +1 -1
- package/{esm/statusTag → es/status-tag}/style/index.less +70 -70
- package/{esm/statusTag → es/status-tag}/style/mixin.less +48 -39
- 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/{lib → es}/table/Table.d.ts +7 -5
- package/{esm → es}/table/Table.js +6 -4
- 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/{esm/table/RcTable → es/table/components}/VirtualTable.js +4 -1
- 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/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/{esm/table → es/table/shared/utils}/util.d.ts +3 -11
- package/{esm/table → es/table/shared/utils}/util.js +6 -13
- 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/{esm/formList → lib/form-list}/style/index.less +45 -45
- package/lib/index.js +37 -67
- 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/lib/{statusTag → 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 +699 -270
- package/lib/table/Table.js +14 -11
- package/lib/table/TableMeasureRowContext.js +1 -1
- 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 +118 -3
- package/lib/table/interface.js +54 -2
- 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 -141
- 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 -88
- package/lib/table/style/index.js +2 -1
- package/lib/table/style/index.less +19 -150
- 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 -90
- package/lib/table/style/size.less +54 -0
- package/lib/table/style/sorter.less +99 -0
- package/lib/table/style/sticky.less +45 -55
- package/lib/table/style/summary.less +23 -0
- package/lib/table/style/variables.less +80 -0
- package/lib/table/style/virtual.less +95 -65
- package/package.json +148 -155
- package/esm/_util/extendsObject.d.ts +0 -4
- package/esm/_util/extendsObject.js +0 -17
- package/esm/_util/hooks/index.d.ts +0 -4
- package/esm/_util/hooks/index.js +0 -4
- package/esm/_util/hooks/useProxyImperativeHandle.d.ts +0 -4
- package/esm/_util/index.d.ts +0 -3
- package/esm/_util/isNonNullable.d.ts +0 -2
- package/esm/_util/isNonNullable.js +0 -4
- package/esm/blockHeader/index.d.ts +0 -58
- package/esm/flex/index.d.ts +0 -7
- package/esm/index.d.ts +0 -17
- package/esm/index.js +0 -14
- package/esm/overflowList/index.d.ts +0 -40
- package/esm/resizeObserver/index.d.ts +0 -45
- package/esm/splitter/index.d.ts +0 -8
- package/esm/splitter/interface.d.ts +0 -69
- 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/esm/table/InternalTable.d.ts +0 -32
- package/esm/table/InternalTable.js +0 -429
- package/esm/table/RcTable/VirtualTable.d.ts +0 -2
- package/esm/table/RcTable/index.d.ts +0 -2
- package/esm/table/RcTable/index.js +0 -9
- package/esm/table/Table.d.ts +0 -17
- package/esm/table/index.d.ts +0 -7
- package/esm/table/index.js +0 -2
- package/esm/table/interface.d.ts +0 -196
- package/esm/table/interface.js +0 -4
- package/esm/table/style/bordered.less +0 -141
- package/esm/table/style/fixed.less +0 -88
- package/esm/table/style/index.d.ts +0 -2
- package/esm/table/style/index.js +0 -2
- package/esm/table/style/index.less +0 -150
- package/esm/table/style/selection.less +0 -90
- package/esm/table/style/sticky.less +0 -55
- package/esm/table/style/virtual.less +0 -65
- package/lib/_util/easings.d.ts +0 -1
- package/lib/_util/extendsObject.d.ts +0 -4
- package/lib/_util/extendsObject.js +0 -20
- package/lib/_util/gapSize.d.ts +0 -3
- package/lib/_util/getScroll.d.ts +0 -3
- package/lib/_util/hooks/index.d.ts +0 -4
- package/lib/_util/hooks/useForceUpdate.d.ts +0 -2
- package/lib/_util/hooks/useOrientation.d.ts +0 -2
- package/lib/_util/hooks/useProxyImperativeHandle.d.ts +0 -4
- package/lib/_util/hooks/useSyncState.d.ts +0 -3
- package/lib/_util/index.d.ts +0 -3
- package/lib/_util/isNonNullable.d.ts +0 -2
- package/lib/_util/isNonNullable.js +0 -10
- package/lib/_util/scrollTo.d.ts +0 -10
- package/lib/_util/type.d.ts +0 -52
- package/lib/_util/warning.d.ts +0 -31
- package/lib/blockHeader/index.js +0 -121
- package/lib/blockHeader/style/index.d.ts +0 -2
- package/lib/button/index.d.ts +0 -10
- package/lib/button/style/index.d.ts +0 -2
- package/lib/collapsible/index.d.ts +0 -102
- package/lib/collapsible/style/index.d.ts +0 -1
- package/lib/collapsibleActionItems/index.d.ts +0 -24
- package/lib/collapsibleActionItems/index.js +0 -68
- package/lib/collapsibleActionItems/style/index.d.ts +0 -2
- package/lib/flex/interface.d.ts +0 -16
- package/lib/flex/style/index.d.ts +0 -2
- package/lib/flex/utils.d.ts +0 -7
- package/lib/formList/index.d.ts +0 -78
- package/lib/formList/index.js +0 -130
- package/lib/formList/style/index.d.ts +0 -2
- package/lib/index.d.ts +0 -17
- package/lib/overflowList/index.js +0 -144
- package/lib/overflowList/style/index.d.ts +0 -2
- package/lib/resize/index.d.ts +0 -9
- package/lib/resizeObserver/index.js +0 -137
- package/lib/splitter/Panel.d.ts +0 -7
- package/lib/splitter/SplitBar.d.ts +0 -24
- package/lib/splitter/Splitter.d.ts +0 -5
- package/lib/splitter/hooks/sizeUtil.d.ts +0 -3
- package/lib/splitter/hooks/useItems.d.ts +0 -14
- package/lib/splitter/hooks/useResizable.d.ts +0 -10
- package/lib/splitter/hooks/useResize.d.ts +0 -6
- package/lib/splitter/hooks/useSizes.d.ts +0 -4
- package/lib/splitter/interface.d.ts +0 -69
- package/lib/splitter/style/index.d.ts +0 -2
- package/lib/statusTag/index.d.ts +0 -29
- package/lib/statusTag/index.js +0 -125
- package/lib/statusTag/style/index.d.ts +0 -2
- package/lib/style/index.d.ts +0 -1
- package/lib/style/mixins/index.less +0 -0
- package/lib/table/InternalTable.d.ts +0 -32
- package/lib/table/RcTable/VirtualTable.d.ts +0 -2
- package/lib/table/RcTable/VirtualTable.js +0 -17
- package/lib/table/RcTable/index.d.ts +0 -2
- package/lib/table/RcTable/index.js +0 -17
- package/lib/table/TableMeasureRowContext.d.ts +0 -3
- package/lib/table/hooks/useContainerWidth.d.ts +0 -1
- package/lib/table/hooks/useContainerWidth.js +0 -20
- package/lib/table/index.d.ts +0 -7
- package/lib/table/interface.d.ts +0 -196
- package/lib/table/style/index.d.ts +0 -2
- package/lib/table/util.d.ts +0 -14
- package/lib/table/util.js +0 -44
- /package/{esm → es}/_util/easings.d.ts +0 -0
- /package/{esm → es}/_util/easings.js +0 -0
- /package/{esm → es}/_util/gapSize.js +0 -0
- /package/{esm → es}/_util/getScroll.d.ts +0 -0
- /package/{esm → es}/_util/hooks/useForceUpdate.d.ts +0 -0
- /package/{esm → es}/_util/hooks/useForceUpdate.js +0 -0
- /package/{esm → es}/_util/hooks/useOrientation.d.ts +0 -0
- /package/{esm → es}/_util/hooks/useOrientation.js +0 -0
- /package/{esm → es}/_util/hooks/useSyncState.d.ts +0 -0
- /package/{esm → es}/_util/hooks/useSyncState.js +0 -0
- /package/{esm → es}/_util/scrollTo.d.ts +0 -0
- /package/{esm → es}/_util/type.js +0 -0
- /package/{esm → es}/_util/warning.d.ts +0 -0
- /package/{esm/blockHeader → es/block-header}/style/index.d.ts +0 -0
- /package/{esm/blockHeader → es/block-header}/style/index.js +0 -0
- /package/{esm → es}/button/style/index.d.ts +0 -0
- /package/{esm → es}/button/style/index.js +0 -0
- /package/{esm → es}/collapsible/index.d.ts +0 -0
- /package/{esm → es}/collapsible/style/index.d.ts +0 -0
- /package/{esm → es}/collapsible/style/index.js +0 -0
- /package/{esm/collapsibleActionItems → es/collapsible-action-items}/style/index.d.ts +0 -0
- /package/{esm/collapsibleActionItems → es/collapsible-action-items}/style/index.js +0 -0
- /package/{esm → es}/flex/interface.d.ts +0 -0
- /package/{esm → es}/flex/interface.js +0 -0
- /package/{esm → es}/flex/style/index.d.ts +0 -0
- /package/{esm → es}/flex/style/index.js +0 -0
- /package/{esm → es}/flex/utils.d.ts +0 -0
- /package/{esm → es}/flex/utils.js +0 -0
- /package/{esm/formList → es/form-list}/style/index.d.ts +0 -0
- /package/{esm/formList → es/form-list}/style/index.js +0 -0
- /package/{esm/overflowList → es/overflow-list}/style/index.d.ts +0 -0
- /package/{esm/overflowList → es/overflow-list}/style/index.js +0 -0
- /package/{esm → es}/resize/index.d.ts +0 -0
- /package/{esm → es}/resize/index.js +0 -0
- /package/{esm → es}/splitter/Splitter.d.ts +0 -0
- /package/{esm → es}/splitter/hooks/sizeUtil.d.ts +0 -0
- /package/{esm → es}/splitter/hooks/useItems.js +0 -0
- /package/{esm → es}/splitter/hooks/useSizes.d.ts +0 -0
- /package/{esm → es}/splitter/index.js +0 -0
- /package/{esm → es}/splitter/interface.js +0 -0
- /package/{esm → es}/splitter/style/index.d.ts +0 -0
- /package/{esm → es}/splitter/style/index.js +0 -0
- /package/{esm/statusTag → es/status-tag}/index.d.ts +0 -0
- /package/{esm/statusTag → es/status-tag}/style/index.d.ts +0 -0
- /package/{esm/statusTag → es/status-tag}/style/index.js +0 -0
- /package/{esm → es}/style/index.d.ts +0 -0
- /package/{esm → es}/style/index.js +0 -0
- /package/{esm → es}/table/TableMeasureRowContext.d.ts +0 -0
- /package/{esm → es}/table/TableMeasureRowContext.js +0 -0
- /package/{esm/table → es/table/shared}/hooks/useContainerWidth.d.ts +0 -0
- /package/{esm/table → es/table/shared}/hooks/useContainerWidth.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,205 @@
|
|
|
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 _clsx2 = require("clsx");
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _TableContext = _interopRequireDefault(require("../../shared/context/TableContext"));
|
|
11
|
+
var _useRenderTimes = _interopRequireDefault(require("../../shared/hooks/useRenderTimes"));
|
|
12
|
+
var _useCellRender3 = _interopRequireDefault(require("./useCellRender"));
|
|
13
|
+
var _useHoverState3 = _interopRequireDefault(require("./useHoverState"));
|
|
14
|
+
var _useEvent = _interopRequireDefault(require("../../../_util/hooks/useEvent"));
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
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); }
|
|
17
|
+
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; }
|
|
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 _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); }
|
|
20
|
+
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; }
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
23
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
24
|
+
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); }
|
|
25
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
26
|
+
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."); }
|
|
27
|
+
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); }
|
|
28
|
+
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; }
|
|
29
|
+
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; } }
|
|
30
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
31
|
+
var getTitleFromCellRenderChildren = function getTitleFromCellRenderChildren(_ref) {
|
|
32
|
+
var ellipsis = _ref.ellipsis,
|
|
33
|
+
rowType = _ref.rowType,
|
|
34
|
+
children = _ref.children;
|
|
35
|
+
var title;
|
|
36
|
+
var ellipsisConfig = ellipsis === true ? {
|
|
37
|
+
showTitle: true
|
|
38
|
+
} : ellipsis;
|
|
39
|
+
if (ellipsisConfig && (ellipsisConfig.showTitle || rowType === 'header')) {
|
|
40
|
+
var _children$props;
|
|
41
|
+
if (typeof children === 'string' || typeof children === 'number') {
|
|
42
|
+
title = children.toString();
|
|
43
|
+
} else if ( /*#__PURE__*/React.isValidElement(children) && typeof ((_children$props = children.props) === null || _children$props === void 0 ? void 0 : _children$props.children) === 'string') {
|
|
44
|
+
var _children$props2;
|
|
45
|
+
title = (_children$props2 = children.props) === null || _children$props2 === void 0 ? void 0 : _children$props2.children;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return title;
|
|
49
|
+
};
|
|
50
|
+
var Cell = function Cell(props) {
|
|
51
|
+
var _ref3, _ref4, _legacyCellProps$colS, _ref5, _ref6, _legacyCellProps$rowS, _additionalProps$titl, _clsx;
|
|
52
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
53
|
+
(0, _useRenderTimes.default)(props);
|
|
54
|
+
}
|
|
55
|
+
var children = props.children,
|
|
56
|
+
ellipsis = props.ellipsis,
|
|
57
|
+
scope = props.scope,
|
|
58
|
+
prefixCls = props.prefixCls,
|
|
59
|
+
className = props.className,
|
|
60
|
+
style = props.style,
|
|
61
|
+
align = props.align,
|
|
62
|
+
record = props.record,
|
|
63
|
+
render = props.render,
|
|
64
|
+
dataIndex = props.dataIndex,
|
|
65
|
+
renderIndex = props.renderIndex,
|
|
66
|
+
shouldCellUpdate = props.shouldCellUpdate,
|
|
67
|
+
index = props.index,
|
|
68
|
+
rowType = props.rowType,
|
|
69
|
+
colSpan = props.colSpan,
|
|
70
|
+
rowSpan = props.rowSpan,
|
|
71
|
+
fixStart = props.fixStart,
|
|
72
|
+
fixEnd = props.fixEnd,
|
|
73
|
+
fixedStartShadow = props.fixedStartShadow,
|
|
74
|
+
fixedEndShadow = props.fixedEndShadow,
|
|
75
|
+
offsetFixedStartShadow = props.offsetFixedStartShadow,
|
|
76
|
+
offsetFixedEndShadow = props.offsetFixedEndShadow,
|
|
77
|
+
zIndex = props.zIndex,
|
|
78
|
+
zIndexReverse = props.zIndexReverse,
|
|
79
|
+
appendNode = props.appendNode,
|
|
80
|
+
_props$additionalProp = props.additionalProps,
|
|
81
|
+
additionalProps = _props$additionalProp === void 0 ? {} : _props$additionalProp,
|
|
82
|
+
isSticky = props.isSticky;
|
|
83
|
+
|
|
84
|
+
// `component` is optional in props but is always provided by call sites when rendering
|
|
85
|
+
var Component = props.component;
|
|
86
|
+
var cellPrefixCls = "".concat(prefixCls, "-cell");
|
|
87
|
+
var _useContext = (0, _context.useContext)(_TableContext.default, ['allColumnsFixedLeft', 'rowHoverable']),
|
|
88
|
+
allColumnsFixedLeft = _useContext.allColumnsFixedLeft,
|
|
89
|
+
rowHoverable = _useContext.rowHoverable;
|
|
90
|
+
|
|
91
|
+
// ====================== Value =======================
|
|
92
|
+
var _useCellRender = (0, _useCellRender3.default)(record, dataIndex, renderIndex, children, render, shouldCellUpdate),
|
|
93
|
+
_useCellRender2 = _slicedToArray(_useCellRender, 2),
|
|
94
|
+
childNode = _useCellRender2[0],
|
|
95
|
+
legacyCellProps = _useCellRender2[1];
|
|
96
|
+
|
|
97
|
+
// ====================== Fixed =======================
|
|
98
|
+
var fixedStyle = {};
|
|
99
|
+
var isFixStart = typeof fixStart === 'number' && !allColumnsFixedLeft;
|
|
100
|
+
var isFixEnd = typeof fixEnd === 'number' && !allColumnsFixedLeft;
|
|
101
|
+
var _useContext2 = (0, _context.useContext)(_TableContext.default, function (_ref2) {
|
|
102
|
+
var scrollInfo = _ref2.scrollInfo;
|
|
103
|
+
if (!isFixStart && !isFixEnd) {
|
|
104
|
+
return [false, false];
|
|
105
|
+
}
|
|
106
|
+
var _scrollInfo = _slicedToArray(scrollInfo, 2),
|
|
107
|
+
absScroll = _scrollInfo[0],
|
|
108
|
+
scrollWidth = _scrollInfo[1];
|
|
109
|
+
var showStartShadow = isFixStart && fixedStartShadow && absScroll - (offsetFixedStartShadow || 0) >= 1;
|
|
110
|
+
var showEndShadow = isFixEnd && fixedEndShadow && scrollWidth - absScroll - (offsetFixedEndShadow || 0) > 1;
|
|
111
|
+
return [showStartShadow, showEndShadow];
|
|
112
|
+
}),
|
|
113
|
+
_useContext3 = _slicedToArray(_useContext2, 2),
|
|
114
|
+
showFixStartShadow = _useContext3[0],
|
|
115
|
+
showFixEndShadow = _useContext3[1];
|
|
116
|
+
if (isFixStart) {
|
|
117
|
+
fixedStyle.insetInlineStart = fixStart;
|
|
118
|
+
fixedStyle['--z-offset'] = zIndex;
|
|
119
|
+
fixedStyle['--z-offset-reverse'] = zIndexReverse;
|
|
120
|
+
}
|
|
121
|
+
if (isFixEnd) {
|
|
122
|
+
fixedStyle.insetInlineEnd = fixEnd;
|
|
123
|
+
fixedStyle['--z-offset'] = zIndex;
|
|
124
|
+
fixedStyle['--z-offset-reverse'] = zIndexReverse;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// ================ RowSpan & ColSpan =================
|
|
128
|
+
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;
|
|
129
|
+
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;
|
|
130
|
+
|
|
131
|
+
// ====================== Hover =======================
|
|
132
|
+
var _useHoverState = (0, _useHoverState3.default)(index, mergedRowSpan),
|
|
133
|
+
_useHoverState2 = _slicedToArray(_useHoverState, 2),
|
|
134
|
+
hovering = _useHoverState2[0],
|
|
135
|
+
onHover = _useHoverState2[1];
|
|
136
|
+
var onMouseEnter = (0, _useEvent.default)(function (event) {
|
|
137
|
+
var _additionalProps$onMo;
|
|
138
|
+
if (record && index !== undefined) {
|
|
139
|
+
onHover(index, index + mergedRowSpan - 1);
|
|
140
|
+
}
|
|
141
|
+
additionalProps === null || additionalProps === void 0 || (_additionalProps$onMo = additionalProps.onMouseEnter) === null || _additionalProps$onMo === void 0 || _additionalProps$onMo.call(additionalProps, event);
|
|
142
|
+
});
|
|
143
|
+
var onMouseLeave = (0, _useEvent.default)(function (event) {
|
|
144
|
+
var _additionalProps$onMo2;
|
|
145
|
+
if (record) {
|
|
146
|
+
onHover(-1, -1);
|
|
147
|
+
}
|
|
148
|
+
additionalProps === null || additionalProps === void 0 || (_additionalProps$onMo2 = additionalProps.onMouseLeave) === null || _additionalProps$onMo2 === void 0 || _additionalProps$onMo2.call(additionalProps, event);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// ====================== Render ======================
|
|
152
|
+
if (mergedColSpan === 0 || mergedRowSpan === 0) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// >>>>> Title
|
|
157
|
+
var title = (_additionalProps$titl = additionalProps.title) !== null && _additionalProps$titl !== void 0 ? _additionalProps$titl : getTitleFromCellRenderChildren({
|
|
158
|
+
rowType: rowType,
|
|
159
|
+
ellipsis: ellipsis,
|
|
160
|
+
children: childNode
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
// >>>>> ClassName
|
|
164
|
+
var mergedClassName = (0, _clsx2.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);
|
|
165
|
+
|
|
166
|
+
// >>>>> Style
|
|
167
|
+
var alignStyle = {};
|
|
168
|
+
if (align) {
|
|
169
|
+
alignStyle.textAlign = align;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// The order is important since user can overwrite style.
|
|
173
|
+
// For example ant-design/ant-design#51763
|
|
174
|
+
var mergedStyle = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, legacyCellProps === null || legacyCellProps === void 0 ? void 0 : legacyCellProps.style), fixedStyle), alignStyle), additionalProps.style), style);
|
|
175
|
+
|
|
176
|
+
// >>>>> Children Node
|
|
177
|
+
var mergedChildNode = childNode;
|
|
178
|
+
|
|
179
|
+
// Not crash if final `childNode` is not validate ReactNode
|
|
180
|
+
if (_typeof(mergedChildNode) === 'object' && !Array.isArray(mergedChildNode) && ! /*#__PURE__*/React.isValidElement(mergedChildNode)) {
|
|
181
|
+
mergedChildNode = null;
|
|
182
|
+
}
|
|
183
|
+
if (ellipsis && (fixedStartShadow || fixedEndShadow)) {
|
|
184
|
+
mergedChildNode = /*#__PURE__*/React.createElement("span", {
|
|
185
|
+
className: "".concat(cellPrefixCls, "-content")
|
|
186
|
+
}, mergedChildNode);
|
|
187
|
+
}
|
|
188
|
+
return /*#__PURE__*/React.createElement(Component, _extends({}, legacyCellProps, additionalProps, {
|
|
189
|
+
className: mergedClassName,
|
|
190
|
+
style: mergedStyle
|
|
191
|
+
// A11y
|
|
192
|
+
,
|
|
193
|
+
title: title,
|
|
194
|
+
scope: scope
|
|
195
|
+
// Hover
|
|
196
|
+
,
|
|
197
|
+
onMouseEnter: rowHoverable ? onMouseEnter : undefined,
|
|
198
|
+
onMouseLeave: rowHoverable ? onMouseLeave : undefined
|
|
199
|
+
//Span
|
|
200
|
+
,
|
|
201
|
+
colSpan: mergedColSpan !== 1 ? mergedColSpan : undefined,
|
|
202
|
+
rowSpan: mergedRowSpan !== 1 ? mergedRowSpan : undefined
|
|
203
|
+
}), appendNode, mergedChildNode);
|
|
204
|
+
};
|
|
205
|
+
var _default = exports.default = /*#__PURE__*/React.memo(Cell);
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useCellRender;
|
|
7
|
+
var _get = _interopRequireDefault(require("rc-util/lib/utils/get"));
|
|
8
|
+
var _isEqual = _interopRequireDefault(require("rc-util/lib/isEqual"));
|
|
9
|
+
var _useMemo = _interopRequireDefault(require("rc-util/lib/hooks/useMemo"));
|
|
10
|
+
var _warning = _interopRequireDefault(require("rc-util/lib/warning"));
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _PerfContext = _interopRequireDefault(require("../../shared/context/PerfContext"));
|
|
13
|
+
var _valueUtil = require("../../shared/utils/valueUtil");
|
|
14
|
+
var _TableContext = require("../../shared/context/TableContext");
|
|
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
19
|
+
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."); }
|
|
20
|
+
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); }
|
|
21
|
+
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; }
|
|
22
|
+
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; } }
|
|
23
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
24
|
+
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); }
|
|
25
|
+
function isRenderCell(data) {
|
|
26
|
+
return !!data && _typeof(data) === 'object' && !Array.isArray(data) && ! /*#__PURE__*/React.isValidElement(data);
|
|
27
|
+
}
|
|
28
|
+
function useCellRender(record, dataIndex, renderIndex, children, render, shouldCellUpdate) {
|
|
29
|
+
// TODO: Remove this after next major version
|
|
30
|
+
var perfRecord = React.useContext(_PerfContext.default);
|
|
31
|
+
var mark = (0, _TableContext.useImmutableMark)();
|
|
32
|
+
|
|
33
|
+
// ======================== Render ========================
|
|
34
|
+
var retData = (0, _useMemo.default)(function () {
|
|
35
|
+
if ((0, _valueUtil.validateValue)(children)) {
|
|
36
|
+
return [children];
|
|
37
|
+
}
|
|
38
|
+
var path = dataIndex === null || dataIndex === undefined || dataIndex === '' ? [] : Array.isArray(dataIndex) ? dataIndex : [dataIndex];
|
|
39
|
+
var value = (0, _get.default)(record, path);
|
|
40
|
+
|
|
41
|
+
// Customize render node
|
|
42
|
+
var returnChildNode = value;
|
|
43
|
+
var returnCellProps;
|
|
44
|
+
if (render) {
|
|
45
|
+
var renderData = render(value, record, renderIndex);
|
|
46
|
+
if (isRenderCell(renderData)) {
|
|
47
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
48
|
+
(0, _warning.default)(false, '`columns.render` return cell props is deprecated with perf issue, please use `onCell` instead.');
|
|
49
|
+
}
|
|
50
|
+
returnChildNode = renderData.children;
|
|
51
|
+
returnCellProps = renderData.props;
|
|
52
|
+
perfRecord.renderWithProps = true;
|
|
53
|
+
} else {
|
|
54
|
+
returnChildNode = renderData;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return [returnChildNode, returnCellProps];
|
|
58
|
+
}, [
|
|
59
|
+
// Force update deps
|
|
60
|
+
mark,
|
|
61
|
+
// Normal deps
|
|
62
|
+
record, children, dataIndex, render, renderIndex], function (prev, next) {
|
|
63
|
+
if (shouldCellUpdate) {
|
|
64
|
+
var _prev = _slicedToArray(prev, 2),
|
|
65
|
+
prevRecord = _prev[1];
|
|
66
|
+
var _next = _slicedToArray(next, 2),
|
|
67
|
+
nextRecord = _next[1];
|
|
68
|
+
return shouldCellUpdate(nextRecord, prevRecord);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Legacy mode should always update
|
|
72
|
+
if (perfRecord.renderWithProps) {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
return !(0, _isEqual.default)(prev, next, true);
|
|
76
|
+
});
|
|
77
|
+
return retData;
|
|
78
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useHoverState;
|
|
7
|
+
var _context = require("../../../_util/context");
|
|
8
|
+
var _TableContext = _interopRequireDefault(require("../../shared/context/TableContext"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
/** Check if cell is in hover range */
|
|
11
|
+
function inHoverRange(cellStartRow, cellRowSpan, startRow, endRow) {
|
|
12
|
+
var cellEndRow = cellStartRow + cellRowSpan - 1;
|
|
13
|
+
return cellStartRow <= endRow && cellEndRow >= startRow;
|
|
14
|
+
}
|
|
15
|
+
function useHoverState(rowIndex, rowSpan) {
|
|
16
|
+
return (0, _context.useContext)(_TableContext.default, function (ctx) {
|
|
17
|
+
var hovering = inHoverRange(rowIndex, rowSpan || 1, ctx.hoverStartRow, ctx.hoverEndRow);
|
|
18
|
+
return [hovering, ctx.onHover];
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
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 React = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _legacyUtil = require("../shared/utils/legacyUtil");
|
|
10
|
+
var _context = require("../../_util/context");
|
|
11
|
+
var _TableContext = _interopRequireDefault(require("../shared/context/TableContext"));
|
|
12
|
+
var _excluded = ["columnType"];
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
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); }
|
|
15
|
+
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; }
|
|
16
|
+
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); }
|
|
17
|
+
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; }
|
|
18
|
+
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; }
|
|
19
|
+
/** Column injected with internal col props by internal features (e.g. expandable, selection) */
|
|
20
|
+
|
|
21
|
+
var ColGroup = function ColGroup(props) {
|
|
22
|
+
var colWidths = props.colWidths,
|
|
23
|
+
columns = props.columns,
|
|
24
|
+
columCount = props.columCount;
|
|
25
|
+
var _useContext = (0, _context.useContext)(_TableContext.default, ['tableLayout']),
|
|
26
|
+
tableLayout = _useContext.tableLayout;
|
|
27
|
+
var cols = [];
|
|
28
|
+
var len = columCount || (columns === null || columns === void 0 ? void 0 : columns.length) || 0;
|
|
29
|
+
|
|
30
|
+
// Only insert col with width & additional props
|
|
31
|
+
// Skip if rest col do not have any useful info
|
|
32
|
+
var mustInsert = false;
|
|
33
|
+
for (var i = len - 1; i >= 0; i -= 1) {
|
|
34
|
+
var width = colWidths[i];
|
|
35
|
+
var column = columns && columns[i];
|
|
36
|
+
var additionalProps = void 0;
|
|
37
|
+
var minWidth = void 0;
|
|
38
|
+
if (column) {
|
|
39
|
+
additionalProps = column[_legacyUtil.INTERNAL_COL_DEFINE];
|
|
40
|
+
|
|
41
|
+
// fixed will cause layout problems
|
|
42
|
+
if (tableLayout === 'auto') {
|
|
43
|
+
minWidth = column.minWidth;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (width || minWidth || additionalProps || mustInsert) {
|
|
47
|
+
var _ref = additionalProps || {},
|
|
48
|
+
columnType = _ref.columnType,
|
|
49
|
+
restAdditionalProps = _objectWithoutProperties(_ref, _excluded);
|
|
50
|
+
cols.unshift( /*#__PURE__*/React.createElement("col", _extends({
|
|
51
|
+
key: i,
|
|
52
|
+
style: {
|
|
53
|
+
width: width,
|
|
54
|
+
minWidth: minWidth
|
|
55
|
+
}
|
|
56
|
+
}, restAdditionalProps)));
|
|
57
|
+
mustInsert = true;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return cols.length > 0 ? /*#__PURE__*/React.createElement("colgroup", null, cols) : null;
|
|
61
|
+
};
|
|
62
|
+
var _default = exports.default = ColGroup;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _clsx2 = require("clsx");
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
14
|
+
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); }
|
|
15
|
+
function renderExpandIcon(locale) {
|
|
16
|
+
return function (props) {
|
|
17
|
+
var prefixCls = props.prefixCls,
|
|
18
|
+
onExpand = props.onExpand,
|
|
19
|
+
record = props.record,
|
|
20
|
+
expanded = props.expanded,
|
|
21
|
+
expandable = props.expandable;
|
|
22
|
+
var iconPrefix = "".concat(prefixCls, "-row-expand-icon");
|
|
23
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
24
|
+
type: "button",
|
|
25
|
+
onClick: function onClick(e) {
|
|
26
|
+
onExpand(record, e);
|
|
27
|
+
e.stopPropagation();
|
|
28
|
+
},
|
|
29
|
+
className: (0, _clsx2.clsx)(iconPrefix, _defineProperty(_defineProperty(_defineProperty({}, "".concat(iconPrefix, "-spaced"), !expandable), "".concat(iconPrefix, "-expanded"), expandable && expanded), "".concat(iconPrefix, "-collapsed"), expandable && !expanded)),
|
|
30
|
+
"aria-label": expanded ? locale.collapse : locale.expand,
|
|
31
|
+
"aria-expanded": expanded
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
var _default = exports.default = renderExpandIcon;
|
|
@@ -0,0 +1,195 @@
|
|
|
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 _clsx = require("clsx");
|
|
10
|
+
var _ref2 = require("rc-util/lib/ref");
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var React = _react;
|
|
13
|
+
var _ColGroup = _interopRequireDefault(require("../ColGroup"));
|
|
14
|
+
var _TableContext = _interopRequireDefault(require("../../shared/context/TableContext"));
|
|
15
|
+
var _useRenderTimes = _interopRequireDefault(require("../../shared/hooks/useRenderTimes"));
|
|
16
|
+
var _excluded = ["className", "style", "noData", "columns", "flattenColumns", "colWidths", "colGroup", "columCount", "stickyOffsets", "direction", "fixHeader", "stickyTopOffset", "stickyBottomOffset", "stickyClassName", "scrollX", "tableLayout", "onScroll", "maxContentScroll", "children"];
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
+
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); }
|
|
19
|
+
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; }
|
|
20
|
+
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; }
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
23
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
24
|
+
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); }
|
|
25
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
26
|
+
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."); }
|
|
27
|
+
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); }
|
|
28
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
29
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
30
|
+
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; }
|
|
31
|
+
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; }
|
|
32
|
+
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; }
|
|
33
|
+
function useColumnWidth(colWidths, columCount) {
|
|
34
|
+
return (0, _react.useMemo)(function () {
|
|
35
|
+
var cloneColumns = [];
|
|
36
|
+
for (var i = 0; i < columCount; i += 1) {
|
|
37
|
+
var val = colWidths[i];
|
|
38
|
+
if (val !== undefined) {
|
|
39
|
+
cloneColumns[i] = val;
|
|
40
|
+
} else {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return cloneColumns;
|
|
45
|
+
}, [colWidths.join('_'), columCount]);
|
|
46
|
+
}
|
|
47
|
+
var FixedHolder = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
48
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
49
|
+
(0, _useRenderTimes.default)(props);
|
|
50
|
+
}
|
|
51
|
+
var className = props.className,
|
|
52
|
+
style = props.style,
|
|
53
|
+
noData = props.noData,
|
|
54
|
+
columns = props.columns,
|
|
55
|
+
flattenColumns = props.flattenColumns,
|
|
56
|
+
colWidths = props.colWidths,
|
|
57
|
+
colGroup = props.colGroup,
|
|
58
|
+
columCount = props.columCount,
|
|
59
|
+
stickyOffsets = props.stickyOffsets,
|
|
60
|
+
direction = props.direction,
|
|
61
|
+
fixHeader = props.fixHeader,
|
|
62
|
+
stickyTopOffset = props.stickyTopOffset,
|
|
63
|
+
stickyBottomOffset = props.stickyBottomOffset,
|
|
64
|
+
stickyClassName = props.stickyClassName,
|
|
65
|
+
scrollX = props.scrollX,
|
|
66
|
+
_props$tableLayout = props.tableLayout,
|
|
67
|
+
tableLayout = _props$tableLayout === void 0 ? 'fixed' : _props$tableLayout,
|
|
68
|
+
onScroll = props.onScroll,
|
|
69
|
+
maxContentScroll = props.maxContentScroll,
|
|
70
|
+
children = props.children,
|
|
71
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
72
|
+
var _useContext = (0, _context.useContext)(_TableContext.default, ['prefixCls', 'scrollbarSize', 'isSticky', 'getComponent']),
|
|
73
|
+
prefixCls = _useContext.prefixCls,
|
|
74
|
+
scrollbarSize = _useContext.scrollbarSize,
|
|
75
|
+
isSticky = _useContext.isSticky,
|
|
76
|
+
getComponent = _useContext.getComponent;
|
|
77
|
+
var TableComponent = getComponent(['header', 'table'], 'table');
|
|
78
|
+
var combinationScrollBarSize = isSticky && !fixHeader ? 0 : scrollbarSize;
|
|
79
|
+
|
|
80
|
+
// Pass wheel to scroll event
|
|
81
|
+
var scrollRef = React.useRef(null);
|
|
82
|
+
var setScrollRef = React.useCallback(function (element) {
|
|
83
|
+
(0, _ref2.fillRef)(ref, element);
|
|
84
|
+
(0, _ref2.fillRef)(scrollRef, element);
|
|
85
|
+
}, []);
|
|
86
|
+
React.useEffect(function () {
|
|
87
|
+
function onWheel(e) {
|
|
88
|
+
var _ref = e,
|
|
89
|
+
currentTarget = _ref.currentTarget,
|
|
90
|
+
deltaX = _ref.deltaX;
|
|
91
|
+
if (deltaX) {
|
|
92
|
+
var scrollLeft = currentTarget.scrollLeft,
|
|
93
|
+
scrollWidth = currentTarget.scrollWidth,
|
|
94
|
+
clientWidth = currentTarget.clientWidth;
|
|
95
|
+
var maxScrollWidth = scrollWidth - clientWidth;
|
|
96
|
+
var nextScroll = scrollLeft + deltaX;
|
|
97
|
+
if (direction === 'rtl') {
|
|
98
|
+
nextScroll = Math.max(-maxScrollWidth, nextScroll);
|
|
99
|
+
nextScroll = Math.min(0, nextScroll);
|
|
100
|
+
} else {
|
|
101
|
+
nextScroll = Math.min(maxScrollWidth, nextScroll);
|
|
102
|
+
nextScroll = Math.max(0, nextScroll);
|
|
103
|
+
}
|
|
104
|
+
onScroll({
|
|
105
|
+
currentTarget: currentTarget,
|
|
106
|
+
scrollLeft: nextScroll
|
|
107
|
+
});
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
var scrollEle = scrollRef.current;
|
|
112
|
+
scrollEle === null || scrollEle === void 0 || scrollEle.addEventListener('wheel', onWheel, {
|
|
113
|
+
passive: false
|
|
114
|
+
});
|
|
115
|
+
return function () {
|
|
116
|
+
scrollEle === null || scrollEle === void 0 || scrollEle.removeEventListener('wheel', onWheel);
|
|
117
|
+
};
|
|
118
|
+
}, []);
|
|
119
|
+
|
|
120
|
+
// Add scrollbar column
|
|
121
|
+
var lastColumn = flattenColumns[flattenColumns.length - 1];
|
|
122
|
+
var ScrollBarColumn = {
|
|
123
|
+
fixed: lastColumn === null || lastColumn === void 0 ? void 0 : lastColumn.fixed,
|
|
124
|
+
scrollbar: true,
|
|
125
|
+
onHeaderCell: function onHeaderCell() {
|
|
126
|
+
return {
|
|
127
|
+
className: "".concat(prefixCls, "-cell-scrollbar")
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
var columnsWithScrollbar = (0, _react.useMemo)(function () {
|
|
132
|
+
return combinationScrollBarSize ? [].concat(_toConsumableArray(columns), [ScrollBarColumn]) : columns;
|
|
133
|
+
}, [combinationScrollBarSize, columns]);
|
|
134
|
+
var flattenColumnsWithScrollbar = (0, _react.useMemo)(function () {
|
|
135
|
+
return combinationScrollBarSize ? [].concat(_toConsumableArray(flattenColumns), [ScrollBarColumn]) : flattenColumns;
|
|
136
|
+
}, [combinationScrollBarSize, flattenColumns]);
|
|
137
|
+
|
|
138
|
+
// Calculate the sticky offsets
|
|
139
|
+
var headerStickyOffsets = (0, _react.useMemo)(function () {
|
|
140
|
+
var start = stickyOffsets.start,
|
|
141
|
+
end = stickyOffsets.end;
|
|
142
|
+
return _objectSpread(_objectSpread({}, stickyOffsets), {}, {
|
|
143
|
+
// left:
|
|
144
|
+
// direction === 'rtl' ? [...left.map(width => width + combinationScrollBarSize), 0] : left,
|
|
145
|
+
// right:
|
|
146
|
+
// direction === 'rtl' ? right : [...right.map(width => width + combinationScrollBarSize), 0],
|
|
147
|
+
start: start,
|
|
148
|
+
end: [].concat(_toConsumableArray(end.map(function (width) {
|
|
149
|
+
return width + combinationScrollBarSize;
|
|
150
|
+
})), [0]),
|
|
151
|
+
isSticky: isSticky
|
|
152
|
+
});
|
|
153
|
+
}, [combinationScrollBarSize, stickyOffsets, isSticky]);
|
|
154
|
+
var mergedColumnWidth = useColumnWidth(colWidths, columCount);
|
|
155
|
+
var isColGroupEmpty = (0, _react.useMemo)(function () {
|
|
156
|
+
// use original ColGroup if no data or no calculated column width, otherwise use calculated column width
|
|
157
|
+
// Return original colGroup if no data, or mergedColumnWidth is empty, or all widths are falsy
|
|
158
|
+
var noWidth = !mergedColumnWidth || !mergedColumnWidth.length || mergedColumnWidth.every(function (w) {
|
|
159
|
+
return !w;
|
|
160
|
+
});
|
|
161
|
+
return noData || noWidth;
|
|
162
|
+
}, [noData, mergedColumnWidth]);
|
|
163
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
164
|
+
style: _objectSpread(_objectSpread({
|
|
165
|
+
overflow: 'hidden'
|
|
166
|
+
}, isSticky ? {
|
|
167
|
+
top: stickyTopOffset,
|
|
168
|
+
bottom: stickyBottomOffset
|
|
169
|
+
} : {}), style),
|
|
170
|
+
ref: setScrollRef,
|
|
171
|
+
className: (0, _clsx.clsx)(className, stickyClassName)
|
|
172
|
+
}, /*#__PURE__*/React.createElement(TableComponent, {
|
|
173
|
+
style: {
|
|
174
|
+
tableLayout: tableLayout,
|
|
175
|
+
minWidth: '100%',
|
|
176
|
+
// https://github.com/ant-design/ant-design/issues/54894
|
|
177
|
+
width: scrollX
|
|
178
|
+
}
|
|
179
|
+
}, isColGroupEmpty ? colGroup : /*#__PURE__*/React.createElement(_ColGroup.default, {
|
|
180
|
+
colWidths: [].concat(_toConsumableArray(mergedColumnWidth || []), [combinationScrollBarSize]),
|
|
181
|
+
columCount: columCount + 1,
|
|
182
|
+
columns: flattenColumnsWithScrollbar
|
|
183
|
+
}), children(_objectSpread(_objectSpread({}, restProps), {}, {
|
|
184
|
+
stickyOffsets: headerStickyOffsets,
|
|
185
|
+
columns: columnsWithScrollbar,
|
|
186
|
+
flattenColumns: flattenColumnsWithScrollbar
|
|
187
|
+
}))));
|
|
188
|
+
});
|
|
189
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
190
|
+
FixedHolder.displayName = 'FixedHolder';
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** Return a table in div as fixed element which contains sticky info */
|
|
194
|
+
// export default responseImmutable(FixedHolder);
|
|
195
|
+
var _default = exports.default = /*#__PURE__*/React.memo(FixedHolder);
|