x-next 1.13.0 → 1.15.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/AI_CODING.md +6 -5
- package/AI_USAGE/catalog.md +108 -105
- package/AI_USAGE/components/alert-api.md +48 -0
- package/AI_USAGE/components/alert.md +222 -3
- package/AI_USAGE/components/bar-chart-api.md +177 -0
- package/AI_USAGE/components/bar-chart.md +297 -3
- package/AI_USAGE/components/boxicons.md +147 -0
- package/AI_USAGE/components/button-api.md +144 -0
- package/AI_USAGE/components/button.md +447 -3
- package/AI_USAGE/components/charts.md +81 -0
- package/AI_USAGE/components/checkbox-api.md +145 -0
- package/AI_USAGE/components/checkbox.md +365 -3
- package/AI_USAGE/components/color-picker-api.md +52 -0
- package/AI_USAGE/components/color-picker.md +211 -3
- package/AI_USAGE/components/config-provider-api.md +38 -0
- package/AI_USAGE/components/config-provider.md +250 -3
- package/AI_USAGE/components/date-picker-api.md +1114 -0
- package/AI_USAGE/components/date-picker.md +378 -3
- package/AI_USAGE/components/dialog-api.md +142 -0
- package/AI_USAGE/components/dialog.md +284 -3
- package/AI_USAGE/components/draggable-api.md +146 -0
- package/AI_USAGE/components/draggable.md +259 -0
- package/AI_USAGE/components/drawer-api.md +78 -0
- package/AI_USAGE/components/drawer.md +256 -0
- package/AI_USAGE/components/dropdown-api.md +529 -0
- package/AI_USAGE/components/dropdown.md +392 -3
- package/AI_USAGE/components/empty-api.md +36 -0
- package/AI_USAGE/components/empty.md +227 -3
- package/AI_USAGE/components/finicon.md +88 -0
- package/AI_USAGE/components/form-api.md +524 -0
- package/AI_USAGE/components/form.md +454 -0
- package/AI_USAGE/components/grid-api.md +527 -0
- package/AI_USAGE/components/grid.md +224 -0
- package/AI_USAGE/components/heatmap-api.md +122 -0
- package/AI_USAGE/components/heatmap.md +220 -0
- package/AI_USAGE/components/icon-api.md +4707 -0
- package/AI_USAGE/components/icon.md +257 -0
- package/AI_USAGE/components/image-api.md +440 -0
- package/AI_USAGE/components/image.md +465 -0
- package/AI_USAGE/components/input-api.md +184 -0
- package/AI_USAGE/components/input-number-api.md +66 -0
- package/AI_USAGE/components/input-number.md +294 -0
- package/AI_USAGE/components/input-tag-api.md +114 -0
- package/AI_USAGE/components/input-tag.md +482 -0
- package/AI_USAGE/components/input.md +293 -3
- package/AI_USAGE/components/layout-api.md +147 -0
- package/AI_USAGE/components/layout.md +230 -0
- package/AI_USAGE/components/line-chart-api.md +197 -0
- package/AI_USAGE/components/line-chart.md +306 -3
- package/AI_USAGE/components/link-api.md +42 -0
- package/AI_USAGE/components/link.md +197 -0
- package/AI_USAGE/components/menu-api.md +516 -0
- package/AI_USAGE/components/menu.md +268 -0
- package/AI_USAGE/components/message-api.md +215 -0
- package/AI_USAGE/components/message-box-api.md +108 -0
- package/AI_USAGE/components/message-box.md +268 -3
- package/AI_USAGE/components/message.md +231 -3
- package/AI_USAGE/components/network-api.md +91 -0
- package/AI_USAGE/components/network.md +378 -0
- package/AI_USAGE/components/notification-api.md +236 -0
- package/AI_USAGE/components/notification.md +275 -3
- package/AI_USAGE/components/pagination-api.md +62 -0
- package/AI_USAGE/components/pagination.md +380 -3
- package/AI_USAGE/components/pie-chart-api.md +109 -0
- package/AI_USAGE/components/pie-chart.md +245 -3
- package/AI_USAGE/components/popconfirm-api.md +75 -0
- package/AI_USAGE/components/popconfirm.md +231 -3
- package/AI_USAGE/components/popover-api.md +75 -0
- package/AI_USAGE/components/popover.md +208 -3
- package/AI_USAGE/components/popup-api.md +75 -0
- package/AI_USAGE/components/popup.md +52 -0
- package/AI_USAGE/components/progress-api.md +44 -0
- package/AI_USAGE/components/progress.md +248 -3
- package/AI_USAGE/components/radio-api.md +165 -0
- package/AI_USAGE/components/radio.md +259 -3
- package/AI_USAGE/components/rate-api.md +54 -0
- package/AI_USAGE/components/rate.md +233 -3
- package/AI_USAGE/components/resize-box-api.md +56 -0
- package/AI_USAGE/components/resize-box.md +231 -0
- package/AI_USAGE/components/scrollbar-api.md +77 -0
- package/AI_USAGE/components/scrollbar.md +218 -0
- package/AI_USAGE/components/select-api.md +758 -0
- package/AI_USAGE/components/select.md +640 -3
- package/AI_USAGE/components/skeleton-api.md +85 -0
- package/AI_USAGE/components/skeleton.md +150 -0
- package/AI_USAGE/components/slider-api.md +51 -0
- package/AI_USAGE/components/slider.md +233 -3
- package/AI_USAGE/components/space-api.md +38 -0
- package/AI_USAGE/components/space.md +145 -0
- package/AI_USAGE/components/spin-api.md +43 -0
- package/AI_USAGE/components/spin.md +205 -0
- package/AI_USAGE/components/steps-api.md +111 -0
- package/AI_USAGE/components/steps.md +201 -3
- package/AI_USAGE/components/switch-api.md +58 -0
- package/AI_USAGE/components/switch.md +290 -3
- package/AI_USAGE/components/table-api.md +2919 -0
- package/AI_USAGE/components/table.md +1457 -0
- package/AI_USAGE/components/tabs-api.md +135 -0
- package/AI_USAGE/components/tabs.md +308 -3
- package/AI_USAGE/components/tag-api.md +124 -0
- package/AI_USAGE/components/tag.md +292 -0
- package/AI_USAGE/components/textarea-api.md +55 -0
- package/AI_USAGE/components/textarea.md +326 -3
- package/AI_USAGE/components/time-picker-api.md +137 -0
- package/AI_USAGE/components/time-picker.md +271 -3
- package/AI_USAGE/components/time-range-selector-api.md +44 -0
- package/AI_USAGE/components/time-range-selector.md +355 -0
- package/AI_USAGE/components/timeline-api.md +93 -0
- package/AI_USAGE/components/timeline.md +312 -0
- package/AI_USAGE/components/tooltip-api.md +77 -0
- package/AI_USAGE/components/tooltip.md +182 -0
- package/AI_USAGE/components/tree-select-api.md +498 -0
- package/AI_USAGE/components/tree-select.md +744 -0
- package/AI_USAGE/components/trend-chart-api.md +119 -0
- package/AI_USAGE/components/trend-chart.md +335 -0
- package/AI_USAGE/components/trigger-api.md +124 -0
- package/AI_USAGE/components/trigger.md +185 -0
- package/AI_USAGE/components/upload-api.md +200 -0
- package/AI_USAGE/components/upload.md +711 -3
- package/AI_USAGE/components/watermark-api.md +87 -0
- package/AI_USAGE/components/watermark.md +200 -0
- package/AI_USAGE/core.md +1 -1
- package/AI_USAGE/index.md +36 -7
- package/AI_USAGE/recipes/form-on-demand.md +1 -1
- package/AI_USAGE.md +34972 -5
- package/CHANGELOG.md +39 -0
- package/dist/_props/css.d.ts +2 -1
- package/dist/_utils/inherit-component-type.d.ts +11 -0
- package/dist/components/bar-chart/BarChart.d.ts +1 -1
- package/dist/components/bar-chart/index.d.ts +3 -3
- package/dist/components/date-picker/index.d.ts +420 -5
- package/dist/components/form-input/index.d.ts +617 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/layout/index.d.ts +689 -1
- package/dist/components/line-chart/LineChart.d.ts +1 -1
- package/dist/components/line-chart/index.d.ts +3 -3
- package/dist/components/line-chart/interface.d.ts +2 -2
- package/dist/components/menu/index.d.ts +786 -1
- package/dist/components/tree-select/TreeNode.vue.d.ts +478 -0
- package/dist/components/tree-select/TreeSelect.d.ts +1549 -0
- package/dist/components/tree-select/TreeSelectDropdown.vue.d.ts +569 -0
- package/dist/components/tree-select/hooks/use-tree-select.d.ts +92 -0
- package/dist/components/tree-select/index.d.ts +3321 -0
- package/dist/components/tree-select/interface.d.ts +203 -0
- package/dist/components/tree-select/utils.d.ts +64 -0
- package/dist/es/_styles/palette-aliases.js +3 -0
- package/dist/es/_utils/inherit-component-type.js +6 -0
- package/dist/es/components/_components/feedback-icon/index.vue2.js +10 -10
- package/dist/es/components/button/Button.js +9 -9
- package/dist/es/components/date-picker/index.js +18 -17
- package/dist/es/components/drawer/src/Drawer.vue.js +6 -6
- package/dist/es/components/form-input/index.js +12 -11
- package/dist/es/components/form-switch/Switch.vue2.js +18 -18
- package/dist/es/components/image/Image.vue2.js +13 -13
- package/dist/es/components/image/ImagePreview.vue2.js +33 -33
- package/dist/es/components/index.js +55 -52
- package/dist/es/components/layout/index.js +10 -9
- package/dist/es/components/link/Link.vue2.js +12 -12
- package/dist/es/components/menu/hooks/use-level.js +5 -5
- package/dist/es/components/menu/index.js +13 -10
- package/dist/es/components/message/message.vue2.js +13 -13
- package/dist/es/components/spin/Spin.js +28 -28
- package/dist/es/components/tag/Tag.vue2.js +22 -22
- package/dist/es/components/timeline/src/Timeline.js +7 -7
- package/dist/es/components/tree-select/TreeNode.vue.js +91 -0
- package/dist/es/components/tree-select/TreeNode.vue2.js +162 -0
- package/dist/es/components/tree-select/TreeSelect.js +865 -0
- package/dist/es/components/tree-select/TreeSelectDropdown.vue.js +57 -0
- package/dist/es/components/tree-select/TreeSelectDropdown.vue2.js +79 -0
- package/dist/es/components/tree-select/hooks/use-tree-select.js +376 -0
- package/dist/es/components/tree-select/index.js +13 -0
- package/dist/es/components/tree-select/utils.js +181 -0
- package/dist/es/icons/animation/animation-loading.js +2 -2
- package/dist/es/index.js +71 -68
- package/dist/es/style.css +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.umd.js +3 -3
- package/dist/style/base.css +1 -1
- package/dist/style/dependencies.json +10 -0
- package/dist/style/drawer.css +1 -1
- package/dist/style/table.css +1 -1
- package/dist/style/tree-select.css +1 -0
- package/dist/style/tree-select.js +8 -0
- package/dist/style.css +1 -1
- package/dist/types.d.ts +2 -0
- package/package.json +11 -5
- package/volar.d.ts +2 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import i from "./TreeSelectDropdown.vue2.js";
|
|
2
|
+
import { resolveComponent as y, openBlock as s, createElementBlock as l, normalizeClass as o, renderSlot as r, createCommentVNode as t, createBlock as a, resolveDynamicComponent as m, Fragment as f, mergeProps as u, withCtx as v, createElementVNode as $ } from "vue";
|
|
3
|
+
import c from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const w = ["id"];
|
|
5
|
+
function k(e, n, h, N, C, E) {
|
|
6
|
+
const p = y("spin");
|
|
7
|
+
return s(), l("div", {
|
|
8
|
+
id: e.id,
|
|
9
|
+
class: o(e.cls),
|
|
10
|
+
role: "tree",
|
|
11
|
+
onKeydown: n[0] || (n[0] = (...d) => e.handleKeydown && e.handleKeydown(...d))
|
|
12
|
+
}, [
|
|
13
|
+
e.$slots.header && (!e.empty || e.showHeaderOnEmpty) ? (s(), l("div", {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: o(e.className.element("header"))
|
|
16
|
+
}, [
|
|
17
|
+
r(e.$slots, "header")
|
|
18
|
+
], 2)) : t("", !0),
|
|
19
|
+
e.loading ? (s(), a(p, {
|
|
20
|
+
key: 1,
|
|
21
|
+
class: o(e.className.element("loading"))
|
|
22
|
+
}, null, 8, ["class"])) : e.empty ? (s(), l("div", {
|
|
23
|
+
key: 2,
|
|
24
|
+
class: o(e.className.element("empty"))
|
|
25
|
+
}, [
|
|
26
|
+
r(e.$slots, "empty", {}, () => [
|
|
27
|
+
(s(), a(m("Empty"), { component: "tree-select" }))
|
|
28
|
+
])
|
|
29
|
+
], 2)) : (s(), l(f, { key: 3 }, [
|
|
30
|
+
e.virtualList ? r(e.$slots, "virtual-list", {}, void 0, void 0, 0) : (s(), a(m(e.displayScrollbar ? "ScrollbarComponent" : "div"), u({
|
|
31
|
+
key: 1,
|
|
32
|
+
ref: "wrapperComRef",
|
|
33
|
+
class: e.className.element("list-wrapper"),
|
|
34
|
+
style: e.wrapperStyle
|
|
35
|
+
}, e.scrollbarProps), {
|
|
36
|
+
default: v(() => [
|
|
37
|
+
$("ul", {
|
|
38
|
+
class: o(e.className.element("list"))
|
|
39
|
+
}, [
|
|
40
|
+
r(e.$slots, "default")
|
|
41
|
+
], 2)
|
|
42
|
+
]),
|
|
43
|
+
_: 3
|
|
44
|
+
}, 16, ["class", "style"]))
|
|
45
|
+
], 64)),
|
|
46
|
+
e.$slots.footer && (!e.empty || e.showFooterOnEmpty) ? (s(), l("div", {
|
|
47
|
+
key: 4,
|
|
48
|
+
class: o(e.className.element("footer"))
|
|
49
|
+
}, [
|
|
50
|
+
r(e.$slots, "footer")
|
|
51
|
+
], 2)) : t("", !0)
|
|
52
|
+
], 42, w);
|
|
53
|
+
}
|
|
54
|
+
const B = /* @__PURE__ */ c(i, [["render", k]]);
|
|
55
|
+
export {
|
|
56
|
+
B as default
|
|
57
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { defineComponent as y, toRefs as h, computed as n } from "vue";
|
|
2
|
+
import { Empty as w } from "../empty/index.js";
|
|
3
|
+
import { Spin as b } from "../spin/index.js";
|
|
4
|
+
import { Scrollbar as S } from "../scrollbar-v2/index.js";
|
|
5
|
+
import { useComponentRef as B } from "../../_hooks/use-component-ref.js";
|
|
6
|
+
import { useScrollbar as g } from "../../_hooks/use-scrollbar.js";
|
|
7
|
+
import { getClassNameMixin as x } from "../../_utils/config.js";
|
|
8
|
+
const N = y({
|
|
9
|
+
name: "TreeSelectDropdown",
|
|
10
|
+
components: {
|
|
11
|
+
ScrollbarComponent: S,
|
|
12
|
+
Empty: w,
|
|
13
|
+
Spin: b
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
id: String,
|
|
17
|
+
loading: Boolean,
|
|
18
|
+
empty: Boolean,
|
|
19
|
+
virtualList: Boolean,
|
|
20
|
+
showLine: Boolean,
|
|
21
|
+
scrollbar: {
|
|
22
|
+
type: [Boolean, Object],
|
|
23
|
+
default: !0
|
|
24
|
+
},
|
|
25
|
+
maxHeight: {
|
|
26
|
+
type: [Number, String]
|
|
27
|
+
},
|
|
28
|
+
onScroll: {
|
|
29
|
+
type: [Function, Array]
|
|
30
|
+
},
|
|
31
|
+
showHeaderOnEmpty: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: !1
|
|
34
|
+
},
|
|
35
|
+
showFooterOnEmpty: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: !1
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
emits: ["scroll", "keydown"],
|
|
41
|
+
setup(r, { emit: l, slots: a }) {
|
|
42
|
+
const { scrollbar: m } = h(r), e = x("tree-select--dropdown"), { componentRef: t } = B("containerRef"), { displayScrollbar: s, scrollbarProps: i } = g(m), p = n(
|
|
43
|
+
() => {
|
|
44
|
+
var o;
|
|
45
|
+
return ((o = t.value) == null ? void 0 : o.$el) ?? t.value;
|
|
46
|
+
}
|
|
47
|
+
), c = n(() => {
|
|
48
|
+
const o = r.maxHeight;
|
|
49
|
+
return o === void 0 ? {} : {
|
|
50
|
+
maxHeight: typeof o == "number" ? `${o}px` : o
|
|
51
|
+
};
|
|
52
|
+
}), f = (o) => {
|
|
53
|
+
l("scroll", o);
|
|
54
|
+
}, d = (o) => {
|
|
55
|
+
l("keydown", o);
|
|
56
|
+
}, u = n(() => [
|
|
57
|
+
e.block,
|
|
58
|
+
{
|
|
59
|
+
[e.modifier("has-header")]: !!a.header,
|
|
60
|
+
[e.modifier("has-footer")]: !!a.footer,
|
|
61
|
+
[e.modifier("with-line")]: r.showLine
|
|
62
|
+
}
|
|
63
|
+
]);
|
|
64
|
+
return {
|
|
65
|
+
className: e,
|
|
66
|
+
cls: u,
|
|
67
|
+
wrapperComRef: t,
|
|
68
|
+
wrapperRef: p,
|
|
69
|
+
wrapperStyle: c,
|
|
70
|
+
displayScrollbar: s,
|
|
71
|
+
scrollbarProps: i,
|
|
72
|
+
handleScroll: f,
|
|
73
|
+
handleKeydown: d
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
export {
|
|
78
|
+
N as default
|
|
79
|
+
};
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { computed as r, ref as L, watch as Se, watchEffect as tt } from "vue";
|
|
2
|
+
import { isNull as xe, isUndefined as F, isString as be, isNumber as at, isFunction as ce } from "../../../_utils/is.js";
|
|
3
|
+
import { KEYBOARD_KEY as g } from "../../../_utils/keyboard.js";
|
|
4
|
+
import { DEFAULT_FIELD_NAMES as ut, buildTree as lt, getKeysFromValues as nt, normalizeKey as k, conductCheckState as rt, filterTreeNodes as st, getVisibleNodes as ct, getKeyFromValue as T, isValidKey as U, toggleCheckState as Ce, getValueFromKey as oe, filterCheckedKeysByStrategy as ot } from "../utils.js";
|
|
5
|
+
const gt = (I) => {
|
|
6
|
+
var Ke;
|
|
7
|
+
const {
|
|
8
|
+
data: Ve,
|
|
9
|
+
fieldNames: W,
|
|
10
|
+
modelValue: ie,
|
|
11
|
+
defaultValue: Ae,
|
|
12
|
+
multiple: b,
|
|
13
|
+
treeCheckable: O,
|
|
14
|
+
treeCheckStrictly: H,
|
|
15
|
+
checkedStrategy: P,
|
|
16
|
+
labelInValue: C,
|
|
17
|
+
selectable: z,
|
|
18
|
+
expandedKeys: V,
|
|
19
|
+
defaultExpandedKeys: M,
|
|
20
|
+
defaultExpandAll: Y,
|
|
21
|
+
autoExpandParent: G,
|
|
22
|
+
filterTreeNode: j,
|
|
23
|
+
loadMore: m,
|
|
24
|
+
fallbackOption: A,
|
|
25
|
+
formatLabel: _,
|
|
26
|
+
popupVisible: y,
|
|
27
|
+
disabled: s,
|
|
28
|
+
loading: c,
|
|
29
|
+
onUpdateModelValue: Ne,
|
|
30
|
+
onChange: Ee,
|
|
31
|
+
onUpdateExpandedKeys: Re,
|
|
32
|
+
onExpand: Le,
|
|
33
|
+
onUpdateInputValue: Fe,
|
|
34
|
+
onPopupVisibleChange: B
|
|
35
|
+
} = I, q = r(() => ({
|
|
36
|
+
...ut,
|
|
37
|
+
...W == null ? void 0 : W.value
|
|
38
|
+
})), J = L(Ae.value), _e = r(() => ie.value ?? J.value), w = r(() => {
|
|
39
|
+
const e = _e.value;
|
|
40
|
+
return xe(e) || F(e) || e === "" ? [] : Array.isArray(e) ? e : [e];
|
|
41
|
+
});
|
|
42
|
+
Se(ie, (e) => {
|
|
43
|
+
(F(e) || xe(e)) && (J.value = b != null && b.value ? [] : void 0);
|
|
44
|
+
});
|
|
45
|
+
const Q = r(() => lt(Ve.value ?? [], q.value)), o = r(() => Q.value.nodeMap), h = r(() => Q.value.orderedNodes), i = r(() => !!(O != null && O.value)), X = r(() => !!(b != null && b.value) || i.value), E = r(() => !!(H != null && H.value)), Be = r(() => (P == null ? void 0 : P.value) ?? "parent"), p = r(() => nt(w.value).map(k)), N = r(() => i.value ? rt(p.value, o.value, h.value, E.value) : { checked: new Set(p.value), halfChecked: /* @__PURE__ */ new Set() }), De = (e) => E.value ? h.value.filter((t) => e.checked.has(t.key)).map((t) => t.key) : ot(
|
|
46
|
+
e,
|
|
47
|
+
Be.value,
|
|
48
|
+
h.value,
|
|
49
|
+
o.value
|
|
50
|
+
), ve = L(((Ke = I.defaultInputValue) == null ? void 0 : Ke.value) ?? ""), Z = r(() => {
|
|
51
|
+
var e;
|
|
52
|
+
return ((e = I.inputValue) == null ? void 0 : e.value) ?? ve.value;
|
|
53
|
+
}), fe = (e) => {
|
|
54
|
+
ve.value = e, Fe(e);
|
|
55
|
+
}, D = L([]), Te = r(() => (V == null ? void 0 : V.value) ?? D.value), S = r(
|
|
56
|
+
() => new Set(Te.value.map((e) => k(e)))
|
|
57
|
+
), $ = /* @__PURE__ */ new Set();
|
|
58
|
+
tt(() => {
|
|
59
|
+
if (!F(V == null ? void 0 : V.value)) return;
|
|
60
|
+
const e = new Set(D.value.map((u) => k(u)));
|
|
61
|
+
let t = !1;
|
|
62
|
+
const a = (u) => {
|
|
63
|
+
e.has(u) || (e.add(u), t = !0), $.add(u);
|
|
64
|
+
};
|
|
65
|
+
if (Y != null && Y.value)
|
|
66
|
+
for (const u of h.value)
|
|
67
|
+
!u.isLeaf && !$.has(u.key) && a(u.key);
|
|
68
|
+
for (const u of (M == null ? void 0 : M.value) ?? []) {
|
|
69
|
+
const l = k(u);
|
|
70
|
+
if (!$.has(l)) {
|
|
71
|
+
a(l);
|
|
72
|
+
const n = o.value.get(l);
|
|
73
|
+
(G == null ? void 0 : G.value) !== !1 && (n == null || n.pathKeys.forEach((d) => a(d)));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
t && (D.value = Array.from(e).map(
|
|
77
|
+
(u) => {
|
|
78
|
+
var l;
|
|
79
|
+
return ((l = o.value.get(u)) == null ? void 0 : l.value) ?? oe(u);
|
|
80
|
+
}
|
|
81
|
+
));
|
|
82
|
+
});
|
|
83
|
+
const de = r(
|
|
84
|
+
() => st(
|
|
85
|
+
h.value,
|
|
86
|
+
o.value,
|
|
87
|
+
Z.value,
|
|
88
|
+
(j == null ? void 0 : j.value) ?? !0
|
|
89
|
+
)
|
|
90
|
+
), ee = r(
|
|
91
|
+
() => ct(h.value, S.value, de.value)
|
|
92
|
+
), K = (e) => o.value.get(e), Ue = (e) => {
|
|
93
|
+
const t = z == null ? void 0 : z.value;
|
|
94
|
+
return t === "leaf" ? e.isLeaf : ce(t) ? !!t(e.raw, { isLeaf: e.isLeaf, level: e.level }) : t !== !1;
|
|
95
|
+
}, ye = (e) => e.selectable && Ue(e), Ie = (e) => i.value && e.checkable && !e.disabled, We = (e) => i.value ? N.value.checked.has(e.key) : p.value.includes(e.key), Oe = (e) => i.value && N.value.halfChecked.has(e.key), He = (e) => S.value.has(e.key), v = L(), te = r(() => ee.value.filter((e) => !e.disabled)), he = () => {
|
|
96
|
+
var a;
|
|
97
|
+
const e = te.value, t = p.value[p.value.length - 1];
|
|
98
|
+
return t && e.some((u) => u.key === t) ? t : (a = e[0]) == null ? void 0 : a.key;
|
|
99
|
+
};
|
|
100
|
+
Se(y, (e) => {
|
|
101
|
+
e && (v.value = he());
|
|
102
|
+
});
|
|
103
|
+
const Pe = (e) => {
|
|
104
|
+
v.value = e;
|
|
105
|
+
}, pe = (e) => {
|
|
106
|
+
const t = te.value;
|
|
107
|
+
if (t.length === 0) return;
|
|
108
|
+
if (F(v.value))
|
|
109
|
+
return e === "down" ? t[0].key : t[t.length - 1].key;
|
|
110
|
+
const a = t.findIndex((l) => l.key === v.value);
|
|
111
|
+
if (a === -1) return he();
|
|
112
|
+
const u = (t.length + a + (e === "up" ? -1 : 1)) % t.length;
|
|
113
|
+
return t[u].key;
|
|
114
|
+
}, ge = (e) => {
|
|
115
|
+
D.value = e, Re(e);
|
|
116
|
+
}, ae = (e, t) => {
|
|
117
|
+
const a = K(e);
|
|
118
|
+
if (!a) return;
|
|
119
|
+
const u = new Set(S.value);
|
|
120
|
+
if (t === u.has(e)) return;
|
|
121
|
+
t ? u.add(e) : u.delete(e);
|
|
122
|
+
const l = Array.from(u).map(
|
|
123
|
+
(n) => {
|
|
124
|
+
var d;
|
|
125
|
+
return ((d = o.value.get(n)) == null ? void 0 : d.value) ?? oe(n);
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
ge(l), Le(l, { node: a.raw, expanded: t });
|
|
129
|
+
}, x = L([]), ze = (e) => x.value.includes(e), R = (e, t) => {
|
|
130
|
+
const a = K(e);
|
|
131
|
+
if (!a || a.disabled) return;
|
|
132
|
+
if (!(t ?? !S.value.has(e))) {
|
|
133
|
+
ae(e, !1);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (!(!!(m != null && m.value) && !a.isLeaf && a.childrenKeys.length === 0)) {
|
|
137
|
+
ae(e, !0);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
x.value.includes(e) || (x.value = [...x.value, e], (async () => {
|
|
141
|
+
var n;
|
|
142
|
+
try {
|
|
143
|
+
await ((n = m == null ? void 0 : m.value) == null ? void 0 : n.call(m, a.raw)), ae(e, !0);
|
|
144
|
+
} finally {
|
|
145
|
+
x.value = x.value.filter((d) => d !== e);
|
|
146
|
+
}
|
|
147
|
+
})());
|
|
148
|
+
}, Me = (e, t) => {
|
|
149
|
+
R(e, t);
|
|
150
|
+
}, ue = /* @__PURE__ */ new Map(), le = (e) => ce(_ == null ? void 0 : _.value) ? _.value(e.raw) : e.title, ne = (e) => C != null && C.value ? { value: e.value, label: le(e), raw: e.raw } : e.value, f = (e, t) => {
|
|
151
|
+
J.value = e, Ne(e), Ee(e, t);
|
|
152
|
+
}, re = (e) => w.value.filter((t) => {
|
|
153
|
+
const a = T(t);
|
|
154
|
+
return U(a) ? !e.includes(k(a)) : !1;
|
|
155
|
+
}), Ye = (e) => e.map((t) => o.value.get(t)).filter((t) => !!t).map(ne), Ge = () => p.value.filter((e) => !o.value.has(e)).map((e) => {
|
|
156
|
+
const t = oe(e);
|
|
157
|
+
return C != null && C.value ? { value: t, label: ue.get(e) ?? String(t) } : t;
|
|
158
|
+
}), se = (e) => [
|
|
159
|
+
...Ye(De(e)),
|
|
160
|
+
...Ge()
|
|
161
|
+
], ke = (e) => {
|
|
162
|
+
if (!i.value || !e.checkable || e.disabled || e.disableCheckbox) return;
|
|
163
|
+
const t = !N.value.checked.has(e.key), a = Ce(
|
|
164
|
+
N.value,
|
|
165
|
+
e,
|
|
166
|
+
t,
|
|
167
|
+
o.value,
|
|
168
|
+
E.value
|
|
169
|
+
);
|
|
170
|
+
f(se(a), {
|
|
171
|
+
node: e.raw,
|
|
172
|
+
checked: t,
|
|
173
|
+
selected: t
|
|
174
|
+
});
|
|
175
|
+
}, je = (e) => {
|
|
176
|
+
if (e.disabled) return;
|
|
177
|
+
if (!ye(e)) {
|
|
178
|
+
e.isLeaf || R(e.key, !0);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (i.value) {
|
|
182
|
+
ke(e);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (!X.value) {
|
|
186
|
+
if (p.value[0] === e.key) return;
|
|
187
|
+
f(ne(e), { node: e.raw, selected: !0 });
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
const a = p.value.includes(e.key), u = a ? re([e.key]) : [...w.value, ne(e)];
|
|
191
|
+
f(u, { node: e.raw, selected: !a });
|
|
192
|
+
}, me = (e) => {
|
|
193
|
+
if (s != null && s.value || c != null && c.value) return;
|
|
194
|
+
const t = K(e);
|
|
195
|
+
t && je(t);
|
|
196
|
+
}, qe = (e) => {
|
|
197
|
+
if (s != null && s.value || c != null && c.value) return;
|
|
198
|
+
const t = K(e);
|
|
199
|
+
if (t != null && t.disabled) return;
|
|
200
|
+
if (!i.value) {
|
|
201
|
+
f(re([e]), { node: t == null ? void 0 : t.raw, selected: !1 });
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if (!t) {
|
|
205
|
+
f(re([e]), {});
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
const a = Ce(N.value, t, !1, o.value, E.value);
|
|
209
|
+
f(se(a), {
|
|
210
|
+
node: t.raw,
|
|
211
|
+
checked: !1,
|
|
212
|
+
selected: !1
|
|
213
|
+
});
|
|
214
|
+
}, Je = () => {
|
|
215
|
+
if (!(s != null && s.value || c != null && c.value)) {
|
|
216
|
+
if (X.value) {
|
|
217
|
+
const e = w.value.filter((t) => {
|
|
218
|
+
var u;
|
|
219
|
+
const a = T(t);
|
|
220
|
+
return U(a) && ((u = o.value.get(k(a))) == null ? void 0 : u.disabled);
|
|
221
|
+
});
|
|
222
|
+
f(e, {});
|
|
223
|
+
} else
|
|
224
|
+
f(void 0, {});
|
|
225
|
+
fe("");
|
|
226
|
+
}
|
|
227
|
+
}, Qe = (e, t) => {
|
|
228
|
+
const a = ue.get(k(e));
|
|
229
|
+
return a !== void 0 ? a : t && be(t.label) ? t.label : String(e);
|
|
230
|
+
}, Xe = (e) => {
|
|
231
|
+
const t = A == null ? void 0 : A.value;
|
|
232
|
+
if (ce(t)) return t(e);
|
|
233
|
+
}, Ze = r(() => {
|
|
234
|
+
const e = [];
|
|
235
|
+
for (const t of w.value) {
|
|
236
|
+
const a = T(t);
|
|
237
|
+
if (!U(a)) continue;
|
|
238
|
+
const u = k(a), l = o.value.get(u), n = be(t) || at(t) ? void 0 : t;
|
|
239
|
+
if (l) {
|
|
240
|
+
const we = le(l);
|
|
241
|
+
ue.set(u, we), e.push({ value: l.value, label: we, raw: l.raw });
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
if ((A == null ? void 0 : A.value) === !1 && !n) continue;
|
|
245
|
+
const d = Xe(a), et = (n == null ? void 0 : n.label) ?? (d ? String(d[q.value.title] ?? a) : Qe(a, n));
|
|
246
|
+
e.push({ value: a, label: et, raw: d ?? (n == null ? void 0 : n.raw) });
|
|
247
|
+
}
|
|
248
|
+
return e;
|
|
249
|
+
}), $e = r(
|
|
250
|
+
() => w.value.some((e) => {
|
|
251
|
+
var a;
|
|
252
|
+
const t = T(e);
|
|
253
|
+
return U(t) ? !((a = o.value.get(k(t))) != null && a.disabled) : !1;
|
|
254
|
+
})
|
|
255
|
+
);
|
|
256
|
+
return {
|
|
257
|
+
// state
|
|
258
|
+
mergedFieldNames: q,
|
|
259
|
+
treeData: Q,
|
|
260
|
+
nodeMap: o,
|
|
261
|
+
orderedNodes: h,
|
|
262
|
+
valueArray: w,
|
|
263
|
+
publicKeys: p,
|
|
264
|
+
checkState: N,
|
|
265
|
+
isCheckable: i,
|
|
266
|
+
isMultiple: X,
|
|
267
|
+
isStrict: E,
|
|
268
|
+
filterResult: de,
|
|
269
|
+
visibleNodes: ee,
|
|
270
|
+
activeKey: v,
|
|
271
|
+
expandedKeySet: S,
|
|
272
|
+
displayValues: Ze,
|
|
273
|
+
clearable: $e,
|
|
274
|
+
loadingKeys: x,
|
|
275
|
+
computedInputValue: Z,
|
|
276
|
+
// helpers
|
|
277
|
+
getNodeInfo: K,
|
|
278
|
+
isNodeSelectable: ye,
|
|
279
|
+
isNodeCheckable: Ie,
|
|
280
|
+
isNodeSelected: We,
|
|
281
|
+
isNodeHalfChecked: Oe,
|
|
282
|
+
isNodeExpanded: He,
|
|
283
|
+
isLoadingNode: ze,
|
|
284
|
+
getDisplayLabel: le,
|
|
285
|
+
updateInputValue: fe,
|
|
286
|
+
setActiveKey: Pe,
|
|
287
|
+
getNextActiveKey: pe,
|
|
288
|
+
expandNode: R,
|
|
289
|
+
toggleExpand: Me,
|
|
290
|
+
handleSelect: me,
|
|
291
|
+
handleRemove: qe,
|
|
292
|
+
handleClear: Je,
|
|
293
|
+
handleKeyDown: (e) => {
|
|
294
|
+
if (s != null && s.value || e.isComposing || e.keyCode === 229 || e.ctrlKey || e.altKey || e.metaKey || e.shiftKey) return;
|
|
295
|
+
const t = () => {
|
|
296
|
+
e.stopPropagation(), e.preventDefault();
|
|
297
|
+
};
|
|
298
|
+
if (e.key === g.TAB) {
|
|
299
|
+
y.value && B(!1);
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
if (e.key === g.ESC) {
|
|
303
|
+
y.value && (t(), B(!1));
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
if (c != null && c.value) return;
|
|
307
|
+
const a = v.value;
|
|
308
|
+
if (e.key === g.ENTER) {
|
|
309
|
+
y.value ? a && (t(), me(a)) : (t(), B(!0));
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
if (e.key === g.SPACE) {
|
|
313
|
+
if (y.value && i.value && a) {
|
|
314
|
+
const u = K(a);
|
|
315
|
+
u && !u.disabled && u.checkable && !u.disableCheckbox && (t(), ke(u));
|
|
316
|
+
}
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
if (e.key === g.ARROW_DOWN || e.key === g.ARROW_UP) {
|
|
320
|
+
const u = e.key === g.ARROW_UP ? "up" : "down";
|
|
321
|
+
if (t(), !y.value) {
|
|
322
|
+
B(!0);
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
const l = pe(u);
|
|
326
|
+
F(l) || (v.value = l);
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
if (e.key === "Home" || e.key === "End") {
|
|
330
|
+
if (y.value && Z.value === "") {
|
|
331
|
+
const u = te.value, l = e.key === "Home" ? u[0] : u[u.length - 1];
|
|
332
|
+
l && (t(), v.value = l.key);
|
|
333
|
+
}
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
if (e.key === g.ARROW_RIGHT) {
|
|
337
|
+
if (!y.value || !a) return;
|
|
338
|
+
const u = K(a);
|
|
339
|
+
if (!u || u.isLeaf) return;
|
|
340
|
+
if (t(), !S.value.has(u.key))
|
|
341
|
+
R(u.key, !0);
|
|
342
|
+
else {
|
|
343
|
+
const l = ee.value.find(
|
|
344
|
+
(n) => n.parentKey === u.key && !n.disabled
|
|
345
|
+
);
|
|
346
|
+
l && (v.value = l.key);
|
|
347
|
+
}
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
if (e.key === g.ARROW_LEFT) {
|
|
351
|
+
if (!y.value || !a) return;
|
|
352
|
+
const u = K(a);
|
|
353
|
+
if (!u) return;
|
|
354
|
+
t(), !u.isLeaf && S.value.has(u.key) ? R(u.key, !1) : u.parentKey && (v.value = u.parentKey);
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
emitValue: f,
|
|
358
|
+
expandAll: (e = !0) => {
|
|
359
|
+
if (s != null && s.value) return;
|
|
360
|
+
const t = e ? h.value.filter((a) => !a.disabled && !a.isLeaf).map((a) => a.value) : [];
|
|
361
|
+
ge(t);
|
|
362
|
+
},
|
|
363
|
+
checkAll: (e = !0) => {
|
|
364
|
+
if (!i.value || s != null && s.value || c != null && c.value) return;
|
|
365
|
+
const t = e ? {
|
|
366
|
+
checked: new Set(
|
|
367
|
+
h.value.filter((a) => a.checkable && !a.disabled).map((a) => a.key)
|
|
368
|
+
)
|
|
369
|
+
} : { checked: /* @__PURE__ */ new Set() };
|
|
370
|
+
f(se(t), {});
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
};
|
|
374
|
+
export {
|
|
375
|
+
gt as useTreeSelect
|
|
376
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import r from "./TreeSelect.js";
|
|
2
|
+
import t from "./TreeSelectDropdown.vue.js";
|
|
3
|
+
import { generateComponent as e } from "../../_utils/vue-eco.js";
|
|
4
|
+
import { getComponentPrefix as o } from "../../_utils/config.js";
|
|
5
|
+
const l = e(o("TreeSelect"), r), f = e(
|
|
6
|
+
o("TreeSelectDropdown"),
|
|
7
|
+
t
|
|
8
|
+
);
|
|
9
|
+
export {
|
|
10
|
+
l as TreeSelect,
|
|
11
|
+
f as TreeSelectDropdown,
|
|
12
|
+
l as default
|
|
13
|
+
};
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { isNumber as b, isString as p, isArray as E, isFunction as F } from "../../_utils/is.js";
|
|
2
|
+
const A = {
|
|
3
|
+
key: "key",
|
|
4
|
+
title: "title",
|
|
5
|
+
children: "children",
|
|
6
|
+
disabled: "disabled",
|
|
7
|
+
checkable: "checkable",
|
|
8
|
+
disableCheckbox: "disableCheckbox",
|
|
9
|
+
selectable: "selectable",
|
|
10
|
+
isLeaf: "isLeaf",
|
|
11
|
+
icon: "icon"
|
|
12
|
+
}, S = (e) => b(e) ? `__x_tree__number-${e}` : `__x_tree__string-${e}`, B = (e) => e.startsWith("__x_tree__number-") ? Number(e.slice(17)) : e.startsWith("__x_tree__string-") ? e.slice(17) : e, $ = (e) => {
|
|
13
|
+
if (p(e) || b(e))
|
|
14
|
+
return e;
|
|
15
|
+
if (e && typeof e == "object" && "value" in e)
|
|
16
|
+
return e.value;
|
|
17
|
+
}, m = (e) => p(e) || b(e), O = (e, t) => {
|
|
18
|
+
const h = /* @__PURE__ */ new Map(), o = [], c = [], n = (s, l, r, a, d) => {
|
|
19
|
+
s.forEach((i, K) => {
|
|
20
|
+
const x = i[t.key], u = [...a, String(K)];
|
|
21
|
+
let k = m(x) ? x : `__x_tree__auto-${u.join("-")}`, f = S(k);
|
|
22
|
+
h.has(f) && (console.warn(
|
|
23
|
+
`[x-next] TreeSelect: duplicate node key "${String(k)}", fallback to path key.`
|
|
24
|
+
), k = `__x_tree__auto-${u.join("-")}`, f = S(k));
|
|
25
|
+
const g = E(i[t.children]) ? i[t.children] : [], v = i[t.isLeaf], L = g.length === 0 && v !== !1, _ = {
|
|
26
|
+
key: f,
|
|
27
|
+
value: k,
|
|
28
|
+
title: i[t.title] !== void 0 ? String(i[t.title]) : String(k),
|
|
29
|
+
raw: i,
|
|
30
|
+
level: l,
|
|
31
|
+
index: o.length,
|
|
32
|
+
parentKey: r,
|
|
33
|
+
pathKeys: d ? [...d.pathKeys, d.key] : [],
|
|
34
|
+
childrenKeys: [],
|
|
35
|
+
siblingIndex: K,
|
|
36
|
+
siblingCount: s.length,
|
|
37
|
+
isLeaf: L,
|
|
38
|
+
disabled: !!i[t.disabled],
|
|
39
|
+
checkable: i[t.checkable] !== !1,
|
|
40
|
+
disableCheckbox: !!i[t.disableCheckbox],
|
|
41
|
+
selectable: i[t.selectable] !== !1,
|
|
42
|
+
loading: !1
|
|
43
|
+
};
|
|
44
|
+
h.set(f, _), o.push(_), d ? d.childrenKeys.push(f) : c.push(f), g.length > 0 && n(g, l + 1, f, u, _);
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
return n(e ?? [], 0, void 0, [], void 0), { nodeMap: h, orderedNodes: o, rootKeys: c };
|
|
48
|
+
}, y = (e) => e.checkable && !e.disabled, w = (e, t) => e.childrenKeys.map((h) => t.get(h)).filter(
|
|
49
|
+
(h) => h !== void 0 && y(h)
|
|
50
|
+
), C = (e, t, h) => {
|
|
51
|
+
const o = [], c = (n) => {
|
|
52
|
+
for (const s of n) {
|
|
53
|
+
const l = e.get(s);
|
|
54
|
+
l && ((!h || h(l)) && o.push(l.key), c(l.childrenKeys));
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
return c(t.childrenKeys), o;
|
|
58
|
+
}, D = (e, t) => [t.key, ...C(e, t, y)], I = () => ({
|
|
59
|
+
checked: /* @__PURE__ */ new Set(),
|
|
60
|
+
halfChecked: /* @__PURE__ */ new Set()
|
|
61
|
+
}), V = (e, t, h, o) => {
|
|
62
|
+
const c = I(), n = /* @__PURE__ */ new Set();
|
|
63
|
+
for (const s of e) {
|
|
64
|
+
const l = t.get(s);
|
|
65
|
+
l && n.add(l.key);
|
|
66
|
+
}
|
|
67
|
+
if (o)
|
|
68
|
+
return c.checked = new Set(n), c;
|
|
69
|
+
for (const s of n) {
|
|
70
|
+
const l = t.get(s);
|
|
71
|
+
l && y(l) && (c.checked.add(l.key), C(t, l, y).forEach(
|
|
72
|
+
(r) => c.checked.add(r)
|
|
73
|
+
));
|
|
74
|
+
}
|
|
75
|
+
for (let s = h.length - 1; s >= 0; s--) {
|
|
76
|
+
const l = h[s];
|
|
77
|
+
if (!l) continue;
|
|
78
|
+
const r = w(l, t);
|
|
79
|
+
if (r.length === 0 || !y(l)) continue;
|
|
80
|
+
let a = !0, d = !1;
|
|
81
|
+
for (const i of r)
|
|
82
|
+
c.checked.has(i.key) ? d = !0 : (a = !1, c.halfChecked.has(i.key) && (d = !0));
|
|
83
|
+
a ? (c.checked.add(l.key), c.halfChecked.delete(l.key)) : (c.checked.delete(l.key), d ? c.halfChecked.add(l.key) : c.halfChecked.delete(l.key));
|
|
84
|
+
}
|
|
85
|
+
return c;
|
|
86
|
+
}, T = (e, t, h) => {
|
|
87
|
+
const o = w(e, t);
|
|
88
|
+
if (o.length === 0)
|
|
89
|
+
return h.checked.has(e.key) ? "checked" : "none";
|
|
90
|
+
let c = !0, n = !1;
|
|
91
|
+
for (const s of o)
|
|
92
|
+
h.checked.has(s.key) ? n = !0 : (c = !1, h.halfChecked.has(s.key) && (n = !0));
|
|
93
|
+
return c ? "checked" : n ? "half" : "none";
|
|
94
|
+
}, W = (e, t, h, o, c) => {
|
|
95
|
+
const n = {
|
|
96
|
+
checked: new Set(e.checked),
|
|
97
|
+
halfChecked: new Set(e.halfChecked)
|
|
98
|
+
};
|
|
99
|
+
if (c)
|
|
100
|
+
return h ? n.checked.add(t.key) : n.checked.delete(t.key), n.halfChecked.delete(t.key), n;
|
|
101
|
+
const s = D(o, t);
|
|
102
|
+
for (const r of s)
|
|
103
|
+
h ? n.checked.add(r) : n.checked.delete(r), n.halfChecked.delete(r);
|
|
104
|
+
let l = t.parentKey;
|
|
105
|
+
for (; l; ) {
|
|
106
|
+
const r = o.get(l);
|
|
107
|
+
if (!r) break;
|
|
108
|
+
if (y(r)) {
|
|
109
|
+
const a = T(r, o, n);
|
|
110
|
+
a === "checked" ? (n.checked.add(r.key), n.halfChecked.delete(r.key)) : (n.checked.delete(r.key), a === "half" ? n.halfChecked.add(r.key) : n.halfChecked.delete(r.key));
|
|
111
|
+
}
|
|
112
|
+
l = r.parentKey;
|
|
113
|
+
}
|
|
114
|
+
return n;
|
|
115
|
+
}, z = (e, t, h, o) => {
|
|
116
|
+
const c = h.filter((s) => e.checked.has(s.key)).map((s) => s.key);
|
|
117
|
+
if (t === "all") return c;
|
|
118
|
+
if (t === "parent")
|
|
119
|
+
return c.filter(
|
|
120
|
+
(s) => {
|
|
121
|
+
var l;
|
|
122
|
+
return !((l = o.get(s)) != null && l.pathKeys.some((r) => e.checked.has(r)));
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
const n = /* @__PURE__ */ new Set();
|
|
126
|
+
for (const s of c) {
|
|
127
|
+
const l = o.get(s);
|
|
128
|
+
l && l.pathKeys.forEach((r) => n.add(r));
|
|
129
|
+
}
|
|
130
|
+
return c.filter((s) => !n.has(s));
|
|
131
|
+
}, H = (e, t, h, o) => {
|
|
132
|
+
if (!h || o === !1) return null;
|
|
133
|
+
const c = h.toLowerCase(), n = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), l = (r) => F(o) ? o(h, r.raw) : r.title.toLowerCase().includes(c);
|
|
134
|
+
for (const r of e)
|
|
135
|
+
l(r) && (n.add(r.key), s.add(r.key), C(t, r).forEach((a) => s.add(a)), r.pathKeys.forEach((a) => s.add(a)));
|
|
136
|
+
return { keptKeys: s, matchedKeys: n, query: h };
|
|
137
|
+
}, P = (e, t, h) => {
|
|
138
|
+
const o = h ? e.filter((c) => h.keptKeys.has(c.key)) : e.filter((c) => c.pathKeys.every((n) => t.has(n)));
|
|
139
|
+
return o.map((c, n) => {
|
|
140
|
+
let s = !0;
|
|
141
|
+
for (let l = n + 1; l < o.length && !(o[l].level < c.level); l++)
|
|
142
|
+
if (o[l].level === c.level) {
|
|
143
|
+
s = !1;
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
return { ...c, lastChild: s };
|
|
147
|
+
});
|
|
148
|
+
}, Q = (e, t) => {
|
|
149
|
+
if (!t) return [{ text: e, match: !1 }];
|
|
150
|
+
const h = e.toLowerCase(), o = t.toLowerCase(), c = [];
|
|
151
|
+
let n = 0, s = h.indexOf(o);
|
|
152
|
+
for (; s !== -1; )
|
|
153
|
+
s > n && c.push({ text: e.slice(n, s), match: !1 }), c.push({ text: e.slice(s, s + t.length), match: !0 }), n = s + t.length, s = h.indexOf(o, n);
|
|
154
|
+
return n < e.length && c.push({ text: e.slice(n), match: !1 }), c.length > 0 ? c : [{ text: e, match: !1 }];
|
|
155
|
+
}, U = (e) => {
|
|
156
|
+
const t = [];
|
|
157
|
+
for (const h of e) {
|
|
158
|
+
const o = $(h);
|
|
159
|
+
m(o) && t.push(o);
|
|
160
|
+
}
|
|
161
|
+
return t;
|
|
162
|
+
};
|
|
163
|
+
export {
|
|
164
|
+
A as DEFAULT_FIELD_NAMES,
|
|
165
|
+
O as buildTree,
|
|
166
|
+
V as conductCheckState,
|
|
167
|
+
z as filterCheckedKeysByStrategy,
|
|
168
|
+
H as filterTreeNodes,
|
|
169
|
+
D as getCascadeKeys,
|
|
170
|
+
C as getDescendantKeys,
|
|
171
|
+
w as getEligibleChildren,
|
|
172
|
+
$ as getKeyFromValue,
|
|
173
|
+
U as getKeysFromValues,
|
|
174
|
+
B as getValueFromKey,
|
|
175
|
+
P as getVisibleNodes,
|
|
176
|
+
y as isCascadeCheckable,
|
|
177
|
+
m as isValidKey,
|
|
178
|
+
S as normalizeKey,
|
|
179
|
+
Q as splitHighlightText,
|
|
180
|
+
W as toggleCheckState
|
|
181
|
+
};
|