@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,438 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { Breakpoint } from '../_util/hooks/useBreakpoint';
|
|
3
|
+
import type { AnyObject } from '../_util/type';
|
|
4
|
+
import type { CheckboxProps } from 'antd/lib/checkbox';
|
|
5
|
+
import type { DropdownProps } from 'antd/lib/dropdown';
|
|
6
|
+
import type { PaginationProps } from 'antd/lib/pagination';
|
|
7
|
+
import type { TooltipProps } from 'antd/lib/tooltip';
|
|
8
|
+
import type { INTERNAL_SELECTION_ITEM } from './features/selection/useSelection';
|
|
9
|
+
import type { InternalTableProps, TableProps } from './InternalTable';
|
|
10
|
+
type BaseNamePath = string | number | boolean | (string | number | boolean)[];
|
|
11
|
+
/**
|
|
12
|
+
* Store: The store type from `FormInstance<Store>`
|
|
13
|
+
* ParentNamePath: Auto generate by nest logic. Do not fill manually.
|
|
14
|
+
*/
|
|
15
|
+
export type DeepNamePath<Store = any, ParentNamePath extends any[] = []> = ParentNamePath['length'] extends 3 ? never : true extends (Store extends BaseNamePath ? true : false) ? ParentNamePath['length'] extends 0 ? Store | BaseNamePath : Store extends any[] ? [...ParentNamePath, number] : never : Store extends any[] ? // Connect path. e.g. { a: { b: string } }[]
|
|
16
|
+
[
|
|
17
|
+
...ParentNamePath,
|
|
18
|
+
number
|
|
19
|
+
] | DeepNamePath<Store[number], [...ParentNamePath, number]> : keyof Store extends never ? Store : {
|
|
20
|
+
[FieldKey in keyof Store]: Store[FieldKey] extends (...args: any[]) => any ? never : (ParentNamePath['length'] extends 0 ? FieldKey : never) | [...ParentNamePath, FieldKey] | DeepNamePath<Required<Store>[FieldKey], [...ParentNamePath, FieldKey]>;
|
|
21
|
+
}[keyof Store];
|
|
22
|
+
/**
|
|
23
|
+
* ColumnType which applied in antd: https://ant.design/components/table-cn/#Column
|
|
24
|
+
* - defaultSortOrder
|
|
25
|
+
* - filterDropdown
|
|
26
|
+
* - filterDropdownVisible
|
|
27
|
+
* - filtered
|
|
28
|
+
* - filteredValue
|
|
29
|
+
* - filterIcon
|
|
30
|
+
* - filterMultiple
|
|
31
|
+
* - filters
|
|
32
|
+
* - sorter
|
|
33
|
+
* - sortOrder
|
|
34
|
+
* - sortDirections
|
|
35
|
+
* - onFilter
|
|
36
|
+
* - onFilterDropdownVisibleChange
|
|
37
|
+
*/
|
|
38
|
+
export type Key = React.Key;
|
|
39
|
+
/**
|
|
40
|
+
* Use `start` or `end` instead. `left` or `right` is deprecated.
|
|
41
|
+
*/
|
|
42
|
+
export type FixedType = 'start' | 'end' | 'left' | 'right' | boolean;
|
|
43
|
+
export type DefaultRecordType = Record<string, any>;
|
|
44
|
+
export type TableLayout = 'auto' | 'fixed';
|
|
45
|
+
export type ScrollConfig = {
|
|
46
|
+
/** The index of the row to scroll to */
|
|
47
|
+
index?: number;
|
|
48
|
+
/** The key of the row to scroll to */
|
|
49
|
+
key?: Key;
|
|
50
|
+
/** The absolute scroll position from top */
|
|
51
|
+
top?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Additional offset in pixels to apply to the scroll position.
|
|
54
|
+
* Only effective when using `key` or `index` mode.
|
|
55
|
+
* Ignored when using `top` mode.
|
|
56
|
+
* In `key` / `index` mode, `offset` is added to the position resolved by `align`.
|
|
57
|
+
*/
|
|
58
|
+
offset?: number;
|
|
59
|
+
align?: ScrollLogicalPosition;
|
|
60
|
+
};
|
|
61
|
+
export type VirtualScrollConfig = ScrollConfig & {
|
|
62
|
+
align?: Exclude<ScrollLogicalPosition, 'center'>;
|
|
63
|
+
};
|
|
64
|
+
export type EditableErrors = Map<string, string[]>;
|
|
65
|
+
export interface EditableValidateResult {
|
|
66
|
+
valid: boolean;
|
|
67
|
+
/** 首个错误:rowKey 用于定位行(排序/筛选后依然准确),rowIndex 保留 rawData 下标语义 */
|
|
68
|
+
firstError?: EditableError & {
|
|
69
|
+
rowIndex: number;
|
|
70
|
+
};
|
|
71
|
+
errors: EditableErrors;
|
|
72
|
+
}
|
|
73
|
+
export type Reference = {
|
|
74
|
+
nativeElement: HTMLDivElement;
|
|
75
|
+
scrollTo: (config: ScrollConfig) => void;
|
|
76
|
+
/** 校验全部可编辑单元格,返回校验结果(异步 — 支持异步 validator) */
|
|
77
|
+
validate: () => Promise<EditableValidateResult>;
|
|
78
|
+
/** 重置所有校验错误 */
|
|
79
|
+
resetErrors: () => void;
|
|
80
|
+
/** 重置所有列宽为初始弹性分配(清除用户拖拽记录) */
|
|
81
|
+
resetColumnWidths: () => void;
|
|
82
|
+
};
|
|
83
|
+
export type RowClassName<RecordType> = (record: RecordType, index: number, indent: number) => string;
|
|
84
|
+
export interface CellType<RecordType> {
|
|
85
|
+
key?: Key;
|
|
86
|
+
className?: string;
|
|
87
|
+
style?: React.CSSProperties;
|
|
88
|
+
children?: React.ReactNode;
|
|
89
|
+
column?: ColumnsType<RecordType>[number];
|
|
90
|
+
colSpan?: number;
|
|
91
|
+
rowSpan?: number;
|
|
92
|
+
/** Only used for table header */
|
|
93
|
+
hasSubColumns?: boolean;
|
|
94
|
+
colStart?: number;
|
|
95
|
+
colEnd?: number;
|
|
96
|
+
}
|
|
97
|
+
export interface RenderedCell<RecordType> {
|
|
98
|
+
props?: CellType<RecordType>;
|
|
99
|
+
children?: React.ReactNode;
|
|
100
|
+
}
|
|
101
|
+
export type Direction = 'ltr' | 'rtl';
|
|
102
|
+
export type SpecialString<T> = T | (string & NonNullable<unknown>);
|
|
103
|
+
export type DataIndex<T = any> = DeepNamePath<T> | SpecialString<T> | number | (SpecialString<T> | number)[];
|
|
104
|
+
export type CellEllipsisType = {
|
|
105
|
+
showTitle?: boolean;
|
|
106
|
+
} | boolean;
|
|
107
|
+
export type ColScopeType = 'col' | 'colgroup';
|
|
108
|
+
export type RowScopeType = 'row' | 'rowgroup';
|
|
109
|
+
export type ScopeType = ColScopeType | RowScopeType;
|
|
110
|
+
export type EditorType = 'input' | 'textarea' | 'number' | 'select' | 'switch' | 'custom';
|
|
111
|
+
export interface EditableRule<RecordType = AnyObject> {
|
|
112
|
+
required?: boolean;
|
|
113
|
+
message?: string;
|
|
114
|
+
pattern?: RegExp;
|
|
115
|
+
validator?: (value: any, record: RecordType) => string | undefined | Promise<string | undefined>;
|
|
116
|
+
}
|
|
117
|
+
export interface EditableConfig<RecordType = AnyObject> {
|
|
118
|
+
type?: EditorType;
|
|
119
|
+
options?: {
|
|
120
|
+
label: React.ReactNode;
|
|
121
|
+
value: any;
|
|
122
|
+
}[];
|
|
123
|
+
/** 透传给底层 antd 组件的额外 props(如 min/max/step/rows 等) */
|
|
124
|
+
props?: Record<string, any>;
|
|
125
|
+
renderEditor?: (value: any, record: RecordType, index: number, onChange: (value: any) => void) => React.ReactNode;
|
|
126
|
+
rules?: EditableRule<RecordType>[];
|
|
127
|
+
onChange?: (value: any, record: RecordType, index: number) => void;
|
|
128
|
+
onSave?: (value: any, record: RecordType, index: number) => void;
|
|
129
|
+
}
|
|
130
|
+
export interface EditableError {
|
|
131
|
+
rowKey: React.Key;
|
|
132
|
+
dataIndex: string | number;
|
|
133
|
+
message: string;
|
|
134
|
+
}
|
|
135
|
+
interface ColumnSharedType<RecordType> {
|
|
136
|
+
title?: ColumnTitle<RecordType>;
|
|
137
|
+
key?: Key;
|
|
138
|
+
className?: string;
|
|
139
|
+
hidden?: boolean;
|
|
140
|
+
fixed?: FixedType;
|
|
141
|
+
onHeaderCell?: GetComponentProps<ColumnsType<RecordType>[number]>;
|
|
142
|
+
ellipsis?: CellEllipsisType;
|
|
143
|
+
align?: AlignType;
|
|
144
|
+
rowScope?: RowScopeType;
|
|
145
|
+
}
|
|
146
|
+
export interface ColumnGroupType<RecordType = AnyObject> extends Omit<ColumnType<RecordType>, 'dataIndex'> {
|
|
147
|
+
children: ColumnsType<RecordType>;
|
|
148
|
+
}
|
|
149
|
+
export type AlignType = 'start' | 'end' | 'left' | 'right' | 'center' | 'justify' | 'match-parent';
|
|
150
|
+
export interface ColumnType<RecordType = AnyObject> extends ColumnSharedType<RecordType> {
|
|
151
|
+
colSpan?: number;
|
|
152
|
+
dataIndex?: DataIndex<RecordType>;
|
|
153
|
+
render?: (value: any, record: RecordType, index: number) => React.ReactNode | RenderedCell<RecordType>;
|
|
154
|
+
shouldCellUpdate?: (record: RecordType, prevRecord: RecordType) => boolean;
|
|
155
|
+
rowSpan?: number;
|
|
156
|
+
width?: number | string;
|
|
157
|
+
minWidth?: number;
|
|
158
|
+
/** 最大列宽(用于列宽拖拽限制) */
|
|
159
|
+
maxWidth?: number;
|
|
160
|
+
onCell?: GetComponentProps<RecordType>;
|
|
161
|
+
/** @deprecated Please use `onCell` instead */
|
|
162
|
+
onCellClick?: (record: RecordType, e: React.MouseEvent<HTMLElement>) => void;
|
|
163
|
+
/** 是否可拖拽调整列宽,覆盖 Table.resizable */
|
|
164
|
+
resizable?: boolean;
|
|
165
|
+
/** 列宽变化回调 */
|
|
166
|
+
onResize?: (width: number) => void;
|
|
167
|
+
/** 可编辑配置,可为 boolean 或详细配置对象 */
|
|
168
|
+
editable?: boolean | EditableConfig<RecordType>;
|
|
169
|
+
title?: ColumnTitle<RecordType>;
|
|
170
|
+
sorter?: boolean | CompareFn<RecordType> | ColumnSorter<RecordType>;
|
|
171
|
+
sortOrder?: SortOrder;
|
|
172
|
+
defaultSortOrder?: SortOrder;
|
|
173
|
+
sortDirections?: SortOrder[];
|
|
174
|
+
sortIcon?: (props: {
|
|
175
|
+
sortOrder: SortOrder;
|
|
176
|
+
}) => React.ReactNode;
|
|
177
|
+
showSorterTooltip?: boolean | SorterTooltipProps;
|
|
178
|
+
filtered?: boolean;
|
|
179
|
+
filters?: ColumnFilterItem[];
|
|
180
|
+
filterDropdown?: React.ReactNode | ((props: FilterDropdownProps) => React.ReactNode);
|
|
181
|
+
filterOnClose?: boolean;
|
|
182
|
+
filterMultiple?: boolean;
|
|
183
|
+
filteredValue?: FilterValue | null;
|
|
184
|
+
defaultFilteredValue?: FilterValue | null;
|
|
185
|
+
filterIcon?: React.ReactNode | ((filtered: boolean) => React.ReactNode);
|
|
186
|
+
filterMode?: 'menu' | 'tree';
|
|
187
|
+
filterSearch?: FilterSearchType<ColumnFilterItem>;
|
|
188
|
+
onFilter?: (value: React.Key | boolean, record: RecordType) => boolean;
|
|
189
|
+
filterDropdownProps?: CoverableDropdownProps;
|
|
190
|
+
filterResetToDefaultFilteredValue?: boolean;
|
|
191
|
+
responsive?: Breakpoint[];
|
|
192
|
+
/** @deprecated Please use `filterDropdownProps.open` instead. */
|
|
193
|
+
filterDropdownOpen?: boolean;
|
|
194
|
+
/** @deprecated Please use `filterDropdownProps.onOpenChange` instead. */
|
|
195
|
+
onFilterDropdownOpenChange?: (visible: boolean) => void;
|
|
196
|
+
}
|
|
197
|
+
export type ColumnsType<RecordType = AnyObject> = (ColumnGroupType<RecordType> | ColumnType<RecordType>)[];
|
|
198
|
+
export type GetRowKey<RecordType> = (record: RecordType, index?: number) => Key;
|
|
199
|
+
export interface StickyOffsets {
|
|
200
|
+
start: readonly number[];
|
|
201
|
+
end: readonly number[];
|
|
202
|
+
widths: readonly number[];
|
|
203
|
+
isSticky?: boolean;
|
|
204
|
+
}
|
|
205
|
+
export type GetComponentProps<DataType> = (data: DataType, index?: number) => React.HTMLAttributes<any> & React.TdHTMLAttributes<any>;
|
|
206
|
+
type Component<P> = React.ComponentType<P> | React.ForwardRefExoticComponent<P> | React.FC<P> | keyof React.JSX.IntrinsicElements;
|
|
207
|
+
export type CustomizeComponent = Component<any>;
|
|
208
|
+
export type OnCustomizeScroll = (info: {
|
|
209
|
+
currentTarget?: HTMLElement;
|
|
210
|
+
scrollLeft?: number;
|
|
211
|
+
}) => void;
|
|
212
|
+
export type CustomizeScrollBody<RecordType> = (data: readonly RecordType[], info: {
|
|
213
|
+
scrollbarSize: number;
|
|
214
|
+
ref: React.Ref<{
|
|
215
|
+
scrollLeft: number;
|
|
216
|
+
scrollTo?: (scrollConfig: ScrollConfig) => void;
|
|
217
|
+
}>;
|
|
218
|
+
onScroll: OnCustomizeScroll;
|
|
219
|
+
}) => React.ReactNode;
|
|
220
|
+
export interface TableComponents<RecordType> {
|
|
221
|
+
table?: CustomizeComponent;
|
|
222
|
+
header?: {
|
|
223
|
+
table?: CustomizeComponent;
|
|
224
|
+
wrapper?: CustomizeComponent;
|
|
225
|
+
row?: CustomizeComponent;
|
|
226
|
+
cell?: CustomizeComponent;
|
|
227
|
+
};
|
|
228
|
+
body?: CustomizeScrollBody<RecordType> | {
|
|
229
|
+
wrapper?: CustomizeComponent;
|
|
230
|
+
row?: CustomizeComponent;
|
|
231
|
+
cell?: CustomizeComponent;
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
export type GetComponent = (path: readonly string[], defaultComponent?: CustomizeComponent) => CustomizeComponent;
|
|
235
|
+
export type ExpandableType = false | 'row' | 'nest';
|
|
236
|
+
export interface LegacyExpandableProps<RecordType> {
|
|
237
|
+
/** @deprecated Use `expandable.expandedRowKeys` instead */
|
|
238
|
+
expandedRowKeys?: readonly Key[];
|
|
239
|
+
/** @deprecated Use `expandable.defaultExpandedRowKeys` instead */
|
|
240
|
+
defaultExpandedRowKeys?: readonly Key[];
|
|
241
|
+
/** @deprecated Use `expandable.expandedRowRender` instead */
|
|
242
|
+
expandedRowRender?: ExpandedRowRender<RecordType>;
|
|
243
|
+
/** @deprecated Use `expandable.expandRowByClick` instead */
|
|
244
|
+
expandRowByClick?: boolean;
|
|
245
|
+
/** @deprecated Use `expandable.expandIcon` instead */
|
|
246
|
+
expandIcon?: RenderExpandIcon<RecordType>;
|
|
247
|
+
/** @deprecated Use `expandable.onExpand` instead */
|
|
248
|
+
onExpand?: (expanded: boolean, record: RecordType) => void;
|
|
249
|
+
/** @deprecated Use `expandable.onExpandedRowsChange` instead */
|
|
250
|
+
onExpandedRowsChange?: (expandedKeys: readonly Key[]) => void;
|
|
251
|
+
/** @deprecated Use `expandable.defaultExpandAllRows` instead */
|
|
252
|
+
defaultExpandAllRows?: boolean;
|
|
253
|
+
/** @deprecated Use `expandable.indentSize` instead */
|
|
254
|
+
indentSize?: number;
|
|
255
|
+
/** @deprecated Use `expandable.expandIconColumnIndex` instead */
|
|
256
|
+
expandIconColumnIndex?: number;
|
|
257
|
+
/** @deprecated Use `expandable.expandedRowClassName` instead */
|
|
258
|
+
expandedRowClassName?: RowClassName<RecordType>;
|
|
259
|
+
/** @deprecated Use `expandable.childrenColumnName` instead */
|
|
260
|
+
childrenColumnName?: string;
|
|
261
|
+
title?: PanelRender<RecordType>;
|
|
262
|
+
}
|
|
263
|
+
export type ExpandedRowRender<ValueType> = (record: ValueType, index: number, indent: number, expanded: boolean) => React.ReactNode;
|
|
264
|
+
export interface RenderExpandIconProps<RecordType> {
|
|
265
|
+
prefixCls: string;
|
|
266
|
+
expanded: boolean;
|
|
267
|
+
record: RecordType;
|
|
268
|
+
expandable: boolean;
|
|
269
|
+
onExpand: TriggerEventHandler<RecordType>;
|
|
270
|
+
}
|
|
271
|
+
export type RenderExpandIcon<RecordType> = (props: RenderExpandIconProps<RecordType>) => React.ReactNode;
|
|
272
|
+
export interface ExpandableConfig<RecordType> {
|
|
273
|
+
expandedRowKeys?: readonly Key[];
|
|
274
|
+
defaultExpandedRowKeys?: readonly Key[];
|
|
275
|
+
expandedRowRender?: ExpandedRowRender<RecordType>;
|
|
276
|
+
columnTitle?: React.ReactNode;
|
|
277
|
+
expandRowByClick?: boolean;
|
|
278
|
+
expandIcon?: RenderExpandIcon<RecordType>;
|
|
279
|
+
onExpand?: (expanded: boolean, record: RecordType) => void;
|
|
280
|
+
onExpandedRowsChange?: (expandedKeys: readonly Key[]) => void;
|
|
281
|
+
defaultExpandAllRows?: boolean;
|
|
282
|
+
indentSize?: number;
|
|
283
|
+
/** @deprecated Please use `EXPAND_COLUMN` in `columns` directly */
|
|
284
|
+
expandIconColumnIndex?: number;
|
|
285
|
+
showExpandColumn?: boolean;
|
|
286
|
+
expandedRowClassName?: string | RowClassName<RecordType>;
|
|
287
|
+
childrenColumnName?: string;
|
|
288
|
+
rowExpandable?: (record: RecordType) => boolean;
|
|
289
|
+
columnWidth?: number | string;
|
|
290
|
+
fixed?: FixedType;
|
|
291
|
+
expandedRowOffset?: number;
|
|
292
|
+
}
|
|
293
|
+
export type PanelRender<RecordType> = (data: readonly RecordType[]) => React.ReactNode;
|
|
294
|
+
export type TriggerEventHandler<RecordType> = (record: RecordType, event: React.MouseEvent<HTMLElement>) => void;
|
|
295
|
+
export interface TableSticky {
|
|
296
|
+
offsetHeader?: number;
|
|
297
|
+
offsetSummary?: number;
|
|
298
|
+
offsetScroll?: number;
|
|
299
|
+
getContainer?: () => Window | HTMLElement;
|
|
300
|
+
}
|
|
301
|
+
export type RefTable = <RecordType = AnyObject>(props: React.PropsWithChildren<TableProps<RecordType>> & React.RefAttributes<Reference>) => React.ReactElement;
|
|
302
|
+
export type RefInternalTable = <RecordType = AnyObject>(props: React.PropsWithChildren<InternalTableProps<RecordType>> & React.RefAttributes<Reference>) => React.ReactElement;
|
|
303
|
+
export type SafeKey = Exclude<Key, bigint>;
|
|
304
|
+
export type RowSelectionType = 'checkbox' | 'radio';
|
|
305
|
+
export type SelectionItemSelectFn = (currentRowKeys: Key[]) => void;
|
|
306
|
+
export type ExpandType = null | 'row' | 'nest';
|
|
307
|
+
export interface TableLocale {
|
|
308
|
+
filterTitle?: string;
|
|
309
|
+
filterConfirm?: React.ReactNode;
|
|
310
|
+
filterReset?: React.ReactNode;
|
|
311
|
+
filterEmptyText?: React.ReactNode;
|
|
312
|
+
/** @deprecated Please use `filterCheckAll` instead. */
|
|
313
|
+
filterCheckall?: React.ReactNode;
|
|
314
|
+
filterCheckAll?: React.ReactNode;
|
|
315
|
+
filterSearchPlaceholder?: string;
|
|
316
|
+
emptyText?: React.ReactNode | (() => React.ReactNode);
|
|
317
|
+
selectAll?: React.ReactNode;
|
|
318
|
+
selectNone?: React.ReactNode;
|
|
319
|
+
selectInvert?: React.ReactNode;
|
|
320
|
+
selectionAll?: React.ReactNode;
|
|
321
|
+
sortTitle?: string;
|
|
322
|
+
expand?: string;
|
|
323
|
+
collapse?: string;
|
|
324
|
+
triggerDesc?: string;
|
|
325
|
+
triggerAsc?: string;
|
|
326
|
+
cancelSort?: string;
|
|
327
|
+
}
|
|
328
|
+
export type SortOrder = 'descend' | 'ascend' | null;
|
|
329
|
+
export type SorterTooltipTarget = 'full-header' | 'sorter-icon';
|
|
330
|
+
export type SorterTooltipProps = TooltipProps & {
|
|
331
|
+
target?: SorterTooltipTarget;
|
|
332
|
+
};
|
|
333
|
+
declare const _TableActions: readonly ["paginate", "sort", "filter"];
|
|
334
|
+
export type TableAction = (typeof _TableActions)[number];
|
|
335
|
+
export type CompareFn<T = AnyObject> = (a: T, b: T, sortOrder?: SortOrder) => number;
|
|
336
|
+
export interface ColumnSorter<RecordType = AnyObject> {
|
|
337
|
+
compare?: CompareFn<RecordType>;
|
|
338
|
+
multiple?: number;
|
|
339
|
+
}
|
|
340
|
+
export interface ColumnFilterItem {
|
|
341
|
+
text: React.ReactNode;
|
|
342
|
+
value: React.Key | boolean;
|
|
343
|
+
children?: ColumnFilterItem[];
|
|
344
|
+
}
|
|
345
|
+
export interface ColumnTitleProps<RecordType = AnyObject> {
|
|
346
|
+
/** @deprecated Will be remove in v7, Please use `sorterColumns` instead. */
|
|
347
|
+
sortOrder?: SortOrder;
|
|
348
|
+
/** @deprecated Will be remove in v7, Please use `sorterColumns` instead. */
|
|
349
|
+
sortColumn?: ColumnType<RecordType>;
|
|
350
|
+
sortColumns?: {
|
|
351
|
+
column: ColumnType<RecordType>;
|
|
352
|
+
order: SortOrder;
|
|
353
|
+
}[];
|
|
354
|
+
filters?: Record<string, FilterValue>;
|
|
355
|
+
}
|
|
356
|
+
export type ColumnTitle<RecordType = AnyObject> = React.ReactNode | ((props: ColumnTitleProps<RecordType>) => React.ReactNode);
|
|
357
|
+
export type FilterValue = (Key | boolean)[];
|
|
358
|
+
export type FilterKey = (string | number)[] | null;
|
|
359
|
+
export type FilterSearchType<RecordType = AnyObject> = boolean | ((input: string, record: RecordType) => boolean);
|
|
360
|
+
export interface FilterConfirmProps {
|
|
361
|
+
closeDropdown: boolean;
|
|
362
|
+
}
|
|
363
|
+
export interface FilterResetProps {
|
|
364
|
+
confirm?: boolean;
|
|
365
|
+
closeDropdown?: boolean;
|
|
366
|
+
}
|
|
367
|
+
/** @deprecated Please use `FilterResetProps` instead. */
|
|
368
|
+
export interface FilterRestProps extends FilterResetProps {
|
|
369
|
+
}
|
|
370
|
+
export interface FilterDropdownProps {
|
|
371
|
+
prefixCls: string;
|
|
372
|
+
setSelectedKeys: (selectedKeys: React.Key[]) => void;
|
|
373
|
+
selectedKeys: React.Key[];
|
|
374
|
+
confirm: (param?: FilterConfirmProps) => void;
|
|
375
|
+
clearFilters?: (param?: FilterResetProps) => void;
|
|
376
|
+
filters?: ColumnFilterItem[];
|
|
377
|
+
close: () => void;
|
|
378
|
+
visible: boolean;
|
|
379
|
+
}
|
|
380
|
+
interface CoverableDropdownProps extends Omit<DropdownProps, 'onOpenChange' | 'overlay' | 'visible' | 'onVisibleChange'> {
|
|
381
|
+
onOpenChange?: (open: boolean) => void;
|
|
382
|
+
}
|
|
383
|
+
export interface SelectionItem {
|
|
384
|
+
key: string;
|
|
385
|
+
text: React.ReactNode;
|
|
386
|
+
onSelect?: SelectionItemSelectFn;
|
|
387
|
+
}
|
|
388
|
+
export type SelectionSelectFn<T = AnyObject> = (record: T, selected: boolean, selectedRows: T[], nativeEvent: Event) => void;
|
|
389
|
+
export type RowSelectMethod = 'all' | 'none' | 'invert' | 'single' | 'multiple';
|
|
390
|
+
export interface TableRowSelection<T = AnyObject> {
|
|
391
|
+
preserveSelectedRowKeys?: boolean;
|
|
392
|
+
type?: RowSelectionType;
|
|
393
|
+
selectedRowKeys?: Key[];
|
|
394
|
+
defaultSelectedRowKeys?: Key[];
|
|
395
|
+
onChange?: (selectedRowKeys: Key[], selectedRows: T[], info: {
|
|
396
|
+
type: RowSelectMethod;
|
|
397
|
+
}) => void;
|
|
398
|
+
getCheckboxProps?: (record: T) => Partial<Omit<CheckboxProps, 'checked' | 'defaultChecked'>> & React.AriaAttributes;
|
|
399
|
+
onSelect?: SelectionSelectFn<T>;
|
|
400
|
+
/** @deprecated This function will be remove in v7 and should use `onChange` instead */
|
|
401
|
+
onSelectMultiple?: (selected: boolean, selectedRows: T[], changeRows: T[]) => void;
|
|
402
|
+
/** @deprecated This function will be remove in v7 and should use `onChange` instead */
|
|
403
|
+
onSelectAll?: (selected: boolean, selectedRows: T[], changeRows: T[]) => void;
|
|
404
|
+
/** @deprecated This function will be remove in v7 and should use `onChange` instead */
|
|
405
|
+
onSelectInvert?: (selectedRowKeys: Key[]) => void;
|
|
406
|
+
/** @deprecated This function will be remove in v7 and should use `onChange` instead */
|
|
407
|
+
onSelectNone?: () => void;
|
|
408
|
+
selections?: INTERNAL_SELECTION_ITEM[] | boolean;
|
|
409
|
+
hideSelectAll?: boolean;
|
|
410
|
+
fixed?: FixedType;
|
|
411
|
+
columnWidth?: string | number;
|
|
412
|
+
columnTitle?: React.ReactNode | ((checkboxNode: React.ReactNode) => React.ReactNode);
|
|
413
|
+
checkStrictly?: boolean;
|
|
414
|
+
align?: 'left' | 'center' | 'right';
|
|
415
|
+
renderCell?: (value: boolean, record: T, index: number, originNode: React.ReactNode) => React.ReactNode | RenderedCell<T>;
|
|
416
|
+
onCell?: GetComponentProps<T>;
|
|
417
|
+
getTitleCheckboxProps?: () => Partial<Omit<CheckboxProps, 'checked' | 'defaultChecked'>> & React.AriaAttributes;
|
|
418
|
+
}
|
|
419
|
+
export type TransformColumns<RecordType = AnyObject> = (columns: ColumnsType<RecordType>) => ColumnsType<RecordType>;
|
|
420
|
+
export interface TableCurrentDataSource<RecordType = AnyObject> {
|
|
421
|
+
currentDataSource: RecordType[];
|
|
422
|
+
action: TableAction;
|
|
423
|
+
}
|
|
424
|
+
export interface SorterResult<RecordType = AnyObject> {
|
|
425
|
+
column?: ColumnType<RecordType>;
|
|
426
|
+
order?: SortOrder;
|
|
427
|
+
field?: Key | readonly Key[];
|
|
428
|
+
columnKey?: Key;
|
|
429
|
+
}
|
|
430
|
+
export type GetPopupContainer = (triggerNode: HTMLElement) => HTMLElement;
|
|
431
|
+
export type TablePaginationPlacement = 'topStart' | 'topCenter' | 'topEnd' | 'bottomStart' | 'bottomCenter' | 'bottomEnd' | 'none';
|
|
432
|
+
export type TablePaginationPosition = 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight' | 'none';
|
|
433
|
+
export interface TablePaginationConfig extends PaginationProps {
|
|
434
|
+
placement?: TablePaginationPlacement[];
|
|
435
|
+
/** @deprecated please use `placement` instead */
|
|
436
|
+
position?: TablePaginationPosition[];
|
|
437
|
+
}
|
|
438
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// ===================== namePathType.ts =====================
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Store: The store type from `FormInstance<Store>`
|
|
5
|
+
* ParentNamePath: Auto generate by nest logic. Do not fill manually.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// ===================== Core interface =====================
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* ColumnType which applied in antd: https://ant.design/components/table-cn/#Column
|
|
12
|
+
* - defaultSortOrder
|
|
13
|
+
* - filterDropdown
|
|
14
|
+
* - filterDropdownVisible
|
|
15
|
+
* - filtered
|
|
16
|
+
* - filteredValue
|
|
17
|
+
* - filterIcon
|
|
18
|
+
* - filterMultiple
|
|
19
|
+
* - filters
|
|
20
|
+
* - sorter
|
|
21
|
+
* - sortOrder
|
|
22
|
+
* - sortDirections
|
|
23
|
+
* - onFilter
|
|
24
|
+
* - onFilterDropdownVisibleChange
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Use `start` or `end` instead. `left` or `right` is deprecated.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
// ==================== Row =====================
|
|
32
|
+
|
|
33
|
+
// =================== Column ===================
|
|
34
|
+
|
|
35
|
+
// SpecialString will be removed in antd@6
|
|
36
|
+
|
|
37
|
+
// ===================== Editable Types =====================
|
|
38
|
+
|
|
39
|
+
// ================= Fix Column =================
|
|
40
|
+
|
|
41
|
+
// ================= Customized =================
|
|
42
|
+
|
|
43
|
+
// =================== Expand ===================
|
|
44
|
+
|
|
45
|
+
// =================== Render ===================
|
|
46
|
+
|
|
47
|
+
// =================== Events ===================
|
|
48
|
+
|
|
49
|
+
// =================== Sticky ===================
|
|
50
|
+
|
|
51
|
+
// ===================== Antd wrapper interface =====================
|
|
52
|
+
|
|
53
|
+
var _TableActions = ['paginate', 'sort', 'filter'];
|
|
54
|
+
|
|
55
|
+
/** @deprecated Please use `FilterResetProps` instead. */
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ColumnsType, ColumnType, Direction, ExpandableConfig, ExpandableType, ExpandedRowRender, GetComponent, GetComponentProps, GetRowKey, RenderExpandIcon, RowClassName, TableLayout, TriggerEventHandler } from '../../interface';
|
|
2
|
+
import type { FixedInfo } from '../../features/fixed/fixUtil';
|
|
3
|
+
import type { TableProps } from '../../components/RcTable';
|
|
4
|
+
declare const makeImmutable: <T extends React.ComponentType<any>>(Component: T, shouldTriggerRender?: import("../../../_util/context").CompareProps<T>) => T, responseImmutable: <T extends React.ComponentType<any>>(Component: T, propsAreEqual?: import("../../../_util/context").CompareProps<T>) => T, useImmutableMark: () => number | null;
|
|
5
|
+
export { makeImmutable, responseImmutable, useImmutableMark };
|
|
6
|
+
export type ScrollInfoType = [scrollLeft: number, scrollRange: number];
|
|
7
|
+
export interface TableContextProps<RecordType = any> {
|
|
8
|
+
scrollX: number | string | true;
|
|
9
|
+
classNames?: TableProps['classNames'];
|
|
10
|
+
styles?: TableProps['styles'];
|
|
11
|
+
prefixCls: string;
|
|
12
|
+
getComponent: GetComponent;
|
|
13
|
+
scrollbarSize: number;
|
|
14
|
+
direction: Direction;
|
|
15
|
+
fixedInfoList: readonly FixedInfo[];
|
|
16
|
+
isSticky: boolean;
|
|
17
|
+
componentWidth: number;
|
|
18
|
+
fixHeader: boolean;
|
|
19
|
+
fixColumn: boolean;
|
|
20
|
+
horizonScroll: boolean;
|
|
21
|
+
scrollInfo: ScrollInfoType;
|
|
22
|
+
rowClassName: string | RowClassName<RecordType>;
|
|
23
|
+
expandedRowClassName: string | RowClassName<RecordType>;
|
|
24
|
+
onRow?: GetComponentProps<RecordType>;
|
|
25
|
+
emptyNode?: React.ReactNode;
|
|
26
|
+
tableLayout: TableLayout;
|
|
27
|
+
indentSize: number;
|
|
28
|
+
expandableType: ExpandableType;
|
|
29
|
+
expandRowByClick: boolean;
|
|
30
|
+
expandedRowRender: ExpandedRowRender<RecordType>;
|
|
31
|
+
expandIcon: RenderExpandIcon<RecordType>;
|
|
32
|
+
onTriggerExpand: TriggerEventHandler<RecordType>;
|
|
33
|
+
expandIconColumnIndex: number;
|
|
34
|
+
allColumnsFixedLeft: boolean;
|
|
35
|
+
columns: ColumnsType<RecordType>;
|
|
36
|
+
flattenColumns: readonly ColumnType<RecordType>[];
|
|
37
|
+
onColumnResize: (columnKey: React.Key, width: number) => void;
|
|
38
|
+
colWidths: number[];
|
|
39
|
+
hoverStartRow: number;
|
|
40
|
+
hoverEndRow: number;
|
|
41
|
+
onHover: (start: number, end: number) => void;
|
|
42
|
+
rowExpandable: (record: RecordType) => boolean;
|
|
43
|
+
expandedKeys: Set<React.Key>;
|
|
44
|
+
getRowKey: GetRowKey<RecordType>;
|
|
45
|
+
childrenColumnName: string;
|
|
46
|
+
rowHoverable?: boolean;
|
|
47
|
+
expandedRowOffset: ExpandableConfig<RecordType>['expandedRowOffset'];
|
|
48
|
+
measureRowRender?: (measureRow: React.ReactNode) => React.ReactNode;
|
|
49
|
+
}
|
|
50
|
+
declare const TableContext: import("../../../_util/context").SelectorContext<TableContextProps<any>>;
|
|
51
|
+
export default TableContext;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createContext, createImmutable } from "../../../_util/context";
|
|
2
|
+
var _createImmutable = createImmutable(),
|
|
3
|
+
makeImmutable = _createImmutable.makeImmutable,
|
|
4
|
+
responseImmutable = _createImmutable.responseImmutable,
|
|
5
|
+
useImmutableMark = _createImmutable.useImmutableMark;
|
|
6
|
+
export { makeImmutable, responseImmutable, useImmutableMark };
|
|
7
|
+
var TableContext = createContext();
|
|
8
|
+
export default TableContext;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useContainerWidth(prefixCls: string): (ele: HTMLElement, width: number) => number;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default function useContainerWidth(prefixCls) {
|
|
2
|
+
var getContainerWidth = function getContainerWidth(ele, width) {
|
|
3
|
+
var container = ele.querySelector(".".concat(prefixCls, "-container"));
|
|
4
|
+
var returnWidth = width;
|
|
5
|
+
if (container) {
|
|
6
|
+
var style = getComputedStyle(container);
|
|
7
|
+
var borderLeft = Number.parseInt(style.borderLeftWidth, 10);
|
|
8
|
+
var borderRight = Number.parseInt(style.borderRightWidth, 10);
|
|
9
|
+
returnWidth = width - borderLeft - borderRight;
|
|
10
|
+
}
|
|
11
|
+
return returnWidth;
|
|
12
|
+
};
|
|
13
|
+
return getContainerWidth;
|
|
14
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AnyObject } from '../../../_util/type';
|
|
2
|
+
import type { GetRowKey, Key } from '../../interface';
|
|
3
|
+
declare const useLazyKVMap: <RecordType extends AnyObject = AnyObject>(data: readonly RecordType[], childrenColumnName: string, getRowKey: GetRowKey<RecordType>) => readonly [(key: Key) => RecordType];
|
|
4
|
+
export default useLazyKVMap;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { isPlainObject } from "../../../_util/is";
|
|
3
|
+
var useLazyKVMap = function useLazyKVMap(data, childrenColumnName, getRowKey) {
|
|
4
|
+
var mapCacheRef = React.useRef({});
|
|
5
|
+
function getRecordByKey(key) {
|
|
6
|
+
var _mapCacheRef$current$;
|
|
7
|
+
if (!mapCacheRef.current || mapCacheRef.current.data !== data || mapCacheRef.current.childrenColumnName !== childrenColumnName || mapCacheRef.current.getRowKey !== getRowKey) {
|
|
8
|
+
var kvMap = new Map();
|
|
9
|
+
function dig(records) {
|
|
10
|
+
records.forEach(function (record, index) {
|
|
11
|
+
var rowKey = getRowKey(record, index);
|
|
12
|
+
kvMap.set(rowKey, record);
|
|
13
|
+
if (isPlainObject(record) && childrenColumnName in record) {
|
|
14
|
+
dig(record[childrenColumnName] || []);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
dig(data);
|
|
19
|
+
mapCacheRef.current = {
|
|
20
|
+
data: data,
|
|
21
|
+
childrenColumnName: childrenColumnName,
|
|
22
|
+
kvMap: kvMap,
|
|
23
|
+
getRowKey: getRowKey
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return (_mapCacheRef$current$ = mapCacheRef.current.kvMap) === null || _mapCacheRef$current$ === void 0 ? void 0 : _mapCacheRef$current$.get(key);
|
|
27
|
+
}
|
|
28
|
+
return [getRecordByKey];
|
|
29
|
+
};
|
|
30
|
+
export default useLazyKVMap;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
declare function useRenderTimes<T extends object>(props?: T, debug?: string): number;
|
|
3
|
+
declare const _default: typeof useRenderTimes | (() => void);
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const RenderBlock: React.MemoExoticComponent<() => React.JSX.Element>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* istanbul ignore file */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
function useRenderTimes(props, debug) {
|
|
4
|
+
// Render times
|
|
5
|
+
var timesRef = React.useRef(0);
|
|
6
|
+
timesRef.current += 1;
|
|
7
|
+
|
|
8
|
+
// Props changed
|
|
9
|
+
var propsRef = React.useRef(props);
|
|
10
|
+
var keys = [];
|
|
11
|
+
Object.keys(props || {}).forEach(function (key) {
|
|
12
|
+
var nextProps = props;
|
|
13
|
+
var prevProps = propsRef.current;
|
|
14
|
+
if ((nextProps === null || nextProps === void 0 ? void 0 : nextProps[key]) !== (prevProps === null || prevProps === void 0 ? void 0 : prevProps[key])) {
|
|
15
|
+
keys.push(key);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
propsRef.current = props;
|
|
19
|
+
|
|
20
|
+
// Cache keys since React rerender may cause it lost
|
|
21
|
+
var keysRef = React.useRef([]);
|
|
22
|
+
if (keys.length) {
|
|
23
|
+
keysRef.current = keys;
|
|
24
|
+
}
|
|
25
|
+
React.useDebugValue(timesRef.current);
|
|
26
|
+
React.useDebugValue(keysRef.current.join(', '));
|
|
27
|
+
if (debug) {
|
|
28
|
+
console.warn("".concat(debug, ":"), timesRef.current, keysRef.current);
|
|
29
|
+
}
|
|
30
|
+
return timesRef.current;
|
|
31
|
+
}
|
|
32
|
+
export default process.env.NODE_ENV !== 'production' ? useRenderTimes : function () {};
|
|
33
|
+
export var RenderBlock = /*#__PURE__*/React.memo(function () {
|
|
34
|
+
var times = useRenderTimes();
|
|
35
|
+
return /*#__PURE__*/React.createElement("h1", null, "Render Times: ", times);
|
|
36
|
+
});
|
|
37
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
38
|
+
RenderBlock.displayName = 'RenderBlock';
|
|
39
|
+
}
|