@duxweb/dvha-pro 1.1.21 → 1.1.22
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/dist/cjs/component.cjs +1 -1
- package/dist/cjs/components/cascaderPanel/cascaderPanel.cjs +1 -0
- package/dist/cjs/components/chart/echart.cjs +1 -1
- package/dist/cjs/components/dashboard/helloBig.cjs +1 -1
- package/dist/cjs/components/data/dynamicData.cjs +1 -1
- package/dist/cjs/components/data/selectModal.cjs +1 -1
- package/dist/cjs/components/designEditor/editor/setting.cjs +1 -1
- package/dist/cjs/components/designEditor/editor.cjs +1 -1
- package/dist/cjs/components/drawer/drawer.cjs +1 -1
- package/dist/cjs/components/flowEditor/components/setting.cjs +1 -1
- package/dist/cjs/components/form/drawerForm.cjs +1 -1
- package/dist/cjs/components/form/formItem.cjs +1 -1
- package/dist/cjs/components/form/modalForm.cjs +1 -1
- package/dist/cjs/components/form/pageForm.cjs +1 -1
- package/dist/cjs/components/form/pageTabForm.cjs +1 -1
- package/dist/cjs/components/form/settingForm.cjs +1 -1
- package/dist/cjs/components/formEditor/components/imageUpload.cjs +1 -1
- package/dist/cjs/components/formEditor/editor.cjs +1 -1
- package/dist/cjs/components/layout/table.cjs +1 -1
- package/dist/cjs/components/layout/tools.cjs +1 -1
- package/dist/cjs/components/mapCoord/mapCoord.cjs +1 -0
- package/dist/cjs/components/media/media.cjs +1 -1
- package/dist/cjs/components/modal/modalTab.cjs +1 -1
- package/dist/cjs/components/panel/setting.cjs +1 -1
- package/dist/cjs/components/posterEditor/posterEditor.cjs +1 -1
- package/dist/cjs/components/select/selectCard.cjs +1 -1
- package/dist/cjs/components/spec/spec.cjs +1 -1
- package/dist/cjs/components/stats/realTime.cjs +1 -1
- package/dist/cjs/components/table/table.cjs +1 -1
- package/dist/cjs/components/textImageEditor/textImageEditor.cjs +1 -0
- package/dist/cjs/components/textImageEditor/textModal.cjs +1 -0
- package/dist/cjs/components/upload/image.cjs +1 -1
- package/dist/cjs/components/upload/manage/item.cjs +1 -1
- package/dist/cjs/components/upload/manager.cjs +1 -1
- package/dist/cjs/components/upload/video.cjs +1 -0
- package/dist/cjs/components/widget/connect.cjs +1 -1
- package/dist/cjs/dvha-pro.css +1 -1
- package/dist/cjs/hooks/dialog.cjs +1 -1
- package/dist/cjs/hooks/drawer.cjs +1 -1
- package/dist/cjs/hooks/modal.cjs +1 -1
- package/dist/cjs/hooks/table/image.cjs +1 -1
- package/dist/cjs/hooks/table/media.cjs +1 -1
- package/dist/cjs/hooks/table/switch.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/langs/en-US.json.cjs +1 -1
- package/dist/cjs/langs/zh-CN.json.cjs +1 -1
- package/dist/cjs/pages/authLayout.cjs +1 -1
- package/dist/cjs/pages/login.cjs +1 -1
- package/dist/cjs/pages/menu/avatar.cjs +1 -1
- package/dist/cjs/pages/menu/button.cjs +1 -1
- package/dist/cjs/pages/menu/menuApp.cjs +1 -1
- package/dist/cjs/pages/menu/mobile.cjs +1 -1
- package/dist/cjs/pages/menu/notice.cjs +1 -1
- package/dist/cjs/pages/page404.cjs +1 -1
- package/dist/cjs/pages/pageStatus.cjs +1 -1
- package/dist/cjs/theme/uno.css.cjs +24 -2
- package/dist/esm/component.js +21 -20
- package/dist/esm/components/cascaderPanel/cascaderPanel.js +378 -0
- package/dist/esm/components/chart/echart.js +1 -1
- package/dist/esm/components/dashboard/helloBig.js +3 -2
- package/dist/esm/components/data/dynamicData.js +49 -40
- package/dist/esm/components/data/selectModal.js +3 -3
- package/dist/esm/components/designEditor/editor/setting.js +2 -2
- package/dist/esm/components/designEditor/editor.js +3 -2
- package/dist/esm/components/drawer/drawer.js +22 -19
- package/dist/esm/components/flowEditor/components/setting.js +1 -1
- package/dist/esm/components/form/drawerForm.js +1 -1
- package/dist/esm/components/form/formItem.js +1 -1
- package/dist/esm/components/form/modalForm.js +1 -1
- package/dist/esm/components/form/pageForm.js +1 -1
- package/dist/esm/components/form/pageTabForm.js +1 -1
- package/dist/esm/components/form/settingForm.js +1 -1
- package/dist/esm/components/formEditor/components/imageUpload.js +1 -1
- package/dist/esm/components/formEditor/editor.js +1 -1
- package/dist/esm/components/layout/table.js +74 -56
- package/dist/esm/components/layout/tools.js +8 -8
- package/dist/esm/components/mapCoord/mapCoord.js +218 -0
- package/dist/esm/components/media/media.js +57 -32
- package/dist/esm/components/modal/modalTab.js +20 -14
- package/dist/esm/components/panel/setting.js +3 -2
- package/dist/esm/components/posterEditor/posterEditor.js +1 -1
- package/dist/esm/components/select/selectCard.js +3 -3
- package/dist/esm/components/spec/spec.js +142 -103
- package/dist/esm/components/stats/realTime.js +5 -4
- package/dist/esm/components/table/table.js +19 -19
- package/dist/esm/components/textImageEditor/textImageEditor.js +405 -0
- package/dist/esm/components/textImageEditor/textModal.js +77 -0
- package/dist/esm/components/upload/image.js +35 -34
- package/dist/esm/components/upload/manage/item.js +1 -1
- package/dist/esm/components/upload/manager.js +155 -138
- package/dist/esm/components/upload/video.js +340 -0
- package/dist/esm/components/widget/connect.js +3 -2
- package/dist/esm/dvha-pro.css +1 -1
- package/dist/esm/hooks/dialog.js +2 -2
- package/dist/esm/hooks/drawer.js +2 -2
- package/dist/esm/hooks/modal.js +2 -2
- package/dist/esm/hooks/table/image.js +2 -2
- package/dist/esm/hooks/table/media.js +2 -2
- package/dist/esm/hooks/table/switch.js +58 -26
- package/dist/esm/index.js +308 -296
- package/dist/esm/langs/en-US.json.js +1 -1
- package/dist/esm/langs/zh-CN.json.js +1 -1
- package/dist/esm/pages/authLayout.js +1 -1
- package/dist/esm/pages/login.js +1 -1
- package/dist/esm/pages/menu/avatar.js +1 -1
- package/dist/esm/pages/menu/button.js +1 -1
- package/dist/esm/pages/menu/menuApp.js +1 -1
- package/dist/esm/pages/menu/mobile.js +1 -1
- package/dist/esm/pages/menu/notice.js +1 -1
- package/dist/esm/pages/page404.js +1 -1
- package/dist/esm/pages/pageStatus.js +2 -2
- package/dist/esm/theme/uno.css.js +24 -2
- package/dist/types/components/cascaderPanel/cascaderPanel.d.ts +110 -0
- package/dist/types/components/cascaderPanel/index.d.ts +1 -0
- package/dist/types/components/data/dynamicData.d.ts +10 -0
- package/dist/types/components/data/index.d.ts +1 -1
- package/dist/types/components/data/selectModal.d.ts +2 -2
- package/dist/types/components/drawer/drawer.d.ts +1 -1
- package/dist/types/components/flowEditor/components/kvInput.d.ts +1 -1
- package/dist/types/components/flowEditor/components/nodeCard.d.ts +1 -1
- package/dist/types/components/form/drawerForm.d.ts +2 -2
- package/dist/types/components/form/formLayout.d.ts +2 -2
- package/dist/types/components/form/modalForm.d.ts +2 -2
- package/dist/types/components/index.d.ts +3 -0
- package/dist/types/components/level/level.d.ts +2 -2
- package/dist/types/components/mapCoord/index.d.ts +1 -0
- package/dist/types/components/mapCoord/mapCoord.d.ts +93 -0
- package/dist/types/components/media/media.d.ts +3 -32
- package/dist/types/components/modal/modalTab.d.ts +5 -5
- package/dist/types/components/select/checkboxTag.d.ts +2 -2
- package/dist/types/components/select/dateTag.d.ts +2 -2
- package/dist/types/components/select/radioTag.d.ts +2 -2
- package/dist/types/components/select/selectCard.d.ts +4 -4
- package/dist/types/components/spec/spec.d.ts +21 -0
- package/dist/types/components/table/table.d.ts +3 -3
- package/dist/types/components/textImageEditor/index.d.ts +2 -0
- package/dist/types/components/textImageEditor/textImageEditor.d.ts +56 -0
- package/dist/types/components/textImageEditor/textModal.d.ts +72 -0
- package/dist/types/components/textImageEditor/types.d.ts +19 -0
- package/dist/types/components/upload/index.d.ts +1 -0
- package/dist/types/components/upload/video.d.ts +126 -0
- package/dist/types/components/widget/index.d.ts +1 -0
- package/dist/types/hooks/table/column.d.ts +1 -1
- package/dist/types/hooks/table/switch.d.ts +1 -1
- package/dist/types/main.d.ts +5 -0
- package/package.json +3 -3
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import { defineComponent as X, ref as N, watch as b, toRef as E, computed as I, createVNode as o, createTextVNode as Y, isVNode as Z } from "vue";
|
|
2
|
+
import { useI18n as ee, useTree as te } from "@duxweb/dvha-core";
|
|
3
|
+
import { useVModel as le } from "@vueuse/core";
|
|
4
|
+
import { NSpin as ae, NButton as R, NScrollbar as ne, NCheckbox as re } from "naive-ui";
|
|
5
|
+
function _(n) {
|
|
6
|
+
return typeof n == "function" || Object.prototype.toString.call(n) === "[object Object]" && !Z(n);
|
|
7
|
+
}
|
|
8
|
+
const oe = /* @__PURE__ */ X({
|
|
9
|
+
name: "DuxCascaderPanel",
|
|
10
|
+
props: {
|
|
11
|
+
value: {
|
|
12
|
+
type: [String, Number, Array],
|
|
13
|
+
default: () => []
|
|
14
|
+
},
|
|
15
|
+
options: Array,
|
|
16
|
+
path: String,
|
|
17
|
+
params: Object,
|
|
18
|
+
treeOptions: Object,
|
|
19
|
+
maxLevel: {
|
|
20
|
+
type: Number,
|
|
21
|
+
default: 3
|
|
22
|
+
},
|
|
23
|
+
maxHeight: {
|
|
24
|
+
type: Number,
|
|
25
|
+
default: 420
|
|
26
|
+
},
|
|
27
|
+
labelField: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: "label"
|
|
30
|
+
},
|
|
31
|
+
valueField: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: "value"
|
|
34
|
+
},
|
|
35
|
+
childrenField: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: "children"
|
|
38
|
+
},
|
|
39
|
+
multiple: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: !1
|
|
42
|
+
},
|
|
43
|
+
cascade: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: !0
|
|
46
|
+
},
|
|
47
|
+
checkStrategy: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: "all"
|
|
50
|
+
},
|
|
51
|
+
showPath: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: !0
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
emits: ["update:value"],
|
|
57
|
+
setup(n, {
|
|
58
|
+
emit: D
|
|
59
|
+
}) {
|
|
60
|
+
const S = le(n, "value", D, {
|
|
61
|
+
passive: !1,
|
|
62
|
+
defaultValue: []
|
|
63
|
+
}), {
|
|
64
|
+
t: C
|
|
65
|
+
} = ee(), c = N([]), s = N([]), m = N([]), O = N(!1);
|
|
66
|
+
if (n.options !== void 0)
|
|
67
|
+
b(() => n.options, (t) => {
|
|
68
|
+
m.value = Array.isArray(t) ? t : [];
|
|
69
|
+
}, {
|
|
70
|
+
immediate: !0,
|
|
71
|
+
deep: !0
|
|
72
|
+
});
|
|
73
|
+
else if (n.path) {
|
|
74
|
+
const t = E(n, "path", ""), e = E(n, "params", {}), l = E(n, "treeOptions", {}), r = te({
|
|
75
|
+
path: t,
|
|
76
|
+
params: e,
|
|
77
|
+
...l.value
|
|
78
|
+
});
|
|
79
|
+
b(r.options, (a) => {
|
|
80
|
+
m.value = Array.isArray(a) ? a : [];
|
|
81
|
+
}, {
|
|
82
|
+
immediate: !0,
|
|
83
|
+
deep: !0
|
|
84
|
+
}), b(r.loading, (a) => {
|
|
85
|
+
O.value = !!a;
|
|
86
|
+
}, {
|
|
87
|
+
immediate: !0
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
const J = (t) => {
|
|
91
|
+
const e = n.labelField;
|
|
92
|
+
return t?.[e] ?? t?.label ?? t?.name ?? t?.title ?? "";
|
|
93
|
+
}, f = (t) => {
|
|
94
|
+
const e = n.valueField;
|
|
95
|
+
return t?.[e] ?? t?.value ?? t?.id ?? t?.code ?? t?.key ?? "";
|
|
96
|
+
}, g = (t) => {
|
|
97
|
+
const e = n.childrenField, l = t?.[e] ?? t?.children;
|
|
98
|
+
return Array.isArray(l) ? l : [];
|
|
99
|
+
}, j = (t) => Array.isArray(t) && t.every((e) => typeof e == "string" || typeof e == "number"), B = (t) => Array.isArray(t) && t.every((e) => j(e)), P = (t) => JSON.stringify(t), $ = (t, e) => {
|
|
100
|
+
let l = t, r = 0, a;
|
|
101
|
+
for (const i of e) {
|
|
102
|
+
if (a = l.find((u) => String(f(u)) === String(i)), !a)
|
|
103
|
+
return null;
|
|
104
|
+
r += 1, l = g(a);
|
|
105
|
+
}
|
|
106
|
+
return a ? {
|
|
107
|
+
node: a,
|
|
108
|
+
level: r - 1
|
|
109
|
+
} : null;
|
|
110
|
+
}, k = (t, e, l) => {
|
|
111
|
+
if (!n.cascade)
|
|
112
|
+
return [e];
|
|
113
|
+
const r = g(t);
|
|
114
|
+
if (l >= n.maxLevel - 1 || r.length === 0)
|
|
115
|
+
return [e];
|
|
116
|
+
const a = [];
|
|
117
|
+
for (const i of r)
|
|
118
|
+
a.push(...k(i, [...e, f(i)], l + 1));
|
|
119
|
+
return a;
|
|
120
|
+
}, K = (t) => {
|
|
121
|
+
const e = $(m.value, t);
|
|
122
|
+
return e ? k(e.node, t, e.level) : [t];
|
|
123
|
+
}, F = (t, e) => {
|
|
124
|
+
for (const l of t) {
|
|
125
|
+
const r = f(l);
|
|
126
|
+
if (String(r) === String(e))
|
|
127
|
+
return [r];
|
|
128
|
+
const a = g(l);
|
|
129
|
+
if (a.length) {
|
|
130
|
+
const i = F(a, e);
|
|
131
|
+
if (i)
|
|
132
|
+
return [r, ...i];
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return null;
|
|
136
|
+
}, x = (t) => n.multiple ? n.showPath ? t : t.map((e) => e[e.length - 1]).filter((e) => e != null) : t.length ? n.showPath ? t[0] : t[0][t[0].length - 1] : n.showPath ? [] : null, p = (t, e) => t.length !== e.length ? !1 : t.every((l, r) => String(l) === String(e[r])), w = () => {
|
|
137
|
+
const t = Array.isArray(c.value) ? [...c.value] : [];
|
|
138
|
+
let e = m.value, l = !1;
|
|
139
|
+
for (let r = 0; r < n.maxLevel; r++) {
|
|
140
|
+
if (!Array.isArray(e) || e.length === 0) {
|
|
141
|
+
t.length > r && (t.splice(r), l = !0);
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
const a = t[r], i = e.find((u) => String(f(u)) === String(a));
|
|
145
|
+
if (i)
|
|
146
|
+
e = g(i);
|
|
147
|
+
else {
|
|
148
|
+
const u = f(e[0]);
|
|
149
|
+
if (u !== "" && u !== void 0 && u !== null)
|
|
150
|
+
t[r] = u, l = !0, e = g(e[0]);
|
|
151
|
+
else {
|
|
152
|
+
t.splice(r), l = !0;
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
l && (c.value = t, n.multiple || (s.value = t.length ? [t] : [], S.value = x(s.value)));
|
|
158
|
+
};
|
|
159
|
+
b(m, w, {
|
|
160
|
+
immediate: !0,
|
|
161
|
+
deep: !0
|
|
162
|
+
}), b(() => n.maxLevel, w, {
|
|
163
|
+
immediate: !0
|
|
164
|
+
}), b(() => n.value, (t) => {
|
|
165
|
+
if (n.showPath) {
|
|
166
|
+
if (n.multiple) {
|
|
167
|
+
if (B(t)) {
|
|
168
|
+
const e = t.map((l) => l.slice(0, n.maxLevel));
|
|
169
|
+
if (s.value = e, c.value.length && e.some((l) => p(l, c.value)))
|
|
170
|
+
c.value = [...c.value];
|
|
171
|
+
else {
|
|
172
|
+
const l = e[e.length - 1];
|
|
173
|
+
c.value = l ? [...l] : [];
|
|
174
|
+
}
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
} else if (j(t)) {
|
|
178
|
+
const e = t;
|
|
179
|
+
s.value = e.length ? [e.slice(0, n.maxLevel)] : [], c.value = s.value[0] ? [...s.value[0]] : [];
|
|
180
|
+
return;
|
|
181
|
+
} else if (B(t)) {
|
|
182
|
+
const e = t[0] || [];
|
|
183
|
+
s.value = e.length ? [e.slice(0, n.maxLevel)] : [], c.value = s.value[0] ? [...s.value[0]] : [];
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
} else {
|
|
187
|
+
if (n.multiple && Array.isArray(t)) {
|
|
188
|
+
const e = t.map((l) => F(m.value, l)).filter((l) => Array.isArray(l) && l.length > 0);
|
|
189
|
+
if (s.value = e, c.value.length && e.some((l) => p(l, c.value)))
|
|
190
|
+
c.value = [...c.value];
|
|
191
|
+
else {
|
|
192
|
+
const l = e[e.length - 1];
|
|
193
|
+
c.value = l ? [...l] : [];
|
|
194
|
+
}
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (!n.multiple && t !== void 0 && t !== null && !Array.isArray(t)) {
|
|
198
|
+
const e = F(m.value, t);
|
|
199
|
+
s.value = e ? [e] : [], c.value = e ? [...e] : [];
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
s.value = [], c.value = [];
|
|
204
|
+
}, {
|
|
205
|
+
immediate: !0,
|
|
206
|
+
deep: !0
|
|
207
|
+
});
|
|
208
|
+
const M = I(() => {
|
|
209
|
+
const t = [];
|
|
210
|
+
let e = m.value;
|
|
211
|
+
for (let l = 0; l < n.maxLevel; l++) {
|
|
212
|
+
const r = c.value?.[l];
|
|
213
|
+
t.push({
|
|
214
|
+
level: l,
|
|
215
|
+
items: e,
|
|
216
|
+
activeValue: r
|
|
217
|
+
});
|
|
218
|
+
const a = e.find((i) => String(f(i)) === String(r));
|
|
219
|
+
e = a ? g(a) : [];
|
|
220
|
+
}
|
|
221
|
+
return t;
|
|
222
|
+
}), U = I(() => ({
|
|
223
|
+
gridTemplateColumns: `repeat(${n.maxLevel}, minmax(160px, 1fr))`
|
|
224
|
+
})), T = (t, e) => t >= n.maxLevel - 1 ? !0 : g(e).length === 0, q = (t, e) => n.multiple ? n.checkStrategy === "child" ? T(t, e) : n.checkStrategy === "parent" ? !T(t, e) : !0 : !0, G = (t, e) => {
|
|
225
|
+
const l = Array.isArray(c.value) ? [...c.value] : [];
|
|
226
|
+
l[t] = f(e), l.splice(t + 1), c.value = l;
|
|
227
|
+
}, L = (t, e) => [...c.value.slice(0, t), f(e)], V = () => {
|
|
228
|
+
const t = /* @__PURE__ */ new Set(), e = Array.isArray(s.value) ? s.value : [];
|
|
229
|
+
return n.cascade ? (e.forEach((l) => {
|
|
230
|
+
K(l).forEach((r) => t.add(P(r)));
|
|
231
|
+
}), t) : (e.forEach((l) => t.add(P(l))), t);
|
|
232
|
+
}, Q = (t, e, l, r) => {
|
|
233
|
+
const a = k(e, t, l);
|
|
234
|
+
if (a.length === 0)
|
|
235
|
+
return {
|
|
236
|
+
checked: !1,
|
|
237
|
+
indeterminate: !1
|
|
238
|
+
};
|
|
239
|
+
const i = a.filter((u) => r.has(P(u))).length;
|
|
240
|
+
return {
|
|
241
|
+
checked: i > 0 && i === a.length,
|
|
242
|
+
indeterminate: i > 0 && i < a.length
|
|
243
|
+
};
|
|
244
|
+
}, z = (t) => {
|
|
245
|
+
const e = Array.from(t).map((a) => JSON.parse(a));
|
|
246
|
+
if (!n.cascade || n.checkStrategy === "child")
|
|
247
|
+
return e;
|
|
248
|
+
const l = [], r = (a, i, u) => {
|
|
249
|
+
const v = g(a);
|
|
250
|
+
if (u >= n.maxLevel - 1 || v.length === 0) {
|
|
251
|
+
const h = t.has(P(i));
|
|
252
|
+
return {
|
|
253
|
+
allSelected: h,
|
|
254
|
+
paths: h ? [i] : []
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
const d = v.map((h) => r(h, [...i, f(h)], u + 1)), A = d.length > 0 && d.every((h) => h.allSelected);
|
|
258
|
+
let y = [];
|
|
259
|
+
return n.checkStrategy === "parent" ? A ? y = [i] : d.forEach((h) => y.push(...h.paths)) : (A && y.push(i), d.forEach((h) => y.push(...h.paths))), {
|
|
260
|
+
allSelected: A,
|
|
261
|
+
paths: y
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
return m.value.forEach((a) => {
|
|
265
|
+
const i = r(a, [f(a)], 0);
|
|
266
|
+
l.push(...i.paths);
|
|
267
|
+
}), l;
|
|
268
|
+
}, W = (t, e, l) => {
|
|
269
|
+
const r = L(t, e);
|
|
270
|
+
if (c.value = r, n.multiple) {
|
|
271
|
+
if (!q(t, e))
|
|
272
|
+
return;
|
|
273
|
+
if (n.cascade) {
|
|
274
|
+
const a = V();
|
|
275
|
+
k(e, r, t).forEach((v) => {
|
|
276
|
+
const d = P(v);
|
|
277
|
+
l ? a.add(d) : a.delete(d);
|
|
278
|
+
});
|
|
279
|
+
const u = z(a);
|
|
280
|
+
s.value = u, S.value = x(u);
|
|
281
|
+
} else {
|
|
282
|
+
const a = Array.isArray(s.value) ? [...s.value] : [], i = a.findIndex((u) => p(u, r));
|
|
283
|
+
l && i < 0 && a.push(r), !l && i >= 0 && a.splice(i, 1), s.value = a, S.value = x(a);
|
|
284
|
+
}
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
l ? (s.value = [r], S.value = x(s.value)) : (s.value = [], S.value = x([]));
|
|
288
|
+
}, H = (t, e, l) => {
|
|
289
|
+
if (!n.multiple || e.length === 0)
|
|
290
|
+
return;
|
|
291
|
+
if (n.cascade) {
|
|
292
|
+
const a = V();
|
|
293
|
+
e.forEach((u) => {
|
|
294
|
+
const v = L(t, u);
|
|
295
|
+
k(u, v, t).forEach((A) => {
|
|
296
|
+
const y = P(A);
|
|
297
|
+
l ? a.add(y) : a.delete(y);
|
|
298
|
+
});
|
|
299
|
+
});
|
|
300
|
+
const i = z(a);
|
|
301
|
+
s.value = i, S.value = x(i);
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
const r = Array.isArray(s.value) ? [...s.value] : [];
|
|
305
|
+
e.forEach((a) => {
|
|
306
|
+
const i = L(t, a), u = r.findIndex((v) => p(v, i));
|
|
307
|
+
l && u < 0 && r.push(i), !l && u >= 0 && r.splice(u, 1);
|
|
308
|
+
}), s.value = r, S.value = x(r);
|
|
309
|
+
};
|
|
310
|
+
return () => {
|
|
311
|
+
const t = V();
|
|
312
|
+
return o(ae, {
|
|
313
|
+
show: O.value
|
|
314
|
+
}, {
|
|
315
|
+
default: () => [o("div", {
|
|
316
|
+
class: "grid gap-3",
|
|
317
|
+
style: U.value
|
|
318
|
+
}, [M.value.map((e) => {
|
|
319
|
+
let l, r;
|
|
320
|
+
return o("div", {
|
|
321
|
+
key: e.level,
|
|
322
|
+
class: "border border-muted rounded"
|
|
323
|
+
}, [n.multiple ? o("div", {
|
|
324
|
+
class: "flex items-center justify-between px-2 py-2 border-b border-muted"
|
|
325
|
+
}, [o("span", {
|
|
326
|
+
class: "text-xs text-muted"
|
|
327
|
+
}, [C("components.cascaderPanel.level", {
|
|
328
|
+
num: e.level + 1
|
|
329
|
+
})]), o("div", {
|
|
330
|
+
class: "flex items-center gap-2"
|
|
331
|
+
}, [o(R, {
|
|
332
|
+
size: "small",
|
|
333
|
+
tertiary: !0,
|
|
334
|
+
onClick: (a) => {
|
|
335
|
+
a.stopPropagation(), H(e.level, e.items || [], !0);
|
|
336
|
+
}
|
|
337
|
+
}, _(l = C("components.cascaderPanel.selectAll")) ? l : {
|
|
338
|
+
default: () => [l]
|
|
339
|
+
}), o(R, {
|
|
340
|
+
size: "small",
|
|
341
|
+
tertiary: !0,
|
|
342
|
+
onClick: (a) => {
|
|
343
|
+
a.stopPropagation(), H(e.level, e.items || [], !1);
|
|
344
|
+
}
|
|
345
|
+
}, _(r = C("components.cascaderPanel.clearAll")) ? r : {
|
|
346
|
+
default: () => [r]
|
|
347
|
+
})])]) : null, o(ne, {
|
|
348
|
+
style: {
|
|
349
|
+
maxHeight: `${n.maxHeight}px`
|
|
350
|
+
}
|
|
351
|
+
}, {
|
|
352
|
+
default: () => [o("div", {
|
|
353
|
+
class: "p-2 space-y-2"
|
|
354
|
+
}, [e.items?.map((a) => {
|
|
355
|
+
const i = f(a), u = String(e.activeValue) === String(i), v = L(e.level, a), d = Q(v, a, e.level, t);
|
|
356
|
+
return o("div", {
|
|
357
|
+
key: String(i),
|
|
358
|
+
class: ["flex items-center justify-between gap-2 px-2 py-1 rounded cursor-pointer", u ? "bg-muted" : "hover:bg-muted"],
|
|
359
|
+
onClick: () => G(e.level, a)
|
|
360
|
+
}, [o("div", {
|
|
361
|
+
class: "flex items-center gap-2"
|
|
362
|
+
}, [o(re, {
|
|
363
|
+
checked: d.checked,
|
|
364
|
+
indeterminate: d.indeterminate,
|
|
365
|
+
onUpdateChecked: (A) => W(e.level, a, !!A)
|
|
366
|
+
}, null), o("span", null, [J(a)])]), e.level < n.maxLevel - 1 ? o("span", {
|
|
367
|
+
class: "text-muted"
|
|
368
|
+
}, [Y("›")]) : null]);
|
|
369
|
+
})])]
|
|
370
|
+
})]);
|
|
371
|
+
})])]
|
|
372
|
+
});
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
export {
|
|
377
|
+
oe as DuxCascaderPanel
|
|
378
|
+
};
|
|
@@ -4,8 +4,8 @@ import "@duxweb/dvha-core";
|
|
|
4
4
|
import "naive-ui";
|
|
5
5
|
import "vue-router";
|
|
6
6
|
import "@overlastic/vue";
|
|
7
|
-
import "clsx";
|
|
8
7
|
import "@vueuse/core";
|
|
8
|
+
import "clsx";
|
|
9
9
|
import "vue3-ace-editor";
|
|
10
10
|
import "ace-builds/src-noconflict/mode-vue";
|
|
11
11
|
import "ace-builds/src-noconflict/mode-javascript";
|
|
@@ -2,8 +2,9 @@ import { defineComponent as o, ref as n, onMounted as e, createVNode as a, creat
|
|
|
2
2
|
import s from "clsx";
|
|
3
3
|
import { load as f } from "jinrishici";
|
|
4
4
|
import { DuxCard as u } from "../card/card.js";
|
|
5
|
+
import "@vueuse/core";
|
|
5
6
|
import "naive-ui";
|
|
6
|
-
const
|
|
7
|
+
const m = /* @__PURE__ */ o({
|
|
7
8
|
name: "DuxDashboardHelloBig",
|
|
8
9
|
props: {
|
|
9
10
|
title: String,
|
|
@@ -338,5 +339,5 @@ const v = /* @__PURE__ */ o({
|
|
|
338
339
|
}
|
|
339
340
|
});
|
|
340
341
|
export {
|
|
341
|
-
|
|
342
|
+
m as DuxDashboardHelloBig
|
|
342
343
|
};
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as w, ref as K, computed as u, createVNode as n, h as R, mergeProps as B } from "vue";
|
|
2
2
|
import { useJsonSchema as V } from "@duxweb/dvha-core";
|
|
3
|
-
import { useVModel as
|
|
4
|
-
import { NButton as d, NDataTable as
|
|
5
|
-
import { DuxBlockEmpty as
|
|
6
|
-
const
|
|
3
|
+
import { useVModel as z } from "@vueuse/core";
|
|
4
|
+
import { NButton as d, NDataTable as S } from "naive-ui";
|
|
5
|
+
import { DuxBlockEmpty as T } from "../status/blockEmpty.js";
|
|
6
|
+
const E = /* @__PURE__ */ w({
|
|
7
7
|
name: "DuxDynamicData",
|
|
8
8
|
props: {
|
|
9
|
+
size: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: "small"
|
|
12
|
+
},
|
|
9
13
|
moveAction: {
|
|
10
14
|
type: Boolean,
|
|
11
15
|
default: !0
|
|
@@ -30,41 +34,41 @@ const F = /* @__PURE__ */ x({
|
|
|
30
34
|
default: []
|
|
31
35
|
}
|
|
32
36
|
},
|
|
33
|
-
setup(
|
|
37
|
+
setup(a, {
|
|
34
38
|
emit: y
|
|
35
39
|
}) {
|
|
36
|
-
const
|
|
40
|
+
const r = z(a, "value", y, {
|
|
37
41
|
passive: !0,
|
|
38
|
-
defaultValue:
|
|
42
|
+
defaultValue: a.defaultValue || [],
|
|
39
43
|
deep: !0
|
|
40
44
|
}), {
|
|
41
45
|
renderAsync: m
|
|
42
46
|
} = V(), o = K(null), v = (e) => {
|
|
43
|
-
const t =
|
|
47
|
+
const t = r.value?.[0][e], l = [...r.value || []].map((i) => ({
|
|
44
48
|
...i,
|
|
45
49
|
[e]: t
|
|
46
50
|
}));
|
|
47
|
-
|
|
48
|
-
}, p = u(() =>
|
|
49
|
-
if (
|
|
50
|
-
|
|
51
|
+
r.value = [...l];
|
|
52
|
+
}, p = u(() => r.value || []), g = () => {
|
|
53
|
+
if (a?.onCreate) {
|
|
54
|
+
a.onCreate();
|
|
51
55
|
return;
|
|
52
56
|
}
|
|
53
|
-
const e =
|
|
54
|
-
|
|
57
|
+
const e = a?.createCallback?.(r.value) || {};
|
|
58
|
+
r.value = [...r.value || [], e];
|
|
55
59
|
}, h = (e) => {
|
|
56
|
-
if (!
|
|
60
|
+
if (!r.value)
|
|
57
61
|
return;
|
|
58
|
-
const t = [...
|
|
59
|
-
t.splice(e, 1),
|
|
62
|
+
const t = [...r.value];
|
|
63
|
+
t.splice(e, 1), r.value = t;
|
|
60
64
|
}, s = /* @__PURE__ */ new WeakMap();
|
|
61
65
|
let f = 0;
|
|
62
66
|
const D = (e) => e.__specKey || e.__rowKey ? e.__specKey || e.__rowKey : (s.has(e) || (f += 1, s.set(e, f)), s.get(e)), A = (e, t) => {
|
|
63
67
|
if (e === t)
|
|
64
68
|
return;
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
}, C = (e) =>
|
|
69
|
+
const l = [...r.value || []], [i] = l.splice(e, 1);
|
|
70
|
+
l.splice(t, 0, i), r.value = l;
|
|
71
|
+
}, C = (e) => a.moveAction ? {
|
|
68
72
|
style: {
|
|
69
73
|
cursor: "move"
|
|
70
74
|
},
|
|
@@ -77,13 +81,13 @@ const F = /* @__PURE__ */ x({
|
|
|
77
81
|
},
|
|
78
82
|
onDrop: (t) => {
|
|
79
83
|
t.preventDefault();
|
|
80
|
-
const
|
|
81
|
-
|
|
84
|
+
const l = o.value;
|
|
85
|
+
l !== null && (A(l, e), o.value = null);
|
|
82
86
|
},
|
|
83
87
|
onDragend: () => {
|
|
84
88
|
o.value = null;
|
|
85
89
|
}
|
|
86
|
-
} : {}, _ = u(() =>
|
|
90
|
+
} : {}, _ = u(() => a.moveAction ? {
|
|
87
91
|
key: "__move",
|
|
88
92
|
fixed: "left",
|
|
89
93
|
width: 48,
|
|
@@ -92,7 +96,7 @@ const F = /* @__PURE__ */ x({
|
|
|
92
96
|
render: () => n("div", {
|
|
93
97
|
class: "i-tabler:grid-dots text-gray-400 size-4 inline-flex items-center justify-center"
|
|
94
98
|
}, null)
|
|
95
|
-
} : null), k = u(() => (
|
|
99
|
+
} : null), k = u(() => (a.columns || []).map((e) => {
|
|
96
100
|
const t = e.copy ? () => n("div", {
|
|
97
101
|
class: "flex items-center justify-between gap-1"
|
|
98
102
|
}, [n("span", null, [e.title]), n(d, {
|
|
@@ -108,30 +112,31 @@ const F = /* @__PURE__ */ x({
|
|
|
108
112
|
key: e.key,
|
|
109
113
|
title: t,
|
|
110
114
|
width: e.width,
|
|
115
|
+
minWidth: e.minWidth,
|
|
111
116
|
fixed: e.fixed,
|
|
112
117
|
align: e.align,
|
|
113
118
|
ellipsis: e.ellipsis,
|
|
114
|
-
render: (
|
|
119
|
+
render: (l, i) => {
|
|
115
120
|
if (e.schema) {
|
|
116
|
-
const c = typeof e.schema == "function" ? e.schema(
|
|
121
|
+
const c = typeof e.schema == "function" ? e.schema(l, i) : e.schema;
|
|
117
122
|
return R(m({
|
|
118
123
|
data: Array.isArray(c) ? c : [c],
|
|
119
124
|
context: {
|
|
120
125
|
rowIndex: i,
|
|
121
|
-
model:
|
|
122
|
-
row:
|
|
126
|
+
model: r.value,
|
|
127
|
+
row: l
|
|
123
128
|
}
|
|
124
129
|
}));
|
|
125
130
|
}
|
|
126
|
-
return e.render?.(
|
|
131
|
+
return e.render?.(l, i) ?? l[e.key];
|
|
127
132
|
}
|
|
128
133
|
};
|
|
129
|
-
})), b = u(() => !
|
|
134
|
+
})), b = u(() => !a.createAction && !a.deleteAction ? null : {
|
|
130
135
|
key: "__action",
|
|
131
136
|
width: 64,
|
|
132
137
|
fixed: "right",
|
|
133
138
|
align: "center",
|
|
134
|
-
title:
|
|
139
|
+
title: a.createAction ? () => n(d, {
|
|
135
140
|
tertiary: !0,
|
|
136
141
|
type: "primary",
|
|
137
142
|
circle: !0,
|
|
@@ -140,7 +145,7 @@ const F = /* @__PURE__ */ x({
|
|
|
140
145
|
}, null),
|
|
141
146
|
onClick: g
|
|
142
147
|
}, null) : "",
|
|
143
|
-
render: (e, t) =>
|
|
148
|
+
render: (e, t) => a.deleteAction ? n(d, {
|
|
144
149
|
tertiary: !0,
|
|
145
150
|
type: "error",
|
|
146
151
|
circle: !0,
|
|
@@ -149,21 +154,25 @@ const F = /* @__PURE__ */ x({
|
|
|
149
154
|
}, null),
|
|
150
155
|
onClick: () => h(t)
|
|
151
156
|
}, null) : null
|
|
152
|
-
}),
|
|
153
|
-
return () => n(
|
|
154
|
-
size:
|
|
157
|
+
}), x = u(() => [_.value, ...k.value, b.value].filter(Boolean));
|
|
158
|
+
return () => n(S, B({
|
|
159
|
+
size: a.size,
|
|
155
160
|
rowKey: D,
|
|
156
|
-
bordered: !
|
|
157
|
-
columns:
|
|
161
|
+
bordered: !0,
|
|
162
|
+
columns: x.value,
|
|
158
163
|
data: p.value,
|
|
159
164
|
pagination: !1
|
|
160
165
|
}, {
|
|
161
166
|
rowProps: (e, t) => C(t)
|
|
167
|
+
}, {
|
|
168
|
+
style: {
|
|
169
|
+
"--n-empty-padding": "20px 0"
|
|
170
|
+
}
|
|
162
171
|
}), {
|
|
163
|
-
empty: () => n(
|
|
172
|
+
empty: () => n(T, null, null)
|
|
164
173
|
});
|
|
165
174
|
}
|
|
166
175
|
});
|
|
167
176
|
export {
|
|
168
|
-
|
|
177
|
+
E as DuxDynamicData
|
|
169
178
|
};
|
|
@@ -3,9 +3,9 @@ import { useI18n as P, useJsonSchema as j } from "@duxweb/dvha-core";
|
|
|
3
3
|
import { NButton as l, NDataTable as k } from "naive-ui";
|
|
4
4
|
import "vue-router";
|
|
5
5
|
import "@overlastic/vue";
|
|
6
|
+
import "@vueuse/core";
|
|
6
7
|
import "clsx";
|
|
7
8
|
import "vue-echarts";
|
|
8
|
-
import "@vueuse/core";
|
|
9
9
|
import "vue3-ace-editor";
|
|
10
10
|
import "ace-builds/src-noconflict/mode-vue";
|
|
11
11
|
import "ace-builds/src-noconflict/mode-javascript";
|
|
@@ -67,7 +67,7 @@ import "pinia";
|
|
|
67
67
|
function c(t) {
|
|
68
68
|
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !z(t);
|
|
69
69
|
}
|
|
70
|
-
const
|
|
70
|
+
const Jt = /* @__PURE__ */ y({
|
|
71
71
|
name: "Select",
|
|
72
72
|
props: {
|
|
73
73
|
path: String,
|
|
@@ -161,5 +161,5 @@ const Mt = /* @__PURE__ */ y({
|
|
|
161
161
|
}
|
|
162
162
|
});
|
|
163
163
|
export {
|
|
164
|
-
|
|
164
|
+
Jt as default
|
|
165
165
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { defineComponent as m, inject as l, computed as p, createVNode as o } from "vue";
|
|
2
|
+
import "@vueuse/core";
|
|
2
3
|
import "clsx";
|
|
3
4
|
import "naive-ui";
|
|
4
|
-
import "vue-echarts";
|
|
5
5
|
import "@duxweb/dvha-core";
|
|
6
|
+
import "vue-echarts";
|
|
6
7
|
import "vue-router";
|
|
7
8
|
import "@overlastic/vue";
|
|
8
9
|
import "dayjs";
|
|
9
10
|
import "lodash-es";
|
|
10
11
|
import "@tanstack/vue-query";
|
|
11
12
|
import "@duxweb/dvha-naiveui";
|
|
12
|
-
import "@vueuse/core";
|
|
13
13
|
import "pinia";
|
|
14
14
|
import "vue3-ace-editor";
|
|
15
15
|
import "ace-builds/src-noconflict/mode-vue";
|
|
@@ -6,11 +6,12 @@ import { NScrollbar as b } from "naive-ui";
|
|
|
6
6
|
import w from "short-unique-id";
|
|
7
7
|
import { VueDraggable as h } from "vue-draggable-plus";
|
|
8
8
|
import { DuxCard as y } from "../card/card.js";
|
|
9
|
+
import "@vueuse/core";
|
|
9
10
|
import { duxFormEditorGrid as D } from "./components/grid.js";
|
|
10
11
|
import { useEditor as k } from "./editor/hook.js";
|
|
11
12
|
import { DuxWidgetEditorPreview as c } from "./editor/preview.js";
|
|
12
13
|
import { WidgetEditorSetting as C } from "./editor/setting.js";
|
|
13
|
-
const
|
|
14
|
+
const M = /* @__PURE__ */ f({
|
|
14
15
|
name: "DuxDesignEditor",
|
|
15
16
|
props: {
|
|
16
17
|
data: Object,
|
|
@@ -157,5 +158,5 @@ function s({
|
|
|
157
158
|
}, [r])]);
|
|
158
159
|
}
|
|
159
160
|
export {
|
|
160
|
-
|
|
161
|
+
M as DuxDesignEditor
|
|
161
162
|
};
|