niuma-ui 2.0.3 → 2.0.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/CHANGELOG.md +96 -0
- package/dist/components/_shared/index.d.ts +2 -2
- package/dist/components/_shared/src/overlay-utils.d.ts +44 -1
- package/dist/components/_shared/src/overlay-utils.js +87 -2
- package/dist/components/_shared/src/reka.d.ts +1 -1
- package/dist/components/_shared/src/reka.js +2 -2
- package/dist/components/alert/index.d.ts +1 -0
- package/dist/components/alert/src/RsAlert.css +120 -65
- package/dist/components/alert/src/RsAlert.d.ts +24 -5
- package/dist/components/alert/src/RsAlert.impl.js +108 -36
- package/dist/components/alert/src/RsAlert.js +1 -1
- package/dist/components/alert/src/alert-utils.d.ts +37 -0
- package/dist/components/alert/src/alert-utils.js +71 -0
- package/dist/components/anchor/index.d.ts +1 -1
- package/dist/components/anchor/src/RsAnchor.css +63 -32
- package/dist/components/anchor/src/RsAnchor.d.ts +29 -2
- package/dist/components/anchor/src/RsAnchor.impl.js +199 -81
- package/dist/components/anchor/src/RsAnchor.js +1 -1
- package/dist/components/anchor/src/anchor-utils.d.ts +36 -4
- package/dist/components/anchor/src/anchor-utils.js +81 -19
- package/dist/components/auto-complete/index.d.ts +2 -0
- package/dist/components/auto-complete/src/RsAutoComplete.css +122 -0
- package/dist/components/auto-complete/src/RsAutoComplete.d.ts +47 -7
- package/dist/components/auto-complete/src/RsAutoComplete.impl.js +180 -72
- package/dist/components/auto-complete/src/RsAutoComplete.js +4 -1
- package/dist/components/auto-complete/src/auto-complete-utils.d.ts +7 -0
- package/dist/components/auto-complete/src/auto-complete-utils.js +17 -0
- package/dist/components/avatar/index.d.ts +1 -0
- package/dist/components/avatar/src/RsAvatar.css +36 -19
- package/dist/components/avatar/src/RsAvatar.d.ts +9 -3
- package/dist/components/avatar/src/RsAvatar.impl.js +57 -33
- package/dist/components/avatar/src/RsAvatar.js +2 -1
- package/dist/components/avatar/src/avatar-utils.d.ts +16 -7
- package/dist/components/avatar/src/avatar-utils.js +41 -3
- package/dist/components/breadcrumb/index.d.ts +1 -1
- package/dist/components/breadcrumb/src/RsBreadcrumb.css +50 -17
- package/dist/components/breadcrumb/src/RsBreadcrumb.d.ts +45 -6
- package/dist/components/breadcrumb/src/RsBreadcrumb.impl.js +111 -12
- package/dist/components/breadcrumb/src/RsBreadcrumb.js +2 -1
- package/dist/components/breadcrumb/src/breadcrumb-utils.d.ts +37 -5
- package/dist/components/breadcrumb/src/breadcrumb-utils.js +70 -9
- package/dist/components/button/src/RsButton.impl.js +1 -1
- package/dist/components/calendar-grid/index.d.ts +2 -0
- package/dist/components/calendar-grid/src/RsCalendarGrid.css +105 -45
- package/dist/components/calendar-grid/src/RsCalendarGrid.d.ts +62 -2
- package/dist/components/calendar-grid/src/RsCalendarGrid.impl.js +265 -94
- package/dist/components/calendar-grid/src/RsCalendarGrid.js +1 -1
- package/dist/components/calendar-grid/src/calendar-grid-utils.d.ts +72 -0
- package/dist/components/calendar-grid/src/calendar-grid-utils.js +122 -0
- package/dist/components/card/index.d.ts +1 -1
- package/dist/components/card/src/RsCard.css +108 -98
- package/dist/components/card/src/RsCard.d.ts +4 -13
- package/dist/components/card/src/RsCard.impl.js +29 -25
- package/dist/components/card/src/RsCard.js +2 -1
- package/dist/components/card/src/card-utils.d.ts +25 -0
- package/dist/components/card/src/card-utils.js +10 -0
- package/dist/components/cascader/index.d.ts +1 -0
- package/dist/components/cascader/src/RsCascader.css +175 -30
- package/dist/components/cascader/src/RsCascader.d.ts +15 -3
- package/dist/components/cascader/src/RsCascader.impl.js +277 -48
- package/dist/components/cascader/src/RsCascader.js +1 -1
- package/dist/components/cascader/src/cascader-utils.d.ts +2 -0
- package/dist/components/cascader/src/cascader-utils.js +8 -1
- package/dist/components/checkbox/index.d.ts +1 -0
- package/dist/components/checkbox/src/RsCheckbox.css +46 -23
- package/dist/components/checkbox/src/RsCheckbox.d.ts +11 -1
- package/dist/components/checkbox/src/RsCheckbox.impl.js +37 -9
- package/dist/components/checkbox/src/RsCheckbox.js +2 -1
- package/dist/components/checkbox/src/checkbox-utils.d.ts +4 -0
- package/dist/components/checkbox/src/checkbox-utils.js +12 -0
- package/dist/components/code-block/index.d.ts +1 -0
- package/dist/components/code-block/src/RsCodeBlock.css +93 -52
- package/dist/components/code-block/src/RsCodeBlock.d.ts +36 -9
- package/dist/components/code-block/src/RsCodeBlock.impl.js +203 -84
- package/dist/components/code-block/src/RsCodeBlock.js +1 -1
- package/dist/components/code-block/src/code-block-highlight.d.ts +4 -0
- package/dist/components/code-block/src/code-block-highlight.js +34 -0
- package/dist/components/code-block/src/code-block-utils.d.ts +23 -0
- package/dist/components/code-block/src/code-block-utils.js +71 -0
- package/dist/components/code-editor/index.d.ts +1 -1
- package/dist/components/code-editor/src/RsCodeEditor.css +118 -92
- package/dist/components/code-editor/src/RsCodeEditor.d.ts +14 -3
- package/dist/components/code-editor/src/RsCodeEditor.impl.js +261 -94
- package/dist/components/code-editor/src/RsCodeEditor.js +1 -1
- package/dist/components/code-editor/src/code-editor-utils.d.ts +15 -0
- package/dist/components/code-editor/src/code-editor-utils.js +36 -1
- package/dist/components/code-editor/src/code-mirror-completion.d.ts +1 -1
- package/dist/components/code-editor/src/code-mirror-completion.js +8 -5
- package/dist/components/code-editor/src/code-mirror-diagnostics.d.ts +2 -3
- package/dist/components/code-editor/src/code-mirror-diagnostics.js +3 -4
- package/dist/components/code-editor/src/code-mirror-ghost.d.ts +1 -1
- package/dist/components/code-editor/src/code-mirror-ghost.js +12 -3
- package/dist/components/code-editor/src/code-mirror-inline-edit.js +8 -3
- package/dist/components/code-editor/src/code-mirror-intel.d.ts +2 -2
- package/dist/components/code-editor/src/code-mirror-intel.js +50 -39
- package/dist/components/code-editor/src/code-mirror-lang.js +4 -0
- package/dist/components/code-editor/src/code-mirror-session.d.ts +13 -0
- package/dist/components/code-editor/src/code-mirror-session.js +30 -0
- package/dist/components/container/index.d.ts +1 -1
- package/dist/components/container/src/RsContainer.css +11 -11
- package/dist/components/container/src/RsContainer.d.ts +2 -12
- package/dist/components/container/src/RsContainer.impl.js +10 -57
- package/dist/components/container/src/RsContainer.js +1 -1
- package/dist/components/container/src/container-utils.d.ts +23 -0
- package/dist/components/container/src/container-utils.js +51 -0
- package/dist/components/context-menu/index.d.ts +1 -1
- package/dist/components/context-menu/src/RsContextMenu.css +115 -89
- package/dist/components/context-menu/src/RsContextMenu.d.ts +32 -11
- package/dist/components/context-menu/src/RsContextMenu.impl.js +795 -48
- package/dist/components/context-menu/src/RsContextMenuItems.d.ts +25 -1
- package/dist/components/context-menu/src/RsContextMenuItems.impl.js +110 -61
- package/dist/components/context-menu/src/context-menu-utils.d.ts +89 -3
- package/dist/components/context-menu/src/context-menu-utils.js +168 -3
- package/dist/components/date-picker/index.d.ts +4 -2
- package/dist/components/date-picker/src/RsDatePicker.css +42 -22
- package/dist/components/date-picker/src/RsDatePicker.d.ts +44 -20
- package/dist/components/date-picker/src/RsDatePicker.impl.js +484 -222
- package/dist/components/date-picker/src/RsDatePicker.js +1 -3
- package/dist/components/date-picker/src/RsDateTimePicker.d.ts +33 -6
- package/dist/components/date-picker/src/RsDateTimePicker.impl.js +47 -6
- package/dist/components/date-picker/src/date-picker-utils.d.ts +19 -0
- package/dist/components/date-picker/src/date-picker-utils.js +33 -10
- package/dist/components/descriptions/index.d.ts +1 -1
- package/dist/components/descriptions/src/RsDescriptions.css +38 -11
- package/dist/components/descriptions/src/RsDescriptions.d.ts +20 -4
- package/dist/components/descriptions/src/RsDescriptions.impl.js +89 -19
- package/dist/components/descriptions/src/RsDescriptionsItem.impl.js +13 -6
- package/dist/components/descriptions/src/descriptions-utils.d.ts +19 -0
- package/dist/components/descriptions/src/descriptions-utils.js +39 -1
- package/dist/components/dialog/index.d.ts +1 -1
- package/dist/components/dialog/src/RsConfirmDialog.css +47 -21
- package/dist/components/dialog/src/RsConfirmDialog.d.ts +19 -7
- package/dist/components/dialog/src/RsConfirmDialog.impl.js +349 -119
- package/dist/components/dialog/src/RsConfirmDialog.js +2 -1
- package/dist/components/dialog/src/RsDialog.css +102 -109
- package/dist/components/dialog/src/RsDialog.d.ts +34 -24
- package/dist/components/dialog/src/RsDialog.impl.js +410 -177
- package/dist/components/dialog/src/RsDialog.js +2 -1
- package/dist/components/dialog/src/dialog-utils.d.ts +40 -1
- package/dist/components/dialog/src/dialog-utils.js +152 -1
- package/dist/components/dialog/src/dialog-window.js +29 -8
- package/dist/components/drawer/index.d.ts +1 -1
- package/dist/components/drawer/src/RsDrawer.css +61 -29
- package/dist/components/drawer/src/RsDrawer.d.ts +37 -21
- package/dist/components/drawer/src/RsDrawer.impl.js +441 -223
- package/dist/components/drawer/src/drawer-utils.d.ts +35 -0
- package/dist/components/drawer/src/drawer-utils.js +131 -1
- package/dist/components/dropdown/index.d.ts +1 -1
- package/dist/components/dropdown/src/RsDropdown.css +140 -61
- package/dist/components/dropdown/src/RsDropdown.d.ts +39 -6
- package/dist/components/dropdown/src/RsDropdown.impl.js +693 -63
- package/dist/components/dropdown/src/RsDropdownItemView.impl.js +17 -7
- package/dist/components/dropdown/src/RsDropdownItems.d.ts +32 -3
- package/dist/components/dropdown/src/RsDropdownItems.impl.js +171 -59
- package/dist/components/dropdown/src/dropdown-utils.d.ts +50 -0
- package/dist/components/dropdown/src/dropdown-utils.js +103 -3
- package/dist/components/dynamic-tags/index.d.ts +1 -1
- package/dist/components/dynamic-tags/src/RsDynamicTags.css +115 -38
- package/dist/components/dynamic-tags/src/RsDynamicTags.d.ts +58 -17
- package/dist/components/dynamic-tags/src/RsDynamicTags.impl.js +269 -106
- package/dist/components/dynamic-tags/src/RsDynamicTags.js +1 -1
- package/dist/components/dynamic-tags/src/dynamic-tags-utils.d.ts +19 -0
- package/dist/components/dynamic-tags/src/dynamic-tags-utils.js +60 -0
- package/dist/components/empty/index.d.ts +1 -0
- package/dist/components/empty/src/RsEmpty.css +105 -23
- package/dist/components/empty/src/RsEmpty.d.ts +27 -4
- package/dist/components/empty/src/RsEmpty.impl.js +154 -11
- package/dist/components/empty/src/RsEmpty.js +2 -1
- package/dist/components/empty/src/empty-utils.d.ts +28 -0
- package/dist/components/empty/src/empty-utils.js +55 -0
- package/dist/components/fieldset/src/RsFieldset.css +71 -41
- package/dist/components/fieldset/src/RsFieldset.d.ts +21 -2
- package/dist/components/fieldset/src/RsFieldset.impl.js +93 -26
- package/dist/components/fieldset/src/RsFieldset.js +1 -1
- package/dist/components/fieldset/src/fieldset-utils.d.ts +4 -0
- package/dist/components/fieldset/src/fieldset-utils.js +9 -1
- package/dist/components/form/index.d.ts +1 -0
- package/dist/components/form/src/RsForm.css +15 -12
- package/dist/components/form/src/RsForm.d.ts +21 -23
- package/dist/components/form/src/RsForm.impl.js +33 -20
- package/dist/components/form/src/RsForm.js +1 -1
- package/dist/components/form/src/form-utils.d.ts +7 -0
- package/dist/components/form/src/form-utils.js +28 -1
- package/dist/components/input/index.d.ts +1 -1
- package/dist/components/input/src/RsInput.css +78 -260
- package/dist/components/input/src/RsInput.d.ts +5 -3
- package/dist/components/input/src/RsInput.impl.js +8 -16
- package/dist/components/input/src/RsInput.js +1 -1
- package/dist/components/input/src/input-utils.d.ts +11 -0
- package/dist/components/input/src/input-utils.js +22 -0
- package/dist/components/input-number/index.d.ts +1 -0
- package/dist/components/input-number/src/RsInputNumber.css +31 -31
- package/dist/components/input-number/src/RsInputNumber.d.ts +16 -14
- package/dist/components/input-number/src/RsInputNumber.impl.js +17 -4
- package/dist/components/input-number/src/RsInputNumber.js +1 -1
- package/dist/components/label/src/RsLabel.css +30 -11
- package/dist/components/label/src/RsLabel.d.ts +18 -1
- package/dist/components/label/src/RsLabel.impl.js +63 -10
- package/dist/components/label/src/RsLabel.js +1 -1
- package/dist/components/label/src/label-utils.d.ts +6 -0
- package/dist/components/label/src/label-utils.js +16 -0
- package/dist/components/link/src/RsLink.d.ts +2 -2
- package/dist/components/loading/index.d.ts +1 -0
- package/dist/components/loading/src/RsLoading.css +13 -97
- package/dist/components/loading/src/RsLoading.d.ts +53 -3
- package/dist/components/loading/src/RsLoading.impl.js +216 -33
- package/dist/components/loading/src/RsLoading.js +2 -1
- package/dist/components/loading/src/loading-status.css +210 -0
- package/dist/components/loading/src/loading-status.d.ts +34 -0
- package/dist/components/loading/src/loading-status.impl.js +84 -0
- package/dist/components/loading/src/loading-status.js +8 -0
- package/dist/components/loading/src/loading-utils.d.ts +51 -4
- package/dist/components/loading/src/loading-utils.js +122 -0
- package/dist/components/loading-bar/index.d.ts +1 -0
- package/dist/components/loading-bar/src/RsLoadingBar.css +72 -8
- package/dist/components/loading-bar/src/RsLoadingBar.d.ts +55 -11
- package/dist/components/loading-bar/src/RsLoadingBar.impl.js +298 -57
- package/dist/components/loading-bar/src/RsLoadingBar.js +1 -1
- package/dist/components/loading-bar/src/loading-bar-utils.d.ts +69 -0
- package/dist/components/loading-bar/src/loading-bar-utils.js +97 -0
- package/dist/components/log/src/RsLog.css +52 -144
- package/dist/components/log/src/RsLog.d.ts +12 -11
- package/dist/components/log/src/RsLog.impl.js +181 -148
- package/dist/components/log/src/RsLog.js +1 -1
- package/dist/components/log/src/RsLogRow.css +152 -0
- package/dist/components/log/src/RsLogRow.d.ts +35 -0
- package/dist/components/log/src/RsLogRow.impl.js +91 -0
- package/dist/components/log/src/RsLogRow.js +8 -0
- package/dist/components/log/src/log-utils.d.ts +8 -0
- package/dist/components/log/src/log-utils.js +71 -10
- package/dist/components/markdown/index.d.ts +1 -1
- package/dist/components/markdown/src/RsMarkdown.css +75 -32
- package/dist/components/markdown/src/RsMarkdown.d.ts +6 -2
- package/dist/components/markdown/src/RsMarkdown.impl.js +185 -17
- package/dist/components/markdown/src/markdown-utils.d.ts +26 -0
- package/dist/components/markdown/src/markdown-utils.js +114 -12
- package/dist/components/mentions/index.d.ts +2 -1
- package/dist/components/mentions/src/RsMentions.css +119 -3
- package/dist/components/mentions/src/RsMentions.d.ts +57 -5
- package/dist/components/mentions/src/RsMentions.impl.js +298 -79
- package/dist/components/mentions/src/RsMentions.js +1 -3
- package/dist/components/mentions/src/mentions-utils.d.ts +5 -1
- package/dist/components/mentions/src/mentions-utils.js +28 -9
- package/dist/components/menu/index.d.ts +1 -1
- package/dist/components/menu/src/RsMenu.css +70 -29
- package/dist/components/menu/src/RsMenu.d.ts +58 -4
- package/dist/components/menu/src/RsMenu.impl.js +93 -46
- package/dist/components/menu/src/RsMenuItems.d.ts +22 -5
- package/dist/components/menu/src/RsMenuItems.impl.js +506 -154
- package/dist/components/menu/src/menu-utils.d.ts +56 -0
- package/dist/components/menu/src/menu-utils.js +139 -6
- package/dist/components/monaco-editor/index.d.ts +1 -1
- package/dist/components/monaco-editor/src/RsMonacoEditor.css +28 -16
- package/dist/components/monaco-editor/src/RsMonacoEditor.d.ts +39 -41
- package/dist/components/monaco-editor/src/RsMonacoEditor.impl.js +212 -133
- package/dist/components/monaco-editor/src/RsMonacoEditor.js +1 -1
- package/dist/components/monaco-editor/src/monaco-editor-utils.d.ts +126 -0
- package/dist/components/monaco-editor/src/monaco-editor-utils.js +302 -0
- package/dist/components/pagination/index.d.ts +2 -2
- package/dist/components/pagination/src/RsPagination.css +93 -46
- package/dist/components/pagination/src/RsPagination.d.ts +68 -8
- package/dist/components/pagination/src/RsPagination.impl.js +229 -86
- package/dist/components/pagination/src/RsPagination.js +1 -1
- package/dist/components/pagination/src/pagination-utils.d.ts +59 -0
- package/dist/components/pagination/src/pagination-utils.js +105 -1
- package/dist/components/popover/index.d.ts +1 -0
- package/dist/components/popover/src/RsPopover.css +124 -14
- package/dist/components/popover/src/RsPopover.d.ts +38 -7
- package/dist/components/popover/src/RsPopover.impl.js +546 -35
- package/dist/components/popover/src/RsPopover.js +2 -1
- package/dist/components/popover/src/popover-utils.d.ts +24 -2
- package/dist/components/popover/src/popover-utils.js +55 -0
- package/dist/components/radio/index.d.ts +1 -1
- package/dist/components/radio/src/RsRadio.css +7 -6
- package/dist/components/radio/src/RsRadio.d.ts +8 -5
- package/dist/components/radio/src/RsRadio.impl.js +34 -24
- package/dist/components/radio/src/RsRadio.js +2 -1
- package/dist/components/radio/src/RsRadioItem.css +61 -44
- package/dist/components/radio/src/RsRadioItem.d.ts +2 -2
- package/dist/components/radio/src/RsRadioItem.impl.js +53 -20
- package/dist/components/radio/src/RsRadioItem.js +2 -1
- package/dist/components/radio/src/radio-utils.d.ts +12 -1
- package/dist/components/radio/src/radio-utils.js +15 -1
- package/dist/components/scrollbar/src/RsScrollbar.css +71 -24
- package/dist/components/scrollbar/src/RsScrollbar.d.ts +9 -5
- package/dist/components/scrollbar/src/RsScrollbar.impl.js +372 -47
- package/dist/components/scrollbar/src/RsScrollbar.js +2 -1
- package/dist/components/scrollbar/src/scrollbar-utils.d.ts +34 -2
- package/dist/components/scrollbar/src/scrollbar-utils.js +64 -1
- package/dist/components/select/index.d.ts +1 -0
- package/dist/components/select/src/RsSelect.css +54 -42
- package/dist/components/select/src/RsSelect.d.ts +19 -2
- package/dist/components/select/src/RsSelect.impl.js +727 -312
- package/dist/components/select/src/RsSelect.js +1 -1
- package/dist/components/select/src/select-utils.d.ts +4 -2
- package/dist/components/select/src/select-utils.js +8 -3
- package/dist/components/select/src/use-rs-select.d.ts +1 -0
- package/dist/components/select/src/use-rs-select.js +23 -17
- package/dist/components/sidebar/index.d.ts +1 -0
- package/dist/components/sidebar/src/RsSidebar.css +91 -33
- package/dist/components/sidebar/src/RsSidebar.d.ts +17 -9
- package/dist/components/sidebar/src/RsSidebar.impl.js +124 -22
- package/dist/components/sidebar/src/RsSidebar.js +1 -1
- package/dist/components/sidebar/src/RsSidebarGroup.css +23 -6
- package/dist/components/sidebar/src/RsSidebarGroup.d.ts +6 -2
- package/dist/components/sidebar/src/RsSidebarGroup.impl.js +17 -4
- package/dist/components/sidebar/src/RsSidebarGroup.js +1 -1
- package/dist/components/sidebar/src/RsSidebarItem.css +50 -20
- package/dist/components/sidebar/src/RsSidebarItem.d.ts +21 -3
- package/dist/components/sidebar/src/RsSidebarItem.impl.js +71 -20
- package/dist/components/sidebar/src/RsSidebarItem.js +1 -1
- package/dist/components/sidebar/src/sidebar-utils.d.ts +47 -0
- package/dist/components/sidebar/src/sidebar-utils.js +72 -0
- package/dist/components/split-pane/index.d.ts +2 -2
- package/dist/components/split-pane/src/RsSplitPane.css +41 -30
- package/dist/components/split-pane/src/RsSplitPane.d.ts +6 -2
- package/dist/components/split-pane/src/RsSplitPane.impl.js +153 -45
- package/dist/components/split-pane/src/split-pane-utils.d.ts +23 -0
- package/dist/components/split-pane/src/split-pane-utils.js +18 -1
- package/dist/components/stat-card/index.d.ts +1 -0
- package/dist/components/stat-card/src/RsStatCard.css +129 -25
- package/dist/components/stat-card/src/RsStatCard.d.ts +40 -4
- package/dist/components/stat-card/src/RsStatCard.impl.js +106 -12
- package/dist/components/stat-card/src/RsStatCard.js +1 -1
- package/dist/components/stat-card/src/stat-card-utils.d.ts +39 -0
- package/dist/components/stat-card/src/stat-card-utils.js +113 -0
- package/dist/components/steps/index.d.ts +1 -1
- package/dist/components/steps/src/RsSteps.css +158 -37
- package/dist/components/steps/src/RsSteps.d.ts +69 -5
- package/dist/components/steps/src/RsSteps.impl.js +168 -28
- package/dist/components/steps/src/RsSteps.js +1 -1
- package/dist/components/steps/src/steps-utils.d.ts +51 -1
- package/dist/components/steps/src/steps-utils.js +67 -1
- package/dist/components/switch/index.d.ts +2 -1
- package/dist/components/switch/src/RsSwitch.css +36 -18
- package/dist/components/switch/src/RsSwitch.d.ts +18 -5
- package/dist/components/switch/src/RsSwitch.impl.js +61 -29
- package/dist/components/switch/src/RsSwitch.js +2 -1
- package/dist/components/switch/src/switch-utils.d.ts +4 -0
- package/dist/components/switch/src/switch-utils.js +9 -0
- package/dist/components/table/src/RsTable.impl.js +4 -2
- package/dist/components/table/src/composables/useRsTableContextMenu.d.ts +16 -0
- package/dist/components/table/src/composables/useRsTableContextMenu.js +1 -1
- package/dist/components/table/src/composables/useRsTableEngine.js +6 -2
- package/dist/components/table/src/composables/useRsTableScrollLayout.js +2 -0
- package/dist/components/table/src/composables/useRsTableShell.d.ts +16 -0
- package/dist/components/table/src/rs-table-props.d.ts +1 -1
- package/dist/components/table/src/rs-table-props.js +0 -1
- package/dist/components/table/src/table-body/RsTableBody.impl.js +1 -0
- package/dist/components/table/src/table-body/RsTableCellEditor.impl.js +10 -2
- package/dist/components/table/src/table-body/RsTableColGroup.impl.js +1 -0
- package/dist/components/table/src/table-footer/RsTableSummaryRow.impl.js +1 -0
- package/dist/components/table/src/table-header/RsTableHeader.impl.js +1 -0
- package/dist/components/table/src/utils/table-utils.d.ts +10 -6
- package/dist/components/table/src/utils/table-utils.js +27 -25
- package/dist/components/table/style/rs-table.css +34 -20
- package/dist/components/tabs/index.d.ts +2 -2
- package/dist/components/tabs/src/RsTabs.css +225 -101
- package/dist/components/tabs/src/RsTabs.d.ts +37 -8
- package/dist/components/tabs/src/RsTabs.impl.js +400 -270
- package/dist/components/tabs/src/tabs-utils.d.ts +41 -2
- package/dist/components/tabs/src/tabs-utils.js +55 -1
- package/dist/components/terminal/index.d.ts +1 -1
- package/dist/components/terminal/src/RsTerminal.css +60 -37
- package/dist/components/terminal/src/RsTerminal.d.ts +36 -4
- package/dist/components/terminal/src/RsTerminal.impl.js +288 -68
- package/dist/components/terminal/src/RsTerminal.js +1 -1
- package/dist/components/terminal/src/terminal-utils.d.ts +42 -4
- package/dist/components/terminal/src/terminal-utils.js +113 -10
- package/dist/components/textarea/src/RsTextarea.css +23 -23
- package/dist/components/textarea/src/RsTextarea.d.ts +7 -13
- package/dist/components/textarea/src/RsTextarea.impl.js +37 -46
- package/dist/components/textarea/src/RsTextarea.js +1 -1
- package/dist/components/textarea/src/textarea-utils.d.ts +27 -0
- package/dist/components/textarea/src/textarea-utils.js +61 -0
- package/dist/components/time-picker/index.d.ts +3 -2
- package/dist/components/time-picker/src/RsTimePicker.css +41 -24
- package/dist/components/time-picker/src/RsTimePicker.d.ts +52 -7
- package/dist/components/time-picker/src/RsTimePicker.impl.js +520 -156
- package/dist/components/time-picker/src/RsTimePicker.js +1 -3
- package/dist/components/time-picker/src/RsTimePickerColumns.css +26 -18
- package/dist/components/time-picker/src/RsTimePickerColumns.d.ts +3 -1
- package/dist/components/time-picker/src/RsTimePickerColumns.impl.js +62 -9
- package/dist/components/time-picker/src/RsTimePickerColumns.js +1 -1
- package/dist/components/time-picker/src/time-picker-utils.d.ts +38 -0
- package/dist/components/time-picker/src/time-picker-utils.js +97 -5
- package/dist/components/toaster/src/RsToaster.css +156 -203
- package/dist/components/toaster/src/RsToaster.d.ts +33 -3
- package/dist/components/toaster/src/RsToaster.impl.js +309 -34
- package/dist/components/toaster/src/toast-store.d.ts +95 -0
- package/dist/components/toaster/src/toast-store.js +177 -0
- package/dist/components/toaster/src/toast-utils.d.ts +60 -0
- package/dist/components/toaster/src/toast-utils.js +86 -0
- package/dist/components/toolbar/index.d.ts +1 -1
- package/dist/components/toolbar/src/RsToolbar.css +206 -32
- package/dist/components/toolbar/src/RsToolbar.d.ts +41 -16
- package/dist/components/toolbar/src/RsToolbar.impl.js +146 -18
- package/dist/components/toolbar/src/RsToolbar.js +2 -1
- package/dist/components/toolbar/src/toolbar-utils.d.ts +20 -0
- package/dist/components/toolbar/src/toolbar-utils.js +105 -0
- package/dist/components/tooltip/index.d.ts +1 -0
- package/dist/components/tooltip/src/RsTooltip.css +104 -26
- package/dist/components/tooltip/src/RsTooltip.d.ts +39 -17
- package/dist/components/tooltip/src/RsTooltip.impl.js +420 -51
- package/dist/components/tooltip/src/RsTooltip.js +2 -1
- package/dist/components/tooltip/src/RsTooltipProvider.d.ts +4 -4
- package/dist/components/tooltip/src/RsTooltipProvider.impl.js +51 -14
- package/dist/components/tooltip/src/tooltip-utils.d.ts +30 -0
- package/dist/components/tooltip/src/tooltip-utils.js +23 -0
- package/dist/components/tree/index.d.ts +2 -2
- package/dist/components/tree/src/RsTree.css +84 -75
- package/dist/components/tree/src/RsTree.d.ts +23 -23
- package/dist/components/tree/src/RsTree.impl.js +292 -66
- package/dist/components/tree/src/RsTree.js +1 -1
- package/dist/components/tree/src/tree-utils.d.ts +22 -0
- package/dist/components/tree/src/tree-utils.js +18 -4
- package/dist/components/tree-select/index.d.ts +2 -0
- package/dist/components/tree-select/src/RsTreeSelect.css +100 -25
- package/dist/components/tree-select/src/RsTreeSelect.d.ts +91 -7
- package/dist/components/tree-select/src/RsTreeSelect.impl.js +464 -79
- package/dist/components/tree-select/src/RsTreeSelect.js +1 -1
- package/dist/components/tree-select/src/tree-select-utils.d.ts +20 -0
- package/dist/components/tree-select/src/tree-select-utils.js +60 -0
- package/dist/components/upload/index.d.ts +2 -1
- package/dist/components/upload/src/RsUpload.css +223 -75
- package/dist/components/upload/src/RsUpload.d.ts +77 -1
- package/dist/components/upload/src/RsUpload.impl.js +404 -90
- package/dist/components/upload/src/RsUpload.js +1 -1
- package/dist/components/upload/src/upload-utils.d.ts +21 -2
- package/dist/components/upload/src/upload-utils.js +139 -9
- package/dist/components/virtual-list/index.d.ts +1 -1
- package/dist/components/virtual-list/src/RsVirtualList.css +64 -9
- package/dist/components/virtual-list/src/RsVirtualList.d.ts +31 -5
- package/dist/components/virtual-list/src/RsVirtualList.impl.js +425 -76
- package/dist/components/virtual-list/src/RsVirtualList.js +1 -1
- package/dist/components/virtual-list/src/virtual-list-utils.d.ts +64 -1
- package/dist/components/virtual-list/src/virtual-list-utils.js +215 -1
- package/dist/composables/useRsLoadingBar.d.ts +2 -5
- package/dist/composables/useRsLoadingBar.js +21 -5
- package/dist/composables/useRsTabsNav.d.ts +3 -1
- package/dist/composables/useRsTabsNav.js +96 -28
- package/dist/composables/useRsToast.d.ts +11 -13
- package/dist/composables/useRsToast.js +66 -17
- package/dist/index.d.ts +51 -32
- package/dist/index.js +20 -0
- package/dist/locale/apply.js +6 -1
- package/dist/locale/messages.js +174 -4
- package/dist/styles.css +1007 -980
- package/dist/theme/brand.example.css +3 -2
- package/dist/vite-plugins/niuma-ui-host.js +1 -1
- package/package.json +2 -3
- package/dist/components/breadcrumb/src/RsBreadcrumbItems.d.ts +0 -8
- package/dist/components/breadcrumb/src/RsBreadcrumbItems.impl.js +0 -40
- package/dist/components/breadcrumb/src/RsBreadcrumbItems.js +0 -5
- package/dist/components/date-picker/src/RsDatePicker-1.css +0 -157
- package/dist/components/mentions/src/RsMentions-1.css +0 -29
- package/dist/components/time-picker/src/RsTimePicker-1.css +0 -98
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
//#region src/components/virtual-list/src/virtual-list-utils.ts
|
|
2
|
+
/** Chrome / Firefox 可滚动高度上限之下,避免超长列表把滚动条撑爆。 */
|
|
3
|
+
var RS_VIRTUAL_LIST_MAX_EXTENT = 8e6;
|
|
2
4
|
function resolveItemSize(itemSize, index = 0) {
|
|
5
|
+
if (itemSize === "auto") return 32;
|
|
3
6
|
const size = typeof itemSize === "function" ? itemSize(index) : itemSize;
|
|
4
7
|
return Number.isFinite(size) && size > 0 ? size : 32;
|
|
5
8
|
}
|
|
@@ -24,5 +27,216 @@ function parseVirtualListHeightPx(height) {
|
|
|
24
27
|
}
|
|
25
28
|
return null;
|
|
26
29
|
}
|
|
30
|
+
function normalizeOverscan(value, fallback = 4) {
|
|
31
|
+
if (value == null || !Number.isFinite(value)) return fallback;
|
|
32
|
+
return Math.max(0, Math.floor(value));
|
|
33
|
+
}
|
|
34
|
+
function capExtent(total, max = RS_VIRTUAL_LIST_MAX_EXTENT) {
|
|
35
|
+
if (!Number.isFinite(total) || total <= 0) return 0;
|
|
36
|
+
return Math.min(total, max);
|
|
37
|
+
}
|
|
38
|
+
function axisMax(total, viewport) {
|
|
39
|
+
return Math.max(0, total - Math.max(0, viewport));
|
|
40
|
+
}
|
|
41
|
+
/** 内容偏移 → 滚动条偏移。未触顶时二者相同。 */
|
|
42
|
+
function contentToScroll(content, total, viewport, extent) {
|
|
43
|
+
const contentMax = axisMax(total, viewport);
|
|
44
|
+
const scrollMax = axisMax(extent, viewport);
|
|
45
|
+
if (contentMax === 0 || scrollMax === 0) return 0;
|
|
46
|
+
return Math.min(1, Math.max(0, content / contentMax)) * scrollMax;
|
|
47
|
+
}
|
|
48
|
+
/** 滚动条偏移 → 内容偏移。未触顶时二者相同。 */
|
|
49
|
+
function scrollToContent(scroll, total, viewport, extent) {
|
|
50
|
+
const contentMax = axisMax(total, viewport);
|
|
51
|
+
const scrollMax = axisMax(extent, viewport);
|
|
52
|
+
if (contentMax === 0 || scrollMax === 0) return 0;
|
|
53
|
+
return Math.min(1, Math.max(0, scroll / scrollMax)) * contentMax;
|
|
54
|
+
}
|
|
55
|
+
/** 窗口在滚动内容里的平移。scale 为 1 时等于条目偏移。 */
|
|
56
|
+
function windowOrigin(scroll, contentOffset, itemOffset) {
|
|
57
|
+
return scroll + itemOffset - contentOffset;
|
|
58
|
+
}
|
|
59
|
+
function buildVirtualMetrics(count, itemSize, measured, estimate = 32) {
|
|
60
|
+
const countSafe = Number.isFinite(count) && count > 0 ? Math.floor(count) : 0;
|
|
61
|
+
const estimatePx = resolveItemSize(estimate);
|
|
62
|
+
if (itemSize !== "auto" && typeof itemSize !== "function") {
|
|
63
|
+
const size = resolveItemSize(itemSize);
|
|
64
|
+
const total = countSafe * size;
|
|
65
|
+
return {
|
|
66
|
+
fixed: size,
|
|
67
|
+
total,
|
|
68
|
+
extent: capExtent(total),
|
|
69
|
+
sizeAt: () => size,
|
|
70
|
+
offsetAt: (index) => {
|
|
71
|
+
if (countSafe <= 0) return 0;
|
|
72
|
+
if (index >= countSafe) return total;
|
|
73
|
+
return Math.max(0, index) * size;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
const sizes = new Array(countSafe);
|
|
78
|
+
const offsets = new Array(countSafe);
|
|
79
|
+
let total = 0;
|
|
80
|
+
for (let index = 0; index < countSafe; index += 1) {
|
|
81
|
+
let size = estimatePx;
|
|
82
|
+
if (itemSize === "auto") {
|
|
83
|
+
const known = measured?.get(index);
|
|
84
|
+
if (known != null && known > 0) size = known;
|
|
85
|
+
} else size = resolveItemSize(itemSize, index);
|
|
86
|
+
sizes[index] = size;
|
|
87
|
+
offsets[index] = total;
|
|
88
|
+
total += size;
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
fixed: null,
|
|
92
|
+
total,
|
|
93
|
+
extent: capExtent(total),
|
|
94
|
+
sizeAt: (index) => {
|
|
95
|
+
if (index < 0 || index >= countSafe) return estimatePx;
|
|
96
|
+
return sizes[index] ?? estimatePx;
|
|
97
|
+
},
|
|
98
|
+
offsetAt: (index) => {
|
|
99
|
+
if (countSafe <= 0 || index <= 0) return 0;
|
|
100
|
+
if (index >= countSafe) return total;
|
|
101
|
+
return offsets[index] ?? total;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function findIndexAtOffset(count, offset, metrics) {
|
|
106
|
+
if (count <= 0) return 0;
|
|
107
|
+
const target = Math.max(0, offset);
|
|
108
|
+
if (metrics.fixed) return Math.min(count - 1, Math.floor(target / metrics.fixed));
|
|
109
|
+
let lo = 0;
|
|
110
|
+
let hi = count - 1;
|
|
111
|
+
let answer = 0;
|
|
112
|
+
while (lo <= hi) {
|
|
113
|
+
const mid = lo + hi >> 1;
|
|
114
|
+
if (metrics.offsetAt(mid) <= target) {
|
|
115
|
+
answer = mid;
|
|
116
|
+
lo = mid + 1;
|
|
117
|
+
} else hi = mid - 1;
|
|
118
|
+
}
|
|
119
|
+
return answer;
|
|
120
|
+
}
|
|
121
|
+
function resolveVisibleRange(count, contentOffset, viewport, overscan, metrics) {
|
|
122
|
+
if (count <= 0) return {
|
|
123
|
+
start: 0,
|
|
124
|
+
end: 0,
|
|
125
|
+
offset: 0
|
|
126
|
+
};
|
|
127
|
+
const over = normalizeOverscan(overscan);
|
|
128
|
+
const scroll = Math.max(0, contentOffset);
|
|
129
|
+
if (metrics.fixed) {
|
|
130
|
+
const start = Math.max(0, Math.floor(scroll / metrics.fixed) - over);
|
|
131
|
+
const visible = Math.ceil(Math.max(0, viewport) / metrics.fixed) + over * 2;
|
|
132
|
+
return {
|
|
133
|
+
start,
|
|
134
|
+
end: Math.min(count, start + visible),
|
|
135
|
+
offset: metrics.offsetAt(start)
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
const startIndex = findIndexAtOffset(count, scroll, metrics);
|
|
139
|
+
const endIndex = findIndexAtOffset(count, scroll + Math.max(0, viewport), metrics);
|
|
140
|
+
const start = Math.max(0, startIndex - over);
|
|
141
|
+
return {
|
|
142
|
+
start,
|
|
143
|
+
end: Math.min(count, endIndex + 1 + over),
|
|
144
|
+
offset: metrics.offsetAt(start)
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function resolveAlignedOffset(options) {
|
|
148
|
+
const { index, align, count, viewport, contentOffset, total, offsetAt, sizeAt } = options;
|
|
149
|
+
if (index < 0 || index >= count) return null;
|
|
150
|
+
const itemTop = offsetAt(index);
|
|
151
|
+
const itemSize = sizeAt(index);
|
|
152
|
+
const itemBottom = itemTop + itemSize;
|
|
153
|
+
const viewTop = contentOffset;
|
|
154
|
+
const viewBottom = viewTop + viewport;
|
|
155
|
+
const maxScroll = axisMax(total, viewport);
|
|
156
|
+
if (align === "nearest" && itemTop >= viewTop && itemBottom <= viewBottom) return null;
|
|
157
|
+
let next = itemTop - (viewport - itemSize) / 2;
|
|
158
|
+
if (align === "start") next = itemTop;
|
|
159
|
+
if (align === "end") next = itemBottom - viewport;
|
|
160
|
+
if (align === "nearest") if (itemTop < viewTop) next = itemTop;
|
|
161
|
+
else if (itemBottom > viewBottom) next = itemBottom - viewport;
|
|
162
|
+
else return null;
|
|
163
|
+
return Math.min(maxScroll, Math.max(0, next));
|
|
164
|
+
}
|
|
165
|
+
function readHorizontalOffset(scrollLeft, max, rtl, type) {
|
|
166
|
+
if (!rtl || type === "default") return Math.max(0, scrollLeft);
|
|
167
|
+
if (type === "negative") return Math.abs(scrollLeft);
|
|
168
|
+
return Math.max(0, max - scrollLeft);
|
|
169
|
+
}
|
|
170
|
+
function writeHorizontalOffset(offset, max, rtl, type) {
|
|
171
|
+
const next = Math.min(Math.max(0, max), Math.max(0, offset));
|
|
172
|
+
if (!rtl || type === "default") return next;
|
|
173
|
+
if (type === "negative") return -next;
|
|
174
|
+
return Math.max(0, max - next);
|
|
175
|
+
}
|
|
176
|
+
var cachedRtlScrollType = null;
|
|
177
|
+
/** 探测当前引擎的 RTL scrollLeft。探测节点用完即删。无 document 时按 default。 */
|
|
178
|
+
function detectRtlScrollType() {
|
|
179
|
+
if (cachedRtlScrollType) return cachedRtlScrollType;
|
|
180
|
+
if (typeof document === "undefined" || !document.body) return "default";
|
|
181
|
+
const dummy = document.createElement("div");
|
|
182
|
+
const inner = document.createElement("div");
|
|
183
|
+
dummy.dir = "rtl";
|
|
184
|
+
dummy.style.cssText = "width:4px;height:1px;position:absolute;top:-9999px;overflow:scroll;visibility:hidden";
|
|
185
|
+
inner.style.cssText = "width:8px;height:1px";
|
|
186
|
+
dummy.appendChild(inner);
|
|
187
|
+
document.body.appendChild(dummy);
|
|
188
|
+
try {
|
|
189
|
+
const initial = dummy.scrollLeft;
|
|
190
|
+
dummy.scrollLeft = -1;
|
|
191
|
+
if (dummy.scrollLeft < 0) cachedRtlScrollType = "negative";
|
|
192
|
+
else if (initial > 0) cachedRtlScrollType = "reverse";
|
|
193
|
+
else cachedRtlScrollType = "default";
|
|
194
|
+
} finally {
|
|
195
|
+
dummy.remove();
|
|
196
|
+
}
|
|
197
|
+
return cachedRtlScrollType;
|
|
198
|
+
}
|
|
199
|
+
function resolveVirtualListKeyIndex(options) {
|
|
200
|
+
const { count } = options;
|
|
201
|
+
if (count <= 0) return null;
|
|
202
|
+
let motion = null;
|
|
203
|
+
const key = options.key;
|
|
204
|
+
if (options.orientation === "vertical") {
|
|
205
|
+
if (key === "ArrowDown") motion = 1;
|
|
206
|
+
else if (key === "ArrowUp") motion = -1;
|
|
207
|
+
else if (key === "PageDown") motion = "page-down";
|
|
208
|
+
else if (key === "PageUp") motion = "page-up";
|
|
209
|
+
else if (key === "Home") motion = "home";
|
|
210
|
+
else if (key === "End") motion = "end";
|
|
211
|
+
} else {
|
|
212
|
+
const forward = options.rtl ? "ArrowLeft" : "ArrowRight";
|
|
213
|
+
const backward = options.rtl ? "ArrowRight" : "ArrowLeft";
|
|
214
|
+
if (key === forward) motion = 1;
|
|
215
|
+
else if (key === backward) motion = -1;
|
|
216
|
+
else if (key === "Home") motion = "home";
|
|
217
|
+
else if (key === "End") motion = "end";
|
|
218
|
+
}
|
|
219
|
+
if (motion == null) return null;
|
|
220
|
+
const current = options.index;
|
|
221
|
+
const page = Math.max(1, Math.floor(options.pageSize) || 1);
|
|
222
|
+
if (motion === "home") return 0;
|
|
223
|
+
if (motion === "end") return count - 1;
|
|
224
|
+
if (motion === "page-down") {
|
|
225
|
+
const base = current == null || current < 0 ? -1 : current;
|
|
226
|
+
return Math.min(count - 1, base + page);
|
|
227
|
+
}
|
|
228
|
+
if (motion === "page-up") return Math.max(0, (current == null || current < 0 ? 0 : current) - page);
|
|
229
|
+
if (current == null || current < 0) return motion > 0 ? 0 : count - 1;
|
|
230
|
+
return Math.min(count - 1, Math.max(0, current + motion));
|
|
231
|
+
}
|
|
232
|
+
function readVirtualItemBox(entry, orientation) {
|
|
233
|
+
const box = entry.borderBoxSize?.[0];
|
|
234
|
+
if (box) {
|
|
235
|
+
const value = orientation === "horizontal" ? box.inlineSize : box.blockSize;
|
|
236
|
+
if (value > 0) return value;
|
|
237
|
+
}
|
|
238
|
+
const rect = orientation === "horizontal" ? entry.contentRect.width : entry.contentRect.height;
|
|
239
|
+
return Math.max(0, rect);
|
|
240
|
+
}
|
|
27
241
|
//#endregion
|
|
28
|
-
export { isVirtualListFillHeight, parseVirtualListHeightPx, resolveItemSize, resolveVirtualListHeight };
|
|
242
|
+
export { RS_VIRTUAL_LIST_MAX_EXTENT, axisMax, buildVirtualMetrics, capExtent, contentToScroll, detectRtlScrollType, findIndexAtOffset, isVirtualListFillHeight, normalizeOverscan, parseVirtualListHeightPx, readHorizontalOffset, readVirtualItemBox, resolveAlignedOffset, resolveItemSize, resolveVirtualListHeight, resolveVirtualListKeyIndex, resolveVisibleRange, scrollToContent, windowOrigin, writeHorizontalOffset };
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { type InjectionKey, type ShallowRef } from 'vue';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
finish: () => void;
|
|
5
|
-
error: () => void;
|
|
6
|
-
};
|
|
2
|
+
import type { RsLoadingBarApi } from '../components/loading-bar/src/loading-bar-utils';
|
|
3
|
+
export type { RsLoadingBarApi } from '../components/loading-bar/src/loading-bar-utils';
|
|
7
4
|
export declare const RS_LOADING_BAR_KEY: InjectionKey<ShallowRef<RsLoadingBarApi | null>>;
|
|
8
5
|
/**
|
|
9
6
|
* useRsLoadingBar 读取最近的 RsLoadingBar 实例 API。
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { inject } from "vue";
|
|
2
2
|
//#region src/composables/useRsLoadingBar.ts
|
|
3
3
|
var RS_LOADING_BAR_KEY = Symbol("rs-loading-bar");
|
|
4
|
+
var noop = {
|
|
5
|
+
start() {},
|
|
6
|
+
finish() {},
|
|
7
|
+
error() {},
|
|
8
|
+
set() {},
|
|
9
|
+
inc() {},
|
|
10
|
+
getProgress: () => 0,
|
|
11
|
+
isStarted: () => false
|
|
12
|
+
};
|
|
4
13
|
/**
|
|
5
14
|
* useRsLoadingBar 读取最近的 RsLoadingBar 实例 API。
|
|
6
15
|
* 调用方须位于 RsLoadingBar 默认插槽的后代树中;
|
|
@@ -8,11 +17,6 @@ var RS_LOADING_BAR_KEY = Symbol("rs-loading-bar");
|
|
|
8
17
|
*/
|
|
9
18
|
function useRsLoadingBar() {
|
|
10
19
|
const injected = inject(RS_LOADING_BAR_KEY, null);
|
|
11
|
-
const noop = {
|
|
12
|
-
start() {},
|
|
13
|
-
finish() {},
|
|
14
|
-
error() {}
|
|
15
|
-
};
|
|
16
20
|
if (!injected) return noop;
|
|
17
21
|
return {
|
|
18
22
|
start() {
|
|
@@ -23,6 +27,18 @@ function useRsLoadingBar() {
|
|
|
23
27
|
},
|
|
24
28
|
error() {
|
|
25
29
|
injected.value?.error();
|
|
30
|
+
},
|
|
31
|
+
set(progress) {
|
|
32
|
+
injected.value?.set(progress);
|
|
33
|
+
},
|
|
34
|
+
inc(amount) {
|
|
35
|
+
injected.value?.inc(amount);
|
|
36
|
+
},
|
|
37
|
+
getProgress() {
|
|
38
|
+
return injected.value?.getProgress() ?? 0;
|
|
39
|
+
},
|
|
40
|
+
isStarted() {
|
|
41
|
+
return injected.value?.isStarted() ?? false;
|
|
26
42
|
}
|
|
27
43
|
};
|
|
28
44
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ComputedRef, type Ref } from 'vue';
|
|
2
|
-
import { type RsTabItem, type RsTabsOverflow } from '../components/tabs/src/tabs-utils';
|
|
2
|
+
import { type RsTabItem, type RsTabsOverflow, type RsTabsPosition } from '../components/tabs/src/tabs-utils';
|
|
3
3
|
interface UseRsTabsNavOptions {
|
|
4
4
|
items: ComputedRef<RsTabItem[]>;
|
|
5
5
|
activeValue: Ref<string>;
|
|
@@ -11,6 +11,7 @@ interface UseRsTabsNavOptions {
|
|
|
11
11
|
/** 右侧 #extra 区域,计入下拉溢出预留宽度 */
|
|
12
12
|
extraRef?: Ref<HTMLElement | null>;
|
|
13
13
|
addButtonWidth: number;
|
|
14
|
+
position?: ComputedRef<RsTabsPosition>;
|
|
14
15
|
}
|
|
15
16
|
export declare function useRsTabsNav(options: UseRsTabsNavOptions): {
|
|
16
17
|
navViewportRef: Ref<HTMLElement | null, HTMLElement | null>;
|
|
@@ -29,5 +30,6 @@ export declare function useRsTabsNav(options: UseRsTabsNavOptions): {
|
|
|
29
30
|
scrollNav: (direction: -1 | 1) => void;
|
|
30
31
|
onNavScroll: () => void;
|
|
31
32
|
scheduleLayout: () => void;
|
|
33
|
+
axis: ComputedRef<"x" | "y">;
|
|
32
34
|
};
|
|
33
35
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { resolveVisibleTabValues } from "../components/tabs/src/tabs-utils.js";
|
|
1
|
+
import { isVerticalTabsPosition, resolveVisibleTabValues } from "../components/tabs/src/tabs-utils.js";
|
|
2
2
|
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from "vue";
|
|
3
3
|
//#region src/composables/useRsTabsNav.ts
|
|
4
4
|
function useRsTabsNav(options) {
|
|
@@ -8,6 +8,10 @@ function useRsTabsNav(options) {
|
|
|
8
8
|
const canScrollPrev = ref(false);
|
|
9
9
|
const canScrollNext = ref(false);
|
|
10
10
|
let resizeObserver = null;
|
|
11
|
+
let disposed = false;
|
|
12
|
+
let layoutRaf = 0;
|
|
13
|
+
let boundViewport = null;
|
|
14
|
+
const axis = computed(() => isVerticalTabsPosition(options.position?.value ?? "top") ? "y" : "x");
|
|
11
15
|
const useDropdownOverflow = computed(() => options.overflow.value === "dropdown");
|
|
12
16
|
const useScrollOverflow = computed(() => options.overflow.value === "scroll");
|
|
13
17
|
const visibleTabItems = computed(() => options.items.value.filter((item) => visibleValues.value.has(item.value)));
|
|
@@ -18,13 +22,16 @@ function useRsTabsNav(options) {
|
|
|
18
22
|
})));
|
|
19
23
|
const activeInHidden = computed(() => hiddenItems.value.some((item) => item.value === options.activeValue.value));
|
|
20
24
|
const showOverflowMenu = computed(() => useDropdownOverflow.value && hiddenItems.value.length > 0);
|
|
25
|
+
function measureAlongAxis(node) {
|
|
26
|
+
return axis.value === "y" ? node.offsetHeight : node.offsetWidth;
|
|
27
|
+
}
|
|
21
28
|
function measureTriggerWidths() {
|
|
22
29
|
const measureRoot = options.measureRef.value;
|
|
23
30
|
if (measureRoot) {
|
|
24
31
|
const next = /* @__PURE__ */ new Map();
|
|
25
32
|
for (const node of measureRoot.querySelectorAll("[data-tab-value]")) {
|
|
26
33
|
const value = node.dataset.tabValue;
|
|
27
|
-
if (value) next.set(value, node
|
|
34
|
+
if (value) next.set(value, measureAlongAxis(node));
|
|
28
35
|
}
|
|
29
36
|
if (next.size > 0) return next;
|
|
30
37
|
}
|
|
@@ -33,16 +40,21 @@ function useRsTabsNav(options) {
|
|
|
33
40
|
if (!viewport) return next;
|
|
34
41
|
for (const trigger of viewport.querySelectorAll(".rs-tabs__trigger[data-tab-value]")) {
|
|
35
42
|
const value = trigger.dataset.tabValue;
|
|
36
|
-
if (value) next.set(value, trigger
|
|
43
|
+
if (value) next.set(value, measureAlongAxis(trigger));
|
|
37
44
|
}
|
|
38
45
|
return next;
|
|
39
46
|
}
|
|
40
|
-
function
|
|
41
|
-
let
|
|
42
|
-
if (useDropdownOverflow.value && options.items.value.length > 1)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
function reservedSize() {
|
|
48
|
+
let size = 0;
|
|
49
|
+
if (useDropdownOverflow.value && options.items.value.length > 1) {
|
|
50
|
+
const overflowNode = options.overflowRef.value;
|
|
51
|
+
const overflowFallback = axis.value === "y" ? 36 : 76;
|
|
52
|
+
size += overflowNode ? measureAlongAxis(overflowNode) : overflowFallback;
|
|
53
|
+
}
|
|
54
|
+
if (options.canAdd.value) size += options.addButtonWidth;
|
|
55
|
+
const extra = options.extraRef?.value;
|
|
56
|
+
if (extra) size += measureAlongAxis(extra);
|
|
57
|
+
return size;
|
|
46
58
|
}
|
|
47
59
|
function recomputeVisibleTabs() {
|
|
48
60
|
if (!useDropdownOverflow.value) {
|
|
@@ -52,8 +64,8 @@ function useRsTabsNav(options) {
|
|
|
52
64
|
const nav = options.navRef.value;
|
|
53
65
|
if (!nav) return;
|
|
54
66
|
triggerWidths.value = measureTriggerWidths();
|
|
55
|
-
const
|
|
56
|
-
visibleValues.value = resolveVisibleTabValues(options.items.value, triggerWidths.value,
|
|
67
|
+
const available = axis.value === "y" ? nav.clientHeight : nav.clientWidth;
|
|
68
|
+
visibleValues.value = resolveVisibleTabValues(options.items.value, triggerWidths.value, available, options.activeValue.value, reservedSize(), { keepActiveVisible: false });
|
|
57
69
|
}
|
|
58
70
|
function updateScrollButtons() {
|
|
59
71
|
const viewport = navViewportRef.value;
|
|
@@ -62,39 +74,87 @@ function useRsTabsNav(options) {
|
|
|
62
74
|
canScrollNext.value = false;
|
|
63
75
|
return;
|
|
64
76
|
}
|
|
77
|
+
if (axis.value === "y") {
|
|
78
|
+
canScrollPrev.value = viewport.scrollTop > 1;
|
|
79
|
+
canScrollNext.value = viewport.scrollTop + viewport.clientHeight < viewport.scrollHeight - 1;
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
65
82
|
canScrollPrev.value = viewport.scrollLeft > 1;
|
|
66
83
|
canScrollNext.value = viewport.scrollLeft + viewport.clientWidth < viewport.scrollWidth - 1;
|
|
67
84
|
}
|
|
68
85
|
function scrollNav(direction) {
|
|
69
|
-
navViewportRef.value
|
|
70
|
-
|
|
86
|
+
const viewport = navViewportRef.value;
|
|
87
|
+
if (!viewport) return;
|
|
88
|
+
const delta = direction * 180;
|
|
89
|
+
if (axis.value === "y") {
|
|
90
|
+
viewport.scrollBy({
|
|
91
|
+
top: delta,
|
|
92
|
+
behavior: "smooth"
|
|
93
|
+
});
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
viewport.scrollBy({
|
|
97
|
+
left: delta,
|
|
71
98
|
behavior: "smooth"
|
|
72
99
|
});
|
|
73
100
|
}
|
|
74
101
|
function onNavScroll() {
|
|
75
102
|
updateScrollButtons();
|
|
76
103
|
}
|
|
104
|
+
function scrollElementIntoView(el, viewport) {
|
|
105
|
+
if (axis.value === "y") {
|
|
106
|
+
const top = el.offsetTop;
|
|
107
|
+
const bottom = top + el.offsetHeight;
|
|
108
|
+
if (top < viewport.scrollTop) viewport.scrollTop = top;
|
|
109
|
+
else if (bottom > viewport.scrollTop + viewport.clientHeight) viewport.scrollTop = bottom - viewport.clientHeight;
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const left = el.offsetLeft;
|
|
113
|
+
const right = left + el.offsetWidth;
|
|
114
|
+
if (left < viewport.scrollLeft) viewport.scrollLeft = left;
|
|
115
|
+
else if (right > viewport.scrollLeft + viewport.clientWidth) viewport.scrollLeft = right - viewport.clientWidth;
|
|
116
|
+
}
|
|
77
117
|
async function scrollActiveTabIntoView() {
|
|
78
118
|
if (!useScrollOverflow.value) return;
|
|
79
119
|
await nextTick();
|
|
120
|
+
if (disposed) return;
|
|
80
121
|
const viewport = navViewportRef.value;
|
|
81
122
|
if (!viewport) return;
|
|
82
|
-
viewport.querySelector(`.rs-tabs__trigger[data-state='active']`)
|
|
83
|
-
|
|
84
|
-
block: "nearest",
|
|
85
|
-
behavior: "smooth"
|
|
86
|
-
});
|
|
123
|
+
const active = viewport.querySelector(`.rs-tabs__trigger[data-state='active']`);
|
|
124
|
+
if (active) scrollElementIntoView(active, viewport);
|
|
87
125
|
updateScrollButtons();
|
|
88
126
|
}
|
|
127
|
+
function onNavWheel(event) {
|
|
128
|
+
if (disposed || !useScrollOverflow.value || axis.value === "y") return;
|
|
129
|
+
const viewport = navViewportRef.value;
|
|
130
|
+
if (!viewport) return;
|
|
131
|
+
if (Math.abs(event.deltaY) <= Math.abs(event.deltaX)) return;
|
|
132
|
+
if (viewport.scrollWidth <= viewport.clientWidth) return;
|
|
133
|
+
event.preventDefault();
|
|
134
|
+
viewport.scrollLeft += event.deltaY;
|
|
135
|
+
onNavScroll();
|
|
136
|
+
}
|
|
137
|
+
function unbindWheel() {
|
|
138
|
+
if (!boundViewport) return;
|
|
139
|
+
boundViewport.removeEventListener("wheel", onNavWheel);
|
|
140
|
+
boundViewport = null;
|
|
141
|
+
}
|
|
142
|
+
function bindWheel() {
|
|
143
|
+
const viewport = navViewportRef.value;
|
|
144
|
+
unbindWheel();
|
|
145
|
+
if (!viewport || !useScrollOverflow.value || axis.value === "y") return;
|
|
146
|
+
viewport.addEventListener("wheel", onNavWheel, { passive: false });
|
|
147
|
+
boundViewport = viewport;
|
|
148
|
+
}
|
|
89
149
|
function scheduleLayout() {
|
|
90
|
-
|
|
150
|
+
if (disposed) return;
|
|
151
|
+
if (layoutRaf) cancelAnimationFrame(layoutRaf);
|
|
152
|
+
layoutRaf = requestAnimationFrame(() => {
|
|
153
|
+
layoutRaf = 0;
|
|
154
|
+
if (disposed) return;
|
|
91
155
|
recomputeVisibleTabs();
|
|
92
156
|
updateScrollButtons();
|
|
93
|
-
|
|
94
|
-
nextTick(() => {
|
|
95
|
-
recomputeVisibleTabs();
|
|
96
|
-
updateScrollButtons();
|
|
97
|
-
});
|
|
157
|
+
bindWheel();
|
|
98
158
|
});
|
|
99
159
|
}
|
|
100
160
|
onMounted(() => {
|
|
@@ -105,18 +165,25 @@ function useRsTabsNav(options) {
|
|
|
105
165
|
resizeObserver.observe(nav);
|
|
106
166
|
});
|
|
107
167
|
onUnmounted(() => {
|
|
168
|
+
disposed = true;
|
|
169
|
+
if (layoutRaf) cancelAnimationFrame(layoutRaf);
|
|
170
|
+
layoutRaf = 0;
|
|
171
|
+
unbindWheel();
|
|
108
172
|
resizeObserver?.disconnect();
|
|
109
173
|
resizeObserver = null;
|
|
110
174
|
});
|
|
111
175
|
watch(() => [
|
|
112
|
-
options.items.value,
|
|
176
|
+
options.items.value.map((item) => item.value).join("\0"),
|
|
177
|
+
options.items.value.map((item) => `${item.label}\0${item.icon ?? ""}\0${item.badge ?? ""}`).join("\n"),
|
|
113
178
|
options.overflow.value,
|
|
114
|
-
options.canAdd.value
|
|
115
|
-
|
|
179
|
+
options.canAdd.value,
|
|
180
|
+
axis.value
|
|
181
|
+
].join("\n"), () => scheduleLayout());
|
|
116
182
|
watch(options.activeValue, () => {
|
|
117
183
|
scheduleLayout();
|
|
118
184
|
scrollActiveTabIntoView();
|
|
119
185
|
});
|
|
186
|
+
watch(navViewportRef, () => bindWheel());
|
|
120
187
|
return {
|
|
121
188
|
navViewportRef,
|
|
122
189
|
useDropdownOverflow,
|
|
@@ -130,7 +197,8 @@ function useRsTabsNav(options) {
|
|
|
130
197
|
canScrollNext,
|
|
131
198
|
scrollNav,
|
|
132
199
|
onNavScroll,
|
|
133
|
-
scheduleLayout
|
|
200
|
+
scheduleLayout,
|
|
201
|
+
axis
|
|
134
202
|
};
|
|
135
203
|
}
|
|
136
204
|
//#endregion
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export type {
|
|
3
|
-
export type RsToastInput = string | {
|
|
4
|
-
title: string;
|
|
5
|
-
description?: string;
|
|
6
|
-
position?: RsToastPosition;
|
|
7
|
-
duration?: number;
|
|
8
|
-
};
|
|
1
|
+
import { type RsToastInput, type RsToastKind, type RsToastOptions, type RsToastPromiseMessages, type RsToastAction } from '../components/toaster/src/toast-utils';
|
|
2
|
+
export type { RsToastAction, RsToastInput, RsToastKind, RsToastOptions, RsToastPromiseMessages, };
|
|
9
3
|
export declare function useRsToast(): {
|
|
10
|
-
success: (input: RsToastInput) =>
|
|
11
|
-
error: (input: RsToastInput) =>
|
|
12
|
-
info: (input: RsToastInput) =>
|
|
13
|
-
warning: (input: RsToastInput) =>
|
|
14
|
-
|
|
4
|
+
success: (input: RsToastInput) => string;
|
|
5
|
+
error: (input: RsToastInput) => string;
|
|
6
|
+
info: (input: RsToastInput) => string;
|
|
7
|
+
warning: (input: RsToastInput) => string;
|
|
8
|
+
message: (input: RsToastInput) => string;
|
|
9
|
+
loading: (input: RsToastInput) => string;
|
|
10
|
+
promise: <T>(task: Promise<T> | (() => Promise<T>), data: RsToastPromiseMessages<T>) => string;
|
|
11
|
+
update: (id: string, input: RsToastInput, type?: RsToastKind) => void;
|
|
12
|
+
dismiss: (id?: string | number) => void;
|
|
15
13
|
};
|
|
@@ -1,29 +1,78 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolveRsMessage } from "../locale/registry.js";
|
|
2
|
+
import { rsConfigKey } from "./useRsConfig.js";
|
|
3
|
+
import { readDocumentLocale } from "../locale/apply.js";
|
|
4
|
+
import { errorToastText, normalizePromiseMessage, normalizeRsToastInput } from "../components/toaster/src/toast-utils.js";
|
|
5
|
+
import { dismissRsToast, pushRsToast, rsToasts } from "../components/toaster/src/toast-store.js";
|
|
6
|
+
import { getCurrentInstance, inject } from "vue";
|
|
2
7
|
//#region src/composables/useRsToast.ts
|
|
3
|
-
function
|
|
4
|
-
|
|
5
|
-
return
|
|
8
|
+
function show(type, input, duration) {
|
|
9
|
+
const payload = normalizeRsToastInput(input);
|
|
10
|
+
return pushRsToast({
|
|
11
|
+
...payload,
|
|
12
|
+
type,
|
|
13
|
+
duration: duration ?? payload.duration
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
/** 在 setup 里跟 ConfigProvider;在 setup 外跟 document / 本机语言。回调里不再调用 inject。 */
|
|
17
|
+
function createToastTranslator() {
|
|
18
|
+
const config = getCurrentInstance() ? inject(rsConfigKey, null) : null;
|
|
19
|
+
return (key) => resolveRsMessage(config?.locale.value ?? readDocumentLocale(), key) ?? key;
|
|
6
20
|
}
|
|
7
21
|
function useRsToast() {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
const t = createToastTranslator();
|
|
23
|
+
function update(id, input, type) {
|
|
24
|
+
const current = rsToasts.value.find((item) => item.id === id);
|
|
25
|
+
if (!current) return;
|
|
26
|
+
const payload = normalizeRsToastInput(input);
|
|
27
|
+
const typeChanged = type != null && type !== current.type;
|
|
28
|
+
pushRsToast({
|
|
29
|
+
type: type ?? current.type,
|
|
30
|
+
title: payload.title,
|
|
31
|
+
description: payload.description ?? current.description,
|
|
32
|
+
position: payload.position ?? current.position,
|
|
33
|
+
duration: payload.duration ?? (typeChanged && type !== "loading" ? void 0 : current.duration),
|
|
34
|
+
id,
|
|
35
|
+
toasterId: payload.toasterId ?? current.toasterId,
|
|
36
|
+
dismissible: payload.dismissible ?? current.dismissible,
|
|
37
|
+
closeButton: payload.closeButton ?? current.closeButton,
|
|
38
|
+
richColors: payload.richColors ?? current.richColors,
|
|
39
|
+
action: payload.action ?? current.action,
|
|
40
|
+
cancel: payload.cancel ?? current.cancel,
|
|
41
|
+
onDismiss: payload.onDismiss ?? current.onDismiss,
|
|
42
|
+
onAutoClose: payload.onAutoClose ?? current.onAutoClose
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function promise(task, data) {
|
|
46
|
+
const loading = normalizeRsToastInput(data.loading);
|
|
47
|
+
const id = pushRsToast({
|
|
48
|
+
...loading,
|
|
49
|
+
type: "loading",
|
|
50
|
+
duration: loading.duration ?? Number.POSITIVE_INFINITY,
|
|
51
|
+
id: data.id ?? loading.id,
|
|
52
|
+
toasterId: data.toasterId ?? loading.toasterId
|
|
53
|
+
});
|
|
54
|
+
const run = typeof task === "function" ? task() : task;
|
|
55
|
+
Promise.resolve(run).then((value) => {
|
|
56
|
+
const next = normalizePromiseMessage(data.success, value) ?? { title: t("toaster.done") };
|
|
57
|
+
update(id, next, "success");
|
|
58
|
+
}, (error) => {
|
|
59
|
+
const next = normalizePromiseMessage(data.error, error) ?? { title: errorToastText(error) || t("toaster.failed") };
|
|
60
|
+
update(id, next, "error");
|
|
61
|
+
});
|
|
62
|
+
return id;
|
|
20
63
|
}
|
|
21
64
|
return {
|
|
22
65
|
success: (input) => show("success", input),
|
|
23
66
|
error: (input) => show("error", input),
|
|
24
67
|
info: (input) => show("info", input),
|
|
25
68
|
warning: (input) => show("warning", input),
|
|
26
|
-
|
|
69
|
+
message: (input) => show("default", input),
|
|
70
|
+
loading: (input) => show("loading", input, normalizeRsToastInput(input).duration ?? Number.POSITIVE_INFINITY),
|
|
71
|
+
promise,
|
|
72
|
+
update,
|
|
73
|
+
dismiss: (id) => {
|
|
74
|
+
dismissRsToast(id == null || id === "" ? void 0 : String(id));
|
|
75
|
+
}
|
|
27
76
|
};
|
|
28
77
|
}
|
|
29
78
|
//#endregion
|