niuma-ui 2.0.4 → 2.1.0
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 +67 -0
- package/NOTICE +0 -1
- package/README.md +3 -3
- package/README.zh-CN.md +3 -3
- 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/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/auto-complete/src/RsAutoComplete.d.ts +1 -1
- package/dist/components/button/src/RsButton.css +75 -72
- package/dist/components/button/src/RsButton.d.ts +1 -4
- package/dist/components/button/src/RsButton.impl.js +3 -7
- package/dist/components/button/src/RsButton.js +1 -1
- package/dist/components/card/src/RsCard.d.ts +1 -1
- 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/config-provider/src/RsConfigProvider.css +1 -1
- package/dist/components/config-provider/src/RsConfigProvider.d.ts +2 -2
- package/dist/components/config-provider/src/RsConfigProvider.impl.js +7 -16
- package/dist/components/config-provider/src/RsConfigProvider.js +1 -1
- 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/src/RsDatePicker.d.ts +2 -2
- package/dist/components/date-picker/src/RsDateTimePicker.d.ts +2 -2
- 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/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/form/src/RsForm.d.ts +1 -1
- package/dist/components/input-number/src/RsInputNumber.d.ts +1 -1
- package/dist/components/label/src/RsLabel.d.ts +1 -1
- 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 +52 -2
- 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/src/RsMentions.d.ts +2 -2
- 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/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/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/RsTableCell.impl.js +1 -1
- 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 +86 -28
- 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.d.ts +1 -1
- package/dist/components/time-picker/src/RsTimePicker.d.ts +2 -2
- package/dist/components/toaster/src/RsToaster.css +156 -203
- package/dist/components/toaster/src/RsToaster.d.ts +32 -2
- 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 +38 -16
- 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 +20 -20
- 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/src/RsTreeSelect.d.ts +1 -1
- 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 +30 -21
- package/dist/index.js +14 -0
- package/dist/locale/apply.js +6 -1
- package/dist/locale/messages.js +128 -2
- package/dist/styles.css +465 -808
- package/dist/theme/brand.example.css +3 -2
- package/dist/vite-plugins/niuma-ui-host.js +1 -1
- package/package.json +2 -5
- package/dist/components/_shared/src/reka.d.ts +0 -2
- package/dist/components/_shared/src/reka.js +0 -2
|
@@ -1,16 +1,30 @@
|
|
|
1
|
+
import { useRsConfigOptional } from "../../../composables/useRsConfig.js";
|
|
2
|
+
import { resolveDirMode } from "../../../locale/apply.js";
|
|
1
3
|
import { useRsI18n } from "../../../composables/useRsI18n.js";
|
|
2
4
|
import RsIcon_default from "../../icon/src/RsIcon.js";
|
|
5
|
+
import { useRsFormContext } from "../../form/src/form-utils.js";
|
|
6
|
+
import { useResolvedRsComponentSize } from "../../_shared/src/resolve-size.js";
|
|
3
7
|
import RsEmpty_default from "../../empty/src/RsEmpty.js";
|
|
4
|
-
import { buildTreeNodeIndex, collectExpandableKeys, collectHalfCheckedKeys, filterTreeNodes, flattenVisibleTreeNodes, getTreeChildren, getTreeKey, getTreeLabel, hasTreeChildren, isTreeAncestorKey, isTreeCheckboxDisabled, isTreeNodeDisabled, isTreeNodeLoading, resolveAccordionExpandedKeys, resolveTreeCheckState, resolveTreeFieldNames, resolveTreeFocusKey, resolveTreeIndent, resolveTreeRowHeight, resolveTreeVirtualEnabled, shouldShowTreeCheckbox, sliceVirtualTreeNodes, splitTreeLabelHighlight, toggleTreeCheck } from "./tree-utils.js";
|
|
8
|
+
import { buildTreeNodeIndex, collectExpandableKeys, collectHalfCheckedKeys, filterTreeNodes, flattenVisibleTreeNodes, getTreeChildren, getTreeKey, getTreeLabel, hasTreeChildren, isTreeAncestorKey, isTreeCheckboxDisabled, isTreeNodeDisabled, isTreeNodeLoading, resolveAccordionExpandedKeys, resolveTreeCheckState, resolveTreeFieldNames, resolveTreeFocusKey, resolveTreeIndent, resolveTreeRowHeight, resolveTreeTypeaheadKey, resolveTreeVirtualEnabled, shouldShowTreeCheckbox, sliceVirtualTreeNodes, splitTreeLabelHighlight, toggleTreeCheck } from "./tree-utils.js";
|
|
5
9
|
import { isVirtualListFillHeight, parseVirtualListHeightPx, resolveVirtualListHeight } from "../../virtual-list/src/virtual-list-utils.js";
|
|
6
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, nextTick, normalizeClass, normalizeStyle, onMounted, onUnmounted, openBlock, ref, renderList, renderSlot, toDisplayString, unref, useModel, vShow, watch, withDirectives, withModifiers } from "vue";
|
|
10
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, nextTick, normalizeClass, normalizeStyle, onMounted, onUnmounted, openBlock, ref, renderList, renderSlot, toDisplayString, unref, useId, useModel, vShow, watch, withDirectives, withModifiers } from "vue";
|
|
7
11
|
//#region src/components/tree/src/RsTree.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
-
var _hoisted_1 = [
|
|
12
|
+
var _hoisted_1 = [
|
|
13
|
+
"id",
|
|
14
|
+
"tabindex",
|
|
15
|
+
"aria-label",
|
|
16
|
+
"aria-disabled",
|
|
17
|
+
"aria-multiselectable",
|
|
18
|
+
"aria-activedescendant"
|
|
19
|
+
];
|
|
9
20
|
var _hoisted_2 = { class: "rs-tree__list" };
|
|
10
21
|
var _hoisted_3 = [
|
|
11
|
-
"
|
|
22
|
+
"id",
|
|
12
23
|
"aria-expanded",
|
|
13
24
|
"aria-selected",
|
|
25
|
+
"aria-checked",
|
|
26
|
+
"aria-disabled",
|
|
27
|
+
"aria-busy",
|
|
14
28
|
"aria-level",
|
|
15
29
|
"aria-setsize",
|
|
16
30
|
"aria-posinset",
|
|
@@ -28,7 +42,7 @@ var _hoisted_4 = {
|
|
|
28
42
|
class: "rs-tree__lines",
|
|
29
43
|
"aria-hidden": "true"
|
|
30
44
|
};
|
|
31
|
-
var _hoisted_5 = ["
|
|
45
|
+
var _hoisted_5 = ["title"];
|
|
32
46
|
var _hoisted_6 = [
|
|
33
47
|
"aria-label",
|
|
34
48
|
"aria-expanded",
|
|
@@ -47,6 +61,7 @@ var _hoisted_8 = {
|
|
|
47
61
|
};
|
|
48
62
|
var _hoisted_9 = [
|
|
49
63
|
"checked",
|
|
64
|
+
"indeterminate",
|
|
50
65
|
"disabled",
|
|
51
66
|
"aria-label",
|
|
52
67
|
"onChange"
|
|
@@ -73,7 +88,13 @@ var RsTree_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
73
88
|
props: /*@__PURE__*/ mergeModels({
|
|
74
89
|
nodes: {},
|
|
75
90
|
fieldNames: {},
|
|
76
|
-
size: {
|
|
91
|
+
size: {},
|
|
92
|
+
id: {},
|
|
93
|
+
ariaLabel: {},
|
|
94
|
+
disabled: {
|
|
95
|
+
type: Boolean,
|
|
96
|
+
default: false
|
|
97
|
+
},
|
|
77
98
|
multiple: {
|
|
78
99
|
type: Boolean,
|
|
79
100
|
default: false
|
|
@@ -180,25 +201,57 @@ var RsTree_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
180
201
|
const props = __props;
|
|
181
202
|
const emit = __emit;
|
|
182
203
|
const { t } = useRsI18n();
|
|
204
|
+
const formContext = useRsFormContext();
|
|
205
|
+
const config = useRsConfigOptional();
|
|
206
|
+
const uid = useId();
|
|
207
|
+
const resolvedSize = useResolvedRsComponentSize(() => props.size);
|
|
208
|
+
const treeDisabled = computed(() => props.disabled || Boolean(formContext?.disabled.value));
|
|
209
|
+
const rootId = computed(() => props.id || uid);
|
|
210
|
+
const treeLabel = computed(() => props.ariaLabel || t("tree.label"));
|
|
183
211
|
const fields = computed(() => resolveTreeFieldNames(props.fieldNames));
|
|
184
|
-
const rowHeight = computed(() => resolveTreeRowHeight(
|
|
212
|
+
const rowHeight = computed(() => resolveTreeRowHeight(resolvedSize.value, props.itemHeight));
|
|
185
213
|
const indentPx = computed(() => resolveTreeIndent(props.size));
|
|
186
214
|
const rootKeys = computed(() => props.nodes.map((node) => getTreeKey(node, fields.value)));
|
|
187
215
|
const treeRootRef = ref(null);
|
|
188
216
|
const _measuredHeight = ref(0);
|
|
189
217
|
let _heightObs = null;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
218
|
+
let alive = true;
|
|
219
|
+
let typeaheadQuery = "";
|
|
220
|
+
let typeaheadTimer = null;
|
|
221
|
+
function needsHeightObserver() {
|
|
222
|
+
if (!props.virtual || !treeRootRef.value) return false;
|
|
223
|
+
if (props.height !== void 0 && !isVirtualListFillHeight(props.height)) return false;
|
|
224
|
+
return typeof ResizeObserver !== "undefined";
|
|
225
|
+
}
|
|
226
|
+
function syncHeightObserver() {
|
|
227
|
+
_heightObs?.disconnect();
|
|
228
|
+
_heightObs = null;
|
|
229
|
+
if (!needsHeightObserver() || !treeRootRef.value) return;
|
|
230
|
+
const target = treeRootRef.value;
|
|
193
231
|
_heightObs = new ResizeObserver((entries) => {
|
|
232
|
+
if (!alive) return;
|
|
194
233
|
_measuredHeight.value = entries[0]?.contentRect.height ?? 0;
|
|
195
234
|
});
|
|
196
|
-
_heightObs.observe(
|
|
197
|
-
_measuredHeight.value =
|
|
235
|
+
_heightObs.observe(target);
|
|
236
|
+
_measuredHeight.value = target.clientHeight;
|
|
237
|
+
}
|
|
238
|
+
onMounted(() => {
|
|
239
|
+
syncHeightObserver();
|
|
240
|
+
});
|
|
241
|
+
watch(() => [props.virtual, props.height], () => {
|
|
242
|
+
nextTick(() => {
|
|
243
|
+
if (!alive) return;
|
|
244
|
+
syncHeightObserver();
|
|
245
|
+
});
|
|
198
246
|
});
|
|
199
247
|
onUnmounted(() => {
|
|
248
|
+
alive = false;
|
|
200
249
|
_heightObs?.disconnect();
|
|
201
250
|
_heightObs = null;
|
|
251
|
+
if (typeaheadTimer != null) clearTimeout(typeaheadTimer);
|
|
252
|
+
typeaheadTimer = null;
|
|
253
|
+
typeaheadQuery = "";
|
|
254
|
+
rowRefs.value.clear();
|
|
202
255
|
});
|
|
203
256
|
const expandedKeysInternal = ref(props.defaultExpandAll ? collectExpandableKeys(props.nodes, fields.value, props.lazy) : [...props.defaultExpandedKeys]);
|
|
204
257
|
/** 进入过滤前的展开快照;清空过滤时还原,避免无匹配时被清空后无法恢复 */
|
|
@@ -325,6 +378,7 @@ var RsTree_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
325
378
|
}
|
|
326
379
|
if (previousKeyword === void 0) return;
|
|
327
380
|
nextTick(() => {
|
|
381
|
+
if (!alive) return;
|
|
328
382
|
resetViewportScroll();
|
|
329
383
|
});
|
|
330
384
|
}, { immediate: true });
|
|
@@ -332,12 +386,14 @@ var RsTree_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
332
386
|
if (nodes.length === 0) {
|
|
333
387
|
focusedKey.value = null;
|
|
334
388
|
nextTick(() => {
|
|
389
|
+
if (!alive) return;
|
|
335
390
|
clampViewportScroll();
|
|
336
391
|
});
|
|
337
392
|
return;
|
|
338
393
|
}
|
|
339
394
|
if (!focusedKey.value || !nodes.some((item) => item.key === focusedKey.value)) focusedKey.value = nodes[0]?.key ?? null;
|
|
340
395
|
nextTick(() => {
|
|
396
|
+
if (!alive) return;
|
|
341
397
|
clampViewportScroll();
|
|
342
398
|
});
|
|
343
399
|
}, { immediate: true });
|
|
@@ -349,9 +405,65 @@ var RsTree_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
349
405
|
if (element instanceof HTMLElement) rowRefs.value.set(key, element);
|
|
350
406
|
else rowRefs.value.delete(key);
|
|
351
407
|
}
|
|
408
|
+
function pruneRowRefs(nodes) {
|
|
409
|
+
const live = new Set(nodes.map((item) => item.key));
|
|
410
|
+
for (const key of rowRefs.value.keys()) if (!live.has(key)) rowRefs.value.delete(key);
|
|
411
|
+
}
|
|
412
|
+
watch(visibleFlatNodes, (nodes) => {
|
|
413
|
+
pruneRowRefs(nodes);
|
|
414
|
+
});
|
|
415
|
+
function itemDomId(key) {
|
|
416
|
+
return `${rootId.value}-item-${encodeURIComponent(key).replace(/%/g, "_")}`;
|
|
417
|
+
}
|
|
418
|
+
function isRtlHost() {
|
|
419
|
+
if (config) return resolveDirMode(config.dir.value, config.locale.value) === "rtl";
|
|
420
|
+
const dir = treeRootRef.value?.closest("[dir]")?.getAttribute("dir");
|
|
421
|
+
if (dir === "rtl") return true;
|
|
422
|
+
if (dir === "ltr") return false;
|
|
423
|
+
if (treeRootRef.value && typeof getComputedStyle === "function") return getComputedStyle(treeRootRef.value).direction === "rtl";
|
|
424
|
+
return false;
|
|
425
|
+
}
|
|
426
|
+
function scrollKeyIntoView(key) {
|
|
427
|
+
const index = flatNodes.value.findIndex((item) => item.key === key);
|
|
428
|
+
if (index < 0) return;
|
|
429
|
+
if (useVirtualScroll.value) {
|
|
430
|
+
const top = index * rowHeight.value;
|
|
431
|
+
const view = viewportHeightPx.value;
|
|
432
|
+
const current = scrollTop.value;
|
|
433
|
+
let next = current;
|
|
434
|
+
if (top < current) next = top;
|
|
435
|
+
else if (top + rowHeight.value > current + view) next = Math.max(0, top + rowHeight.value - view);
|
|
436
|
+
if (next !== current) {
|
|
437
|
+
scrollTop.value = next;
|
|
438
|
+
const el = viewportRef.value;
|
|
439
|
+
if (el && el.scrollTop !== next) el.scrollTop = next;
|
|
440
|
+
}
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
rowRefs.value.get(key)?.scrollIntoView?.({ block: "nearest" });
|
|
444
|
+
}
|
|
352
445
|
async function scrollFocusedIntoView(key) {
|
|
353
446
|
await nextTick();
|
|
354
|
-
|
|
447
|
+
if (!alive) return;
|
|
448
|
+
scrollKeyIntoView(key);
|
|
449
|
+
}
|
|
450
|
+
function revealAncestors(key) {
|
|
451
|
+
const index = nodeIndex.value;
|
|
452
|
+
if (!index.has(key)) return;
|
|
453
|
+
const chain = [];
|
|
454
|
+
let parent = index.get(key)?.parentKey ?? null;
|
|
455
|
+
while (parent) {
|
|
456
|
+
chain.push(parent);
|
|
457
|
+
parent = index.get(parent)?.parentKey ?? null;
|
|
458
|
+
}
|
|
459
|
+
if (chain.length === 0) return;
|
|
460
|
+
const next = new Set(expandedKeys.value);
|
|
461
|
+
let changed = false;
|
|
462
|
+
for (const id of chain) if (!next.has(id)) {
|
|
463
|
+
next.add(id);
|
|
464
|
+
changed = true;
|
|
465
|
+
}
|
|
466
|
+
if (changed) expandedKeys.value = [...next];
|
|
355
467
|
}
|
|
356
468
|
function setExpanded(key, expanded) {
|
|
357
469
|
let next = [...expandedKeys.value];
|
|
@@ -365,6 +477,7 @@ var RsTree_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
365
477
|
emit("expand", key, expanded);
|
|
366
478
|
}
|
|
367
479
|
async function toggleExpanded(node, key) {
|
|
480
|
+
if (treeDisabled.value) return;
|
|
368
481
|
if (expandedSet.value.has(key)) {
|
|
369
482
|
setExpanded(key, false);
|
|
370
483
|
return;
|
|
@@ -376,15 +489,17 @@ var RsTree_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
376
489
|
try {
|
|
377
490
|
await props.loadData(node, key);
|
|
378
491
|
} finally {
|
|
492
|
+
if (!alive) return;
|
|
379
493
|
const doneLoading = new Set(loadingKeys.value);
|
|
380
494
|
doneLoading.delete(key);
|
|
381
495
|
loadingKeys.value = doneLoading;
|
|
382
496
|
}
|
|
383
497
|
}
|
|
498
|
+
if (!alive) return;
|
|
384
499
|
setExpanded(key, true);
|
|
385
500
|
}
|
|
386
501
|
function selectNode(node, key) {
|
|
387
|
-
if (!props.selectable || isTreeNodeDisabled(node, fields.value)) return;
|
|
502
|
+
if (treeDisabled.value || !props.selectable || isTreeNodeDisabled(node, fields.value)) return;
|
|
388
503
|
if (props.multiple) {
|
|
389
504
|
const next = new Set(selectedSet.value);
|
|
390
505
|
if (next.has(key)) next.delete(key);
|
|
@@ -395,12 +510,13 @@ var RsTree_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
395
510
|
model.value = key;
|
|
396
511
|
}
|
|
397
512
|
function toggleCheck(node, key) {
|
|
398
|
-
if (isTreeCheckboxDisabled(node, fields.value, checkboxOptions())) return;
|
|
513
|
+
if (treeDisabled.value || isTreeCheckboxDisabled(node, fields.value, checkboxOptions())) return;
|
|
399
514
|
const next = toggleTreeCheck(key, checkedSet.value, nodeIndex.value, props.checkStrictly, props.onlyCheckLeaf);
|
|
400
515
|
checkedKeys.value = next;
|
|
401
516
|
emit("check", next, halfCheckedKeys.value, node, key);
|
|
402
517
|
}
|
|
403
518
|
function handleNodeAction(node, key) {
|
|
519
|
+
if (treeDisabled.value) return;
|
|
404
520
|
emit("node-click", node, key);
|
|
405
521
|
focusedKey.value = key;
|
|
406
522
|
if (props.checkable && props.checkOnClickNode) {
|
|
@@ -418,6 +534,7 @@ var RsTree_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
418
534
|
handleNodeAction(node, key);
|
|
419
535
|
}
|
|
420
536
|
function handleRowDblclick(node, key, event) {
|
|
537
|
+
if (treeDisabled.value) return;
|
|
421
538
|
if (event.target.closest(".rs-tree__toggle, .rs-tree__checkbox, .rs-tree__drag-handle")) return;
|
|
422
539
|
emit("node-dblclick", node, key);
|
|
423
540
|
}
|
|
@@ -425,10 +542,26 @@ var RsTree_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
425
542
|
event.stopPropagation();
|
|
426
543
|
handleNodeAction(node, key);
|
|
427
544
|
}
|
|
428
|
-
/**
|
|
545
|
+
/**
|
|
546
|
+
* 只给当前可见行算勾选态,模板里多次读取走 Map。
|
|
547
|
+
* 没有勾选项时不建索引。
|
|
548
|
+
*/
|
|
549
|
+
const checkStateMap = computed(() => {
|
|
550
|
+
const map = /* @__PURE__ */ new Map();
|
|
551
|
+
if (!props.checkable || checkedSet.value.size === 0) return map;
|
|
552
|
+
const index = nodeIndex.value;
|
|
553
|
+
for (const entry of visibleFlatNodes.value) map.set(entry.key, resolveTreeCheckState(entry.key, checkedSet.value, index, props.checkStrictly, props.onlyCheckLeaf));
|
|
554
|
+
return map;
|
|
555
|
+
});
|
|
429
556
|
function checkStateFor(key) {
|
|
430
|
-
|
|
431
|
-
|
|
557
|
+
return checkStateMap.value.get(key) ?? "unchecked";
|
|
558
|
+
}
|
|
559
|
+
function ariaChecked(key) {
|
|
560
|
+
if (!props.checkable) return void 0;
|
|
561
|
+
const state = checkStateFor(key);
|
|
562
|
+
if (state === "checked") return "true";
|
|
563
|
+
if (state === "indeterminate") return "mixed";
|
|
564
|
+
return "false";
|
|
432
565
|
}
|
|
433
566
|
function isSelected(key) {
|
|
434
567
|
return selectedSet.value.has(key);
|
|
@@ -439,13 +572,20 @@ var RsTree_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
439
572
|
function isFocused(key) {
|
|
440
573
|
return focusedKey.value === key;
|
|
441
574
|
}
|
|
442
|
-
|
|
443
|
-
const
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
575
|
+
const labelPartsByKey = computed(() => {
|
|
576
|
+
const map = /* @__PURE__ */ new Map();
|
|
577
|
+
const keyword = props.filter.trim();
|
|
578
|
+
for (const entry of visibleFlatNodes.value) {
|
|
579
|
+
const label = getTreeLabel(entry.node, fields.value);
|
|
580
|
+
map.set(entry.key, !props.highlight || !keyword ? [{
|
|
581
|
+
text: label,
|
|
582
|
+
highlight: false
|
|
583
|
+
}] : splitTreeLabelHighlight(label, props.filter));
|
|
584
|
+
}
|
|
585
|
+
return map;
|
|
586
|
+
});
|
|
587
|
+
function labelParts(key) {
|
|
588
|
+
return labelPartsByKey.value.get(key) ?? [];
|
|
449
589
|
}
|
|
450
590
|
function rowIndentStyle(depth) {
|
|
451
591
|
return { paddingInlineStart: `${depth * indentPx.value}px` };
|
|
@@ -466,6 +606,28 @@ var RsTree_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
466
606
|
focusedKey.value = key;
|
|
467
607
|
scrollFocusedIntoView(key);
|
|
468
608
|
}
|
|
609
|
+
function focus() {
|
|
610
|
+
treeRootRef.value?.focus();
|
|
611
|
+
}
|
|
612
|
+
function scrollToKey(key) {
|
|
613
|
+
if (!nodeIndex.value.has(key)) return;
|
|
614
|
+
revealAncestors(key);
|
|
615
|
+
focusedKey.value = key;
|
|
616
|
+
scrollFocusedIntoView(key);
|
|
617
|
+
}
|
|
618
|
+
function getSelectedKeys() {
|
|
619
|
+
if (props.multiple) return Array.isArray(model.value) ? model.value.map(String) : [];
|
|
620
|
+
return typeof model.value === "string" && model.value ? [model.value] : [];
|
|
621
|
+
}
|
|
622
|
+
function getCheckedKeys() {
|
|
623
|
+
return [...checkedKeys.value];
|
|
624
|
+
}
|
|
625
|
+
function getExpandedKeys() {
|
|
626
|
+
return [...expandedKeys.value];
|
|
627
|
+
}
|
|
628
|
+
function getHalfCheckedKeys() {
|
|
629
|
+
return [...halfCheckedKeys.value];
|
|
630
|
+
}
|
|
469
631
|
function moveFocus(move) {
|
|
470
632
|
const nextKey = resolveTreeFocusKey(flatNodes.value, focusedKey.value, move, nodeIndex.value);
|
|
471
633
|
if (!nextKey) return;
|
|
@@ -485,38 +647,82 @@ var RsTree_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
485
647
|
moveFocus(move);
|
|
486
648
|
return true;
|
|
487
649
|
}
|
|
488
|
-
function
|
|
650
|
+
function handleTreeArrowForward(event, entry, current) {
|
|
489
651
|
event.preventDefault();
|
|
490
652
|
if (entry.hasChildren && !isExpanded(current)) toggleExpanded(entry.node, current);
|
|
491
653
|
else moveFocus("next");
|
|
492
654
|
}
|
|
493
|
-
function
|
|
655
|
+
function handleTreeArrowBackward(event, entry, current) {
|
|
494
656
|
event.preventDefault();
|
|
495
657
|
if (entry.hasChildren && isExpanded(current)) setExpanded(current, false);
|
|
496
658
|
else moveFocus("parent");
|
|
497
659
|
}
|
|
498
|
-
function
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
handleNodeAction(entry.node, current);
|
|
660
|
+
function expandSiblingBranches(current) {
|
|
661
|
+
if (props.accordion || treeDisabled.value) return;
|
|
662
|
+
const index = nodeIndex.value;
|
|
663
|
+
const parentKey = index.get(current)?.parentKey ?? null;
|
|
664
|
+
const siblings = parentKey ? index.get(parentKey)?.childrenKeys ?? [] : rootKeys.value;
|
|
665
|
+
const next = new Set(expandedKeys.value);
|
|
666
|
+
let changed = false;
|
|
667
|
+
for (const sibling of siblings) {
|
|
668
|
+
const entry = index.get(sibling);
|
|
669
|
+
if (!entry || entry.childrenKeys.length === 0 || next.has(sibling)) continue;
|
|
670
|
+
next.add(sibling);
|
|
671
|
+
changed = true;
|
|
511
672
|
}
|
|
673
|
+
if (changed) expandedKeys.value = [...next];
|
|
674
|
+
}
|
|
675
|
+
function handleTypeahead(event) {
|
|
676
|
+
if (event.isComposing || event.key === "Process") return false;
|
|
677
|
+
if (event.altKey || event.ctrlKey || event.metaKey) return false;
|
|
678
|
+
if (event.key.length !== 1) return false;
|
|
679
|
+
event.preventDefault();
|
|
680
|
+
typeaheadQuery = `${typeaheadQuery}${event.key}`.slice(-32);
|
|
681
|
+
if (typeaheadTimer != null) clearTimeout(typeaheadTimer);
|
|
682
|
+
typeaheadTimer = setTimeout(() => {
|
|
683
|
+
typeaheadTimer = null;
|
|
684
|
+
typeaheadQuery = "";
|
|
685
|
+
}, 500);
|
|
686
|
+
const nextKey = resolveTreeTypeaheadKey(flatNodes.value, focusedKey.value, typeaheadQuery, fields.value);
|
|
687
|
+
if (!nextKey) return true;
|
|
688
|
+
focusedKey.value = nextKey;
|
|
689
|
+
scrollFocusedIntoView(nextKey);
|
|
690
|
+
return true;
|
|
691
|
+
}
|
|
692
|
+
function isInnerControlTarget(event) {
|
|
693
|
+
const target = event.target;
|
|
694
|
+
if (!(target instanceof Element)) return false;
|
|
695
|
+
return Boolean(target.closest(".rs-tree__label, .rs-tree__toggle, .rs-tree__checkbox"));
|
|
512
696
|
}
|
|
513
697
|
function handleKeydown(event) {
|
|
698
|
+
if (treeDisabled.value) return;
|
|
699
|
+
if ((event.key === "Enter" || event.key === " ") && isInnerControlTarget(event)) return;
|
|
514
700
|
if (handleTreeNavigationKey(event)) return;
|
|
515
701
|
const current = focusedKey.value;
|
|
516
702
|
if (!current) return;
|
|
517
703
|
const entry = flatNodes.value.find((item) => item.key === current);
|
|
518
704
|
if (!entry) return;
|
|
519
|
-
|
|
705
|
+
const forward = isRtlHost() ? "ArrowLeft" : "ArrowRight";
|
|
706
|
+
const backward = isRtlHost() ? "ArrowRight" : "ArrowLeft";
|
|
707
|
+
if (event.key === forward) {
|
|
708
|
+
handleTreeArrowForward(event, entry, current);
|
|
709
|
+
return;
|
|
710
|
+
}
|
|
711
|
+
if (event.key === backward) {
|
|
712
|
+
handleTreeArrowBackward(event, entry, current);
|
|
713
|
+
return;
|
|
714
|
+
}
|
|
715
|
+
if (event.key === "*") {
|
|
716
|
+
event.preventDefault();
|
|
717
|
+
expandSiblingBranches(current);
|
|
718
|
+
return;
|
|
719
|
+
}
|
|
720
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
721
|
+
event.preventDefault();
|
|
722
|
+
handleNodeAction(entry.node, current);
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
725
|
+
handleTypeahead(event);
|
|
520
726
|
}
|
|
521
727
|
function canDrop(drag, drop, position) {
|
|
522
728
|
if (drag === drop) return false;
|
|
@@ -532,14 +738,14 @@ var RsTree_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
532
738
|
return "inside";
|
|
533
739
|
}
|
|
534
740
|
function onDragStart(key, event) {
|
|
535
|
-
if (!props.draggable) return;
|
|
741
|
+
if (treeDisabled.value || !props.draggable) return;
|
|
536
742
|
dragKey.value = key;
|
|
537
743
|
if (!event.dataTransfer) return;
|
|
538
744
|
event.dataTransfer.setData("text/plain", key);
|
|
539
745
|
event.dataTransfer.effectAllowed = "move";
|
|
540
746
|
}
|
|
541
747
|
function onDragOver(key, event) {
|
|
542
|
-
if (!props.draggable || !dragKey.value) return;
|
|
748
|
+
if (treeDisabled.value || !props.draggable || !dragKey.value) return;
|
|
543
749
|
const row = event.currentTarget;
|
|
544
750
|
const position = resolveDropPosition(event, row);
|
|
545
751
|
if (!canDrop(dragKey.value, key, position)) return;
|
|
@@ -551,7 +757,7 @@ var RsTree_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
551
757
|
dropTargetKey.value = null;
|
|
552
758
|
}
|
|
553
759
|
function onDrop(key, event) {
|
|
554
|
-
if (!props.draggable || !dragKey.value) return;
|
|
760
|
+
if (treeDisabled.value || !props.draggable || !dragKey.value) return;
|
|
555
761
|
const row = event.currentTarget;
|
|
556
762
|
const position = resolveDropPosition(event, row);
|
|
557
763
|
event.preventDefault();
|
|
@@ -572,31 +778,40 @@ var RsTree_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
572
778
|
collapseAll,
|
|
573
779
|
expandNode,
|
|
574
780
|
collapseNode,
|
|
575
|
-
focusNode
|
|
781
|
+
focusNode,
|
|
782
|
+
focus,
|
|
783
|
+
scrollToKey,
|
|
784
|
+
getSelectedKeys,
|
|
785
|
+
getCheckedKeys,
|
|
786
|
+
getExpandedKeys,
|
|
787
|
+
getHalfCheckedKeys
|
|
576
788
|
});
|
|
577
789
|
return (_ctx, _cache) => {
|
|
578
790
|
return openBlock(), createElementBlock("div", {
|
|
791
|
+
id: rootId.value,
|
|
579
792
|
ref_key: "treeRootRef",
|
|
580
793
|
ref: treeRootRef,
|
|
581
|
-
class: normalizeClass(["rs-tree", [`rs-tree--${
|
|
794
|
+
class: normalizeClass(["rs-tree rs-motion-reduce", [`rs-tree--${unref(resolvedSize)}`, {
|
|
582
795
|
"rs-tree--virtual": useVirtualScroll.value,
|
|
583
796
|
"rs-tree--fill-capture": fillCapture.value,
|
|
584
797
|
"rs-tree--block": __props.blockNode,
|
|
585
798
|
"rs-tree--line": __props.showLine,
|
|
586
799
|
"rs-tree--draggable": __props.draggable,
|
|
587
|
-
"rs-tree--drag-row": dragWholeRow.value
|
|
800
|
+
"rs-tree--drag-row": dragWholeRow.value,
|
|
801
|
+
"rs-tree--disabled": treeDisabled.value
|
|
588
802
|
}]]),
|
|
589
803
|
role: "tree",
|
|
590
|
-
tabindex:
|
|
591
|
-
"aria-label":
|
|
804
|
+
tabindex: treeDisabled.value ? -1 : 0,
|
|
805
|
+
"aria-label": treeLabel.value,
|
|
806
|
+
"aria-disabled": treeDisabled.value || void 0,
|
|
592
807
|
"aria-multiselectable": __props.multiple || __props.checkable || void 0,
|
|
808
|
+
"aria-activedescendant": focusedKey.value ? itemDomId(focusedKey.value) : void 0,
|
|
593
809
|
onKeydown: handleKeydown
|
|
594
|
-
}, [isEmpty.value ? (
|
|
595
|
-
key: 0,
|
|
810
|
+
}, [isEmpty.value ? renderSlot(_ctx.$slots, "empty", {}, () => [createVNode(RsEmpty_default, {
|
|
596
811
|
fill: "",
|
|
597
812
|
class: "rs-tree__empty",
|
|
598
813
|
description: unref(t)("tree.empty")
|
|
599
|
-
}, null, 8, ["description"])) : (openBlock(), createElementBlock("div", {
|
|
814
|
+
}, null, 8, ["description"])], true, 0) : (openBlock(), createElementBlock("div", {
|
|
600
815
|
key: 1,
|
|
601
816
|
ref_key: "viewportRef",
|
|
602
817
|
ref: viewportRef,
|
|
@@ -610,11 +825,12 @@ var RsTree_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
610
825
|
style: normalizeStyle({ height: `${virtualSlice.value.paddingTop}px` }),
|
|
611
826
|
"aria-hidden": "true"
|
|
612
827
|
}, null, 4)) : createCommentVNode("", true),
|
|
613
|
-
createElementVNode("ul", _hoisted_2, [(openBlock(true), createElementBlock(Fragment, null, renderList(visibleFlatNodes.value, (entry
|
|
828
|
+
createElementVNode("ul", _hoisted_2, [(openBlock(true), createElementBlock(Fragment, null, renderList(visibleFlatNodes.value, (entry) => {
|
|
614
829
|
return openBlock(), createElementBlock("li", {
|
|
615
830
|
key: `${entry.parentKey ?? "root"}:${entry.key}`,
|
|
616
831
|
class: "rs-tree__item"
|
|
617
832
|
}, [createElementVNode("div", {
|
|
833
|
+
id: itemDomId(entry.key),
|
|
618
834
|
ref_for: true,
|
|
619
835
|
ref: (el) => setRowRef(entry.key, el),
|
|
620
836
|
class: normalizeClass(["rs-tree__row", {
|
|
@@ -627,17 +843,19 @@ var RsTree_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
627
843
|
"rs-tree__row--last": __props.showLine && entry.isLast
|
|
628
844
|
}]),
|
|
629
845
|
role: "treeitem",
|
|
630
|
-
tabindex:
|
|
846
|
+
tabindex: "-1",
|
|
631
847
|
"aria-expanded": entry.hasChildren ? isExpanded(entry.key) : void 0,
|
|
632
848
|
"aria-selected": __props.selectable ? isSelected(entry.key) : void 0,
|
|
849
|
+
"aria-checked": __props.checkable && unref(shouldShowTreeCheckbox)(entry.node, fields.value, checkboxOptions()) ? ariaChecked(entry.key) : void 0,
|
|
850
|
+
"aria-disabled": treeDisabled.value || unref(isTreeNodeDisabled)(entry.node, fields.value) || void 0,
|
|
851
|
+
"aria-busy": unref(isTreeNodeLoading)(entry.node, entry.key, loadingKeys.value, fields.value) || void 0,
|
|
633
852
|
"aria-level": entry.depth + 1,
|
|
634
|
-
"aria-setsize":
|
|
635
|
-
"aria-posinset":
|
|
853
|
+
"aria-setsize": entry.setSize,
|
|
854
|
+
"aria-posinset": entry.posInSet,
|
|
636
855
|
draggable: __props.draggable && !unref(isTreeNodeDisabled)(entry.node, fields.value),
|
|
637
856
|
"data-tree-key": entry.key,
|
|
638
857
|
style: normalizeStyle([rowIndentStyle(entry.depth), { minHeight: `${rowHeight.value}px` }]),
|
|
639
858
|
onContextmenu: ($event) => emit("node-contextmenu", entry.node, entry.key, $event),
|
|
640
|
-
onKeydown: handleKeydown,
|
|
641
859
|
onDragstart: ($event) => onDragStart(entry.key, $event),
|
|
642
860
|
onDragover: ($event) => onDragOver(entry.key, $event),
|
|
643
861
|
onDragleave: onDragLeave,
|
|
@@ -669,7 +887,7 @@ var RsTree_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
669
887
|
showDragHandle.value ? (openBlock(), createElementBlock("span", {
|
|
670
888
|
key: 1,
|
|
671
889
|
class: "rs-tree__drag-handle",
|
|
672
|
-
|
|
890
|
+
title: unref(t)("tree.drag"),
|
|
673
891
|
"aria-hidden": "true"
|
|
674
892
|
}, [createVNode(RsIcon_default, {
|
|
675
893
|
name: "grip-vertical",
|
|
@@ -679,9 +897,10 @@ var RsTree_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
679
897
|
key: 2,
|
|
680
898
|
type: "button",
|
|
681
899
|
class: normalizeClass(["rs-tree__toggle", { "rs-tree__toggle--expanded": isExpanded(entry.key) }]),
|
|
900
|
+
tabindex: "-1",
|
|
682
901
|
"aria-label": isExpanded(entry.key) ? unref(t)("tree.collapse") : unref(t)("tree.expand"),
|
|
683
902
|
"aria-expanded": isExpanded(entry.key),
|
|
684
|
-
disabled: unref(isTreeNodeLoading)(entry.node, entry.key, loadingKeys.value, fields.value),
|
|
903
|
+
disabled: treeDisabled.value || unref(isTreeNodeLoading)(entry.node, entry.key, loadingKeys.value, fields.value),
|
|
685
904
|
onClick: withModifiers(($event) => toggleExpanded(entry.node, entry.key), ["stop"])
|
|
686
905
|
}, [unref(isTreeNodeLoading)(entry.node, entry.key, loadingKeys.value, fields.value) ? (openBlock(), createBlock(RsIcon_default, {
|
|
687
906
|
key: 0,
|
|
@@ -699,8 +918,10 @@ var RsTree_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
699
918
|
}, [createElementVNode("input", {
|
|
700
919
|
type: "checkbox",
|
|
701
920
|
class: "rs-tree__checkbox-input",
|
|
921
|
+
tabindex: "-1",
|
|
702
922
|
checked: checkStateFor(entry.key) === "checked",
|
|
703
|
-
|
|
923
|
+
indeterminate: checkStateFor(entry.key) === "indeterminate",
|
|
924
|
+
disabled: treeDisabled.value || unref(isTreeCheckboxDisabled)(entry.node, fields.value, checkboxOptions()),
|
|
704
925
|
"aria-label": unref(t)("tree.check"),
|
|
705
926
|
onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"])),
|
|
706
927
|
onChange: ($event) => toggleCheck(entry.node, entry.key)
|
|
@@ -708,17 +929,22 @@ var RsTree_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
708
929
|
class: "rs-tree__checkbox-box",
|
|
709
930
|
"aria-hidden": "true"
|
|
710
931
|
}, null, -1))], 2)) : __props.checkable && __props.onlyCheckLeaf && unref(hasTreeChildren)(entry.node, fields.value, __props.lazy) ? (openBlock(), createElementBlock("span", _hoisted_10)) : createCommentVNode("", true),
|
|
711
|
-
entry.node[fields.value.icon] || entry.node.icon ? (
|
|
712
|
-
|
|
932
|
+
_ctx.$slots.icon || entry.node[fields.value.icon] || entry.node.icon ? renderSlot(_ctx.$slots, "icon", {
|
|
933
|
+
node: entry.node,
|
|
934
|
+
key: entry.key,
|
|
935
|
+
expanded: isExpanded(entry.key)
|
|
936
|
+
}, () => [entry.node[fields.value.icon] || entry.node.icon ? (openBlock(), createBlock(RsIcon_default, {
|
|
937
|
+
key: 0,
|
|
713
938
|
name: String(entry.node[fields.value.icon] ?? entry.node.icon),
|
|
714
939
|
size: "sm",
|
|
715
940
|
class: "rs-tree__node-icon"
|
|
716
|
-
}, null, 8, ["name"])) : createCommentVNode("", true),
|
|
941
|
+
}, null, 8, ["name"])) : createCommentVNode("", true)], true) : createCommentVNode("", true),
|
|
717
942
|
!__props.blockNode ? (openBlock(), createElementBlock("button", {
|
|
718
943
|
key: 7,
|
|
719
944
|
type: "button",
|
|
720
945
|
class: "rs-tree__label",
|
|
721
|
-
|
|
946
|
+
tabindex: "-1",
|
|
947
|
+
disabled: treeDisabled.value || unref(isTreeNodeDisabled)(entry.node, fields.value),
|
|
722
948
|
onClick: ($event) => handleLabelClick(entry.node, entry.key, $event)
|
|
723
949
|
}, [renderSlot(_ctx.$slots, "title", {
|
|
724
950
|
node: entry.node,
|
|
@@ -729,7 +955,7 @@ var RsTree_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
729
955
|
checkState: checkStateFor(entry.key),
|
|
730
956
|
depth: entry.depth,
|
|
731
957
|
focused: isFocused(entry.key)
|
|
732
|
-
}, () => [createElementVNode("span", _hoisted_12, [(openBlock(true), createElementBlock(Fragment, null, renderList(labelParts(entry.
|
|
958
|
+
}, () => [createElementVNode("span", _hoisted_12, [(openBlock(true), createElementBlock(Fragment, null, renderList(labelParts(entry.key), (part, index) => {
|
|
733
959
|
return openBlock(), createElementBlock(Fragment, { key: index }, [part.highlight ? (openBlock(), createElementBlock("mark", _hoisted_13, toDisplayString(part.text), 1)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(part.text), 1)], 64))], 64);
|
|
734
960
|
}), 128))])], true)], 8, _hoisted_11)) : (openBlock(), createElementBlock("span", {
|
|
735
961
|
key: 8,
|
|
@@ -743,7 +969,7 @@ var RsTree_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
743
969
|
checkState: checkStateFor(entry.key),
|
|
744
970
|
depth: entry.depth,
|
|
745
971
|
focused: isFocused(entry.key)
|
|
746
|
-
}, () => [createElementVNode("span", _hoisted_14, [(openBlock(true), createElementBlock(Fragment, null, renderList(labelParts(entry.
|
|
972
|
+
}, () => [createElementVNode("span", _hoisted_14, [(openBlock(true), createElementBlock(Fragment, null, renderList(labelParts(entry.key), (part, index) => {
|
|
747
973
|
return openBlock(), createElementBlock(Fragment, { key: index }, [part.highlight ? (openBlock(), createElementBlock("mark", _hoisted_15, toDisplayString(part.text), 1)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(part.text), 1)], 64))], 64);
|
|
748
974
|
}), 128))])], true)], 2))
|
|
749
975
|
], 46, _hoisted_3)]);
|
|
@@ -3,6 +3,6 @@ import _plugin_vue_export_helper_default from "../../../_virtual/_plugin-vue_exp
|
|
|
3
3
|
import RsTree_vue_vue_type_script_setup_true_lang_default from "./RsTree.impl.js";
|
|
4
4
|
|
|
5
5
|
//#region src/components/tree/src/RsTree.vue
|
|
6
|
-
var RsTree_default = /*#__PURE__*/ _plugin_vue_export_helper_default(RsTree_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
6
|
+
var RsTree_default = /*#__PURE__*/ _plugin_vue_export_helper_default(RsTree_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-ef7566eb"]]);
|
|
7
7
|
//#endregion
|
|
8
8
|
export { RsTree_default as default };
|