hys-ui 0.1.0 → 0.1.1
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 +26 -1
- package/README.md +16 -6
- package/dist/components/HysAlert/HysAlert.vue.js +14 -14
- package/dist/components/HysAnimatedNumber/HysAnimatedNumber.vue.js +23 -20
- package/dist/components/HysBadge/HysBadge.vue.js +1 -1
- package/dist/components/HysBadge/HysBadge2.vue.js +20 -19
- package/dist/components/HysCalendar/HysCalendar.vue.js +48 -40
- package/dist/components/HysCard/HysCard.vue.js +2 -2
- package/dist/components/HysCard/HysCard2.vue.js +9 -9
- package/dist/components/HysCascader/HysCascader.vue.js +88 -76
- package/dist/components/HysCheckbox/HysCheckbox.vue.js +5 -39
- package/dist/components/HysCheckbox/HysCheckbox2.vue.js +85 -2
- package/dist/components/HysCommandPalette/HysCommandPalette.vue.js +52 -51
- package/dist/components/HysCommentEditor/HysCommentEditor.vue.js +17 -17
- package/dist/components/HysDataGrid/HysDataGrid2.vue.js +22 -22
- package/dist/components/HysDrawer/HysDrawer.vue.js +1 -1
- package/dist/components/HysDrawer/HysDrawer2.vue.js +55 -54
- package/dist/components/HysFileManager/HysFileManager.vue.js +5 -63
- package/dist/components/HysFileManager/HysFileManager2.vue.js +85 -2
- package/dist/components/HysForm/HysForm.vue.js +2 -2
- package/dist/components/HysForm/HysForm2.vue.js +66 -64
- package/dist/components/HysFormItem/HysFormItem.vue.js +53 -37
- package/dist/components/HysGantt/HysGantt.vue.js +5 -264
- package/dist/components/HysGantt/HysGantt2.vue.js +302 -2
- package/dist/components/HysInput/HysInput.vue.js +1 -1
- package/dist/components/HysInput/HysInput2.vue.js +42 -41
- package/dist/components/HysModal/HysModal.vue.js +2 -2
- package/dist/components/HysModal/HysModal2.vue.js +35 -35
- package/dist/components/HysNotificationCenter/HysNotificationCenter.vue.js +37 -36
- package/dist/components/HysNumberInput/HysNumberInput.vue.js +2 -2
- package/dist/components/HysNumberInput/HysNumberInput2.vue.js +49 -40
- package/dist/components/HysOrgTree/HysOrgTree.vue.js +34 -32
- package/dist/components/HysPagination/HysPagination.vue.js +2 -2
- package/dist/components/HysPagination/HysPagination2.vue.js +91 -91
- package/dist/components/HysPermissionMatrix/HysPermissionMatrix.vue.js +5 -41
- package/dist/components/HysPermissionMatrix/HysPermissionMatrix2.vue.js +100 -2
- package/dist/components/HysRadioGroup/HysRadioGroup.vue.js +5 -40
- package/dist/components/HysRadioGroup/HysRadioGroup2.vue.js +80 -2
- package/dist/components/HysResizablePanel/HysResizablePanel.vue.js +46 -28
- package/dist/components/HysRichTextEditor/HysRichTextEditor.vue.js +2 -2
- package/dist/components/HysRichTextEditor/HysRichTextEditor2.vue.js +86 -67
- package/dist/components/HysSearch/HysSearch.vue.js +49 -38
- package/dist/components/HysSegmented/HysSegmented.vue.js +39 -34
- package/dist/components/HysSelect/HysSelect.vue.js +2 -2
- package/dist/components/HysSelect/HysSelect2.vue.js +130 -109
- package/dist/components/HysSlider/HysSlider.vue.js +2 -2
- package/dist/components/HysSlider/HysSlider2.vue.js +40 -40
- package/dist/components/HysSplitPane/HysSplitPane.vue.js +48 -42
- package/dist/components/HysSteps/HysSteps.vue.js +2 -2
- package/dist/components/HysSteps/HysSteps2.vue.js +15 -14
- package/dist/components/HysSwitch/HysSwitch.vue.js +2 -2
- package/dist/components/HysSwitch/HysSwitch2.vue.js +38 -27
- package/dist/components/HysTable/HysTable.vue.js +2 -2
- package/dist/components/HysTable/HysTable2.vue.js +42 -38
- package/dist/components/HysTabs/HysTabs.vue.js +1 -1
- package/dist/components/HysTabs/HysTabs2.vue.js +8 -6
- package/dist/components/HysTextarea/HysTextarea.vue.js +58 -48
- package/dist/components/HysToast/HysToast.vue.js +2 -2
- package/dist/components/HysToast/HysToast2.vue.js +121 -38
- package/dist/components/HysTour/HysTour.vue.js +47 -42
- package/dist/components/HysTransfer/HysTransfer.vue.js +159 -143
- package/dist/components/HysTree/HysTree.vue.js +2 -2
- package/dist/components/HysTree/HysTree2.vue.js +62 -61
- package/dist/components/HysTreeSelect/HysTreeSelect.vue.js +64 -57
- package/dist/components/HysUpload/HysUpload.vue.js +2 -2
- package/dist/components/HysUpload/HysUpload2.vue.js +95 -77
- package/dist/composables/formContext.js +9 -3
- package/dist/composables/toastEscape.js +16 -0
- package/dist/composables/useDialog.js +16 -16
- package/dist/composables/useFloating.js +40 -40
- package/dist/composables/useHysToast.js +148 -0
- package/dist/config.js +18 -15
- package/dist/index.js +10 -7
- package/dist/style.css +1 -1
- package/dist/types/components/HysCalendar/HysCalendar.vue.d.ts +2 -0
- package/dist/types/components/HysCard/HysCard.vue.d.ts +5 -1
- package/dist/types/components/HysCheckbox/HysCheckbox.vue.d.ts +21 -4
- package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +1 -0
- package/dist/types/components/HysFileManager/HysFileManager.vue.d.ts +6 -2
- package/dist/types/components/HysGantt/HysGantt.vue.d.ts +6 -0
- package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +2 -0
- package/dist/types/components/HysOrgTree/HysOrgTree.vue.d.ts +3 -1
- package/dist/types/components/HysPermissionMatrix/HysPermissionMatrix.vue.d.ts +8 -1
- package/dist/types/components/HysRadioGroup/HysRadioGroup.vue.d.ts +40 -17
- package/dist/types/components/HysResizablePanel/HysResizablePanel.vue.d.ts +6 -0
- package/dist/types/components/HysSelect/HysSelect.vue.d.ts +7 -1
- package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +6 -0
- package/dist/types/components/HysSteps/HysSteps.vue.d.ts +1 -0
- package/dist/types/components/HysSwitch/HysSwitch.vue.d.ts +1 -1
- package/dist/types/components/HysTextarea/HysTextarea.vue.d.ts +1 -1
- package/dist/types/components/HysToast/HysToast.vue.d.ts +55 -7
- package/dist/types/components/HysTour/HysTour.vue.d.ts +3 -1
- package/dist/types/components/HysTransfer/HysTransfer.vue.d.ts +11 -1
- package/dist/types/composables/formContext.d.ts +5 -0
- package/dist/types/composables/toastEscape.d.ts +1 -0
- package/dist/types/composables/useFloating.d.ts +1 -1
- package/dist/types/composables/useHysToast.d.ts +50 -0
- package/dist/types/index.d.ts +5 -0
- package/package.json +46 -11
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { defineComponent as he, ref as p, computed as s, watch as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { defineComponent as he, ref as p, computed as s, watch as W, onDeactivated as fe, openBlock as r, createElementBlock as v, mergeProps as G, unref as I, withDirectives as pe, vModelText as ye, createCommentVNode as w, createElementVNode as E, normalizeStyle as F, Fragment as me, renderList as be, normalizeClass as ge, withModifiers as J, createBlock as O, resolveDynamicComponent as ke, toDisplayString as P, renderSlot as we, Teleport as Ce, withKeys as De, nextTick as Ke } from "vue";
|
|
2
|
+
import Ae from "../HysCheckbox/HysCheckbox.vue.js";
|
|
3
|
+
import { useHysRootAttrs as Me } from "../../config.js";
|
|
4
|
+
import { LoaderCircle as Se, ChevronDown as Te, ChevronRight as Ie } from "lucide-vue-next";
|
|
5
|
+
const Be = ["disabled"], Ve = ["aria-multiselectable"], He = ["aria-level", "aria-expanded", "aria-selected", "aria-disabled", "aria-checked", "tabindex", "draggable", "data-tree-id", "onFocus", "onKeydown", "onClick", "onDragstart", "onDragover", "onDrop", "onContextmenu", "data-drop-position"], $e = ["aria-label", "disabled", "onClick"], Ee = {
|
|
5
6
|
key: 1,
|
|
6
7
|
class: "hys-ui-pf-tree-spacer",
|
|
7
8
|
"aria-hidden": "true"
|
|
8
|
-
},
|
|
9
|
+
}, Le = {
|
|
9
10
|
key: 3,
|
|
10
11
|
"aria-hidden": "true"
|
|
11
12
|
}, Ne = { class: "hys-ui-pf-tree-label" }, Re = {
|
|
@@ -15,7 +16,7 @@ const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "ari
|
|
|
15
16
|
}, qe = {
|
|
16
17
|
key: 2,
|
|
17
18
|
class: "hys-ui-pf-tree-empty"
|
|
18
|
-
},
|
|
19
|
+
}, Ye = /* @__PURE__ */ he({
|
|
19
20
|
__name: "HysTree",
|
|
20
21
|
props: {
|
|
21
22
|
nodes: {},
|
|
@@ -39,20 +40,20 @@ const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "ari
|
|
|
39
40
|
},
|
|
40
41
|
emits: ["update:modelValue", "update:checkedKeys", "update:expandedKeys", "select", "check", "node-drop", "node-contextmenu", "load-error", "children-loaded"],
|
|
41
42
|
setup(i, { expose: ee, emit: le }) {
|
|
42
|
-
const
|
|
43
|
+
const Y = Me(), d = i, c = le, b = p(""), C = p({}), K = p([]), M = p({}), S = p(0), A = p(""), B = p(""), U = p("inside"), h = p(null), V = p(""), m = p(null), u = s(() => {
|
|
43
44
|
const e = /* @__PURE__ */ new Map(), t = (l, n = 0, a, o = /* @__PURE__ */ new Set()) => {
|
|
44
|
-
var
|
|
45
|
+
var $, k;
|
|
45
46
|
for (const y of l)
|
|
46
|
-
e.has(y.id) || o.has(y.id) || (e.set(y.id, { node: y, depth: n, parentId: a, hasChildren: !!((
|
|
47
|
+
e.has(y.id) || o.has(y.id) || (e.set(y.id, { node: y, depth: n, parentId: a, hasChildren: !!(($ = y.children) != null && $.length || (k = C.value[y.id]) != null && k.length || y.hasChildren) }), t(C.value[y.id] ?? y.children ?? [], n + 1, y.id, /* @__PURE__ */ new Set([...o, y.id])));
|
|
47
48
|
};
|
|
48
49
|
return t(d.nodes), e;
|
|
49
|
-
}),
|
|
50
|
-
|
|
51
|
-
d.defaultExpandAll && d.expandedKeys === void 0 && (
|
|
52
|
-
}, { immediate: !0, deep: !0 }),
|
|
50
|
+
}), H = p([]);
|
|
51
|
+
W(() => [d.nodes, d.defaultExpandAll], () => {
|
|
52
|
+
d.defaultExpandAll && d.expandedKeys === void 0 && (H.value = [...u.value.values()].filter((e) => e.hasChildren).map((e) => e.node.id));
|
|
53
|
+
}, { immediate: !0, deep: !0 }), W(() => d.nodes, () => {
|
|
53
54
|
C.value = {}, M.value = {}, S.value = 0;
|
|
54
55
|
}, { deep: !1 });
|
|
55
|
-
const f = s(() => d.expandedKeys ??
|
|
56
|
+
const f = s(() => d.expandedKeys ?? H.value), te = s(() => {
|
|
56
57
|
const e = /* @__PURE__ */ new Set(), t = b.value.trim().toLocaleLowerCase();
|
|
57
58
|
if (!t) return e;
|
|
58
59
|
for (const l of u.value.values()) {
|
|
@@ -93,20 +94,20 @@ const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "ari
|
|
|
93
94
|
K.value = [...K.value, e], delete M.value[e];
|
|
94
95
|
try {
|
|
95
96
|
const a = await d.loadChildren(t.node);
|
|
96
|
-
C.value = { ...C.value, [e]: a },
|
|
97
|
+
C.value = { ...C.value, [e]: a }, c("children-loaded", { node: t.node, children: a });
|
|
97
98
|
} catch (a) {
|
|
98
|
-
M.value = { ...M.value, [e]: "加载失败,点击重试" },
|
|
99
|
+
M.value = { ...M.value, [e]: "加载失败,点击重试" }, c("load-error", { node: t.node, error: a });
|
|
99
100
|
return;
|
|
100
101
|
} finally {
|
|
101
102
|
K.value = K.value.filter((a) => a !== e);
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
105
|
const l = f.value.includes(e) ? f.value.filter((a) => a !== e) : [...f.value, e];
|
|
105
|
-
d.expandedKeys === void 0 && (
|
|
106
|
+
d.expandedKeys === void 0 && (H.value = l), c("update:expandedKeys", l);
|
|
106
107
|
}
|
|
107
108
|
const R = s(() => new Set((Array.isArray(d.modelValue) ? d.modelValue : [d.modelValue]).filter((e) => typeof e == "string")));
|
|
108
109
|
function q(e) {
|
|
109
|
-
d.disabled || e.node.disabled || e.node.selectable === !1 || (
|
|
110
|
+
d.disabled || e.node.disabled || e.node.selectable === !1 || (c("update:modelValue", d.multiple || Array.isArray(d.modelValue) ? R.value.has(e.node.id) ? [...R.value].filter((t) => t !== e.node.id) : [...R.value, e.node.id] : e.node.id), c("select", e.node), V.value = e.node.id);
|
|
110
111
|
}
|
|
111
112
|
function ne(e) {
|
|
112
113
|
const t = [], l = (n) => {
|
|
@@ -125,11 +126,11 @@ const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "ari
|
|
|
125
126
|
n ? l.add(o) : l.delete(o);
|
|
126
127
|
for (const o of d.checkStrictly ? [] : [...u.value.values()].reverse()) {
|
|
127
128
|
if (!o.hasChildren || o.node.disabled || o.node.checkable === !1) continue;
|
|
128
|
-
const
|
|
129
|
-
|
|
129
|
+
const $ = (C.value[o.node.id] ?? o.node.children ?? []).filter((k) => !k.disabled && k.checkable !== !1).map((k) => k.id);
|
|
130
|
+
$.length && $.every((k) => l.has(k)) ? l.add(o.node.id) : l.delete(o.node.id);
|
|
130
131
|
}
|
|
131
132
|
const a = [...l];
|
|
132
|
-
|
|
133
|
+
c("update:checkedKeys", a), c("check", a);
|
|
133
134
|
}
|
|
134
135
|
function T(e) {
|
|
135
136
|
const t = g.value;
|
|
@@ -165,8 +166,8 @@ const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "ari
|
|
|
165
166
|
}
|
|
166
167
|
} else e.key === "Enter" ? (e.preventDefault(), q(t)) : e.key === " " && (e.preventDefault(), d.checkable ? Z(t) : q(t));
|
|
167
168
|
}
|
|
168
|
-
const D = s(() => Math.max(24, d.rowHeight)), z = s(() => Math.max(120, d.viewportHeight)),
|
|
169
|
-
|
|
169
|
+
const D = s(() => Math.max(24, d.rowHeight)), z = s(() => Math.max(120, d.viewportHeight)), X = s(() => d.virtual ? Math.max(0, Math.floor(S.value / D.value) - 5) : 0), x = s(() => d.virtual ? Math.min(g.value.length, Math.ceil((S.value + z.value) / D.value) + 5) : g.value.length), de = s(() => g.value.slice(X.value, x.value)), oe = s(() => X.value * D.value), ie = s(() => Math.max(0, (g.value.length - x.value) * D.value));
|
|
170
|
+
W([b, f], () => {
|
|
170
171
|
S.value = 0, m.value && (m.value.scrollTop = 0);
|
|
171
172
|
});
|
|
172
173
|
function re(e) {
|
|
@@ -190,16 +191,16 @@ const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "ari
|
|
|
190
191
|
}
|
|
191
192
|
e.preventDefault();
|
|
192
193
|
const a = e.currentTarget.getBoundingClientRect(), o = (e.clientY - a.top) / a.height;
|
|
193
|
-
|
|
194
|
+
U.value = o < 0.25 ? "before" : o > 0.75 ? "after" : "inside", B.value = t.node.id;
|
|
194
195
|
}
|
|
195
196
|
function ce(e, t) {
|
|
196
|
-
B.value !== t.node.id || !A.value || (e.preventDefault(),
|
|
197
|
+
B.value !== t.node.id || !A.value || (e.preventDefault(), c("node-drop", { dragId: A.value, targetId: t.node.id, position: U.value }), j());
|
|
197
198
|
}
|
|
198
|
-
function
|
|
199
|
+
function j() {
|
|
199
200
|
A.value = "", B.value = "";
|
|
200
201
|
}
|
|
201
202
|
function ve(e, t) {
|
|
202
|
-
d.contextMenu && (e.preventDefault(), h.value = { node: t.node, x: Math.max(0, Math.min(e.clientX, window.innerWidth - 190)), y: Math.max(0, Math.min(e.clientY, window.innerHeight - 130)) },
|
|
203
|
+
d.contextMenu && (e.preventDefault(), h.value = { node: t.node, x: Math.max(0, Math.min(e.clientX, window.innerWidth - 190)), y: Math.max(0, Math.min(e.clientY, window.innerHeight - 130)) }, c("node-contextmenu", { node: t.node, x: e.clientX, y: e.clientY }));
|
|
203
204
|
}
|
|
204
205
|
function _(e) {
|
|
205
206
|
const t = h.value;
|
|
@@ -212,21 +213,21 @@ const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "ari
|
|
|
212
213
|
}
|
|
213
214
|
}
|
|
214
215
|
return fe(() => {
|
|
215
|
-
h.value = null,
|
|
216
|
+
h.value = null, j();
|
|
216
217
|
}), ee({ getNode: (e) => {
|
|
217
218
|
var t;
|
|
218
219
|
return (t = u.value.get(e)) == null ? void 0 : t.node;
|
|
219
220
|
}, getCheckedKeys: () => [...d.checkedKeys], setCheckedKeys: (e) => {
|
|
220
|
-
|
|
221
|
+
c("update:checkedKeys", e), c("check", e);
|
|
221
222
|
}, filter: (e) => b.value = e, expandAll: () => {
|
|
222
223
|
const e = [...u.value.values()].filter((t) => t.hasChildren).map((t) => t.node.id);
|
|
223
|
-
|
|
224
|
+
H.value = e, c("update:expandedKeys", e);
|
|
224
225
|
}, collapseAll: () => {
|
|
225
|
-
|
|
226
|
-
} }), (e, t) => (r(),
|
|
226
|
+
H.value = [], c("update:expandedKeys", []);
|
|
227
|
+
} }), (e, t) => (r(), v("div", G(I(Y), {
|
|
227
228
|
class: ["hys-ui-pf-tree", { "hys-ui-pf-tree-disabled": i.disabled }]
|
|
228
229
|
}), [
|
|
229
|
-
i.searchable ? pe((r(),
|
|
230
|
+
i.searchable ? pe((r(), v("input", {
|
|
230
231
|
key: 0,
|
|
231
232
|
"onUpdate:modelValue": t[0] || (t[0] = (l) => b.value = l),
|
|
232
233
|
class: "hys-ui-pf-tree-search",
|
|
@@ -234,7 +235,7 @@ const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "ari
|
|
|
234
235
|
placeholder: "搜索节点…",
|
|
235
236
|
"aria-label": "搜索树节点",
|
|
236
237
|
disabled: i.disabled
|
|
237
|
-
}, null, 8,
|
|
238
|
+
}, null, 8, Be)), [
|
|
238
239
|
[ye, b.value]
|
|
239
240
|
]) : w("", !0),
|
|
240
241
|
E("div", {
|
|
@@ -247,12 +248,12 @@ const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "ari
|
|
|
247
248
|
style: F({ maxHeight: z.value + "px" }),
|
|
248
249
|
onScroll: re
|
|
249
250
|
}, [
|
|
250
|
-
i.virtual ? (r(),
|
|
251
|
+
i.virtual ? (r(), v("div", {
|
|
251
252
|
key: 0,
|
|
252
253
|
style: F({ height: oe.value + "px" }),
|
|
253
254
|
"aria-hidden": "true"
|
|
254
255
|
}, null, 4)) : w("", !0),
|
|
255
|
-
(r(!0),
|
|
256
|
+
(r(!0), v(me, null, be(de.value, (l, n) => (r(), v("div", {
|
|
256
257
|
key: l.node.id,
|
|
257
258
|
class: ge(["hys-ui-pf-tree-row", { "hys-ui-pf-tree-selected": R.value.has(l.node.id), "hys-ui-pf-tree-line": i.showLine, "hys-ui-pf-tree-drop": B.value === l.node.id }]),
|
|
258
259
|
role: "treeitem",
|
|
@@ -261,7 +262,7 @@ const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "ari
|
|
|
261
262
|
"aria-selected": i.modelValue === l.node.id,
|
|
262
263
|
"aria-disabled": i.disabled || l.node.disabled,
|
|
263
264
|
"aria-checked": i.checkable ? L.value.has(l.node.id) ? "true" : Q.value.has(l.node.id) ? "mixed" : "false" : void 0,
|
|
264
|
-
tabindex: V.value === l.node.id || !V.value && n === 0 &&
|
|
265
|
+
tabindex: V.value === l.node.id || !V.value && n === 0 && X.value === 0 ? 0 : -1,
|
|
265
266
|
draggable: i.draggable && !i.disabled && !l.node.disabled,
|
|
266
267
|
"data-tree-id": l.node.id,
|
|
267
268
|
onFocus: (a) => V.value = l.node.id,
|
|
@@ -270,61 +271,61 @@ const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "ari
|
|
|
270
271
|
onDragstart: (a) => ue(a, l),
|
|
271
272
|
onDragover: (a) => se(a, l),
|
|
272
273
|
onDrop: (a) => ce(a, l),
|
|
273
|
-
onDragend:
|
|
274
|
+
onDragend: j,
|
|
274
275
|
onContextmenu: (a) => ve(a, l),
|
|
275
|
-
"data-drop-position": B.value === l.node.id ?
|
|
276
|
+
"data-drop-position": B.value === l.node.id ? U.value : void 0,
|
|
276
277
|
style: F({ "--hys-ui-tree-depth": l.depth, minHeight: i.virtual ? D.value + "px" : void 0, height: i.virtual ? D.value + "px" : void 0 })
|
|
277
278
|
}, [
|
|
278
|
-
l.hasChildren ? (r(),
|
|
279
|
+
l.hasChildren ? (r(), v("button", {
|
|
279
280
|
key: 0,
|
|
280
281
|
class: "hys-ui-pf-tree-expander",
|
|
281
282
|
type: "button",
|
|
282
283
|
"aria-label": f.value.includes(l.node.id) ? "折叠" : "展开",
|
|
283
284
|
disabled: i.disabled || l.node.disabled || K.value.includes(l.node.id),
|
|
284
|
-
onClick:
|
|
285
|
+
onClick: J((a) => N(l.node.id), ["stop"])
|
|
285
286
|
}, [
|
|
286
|
-
K.value.includes(l.node.id) ? (r(),
|
|
287
|
+
K.value.includes(l.node.id) ? (r(), O(I(Se), {
|
|
287
288
|
key: 0,
|
|
288
289
|
size: 15,
|
|
289
290
|
"aria-hidden": "true",
|
|
290
291
|
class: "hys-ui-icon-spin"
|
|
291
|
-
})) : (r(),
|
|
292
|
+
})) : (r(), O(ke(b.value.trim() || f.value.includes(l.node.id) ? I(Te) : I(Ie)), {
|
|
292
293
|
key: 1,
|
|
293
294
|
size: 15,
|
|
294
295
|
"aria-hidden": "true"
|
|
295
296
|
}))
|
|
296
|
-
], 8, $e)) : (r(),
|
|
297
|
-
i.checkable ? (r(),
|
|
297
|
+
], 8, $e)) : (r(), v("span", Ee)),
|
|
298
|
+
i.checkable ? (r(), O(Ae, {
|
|
298
299
|
key: 2,
|
|
299
|
-
|
|
300
|
-
|
|
300
|
+
tabindex: -1,
|
|
301
|
+
"model-value": L.value.has(l.node.id),
|
|
301
302
|
disabled: i.disabled || l.node.disabled || l.node.checkable === !1,
|
|
302
303
|
"aria-label": `勾选${l.node.label}`,
|
|
303
304
|
indeterminate: Q.value.has(l.node.id),
|
|
304
|
-
onClick: t[1] || (t[1] =
|
|
305
|
+
onClick: t[1] || (t[1] = J(() => {
|
|
305
306
|
}, ["stop"])),
|
|
306
307
|
onChange: (a) => Z(l)
|
|
307
|
-
}, null,
|
|
308
|
-
l.node.icon ? (r(),
|
|
308
|
+
}, null, 8, ["model-value", "disabled", "aria-label", "indeterminate", "onChange"])) : w("", !0),
|
|
309
|
+
l.node.icon ? (r(), v("span", Le, P(l.node.icon), 1)) : w("", !0),
|
|
309
310
|
we(e.$slots, "node", {
|
|
310
311
|
node: l.node,
|
|
311
312
|
depth: l.depth,
|
|
312
313
|
expanded: f.value.includes(l.node.id),
|
|
313
314
|
selected: i.modelValue === l.node.id
|
|
314
315
|
}, () => [
|
|
315
|
-
E("span", Ne,
|
|
316
|
+
E("span", Ne, P(l.node.label), 1)
|
|
316
317
|
], !0),
|
|
317
|
-
M.value[l.node.id] ? (r(),
|
|
318
|
-
], 46,
|
|
319
|
-
i.virtual ? (r(),
|
|
318
|
+
M.value[l.node.id] ? (r(), v("span", Re, P(M.value[l.node.id]), 1)) : w("", !0)
|
|
319
|
+
], 46, He))), 128)),
|
|
320
|
+
i.virtual ? (r(), v("div", {
|
|
320
321
|
key: 1,
|
|
321
322
|
style: F({ height: ie.value + "px" }),
|
|
322
323
|
"aria-hidden": "true"
|
|
323
324
|
}, null, 4)) : w("", !0),
|
|
324
|
-
g.value.length ? w("", !0) : (r(),
|
|
325
|
-
], 44,
|
|
326
|
-
(r(),
|
|
327
|
-
h.value ? (r(),
|
|
325
|
+
g.value.length ? w("", !0) : (r(), v("div", qe, P(b.value ? "无匹配节点" : "暂无数据"), 1))
|
|
326
|
+
], 44, Ve),
|
|
327
|
+
(r(), O(Ce, { to: "body" }, [
|
|
328
|
+
h.value ? (r(), v("div", G({ key: 0 }, I(Y), {
|
|
328
329
|
class: "hys-ui-pf-tree-context",
|
|
329
330
|
style: { left: h.value.x + "px", top: h.value.y + "px" },
|
|
330
331
|
role: "menu",
|
|
@@ -346,15 +347,15 @@ const Ie = ["disabled"], Be = ["aria-multiselectable"], Ve = ["aria-level", "ari
|
|
|
346
347
|
onClick: t[4] || (t[4] = (l) => h.value = null)
|
|
347
348
|
}, "关闭")
|
|
348
349
|
], 16)) : w("", !0),
|
|
349
|
-
h.value ? (r(),
|
|
350
|
+
h.value ? (r(), v("div", G({ key: 1 }, I(Y), {
|
|
350
351
|
class: "hys-ui-pf-tree-context-backdrop",
|
|
351
352
|
onClick: t[6] || (t[6] = (l) => h.value = null),
|
|
352
|
-
onContextmenu: t[7] || (t[7] =
|
|
353
|
+
onContextmenu: t[7] || (t[7] = J((l) => h.value = null, ["prevent"]))
|
|
353
354
|
}), null, 16)) : w("", !0)
|
|
354
355
|
]))
|
|
355
356
|
], 16));
|
|
356
357
|
}
|
|
357
358
|
});
|
|
358
359
|
export {
|
|
359
|
-
|
|
360
|
+
Ye as default
|
|
360
361
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ChevronDown as
|
|
3
|
-
import { useFloating as
|
|
4
|
-
import { useHysRootAttrs as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as j, ref as p, computed as v, watch as z, openBlock as u, createElementBlock as d, mergeProps as H, unref as n, createElementVNode as V, withKeys as P, withModifiers as W, toDisplayString as N, createVNode as G, createBlock as $, Teleport as J, withDirectives as Q, vModelText as X, createCommentVNode as h, Fragment as Y, renderList as Z, normalizeStyle as _, normalizeClass as ee, renderSlot as le, createTextVNode as ae, nextTick as te } from "vue";
|
|
2
|
+
import { ChevronDown as ne, Check as oe } from "lucide-vue-next";
|
|
3
|
+
import { useFloating as ue } from "../../composables/useFloating.js";
|
|
4
|
+
import { useHysRootAttrs as re } from "../../config.js";
|
|
5
|
+
const se = ["disabled", "aria-expanded"], ie = ["aria-multiselectable"], de = ["aria-selected", "disabled", "data-enabled", "onClick"], ce = { key: 0 }, be = /* @__PURE__ */ j({
|
|
6
6
|
__name: "HysTreeSelect",
|
|
7
7
|
props: {
|
|
8
8
|
modelValue: {},
|
|
@@ -15,110 +15,117 @@ const ue = ["disabled", "aria-expanded", "onKeydown"], re = ["aria-multiselectab
|
|
|
15
15
|
leafOnly: { type: Boolean }
|
|
16
16
|
},
|
|
17
17
|
emits: ["update:modelValue", "change", "clear"],
|
|
18
|
-
setup(
|
|
19
|
-
const t =
|
|
18
|
+
setup(s, { emit: K }) {
|
|
19
|
+
const t = s, w = K, x = re(), A = p(), b = p(), m = p(), y = p(""), o = p(0), { open: k, style: q, show: F, close: f } = ue(A, b, { matchWidth: !0 });
|
|
20
20
|
function B(e, a = 0, l = !1) {
|
|
21
|
-
return e.flatMap((
|
|
21
|
+
return e.flatMap((i) => [{ node: { ...i, disabled: l || i.disabled }, depth: a }, ...B(i.children || [], a + 1, l || i.disabled)]);
|
|
22
22
|
}
|
|
23
|
-
const D =
|
|
23
|
+
const D = v(() => B(t.nodes)), C = v(() => D.value.filter((e) => e.node.label.toLocaleLowerCase().includes(y.value.toLocaleLowerCase()))), c = v(() => C.value.filter((e) => {
|
|
24
24
|
var a;
|
|
25
25
|
return !e.node.disabled && (!t.leafOnly || !((a = e.node.children) != null && a.length));
|
|
26
|
-
})),
|
|
27
|
-
|
|
28
|
-
e &&
|
|
26
|
+
})), r = v(() => Array.isArray(t.modelValue) ? t.modelValue : [t.modelValue].filter(Boolean)), g = v(() => t.multiple || Array.isArray(t.modelValue)), R = v(() => D.value.filter((e) => r.value.includes(e.node.value)).map((e) => e.node.label).join("、"));
|
|
27
|
+
z(y, () => o.value = 0), z(() => t.disabled, (e) => {
|
|
28
|
+
e && f();
|
|
29
29
|
});
|
|
30
30
|
async function E() {
|
|
31
31
|
var e;
|
|
32
|
-
t.disabled || (
|
|
32
|
+
t.disabled || (y.value = "", await F(), await te(), o.value = Math.max(0, c.value.findIndex((a) => r.value.includes(a.node.value))), U() ? (e = m.value) == null || e.focus() : L());
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
|
|
34
|
+
function U() {
|
|
35
|
+
return t.searchable && m.value;
|
|
36
|
+
}
|
|
37
|
+
function L() {
|
|
38
|
+
var e, a;
|
|
39
|
+
(a = (e = b.value) == null ? void 0 : e.querySelectorAll("[data-enabled]")[o.value]) == null || a.focus();
|
|
36
40
|
}
|
|
37
41
|
function M(e) {
|
|
42
|
+
w("update:modelValue", e), w("change", e);
|
|
43
|
+
}
|
|
44
|
+
function S(e) {
|
|
38
45
|
var a;
|
|
39
|
-
t.disabled || e.disabled || t.leafOnly && ((a = e.children) != null && a.length) || (
|
|
46
|
+
t.disabled || e.disabled || t.leafOnly && ((a = e.children) != null && a.length) || (M(g.value ? r.value.includes(e.value) ? r.value.filter((l) => l !== e.value) : [...r.value, e.value] : e.value), g.value || f(!0));
|
|
40
47
|
}
|
|
41
|
-
function
|
|
48
|
+
function I(e) {
|
|
42
49
|
var a, l;
|
|
43
|
-
["ArrowDown", "ArrowUp", "Home", "End"].includes(e.key) ? (e.preventDefault(),
|
|
50
|
+
e.isComposing || e.keyCode === 229 || (["ArrowDown", "ArrowUp", "Home", "End"].includes(e.key) ? (e.preventDefault(), o.value = e.key === "Home" ? 0 : e.key === "End" ? c.value.length - 1 : Math.max(0, Math.min(c.value.length - 1, o.value + (e.key === "ArrowDown" ? 1 : -1))), (l = (a = b.value) == null ? void 0 : a.querySelectorAll("[data-enabled]")[o.value]) == null || l.scrollIntoView({ block: "nearest" }), document.activeElement !== m.value && L()) : e.key === "Enter" && c.value[o.value] ? (e.preventDefault(), S(c.value[o.value].node)) : e.key === "Escape" && (e.preventDefault(), f(!0)));
|
|
44
51
|
}
|
|
45
|
-
return (e, a) => (
|
|
52
|
+
return (e, a) => (u(), d("div", H(n(x), { class: "hys-ui-v4-relative" }), [
|
|
46
53
|
V("button", {
|
|
47
54
|
ref_key: "trigger",
|
|
48
|
-
ref:
|
|
55
|
+
ref: A,
|
|
49
56
|
type: "button",
|
|
50
57
|
class: "hys-ui-v4-control hys-ui-pf-select-trigger",
|
|
51
|
-
disabled:
|
|
58
|
+
disabled: s.disabled,
|
|
52
59
|
"aria-haspopup": "listbox",
|
|
53
|
-
"aria-expanded": n(
|
|
54
|
-
onClick: a[0] || (a[0] = (l) => n(
|
|
55
|
-
onKeydown:
|
|
60
|
+
"aria-expanded": n(k),
|
|
61
|
+
onClick: a[0] || (a[0] = (l) => n(k) ? n(f)() : E()),
|
|
62
|
+
onKeydown: a[1] || (a[1] = P(W((l) => n(k) ? I(l) : E(), ["prevent"]), ["down"]))
|
|
56
63
|
}, [
|
|
57
|
-
V("span", null,
|
|
58
|
-
|
|
64
|
+
V("span", null, N(R.value || s.placeholder || "选择节点"), 1),
|
|
65
|
+
G(n(ne), {
|
|
59
66
|
size: 16,
|
|
60
67
|
class: "hys-ui-pf-select-chevron"
|
|
61
68
|
})
|
|
62
|
-
], 40,
|
|
63
|
-
(
|
|
64
|
-
n(
|
|
69
|
+
], 40, se),
|
|
70
|
+
(u(), $(J, { to: "body" }, [
|
|
71
|
+
n(k) ? (u(), d("div", H({
|
|
65
72
|
key: 0,
|
|
66
73
|
ref_key: "panel",
|
|
67
|
-
ref:
|
|
68
|
-
}, n(
|
|
74
|
+
ref: b
|
|
75
|
+
}, n(x), {
|
|
69
76
|
class: "hys-ui-v4-menu hys-ui-pf-select-menu hys-ui-pf-tree-select-menu",
|
|
70
|
-
style: n(
|
|
71
|
-
onKeydown:
|
|
77
|
+
style: n(q),
|
|
78
|
+
onKeydown: I
|
|
72
79
|
}), [
|
|
73
|
-
|
|
80
|
+
s.searchable ? Q((u(), d("input", {
|
|
74
81
|
key: 0,
|
|
75
82
|
ref_key: "searchInput",
|
|
76
|
-
ref:
|
|
77
|
-
"onUpdate:modelValue": a[
|
|
83
|
+
ref: m,
|
|
84
|
+
"onUpdate:modelValue": a[2] || (a[2] = (l) => y.value = l),
|
|
78
85
|
class: "hys-ui-v4-control",
|
|
79
86
|
placeholder: "搜索节点",
|
|
80
87
|
"aria-label": "搜索节点"
|
|
81
88
|
}, null, 512)), [
|
|
82
|
-
[
|
|
89
|
+
[X, y.value]
|
|
83
90
|
]) : h("", !0),
|
|
84
91
|
V("div", {
|
|
85
92
|
class: "hys-ui-v4-scroll",
|
|
86
93
|
role: "listbox",
|
|
87
|
-
"aria-multiselectable":
|
|
94
|
+
"aria-multiselectable": g.value || void 0,
|
|
88
95
|
"aria-label": "节点选择"
|
|
89
96
|
}, [
|
|
90
|
-
(
|
|
91
|
-
var
|
|
92
|
-
return
|
|
97
|
+
(u(!0), d(Y, null, Z(C.value, (l) => {
|
|
98
|
+
var i, O, T;
|
|
99
|
+
return u(), d("button", {
|
|
93
100
|
key: l.node.value,
|
|
94
101
|
type: "button",
|
|
95
102
|
role: "option",
|
|
96
|
-
"aria-selected":
|
|
97
|
-
disabled: l.node.disabled ||
|
|
98
|
-
"data-enabled": l.node.disabled ||
|
|
99
|
-
class:
|
|
100
|
-
style:
|
|
101
|
-
onClick: (
|
|
103
|
+
"aria-selected": r.value.includes(l.node.value),
|
|
104
|
+
disabled: l.node.disabled || s.leafOnly && !!((i = l.node.children) != null && i.length),
|
|
105
|
+
"data-enabled": l.node.disabled || s.leafOnly && ((O = l.node.children) != null && O.length) ? void 0 : "",
|
|
106
|
+
class: ee(["hys-ui-v4-option", { "hys-ui-v4-active": ((T = c.value[o.value]) == null ? void 0 : T.node.value) === l.node.value }]),
|
|
107
|
+
style: _({ paddingLeft: 12 + l.depth * 16 + "px" }),
|
|
108
|
+
onClick: (ve) => S(l.node)
|
|
102
109
|
}, [
|
|
103
|
-
|
|
110
|
+
le(e.$slots, "option", {
|
|
104
111
|
node: l.node
|
|
105
112
|
}, () => [
|
|
106
|
-
|
|
113
|
+
ae(N(l.node.label), 1)
|
|
107
114
|
]),
|
|
108
|
-
|
|
115
|
+
r.value.includes(l.node.value) ? (u(), $(n(oe), {
|
|
109
116
|
key: 0,
|
|
110
117
|
size: 15
|
|
111
118
|
})) : h("", !0)
|
|
112
|
-
], 14,
|
|
119
|
+
], 14, de);
|
|
113
120
|
}), 128)),
|
|
114
|
-
|
|
115
|
-
], 8,
|
|
116
|
-
|
|
121
|
+
C.value.length ? h("", !0) : (u(), d("p", ce, "无匹配节点"))
|
|
122
|
+
], 8, ie),
|
|
123
|
+
s.clearable && r.value.length ? (u(), d("button", {
|
|
117
124
|
key: 1,
|
|
118
125
|
type: "button",
|
|
119
126
|
class: "hys-ui-v4-option",
|
|
120
|
-
onClick: a[
|
|
121
|
-
|
|
127
|
+
onClick: a[3] || (a[3] = (l) => {
|
|
128
|
+
M(g.value ? [] : ""), w("clear"), n(f)(!0);
|
|
122
129
|
})
|
|
123
130
|
}, "清空选择")) : h("", !0)
|
|
124
131
|
], 16)) : h("", !0)
|
|
@@ -127,5 +134,5 @@ const ue = ["disabled", "aria-expanded", "onKeydown"], re = ["aria-multiselectab
|
|
|
127
134
|
}
|
|
128
135
|
});
|
|
129
136
|
export {
|
|
130
|
-
|
|
137
|
+
be as default
|
|
131
138
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./HysUpload2.vue.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const d = /* @__PURE__ */ t(o, [["__scopeId", "data-v-d2ca10d8"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
d as default
|
|
7
7
|
};
|