vft 0.0.73 → 0.0.76
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/attributes.json +1 -1
- package/dist/index.css +1 -1
- package/es/component.js +67 -48
- package/es/components/affix/affix.js +45 -0
- package/es/components/affix/affix.vue.js +4 -0
- package/es/components/affix/affix.vue2.js +83 -0
- package/es/components/affix/index.js +12 -0
- package/es/components/affix/style/css.js +2 -0
- package/es/components/affix/style/index.js +2 -0
- package/es/components/back-top/back-top.vue2.js +10 -2
- package/es/components/button/button.vue2.js +58 -59
- package/es/components/button/use-button.js +26 -20
- package/es/components/card/card.vue.js +4 -0
- package/es/components/card/card.vue2.js +44 -0
- package/es/components/card/index.js +12 -0
- package/es/components/card/instance.js +1 -0
- package/es/components/card/style/css.js +2 -0
- package/es/components/card/style/index.js +2 -0
- package/es/components/check-tag/check-tag.vue.js +4 -0
- package/es/components/check-tag/check-tag.vue2.js +35 -0
- package/es/components/check-tag/index.js +12 -0
- package/es/components/check-tag/style/css.js +2 -0
- package/es/components/check-tag/style/index.js +2 -0
- package/es/components/color-picker/color-picker.vue2.js +1 -1
- package/es/components/context-menu/context-menu.vue2.js +10 -2
- package/es/components/date-picker/composables/use-month-range-header.js +1 -1
- package/es/components/date-picker/constants.js +16 -2
- package/es/components/date-picker/date-picker-com/basic-month-table.vue2.js +37 -34
- package/es/components/date-picker/date-picker-com/basic-year-table.vue2.js +0 -1
- package/es/components/date-picker/date-picker-com/panel-date-pick.vue2.js +177 -178
- package/es/components/date-picker/date-picker-com/panel-date-range.vue2.js +328 -336
- package/es/components/date-picker/date-picker.js +18 -18
- package/es/components/date-picker/index.js +5 -4
- package/es/components/date-picker/props/shared.js +1 -1
- package/es/components/date-time-select/date-time-select.vue2.js +59 -59
- package/es/components/dialog/dialog.vue2.js +12 -12
- package/es/components/dialog/hooks/use-dialog.js +4 -4
- package/es/components/dropdown/dropdown-menu.vue2.js +4 -4
- package/es/components/footer-layout/footer-layout.vue2.js +10 -2
- package/es/components/header-layout/header-layout.vue2.js +10 -2
- package/es/components/horizontal-menu/constants.js +4 -0
- package/es/components/horizontal-menu/horizontal-menu.vue2.js +153 -86
- package/es/components/horizontal-menu/index.js +7 -5
- package/es/components/index.js +228 -194
- package/es/components/md-container/md-container.vue2.js +10 -2
- package/es/components/menu/menu-item.vue2.js +58 -58
- package/es/components/menu/menu.vue2.js +72 -68
- package/es/components/menu/sub-menu.vue2.js +139 -117
- package/es/components/multiple-tabs/multiple-tabs.vue2.js +35 -26
- package/es/components/option/style/css.js +2 -0
- package/es/components/option/style/index.js +2 -0
- package/es/components/option-group/style/css.js +2 -0
- package/es/components/option-group/style/index.js +2 -0
- package/es/components/popconfirm/index.js +12 -0
- package/es/components/popconfirm/popconfirm.vue.js +4 -0
- package/es/components/popconfirm/popconfirm.vue2.js +112 -0
- package/es/components/popconfirm/style/css.js +6 -0
- package/es/components/popconfirm/style/index.js +6 -0
- package/es/components/popover/style/index.js +1 -1
- package/es/components/result/result.vue2.js +10 -2
- package/es/components/roving-focus-group/roving-focus-item.vue2.js +1 -1
- package/es/components/search/style/css.js +2 -0
- package/es/components/search/style/index.js +2 -0
- package/es/components/select/index.js +22 -0
- package/es/components/select/option-group.vue.js +25 -0
- package/es/components/select/option-group.vue2.js +53 -0
- package/es/components/select/option.vue.js +27 -0
- package/es/components/select/option.vue2.js +58 -0
- package/es/components/select/options.js +34 -0
- package/es/components/select/select-dropdown.vue.js +15 -0
- package/es/components/select/select-dropdown.vue2.js +32 -0
- package/es/components/select/select.vue.js +327 -0
- package/es/components/select/select.vue2.js +348 -0
- package/es/components/select/style/css.js +8 -0
- package/es/components/select/style/index.js +8 -0
- package/es/components/select/token.js +5 -0
- package/es/components/select/useOption.js +71 -0
- package/es/components/select/useSelect.js +414 -0
- package/es/components/select-v2/select-dropdown.js +1 -1
- package/es/components/select-v2/useSelect.js +269 -269
- package/es/components/side-menu/side-menu.vue2.js +153 -142
- package/es/components/skeleton/index.js +16 -0
- package/es/components/skeleton/skeleton-item.vue.js +4 -0
- package/es/components/skeleton/skeleton-item.vue2.js +31 -0
- package/es/components/skeleton/skeleton.vue.js +4 -0
- package/es/components/skeleton/skeleton.vue2.js +55 -0
- package/es/components/skeleton/style/css.js +3 -0
- package/es/components/skeleton/style/index.js +3 -0
- package/es/components/skeleton-item/style/css.js +2 -0
- package/es/components/skeleton-item/style/index.js +2 -0
- package/es/components/space/index.js +17 -0
- package/es/components/space/item.js +24 -0
- package/es/components/space/space.js +182 -0
- package/es/components/space/style/css.js +2 -0
- package/es/components/space/style/index.js +2 -0
- package/es/components/space/use-space.js +44 -0
- package/es/components/switch/switch.vue2.js +1 -1
- package/es/components/tabs/tab-nav.vue2.js +30 -22
- package/es/components/tabs/tabs.vue2.js +37 -37
- package/es/components/time-picker/common/picker.vue2.js +241 -257
- package/es/components/time-picker/common/props.js +10 -6
- package/es/components/time-picker/time-picker-com/panel-time-range.vue2.js +1 -1
- package/es/components/time-picker/time-picker.js +10 -10
- package/es/components/time-select/time-select.vue2.js +38 -42
- package/es/components/tooltip/content.vue2.js +1 -1
- package/es/components/tree/index.js +14 -0
- package/es/components/tree/model/node.js +248 -0
- package/es/components/tree/model/tree-store.js +197 -0
- package/es/components/tree/model/useDragNode.js +71 -0
- package/es/components/tree/model/useKeydown.js +81 -0
- package/es/components/tree/model/useNodeExpandEventBroadcast.js +19 -0
- package/es/components/tree/model/util.js +21 -0
- package/es/components/tree/style/css.js +3 -0
- package/es/components/tree/style/index.js +3 -0
- package/es/components/tree/tree-node-content.vue.js +4 -0
- package/es/components/tree/tree-node-content.vue2.js +28 -0
- package/es/components/tree/tree-node.vue.js +98 -0
- package/es/components/tree/tree-node.vue2.js +152 -0
- package/es/components/tree/tree.type.js +1 -0
- package/es/components/tree/tree.vue.js +48 -0
- package/es/components/tree/tree.vue2.js +268 -0
- package/es/components/tree-select/cache-options.js +32 -0
- package/es/components/tree-select/index.js +9 -0
- package/es/components/tree-select/select.js +38 -0
- package/es/components/tree-select/style/css.js +11 -0
- package/es/components/tree-select/style/index.js +11 -0
- package/es/components/tree-select/tree-select-option.js +21 -0
- package/es/components/tree-select/tree-select.vue.js +4 -0
- package/es/components/tree-select/tree-select.vue2.js +81 -0
- package/es/components/tree-select/tree.js +137 -0
- package/es/components/tree-select/utils.js +45 -0
- package/es/hooks/index.js +25 -21
- package/es/hooks/use-focus/index.js +9 -0
- package/es/hooks/use-throttle-render/index.js +21 -0
- package/es/index.js +408 -368
- package/es/package.json.js +1 -1
- package/es/utils/helper.js +5 -2
- package/es/utils/index.js +48 -46
- package/lib/component.cjs +1 -1
- package/lib/components/affix/affix.cjs +1 -0
- package/lib/components/affix/affix.vue.cjs +1 -0
- package/lib/components/affix/affix.vue2.cjs +1 -0
- package/lib/components/affix/index.cjs +1 -0
- package/lib/components/affix/style/css.cjs +1 -0
- package/lib/components/affix/style/index.cjs +1 -0
- package/lib/components/back-top/back-top.vue2.cjs +1 -1
- package/lib/components/button/button.vue2.cjs +1 -1
- package/lib/components/button/use-button.cjs +1 -1
- package/lib/components/card/card.vue.cjs +1 -0
- package/lib/components/card/card.vue2.cjs +1 -0
- package/lib/components/card/index.cjs +1 -0
- package/lib/components/card/instance.cjs +1 -0
- package/lib/components/card/style/css.cjs +1 -0
- package/lib/components/card/style/index.cjs +1 -0
- package/lib/components/check-tag/check-tag.vue.cjs +1 -0
- package/lib/components/check-tag/check-tag.vue2.cjs +1 -0
- package/lib/components/check-tag/index.cjs +1 -0
- package/lib/components/check-tag/style/css.cjs +1 -0
- package/lib/components/check-tag/style/index.cjs +1 -0
- package/lib/components/color-picker/color-picker.vue2.cjs +1 -1
- package/lib/components/context-menu/context-menu.vue2.cjs +1 -1
- package/lib/components/date-picker/composables/use-month-range-header.cjs +1 -1
- package/lib/components/date-picker/constants.cjs +1 -1
- package/lib/components/date-picker/date-picker-com/basic-month-table.vue2.cjs +1 -1
- package/lib/components/date-picker/date-picker-com/basic-year-table.vue2.cjs +1 -1
- package/lib/components/date-picker/date-picker-com/panel-date-pick.vue2.cjs +1 -1
- package/lib/components/date-picker/date-picker-com/panel-date-range.vue2.cjs +1 -1
- package/lib/components/date-picker/date-picker.cjs +1 -1
- package/lib/components/date-picker/index.cjs +1 -1
- package/lib/components/date-picker/props/shared.cjs +1 -1
- package/lib/components/date-time-select/date-time-select.vue2.cjs +1 -1
- package/lib/components/dialog/dialog.vue2.cjs +1 -1
- package/lib/components/dialog/hooks/use-dialog.cjs +1 -1
- package/lib/components/dropdown/dropdown-menu.vue2.cjs +1 -1
- package/lib/components/footer-layout/footer-layout.vue2.cjs +1 -1
- package/lib/components/header-layout/header-layout.vue2.cjs +1 -1
- package/lib/components/horizontal-menu/constants.cjs +1 -0
- package/lib/components/horizontal-menu/horizontal-menu.vue2.cjs +1 -1
- package/lib/components/horizontal-menu/index.cjs +1 -1
- package/lib/components/index.cjs +1 -1
- package/lib/components/md-container/md-container.vue2.cjs +1 -1
- package/lib/components/menu/menu-item.vue2.cjs +1 -1
- package/lib/components/menu/menu.vue2.cjs +1 -1
- package/lib/components/menu/sub-menu.vue2.cjs +1 -1
- package/lib/components/multiple-tabs/multiple-tabs.vue2.cjs +1 -1
- package/lib/components/option/style/css.cjs +1 -0
- package/lib/components/option/style/index.cjs +1 -0
- package/lib/components/option-group/style/css.cjs +1 -0
- package/lib/components/option-group/style/index.cjs +1 -0
- package/lib/components/popconfirm/index.cjs +1 -0
- package/lib/components/popconfirm/popconfirm.vue.cjs +1 -0
- package/lib/components/popconfirm/popconfirm.vue2.cjs +1 -0
- package/lib/components/popconfirm/style/css.cjs +1 -0
- package/lib/components/popconfirm/style/index.cjs +1 -0
- package/lib/components/popover/style/index.cjs +1 -1
- package/lib/components/result/result.vue2.cjs +1 -1
- package/lib/components/roving-focus-group/roving-focus-item.vue2.cjs +1 -1
- package/lib/components/search/style/css.cjs +1 -1
- package/lib/components/search/style/index.cjs +1 -1
- package/lib/components/select/index.cjs +1 -0
- package/lib/components/select/option-group.vue.cjs +1 -0
- package/lib/components/select/option-group.vue2.cjs +1 -0
- package/lib/components/select/option.vue.cjs +1 -0
- package/lib/components/select/option.vue2.cjs +1 -0
- package/lib/components/select/options.cjs +1 -0
- package/lib/components/select/select-dropdown.vue.cjs +1 -0
- package/lib/components/select/select-dropdown.vue2.cjs +1 -0
- package/lib/components/select/select.vue.cjs +1 -0
- package/lib/components/select/select.vue2.cjs +1 -0
- package/lib/components/select/style/css.cjs +1 -0
- package/lib/components/select/style/index.cjs +1 -0
- package/lib/components/select/token.cjs +1 -0
- package/lib/components/select/useOption.cjs +1 -0
- package/lib/components/select/useSelect.cjs +1 -0
- package/lib/components/select-v2/select-dropdown.cjs +1 -1
- package/lib/components/select-v2/useSelect.cjs +1 -1
- package/lib/components/side-menu/side-menu.vue2.cjs +1 -1
- package/lib/components/skeleton/index.cjs +1 -0
- package/lib/components/skeleton/skeleton-item.vue.cjs +1 -0
- package/lib/components/skeleton/skeleton-item.vue2.cjs +1 -0
- package/lib/components/skeleton/skeleton.vue.cjs +1 -0
- package/lib/components/skeleton/skeleton.vue2.cjs +1 -0
- package/lib/components/skeleton/style/css.cjs +1 -0
- package/lib/components/skeleton/style/index.cjs +1 -0
- package/lib/components/skeleton-item/style/css.cjs +1 -0
- package/lib/components/skeleton-item/style/index.cjs +1 -0
- package/lib/components/space/index.cjs +1 -0
- package/lib/components/space/item.cjs +1 -0
- package/lib/components/space/space.cjs +1 -0
- package/lib/components/space/style/css.cjs +1 -0
- package/lib/components/space/style/index.cjs +1 -0
- package/lib/components/space/use-space.cjs +1 -0
- package/lib/components/switch/switch.vue2.cjs +1 -1
- package/lib/components/tabs/tab-nav.vue2.cjs +1 -1
- package/lib/components/tabs/tabs.vue2.cjs +1 -1
- package/lib/components/time-picker/common/picker.vue2.cjs +1 -1
- package/lib/components/time-picker/common/props.cjs +1 -1
- package/lib/components/time-picker/time-picker-com/panel-time-range.vue2.cjs +1 -1
- package/lib/components/time-picker/time-picker.cjs +1 -1
- package/lib/components/time-select/time-select.vue2.cjs +1 -1
- package/lib/components/tooltip/content.vue2.cjs +1 -1
- package/lib/components/tree/index.cjs +1 -0
- package/lib/components/tree/model/node.cjs +1 -0
- package/lib/components/tree/model/tree-store.cjs +1 -0
- package/lib/components/tree/model/useDragNode.cjs +1 -0
- package/lib/components/tree/model/useKeydown.cjs +1 -0
- package/lib/components/tree/model/useNodeExpandEventBroadcast.cjs +1 -0
- package/lib/components/tree/model/util.cjs +1 -0
- package/lib/components/tree/style/css.cjs +1 -0
- package/lib/components/tree/style/index.cjs +1 -0
- package/lib/components/tree/tree-node-content.vue.cjs +1 -0
- package/lib/components/tree/tree-node-content.vue2.cjs +1 -0
- package/lib/components/tree/tree-node.vue.cjs +1 -0
- package/lib/components/tree/tree-node.vue2.cjs +1 -0
- package/lib/components/tree/tree.type.cjs +1 -0
- package/lib/components/tree/tree.vue.cjs +1 -0
- package/lib/components/tree/tree.vue2.cjs +1 -0
- package/lib/components/tree-select/cache-options.cjs +1 -0
- package/lib/components/tree-select/index.cjs +1 -0
- package/lib/components/tree-select/select.cjs +1 -0
- package/lib/components/tree-select/style/css.cjs +1 -0
- package/lib/components/tree-select/style/index.cjs +1 -0
- package/lib/components/tree-select/tree-select-option.cjs +1 -0
- package/lib/components/tree-select/tree-select.vue.cjs +1 -0
- package/lib/components/tree-select/tree-select.vue2.cjs +1 -0
- package/lib/components/tree-select/tree.cjs +1 -0
- package/lib/components/tree-select/utils.cjs +1 -0
- package/lib/hooks/index.cjs +1 -1
- package/lib/hooks/use-focus/index.cjs +1 -0
- package/lib/hooks/use-throttle-render/index.cjs +1 -0
- package/lib/index.cjs +1 -1
- package/lib/package.json.cjs +1 -1
- package/lib/utils/helper.cjs +1 -1
- package/lib/utils/index.cjs +1 -1
- package/package.json +1 -1
- package/tags.json +1 -1
- package/theme-style/base.css +1 -1
- package/theme-style/index.css +1 -1
- package/theme-style/src/alert.scss +1 -1
- package/theme-style/src/autocomplete.scss +2 -2
- package/theme-style/src/breadcrumb.scss +4 -4
- package/theme-style/src/calendar.scss +2 -2
- package/theme-style/src/card.scss +1 -1
- package/theme-style/src/carousel.scss +1 -1
- package/theme-style/src/cascader.scss +3 -3
- package/theme-style/src/check-tag.scss +3 -3
- package/theme-style/src/checkbox.scss +1 -1
- package/theme-style/src/color-picker.scss +2 -2
- package/theme-style/src/common/var.scss +527 -521
- package/theme-style/src/date-picker/date-picker.scss +1 -1
- package/theme-style/src/date-picker/date-range-picker.scss +2 -2
- package/theme-style/src/date-picker/date-table.scss +1 -1
- package/theme-style/src/date-picker/month-table.scss +2 -2
- package/theme-style/src/date-picker/picker-panel.scss +4 -5
- package/theme-style/src/date-picker/picker.scss +7 -9
- package/theme-style/src/date-picker/time-picker.scss +2 -2
- package/theme-style/src/date-picker/time-spinner.scss +6 -8
- package/theme-style/src/date-picker/year-table.scss +3 -3
- package/theme-style/src/date-time-select.scss +3 -4
- package/theme-style/src/descriptions-item.scss +4 -4
- package/theme-style/src/descriptions.scss +2 -2
- package/theme-style/src/header-layout.scss +1 -1
- package/theme-style/src/horizontal-menu.scss +27 -39
- package/theme-style/src/image-viewer.scss +1 -1
- package/theme-style/src/index.scss +3 -0
- package/theme-style/src/input-number.scss +1 -1
- package/theme-style/src/menu.scss +76 -66
- package/theme-style/src/mixins/_var.scss +2 -2
- package/theme-style/src/mixins/mixins.scss +2 -2
- package/theme-style/src/popconfirm.scss +16 -0
- package/theme-style/src/popper.scss +4 -2
- package/theme-style/src/progress.scss +1 -1
- package/theme-style/src/reset.scss +3 -3
- package/theme-style/src/result.scss +2 -2
- package/theme-style/src/select-dropdown-v2.scss +1 -1
- package/theme-style/src/select-dropdown.scss +1 -1
- package/theme-style/src/select-v2.scss +2 -2
- package/theme-style/src/select.scss +4 -5
- package/theme-style/src/side-menu.scss +0 -1
- package/theme-style/src/skeleton-item.scss +83 -0
- package/theme-style/src/skeleton.scss +44 -0
- package/theme-style/src/step.scss +10 -10
- package/theme-style/src/tabs.scss +15 -155
- package/theme-style/src/timeline-item.scss +2 -2
- package/theme-style/src/transfer.scss +5 -5
- package/theme-style/src/tree.scss +2 -5
- package/theme-style/src/upload.scss +11 -11
- package/theme-style/src/var.scss +1 -1
- package/theme-style/vft-alert.css +1 -1
- package/theme-style/vft-autocomplete.css +1 -1
- package/theme-style/vft-breadcrumb.css +1 -1
- package/theme-style/vft-calendar.css +1 -1
- package/theme-style/vft-card.css +1 -1
- package/theme-style/vft-carousel.css +1 -1
- package/theme-style/vft-cascader.css +1 -1
- package/theme-style/vft-check-tag.css +1 -1
- package/theme-style/vft-checkbox.css +1 -1
- package/theme-style/vft-color-picker.css +1 -1
- package/theme-style/vft-date-picker.css +1 -1
- package/theme-style/vft-date-time-select.css +1 -1
- package/theme-style/vft-descriptions-item.css +1 -1
- package/theme-style/vft-descriptions.css +1 -1
- package/theme-style/vft-header-layout.css +1 -1
- package/theme-style/vft-horizontal-menu.css +1 -1
- package/theme-style/vft-image-viewer.css +1 -1
- package/theme-style/vft-input-number.css +1 -1
- package/theme-style/vft-menu.css +1 -1
- package/theme-style/vft-popconfirm.css +1 -0
- package/theme-style/vft-popper.css +1 -1
- package/theme-style/vft-progress.css +1 -1
- package/theme-style/vft-reset.css +1 -1
- package/theme-style/vft-result.css +1 -1
- package/theme-style/vft-select-dropdown-v2.css +1 -1
- package/theme-style/vft-select-dropdown.css +1 -1
- package/theme-style/vft-select-v2.css +1 -1
- package/theme-style/vft-select.css +1 -1
- package/theme-style/vft-side-menu.css +1 -1
- package/theme-style/vft-skeleton-item.css +1 -0
- package/theme-style/vft-skeleton.css +1 -0
- package/theme-style/vft-step.css +1 -1
- package/theme-style/vft-tabs.css +1 -1
- package/theme-style/vft-time-picker.css +1 -1
- package/theme-style/vft-time-select.css +1 -1
- package/theme-style/vft-timeline-item.css +1 -1
- package/theme-style/vft-transfer.css +1 -1
- package/theme-style/vft-tree.css +1 -1
- package/theme-style/vft-upload.css +1 -1
- package/theme-style/vft-var.css +1 -1
- package/web-types.json +1 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import s from "./tree.vue2.js";
|
|
2
|
+
import { resolveComponent as p, openBlock as r, createElementBlock as n, normalizeClass as o, Fragment as i, renderList as l, createBlock as m, renderSlot as g, createElementVNode as t, toDisplayString as h, createCommentVNode as c, withDirectives as u, vShow as f } from "vue";
|
|
3
|
+
import y from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
function k(e, E, w, N, S, $) {
|
|
5
|
+
const a = p("tree-node");
|
|
6
|
+
return r(), n("div", {
|
|
7
|
+
ref: "el$",
|
|
8
|
+
class: o([
|
|
9
|
+
e.ns.b(),
|
|
10
|
+
e.ns.is("dragging", !!e.dragState.draggingNode),
|
|
11
|
+
e.ns.is("drop-not-allow", !e.dragState.allowDrop),
|
|
12
|
+
e.ns.is("drop-inner", e.dragState.dropType === "inner"),
|
|
13
|
+
{ [e.ns.m("highlight-current")]: e.highlightCurrent }
|
|
14
|
+
]),
|
|
15
|
+
role: "tree"
|
|
16
|
+
}, [
|
|
17
|
+
(r(!0), n(i, null, l(e.root.childNodes, (d) => (r(), m(a, {
|
|
18
|
+
key: e.getNodeKey(d),
|
|
19
|
+
node: d,
|
|
20
|
+
props: e.props,
|
|
21
|
+
accordion: e.accordion,
|
|
22
|
+
"render-after-expand": e.renderAfterExpand,
|
|
23
|
+
"show-checkbox": e.showCheckbox,
|
|
24
|
+
"render-content": e.renderContent,
|
|
25
|
+
onNodeExpand: e.handleNodeExpand
|
|
26
|
+
}, null, 8, ["node", "props", "accordion", "render-after-expand", "show-checkbox", "render-content", "onNodeExpand"]))), 128)),
|
|
27
|
+
e.isEmpty ? (r(), n("div", {
|
|
28
|
+
key: 0,
|
|
29
|
+
class: o(e.ns.e("empty-block"))
|
|
30
|
+
}, [
|
|
31
|
+
g(e.$slots, "empty", {}, () => [
|
|
32
|
+
t("span", {
|
|
33
|
+
class: o(e.ns.e("empty-text"))
|
|
34
|
+
}, h(e.emptyText ?? "暂无数据"), 3)
|
|
35
|
+
])
|
|
36
|
+
], 2)) : c("", !0),
|
|
37
|
+
u(t("div", {
|
|
38
|
+
ref: "dropIndicator$",
|
|
39
|
+
class: o(e.ns.e("drop-indicator"))
|
|
40
|
+
}, null, 2), [
|
|
41
|
+
[f, e.dragState.showDropIndicator]
|
|
42
|
+
])
|
|
43
|
+
], 2);
|
|
44
|
+
}
|
|
45
|
+
const D = /* @__PURE__ */ y(s, [["render", k]]);
|
|
46
|
+
export {
|
|
47
|
+
D as default
|
|
48
|
+
};
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { defineComponent as $, ref as l, computed as j, watch as u, provide as f, getCurrentInstance as _ } from "vue";
|
|
2
|
+
import { useNamespace as R } from "../../hooks/use-namespace/index.js";
|
|
3
|
+
import "@popperjs/core";
|
|
4
|
+
import "lodash";
|
|
5
|
+
import "../../hooks/use-z-index/index.js";
|
|
6
|
+
import "@vueuse/core";
|
|
7
|
+
import "@vft/utils";
|
|
8
|
+
import "../../utils/ns-cover.js";
|
|
9
|
+
import "../form/index.js";
|
|
10
|
+
import U from "./model/tree-store.js";
|
|
11
|
+
import { getNodeKey as V, handleCurrentChange as K } from "./model/util.js";
|
|
12
|
+
import G from "./tree-node.vue.js";
|
|
13
|
+
import { useNodeExpandEventBroadcast as J } from "./model/useNodeExpandEventBroadcast.js";
|
|
14
|
+
import { useDragNodeHandler as L } from "./model/useDragNode.js";
|
|
15
|
+
import { useKeydown as Q } from "./model/useKeydown.js";
|
|
16
|
+
import { formItemContextKey as W } from "../form/constants.js";
|
|
17
|
+
const he = $({
|
|
18
|
+
name: "VftTree",
|
|
19
|
+
components: { TreeNode: G },
|
|
20
|
+
props: {
|
|
21
|
+
data: {
|
|
22
|
+
type: Array,
|
|
23
|
+
default: () => []
|
|
24
|
+
},
|
|
25
|
+
emptyText: {
|
|
26
|
+
type: String
|
|
27
|
+
},
|
|
28
|
+
renderAfterExpand: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: !0
|
|
31
|
+
},
|
|
32
|
+
nodeKey: String,
|
|
33
|
+
checkStrictly: Boolean,
|
|
34
|
+
defaultExpandAll: Boolean,
|
|
35
|
+
expandOnClickNode: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: !0
|
|
38
|
+
},
|
|
39
|
+
checkOnClickNode: Boolean,
|
|
40
|
+
checkDescendants: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: !1
|
|
43
|
+
},
|
|
44
|
+
autoExpandParent: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: !0
|
|
47
|
+
},
|
|
48
|
+
defaultCheckedKeys: Array,
|
|
49
|
+
defaultExpandedKeys: Array,
|
|
50
|
+
currentNodeKey: [String, Number],
|
|
51
|
+
renderContent: Function,
|
|
52
|
+
showCheckbox: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: !1
|
|
55
|
+
},
|
|
56
|
+
draggable: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: !1
|
|
59
|
+
},
|
|
60
|
+
allowDrag: Function,
|
|
61
|
+
allowDrop: Function,
|
|
62
|
+
props: {
|
|
63
|
+
type: Object,
|
|
64
|
+
default: () => ({
|
|
65
|
+
children: "children",
|
|
66
|
+
label: "label",
|
|
67
|
+
disabled: "disabled"
|
|
68
|
+
})
|
|
69
|
+
},
|
|
70
|
+
lazy: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: !1
|
|
73
|
+
},
|
|
74
|
+
highlightCurrent: Boolean,
|
|
75
|
+
load: Function,
|
|
76
|
+
filterNodeMethod: Function,
|
|
77
|
+
accordion: Boolean,
|
|
78
|
+
indent: {
|
|
79
|
+
type: Number,
|
|
80
|
+
default: 18
|
|
81
|
+
},
|
|
82
|
+
icon: {
|
|
83
|
+
type: Object
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
emits: [
|
|
87
|
+
"check-change",
|
|
88
|
+
"current-change",
|
|
89
|
+
"node-click",
|
|
90
|
+
"node-contextmenu",
|
|
91
|
+
"node-collapse",
|
|
92
|
+
"node-expand",
|
|
93
|
+
"check",
|
|
94
|
+
"node-drag-start",
|
|
95
|
+
"node-drag-end",
|
|
96
|
+
"node-drop",
|
|
97
|
+
"node-drag-leave",
|
|
98
|
+
"node-drag-enter",
|
|
99
|
+
"node-drag-over"
|
|
100
|
+
],
|
|
101
|
+
setup(t, o) {
|
|
102
|
+
const C = R("tree"), n = l(
|
|
103
|
+
new U({
|
|
104
|
+
key: t.nodeKey,
|
|
105
|
+
data: t.data,
|
|
106
|
+
lazy: t.lazy,
|
|
107
|
+
props: t.props,
|
|
108
|
+
load: t.load,
|
|
109
|
+
currentNodeKey: t.currentNodeKey,
|
|
110
|
+
checkStrictly: t.checkStrictly,
|
|
111
|
+
checkDescendants: t.checkDescendants,
|
|
112
|
+
defaultCheckedKeys: t.defaultCheckedKeys,
|
|
113
|
+
defaultExpandedKeys: t.defaultExpandedKeys,
|
|
114
|
+
autoExpandParent: t.autoExpandParent,
|
|
115
|
+
defaultExpandAll: t.defaultExpandAll,
|
|
116
|
+
filterNodeMethod: t.filterNodeMethod
|
|
117
|
+
})
|
|
118
|
+
);
|
|
119
|
+
n.value.initialize();
|
|
120
|
+
const c = l(n.value.root), s = l(null), i = l(null), y = l(null), { broadcastExpanded: m } = J(t), { dragState: N } = L({
|
|
121
|
+
props: t,
|
|
122
|
+
ctx: o,
|
|
123
|
+
el$: i,
|
|
124
|
+
dropIndicator$: y,
|
|
125
|
+
store: n
|
|
126
|
+
});
|
|
127
|
+
Q({ el$: i }, n);
|
|
128
|
+
const g = j(() => {
|
|
129
|
+
const { childNodes: e } = c.value;
|
|
130
|
+
return !e || e.length === 0 || e.every(({ visible: r }) => !r);
|
|
131
|
+
});
|
|
132
|
+
u(
|
|
133
|
+
() => t.currentNodeKey,
|
|
134
|
+
(e) => {
|
|
135
|
+
n.value.setCurrentNodeKey(e);
|
|
136
|
+
}
|
|
137
|
+
), u(
|
|
138
|
+
() => t.defaultCheckedKeys,
|
|
139
|
+
(e) => {
|
|
140
|
+
n.value.setDefaultCheckedKey(e);
|
|
141
|
+
}
|
|
142
|
+
), u(
|
|
143
|
+
() => t.defaultExpandedKeys,
|
|
144
|
+
(e) => {
|
|
145
|
+
n.value.setDefaultExpandedKeys(e);
|
|
146
|
+
}
|
|
147
|
+
), u(
|
|
148
|
+
() => t.data,
|
|
149
|
+
(e) => {
|
|
150
|
+
n.value.setData(e);
|
|
151
|
+
},
|
|
152
|
+
{ deep: !0 }
|
|
153
|
+
), u(
|
|
154
|
+
() => t.checkStrictly,
|
|
155
|
+
(e) => {
|
|
156
|
+
n.value.checkStrictly = e;
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
const k = (e) => {
|
|
160
|
+
if (!t.filterNodeMethod)
|
|
161
|
+
throw new Error("[Tree] filterNodeMethod is required when filter");
|
|
162
|
+
n.value.filter(e);
|
|
163
|
+
}, v = (e) => V(t.nodeKey, e.data), E = (e) => {
|
|
164
|
+
if (!t.nodeKey)
|
|
165
|
+
throw new Error("[Tree] nodeKey is required in getNodePath");
|
|
166
|
+
const r = n.value.getNode(e);
|
|
167
|
+
if (!r)
|
|
168
|
+
return [];
|
|
169
|
+
const d = [r.data];
|
|
170
|
+
let a = r.parent;
|
|
171
|
+
for (; a && a !== c.value; )
|
|
172
|
+
d.push(a.data), a = a.parent;
|
|
173
|
+
return d.reverse();
|
|
174
|
+
}, w = (e, r) => n.value.getCheckedNodes(e, r), p = (e) => n.value.getCheckedKeys(e), h = () => {
|
|
175
|
+
const e = n.value.getCurrentNode();
|
|
176
|
+
return e ? e.data : null;
|
|
177
|
+
}, x = () => {
|
|
178
|
+
if (!t.nodeKey)
|
|
179
|
+
throw new Error("[Tree] nodeKey is required in getCurrentKey");
|
|
180
|
+
const e = h();
|
|
181
|
+
return e ? e[t.nodeKey] : null;
|
|
182
|
+
}, B = (e, r) => {
|
|
183
|
+
if (!t.nodeKey)
|
|
184
|
+
throw new Error("[Tree] nodeKey is required in setCheckedNodes");
|
|
185
|
+
n.value.setCheckedNodes(e, r);
|
|
186
|
+
}, T = (e, r) => {
|
|
187
|
+
if (!t.nodeKey)
|
|
188
|
+
throw new Error("[Tree] nodeKey is required in setCheckedKeys");
|
|
189
|
+
n.value.setCheckedKeys(e, r);
|
|
190
|
+
}, b = (e, r, d) => {
|
|
191
|
+
n.value.setChecked(e, r, d);
|
|
192
|
+
}, S = () => n.value.getHalfCheckedNodes(), A = () => n.value.getHalfCheckedKeys(), D = (e, r = !0) => {
|
|
193
|
+
if (!t.nodeKey)
|
|
194
|
+
throw new Error("[Tree] nodeKey is required in setCurrentNode");
|
|
195
|
+
K(
|
|
196
|
+
n,
|
|
197
|
+
o.emit,
|
|
198
|
+
() => n.value.setUserCurrentNode(e, r)
|
|
199
|
+
);
|
|
200
|
+
}, q = (e, r = !0) => {
|
|
201
|
+
if (!t.nodeKey)
|
|
202
|
+
throw new Error("[Tree] nodeKey is required in setCurrentKey");
|
|
203
|
+
K(
|
|
204
|
+
n,
|
|
205
|
+
o.emit,
|
|
206
|
+
() => n.value.setCurrentNodeKey(e, r)
|
|
207
|
+
);
|
|
208
|
+
}, F = (e) => n.value.getNode(e), H = (e) => {
|
|
209
|
+
n.value.remove(e);
|
|
210
|
+
}, M = (e, r) => {
|
|
211
|
+
n.value.append(e, r);
|
|
212
|
+
}, P = (e, r) => {
|
|
213
|
+
n.value.insertBefore(e, r);
|
|
214
|
+
}, z = (e, r) => {
|
|
215
|
+
n.value.insertAfter(e, r);
|
|
216
|
+
}, O = (e, r, d) => {
|
|
217
|
+
m(r), o.emit("node-expand", e, r, d);
|
|
218
|
+
}, I = (e, r) => {
|
|
219
|
+
if (!t.nodeKey)
|
|
220
|
+
throw new Error("[Tree] nodeKey is required in updateKeyChild");
|
|
221
|
+
n.value.updateChildren(e, r);
|
|
222
|
+
};
|
|
223
|
+
return f("RootTree", {
|
|
224
|
+
ctx: o,
|
|
225
|
+
props: t,
|
|
226
|
+
store: n,
|
|
227
|
+
root: c,
|
|
228
|
+
currentNode: s,
|
|
229
|
+
instance: _()
|
|
230
|
+
}), f(W, void 0), {
|
|
231
|
+
ns: C,
|
|
232
|
+
// ref
|
|
233
|
+
store: n,
|
|
234
|
+
root: c,
|
|
235
|
+
currentNode: s,
|
|
236
|
+
dragState: N,
|
|
237
|
+
el$: i,
|
|
238
|
+
dropIndicator$: y,
|
|
239
|
+
// computed
|
|
240
|
+
isEmpty: g,
|
|
241
|
+
// methods
|
|
242
|
+
filter: k,
|
|
243
|
+
getNodeKey: v,
|
|
244
|
+
getNodePath: E,
|
|
245
|
+
getCheckedNodes: w,
|
|
246
|
+
getCheckedKeys: p,
|
|
247
|
+
getCurrentNode: h,
|
|
248
|
+
getCurrentKey: x,
|
|
249
|
+
setCheckedNodes: B,
|
|
250
|
+
setCheckedKeys: T,
|
|
251
|
+
setChecked: b,
|
|
252
|
+
getHalfCheckedNodes: S,
|
|
253
|
+
getHalfCheckedKeys: A,
|
|
254
|
+
setCurrentNode: D,
|
|
255
|
+
setCurrentKey: q,
|
|
256
|
+
getNode: F,
|
|
257
|
+
remove: H,
|
|
258
|
+
append: M,
|
|
259
|
+
insertBefore: P,
|
|
260
|
+
insertAfter: z,
|
|
261
|
+
handleNodeExpand: O,
|
|
262
|
+
updateKeyChildren: I
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
export {
|
|
267
|
+
he as default
|
|
268
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { defineComponent as r, inject as s, watch as n } from "vue";
|
|
2
|
+
import "../select/index.js";
|
|
3
|
+
import { selectKey as i } from "../select/token.js";
|
|
4
|
+
const u = r({
|
|
5
|
+
props: {
|
|
6
|
+
data: {
|
|
7
|
+
type: Array,
|
|
8
|
+
default: () => []
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
setup(a) {
|
|
12
|
+
const e = s(i);
|
|
13
|
+
return n(
|
|
14
|
+
() => a.data,
|
|
15
|
+
() => {
|
|
16
|
+
var o;
|
|
17
|
+
a.data.forEach((t) => {
|
|
18
|
+
e.cachedOptions.has(t.value) || e.cachedOptions.set(t.value, t);
|
|
19
|
+
});
|
|
20
|
+
const c = ((o = e.selectWrapper) == null ? void 0 : o.querySelectorAll("input")) || [];
|
|
21
|
+
Array.from(c).includes(
|
|
22
|
+
document.activeElement
|
|
23
|
+
) || e.setSelected();
|
|
24
|
+
},
|
|
25
|
+
{ flush: "post", immediate: !0 }
|
|
26
|
+
), () => {
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
export {
|
|
31
|
+
u as default
|
|
32
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { toRefs as m, computed as s, nextTick as c } from "vue";
|
|
2
|
+
import { pick as n } from "lodash";
|
|
3
|
+
import { VftSelect as u } from "../select/index.js";
|
|
4
|
+
import { useNamespace as h } from "../../hooks/use-namespace/index.js";
|
|
5
|
+
import "@popperjs/core";
|
|
6
|
+
import "../../hooks/use-z-index/index.js";
|
|
7
|
+
import "@vueuse/core";
|
|
8
|
+
import "@vft/utils";
|
|
9
|
+
import "../../utils/ns-cover.js";
|
|
10
|
+
const x = (o, { attrs: i }, {
|
|
11
|
+
tree: l,
|
|
12
|
+
key: p
|
|
13
|
+
}) => {
|
|
14
|
+
const f = h("tree-select"), r = {
|
|
15
|
+
...n(m(o), Object.keys(u.props)),
|
|
16
|
+
...i,
|
|
17
|
+
valueKey: p,
|
|
18
|
+
popperClass: s(() => {
|
|
19
|
+
const e = [f.e("popper")];
|
|
20
|
+
return o.popperClass && e.push(o.popperClass), e.join(" ");
|
|
21
|
+
}),
|
|
22
|
+
filterMethod: (e = "") => {
|
|
23
|
+
o.filterMethod && o.filterMethod(e), c(() => {
|
|
24
|
+
var t;
|
|
25
|
+
(t = l.value) == null || t.filter(e);
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
// clear filter text when visible change
|
|
29
|
+
onVisibleChange: (e) => {
|
|
30
|
+
var t;
|
|
31
|
+
(t = i.onVisibleChange) == null || t.call(i, e), o.filterable && e && r.filterMethod();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return r;
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
x as useSelect
|
|
38
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "vft/theme-style/base.css";
|
|
2
|
+
import "vft/theme-style/vft-input.css";
|
|
3
|
+
import "vft/theme-style/vft-tag.css";
|
|
4
|
+
import "vft/theme-style/el-option.css";
|
|
5
|
+
import "vft/theme-style/el-option-group.css";
|
|
6
|
+
import "vft/theme-style/vft-scrollbar.css";
|
|
7
|
+
import "vft/theme-style/vft-popper.css";
|
|
8
|
+
import "vft/theme-style/el-select.css";
|
|
9
|
+
import "vft/theme-style/vft-checkbox.css";
|
|
10
|
+
import "vft/theme-style/vft-tree.css";
|
|
11
|
+
import "vft/theme-style/el-tree-select.css";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "vft/theme-style/src/base.scss";
|
|
2
|
+
import "vft/theme-style/src/input.scss";
|
|
3
|
+
import "vft/theme-style/src/tag.scss";
|
|
4
|
+
import "vft/theme-style/src/option.scss";
|
|
5
|
+
import "vft/theme-style/src/option-group.scss";
|
|
6
|
+
import "vft/theme-style/src/scrollbar.scss";
|
|
7
|
+
import "vft/theme-style/src/popper.scss";
|
|
8
|
+
import "vft/theme-style/src/select.scss";
|
|
9
|
+
import "vft/theme-style/src/checkbox.scss";
|
|
10
|
+
import "vft/theme-style/src/tree.scss";
|
|
11
|
+
import "vft/theme-style/src/tree-select.scss";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineComponent as s, getCurrentInstance as i, nextTick as p } from "vue";
|
|
2
|
+
import { VftOption as n } from "../select/index.js";
|
|
3
|
+
const m = s({
|
|
4
|
+
extends: n,
|
|
5
|
+
setup(o, c) {
|
|
6
|
+
const e = n.setup(o, c);
|
|
7
|
+
delete e.selectOptionClick;
|
|
8
|
+
const t = i().proxy;
|
|
9
|
+
return p(() => {
|
|
10
|
+
e.select.cachedOptions.get(t.value) || e.select.onOptionCreate(t);
|
|
11
|
+
}), e;
|
|
12
|
+
},
|
|
13
|
+
methods: {
|
|
14
|
+
selectOptionClick() {
|
|
15
|
+
this.$el.parentElement.click();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
export {
|
|
20
|
+
m as default
|
|
21
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { defineComponent as k, ref as f, computed as v, reactive as c, onMounted as g, h as a } from "vue";
|
|
2
|
+
import { pick as u } from "lodash";
|
|
3
|
+
import { VftSelect as l } from "../select/index.js";
|
|
4
|
+
import p from "../tree/index.js";
|
|
5
|
+
import { useSelect as K } from "./select.js";
|
|
6
|
+
import { useTree as N } from "./tree.js";
|
|
7
|
+
import A from "./cache-options.js";
|
|
8
|
+
const V = k({
|
|
9
|
+
name: "VftTreeSelect",
|
|
10
|
+
// disable `ElSelect` inherit current attrs
|
|
11
|
+
inheritAttrs: !1,
|
|
12
|
+
props: {
|
|
13
|
+
...l.props,
|
|
14
|
+
...p.props,
|
|
15
|
+
cacheData: {
|
|
16
|
+
type: Array,
|
|
17
|
+
default: () => []
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
setup(e, o) {
|
|
21
|
+
const { slots: i, expose: m } = o, t = f(), r = f(), n = v(() => e.nodeKey || e.valueKey || "value"), h = K(e, o, { select: t, tree: r, key: n }), { cacheOptions: C, ...y } = N(e, o, {
|
|
22
|
+
select: t,
|
|
23
|
+
tree: r,
|
|
24
|
+
key: n
|
|
25
|
+
}), d = c({});
|
|
26
|
+
return m(d), g(() => {
|
|
27
|
+
Object.assign(d, {
|
|
28
|
+
...u(r.value, [
|
|
29
|
+
"filter",
|
|
30
|
+
"updateKeyChildren",
|
|
31
|
+
"getCheckedNodes",
|
|
32
|
+
"setCheckedNodes",
|
|
33
|
+
"getCheckedKeys",
|
|
34
|
+
"setCheckedKeys",
|
|
35
|
+
"setChecked",
|
|
36
|
+
"getHalfCheckedNodes",
|
|
37
|
+
"getHalfCheckedKeys",
|
|
38
|
+
"getCurrentKey",
|
|
39
|
+
"getCurrentNode",
|
|
40
|
+
"setCurrentKey",
|
|
41
|
+
"setCurrentNode",
|
|
42
|
+
"getNode",
|
|
43
|
+
"remove",
|
|
44
|
+
"append",
|
|
45
|
+
"insertBefore",
|
|
46
|
+
"insertAfter"
|
|
47
|
+
]),
|
|
48
|
+
...u(t.value, ["focus", "blur"])
|
|
49
|
+
});
|
|
50
|
+
}), () => a(
|
|
51
|
+
l,
|
|
52
|
+
/**
|
|
53
|
+
* 1. The `props` is processed into `Refs`, but `v-bind` and
|
|
54
|
+
* render function props cannot read `Refs`, so use `reactive`
|
|
55
|
+
* unwrap the `Refs` and keep reactive.
|
|
56
|
+
* 2. The keyword `ref` requires `Ref`, but `reactive` broke it,
|
|
57
|
+
* so use function.
|
|
58
|
+
*/
|
|
59
|
+
c({
|
|
60
|
+
...h,
|
|
61
|
+
ref: (s) => t.value = s
|
|
62
|
+
}),
|
|
63
|
+
{
|
|
64
|
+
...i,
|
|
65
|
+
default: () => [
|
|
66
|
+
a(A, { data: C.value }),
|
|
67
|
+
a(
|
|
68
|
+
p,
|
|
69
|
+
c({
|
|
70
|
+
...y,
|
|
71
|
+
ref: (s) => r.value = s
|
|
72
|
+
})
|
|
73
|
+
)
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
export {
|
|
80
|
+
V as default
|
|
81
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { watch as K, nextTick as O, computed as r, toRefs as L } from "vue";
|
|
2
|
+
import { isEqual as g, pick as M } from "lodash";
|
|
3
|
+
import { UPDATE_MODEL_EVENT as m } from "../../constants/event.js";
|
|
4
|
+
import { isFunction as T } from "@vft/utils";
|
|
5
|
+
import w from "../tree/index.js";
|
|
6
|
+
import A from "./tree-select-option.js";
|
|
7
|
+
import { toValidArray as v, treeFind as y, isValidValue as V, treeEach as D, isValidArray as S } from "./utils.js";
|
|
8
|
+
const B = (e, { attrs: a, slots: C, emit: f }, {
|
|
9
|
+
select: b,
|
|
10
|
+
tree: h,
|
|
11
|
+
key: s
|
|
12
|
+
}) => {
|
|
13
|
+
K(
|
|
14
|
+
() => e.modelValue,
|
|
15
|
+
() => {
|
|
16
|
+
e.showCheckbox && O(() => {
|
|
17
|
+
const l = h.value;
|
|
18
|
+
l && !g(
|
|
19
|
+
l.getCheckedKeys(),
|
|
20
|
+
v(e.modelValue)
|
|
21
|
+
) && l.setCheckedKeys(v(e.modelValue));
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
immediate: !0,
|
|
26
|
+
deep: !0
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
const E = r(() => ({
|
|
30
|
+
value: s.value,
|
|
31
|
+
label: "label",
|
|
32
|
+
children: "children",
|
|
33
|
+
disabled: "disabled",
|
|
34
|
+
isLeaf: "isLeaf",
|
|
35
|
+
...e.props
|
|
36
|
+
})), n = (l, i) => {
|
|
37
|
+
var c;
|
|
38
|
+
const d = E.value[l];
|
|
39
|
+
return T(d) ? d(
|
|
40
|
+
i,
|
|
41
|
+
(c = h.value) == null ? void 0 : c.getNode(n("value", i))
|
|
42
|
+
) : i[d];
|
|
43
|
+
}, x = v(e.modelValue).map((l) => y(
|
|
44
|
+
e.data || [],
|
|
45
|
+
(i) => n("value", i) === l,
|
|
46
|
+
(i) => n("children", i),
|
|
47
|
+
(i, d, c, t) => t && n("value", t)
|
|
48
|
+
)).filter((l) => V(l)), N = r(() => {
|
|
49
|
+
if (!e.renderAfterExpand && !e.lazy)
|
|
50
|
+
return [];
|
|
51
|
+
const l = [];
|
|
52
|
+
return D(
|
|
53
|
+
e.data.concat(e.cacheData),
|
|
54
|
+
(i) => {
|
|
55
|
+
const d = n("value", i);
|
|
56
|
+
l.push({
|
|
57
|
+
value: d,
|
|
58
|
+
currentLabel: n("label", i),
|
|
59
|
+
isDisabled: n("disabled", i)
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
(i) => n("children", i)
|
|
63
|
+
), l;
|
|
64
|
+
});
|
|
65
|
+
return {
|
|
66
|
+
...M(L(e), Object.keys(w.props)),
|
|
67
|
+
...a,
|
|
68
|
+
nodeKey: s,
|
|
69
|
+
// only expand on click node when the `check-strictly` is false
|
|
70
|
+
expandOnClickNode: r(() => !e.checkStrictly && e.expandOnClickNode),
|
|
71
|
+
// show current selected node only first time,
|
|
72
|
+
// fix the problem of expanding multiple nodes when checking multiple nodes
|
|
73
|
+
defaultExpandedKeys: r(() => e.defaultExpandedKeys ? e.defaultExpandedKeys.concat(x) : x),
|
|
74
|
+
renderContent: (l, { node: i, data: d, store: c }) => l(
|
|
75
|
+
A,
|
|
76
|
+
{
|
|
77
|
+
value: n("value", d),
|
|
78
|
+
label: n("label", d),
|
|
79
|
+
disabled: n("disabled", d)
|
|
80
|
+
},
|
|
81
|
+
e.renderContent ? () => e.renderContent(l, { node: i, data: d, store: c }) : C.default ? () => C.default({ node: i, data: d, store: c }) : void 0
|
|
82
|
+
),
|
|
83
|
+
filterNodeMethod: (l, i, d) => {
|
|
84
|
+
var c;
|
|
85
|
+
return e.filterNodeMethod ? e.filterNodeMethod(l, i, d) : l ? (c = n("label", i)) == null ? void 0 : c.includes(l) : !0;
|
|
86
|
+
},
|
|
87
|
+
onNodeClick: (l, i, d) => {
|
|
88
|
+
var c, t, o;
|
|
89
|
+
if ((c = a.onNodeClick) == null || c.call(a, l, i, d), !(e.showCheckbox && e.checkOnClickNode))
|
|
90
|
+
if (!e.showCheckbox && (e.checkStrictly || i.isLeaf)) {
|
|
91
|
+
if (!n("disabled", l)) {
|
|
92
|
+
const k = (t = b.value) == null ? void 0 : t.options.get(
|
|
93
|
+
n("value", l)
|
|
94
|
+
);
|
|
95
|
+
(o = b.value) == null || o.handleOptionSelect(k, !0);
|
|
96
|
+
}
|
|
97
|
+
} else
|
|
98
|
+
e.expandOnClickNode && d.proxy.handleExpandIconClick();
|
|
99
|
+
},
|
|
100
|
+
onCheck: (l, i) => {
|
|
101
|
+
var c;
|
|
102
|
+
(c = a.onCheck) == null || c.call(a, l, i);
|
|
103
|
+
const d = n("value", l);
|
|
104
|
+
if (e.checkStrictly)
|
|
105
|
+
f(
|
|
106
|
+
m,
|
|
107
|
+
// Checking for changes may come from `check-on-node-click`
|
|
108
|
+
e.multiple ? i.checkedKeys : i.checkedKeys.includes(d) ? d : void 0
|
|
109
|
+
);
|
|
110
|
+
else if (e.multiple)
|
|
111
|
+
f(
|
|
112
|
+
m,
|
|
113
|
+
h.value.getCheckedKeys(!0)
|
|
114
|
+
);
|
|
115
|
+
else {
|
|
116
|
+
const t = y(
|
|
117
|
+
[l],
|
|
118
|
+
(u) => !S(n("children", u)) && !n("disabled", u),
|
|
119
|
+
(u) => n("children", u)
|
|
120
|
+
), o = t ? n("value", t) : void 0, k = V(e.modelValue) && !!y(
|
|
121
|
+
[l],
|
|
122
|
+
(u) => n("value", u) === e.modelValue,
|
|
123
|
+
(u) => n("children", u)
|
|
124
|
+
);
|
|
125
|
+
f(
|
|
126
|
+
m,
|
|
127
|
+
o === e.modelValue || k ? void 0 : o
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
// else
|
|
132
|
+
cacheOptions: N
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
export {
|
|
136
|
+
B as useTree
|
|
137
|
+
};
|