@lobehub/ui 6.0.0-beta.7 → 6.0.0-beta.9
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/es/Accordion/Accordion.mjs +3 -3
- package/es/Accordion/Accordion.mjs.map +1 -1
- package/es/Accordion/atoms.mjs +2 -2
- package/es/Accordion/atoms.mjs.map +1 -1
- package/es/Accordion/style.d.mts +1 -1
- package/es/ActionIcon/ActionIcon.mjs +2 -2
- package/es/ActionIcon/ActionIcon.mjs.map +1 -1
- package/es/Alert/Alert.mjs +5 -5
- package/es/Alert/Alert.mjs.map +1 -1
- package/es/AutoComplete/AutoComplete.mjs +5 -5
- package/es/AutoComplete/AutoComplete.mjs.map +1 -1
- package/es/AutoComplete/style.mjs +2 -2
- package/es/AutoComplete/style.mjs.map +1 -1
- package/es/Avatar/Avatar.mjs +2 -2
- package/es/Avatar/Avatar.mjs.map +1 -1
- package/es/Avatar/AvatarGroup/index.mjs +2 -2
- package/es/Avatar/AvatarGroup/index.mjs.map +1 -1
- package/es/Breadcrumb/Breadcrumb.mjs +2 -2
- package/es/Breadcrumb/Breadcrumb.mjs.map +1 -1
- package/es/Button/Button.mjs +1 -1
- package/es/Button/Button.mjs.map +1 -1
- package/es/Button/style.d.mts +8 -1
- package/es/Button/style.mjs +41 -18
- package/es/Button/style.mjs.map +1 -1
- package/es/Checkbox/Checkbox.mjs +3 -3
- package/es/Checkbox/Checkbox.mjs.map +1 -1
- package/es/CodeDiff/DiffPanel.mjs +4 -4
- package/es/CodeDiff/DiffPanel.mjs.map +1 -1
- package/es/CodeEditor/CodeEditor.mjs +4 -4
- package/es/CodeEditor/CodeEditor.mjs.map +1 -1
- package/es/ColorPicker/ColorInputs.mjs +136 -0
- package/es/ColorPicker/ColorInputs.mjs.map +1 -0
- package/es/ColorPicker/ColorPanel.mjs +145 -0
- package/es/ColorPicker/ColorPanel.mjs.map +1 -0
- package/es/ColorPicker/ColorPicker.mjs +62 -199
- package/es/ColorPicker/ColorPicker.mjs.map +1 -1
- package/es/ColorPicker/SaturationArea.mjs +2 -1
- package/es/ColorPicker/SaturationArea.mjs.map +1 -1
- package/es/ColorPicker/Swatch.mjs +24 -0
- package/es/ColorPicker/Swatch.mjs.map +1 -0
- package/es/ColorPicker/Swatches.mjs +66 -0
- package/es/ColorPicker/Swatches.mjs.map +1 -0
- package/es/ColorPicker/Trigger.mjs +112 -0
- package/es/ColorPicker/Trigger.mjs.map +1 -0
- package/es/ColorPicker/color.mjs +25 -1
- package/es/ColorPicker/color.mjs.map +1 -1
- package/es/ColorPicker/recent.mjs +25 -0
- package/es/ColorPicker/recent.mjs.map +1 -0
- package/es/ColorPicker/style.mjs +269 -70
- package/es/ColorPicker/style.mjs.map +1 -1
- package/es/ColorPicker/type.d.mts +15 -0
- package/es/ContextMenu/ContextMenuHost.mjs +2 -2
- package/es/ContextMenu/ContextMenuHost.mjs.map +1 -1
- package/es/ContextMenu/ContextMenuTrigger.mjs +2 -2
- package/es/ContextMenu/ContextMenuTrigger.mjs.map +1 -1
- package/es/ContextMenu/renderItems.mjs +3 -3
- package/es/ContextMenu/renderItems.mjs.map +1 -1
- package/es/DatePicker/DatePicker.d.mts +9 -2
- package/es/DatePicker/DatePicker.mjs +15 -85
- package/es/DatePicker/DatePicker.mjs.map +1 -1
- package/es/DatePicker/DateRangePicker.d.mts +3 -2
- package/es/DatePicker/DateRangePicker.mjs +3 -125
- package/es/DatePicker/DateRangePicker.mjs.map +1 -1
- package/es/DatePicker/DayjsDatePicker.d.mts +12 -0
- package/es/DatePicker/DayjsDatePicker.mjs +19 -0
- package/es/DatePicker/DayjsDatePicker.mjs.map +1 -0
- package/es/DatePicker/DayjsDateRangePicker.d.mts +7 -0
- package/es/DatePicker/DayjsDateRangePicker.mjs +8 -0
- package/es/DatePicker/DayjsDateRangePicker.mjs.map +1 -0
- package/es/DatePicker/PurePanel.mjs +65 -0
- package/es/DatePicker/PurePanel.mjs.map +1 -0
- package/es/DatePicker/RangePicker.mjs +121 -0
- package/es/DatePicker/RangePicker.mjs.map +1 -0
- package/es/DatePicker/SinglePicker.mjs +134 -0
- package/es/DatePicker/SinglePicker.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/Popup/Footer.mjs +57 -0
- package/es/DatePicker/core/PickerInput/Popup/Footer.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/Popup/PopupPanel.mjs +57 -0
- package/es/DatePicker/core/PickerInput/Popup/PopupPanel.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/Popup/PresetPanel.mjs +29 -0
- package/es/DatePicker/core/PickerInput/Popup/PresetPanel.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/Popup/index.mjs +133 -0
- package/es/DatePicker/core/PickerInput/Popup/index.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/RangePicker.d.mts +51 -0
- package/es/DatePicker/core/PickerInput/RangePicker.mjs +343 -0
- package/es/DatePicker/core/PickerInput/RangePicker.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/Selector/ClearIcon.mjs +27 -0
- package/es/DatePicker/core/PickerInput/Selector/ClearIcon.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/Selector/Icon.mjs +19 -0
- package/es/DatePicker/core/PickerInput/Selector/Icon.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/Selector/Input.mjs +237 -0
- package/es/DatePicker/core/PickerInput/Selector/Input.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/Selector/MaskFormat.mjs +70 -0
- package/es/DatePicker/core/PickerInput/Selector/MaskFormat.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/Selector/RangeSelector.d.mts +8 -0
- package/es/DatePicker/core/PickerInput/Selector/RangeSelector.mjs +136 -0
- package/es/DatePicker/core/PickerInput/Selector/RangeSelector.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/Selector/SingleSelector/HoverSelector.mjs +28 -0
- package/es/DatePicker/core/PickerInput/Selector/SingleSelector/HoverSelector.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/Selector/SingleSelector/MultipleDates.mjs +69 -0
- package/es/DatePicker/core/PickerInput/Selector/SingleSelector/MultipleDates.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/Selector/SingleSelector/index.mjs +111 -0
- package/es/DatePicker/core/PickerInput/Selector/SingleSelector/index.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/Selector/hooks/useClearIcon.mjs +18 -0
- package/es/DatePicker/core/PickerInput/Selector/hooks/useClearIcon.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/Selector/hooks/useInputProps.mjs +108 -0
- package/es/DatePicker/core/PickerInput/Selector/hooks/useInputProps.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/Selector/hooks/useRootProps.mjs +11 -0
- package/es/DatePicker/core/PickerInput/Selector/hooks/useRootProps.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/Selector/util.mjs +20 -0
- package/es/DatePicker/core/PickerInput/Selector/util.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/SinglePicker.d.mts +55 -0
- package/es/DatePicker/core/PickerInput/SinglePicker.mjs +318 -0
- package/es/DatePicker/core/PickerInput/SinglePicker.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/context.mjs +7 -0
- package/es/DatePicker/core/PickerInput/context.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/hooks/useCellRender.mjs +30 -0
- package/es/DatePicker/core/PickerInput/hooks/useCellRender.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/hooks/useDelayState.mjs +37 -0
- package/es/DatePicker/core/PickerInput/hooks/useDelayState.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/hooks/useDisabledBoundary.mjs +18 -0
- package/es/DatePicker/core/PickerInput/hooks/useDisabledBoundary.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/hooks/useFieldFormat.mjs +20 -0
- package/es/DatePicker/core/PickerInput/hooks/useFieldFormat.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/hooks/useFieldsInvalidate.mjs +31 -0
- package/es/DatePicker/core/PickerInput/hooks/useFieldsInvalidate.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/hooks/useFilledProps.mjs +98 -0
- package/es/DatePicker/core/PickerInput/hooks/useFilledProps.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/hooks/useFocusEvents.mjs +41 -0
- package/es/DatePicker/core/PickerInput/hooks/useFocusEvents.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/hooks/useFocusLock.mjs +34 -0
- package/es/DatePicker/core/PickerInput/hooks/useFocusLock.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/hooks/useHoverStore.mjs +35 -0
- package/es/DatePicker/core/PickerInput/hooks/useHoverStore.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/hooks/useInputReadOnly.mjs +9 -0
- package/es/DatePicker/core/PickerInput/hooks/useInputReadOnly.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/hooks/useInvalidate.mjs +36 -0
- package/es/DatePicker/core/PickerInput/hooks/useInvalidate.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/hooks/useLockEffect.mjs +27 -0
- package/es/DatePicker/core/PickerInput/hooks/useLockEffect.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/hooks/useOpen.mjs +18 -0
- package/es/DatePicker/core/PickerInput/hooks/useOpen.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/hooks/usePickerRef.mjs +19 -0
- package/es/DatePicker/core/PickerInput/hooks/usePickerRef.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/hooks/usePresets.mjs +20 -0
- package/es/DatePicker/core/PickerInput/hooks/usePresets.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/hooks/useRangeDisabledDate.mjs +24 -0
- package/es/DatePicker/core/PickerInput/hooks/useRangeDisabledDate.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/hooks/useRangePickerValue.mjs +107 -0
- package/es/DatePicker/core/PickerInput/hooks/useRangePickerValue.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/hooks/useRangeValue.mjs +144 -0
- package/es/DatePicker/core/PickerInput/hooks/useRangeValue.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/hooks/useRangeValueChange.mjs +219 -0
- package/es/DatePicker/core/PickerInput/hooks/useRangeValueChange.mjs.map +1 -0
- package/es/DatePicker/core/PickerInput/hooks/useShowNow.mjs +11 -0
- package/es/DatePicker/core/PickerInput/hooks/useShowNow.mjs.map +1 -0
- package/es/DatePicker/core/PickerPanel/DatePanel/index.mjs +131 -0
- package/es/DatePicker/core/PickerPanel/DatePanel/index.mjs.map +1 -0
- package/es/DatePicker/core/PickerPanel/DateTimePanel/index.mjs +35 -0
- package/es/DatePicker/core/PickerPanel/DateTimePanel/index.mjs.map +1 -0
- package/es/DatePicker/core/PickerPanel/DecadePanel/index.mjs +84 -0
- package/es/DatePicker/core/PickerPanel/DecadePanel/index.mjs.map +1 -0
- package/es/DatePicker/core/PickerPanel/MonthPanel/index.mjs +73 -0
- package/es/DatePicker/core/PickerPanel/MonthPanel/index.mjs.map +1 -0
- package/es/DatePicker/core/PickerPanel/PanelBody.mjs +95 -0
- package/es/DatePicker/core/PickerPanel/PanelBody.mjs.map +1 -0
- package/es/DatePicker/core/PickerPanel/PanelHeader.mjs +130 -0
- package/es/DatePicker/core/PickerPanel/PanelHeader.mjs.map +1 -0
- package/es/DatePicker/core/PickerPanel/QuarterPanel/index.mjs +64 -0
- package/es/DatePicker/core/PickerPanel/QuarterPanel/index.mjs.map +1 -0
- package/es/DatePicker/core/PickerPanel/TimePanel/TimeClock/ClockDial.mjs +108 -0
- package/es/DatePicker/core/PickerPanel/TimePanel/TimeClock/ClockDial.mjs.map +1 -0
- package/es/DatePicker/core/PickerPanel/TimePanel/TimeClock/geometry.mjs +44 -0
- package/es/DatePicker/core/PickerPanel/TimePanel/TimeClock/geometry.mjs.map +1 -0
- package/es/DatePicker/core/PickerPanel/TimePanel/TimeClock/index.mjs +157 -0
- package/es/DatePicker/core/PickerPanel/TimePanel/TimeClock/index.mjs.map +1 -0
- package/es/DatePicker/core/PickerPanel/TimePanel/TimePanelBody/TimeColumn.mjs +100 -0
- package/es/DatePicker/core/PickerPanel/TimePanel/TimePanelBody/TimeColumn.mjs.map +1 -0
- package/es/DatePicker/core/PickerPanel/TimePanel/TimePanelBody/index.mjs +71 -0
- package/es/DatePicker/core/PickerPanel/TimePanel/TimePanelBody/index.mjs.map +1 -0
- package/es/DatePicker/core/PickerPanel/TimePanel/TimePanelBody/useScrollTo.mjs +62 -0
- package/es/DatePicker/core/PickerPanel/TimePanel/TimePanelBody/useScrollTo.mjs.map +1 -0
- package/es/DatePicker/core/PickerPanel/TimePanel/TimePanelBody/useTimeState.mjs +200 -0
- package/es/DatePicker/core/PickerPanel/TimePanel/TimePanelBody/useTimeState.mjs.map +1 -0
- package/es/DatePicker/core/PickerPanel/TimePanel/TimePanelBody/util.mjs +25 -0
- package/es/DatePicker/core/PickerPanel/TimePanel/TimePanelBody/util.mjs.map +1 -0
- package/es/DatePicker/core/PickerPanel/TimePanel/index.mjs +31 -0
- package/es/DatePicker/core/PickerPanel/TimePanel/index.mjs.map +1 -0
- package/es/DatePicker/core/PickerPanel/WeekPanel/index.mjs +34 -0
- package/es/DatePicker/core/PickerPanel/WeekPanel/index.mjs.map +1 -0
- package/es/DatePicker/core/PickerPanel/YearPanel/index.mjs +92 -0
- package/es/DatePicker/core/PickerPanel/YearPanel/index.mjs.map +1 -0
- package/es/DatePicker/core/PickerPanel/context.mjs +48 -0
- package/es/DatePicker/core/PickerPanel/context.mjs.map +1 -0
- package/es/DatePicker/core/PickerPanel/index.d.mts +1 -0
- package/es/DatePicker/core/PickerPanel/index.mjs +175 -0
- package/es/DatePicker/core/PickerPanel/index.mjs.map +1 -0
- package/es/DatePicker/core/PickerPopup.mjs +118 -0
- package/es/DatePicker/core/PickerPopup.mjs.map +1 -0
- package/es/DatePicker/core/generate/dayjs.mjs +109 -0
- package/es/DatePicker/core/generate/dayjs.mjs.map +1 -0
- package/es/DatePicker/core/generate/index.d.mts +40 -0
- package/es/DatePicker/core/hooks/react.mjs +58 -0
- package/es/DatePicker/core/hooks/react.mjs.map +1 -0
- package/es/DatePicker/core/hooks/useLocale.mjs +51 -0
- package/es/DatePicker/core/hooks/useLocale.mjs.map +1 -0
- package/es/DatePicker/core/hooks/useSemantic.mjs +20 -0
- package/es/DatePicker/core/hooks/useSemantic.mjs.map +1 -0
- package/es/DatePicker/core/hooks/useSyncState.mjs +25 -0
- package/es/DatePicker/core/hooks/useSyncState.mjs.map +1 -0
- package/es/DatePicker/core/hooks/useTimeConfig.mjs +173 -0
- package/es/DatePicker/core/hooks/useTimeConfig.mjs.map +1 -0
- package/es/DatePicker/core/hooks/useTimeInfo.mjs +110 -0
- package/es/DatePicker/core/hooks/useTimeInfo.mjs.map +1 -0
- package/es/DatePicker/core/hooks/useToggleDates.mjs +21 -0
- package/es/DatePicker/core/hooks/useToggleDates.mjs.map +1 -0
- package/es/DatePicker/core/index.d.mts +5 -0
- package/es/DatePicker/core/index.mjs +9 -0
- package/es/DatePicker/core/index.mjs.map +1 -0
- package/es/DatePicker/core/interface.d.mts +325 -0
- package/es/DatePicker/core/locale/common.mjs +11 -0
- package/es/DatePicker/core/locale/common.mjs.map +1 -0
- package/es/DatePicker/core/locale/en_US.mjs +39 -0
- package/es/DatePicker/core/locale/en_US.mjs.map +1 -0
- package/es/DatePicker/core/utils/common.mjs +73 -0
- package/es/DatePicker/core/utils/common.mjs.map +1 -0
- package/es/DatePicker/core/utils/dateUtil.mjs +106 -0
- package/es/DatePicker/core/utils/dateUtil.mjs.map +1 -0
- package/es/DatePicker/core/utils/miscUtil.mjs +46 -0
- package/es/DatePicker/core/utils/miscUtil.mjs.map +1 -0
- package/es/DatePicker/core/utils/uiUtil.mjs +9 -0
- package/es/DatePicker/core/utils/uiUtil.mjs.map +1 -0
- package/es/DatePicker/dateGenerateConfig.mjs +52 -0
- package/es/DatePicker/dateGenerateConfig.mjs.map +1 -0
- package/es/DatePicker/generateConfig.mjs +12 -0
- package/es/DatePicker/generateConfig.mjs.map +1 -0
- package/es/DatePicker/generatePicker.d.mts +12 -0
- package/es/DatePicker/generatePicker.mjs +22 -0
- package/es/DatePicker/generatePicker.mjs.map +1 -0
- package/es/DatePicker/index.d.mts +8 -3
- package/es/DatePicker/index.mjs +5 -1
- package/es/DatePicker/legacyDate.mjs +58 -0
- package/es/DatePicker/legacyDate.mjs.map +1 -0
- package/es/DatePicker/locale.d.mts +15 -0
- package/es/DatePicker/locale.mjs +143 -0
- package/es/DatePicker/locale.mjs.map +1 -0
- package/es/DatePicker/semantic.mjs +29 -0
- package/es/DatePicker/semantic.mjs.map +1 -0
- package/es/DatePicker/style.mjs +3 -155
- package/es/DatePicker/style.mjs.map +1 -1
- package/es/DatePicker/type.d.mts +294 -27
- package/es/DatePicker/usePanelKeyboard.mjs +230 -0
- package/es/DatePicker/usePanelKeyboard.mjs.map +1 -0
- package/es/DatePicker/usePickerShared.mjs +106 -0
- package/es/DatePicker/usePickerShared.mjs.map +1 -0
- package/es/DatePicker/usePresetActive.mjs +49 -0
- package/es/DatePicker/usePresetActive.mjs.map +1 -0
- package/es/DraggablePanel/atoms.mjs +5 -5
- package/es/DraggablePanel/atoms.mjs.map +1 -1
- package/es/DraggableSideNav/DraggableSideNav.mjs +3 -3
- package/es/DraggableSideNav/DraggableSideNav.mjs.map +1 -1
- package/es/Drawer/Drawer.mjs +2 -2
- package/es/Drawer/Drawer.mjs.map +1 -1
- package/es/Drawer/atoms.mjs +6 -6
- package/es/Drawer/atoms.mjs.map +1 -1
- package/es/DropdownMenu/atoms.mjs +22 -22
- package/es/DropdownMenu/atoms.mjs.map +1 -1
- package/es/DropdownMenu/sharedStyle.mjs +2 -2
- package/es/DropdownMenu/sharedStyle.mjs.map +1 -1
- package/es/EditorSlashMenu/atoms.mjs +12 -12
- package/es/EditorSlashMenu/atoms.mjs.map +1 -1
- package/es/EmojiPicker/EmojiPicker.mjs +7 -7
- package/es/EmojiPicker/EmojiPicker.mjs.map +1 -1
- package/es/EmojiPicker/loadEmojiData.mjs +6 -0
- package/es/EmojiPicker/loadEmojiData.mjs.map +1 -0
- package/es/FloatingPanel/FloatingPanel.mjs +2 -2
- package/es/FloatingPanel/FloatingPanel.mjs.map +1 -1
- package/es/FormKit/List.mjs +2 -2
- package/es/FormKit/List.mjs.map +1 -1
- package/es/Highlighter/FullFeatured.mjs +2 -2
- package/es/Highlighter/FullFeatured.mjs.map +1 -1
- package/es/Highlighter/SyntaxHighlighter/StreamRenderer.mjs +2 -2
- package/es/Highlighter/SyntaxHighlighter/StreamRenderer.mjs.map +1 -1
- package/es/Highlighter/SyntaxHighlighter/index.mjs +4 -4
- package/es/Highlighter/SyntaxHighlighter/index.mjs.map +1 -1
- package/es/Highlighter/style.mjs +2 -2
- package/es/Highlighter/style.mjs.map +1 -1
- package/es/HtmlPreview/HtmlPreview.mjs +2 -2
- package/es/HtmlPreview/HtmlPreview.mjs.map +1 -1
- package/es/Icon/Icon.mjs +2 -2
- package/es/Icon/Icon.mjs.map +1 -1
- package/es/List/ListRow.mjs +3 -3
- package/es/List/ListRow.mjs.map +1 -1
- package/es/Markdown/Markdown.mjs +2 -2
- package/es/Markdown/Markdown.mjs.map +1 -1
- package/es/Markdown/Typography.mjs +2 -2
- package/es/Markdown/Typography.mjs.map +1 -1
- package/es/Mermaid/FullFeatured.mjs +2 -2
- package/es/Mermaid/FullFeatured.mjs.map +1 -1
- package/es/Mermaid/SyntaxMermaid/index.mjs +4 -4
- package/es/Mermaid/SyntaxMermaid/index.mjs.map +1 -1
- package/es/Modal/atoms.mjs +6 -6
- package/es/Modal/atoms.mjs.map +1 -1
- package/es/Pagination/Pagination.mjs +181 -41
- package/es/Pagination/Pagination.mjs.map +1 -1
- package/es/Pagination/helpers.mjs +3 -3
- package/es/Pagination/helpers.mjs.map +1 -1
- package/es/Pagination/index.d.mts +2 -2
- package/es/Pagination/marker.stylex.mjs +9 -0
- package/es/Pagination/marker.stylex.mjs.map +1 -0
- package/es/Pagination/style.mjs +74 -4
- package/es/Pagination/style.mjs.map +1 -1
- package/es/Pagination/type.d.mts +41 -3
- package/es/Popover/PopoverInGroup.mjs +2 -2
- package/es/Popover/PopoverInGroup.mjs.map +1 -1
- package/es/Popover/atoms.mjs +6 -6
- package/es/Popover/atoms.mjs.map +1 -1
- package/es/ProTable/ProTable.d.mts +11 -0
- package/es/ProTable/ProTable.mjs +208 -0
- package/es/ProTable/ProTable.mjs.map +1 -0
- package/es/ProTable/hooks/useColumnRequest.mjs +55 -0
- package/es/ProTable/hooks/useColumnRequest.mjs.map +1 -0
- package/es/ProTable/hooks/useColumnsState.mjs +37 -0
- package/es/ProTable/hooks/useColumnsState.mjs.map +1 -0
- package/es/ProTable/hooks/useDelayedFlag.mjs +18 -0
- package/es/ProTable/hooks/useDelayedFlag.mjs.map +1 -0
- package/es/ProTable/hooks/useDensity.mjs +15 -0
- package/es/ProTable/hooks/useDensity.mjs.map +1 -0
- package/es/ProTable/hooks/useFetchData.mjs +97 -0
- package/es/ProTable/hooks/useFetchData.mjs.map +1 -0
- package/es/ProTable/hooks/useFullscreen.mjs +22 -0
- package/es/ProTable/hooks/useFullscreen.mjs.map +1 -0
- package/es/ProTable/hooks/usePageInfo.mjs +35 -0
- package/es/ProTable/hooks/usePageInfo.mjs.map +1 -0
- package/es/ProTable/hooks/useProColumns.mjs +123 -0
- package/es/ProTable/hooks/useProColumns.mjs.map +1 -0
- package/es/ProTable/hooks/useProLoading.mjs +19 -0
- package/es/ProTable/hooks/useProLoading.mjs.map +1 -0
- package/es/ProTable/hooks/useProLocale.mjs +22 -0
- package/es/ProTable/hooks/useProLocale.mjs.map +1 -0
- package/es/ProTable/hooks/useProRequest.mjs +137 -0
- package/es/ProTable/hooks/useProRequest.mjs.map +1 -0
- package/es/ProTable/hooks/useRowCache.mjs +11 -0
- package/es/ProTable/hooks/useRowCache.mjs.map +1 -0
- package/es/ProTable/hooks/useSearchForm.mjs +141 -0
- package/es/ProTable/hooks/useSearchForm.mjs.map +1 -0
- package/es/ProTable/hooks/useTableBindings.mjs +39 -0
- package/es/ProTable/hooks/useTableBindings.mjs.map +1 -0
- package/es/ProTable/hooks/useTableSelection.mjs +14 -0
- package/es/ProTable/hooks/useTableSelection.mjs.map +1 -0
- package/es/ProTable/index.d.mts +4 -0
- package/es/ProTable/index.d.ts +1 -0
- package/es/ProTable/index.js +1 -0
- package/es/ProTable/index.mjs +3 -0
- package/es/ProTable/locale.d.mts +15 -0
- package/es/ProTable/locale.mjs +66 -0
- package/es/ProTable/locale.mjs.map +1 -0
- package/es/ProTable/parts/ColumnSetting.mjs +155 -0
- package/es/ProTable/parts/ColumnSetting.mjs.map +1 -0
- package/es/ProTable/parts/FieldControl.mjs +117 -0
- package/es/ProTable/parts/FieldControl.mjs.map +1 -0
- package/es/ProTable/parts/KeywordInput.mjs +19 -0
- package/es/ProTable/parts/KeywordInput.mjs.map +1 -0
- package/es/ProTable/parts/LightFilter.mjs +70 -0
- package/es/ProTable/parts/LightFilter.mjs.map +1 -0
- package/es/ProTable/parts/OptionPopover.mjs +17 -0
- package/es/ProTable/parts/OptionPopover.mjs.map +1 -0
- package/es/ProTable/parts/SearchForm.mjs +180 -0
- package/es/ProTable/parts/SearchForm.mjs.map +1 -0
- package/es/ProTable/parts/SearchSection.mjs +33 -0
- package/es/ProTable/parts/SearchSection.mjs.map +1 -0
- package/es/ProTable/parts/TableAlert.mjs +38 -0
- package/es/ProTable/parts/TableAlert.mjs.map +1 -0
- package/es/ProTable/parts/Toolbar.mjs +50 -0
- package/es/ProTable/parts/Toolbar.mjs.map +1 -0
- package/es/ProTable/parts/ToolbarOptions.mjs +103 -0
- package/es/ProTable/parts/ToolbarOptions.mjs.map +1 -0
- package/es/ProTable/parts/renderValue.mjs +118 -0
- package/es/ProTable/parts/renderValue.mjs.map +1 -0
- package/es/ProTable/style.mjs +278 -0
- package/es/ProTable/style.mjs.map +1 -0
- package/es/ProTable/type.d.mts +397 -0
- package/es/ProTable/utils.mjs +152 -0
- package/es/ProTable/utils.mjs.map +1 -0
- package/es/Radio/Radio.mjs +3 -3
- package/es/Radio/Radio.mjs.map +1 -1
- package/es/ScrollArea/atoms.mjs +4 -4
- package/es/ScrollArea/atoms.mjs.map +1 -1
- package/es/Segmented/Segmented.mjs +3 -3
- package/es/Segmented/Segmented.mjs.map +1 -1
- package/es/Segmented/atoms.mjs +2 -2
- package/es/Segmented/atoms.mjs.map +1 -1
- package/es/Select/Select.mjs +22 -13
- package/es/Select/Select.mjs.map +1 -1
- package/es/Select/atoms.mjs +4 -4
- package/es/Select/atoms.mjs.map +1 -1
- package/es/Select/helpers.mjs +8 -1
- package/es/Select/helpers.mjs.map +1 -1
- package/es/Select/hooks.mjs +8 -4
- package/es/Select/hooks.mjs.map +1 -1
- package/es/Select/renderOptions.mjs +2 -2
- package/es/Select/renderOptions.mjs.map +1 -1
- package/es/Select/type.d.mts +7 -0
- package/es/Switch/Switch.mjs +2 -2
- package/es/Switch/Switch.mjs.map +1 -1
- package/es/Switch/atoms.mjs +2 -2
- package/es/Switch/atoms.mjs.map +1 -1
- package/es/Table/Column.d.mts +8 -0
- package/es/Table/Column.mjs +6 -0
- package/es/Table/Column.mjs.map +1 -0
- package/es/Table/ColumnGroup.d.mts +11 -0
- package/es/Table/ColumnGroup.mjs +6 -0
- package/es/Table/ColumnGroup.mjs.map +1 -0
- package/es/Table/Table.d.mts +16 -2
- package/es/Table/Table.mjs +149 -118
- package/es/Table/Table.mjs.map +1 -1
- package/es/Table/atoms/cells.d.mts +42 -0
- package/es/Table/atoms/cells.mjs +72 -0
- package/es/Table/atoms/cells.mjs.map +1 -0
- package/es/Table/atoms/index.d.mts +3 -0
- package/es/Table/atoms/layout.d.mts +44 -0
- package/es/Table/atoms/layout.mjs +62 -0
- package/es/Table/atoms/layout.mjs.map +1 -0
- package/es/Table/constants.mjs +16 -0
- package/es/Table/constants.mjs.map +1 -0
- package/es/Table/engine/fixed.d.mts +1 -0
- package/es/Table/engine/fixed.mjs +53 -0
- package/es/Table/engine/fixed.mjs.map +1 -0
- package/es/Table/engine/types.d.mts +1 -0
- package/es/Table/engine/useTableEngine.mjs +180 -0
- package/es/Table/engine/useTableEngine.mjs.map +1 -0
- package/es/Table/index.d.mts +7 -2
- package/es/Table/index.mjs +4 -1
- package/es/Table/internal.d.mts +3 -0
- package/es/Table/pipeline/columnUtils.d.mts +5 -0
- package/es/Table/pipeline/columnUtils.mjs +58 -0
- package/es/Table/pipeline/columnUtils.mjs.map +1 -0
- package/es/Table/pipeline/convertChildrenToColumns.mjs +24 -0
- package/es/Table/pipeline/convertChildrenToColumns.mjs.map +1 -0
- package/es/Table/pipeline/normalizeColumns.mjs +140 -0
- package/es/Table/pipeline/normalizeColumns.mjs.map +1 -0
- package/es/Table/pipeline/selectionUtils.d.mts +9 -0
- package/es/Table/pipeline/selectionUtils.mjs +115 -0
- package/es/Table/pipeline/selectionUtils.mjs.map +1 -0
- package/es/Table/pipeline/useBreakpoint.mjs +36 -0
- package/es/Table/pipeline/useBreakpoint.mjs.map +1 -0
- package/es/Table/pipeline/useExpandable.mjs +45 -0
- package/es/Table/pipeline/useExpandable.mjs.map +1 -0
- package/es/Table/pipeline/useFilter.mjs +52 -0
- package/es/Table/pipeline/useFilter.mjs.map +1 -0
- package/es/Table/pipeline/useSelection.mjs +302 -0
- package/es/Table/pipeline/useSelection.mjs.map +1 -0
- package/es/Table/pipeline/useSorter.mjs +146 -0
- package/es/Table/pipeline/useSorter.mjs.map +1 -0
- package/es/Table/pipeline/useTableLocale.mjs +30 -0
- package/es/Table/pipeline/useTableLocale.mjs.map +1 -0
- package/es/Table/pipeline/useTableState.mjs +118 -0
- package/es/Table/pipeline/useTableState.mjs.map +1 -0
- package/es/Table/pipeline/useVirtualLayout.mjs +80 -0
- package/es/Table/pipeline/useVirtualLayout.mjs.map +1 -0
- package/es/Table/render/Body.mjs +150 -0
- package/es/Table/render/Body.mjs.map +1 -0
- package/es/Table/render/BodyCell.mjs +87 -0
- package/es/Table/render/BodyCell.mjs.map +1 -0
- package/es/Table/render/CellShell.mjs +84 -0
- package/es/Table/render/CellShell.mjs.map +1 -0
- package/es/Table/render/ExpandIcon.mjs +28 -0
- package/es/Table/render/ExpandIcon.mjs.map +1 -0
- package/es/Table/render/FilterDropdown.mjs +139 -0
- package/es/Table/render/FilterDropdown.mjs.map +1 -0
- package/es/Table/render/FilterPanel.mjs +152 -0
- package/es/Table/render/FilterPanel.mjs.map +1 -0
- package/es/Table/render/FixedFrost.mjs +113 -0
- package/es/Table/render/FixedFrost.mjs.map +1 -0
- package/es/Table/render/FixedHolder.mjs +51 -0
- package/es/Table/render/FixedHolder.mjs.map +1 -0
- package/es/Table/render/Header.mjs +184 -0
- package/es/Table/render/Header.mjs.map +1 -0
- package/es/Table/render/LoadingSkeleton.mjs +78 -0
- package/es/Table/render/LoadingSkeleton.mjs.map +1 -0
- package/es/Table/render/PaginationBar.mjs +71 -0
- package/es/Table/render/PaginationBar.mjs.map +1 -0
- package/es/Table/render/SelectionCells.mjs +111 -0
- package/es/Table/render/SelectionCells.mjs.map +1 -0
- package/es/Table/render/StickyScrollBar.mjs +99 -0
- package/es/Table/render/StickyScrollBar.mjs.map +1 -0
- package/es/Table/render/Summary.d.mts +16 -0
- package/es/Table/render/Summary.mjs +58 -0
- package/es/Table/render/Summary.mjs.map +1 -0
- package/es/Table/render/TableView.mjs +215 -0
- package/es/Table/render/TableView.mjs.map +1 -0
- package/es/Table/render/VirtualBody.mjs +101 -0
- package/es/Table/render/VirtualBody.mjs.map +1 -0
- package/es/Table/render/context.mjs +15 -0
- package/es/Table/render/context.mjs.map +1 -0
- package/es/Table/render/filterUtils.mjs +22 -0
- package/es/Table/render/filterUtils.mjs.map +1 -0
- package/es/Table/render/tableHelpers.mjs +27 -0
- package/es/Table/render/tableHelpers.mjs.map +1 -0
- package/es/Table/render/useColGroups.mjs +23 -0
- package/es/Table/render/useColGroups.mjs.map +1 -0
- package/es/Table/render/useScrollSync.mjs +104 -0
- package/es/Table/render/useScrollSync.mjs.map +1 -0
- package/es/Table/render/useViewContexts.mjs +134 -0
- package/es/Table/render/useViewContexts.mjs.map +1 -0
- package/es/Table/semantic.mjs +45 -0
- package/es/Table/semantic.mjs.map +1 -0
- package/es/Table/store/createTableStore.d.mts +1 -0
- package/es/Table/store/createTableStore.mjs +40 -0
- package/es/Table/store/createTableStore.mjs.map +1 -0
- package/es/Table/store/hooks.mjs +24 -0
- package/es/Table/store/hooks.mjs.map +1 -0
- package/es/Table/style.mjs +175 -90
- package/es/Table/style.mjs.map +1 -1
- package/es/Table/type.d.mts +467 -37
- package/es/Table/useTableController.mjs +293 -0
- package/es/Table/useTableController.mjs.map +1 -0
- package/es/Tabs/Tabs.mjs +2 -2
- package/es/Tabs/Tabs.mjs.map +1 -1
- package/es/Tabs/atoms.mjs +2 -2
- package/es/Tabs/atoms.mjs.map +1 -1
- package/es/Tag/Tag.mjs +2 -2
- package/es/Tag/Tag.mjs.map +1 -1
- package/es/Text/Text.mjs +2 -2
- package/es/Text/Text.mjs.map +1 -1
- package/es/Text/style.d.mts +3 -3
- package/es/Text/style.mjs +3 -3
- package/es/Text/style.mjs.map +1 -1
- package/es/ToggleGroup/ToggleGroup.mjs +3 -3
- package/es/ToggleGroup/ToggleGroup.mjs.map +1 -1
- package/es/ToggleGroup/atoms.mjs +2 -2
- package/es/ToggleGroup/atoms.mjs.map +1 -1
- package/es/Tooltip/TooltipGroup.mjs +3 -3
- package/es/Tooltip/TooltipGroup.mjs.map +1 -1
- package/es/Tooltip/TooltipStandalone.mjs +3 -3
- package/es/Tooltip/TooltipStandalone.mjs.map +1 -1
- package/es/Tree/Tree.mjs +2 -2
- package/es/Tree/Tree.mjs.map +1 -1
- package/es/Tree/TreeNode.mjs +2 -2
- package/es/Tree/TreeNode.mjs.map +1 -1
- package/es/Video/Video.mjs +2 -2
- package/es/Video/Video.mjs.map +1 -1
- package/es/awesome/Features/FeatureItem.mjs +2 -2
- package/es/awesome/Features/FeatureItem.mjs.map +1 -1
- package/es/awesome/Hero/Hero.mjs +3 -3
- package/es/awesome/Hero/Hero.mjs.map +1 -1
- package/es/awesome/InstallBanner/InstallBanner.mjs +2 -2
- package/es/awesome/InstallBanner/InstallBanner.mjs.map +1 -1
- package/es/awesome/LandingHero/LandingHero.mjs +3 -3
- package/es/awesome/LandingHero/LandingHero.mjs.map +1 -1
- package/es/awesome/LogoMarquee/LogoMarquee.mjs +2 -2
- package/es/awesome/LogoMarquee/LogoMarquee.mjs.map +1 -1
- package/es/awesome/TypewriterEffect/TypewriterEffect.mjs +4 -4
- package/es/awesome/TypewriterEffect/TypewriterEffect.mjs.map +1 -1
- package/es/awesome/landingActions.mjs +2 -2
- package/es/awesome/landingActions.mjs.map +1 -1
- package/es/chat/ChatItem/ChatItem.mjs +2 -2
- package/es/chat/ChatItem/ChatItem.mjs.map +1 -1
- package/es/chat/EditableMessage/EditableMessage.mjs +3 -3
- package/es/chat/EditableMessage/EditableMessage.mjs.map +1 -1
- package/es/chat/EditableMessageList/EditableMessageList.mjs +1 -1
- package/es/chat/MessageInput/MessageInput.mjs +3 -3
- package/es/chat/MessageInput/MessageInput.mjs.map +1 -1
- package/es/dashboard/AuthLayout/AuthLayout.mjs +8 -4
- package/es/dashboard/AuthLayout/AuthLayout.mjs.map +1 -1
- package/es/dashboard/AuthLayout/style.mjs +14 -3
- package/es/dashboard/AuthLayout/style.mjs.map +1 -1
- package/es/dashboard/AuthTools/AuthLocaleSwitch.mjs +2 -2
- package/es/dashboard/AuthTools/AuthLocaleSwitch.mjs.map +1 -1
- package/es/dashboard/AuthTools/AuthThemeSwitch.mjs +2 -2
- package/es/dashboard/AuthTools/AuthThemeSwitch.mjs.map +1 -1
- package/es/dashboard/ConsoleNav/ConsoleNav.mjs +3 -3
- package/es/dashboard/ConsoleNav/ConsoleNav.mjs.map +1 -1
- package/es/dashboard/ConsoleNav/style.mjs +2 -2
- package/es/dashboard/ConsoleNav/style.mjs.map +1 -1
- package/es/dashboard/ConsoleShell/style.mjs +1 -1
- package/es/dashboard/ConsoleShell/style.mjs.map +1 -1
- package/es/dashboard/FilterSidebar/FilterSidebar.mjs +1 -1
- package/es/dashboard/FilterSidebar/style.mjs +2 -2
- package/es/dashboard/FilterSidebar/style.mjs.map +1 -1
- package/es/dashboard/FilterStrip/style.mjs +1 -1
- package/es/dashboard/FilterStrip/style.mjs.map +1 -1
- package/es/dashboard/MetricStrip/MetricCell.mjs +25 -14
- package/es/dashboard/MetricStrip/MetricCell.mjs.map +1 -1
- package/es/dashboard/MetricStrip/style.mjs +14 -1
- package/es/dashboard/MetricStrip/style.mjs.map +1 -1
- package/es/dashboard/MetricStrip/type.d.mts +2 -0
- package/es/dashboard/PageSkeleton/style.mjs +2 -1
- package/es/dashboard/PageSkeleton/style.mjs.map +1 -1
- package/es/dashboard/StatCard/StatCard.d.mts +1 -1
- package/es/dashboard/StatCard/StatCard.mjs +2 -1
- package/es/dashboard/StatCard/StatCard.mjs.map +1 -1
- package/es/dashboard/StatCard/type.d.mts +2 -0
- package/es/dashboard/Surface/Surface.mjs +3 -4
- package/es/dashboard/Surface/Surface.mjs.map +1 -1
- package/es/dashboard/Surface/link.mjs +1 -1
- package/es/dashboard/Surface/link.mjs.map +1 -1
- package/es/dashboard/Surface/style.mjs +15 -14
- package/es/dashboard/Surface/style.mjs.map +1 -1
- package/es/dashboard/index.mjs +2 -2
- package/es/eslint/noBaseUiSubpath.mjs +2 -1
- package/es/eslint/noBaseUiSubpath.mjs.map +1 -1
- package/es/i18n/resources/en/colorPicker.d.mts +5 -0
- package/es/i18n/resources/en/colorPicker.mjs +5 -0
- package/es/i18n/resources/en/colorPicker.mjs.map +1 -1
- package/es/i18n/resources/en/datePicker.d.mts +54 -0
- package/es/i18n/resources/en/datePicker.mjs +55 -1
- package/es/i18n/resources/en/datePicker.mjs.map +1 -1
- package/es/i18n/resources/en/index.d.mts +4 -3
- package/es/i18n/resources/en/index.mjs +3 -1
- package/es/i18n/resources/en/index.mjs.map +1 -1
- package/es/i18n/resources/en/table.d.mts +23 -0
- package/es/i18n/resources/en/table.mjs +24 -0
- package/es/i18n/resources/en/table.mjs.map +1 -0
- package/es/i18n/resources/zhCn/colorPicker.d.mts +5 -0
- package/es/i18n/resources/zhCn/colorPicker.mjs +5 -0
- package/es/i18n/resources/zhCn/colorPicker.mjs.map +1 -1
- package/es/i18n/resources/zhCn/datePicker.d.mts +54 -0
- package/es/i18n/resources/zhCn/datePicker.mjs +55 -1
- package/es/i18n/resources/zhCn/datePicker.mjs.map +1 -1
- package/es/i18n/resources/zhCn/index.d.mts +4 -3
- package/es/i18n/resources/zhCn/index.mjs +4 -2
- package/es/i18n/resources/zhCn/index.mjs.map +1 -1
- package/es/i18n/resources/zhCn/table.d.mts +23 -0
- package/es/i18n/resources/zhCn/table.mjs +24 -0
- package/es/i18n/resources/zhCn/table.mjs.map +1 -0
- package/es/i18n/types.d.mts +3 -2
- package/es/index.d.mts +15 -6
- package/es/index.mjs +12 -6
- package/es/internal/overflow/OverflowList.mjs +71 -0
- package/es/internal/overflow/OverflowList.mjs.map +1 -0
- package/es/mdx/Callout/index.mjs +2 -2
- package/es/mdx/Callout/index.mjs.map +1 -1
- package/es/mdx/Cards/Card.mjs +2 -2
- package/es/mdx/Cards/Card.mjs.map +1 -1
- package/es/mdx/Cards/index.mjs +2 -2
- package/es/mdx/Cards/index.mjs.map +1 -1
- package/es/mdx/Mdx/index.mjs +2 -2
- package/es/mdx/Mdx/index.mjs.map +1 -1
- package/es/mdx/Steps/index.mjs +2 -2
- package/es/mdx/Steps/index.mjs.map +1 -1
- package/es/mdx/mdxComponents/Pre.mjs +5 -5
- package/es/mdx/mdxComponents/Pre.mjs.map +1 -1
- package/es/storybook/StoryBook/style.mjs +2 -0
- package/es/storybook/StoryBook/style.mjs.map +1 -1
- package/es/style.css +2966 -957
- package/es/styles/stylex/props.mjs +2 -2
- package/es/styles/stylex/props.mjs.map +1 -1
- package/es/styles/theme/themeCss.mjs +15 -0
- package/es/styles/theme/themeCss.mjs.map +1 -1
- package/es/theme.css +8 -0
- package/package.json +6 -1
- package/es/DatePicker/CalendarPanel.mjs +0 -189
- package/es/DatePicker/CalendarPanel.mjs.map +0 -1
- package/es/DatePicker/PickerShell.mjs +0 -43
- package/es/DatePicker/PickerShell.mjs.map +0 -1
- package/es/DatePicker/calendar.d.mts +0 -4
- package/es/DatePicker/calendar.mjs +0 -46
- package/es/DatePicker/calendar.mjs.map +0 -1
- package/es/Table/FilterMenu.mjs +0 -45
- package/es/Table/FilterMenu.mjs.map +0 -1
- package/es/Table/TableBody.mjs +0 -67
- package/es/Table/TableBody.mjs.map +0 -1
- package/es/Table/TableHead.mjs +0 -58
- package/es/Table/TableHead.mjs.map +0 -1
- package/es/Table/features.mjs +0 -12
- package/es/Table/features.mjs.map +0 -1
- package/es/Table/fixedOffsets.mjs +0 -29
- package/es/Table/fixedOffsets.mjs.map +0 -1
- package/es/Table/marker.stylex.mjs +0 -9
- package/es/Table/marker.stylex.mjs.map +0 -1
- package/es/Table/toColumnDefs.mjs +0 -26
- package/es/Table/toColumnDefs.mjs.map +0 -1
- package/es/Table/useTableState.mjs +0 -99
- package/es/Table/useTableState.mjs.map +0 -1
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Tooltip } from "../../Tooltip/Tooltip.mjs";
|
|
3
|
+
import ActionIcon from "../../ActionIcon/ActionIcon.mjs";
|
|
4
|
+
import { TableHeaderCell, TableRow } from "../atoms/cells.mjs";
|
|
5
|
+
import { TableHeader } from "../atoms/layout.mjs";
|
|
6
|
+
import { renderColumnTitle } from "../pipeline/columnUtils.mjs";
|
|
7
|
+
import { useHeaderView, useTableView } from "./context.mjs";
|
|
8
|
+
import { styles } from "../style.mjs";
|
|
9
|
+
import { SelectionHeaderTitle } from "./SelectionCells.mjs";
|
|
10
|
+
import { getMultiplePriority, getNextSortOrder } from "../pipeline/useSorter.mjs";
|
|
11
|
+
import FilterDropdown from "./FilterDropdown.mjs";
|
|
12
|
+
import { createElement } from "react";
|
|
13
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
import clsx$1 from "clsx";
|
|
15
|
+
import * as stylex from "@stylexjs/stylex";
|
|
16
|
+
import { ArrowDownFromLine, ArrowUpDown, ArrowUpToLine } from "lucide-react";
|
|
17
|
+
//#region src/Table/render/Header.tsx
|
|
18
|
+
const sx = (...list) => stylex.props(...list).className;
|
|
19
|
+
const sortTipOf = (next, locale) => next === "descend" ? locale.triggerDesc : next === "ascend" ? locale.triggerAsc : locale.cancelSort;
|
|
20
|
+
const ariaSortOf = (order) => order === "ascend" ? "ascending" : order === "descend" ? "descending" : "none";
|
|
21
|
+
const useDataHeader = (source) => {
|
|
22
|
+
const { prefixCls } = useTableView();
|
|
23
|
+
const header = useHeaderView();
|
|
24
|
+
const column = source.column;
|
|
25
|
+
const { id } = source;
|
|
26
|
+
const { filterDropdown, filters, onHeaderCell, showSorterTooltip, sortDirections, sortIcon, sorter } = column;
|
|
27
|
+
const order = sorter ? header.sortStates.find(({ key }) => key === id)?.sortOrder : void 0;
|
|
28
|
+
const titleNode = renderColumnTitle(column.title, header.titleProps);
|
|
29
|
+
const titleText = typeof titleNode === "string" || typeof titleNode === "number" ? String(titleNode) : void 0;
|
|
30
|
+
const titleContent = column.ellipsis ? /* @__PURE__ */ jsx("span", {
|
|
31
|
+
className: clsx$1(sx(styles.columnTitle), `${prefixCls}-column-title`),
|
|
32
|
+
children: titleNode
|
|
33
|
+
}) : titleNode;
|
|
34
|
+
const filterNode = filters || filterDropdown ? /* @__PURE__ */ jsx(FilterDropdown, {
|
|
35
|
+
column,
|
|
36
|
+
columnKey: id,
|
|
37
|
+
filterState: header.filterStates.find(({ key }) => key === id),
|
|
38
|
+
getPopupContainer: header.getPopupContainer,
|
|
39
|
+
label: titleText ?? id,
|
|
40
|
+
locale: header.locale,
|
|
41
|
+
triggerFilter: header.triggerFilter
|
|
42
|
+
}) : null;
|
|
43
|
+
const hasControls = Boolean(sorter) || Boolean(filterNode);
|
|
44
|
+
let sorterNode = null;
|
|
45
|
+
if (sorter) {
|
|
46
|
+
const nextOrder = getNextSortOrder(sortDirections ?? header.sortDirections, order);
|
|
47
|
+
const showTooltip = showSorterTooltip ?? header.showSorterTooltip;
|
|
48
|
+
const { target, ...tooltipOptions } = typeof showTooltip === "object" ? showTooltip : {};
|
|
49
|
+
const tooltipProps = {
|
|
50
|
+
title: sortTipOf(nextOrder, header.locale),
|
|
51
|
+
...tooltipOptions
|
|
52
|
+
};
|
|
53
|
+
const iconOnlyTooltip = Boolean(showTooltip) && target === "sorter-icon";
|
|
54
|
+
const onSort = () => header.triggerSort({
|
|
55
|
+
column,
|
|
56
|
+
key: id,
|
|
57
|
+
multiplePriority: getMultiplePriority(column),
|
|
58
|
+
sortOrder: nextOrder
|
|
59
|
+
});
|
|
60
|
+
const sortAction = /* @__PURE__ */ jsx(ActionIcon, {
|
|
61
|
+
active: Boolean(order),
|
|
62
|
+
className: clsx$1(sx(styles.sortCaret), `${prefixCls}-column-sorter`),
|
|
63
|
+
"data-order": order ?? void 0,
|
|
64
|
+
size: "small",
|
|
65
|
+
icon: sortIcon ? sortIcon({ sortOrder: order ?? null }) : order === "ascend" ? ArrowUpToLine : order === "descend" ? ArrowDownFromLine : ArrowUpDown,
|
|
66
|
+
...iconOnlyTooltip && showTooltip ? {
|
|
67
|
+
title: tooltipProps.title,
|
|
68
|
+
tooltipProps: tooltipOptions
|
|
69
|
+
} : {},
|
|
70
|
+
onClick: (event) => {
|
|
71
|
+
event.stopPropagation();
|
|
72
|
+
onSort();
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
const group = /* @__PURE__ */ jsxs("span", {
|
|
76
|
+
className: clsx$1(sx(styles.sortButton), `${prefixCls}-column-sorters`),
|
|
77
|
+
title: showTooltip ? void 0 : header.locale.sortTitle,
|
|
78
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
79
|
+
className: sx(styles.sortTitle),
|
|
80
|
+
onClick: onSort,
|
|
81
|
+
children: titleContent
|
|
82
|
+
}), sortAction]
|
|
83
|
+
});
|
|
84
|
+
sorterNode = showTooltip && !iconOnlyTooltip ? /* @__PURE__ */ jsx(Tooltip, {
|
|
85
|
+
...tooltipProps,
|
|
86
|
+
children: group
|
|
87
|
+
}) : group;
|
|
88
|
+
}
|
|
89
|
+
const cell = onHeaderCell?.(column);
|
|
90
|
+
return {
|
|
91
|
+
attributes: {
|
|
92
|
+
...sorter && { "aria-sort": ariaSortOf(order) },
|
|
93
|
+
...column.ellipsis && hasControls && titleText && { title: titleText },
|
|
94
|
+
...cell,
|
|
95
|
+
className: clsx$1(sorter && `${prefixCls}-column-has-sorters`, cell?.className)
|
|
96
|
+
},
|
|
97
|
+
className: order ? `${prefixCls}-column-sort` : void 0,
|
|
98
|
+
content: hasControls ? /* @__PURE__ */ jsxs("span", {
|
|
99
|
+
className: sx(styles.headerInner),
|
|
100
|
+
children: [sorterNode ?? titleContent, filterNode]
|
|
101
|
+
}) : titleContent
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
const DataHeaderContent = ({ children, source }) => /* @__PURE__ */ jsx(Fragment$1, { children: children(useDataHeader(source)) });
|
|
105
|
+
const HeaderTitle = ({ source }) => {
|
|
106
|
+
if (source.kind === "selection") return /* @__PURE__ */ jsx(SelectionHeaderTitle, {});
|
|
107
|
+
if (source.kind === "expand" || source.kind === "placeholder") return /* @__PURE__ */ jsx(Fragment$1, { children: source.column.title });
|
|
108
|
+
return /* @__PURE__ */ jsx(DataHeaderContent, {
|
|
109
|
+
source,
|
|
110
|
+
children: (parts) => parts.content
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
const HeaderCell = ({ cell, fixEndDelta }) => {
|
|
114
|
+
const { components, semanticClassNames, semanticStyles } = useTableView();
|
|
115
|
+
const { source } = cell.column;
|
|
116
|
+
const column = source.column;
|
|
117
|
+
const render = (parts) => {
|
|
118
|
+
const { className: attrClassName, style: attrStyle, ...attributes } = parts.attributes;
|
|
119
|
+
return /* @__PURE__ */ jsx(TableHeaderCell, {
|
|
120
|
+
...attributes,
|
|
121
|
+
align: column.align,
|
|
122
|
+
colSpan: cell.colSpan,
|
|
123
|
+
component: components.headerCell,
|
|
124
|
+
ellipsis: column.ellipsis,
|
|
125
|
+
fixStart: cell.fixedInfo.fixStart,
|
|
126
|
+
rowSpan: cell.rowSpan,
|
|
127
|
+
scope: column.title ? cell.colSpan > 1 ? "colgroup" : "col" : void 0,
|
|
128
|
+
shadowEnd: cell.fixedInfo.shadowEnd,
|
|
129
|
+
shadowStart: cell.fixedInfo.shadowStart,
|
|
130
|
+
style: {
|
|
131
|
+
...semanticStyles.header.cell,
|
|
132
|
+
...attrStyle
|
|
133
|
+
},
|
|
134
|
+
zIndex: cell.fixedInfo.zIndex,
|
|
135
|
+
zIndexReverse: cell.fixedInfo.zIndexReverse,
|
|
136
|
+
className: clsx$1(column.className, semanticClassNames.header.cell, parts.className, attrClassName),
|
|
137
|
+
fixEnd: cell.fixedInfo.fixEnd === void 0 ? void 0 : cell.fixedInfo.fixEnd + fixEndDelta,
|
|
138
|
+
children: parts.content
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
if (source.kind === "data") return /* @__PURE__ */ jsx(DataHeaderContent, {
|
|
142
|
+
source,
|
|
143
|
+
children: render
|
|
144
|
+
});
|
|
145
|
+
return render({
|
|
146
|
+
attributes: { ...column.onHeaderCell?.(column) },
|
|
147
|
+
content: /* @__PURE__ */ jsx(HeaderTitle, { source })
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
const HeaderRows = ({ rows, scrollbar = 0 }) => {
|
|
151
|
+
const { components, leafColumns, prefixCls, semanticClassNames, semanticStyles } = useTableView();
|
|
152
|
+
const lastFixed = leafColumns.at(-1)?.fixed;
|
|
153
|
+
const { onHeaderRow } = useHeaderView();
|
|
154
|
+
return /* @__PURE__ */ jsx(TableHeader, {
|
|
155
|
+
className: semanticClassNames.header.wrapper,
|
|
156
|
+
component: components.headerWrapper,
|
|
157
|
+
style: semanticStyles.header.wrapper,
|
|
158
|
+
children: rows.map((cells, rowIndex) => {
|
|
159
|
+
const rowProps = onHeaderRow?.(cells.map((cell) => cell.column.source.column), rowIndex);
|
|
160
|
+
return /* @__PURE__ */ createElement(TableRow, {
|
|
161
|
+
...rowProps,
|
|
162
|
+
className: clsx$1(rowProps?.className, semanticClassNames.header.row),
|
|
163
|
+
component: components.headerRow,
|
|
164
|
+
key: rowIndex,
|
|
165
|
+
style: {
|
|
166
|
+
...rowProps?.style,
|
|
167
|
+
...semanticStyles.header.row
|
|
168
|
+
}
|
|
169
|
+
}, cells.map((cell) => /* @__PURE__ */ jsx(HeaderCell, {
|
|
170
|
+
cell,
|
|
171
|
+
fixEndDelta: scrollbar
|
|
172
|
+
}, cell.key)), scrollbar > 0 && rowIndex === 0 && /* @__PURE__ */ jsx(TableHeaderCell, {
|
|
173
|
+
className: `${prefixCls}-cell-scrollbar`,
|
|
174
|
+
component: components.headerCell,
|
|
175
|
+
fixEnd: lastFixed === "end" ? 0 : void 0,
|
|
176
|
+
rowSpan: rows.length
|
|
177
|
+
}));
|
|
178
|
+
})
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
//#endregion
|
|
182
|
+
export { HeaderRows, HeaderTitle };
|
|
183
|
+
|
|
184
|
+
//# sourceMappingURL=Header.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.mjs","names":["clsx"],"sources":["../../../src/Table/render/Header.tsx"],"sourcesContent":["'use client';\n\nimport * as stylex from '@stylexjs/stylex';\nimport clsx from 'clsx';\nimport { ArrowDownFromLine, ArrowUpDown, ArrowUpToLine } from 'lucide-react';\nimport type { ReactNode } from 'react';\n\nimport ActionIcon from '@/ActionIcon';\nimport Tooltip from '@/Tooltip';\n\nimport { TableHeader, TableHeaderCell, TableRow } from '../atoms';\nimport type { HeaderCellModel } from '../engine/types';\nimport { renderColumnTitle } from '../pipeline/columnUtils';\nimport type { ColumnSource } from '../pipeline/normalizeColumns';\nimport { getMultiplePriority, getNextSortOrder } from '../pipeline/useSorter';\nimport { styles } from '../style';\nimport type {\n SortOrder,\n TableColumn,\n TableColumnType,\n TableHeaderCellAttributes,\n TableLocale,\n TableSorterTooltipProps,\n} from '../type';\nimport { useHeaderView, useTableView } from './context';\nimport FilterDropdown from './FilterDropdown';\nimport { SelectionHeaderTitle } from './SelectionCells';\n\nconst sx = (...list: (stylex.StyleXStyles | false | null | undefined)[]) =>\n stylex.props(...list).className;\n\nconst sortTipOf = (next: SortOrder | undefined, locale: TableLocale) =>\n next === 'descend'\n ? locale.triggerDesc\n : next === 'ascend'\n ? locale.triggerAsc\n : locale.cancelSort;\n\nconst ariaSortOf = (order: SortOrder | undefined) =>\n order === 'ascend' ? 'ascending' : order === 'descend' ? 'descending' : 'none';\n\ninterface HeaderParts {\n attributes: TableHeaderCellAttributes;\n className?: string;\n content: ReactNode;\n}\n\nconst useDataHeader = <T,>(source: ColumnSource<T>): HeaderParts => {\n const { prefixCls } = useTableView<T>();\n const header = useHeaderView<T>();\n const column = source.column as TableColumnType<T>;\n const { id } = source;\n const {\n filterDropdown,\n filters,\n onHeaderCell,\n showSorterTooltip,\n sortDirections,\n sortIcon,\n sorter,\n } = column;\n const order = sorter ? header.sortStates.find(({ key }) => key === id)?.sortOrder : undefined;\n\n const titleNode = renderColumnTitle(column.title, header.titleProps);\n const titleText =\n typeof titleNode === 'string' || typeof titleNode === 'number' ? String(titleNode) : undefined;\n const titleContent = column.ellipsis ? (\n <span className={clsx(sx(styles.columnTitle), `${prefixCls}-column-title`)}>{titleNode}</span>\n ) : (\n titleNode\n );\n\n const filterNode =\n filters || filterDropdown ? (\n <FilterDropdown<T>\n column={column}\n columnKey={id}\n filterState={header.filterStates.find(({ key }) => key === id)}\n getPopupContainer={header.getPopupContainer}\n label={titleText ?? id}\n locale={header.locale}\n triggerFilter={header.triggerFilter}\n />\n ) : null;\n const hasControls = Boolean(sorter) || Boolean(filterNode);\n\n let sorterNode: ReactNode = null;\n if (sorter) {\n const nextOrder = getNextSortOrder(sortDirections ?? header.sortDirections, order);\n const showTooltip = showSorterTooltip ?? header.showSorterTooltip;\n const { target, ...tooltipOptions } =\n typeof showTooltip === 'object' ? showTooltip : ({} as TableSorterTooltipProps);\n const tooltipProps = { title: sortTipOf(nextOrder, header.locale), ...tooltipOptions };\n const iconOnlyTooltip = Boolean(showTooltip) && target === 'sorter-icon';\n const onSort = () =>\n header.triggerSort({\n column: column as TableColumn<T>,\n key: id,\n multiplePriority: getMultiplePriority(column as TableColumn<T>),\n sortOrder: nextOrder,\n });\n const sortAction = (\n <ActionIcon\n active={Boolean(order)}\n className={clsx(sx(styles.sortCaret), `${prefixCls}-column-sorter`)}\n data-order={order ?? undefined}\n size=\"small\"\n icon={\n sortIcon\n ? sortIcon({ sortOrder: order ?? null })\n : order === 'ascend'\n ? ArrowUpToLine\n : order === 'descend'\n ? ArrowDownFromLine\n : ArrowUpDown\n }\n {...(iconOnlyTooltip && showTooltip\n ? { title: tooltipProps.title, tooltipProps: tooltipOptions }\n : {})}\n onClick={(event) => {\n event.stopPropagation();\n onSort();\n }}\n />\n );\n const group = (\n <span\n className={clsx(sx(styles.sortButton), `${prefixCls}-column-sorters`)}\n title={showTooltip ? undefined : header.locale.sortTitle}\n >\n <span className={sx(styles.sortTitle)} onClick={onSort}>\n {titleContent}\n </span>\n {sortAction}\n </span>\n );\n sorterNode =\n showTooltip && !iconOnlyTooltip ? <Tooltip {...tooltipProps}>{group}</Tooltip> : group;\n }\n\n const cell = onHeaderCell?.(column as TableColumn<T>);\n return {\n attributes: {\n ...(sorter && { 'aria-sort': ariaSortOf(order) }),\n ...(column.ellipsis && hasControls && titleText && { title: titleText }),\n ...cell,\n className: clsx(sorter && `${prefixCls}-column-has-sorters`, cell?.className),\n },\n className: order ? `${prefixCls}-column-sort` : undefined,\n content: hasControls ? (\n <span className={sx(styles.headerInner)}>\n {sorterNode ?? titleContent}\n {filterNode}\n </span>\n ) : (\n titleContent\n ),\n };\n};\n\nconst DataHeaderContent = <T,>({\n children,\n source,\n}: {\n children: (parts: HeaderParts) => ReactNode;\n source: ColumnSource<T>;\n}) => <>{children(useDataHeader(source))}</>;\n\nexport const HeaderTitle = <T,>({ source }: { source: ColumnSource<T> }) => {\n if (source.kind === 'selection') return <SelectionHeaderTitle />;\n if (source.kind === 'expand' || source.kind === 'placeholder') {\n return <>{(source.column as TableColumnType<T>).title as ReactNode}</>;\n }\n return <DataHeaderContent source={source}>{(parts) => parts.content}</DataHeaderContent>;\n};\n\nconst HeaderCell = <T,>({\n cell,\n fixEndDelta,\n}: {\n cell: HeaderCellModel<ColumnSource<T>>;\n fixEndDelta: number;\n}) => {\n const { components, semanticClassNames, semanticStyles } = useTableView<T>();\n const { source } = cell.column;\n const column = source.column as TableColumnType<T>;\n\n const render = (parts: HeaderParts) => {\n const { className: attrClassName, style: attrStyle, ...attributes } = parts.attributes;\n return (\n <TableHeaderCell\n {...(attributes as object)}\n align={column.align}\n colSpan={cell.colSpan}\n component={components.headerCell}\n ellipsis={column.ellipsis}\n fixStart={cell.fixedInfo.fixStart}\n rowSpan={cell.rowSpan}\n scope={column.title ? (cell.colSpan > 1 ? 'colgroup' : 'col') : undefined}\n shadowEnd={cell.fixedInfo.shadowEnd}\n shadowStart={cell.fixedInfo.shadowStart}\n style={{ ...semanticStyles.header.cell, ...attrStyle }}\n zIndex={cell.fixedInfo.zIndex}\n zIndexReverse={cell.fixedInfo.zIndexReverse}\n className={clsx(\n column.className,\n semanticClassNames.header.cell,\n parts.className,\n attrClassName,\n )}\n fixEnd={\n cell.fixedInfo.fixEnd === undefined ? undefined : cell.fixedInfo.fixEnd + fixEndDelta\n }\n >\n {parts.content}\n </TableHeaderCell>\n );\n };\n\n if (source.kind === 'data') {\n return <DataHeaderContent source={source}>{render}</DataHeaderContent>;\n }\n return render({\n attributes: { ...column.onHeaderCell?.(column as TableColumn<T>) },\n content: <HeaderTitle source={source} />,\n });\n};\n\nexport const HeaderRows = <T,>({\n rows,\n scrollbar = 0,\n}: {\n rows: readonly HeaderCellModel<ColumnSource<T>>[][];\n scrollbar?: number;\n}) => {\n const { components, leafColumns, prefixCls, semanticClassNames, semanticStyles } =\n useTableView<T>();\n const lastFixed = leafColumns.at(-1)?.fixed;\n const { onHeaderRow } = useHeaderView<T>();\n return (\n <TableHeader\n className={semanticClassNames.header.wrapper}\n component={components.headerWrapper}\n style={semanticStyles.header.wrapper}\n >\n {rows.map((cells, rowIndex) => {\n const rowProps = onHeaderRow?.(\n cells.map((cell) => cell.column.source.column as TableColumn<T>),\n rowIndex,\n );\n return (\n <TableRow\n {...rowProps}\n className={clsx(rowProps?.className, semanticClassNames.header.row)}\n component={components.headerRow}\n key={rowIndex}\n style={{ ...rowProps?.style, ...semanticStyles.header.row }}\n >\n {cells.map((cell) => (\n <HeaderCell cell={cell} fixEndDelta={scrollbar} key={cell.key} />\n ))}\n {scrollbar > 0 && rowIndex === 0 && (\n <TableHeaderCell\n className={`${prefixCls}-cell-scrollbar`}\n component={components.headerCell}\n fixEnd={lastFixed === 'end' ? 0 : undefined}\n rowSpan={rows.length}\n />\n )}\n </TableRow>\n );\n })}\n </TableHeader>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,MAAM,MAAM,GAAG,SAA6D,OAAO,MAAM,GAAG,IAAI,CAAC,CAAC;AAClG,MAAM,aAAa,MAA6B,WAAwB,SAAS,YAAY,OAAO,cAAc,SAAS,WAAW,OAAO,aAAa,OAAO;AACjK,MAAM,cAAc,UAAiC,UAAU,WAAW,cAAc,UAAU,YAAY,eAAe;AAM7H,MAAM,iBAAqB,WAAyC;CAClE,MAAM,EACJ,cACE,aAAgB;CACpB,MAAM,SAAS,cAAiB;CAChC,MAAM,SAAS,OAAO;CACtB,MAAM,EACJ,OACE;CACJ,MAAM,EACJ,gBACA,SACA,cACA,mBACA,gBACA,UACA,WACE;CACJ,MA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AAO,oBAAC,aAAD;EAAa,WAAW,mBAAmB,OAAO;EAAS,WAAW,WAAW;EAAe,OAAO,eAAe,OAAO;EAC/H,UAAA,KAAK,KAAK,OAAO,aAAa;GAC/B,MAAM,WAAW,cAAc,MAAM,KAAI,SAAQ,KAAK,OAAO,OAAO,MAAwB,GAAG,QAAQ;GACvG,OAAO,8BAAC,UAAD;IAAU,GAAI;IAAU,WAAWA,OAAK,UAAU,WAAW,mBAAmB,OAAO,GAAG;IAAG,WAAW,WAAW;IAAW,KAAK;IAAU,OAAO;KACzJ,GAAG,UAAU;KACb,GAAG,eAAe,OAAO;IAC3B;GAGc,GAFP,MAAM,KAAI,SAAQ,oBAAC,YAAD;IAAkB;IAAM,aAAa;GAA2B,GAAX,KAAK,GAAM,CAAC,GACnF,YAAY,KAAK,aAAa,KAAK,oBAAC,iBAAD;IAAiB,WAAW,GAAG,UAAU;IAAkB,WAAW,WAAW;IAAY,QAAQ,cAAc,QAAQ,IAAI,KAAA;IAAW,SAAS,KAAK;GAAS,CAAA,CAC7L;EAChB,CAAC;CACY,CAAA;AACjB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import Skeleton from "../../Skeleton/index.mjs";
|
|
3
|
+
import { isColumnGroup, isColumnVisibleAt } from "../pipeline/columnUtils.mjs";
|
|
4
|
+
import { styles } from "../style.mjs";
|
|
5
|
+
import { memo, useMemo } from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import * as stylex from "@stylexjs/stylex";
|
|
8
|
+
//#region src/Table/render/LoadingSkeleton.tsx
|
|
9
|
+
const DEFAULT_ROWS = 5;
|
|
10
|
+
const CELL_WIDTHS = [
|
|
11
|
+
72,
|
|
12
|
+
56,
|
|
13
|
+
64,
|
|
14
|
+
48,
|
|
15
|
+
80,
|
|
16
|
+
40,
|
|
17
|
+
60,
|
|
18
|
+
52
|
|
19
|
+
];
|
|
20
|
+
const resolveTrack = (width) => {
|
|
21
|
+
if (typeof width === "number") return `${width}px`;
|
|
22
|
+
if (typeof width === "string" && width) return width;
|
|
23
|
+
return "minmax(0, 1fr)";
|
|
24
|
+
};
|
|
25
|
+
const leafColumns = (columns, screens) => columns.flatMap((column) => {
|
|
26
|
+
if (!isColumnVisibleAt(column, screens)) return [];
|
|
27
|
+
if (isColumnGroup(column)) return leafColumns(column.children, screens);
|
|
28
|
+
return [column];
|
|
29
|
+
});
|
|
30
|
+
function TableLoadingSkeletonInner({ columns, expandColumn = false, rows = DEFAULT_ROWS, screens, selectionColumn = false, size }) {
|
|
31
|
+
const tracks = useMemo(() => {
|
|
32
|
+
const list = [];
|
|
33
|
+
if (selectionColumn) list.push(`32px`);
|
|
34
|
+
if (expandColumn) list.push(`48px`);
|
|
35
|
+
const leaves = leafColumns(columns, screens);
|
|
36
|
+
if (leaves.length === 0) list.push("minmax(0, 1.4fr)", "minmax(0, 1fr)", "minmax(0, 0.8fr)", "minmax(0, 1fr)");
|
|
37
|
+
else leaves.forEach((column) => list.push(resolveTrack(column.width)));
|
|
38
|
+
return list;
|
|
39
|
+
}, [
|
|
40
|
+
columns,
|
|
41
|
+
expandColumn,
|
|
42
|
+
screens,
|
|
43
|
+
selectionColumn
|
|
44
|
+
]);
|
|
45
|
+
const gridTemplateColumns = tracks.join(" ");
|
|
46
|
+
const rowCount = Math.max(1, rows);
|
|
47
|
+
return /* @__PURE__ */ jsx("div", {
|
|
48
|
+
"aria-hidden": true,
|
|
49
|
+
...stylex.props(styles.skeleton),
|
|
50
|
+
"data-table-skeleton": "",
|
|
51
|
+
"data-table-skeleton-size": size === "middle" ? "medium" : size,
|
|
52
|
+
children: Array.from({ length: rowCount }, (_, rowIndex) => /* @__PURE__ */ jsx("div", {
|
|
53
|
+
...stylex.props(styles.skeletonRow),
|
|
54
|
+
style: { gridTemplateColumns },
|
|
55
|
+
children: tracks.map((_, colIndex) => {
|
|
56
|
+
const isLeading = selectionColumn && colIndex === 0 || expandColumn && colIndex === (selectionColumn ? 1 : 0);
|
|
57
|
+
const widthPct = isLeading ? 100 : CELL_WIDTHS[(rowIndex * 3 + colIndex) % CELL_WIDTHS.length];
|
|
58
|
+
return /* @__PURE__ */ jsx("div", {
|
|
59
|
+
...stylex.props(styles.skeletonCell),
|
|
60
|
+
children: isLeading ? /* @__PURE__ */ jsx(Skeleton, {
|
|
61
|
+
height: 14,
|
|
62
|
+
radius: 4,
|
|
63
|
+
width: 14
|
|
64
|
+
}) : /* @__PURE__ */ jsx(Skeleton, {
|
|
65
|
+
height: 14,
|
|
66
|
+
radius: 4,
|
|
67
|
+
width: `${widthPct}%`
|
|
68
|
+
})
|
|
69
|
+
}, colIndex);
|
|
70
|
+
})
|
|
71
|
+
}, rowIndex))
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const TableLoadingSkeleton = memo(TableLoadingSkeletonInner);
|
|
75
|
+
//#endregion
|
|
76
|
+
export { TableLoadingSkeleton as default };
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=LoadingSkeleton.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingSkeleton.mjs","names":[],"sources":["../../../src/Table/render/LoadingSkeleton.tsx"],"sourcesContent":["'use client';\n\nimport * as stylex from '@stylexjs/stylex';\nimport { memo, useMemo } from 'react';\n\nimport Skeleton from '@/Skeleton';\n\nimport { EXPAND_COLUMN_WIDTH, SELECTION_COLUMN_WIDTH } from '../constants';\nimport { isColumnGroup, isColumnVisibleAt } from '../pipeline/columnUtils';\nimport { styles } from '../style';\nimport type { TableBreakpoint, TableColumn, TableSize } from '../type';\n\nconst DEFAULT_ROWS = 5;\n\nconst CELL_WIDTHS = [72, 56, 64, 48, 80, 40, 60, 52] as const;\n\nexport interface TableLoadingSkeletonProps<T = any> {\n columns: readonly TableColumn<T>[];\n expandColumn?: boolean;\n rows?: number;\n screens: ReadonlySet<TableBreakpoint> | null;\n selectionColumn?: boolean;\n size: TableSize;\n}\n\nconst resolveTrack = (width: TableColumn<any>['width']) => {\n if (typeof width === 'number') return `${width}px`;\n if (typeof width === 'string' && width) return width;\n return 'minmax(0, 1fr)';\n};\n\nconst leafColumns = <T,>(\n columns: readonly TableColumn<T>[],\n screens: ReadonlySet<TableBreakpoint> | null,\n): TableColumn<T>[] =>\n columns.flatMap((column) => {\n if (!isColumnVisibleAt(column, screens)) return [];\n if (isColumnGroup(column)) return leafColumns(column.children, screens);\n return [column];\n });\n\nfunction TableLoadingSkeletonInner<T>({\n columns,\n expandColumn = false,\n rows = DEFAULT_ROWS,\n screens,\n selectionColumn = false,\n size,\n}: TableLoadingSkeletonProps<T>) {\n const tracks = useMemo(() => {\n const list: string[] = [];\n if (selectionColumn) list.push(`${SELECTION_COLUMN_WIDTH}px`);\n if (expandColumn) list.push(`${EXPAND_COLUMN_WIDTH}px`);\n const leaves = leafColumns(columns, screens);\n if (leaves.length === 0) {\n list.push('minmax(0, 1.4fr)', 'minmax(0, 1fr)', 'minmax(0, 0.8fr)', 'minmax(0, 1fr)');\n } else {\n leaves.forEach((column) => list.push(resolveTrack(column.width)));\n }\n return list;\n }, [columns, expandColumn, screens, selectionColumn]);\n\n const gridTemplateColumns = tracks.join(' ');\n const rowCount = Math.max(1, rows);\n\n return (\n <div\n aria-hidden\n {...stylex.props(styles.skeleton)}\n data-table-skeleton=\"\"\n data-table-skeleton-size={size === 'middle' ? 'medium' : size}\n >\n {Array.from({ length: rowCount }, (_, rowIndex) => (\n <div key={rowIndex} {...stylex.props(styles.skeletonRow)} style={{ gridTemplateColumns }}>\n {tracks.map((_, colIndex) => {\n const leadingSelection = selectionColumn && colIndex === 0;\n const leadingExpand = expandColumn && colIndex === (selectionColumn ? 1 : 0);\n const isLeading = leadingSelection || leadingExpand;\n const widthPct = isLeading\n ? 100\n : CELL_WIDTHS[(rowIndex * 3 + colIndex) % CELL_WIDTHS.length];\n return (\n <div key={colIndex} {...stylex.props(styles.skeletonCell)}>\n {isLeading ? (\n <Skeleton height={14} radius={4} width={14} />\n ) : (\n <Skeleton height={14} radius={4} width={`${widthPct}%`} />\n )}\n </div>\n );\n })}\n </div>\n ))}\n </div>\n );\n}\n\nconst TableLoadingSkeleton = memo(TableLoadingSkeletonInner) as typeof TableLoadingSkeletonInner;\n\nexport default TableLoadingSkeleton;\n"],"mappings":";;;;;;;;AASA,MAAM,eAAe;AACrB,MAAM,cAAc;CAAC;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;AAAE;AASnD,MAAM,gBAAgB,UAAqC;CACzD,IAAI,OAAO,UAAU,UAAU,OAAO,GAAG,MAAM;CAC/C,IAAI,OAAO,UAAU,YAAY,OAAO,OAAO;CAC/C,OAAO;AACT;AACA,MAAM,eAAmB,SAAoC,YAAmE,QAAQ,SAAQ,WAAU;CACxJ,IAAI,CAAC,kBAAkB,QAAQ,OAAO,GAAG,OAAO,CAAC;CACjD,IAAI,cAAc,MAAM,GAAG,OAAO,YAAY,OAAO,UAAU,OAAO;CACtE,OAAO,CAAC,MAAM;AAChB,CAAC;AACD,SAAS,0BAA6B,EACpC,SACA,eAAe,OACf,OAAO,cACP,SACA,kBAAkB,OAClB,QAC+B;CAC/B,MAAM,SAAS,cAAc;EAC3B,MAAM,OAAiB,CAAC;EACxB,IAAI,iBAAiB,KAAK,KAAK,MAA6B;EAC5D,IAAI,cAAc,KAAK,KAAK,MAA0B;EACtD,MAAM,SAAS,YAAY,SAAS,OAAO;EAC3C,IAAI,OAAO,WAAW,GACpB,KAAK,KAAK,oBAAoB,kBAAkB,oBAAoB,gBAAgB;OAEpF,OAAO,SAAQ,WAAU,KAAK,KAAK,aAAa,OAAO,KAAK,CAAC,CAAC;EAEhE,OAAO;CACT,GAAG;EAAC;EAAS;EAAc;EAAS;CAAe,CAAC;CACpD,MAAM,sBAAsB,OAAO,KAAK,GAAG;CAC3C,MAAM,WAAW,KAAK,IAAI,GAAG,IAAI;CACjC,OAAO,oBAAC,OAAD;EAAK,eAAA;EAAY,GAAI,OAAO,MAAM,OAAO,QAAQ;EAAG,uBAAoB;EAAG,4BAA0B,SAAS,WAAW,WAAW;EACtI,UAAA,MAAM,KAAK,EACZ,QAAQ,SACV,IAAI,GAAG,aAAa,oBAAC,OAAD;GAAoB,GAAI,OAAO,MAAM,OAAO,WAAW;GAAG,OAAO,EACnF,oBACF;GACO,UAAA,OAAO,KAAK,GAAG,aAAa;IAG/B,MAAM,YAFmB,mBAAmB,aAAa,KACnC,gBAAgB,cAAc,kBAAkB,IAAI;IAE1E,MAAM,WAAW,YAAY,MAAM,aAAa,WAAW,IAAI,YAAY,YAAY;IACvF,OAAO,oBAAC,OAAD;KAAoB,GAAI,OAAO,MAAM,OAAO,YAAY;KACtD,UAAA,YAAY,oBAAC,UAAD;MAAU,QAAQ;MAAI,QAAQ;MAAG,OAAO;KAAK,CAAA,IAAI,oBAAC,UAAD;MAAU,QAAQ;MAAI,QAAQ;MAAG,OAAO,GAAG,SAAS;KAAK,CAAA;IACpH,GAFM,QAEN;GACb,CAAC;EACM,GAZqB,QAYrB,CAAC;CACL,CAAA;AACT;AACA,MAAM,uBAAuB,KAAK,yBAAyB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import Pagination from "../../Pagination/Pagination.mjs";
|
|
3
|
+
import { PREFIX_CLS } from "../constants.mjs";
|
|
4
|
+
import { styles } from "../style.mjs";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import clsx$1 from "clsx";
|
|
7
|
+
import * as stylex from "@stylexjs/stylex";
|
|
8
|
+
//#region src/Table/render/PaginationBar.tsx
|
|
9
|
+
const alignStyles = {
|
|
10
|
+
center: styles.paginationCenter,
|
|
11
|
+
end: styles.paginationEnd,
|
|
12
|
+
start: styles.paginationStart
|
|
13
|
+
};
|
|
14
|
+
const normalizePlacement = (placement) => {
|
|
15
|
+
const lower = placement.toLowerCase();
|
|
16
|
+
if (lower.includes("center")) return "center";
|
|
17
|
+
return lower.includes("left") || lower.includes("start") ? "start" : "end";
|
|
18
|
+
};
|
|
19
|
+
const renderPaginationBars = ({ classNames: semanticClassNames, config, onChange, page, size, styles: semanticStyles, total }) => {
|
|
20
|
+
const { className, classNames, current: _current, defaultCurrent: _defaultCurrent, defaultPageSize: _defaultPageSize, onChange: _onChange, onShowSizeChange: _onShowSizeChange, pageSize: _pageSize, placement, size: paginationSize, styles: paginationStyles, total: _total, ...rest } = config;
|
|
21
|
+
const pageCount = Math.ceil(total / page.pageSize);
|
|
22
|
+
if (total <= 0 || rest.hideOnSinglePage && pageCount <= 1) return {
|
|
23
|
+
bottom: null,
|
|
24
|
+
top: null
|
|
25
|
+
};
|
|
26
|
+
const render = (align, side) => /* @__PURE__ */ jsx("div", {
|
|
27
|
+
className: clsx$1(stylex.props(styles.pagination, side === "top" && styles.paginationTop, alignStyles[align]).className, `${PREFIX_CLS}-pagination-wrapper`),
|
|
28
|
+
children: /* @__PURE__ */ jsx(Pagination, {
|
|
29
|
+
...rest,
|
|
30
|
+
className: clsx$1(`${PREFIX_CLS}-pagination`, `${PREFIX_CLS}-pagination-${align}`, className),
|
|
31
|
+
current: page.pageIndex + 1,
|
|
32
|
+
pageSize: page.pageSize,
|
|
33
|
+
size: paginationSize ?? (size && size !== "large" ? "small" : void 0),
|
|
34
|
+
total,
|
|
35
|
+
classNames: {
|
|
36
|
+
item: clsx$1(semanticClassNames.item, classNames?.item),
|
|
37
|
+
root: clsx$1(semanticClassNames.root, classNames?.root)
|
|
38
|
+
},
|
|
39
|
+
styles: {
|
|
40
|
+
item: {
|
|
41
|
+
...paginationStyles?.item,
|
|
42
|
+
...semanticStyles.item
|
|
43
|
+
},
|
|
44
|
+
root: {
|
|
45
|
+
...paginationStyles?.root,
|
|
46
|
+
...semanticStyles.root
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
onChange: (next, nextPageSize) => onChange({
|
|
50
|
+
pageIndex: next - 1,
|
|
51
|
+
pageSize: nextPageSize
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
if (!placement) return {
|
|
56
|
+
bottom: render("end", "bottom"),
|
|
57
|
+
top: null
|
|
58
|
+
};
|
|
59
|
+
const find = (side) => placement.find((item) => item.includes(side));
|
|
60
|
+
const top = find("top");
|
|
61
|
+
const bottom = find("bottom");
|
|
62
|
+
const none = placement.every((item) => item === "none");
|
|
63
|
+
return {
|
|
64
|
+
bottom: bottom ? render(normalizePlacement(bottom), "bottom") : !top && !none ? render("end", "bottom") : null,
|
|
65
|
+
top: top ? render(normalizePlacement(top), "top") : null
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
export { renderPaginationBars };
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=PaginationBar.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaginationBar.mjs","names":["clsx"],"sources":["../../../src/Table/render/PaginationBar.tsx"],"sourcesContent":["'use client';\n\nimport * as stylex from '@stylexjs/stylex';\nimport clsx from 'clsx';\nimport type { CSSProperties, ReactNode } from 'react';\n\nimport Pagination, { type PaginationAlign } from '@/Pagination';\nimport type { PaginationSemanticName } from '@/Pagination/type';\n\nimport { PREFIX_CLS } from '../constants';\nimport type { PaginationState } from '../pipeline/useTableState';\nimport { styles } from '../style';\nimport type { TablePaginationConfig, TableSize } from '../type';\n\nconst alignStyles = {\n center: styles.paginationCenter,\n end: styles.paginationEnd,\n start: styles.paginationStart,\n};\n\nconst normalizePlacement = (placement: string): PaginationAlign => {\n const lower = placement.toLowerCase();\n if (lower.includes('center')) return 'center';\n return lower.includes('left') || lower.includes('start') ? 'start' : 'end';\n};\n\ninterface PaginationBarsProps {\n classNames: Partial<Record<PaginationSemanticName, string>>;\n config: TablePaginationConfig;\n onChange: (next: PaginationState) => void;\n page: PaginationState;\n size?: TableSize;\n styles: Partial<Record<PaginationSemanticName, CSSProperties>>;\n total: number;\n}\n\nexport const renderPaginationBars = ({\n classNames: semanticClassNames,\n config,\n onChange,\n page,\n size,\n styles: semanticStyles,\n total,\n}: PaginationBarsProps): { bottom: ReactNode; top: ReactNode } => {\n const {\n className,\n classNames,\n current: _current,\n defaultCurrent: _defaultCurrent,\n defaultPageSize: _defaultPageSize,\n onChange: _onChange,\n onShowSizeChange: _onShowSizeChange,\n pageSize: _pageSize,\n placement,\n size: paginationSize,\n styles: paginationStyles,\n total: _total,\n ...rest\n } = config;\n const pageCount = Math.ceil(total / page.pageSize);\n if (total <= 0 || (rest.hideOnSinglePage && pageCount <= 1)) return { bottom: null, top: null };\n\n const render = (align: PaginationAlign, side: 'top' | 'bottom') => (\n <div\n className={clsx(\n stylex.props(styles.pagination, side === 'top' && styles.paginationTop, alignStyles[align])\n .className,\n `${PREFIX_CLS}-pagination-wrapper`,\n )}\n >\n <Pagination\n {...rest}\n className={clsx(`${PREFIX_CLS}-pagination`, `${PREFIX_CLS}-pagination-${align}`, className)}\n current={page.pageIndex + 1}\n pageSize={page.pageSize}\n size={paginationSize ?? (size && size !== 'large' ? 'small' : undefined)}\n total={total}\n classNames={{\n item: clsx(semanticClassNames.item, classNames?.item),\n root: clsx(semanticClassNames.root, classNames?.root),\n }}\n styles={{\n item: { ...paginationStyles?.item, ...semanticStyles.item },\n root: { ...paginationStyles?.root, ...semanticStyles.root },\n }}\n onChange={(next, nextPageSize) => onChange({ pageIndex: next - 1, pageSize: nextPageSize })}\n />\n </div>\n );\n\n if (!placement) return { bottom: render('end', 'bottom'), top: null };\n const find = (side: string) => placement.find((item) => item.includes(side));\n const top = find('top');\n const bottom = find('bottom');\n const none = placement.every((item) => item === 'none');\n return {\n bottom: bottom\n ? render(normalizePlacement(bottom), 'bottom')\n : !top && !none\n ? render('end', 'bottom')\n : null,\n top: top ? render(normalizePlacement(top), 'top') : null,\n };\n};\n"],"mappings":";;;;;;;;AAWA,MAAM,cAAc;CAClB,QAAQ,OAAO;CACf,KAAK,OAAO;CACZ,OAAO,OAAO;AAChB;AACA,MAAM,sBAAsB,cAAuC;CACjE,MAAM,QAAQ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OAAO;EACrB,QAAQ,OAAO,OAAO,QAAQ;EAC9B,KAAK;CACP;CACA,MAAM,QAAQ,SAAiB,UAAU,MAAK,SAAQ,KAAK,SAAS,IAAI,CAAC;CACzE,MAAM,MAAM,KAAK,KAAK;CACtB,MAAM,SAAS,KAAK,QAAQ;CAC5B,MAAM,OAAO,UAAU,OAAM,SAAQ,SAAS,MAAM;CACpD,OAAO;EACL,QAAQ,SAAS,OAAO,mBAAmB,MAAM,GAAG,QAAQ,IAAI,CAAC,OAAO,CAAC,OAAO,OAAO,OAAO,QAAQ,IAAI;EAC1G,KAAK,MAAM,OAAO,mBAAmB,GAAG,GAAG,KAAK,IAAI;CACtD;AACF"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import ActionIcon from "../../ActionIcon/ActionIcon.mjs";
|
|
3
|
+
import DropdownMenu from "../../DropdownMenu/DropdownMenu.mjs";
|
|
4
|
+
import Checkbox_default from "../../Checkbox/Checkbox.mjs";
|
|
5
|
+
import Radio from "../../Radio/Radio.mjs";
|
|
6
|
+
import { PREFIX_CLS } from "../constants.mjs";
|
|
7
|
+
import { useSelectionView } from "./context.mjs";
|
|
8
|
+
import { styles } from "../style.mjs";
|
|
9
|
+
import { useRowHalfSelected, useRowSelected, useSelectionSummary } from "../store/hooks.mjs";
|
|
10
|
+
import { CellShell, isRenderedCell } from "./CellShell.mjs";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import clsx$1 from "clsx";
|
|
13
|
+
import * as stylex from "@stylexjs/stylex";
|
|
14
|
+
import { ChevronDown } from "lucide-react";
|
|
15
|
+
import { RadioGroup } from "@base-ui/react/radio-group";
|
|
16
|
+
//#region src/Table/render/SelectionCells.tsx
|
|
17
|
+
const SelectionBodyCell = ({ index, leaf, record, renderIndex, rowKey }) => {
|
|
18
|
+
const selection = useSelectionView();
|
|
19
|
+
const checked = useRowSelected(rowKey);
|
|
20
|
+
const halfChecked = useRowHalfSelected(rowKey);
|
|
21
|
+
const checkboxProps = selection.checkboxPropsMap.get(rowKey) || {};
|
|
22
|
+
const { onChange: onBoxChange, onClick: onBoxClick, ...boxProps } = checkboxProps;
|
|
23
|
+
const handleClick = (event) => {
|
|
24
|
+
event.stopPropagation();
|
|
25
|
+
onBoxClick?.(event);
|
|
26
|
+
};
|
|
27
|
+
let node;
|
|
28
|
+
if (selection.type === "radio") {
|
|
29
|
+
const { classNames: _classNames, indeterminate: _indeterminate, shape: _shape, styles: _styles, ...radioProps } = boxProps;
|
|
30
|
+
node = /* @__PURE__ */ jsx(RadioGroup, {
|
|
31
|
+
className: stylex.props(styles.selectionRadioGroup).className,
|
|
32
|
+
value: checked ? "selected" : null,
|
|
33
|
+
onValueChange: (_value, details) => {
|
|
34
|
+
selection.actions.selectRadio(rowKey, details.event);
|
|
35
|
+
onBoxChange?.(true);
|
|
36
|
+
},
|
|
37
|
+
children: /* @__PURE__ */ jsx(Radio, {
|
|
38
|
+
"aria-label": `Select row ${renderIndex + 1}`,
|
|
39
|
+
...radioProps,
|
|
40
|
+
value: "selected",
|
|
41
|
+
onClick: handleClick
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
} else {
|
|
45
|
+
const indeterminate = selection.expandType === "nest" ? halfChecked : checkboxProps.indeterminate ?? halfChecked;
|
|
46
|
+
node = /* @__PURE__ */ jsx(Checkbox_default, {
|
|
47
|
+
"aria-label": checked ? `Row ${renderIndex + 1} selected` : `Select row ${renderIndex + 1}`,
|
|
48
|
+
...boxProps,
|
|
49
|
+
checked,
|
|
50
|
+
indeterminate,
|
|
51
|
+
onClick: handleClick,
|
|
52
|
+
onChange: (_next, details) => {
|
|
53
|
+
selection.actions.toggleCheckbox(rowKey, checked, details?.event);
|
|
54
|
+
onBoxChange?.(!checked);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
const custom = selection.renderCell ? selection.renderCell(checked, record, renderIndex, node) : node;
|
|
59
|
+
const [childNode, legacyCellProps] = isRenderedCell(custom) ? [custom.children, custom.props] : [custom, void 0];
|
|
60
|
+
return /* @__PURE__ */ jsx(CellShell, {
|
|
61
|
+
index,
|
|
62
|
+
leaf,
|
|
63
|
+
legacyCellProps,
|
|
64
|
+
record,
|
|
65
|
+
children: childNode
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
const SelectionHeaderTitle = () => {
|
|
69
|
+
const selection = useSelectionView();
|
|
70
|
+
const summary = useSelectionSummary();
|
|
71
|
+
if (selection.type === "radio") return typeof selection.title === "function" ? selection.title(null) : selection.title ?? null;
|
|
72
|
+
const customizeSelections = selection.selections ? /* @__PURE__ */ jsx("div", {
|
|
73
|
+
className: clsx$1(stylex.props(styles.selectionExtra).className, `${PREFIX_CLS}-selection-extra`),
|
|
74
|
+
children: /* @__PURE__ */ jsx(DropdownMenu, {
|
|
75
|
+
items: selection.selections.map(({ key, onSelect, text }) => ({
|
|
76
|
+
key,
|
|
77
|
+
label: text,
|
|
78
|
+
onClick: onSelect
|
|
79
|
+
})),
|
|
80
|
+
children: /* @__PURE__ */ jsx(ActionIcon, {
|
|
81
|
+
"aria-label": "Selection options",
|
|
82
|
+
className: stylex.props(styles.selectionTrigger).className,
|
|
83
|
+
icon: ChevronDown,
|
|
84
|
+
size: "small"
|
|
85
|
+
})
|
|
86
|
+
})
|
|
87
|
+
}) : null;
|
|
88
|
+
const { disabled: titleDisabled, onChange: onTitleChange, ...titleCheckboxProps } = selection.getTitleCheckboxProps?.() || {};
|
|
89
|
+
const { locale } = selection;
|
|
90
|
+
const checkbox = /* @__PURE__ */ jsx(Checkbox_default, {
|
|
91
|
+
"aria-label": customizeSelections ? "Custom selection" : typeof locale.selectAll === "string" ? locale.selectAll : void 0,
|
|
92
|
+
...titleCheckboxProps,
|
|
93
|
+
checked: summary.checked,
|
|
94
|
+
disabled: titleDisabled ?? summary.disabled,
|
|
95
|
+
indeterminate: summary.indeterminate,
|
|
96
|
+
onChange: (next) => {
|
|
97
|
+
selection.actions.selectAll();
|
|
98
|
+
onTitleChange?.(next);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
if (selection.title) return typeof selection.title === "function" ? selection.title(checkbox) : selection.title;
|
|
102
|
+
if (selection.hideSelectAll) return null;
|
|
103
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
104
|
+
className: clsx$1(stylex.props(styles.selection).className, `${PREFIX_CLS}-selection`),
|
|
105
|
+
children: [checkbox, customizeSelections]
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
//#endregion
|
|
109
|
+
export { SelectionBodyCell, SelectionHeaderTitle };
|
|
110
|
+
|
|
111
|
+
//# sourceMappingURL=SelectionCells.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectionCells.mjs","names":["BaseRadioGroup","Checkbox","clsx"],"sources":["../../../src/Table/render/SelectionCells.tsx"],"sourcesContent":["'use client';\n\nimport { RadioGroup as BaseRadioGroup } from '@base-ui/react/radio-group';\nimport * as stylex from '@stylexjs/stylex';\nimport clsx from 'clsx';\nimport { ChevronDown } from 'lucide-react';\nimport type { MouseEvent, ReactNode } from 'react';\n\nimport ActionIcon from '@/ActionIcon';\nimport { Checkbox } from '@/Checkbox';\nimport DropdownMenu from '@/DropdownMenu';\nimport { Radio } from '@/Radio';\n\nimport { PREFIX_CLS } from '../constants';\nimport { useRowHalfSelected, useRowSelected, useSelectionSummary } from '../store/hooks';\nimport { styles } from '../style';\nimport type { TableCellAttributes } from '../type';\nimport { type BodyCellProps, CellShell, isRenderedCell } from './CellShell';\nimport { useSelectionView } from './context';\n\nexport const SelectionBodyCell = <T,>({\n index,\n leaf,\n record,\n renderIndex,\n rowKey,\n}: BodyCellProps<T>) => {\n const selection = useSelectionView<T>();\n const checked = useRowSelected(rowKey);\n const halfChecked = useRowHalfSelected(rowKey);\n const checkboxProps = selection.checkboxPropsMap.get(rowKey) || {};\n const { onChange: onBoxChange, onClick: onBoxClick, ...boxProps } = checkboxProps;\n const handleClick = (event: MouseEvent<HTMLElement>) => {\n event.stopPropagation();\n (onBoxClick as ((event: MouseEvent<HTMLElement>) => void) | undefined)?.(event);\n };\n\n let node: ReactNode;\n if (selection.type === 'radio') {\n const {\n classNames: _classNames,\n indeterminate: _indeterminate,\n shape: _shape,\n styles: _styles,\n ...radioProps\n } = boxProps;\n node = (\n <BaseRadioGroup\n className={stylex.props(styles.selectionRadioGroup).className}\n value={checked ? 'selected' : null}\n onValueChange={(_value, details) => {\n selection.actions.selectRadio(rowKey, details.event as Event);\n onBoxChange?.(true);\n }}\n >\n <Radio\n aria-label={`Select row ${renderIndex + 1}`}\n {...(radioProps as object)}\n value=\"selected\"\n onClick={handleClick}\n />\n </BaseRadioGroup>\n );\n } else {\n const indeterminate =\n selection.expandType === 'nest' ? halfChecked : (checkboxProps.indeterminate ?? halfChecked);\n node = (\n <Checkbox\n aria-label={checked ? `Row ${renderIndex + 1} selected` : `Select row ${renderIndex + 1}`}\n {...boxProps}\n checked={checked}\n indeterminate={indeterminate}\n onClick={handleClick}\n onChange={(_next: boolean, details?: { event?: Event }) => {\n selection.actions.toggleCheckbox(rowKey, checked, details?.event);\n onBoxChange?.(!checked);\n }}\n />\n );\n }\n\n const custom = selection.renderCell\n ? selection.renderCell(checked, record, renderIndex, node)\n : node;\n const [childNode, legacyCellProps] = isRenderedCell(custom)\n ? [custom.children, custom.props as TableCellAttributes | undefined]\n : [custom as ReactNode, undefined];\n\n return (\n <CellShell index={index} leaf={leaf} legacyCellProps={legacyCellProps} record={record}>\n {childNode}\n </CellShell>\n );\n};\n\nexport const SelectionHeaderTitle = () => {\n const selection = useSelectionView();\n const summary = useSelectionSummary();\n if (selection.type === 'radio') {\n return typeof selection.title === 'function'\n ? selection.title(null)\n : (selection.title ?? null);\n }\n\n const customizeSelections = selection.selections ? (\n <div\n className={clsx(\n stylex.props(styles.selectionExtra).className,\n `${PREFIX_CLS}-selection-extra`,\n )}\n >\n <DropdownMenu\n items={selection.selections.map(({ key, onSelect, text }) => ({\n key,\n label: text,\n onClick: onSelect,\n }))}\n >\n <ActionIcon\n aria-label=\"Selection options\"\n className={stylex.props(styles.selectionTrigger).className}\n icon={ChevronDown}\n size=\"small\"\n />\n </DropdownMenu>\n </div>\n ) : null;\n\n const {\n disabled: titleDisabled,\n onChange: onTitleChange,\n ...titleCheckboxProps\n } = selection.getTitleCheckboxProps?.() || {};\n const { locale } = selection;\n const checkbox = (\n <Checkbox\n aria-label={\n customizeSelections\n ? 'Custom selection'\n : typeof locale.selectAll === 'string'\n ? locale.selectAll\n : undefined\n }\n {...titleCheckboxProps}\n checked={summary.checked}\n disabled={titleDisabled ?? summary.disabled}\n indeterminate={summary.indeterminate}\n onChange={(next) => {\n selection.actions.selectAll();\n onTitleChange?.(next);\n }}\n />\n );\n\n if (selection.title) {\n return typeof selection.title === 'function' ? selection.title(checkbox) : selection.title;\n }\n if (selection.hideSelectAll) return null;\n return (\n <div className={clsx(stylex.props(styles.selection).className, `${PREFIX_CLS}-selection`)}>\n {checkbox}\n {customizeSelections}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAiBA,MAAa,qBAAyB,EACpC,OACA,MACA,QACA,aACA,aACsB;CACtB,MAAM,YAAY,iBAAoB;CACtC,MAAM,UAAU,eAAe,MAAM;CACrC,MAAM,cAAc,mBAAmB,MAAM;CAC7C,MAAM,gBAAgB,UAAU,iBAAiB,IAAI,MAAM,KAAK,CAAC;CACjE,MAAM,EACJ,UAAU,aACV,SAAS,YACT,GAAG,aACD;CACJ,MAAM,eAAe,UAAmC;EACtD,MAAM,gBAAgB;EACtB,aAAyE,KAAK;CAChF;CACA,IAAI;CACJ,IAAI,UAAU,SAAS,SAAS;EAC9B,MAAM,EACJ,YAAY,aACZ,eAAe,gBACf,OAAO,QACP,QAAQ,SACR,GAAG,eACD;EACJ,OAAO,oBAACA,YAAD;GAAgB,WAAW,OAAO,MAAM,OAAO,mBAAmB,CAAC,CAAC;GAAW,OAAO,UAAU,aAAa;G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AW;IAAoB,WAAW,OAAO,MAAM,OAAO,gBAAgB,CAAC,CAAC;IAAW,MAAM;IAAa,MAAK;GAAS,CAAA;EAC5H,CAAA;CACX,CAAA,IAAI;CACX,MAAM,EACJ,UAAU,eACV,UAAU,eACV,GAAG,uBACD,UAAU,wBAAwB,KAAK,CAAC;CAC5C,MAAM,EACJ,WACE;CACJ,MAAM,WAAW,oBAACD,kBAAD;EAAU,cAAY,sBAAsB,qBAAqB,OAAO,OAAO,cAAc,WAAW,OAAO,YAAY,KAAA;EAAW,GAAI;EAAoB,SAAS,QAAQ;EAAS,UAAU,iBAAiB,QAAQ;EAAU,eAAe,QAAQ;EAAe,WAAU,SAAQ;GAC5S,UAAU,QAAQ,UAAU;GAC5B,gBAAgB,IAAI;EACtB;CAAI,CAAA;CACJ,IAAI,UAAU,OACZ,OAAO,OAAO,UAAU,UAAU,aAAa,UAAU,MAAM,QAAQ,IAAI,UAAU;CAEvF,IAAI,UAAU,eAAe,OAAO;CACpC,OAAO,qBAAC,OAAD;EAAK,WAAWC,OAAK,OAAO,MAAM,OAAO,SAAS,CAAC,CAAC,WAAW,GAAG,WAAW,WAAW;EAAxF,UAAA,CACF,UACA,mBACE;;AACT"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import clsx$1 from "clsx";
|
|
5
|
+
//#region src/Table/render/StickyScrollBar.tsx
|
|
6
|
+
const getContainerBottom = (container) => container === window ? window.innerHeight : container.getBoundingClientRect().bottom;
|
|
7
|
+
const StickyScrollBar = ({ bodyRef, container, offsetScroll, onScroll, prefixCls, ref }) => {
|
|
8
|
+
const [state, setState] = useState({
|
|
9
|
+
hidden: true,
|
|
10
|
+
scrollLeft: 0
|
|
11
|
+
});
|
|
12
|
+
const dragRef = useRef(null);
|
|
13
|
+
const body = bodyRef.current;
|
|
14
|
+
const scrollWidth = body?.scrollWidth ?? 0;
|
|
15
|
+
const clientWidth = body?.clientWidth ?? 0;
|
|
16
|
+
const barWidth = scrollWidth ? clientWidth * (clientWidth / scrollWidth) : 0;
|
|
17
|
+
const barLeft = scrollWidth ? state.scrollLeft / scrollWidth * clientWidth : 0;
|
|
18
|
+
const checkVisible = () => {
|
|
19
|
+
const element = bodyRef.current;
|
|
20
|
+
if (!element) return;
|
|
21
|
+
const rect = element.getBoundingClientRect();
|
|
22
|
+
const bottom = getContainerBottom(container);
|
|
23
|
+
const hidden = element.scrollWidth <= element.clientWidth || rect.bottom - offsetScroll <= bottom || rect.top >= bottom - offsetScroll;
|
|
24
|
+
setState((previous) => previous.hidden === hidden && previous.scrollLeft === element.scrollLeft ? previous : {
|
|
25
|
+
hidden,
|
|
26
|
+
scrollLeft: element.scrollLeft
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
useImperativeHandle(ref, () => ({
|
|
30
|
+
checkVisible,
|
|
31
|
+
setScrollLeft: (left) => setState((previous) => previous.scrollLeft === left ? previous : {
|
|
32
|
+
...previous,
|
|
33
|
+
scrollLeft: left
|
|
34
|
+
})
|
|
35
|
+
}));
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
const onChange = () => checkVisible();
|
|
38
|
+
container.addEventListener("scroll", onChange, false);
|
|
39
|
+
window.addEventListener("resize", onChange, false);
|
|
40
|
+
onChange();
|
|
41
|
+
return () => {
|
|
42
|
+
container.removeEventListener("scroll", onChange, false);
|
|
43
|
+
window.removeEventListener("resize", onChange, false);
|
|
44
|
+
};
|
|
45
|
+
}, [container, offsetScroll]);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const onMove = (event) => {
|
|
48
|
+
const drag = dragRef.current;
|
|
49
|
+
const element = bodyRef.current;
|
|
50
|
+
if (!drag || !element || !clientWidth) return;
|
|
51
|
+
const left = drag.left + (event.pageX - drag.x);
|
|
52
|
+
const max = element.scrollWidth - element.clientWidth;
|
|
53
|
+
onScroll({
|
|
54
|
+
currentTarget: element,
|
|
55
|
+
scrollLeft: Math.min(Math.max(left / clientWidth * element.scrollWidth, 0), max)
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
const onUp = () => {
|
|
59
|
+
dragRef.current = null;
|
|
60
|
+
};
|
|
61
|
+
document.addEventListener("mousemove", onMove);
|
|
62
|
+
document.addEventListener("mouseup", onUp);
|
|
63
|
+
return () => {
|
|
64
|
+
document.removeEventListener("mousemove", onMove);
|
|
65
|
+
document.removeEventListener("mouseup", onUp);
|
|
66
|
+
};
|
|
67
|
+
}, [
|
|
68
|
+
bodyRef,
|
|
69
|
+
clientWidth,
|
|
70
|
+
onScroll
|
|
71
|
+
]);
|
|
72
|
+
if (state.hidden || scrollWidth <= clientWidth || !barWidth) return null;
|
|
73
|
+
const onMouseDown = (event) => {
|
|
74
|
+
dragRef.current = {
|
|
75
|
+
left: barLeft,
|
|
76
|
+
x: event.pageX
|
|
77
|
+
};
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
};
|
|
80
|
+
return /* @__PURE__ */ jsx("div", {
|
|
81
|
+
className: `${prefixCls}-sticky-scroll`,
|
|
82
|
+
style: {
|
|
83
|
+
bottom: offsetScroll,
|
|
84
|
+
width: clientWidth
|
|
85
|
+
},
|
|
86
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
87
|
+
style: {
|
|
88
|
+
transform: `translate3d(${barLeft}px, 0, 0)`,
|
|
89
|
+
width: `${barWidth}px`
|
|
90
|
+
},
|
|
91
|
+
className: clsx$1(`${prefixCls}-sticky-scroll-bar`, dragRef.current && `${prefixCls}-sticky-scroll-bar-active`),
|
|
92
|
+
onMouseDown
|
|
93
|
+
})
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
//#endregion
|
|
97
|
+
export { StickyScrollBar as default };
|
|
98
|
+
|
|
99
|
+
//# sourceMappingURL=StickyScrollBar.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StickyScrollBar.mjs","names":["clsx"],"sources":["../../../src/Table/render/StickyScrollBar.tsx"],"sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport {\n type MouseEvent as ReactMouseEvent,\n type Ref,\n type RefObject,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from 'react';\n\nexport interface StickyScrollBarApi {\n checkVisible: () => void;\n setScrollLeft: (left: number) => void;\n}\n\ninterface StickyScrollBarProps {\n bodyRef: RefObject<HTMLElement | null>;\n container: HTMLElement | Window;\n offsetScroll: number;\n onScroll: (info: { currentTarget: HTMLElement; scrollLeft: number }) => void;\n prefixCls: string;\n ref?: Ref<StickyScrollBarApi>;\n}\n\nconst getContainerBottom = (container: HTMLElement | Window) =>\n container === window\n ? window.innerHeight\n : (container as HTMLElement).getBoundingClientRect().bottom;\n\nconst StickyScrollBar = ({\n bodyRef,\n container,\n offsetScroll,\n onScroll,\n prefixCls,\n ref,\n}: StickyScrollBarProps) => {\n const [state, setState] = useState({ hidden: true, scrollLeft: 0 });\n const dragRef = useRef<{ left: number; x: number } | null>(null);\n\n const body = bodyRef.current;\n const scrollWidth = body?.scrollWidth ?? 0;\n const clientWidth = body?.clientWidth ?? 0;\n const barWidth = scrollWidth ? clientWidth * (clientWidth / scrollWidth) : 0;\n const barLeft = scrollWidth ? (state.scrollLeft / scrollWidth) * clientWidth : 0;\n\n const checkVisible = () => {\n const element = bodyRef.current;\n if (!element) return;\n const rect = element.getBoundingClientRect();\n const bottom = getContainerBottom(container);\n const hidden =\n element.scrollWidth <= element.clientWidth ||\n rect.bottom - offsetScroll <= bottom ||\n rect.top >= bottom - offsetScroll;\n setState((previous) =>\n previous.hidden === hidden && previous.scrollLeft === element.scrollLeft\n ? previous\n : { hidden, scrollLeft: element.scrollLeft },\n );\n };\n\n useImperativeHandle(ref, () => ({\n checkVisible,\n setScrollLeft: (left: number) =>\n setState((previous) =>\n previous.scrollLeft === left ? previous : { ...previous, scrollLeft: left },\n ),\n }));\n\n useEffect(() => {\n const onChange = () => checkVisible();\n container.addEventListener('scroll', onChange, false);\n window.addEventListener('resize', onChange, false);\n onChange();\n return () => {\n container.removeEventListener('scroll', onChange, false);\n window.removeEventListener('resize', onChange, false);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [container, offsetScroll]);\n\n useEffect(() => {\n const onMove = (event: MouseEvent) => {\n const drag = dragRef.current;\n const element = bodyRef.current;\n if (!drag || !element || !clientWidth) return;\n const left = drag.left + (event.pageX - drag.x);\n const max = element.scrollWidth - element.clientWidth;\n const scrollLeft = Math.min(Math.max((left / clientWidth) * element.scrollWidth, 0), max);\n onScroll({ currentTarget: element, scrollLeft });\n };\n const onUp = () => {\n dragRef.current = null;\n };\n document.addEventListener('mousemove', onMove);\n document.addEventListener('mouseup', onUp);\n return () => {\n document.removeEventListener('mousemove', onMove);\n document.removeEventListener('mouseup', onUp);\n };\n }, [bodyRef, clientWidth, onScroll]);\n\n if (state.hidden || scrollWidth <= clientWidth || !barWidth) return null;\n\n const onMouseDown = (event: ReactMouseEvent<HTMLDivElement>) => {\n dragRef.current = { left: barLeft, x: event.pageX };\n event.preventDefault();\n };\n\n return (\n <div\n className={`${prefixCls}-sticky-scroll`}\n style={{ bottom: offsetScroll, width: clientWidth }}\n >\n <div\n style={{ transform: `translate3d(${barLeft}px, 0, 0)`, width: `${barWidth}px` }}\n className={clsx(\n `${prefixCls}-sticky-scroll-bar`,\n dragRef.current && `${prefixCls}-sticky-scroll-bar-active`,\n )}\n onMouseDown={onMouseDown}\n />\n </div>\n );\n};\n\nexport default StickyScrollBar;\n"],"mappings":";;;;;AA2BA,MAAM,sBAAsB,cAC1B,cAAc,SACV,OAAO,cACN,UAA0B,sBAAsB,CAAC,CAAC;AAEzD,MAAM,mBAAmB,EACvB,SACA,WACA,cACA,UACA,WACA,UAC0B;CAC1B,MAAM,CAAC,OAAO,YAAY,SAAS;EAAE,QAAQ;EAAM,YAAY;CAAE,CAAC;CAClE,MAAM,UAAU,OAA2C,IAAI;CAE/D,MAAM,OAAO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C;EACjD;EACA,MAAM,aAAa;GACjB,QAAQ,UAAU;EACpB;EACA,SAAS,iBAAiB,aAAa,MAAM;EAC7C,SAAS,iBAAiB,WAAW,IAAI;EACzC,aAAa;GACX,SAAS,oBAAoB,aAAa,MAAM;GAChD,SAAS,oBAAoB,WAAW,IAAI;EAC9C;CACF,GAAG;EAAC;EAAS;EAAa;CAAQ,CAAC;CAEnC,IAAI,MAAM,UAAU,eAAe,eAAe,CAAC,UAAU,OAAO;CAEpE,MAAM,eAAe,UAA2C;EAC9D,QAAQ,UAAU;GAAE,MAAM;GAAS,GAAG,MAAM;EAAM;EAClD,MAAM,eAAe;CACvB;CAEA,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,UAAU;EACxB,OAAO;GAAE,QAAQ;GAAc,OAAO;EAAY;EAElD,UAAA,oBAAC,OAAD;GACE,OAAO;IAAE,WAAW,eAAe,QAAQ;IAAY,OAAO,GAAG,SAAS;GAAI;GAC9E,WAAWA,OACT,GAAG,UAAU,qBACb,QAAQ,WAAW,GAAG,UAAU,0BAClC;GACa;EACd,CAAA;CACE,CAAA;AAET"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TableSummaryCellProps, TableSummaryProps, TableSummaryRowProps } from "../type.mjs";
|
|
2
|
+
import "../engine/types.mjs";
|
|
3
|
+
import "../engine/fixed.mjs";
|
|
4
|
+
import { ReactNode } from "react";
|
|
5
|
+
//#region src/Table/render/Summary.d.ts
|
|
6
|
+
declare const TableSummaryRoot: ({ children }: TableSummaryProps) => import("react").JSX.Element;
|
|
7
|
+
declare const TableSummaryRow: (props: TableSummaryRowProps) => import("react").JSX.Element;
|
|
8
|
+
declare const TableSummaryCell: ({ align, children, className, colSpan, index, rowSpan, scope, style }: TableSummaryCellProps) => import("react").JSX.Element;
|
|
9
|
+
type TableSummaryComponent = typeof TableSummaryRoot & {
|
|
10
|
+
Cell: typeof TableSummaryCell;
|
|
11
|
+
Row: typeof TableSummaryRow;
|
|
12
|
+
};
|
|
13
|
+
export declare const TableSummary: TableSummaryComponent;
|
|
14
|
+
//#endregion
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=Summary.d.mts.map
|