@ithinkdt/ui 4.0.3 → 4.0.4
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/DataTable-D6hPSWvx.js +219 -0
- package/dist/assets-_Fpf0gbI.js +185 -0
- package/dist/components.js +1609 -2
- package/dist/composables.js +25 -0
- package/dist/page.js +304 -297
- package/esm/components.d.ts +1 -10
- package/esm/composables.d.ts +10 -0
- package/esm/composables.js +1 -0
- package/package.json +6 -2
- package/dist/components-Blh7O5zj.js +0 -2023
package/dist/components.js
CHANGED
|
@@ -1,2 +1,1609 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { n as e } from "./use-i18n-Cmb7Xx7d.js";
|
|
2
|
+
import t, { cB as n, cE as r, useClsPrefix as i } from "./use-style.js";
|
|
3
|
+
import { i as a } from "./directives-DXNnV4xc.js";
|
|
4
|
+
import { _ as o, a as s, c, d as l, f as u, g as d, h as f, i as p, l as m, m as h, n as g, o as _, p as v, r as y, s as b, t as x, u as S, v as C } from "./assets-_Fpf0gbI.js";
|
|
5
|
+
import { Fragment as w, computed as T, createTextVNode as E, createVNode as D, defineAsyncComponent as O, defineComponent as k, h as A, inject as ee, isVNode as j, markRaw as M, mergeProps as N, nextTick as te, reactive as P, ref as F, shallowRef as ne, toRaw as re, toRef as ie, toValue as I, unref as ae, watch as L, withDirectives as oe } from "vue";
|
|
6
|
+
import { until as se } from "@vueuse/core";
|
|
7
|
+
import { NAnchor as ce, NAnchorLink as le, NAvatar as R, NAvatarGroup as ue, NButton as z, NCard as de, NCheckbox as B, NCheckboxGroup as fe, NDropdown as V, NEllipsis as pe, NEmpty as me, NFlex as H, NForm as he, NFormItem as ge, NGi as U, NGrid as _e, NIcon as W, NInput as ve, NList as ye, NListItem as be, NPagination as xe, NPopover as Se, NRadio as Ce, NRadioButton as we, NRadioGroup as Te, NSelect as Ee, NSpin as De, NTag as Oe, NText as ke, NTooltip as Ae, NTransfer as je, NTree as Me, NTreeSelect as Ne, formProps as Pe, useDialog as Fe } from "ithinkdt-ui";
|
|
8
|
+
import { nanoid as Ie } from "nanoid";
|
|
9
|
+
import { VOverflow as Le, VResizeObserver as Re } from "vueuc";
|
|
10
|
+
import { Sortable as ze } from "sortablejs/modular/sortable.core.esm.js";
|
|
11
|
+
import { isNullish as Be, pickProps as G } from "@ithinkdt/common/object";
|
|
12
|
+
import { useFormItem as Ve } from "ithinkdt-ui/es/_mixins";
|
|
13
|
+
import { measureText as He } from "@ithinkdt/common/string";
|
|
14
|
+
import { useFormModal as Ue } from "@ithinkdt/page";
|
|
15
|
+
import We from "ithinkdt-ui/es/_mixins/use-locale.mjs";
|
|
16
|
+
import { flattenTree as Ge, walkTree as Ke } from "@ithinkdt/common";
|
|
17
|
+
const qe = k({
|
|
18
|
+
name: "Checkboxes",
|
|
19
|
+
inheritAttrs: !1,
|
|
20
|
+
props: {
|
|
21
|
+
options: {
|
|
22
|
+
type: Array,
|
|
23
|
+
default: () => []
|
|
24
|
+
},
|
|
25
|
+
vertical: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: !1
|
|
28
|
+
},
|
|
29
|
+
default: {
|
|
30
|
+
type: [
|
|
31
|
+
Boolean,
|
|
32
|
+
String,
|
|
33
|
+
Object
|
|
34
|
+
],
|
|
35
|
+
default: !1
|
|
36
|
+
},
|
|
37
|
+
gap: {
|
|
38
|
+
type: [
|
|
39
|
+
Number,
|
|
40
|
+
String,
|
|
41
|
+
Array
|
|
42
|
+
],
|
|
43
|
+
default: void 0
|
|
44
|
+
},
|
|
45
|
+
modelValue: {
|
|
46
|
+
type: Array,
|
|
47
|
+
default: void 0
|
|
48
|
+
},
|
|
49
|
+
labelPadding: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: void 0
|
|
52
|
+
},
|
|
53
|
+
labelField: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: "label"
|
|
56
|
+
},
|
|
57
|
+
valueField: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: "value"
|
|
60
|
+
},
|
|
61
|
+
disabledField: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: "disabled"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
emits: {
|
|
67
|
+
"update:modelValue": () => !0,
|
|
68
|
+
updateModelValue: () => !0
|
|
69
|
+
},
|
|
70
|
+
setup(t, { emit: n, attrs: r }) {
|
|
71
|
+
let { t: i } = e(), a = T(() => t.default ? t.default === !0 ? i("common.all") : typeof t.default == "string" ? t.default : t.default?.[t.labelField] ?? i("common.all") : ""), o = F([]);
|
|
72
|
+
L(() => t.modelValue, (e) => o.value = e, { immediate: !0 });
|
|
73
|
+
let s = (e) => {
|
|
74
|
+
n("update:modelValue", e), n("updateModelValue", e);
|
|
75
|
+
}, c = () => {
|
|
76
|
+
s(o.value?.length === t.options.length ? [] : t.options.map((e) => e[t.valueField]));
|
|
77
|
+
}, l = T(() => t.options.length > o.value?.length && o.value?.length > 0), u = T(() => ({ "--n-label-padding": t.labelPadding }));
|
|
78
|
+
return () => {
|
|
79
|
+
let e = D(fe, N(r, {
|
|
80
|
+
value: o.value,
|
|
81
|
+
onUpdateValue: s
|
|
82
|
+
}), { default: () => [D(H, {
|
|
83
|
+
size: t.gap ?? (t.vertical ? void 0 : "small"),
|
|
84
|
+
vertical: t.vertical,
|
|
85
|
+
style: !t.default && t.vertical ? { padding: "6px 0 0" } : {}
|
|
86
|
+
}, { default: () => [t.options?.map((e) => D(B, {
|
|
87
|
+
value: e[t.valueField],
|
|
88
|
+
disabled: e[t.disabledField],
|
|
89
|
+
style: u.value
|
|
90
|
+
}, { default: () => [e[t.labelField]] }))] })] });
|
|
91
|
+
return t.default ? D(H, {
|
|
92
|
+
size: t.gap ?? (t.vertical ? void 0 : "small"),
|
|
93
|
+
vertical: t.vertical,
|
|
94
|
+
style: t.vertical ? { padding: "6px 0 0" } : {}
|
|
95
|
+
}, { default: () => [D("span", null, [D(B, {
|
|
96
|
+
indeterminate: l.value,
|
|
97
|
+
checked: o.value?.length > 0,
|
|
98
|
+
onUpdateChecked: c,
|
|
99
|
+
style: u.value
|
|
100
|
+
}, { default: () => [a.value] })]), e] }) : e;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}), Je = k({
|
|
104
|
+
name: "DataActions",
|
|
105
|
+
props: { options: {
|
|
106
|
+
type: Array,
|
|
107
|
+
default: () => []
|
|
108
|
+
} },
|
|
109
|
+
setup(e) {
|
|
110
|
+
let t = F(), n = !0, r = () => {
|
|
111
|
+
n ? n = !1 : t.value?.sync({ showAllItemsBeforeCalculate: !0 });
|
|
112
|
+
}, i = F(), a = () => i.value, o = F(-1), s = (t) => {
|
|
113
|
+
o.value = e.options.length - t;
|
|
114
|
+
}, c = (e) => {
|
|
115
|
+
e || (o.value = -1);
|
|
116
|
+
}, l = () => {}, u = T(() => o.value === -1 ? [] : e.options.slice(o.value).map((e) => ({
|
|
117
|
+
...e,
|
|
118
|
+
key: e.text
|
|
119
|
+
}))), d = (e) => D(z, {
|
|
120
|
+
type: e.color === "danger" ? "error" : [
|
|
121
|
+
"default",
|
|
122
|
+
"tertiary",
|
|
123
|
+
"primary",
|
|
124
|
+
"info",
|
|
125
|
+
"success",
|
|
126
|
+
"warning",
|
|
127
|
+
"error"
|
|
128
|
+
].includes(e.color) ? e.color : "primary",
|
|
129
|
+
text: !0
|
|
130
|
+
}, { default: () => [e.text] }), p = (e, t) => {
|
|
131
|
+
t.onClick?.();
|
|
132
|
+
};
|
|
133
|
+
return () => D(Re, { onResize: r }, { default: () => [D(Le, {
|
|
134
|
+
ref: t,
|
|
135
|
+
getCounter: a,
|
|
136
|
+
onUpdateCount: s,
|
|
137
|
+
onUpdateOverflow: c,
|
|
138
|
+
updateCounter: l,
|
|
139
|
+
style: "margin-top: 2px"
|
|
140
|
+
}, {
|
|
141
|
+
default: () => e.options.map((e) => D(z, {
|
|
142
|
+
quaternary: !0,
|
|
143
|
+
type: e.color === "danger" ? "error" : [
|
|
144
|
+
"default",
|
|
145
|
+
"tertiary",
|
|
146
|
+
"primary",
|
|
147
|
+
"info",
|
|
148
|
+
"success",
|
|
149
|
+
"warning",
|
|
150
|
+
"error"
|
|
151
|
+
].includes(e.color) ? e.color : "primary",
|
|
152
|
+
size: "small",
|
|
153
|
+
onClick: e.onClick
|
|
154
|
+
}, { default: () => [e.text] })),
|
|
155
|
+
counter: () => D("span", {
|
|
156
|
+
ref: i,
|
|
157
|
+
style: "position: absolute"
|
|
158
|
+
}, [D(V, {
|
|
159
|
+
options: u.value,
|
|
160
|
+
renderLabel: d,
|
|
161
|
+
onSelect: p
|
|
162
|
+
}, { default: () => [D(z, {
|
|
163
|
+
quaternary: !0,
|
|
164
|
+
size: "small"
|
|
165
|
+
}, { default: () => [D(f, { style: "font-size: 14px; color: #888" }, null)] })] })])
|
|
166
|
+
})] });
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
function K(e) {
|
|
170
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !j(e);
|
|
171
|
+
}
|
|
172
|
+
var Ye = k({
|
|
173
|
+
name: "DataCustomRow",
|
|
174
|
+
props: {
|
|
175
|
+
label: [String, Function],
|
|
176
|
+
disabled: Boolean,
|
|
177
|
+
hidden: Boolean,
|
|
178
|
+
showFixed: Boolean,
|
|
179
|
+
fixed: [Boolean, String]
|
|
180
|
+
},
|
|
181
|
+
emits: ["update-hidden", "update-fixed"],
|
|
182
|
+
setup(e, { emit: t }) {
|
|
183
|
+
return () => {
|
|
184
|
+
let n;
|
|
185
|
+
return D(H, {
|
|
186
|
+
align: "center",
|
|
187
|
+
wrap: !1,
|
|
188
|
+
size: "small"
|
|
189
|
+
}, { default: () => [
|
|
190
|
+
D(z, {
|
|
191
|
+
type: "primary",
|
|
192
|
+
text: !0,
|
|
193
|
+
class: "icon-drag"
|
|
194
|
+
}, { default: () => [D(W, { size: "18" }, { default: () => [D(b, null, null)] })] }),
|
|
195
|
+
D(B, {
|
|
196
|
+
checked: !e.hidden,
|
|
197
|
+
disabled: e.disabled,
|
|
198
|
+
onUpdateChecked: (e) => t("update-hidden", !e)
|
|
199
|
+
}, null),
|
|
200
|
+
D(pe, { style: "flex: 1 1 auto" }, K(n = I(e.label)) ? n : { default: () => [n] }),
|
|
201
|
+
e.showFixed ? [D(z, {
|
|
202
|
+
text: !0,
|
|
203
|
+
type: e.fixed === "left" ? "primary" : void 0,
|
|
204
|
+
onClick: () => t("update-fixed", e.fixed === "left" ? !1 : "left")
|
|
205
|
+
}, { default: () => [D(W, null, { default: () => [D(h, null, null)] })] }), D(z, {
|
|
206
|
+
text: !0,
|
|
207
|
+
type: e.fixed === "right" ? "primary" : void 0,
|
|
208
|
+
onClick: () => t("update-fixed", e.fixed === "right" ? !1 : "right")
|
|
209
|
+
}, { default: () => [D(W, null, { default: () => [D(o, null, null)] })] })] : void 0
|
|
210
|
+
] });
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
const Xe = k({
|
|
215
|
+
name: "DataCustom",
|
|
216
|
+
props: {
|
|
217
|
+
data: {
|
|
218
|
+
type: Array,
|
|
219
|
+
required: !0
|
|
220
|
+
},
|
|
221
|
+
keyField: {
|
|
222
|
+
type: String,
|
|
223
|
+
default: "key"
|
|
224
|
+
},
|
|
225
|
+
labelField: {
|
|
226
|
+
type: String,
|
|
227
|
+
default: "label"
|
|
228
|
+
},
|
|
229
|
+
fixedField: {
|
|
230
|
+
type: String,
|
|
231
|
+
default: "fixed"
|
|
232
|
+
},
|
|
233
|
+
hiddenField: {
|
|
234
|
+
type: String,
|
|
235
|
+
default: "hidden"
|
|
236
|
+
},
|
|
237
|
+
showFixed: {
|
|
238
|
+
type: Boolean,
|
|
239
|
+
default: !0
|
|
240
|
+
},
|
|
241
|
+
disabledField: {
|
|
242
|
+
type: String,
|
|
243
|
+
default: "disabled"
|
|
244
|
+
},
|
|
245
|
+
visibleField: {
|
|
246
|
+
type: String,
|
|
247
|
+
default: "visible"
|
|
248
|
+
},
|
|
249
|
+
tooltip: [String, Object],
|
|
250
|
+
size: {
|
|
251
|
+
type: Number,
|
|
252
|
+
default: 20
|
|
253
|
+
},
|
|
254
|
+
type: { type: String }
|
|
255
|
+
},
|
|
256
|
+
emits: { custom: () => !0 },
|
|
257
|
+
setup(t, { emit: n }) {
|
|
258
|
+
let { t: r } = e();
|
|
259
|
+
function i(e, r, i) {
|
|
260
|
+
n("custom", {
|
|
261
|
+
key: e[t.keyField],
|
|
262
|
+
[r]: i
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
let o = F();
|
|
266
|
+
return L(o, (e) => {
|
|
267
|
+
e.$el && ze.create(e.$el, {
|
|
268
|
+
animation: 150,
|
|
269
|
+
ghostClass: "ghost",
|
|
270
|
+
handle: ".icon-drag",
|
|
271
|
+
filter: ".disabled",
|
|
272
|
+
onEnd(e) {
|
|
273
|
+
let r = t.data.map((e) => e[t.keyField]), [i] = r.splice(e.oldIndex, 1);
|
|
274
|
+
r.splice(e.newIndex, 0, i), n("custom", r);
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
}), () => D(Se, {
|
|
278
|
+
trigger: "click",
|
|
279
|
+
scrollable: !0,
|
|
280
|
+
placement: "left-start",
|
|
281
|
+
displayDirective: "show",
|
|
282
|
+
style: "max-height: 400px; width: 240px"
|
|
283
|
+
}, {
|
|
284
|
+
trigger: () => oe(D(z, {
|
|
285
|
+
text: !0,
|
|
286
|
+
type: t.type
|
|
287
|
+
}, { default: () => [D(W, { size: t.size }, { default: () => [D(p, null, null)] })] }), [[a, t.tooltip ?? r("common.page.custom.tooltip")]]),
|
|
288
|
+
default: () => {
|
|
289
|
+
let e, a;
|
|
290
|
+
return D(H, { vertical: !0 }, { default: () => [D(H, { justify: "space-between" }, { default: () => [D("div", { style: "font-weight: bold" }, [t.tooltip ?? r("common.page.custom.tooltip")]), D(z, {
|
|
291
|
+
text: !0,
|
|
292
|
+
type: "primary",
|
|
293
|
+
size: "small",
|
|
294
|
+
onClick: () => n("custom", !0)
|
|
295
|
+
}, K(e = r("common.page.custom.reset")) ? e : { default: () => [e] })] }), D(H, {
|
|
296
|
+
ref: o,
|
|
297
|
+
vertical: !0
|
|
298
|
+
}, K(a = t.data.filter((e) => e[t.visibleField] !== !1).map((e) => D(Ye, {
|
|
299
|
+
key: e[t.keyField],
|
|
300
|
+
label: e[t.labelField],
|
|
301
|
+
hidden: e[t.hiddenField],
|
|
302
|
+
fixed: e[t.fixedField],
|
|
303
|
+
showFixed: t.showFixed,
|
|
304
|
+
onUpdateHidden: (t) => i(e, "hidden", t),
|
|
305
|
+
onUpdateFixed: (t) => i(e, "fixed", t)
|
|
306
|
+
}, null))) ? a : { default: () => [a] })] });
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
function Ze(e) {
|
|
312
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !j(e);
|
|
313
|
+
}
|
|
314
|
+
function q(e, t) {
|
|
315
|
+
return typeof e == "function" ? e(t) : e;
|
|
316
|
+
}
|
|
317
|
+
function Qe(e, t) {
|
|
318
|
+
return e.isGroup ? (e.__children ??= e.children?.filter((e) => e.isGroup) ?? [], D(le, { href: `#${e.prop}` }, {
|
|
319
|
+
title: () => q(e.label, t),
|
|
320
|
+
default: e.__children?.length ? () => e.__children.map((e) => Qe(e, t)) : void 0
|
|
321
|
+
})) : null;
|
|
322
|
+
}
|
|
323
|
+
function $e(e, t, n) {
|
|
324
|
+
return typeof e == "function" ? e(t, n) : e;
|
|
325
|
+
}
|
|
326
|
+
function et(e, t, n, r) {
|
|
327
|
+
return e.isGroup ? D("div", {
|
|
328
|
+
key: e.prop,
|
|
329
|
+
class: `${r}__group`,
|
|
330
|
+
id: e.prop
|
|
331
|
+
}, [D("div", { class: `${r}__title` }, [q(e.label, n)]), D("div", { class: `${r}__wrapper` }, [e.children?.map((e) => et(e, t, n, r))])]) : D("div", {
|
|
332
|
+
key: e.prop,
|
|
333
|
+
class: `${r}__item`,
|
|
334
|
+
style: {
|
|
335
|
+
"--descriptions-col-span": $e(e.colSpan, t, n) ?? 1,
|
|
336
|
+
"--descriptions-row-span": $e(e.rowSpan, t, n) ?? 1
|
|
337
|
+
}
|
|
338
|
+
}, [e.label ? D("div", { class: `${r}__label` }, [q(e.label, n)]) : void 0, D("div", { class: `${r}__content` }, [(n ? e.render ? e.render(n) : n[e.prop] : void 0) ?? D("span", { class: `${r}__nothing` }, [E("--")])])]);
|
|
339
|
+
}
|
|
340
|
+
const tt = k({
|
|
341
|
+
name: "DataDescriptions",
|
|
342
|
+
props: {
|
|
343
|
+
cols: {
|
|
344
|
+
type: Number,
|
|
345
|
+
default: 3
|
|
346
|
+
},
|
|
347
|
+
data: { type: Object },
|
|
348
|
+
items: {
|
|
349
|
+
type: Array,
|
|
350
|
+
default: () => []
|
|
351
|
+
},
|
|
352
|
+
title: { type: [String, Function] },
|
|
353
|
+
anchor: {
|
|
354
|
+
type: [Boolean, Object],
|
|
355
|
+
default: void 0
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
setup(e) {
|
|
359
|
+
let n = i(), r = `${n.value}-data-descriptions`;
|
|
360
|
+
t("-data-descriptions", nt, n);
|
|
361
|
+
let a = F();
|
|
362
|
+
L(() => e.items, () => {
|
|
363
|
+
location.hash && se(a).toBeTruthy().then((e) => {
|
|
364
|
+
e.scrollTo(location.hash);
|
|
365
|
+
});
|
|
366
|
+
}, { immediate: !0 });
|
|
367
|
+
let o = T(() => ({ "--descriptions-cols": e.cols })), s = T(() => N({
|
|
368
|
+
ref: a,
|
|
369
|
+
class: `${r}__anchor`,
|
|
370
|
+
showBackground: !1,
|
|
371
|
+
affix: !0
|
|
372
|
+
}, e.anchor && typeof e.anchor == "object" ? e.anchor : {}));
|
|
373
|
+
return () => {
|
|
374
|
+
let t, { cols: n, title: i, data: a, items: c, anchor: l } = e, u = Be(i) ? void 0 : D("div", { class: `${r}__header` }, [typeof i == "string" ? D("span", null, [i]) : i(a ?? void 0)]), d = c.filter((e) => !e.hiddden).map((e) => et(e, n, a, r)), f = l === !1 ? void 0 : D(ce, s.value, Ze(t = c.map((e) => A(Qe(e, a), { key: e.prop }))) ? t : { default: () => [t] });
|
|
375
|
+
return D("div", {
|
|
376
|
+
class: r,
|
|
377
|
+
style: o.value
|
|
378
|
+
}, [
|
|
379
|
+
u,
|
|
380
|
+
D("div", { class: `${r}__wrapper` }, [d]),
|
|
381
|
+
f
|
|
382
|
+
]);
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
var nt = n("data-descriptions", [
|
|
387
|
+
r("header", {
|
|
388
|
+
fontWeight: "bold",
|
|
389
|
+
fontSize: "1.125rem",
|
|
390
|
+
marginBottom: "24px"
|
|
391
|
+
}),
|
|
392
|
+
r("wrapper", {
|
|
393
|
+
gridTemplateColumns: "repeat(var(--descriptions-cols, 3), 1fr)",
|
|
394
|
+
display: "grid",
|
|
395
|
+
gap: "20px"
|
|
396
|
+
}, []),
|
|
397
|
+
r("group", { gridColumn: "span var(--descriptions-cols, 3)" }),
|
|
398
|
+
r("item", {
|
|
399
|
+
gridColumn: "span var(--descriptions-col-span, 3)",
|
|
400
|
+
gridRow: "span var(--descriptions-row-span, 3)"
|
|
401
|
+
}),
|
|
402
|
+
r("title", {
|
|
403
|
+
fontWeight: "bold",
|
|
404
|
+
fontSize: "1.125rem",
|
|
405
|
+
marginBottom: "20px",
|
|
406
|
+
marginTop: "24px"
|
|
407
|
+
}),
|
|
408
|
+
r("label", {
|
|
409
|
+
color: "#888",
|
|
410
|
+
paddingBottom: "6px"
|
|
411
|
+
}),
|
|
412
|
+
r("content", {
|
|
413
|
+
fontSize: "15px",
|
|
414
|
+
color: "var(--color-text)"
|
|
415
|
+
}),
|
|
416
|
+
r("anchor", {
|
|
417
|
+
position: "absolute",
|
|
418
|
+
zIndex: 2,
|
|
419
|
+
top: "40px",
|
|
420
|
+
right: "40px"
|
|
421
|
+
})
|
|
422
|
+
]);
|
|
423
|
+
const J = {
|
|
424
|
+
size: {
|
|
425
|
+
type: String,
|
|
426
|
+
default: void 0
|
|
427
|
+
},
|
|
428
|
+
gap: {
|
|
429
|
+
type: Number,
|
|
430
|
+
default: void 0
|
|
431
|
+
},
|
|
432
|
+
submitText: {
|
|
433
|
+
type: [
|
|
434
|
+
String,
|
|
435
|
+
Number,
|
|
436
|
+
Object
|
|
437
|
+
],
|
|
438
|
+
default: void 0
|
|
439
|
+
},
|
|
440
|
+
resetText: {
|
|
441
|
+
type: [
|
|
442
|
+
String,
|
|
443
|
+
Number,
|
|
444
|
+
Object
|
|
445
|
+
],
|
|
446
|
+
default: void 0
|
|
447
|
+
},
|
|
448
|
+
cancelText: {
|
|
449
|
+
type: [
|
|
450
|
+
String,
|
|
451
|
+
Number,
|
|
452
|
+
Object
|
|
453
|
+
],
|
|
454
|
+
default: void 0
|
|
455
|
+
},
|
|
456
|
+
showSubmitBtn: {
|
|
457
|
+
type: Boolean,
|
|
458
|
+
required: !1,
|
|
459
|
+
default: !0
|
|
460
|
+
},
|
|
461
|
+
showResetBtn: {
|
|
462
|
+
type: Boolean,
|
|
463
|
+
required: !1,
|
|
464
|
+
default: !0
|
|
465
|
+
},
|
|
466
|
+
showCancelBtn: {
|
|
467
|
+
type: Boolean,
|
|
468
|
+
required: !1,
|
|
469
|
+
default: !1
|
|
470
|
+
},
|
|
471
|
+
submitDisabled: Boolean,
|
|
472
|
+
submitLoading: Boolean,
|
|
473
|
+
succeeded: {
|
|
474
|
+
type: Boolean,
|
|
475
|
+
default: void 0
|
|
476
|
+
},
|
|
477
|
+
successText: {
|
|
478
|
+
type: [
|
|
479
|
+
String,
|
|
480
|
+
Number,
|
|
481
|
+
Object
|
|
482
|
+
],
|
|
483
|
+
default: void 0
|
|
484
|
+
},
|
|
485
|
+
failureText: {
|
|
486
|
+
type: [
|
|
487
|
+
String,
|
|
488
|
+
Number,
|
|
489
|
+
Object
|
|
490
|
+
],
|
|
491
|
+
default: void 0
|
|
492
|
+
},
|
|
493
|
+
nativeButtonType: Boolean
|
|
494
|
+
}, rt = k({
|
|
495
|
+
name: "DataFormActions",
|
|
496
|
+
props: J,
|
|
497
|
+
emits: [
|
|
498
|
+
"submit",
|
|
499
|
+
"reset",
|
|
500
|
+
"cancel"
|
|
501
|
+
],
|
|
502
|
+
setup(t, { emit: n, slots: r }) {
|
|
503
|
+
let { t: i } = e(), a = () => {
|
|
504
|
+
n("submit");
|
|
505
|
+
}, o = () => {
|
|
506
|
+
n("reset");
|
|
507
|
+
}, s = () => {
|
|
508
|
+
n("cancel");
|
|
509
|
+
}, { mergedDisabledRef: c, mergedSizeRef: l } = Ve(t);
|
|
510
|
+
return () => {
|
|
511
|
+
let e = l.value, n = c.value, { gap: u = e === "small" ? 8 : e === "medium" ? 12 : 16, submitText: d, resetText: f, cancelText: p, submitDisabled: m, submitLoading: h, showSubmitBtn: _, showResetBtn: v, showCancelBtn: b, succeeded: x, successText: S = d, failureText: C = d, nativeButtonType: w } = t;
|
|
512
|
+
return D(H, { size: u === void 0 ? e : u }, { default: () => [
|
|
513
|
+
r.prefix?.(),
|
|
514
|
+
_ === !1 ? void 0 : D(z, {
|
|
515
|
+
attrType: w ? "submit" : "button",
|
|
516
|
+
size: e,
|
|
517
|
+
type: x ? "success" : x === !1 ? "error" : "primary",
|
|
518
|
+
disabled: x !== void 0 || n || m || h,
|
|
519
|
+
loading: h,
|
|
520
|
+
onClick: w ? void 0 : a
|
|
521
|
+
}, {
|
|
522
|
+
default: () => (x ? S : x === !1 ? C : d) || i("common.page.form.submitText"),
|
|
523
|
+
icon: () => x ? D(W, null, { default: () => [D(g, null, null)] }) : x === !1 ? D(W, null, { default: () => [D(y, null, null)] }) : void 0
|
|
524
|
+
}),
|
|
525
|
+
v === !1 ? void 0 : D(z, {
|
|
526
|
+
size: l.value,
|
|
527
|
+
attrType: w ? "reset" : "button",
|
|
528
|
+
disabled: n || h || x,
|
|
529
|
+
type: b ? "primary" : "default",
|
|
530
|
+
secondary: b,
|
|
531
|
+
onClick: w ? void 0 : o
|
|
532
|
+
}, { default: () => [f || i("common.page.form.resetText")] }),
|
|
533
|
+
b === !1 || x ? void 0 : D(z, {
|
|
534
|
+
attrType: "button",
|
|
535
|
+
disabled: n || h,
|
|
536
|
+
onClick: s
|
|
537
|
+
}, { default: () => [p || i("common.page.form.cancelText")] }),
|
|
538
|
+
r.suffix?.()
|
|
539
|
+
] });
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
function it(e) {
|
|
544
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !j(e);
|
|
545
|
+
}
|
|
546
|
+
const at = k({
|
|
547
|
+
name: "DataForm",
|
|
548
|
+
props: {
|
|
549
|
+
grid: {
|
|
550
|
+
type: Object,
|
|
551
|
+
default: () => ({})
|
|
552
|
+
},
|
|
553
|
+
...G(Pe, "disabled", "model", "labelWidth", "labelAlign", "showFeedback", "size"),
|
|
554
|
+
...G(J, "submitText", "resetText", "cancelText", "showSubmitBtn", "showResetBtn", "showCancelBtn", "submitDisabled", "succeeded", "successText", "failureText"),
|
|
555
|
+
readonly: {
|
|
556
|
+
type: Boolean,
|
|
557
|
+
required: !1,
|
|
558
|
+
default: void 0
|
|
559
|
+
},
|
|
560
|
+
items: {
|
|
561
|
+
type: Array,
|
|
562
|
+
required: !0
|
|
563
|
+
},
|
|
564
|
+
validation: {
|
|
565
|
+
type: Object,
|
|
566
|
+
default: () => ({})
|
|
567
|
+
},
|
|
568
|
+
loading: Boolean,
|
|
569
|
+
showColon: Boolean,
|
|
570
|
+
tooltipPlacement: {
|
|
571
|
+
type: String,
|
|
572
|
+
default: "bottom"
|
|
573
|
+
},
|
|
574
|
+
requireMarkPlacement: {
|
|
575
|
+
type: String,
|
|
576
|
+
default: "left"
|
|
577
|
+
},
|
|
578
|
+
labelPlacement: {
|
|
579
|
+
type: String,
|
|
580
|
+
default: "left"
|
|
581
|
+
},
|
|
582
|
+
showAction: {
|
|
583
|
+
type: [Boolean, Object],
|
|
584
|
+
default: void 0
|
|
585
|
+
},
|
|
586
|
+
actionAlign: {
|
|
587
|
+
type: String,
|
|
588
|
+
default: "center"
|
|
589
|
+
},
|
|
590
|
+
actionJustify: {
|
|
591
|
+
type: String,
|
|
592
|
+
default: "start"
|
|
593
|
+
},
|
|
594
|
+
actionGap: {
|
|
595
|
+
type: String,
|
|
596
|
+
default: void 0
|
|
597
|
+
}
|
|
598
|
+
},
|
|
599
|
+
emits: [
|
|
600
|
+
"submit",
|
|
601
|
+
"reset",
|
|
602
|
+
"cancel"
|
|
603
|
+
],
|
|
604
|
+
setup(e, { emit: t, slots: n }) {
|
|
605
|
+
let r = (n) => {
|
|
606
|
+
n?.preventDefault?.(), t("submit", { ...re(e.model) }, n);
|
|
607
|
+
}, i = (e) => {
|
|
608
|
+
e?.preventDefault?.(), t("reset");
|
|
609
|
+
}, a = (e) => {
|
|
610
|
+
e?.preventDefault?.(), t("cancel");
|
|
611
|
+
}, o = F(), s = ({ overflow: t }) => {
|
|
612
|
+
if (n.action) return n.action({
|
|
613
|
+
overflow: t,
|
|
614
|
+
grid: o.value
|
|
615
|
+
});
|
|
616
|
+
let { loading: r, showSubmitBtn: i, showResetBtn: s, showCancelBtn: c, actionAlign: l, actionJustify: u, actionGap: d, submitDisabled: f, submitText: p, resetText: m, cancelText: h, succeeded: g, successText: _, failureText: v } = e;
|
|
617
|
+
return D(ge, {
|
|
618
|
+
label: u === "start" ? " " : void 0,
|
|
619
|
+
showLabel: e.labelPlacement !== "top",
|
|
620
|
+
style: "padding-top: 16px"
|
|
621
|
+
}, { default: () => [D(rt, {
|
|
622
|
+
align: l,
|
|
623
|
+
justify: u,
|
|
624
|
+
gap: d,
|
|
625
|
+
showSubmitBtn: i,
|
|
626
|
+
showResetBtn: s,
|
|
627
|
+
showCancelBtn: c,
|
|
628
|
+
submitText: p,
|
|
629
|
+
resetText: m,
|
|
630
|
+
cancelText: h,
|
|
631
|
+
submitDisabled: f,
|
|
632
|
+
submitLoading: r,
|
|
633
|
+
succeeded: g,
|
|
634
|
+
successText: _,
|
|
635
|
+
failureText: v,
|
|
636
|
+
nativeButtonType: !0,
|
|
637
|
+
onCancel: a
|
|
638
|
+
}, {
|
|
639
|
+
prefix: () => n.actionPrefix?.(),
|
|
640
|
+
suffix: () => n.actionSuffix?.()
|
|
641
|
+
})] });
|
|
642
|
+
}, c = () => {
|
|
643
|
+
let { items: t, validation: r, showAction: i } = e;
|
|
644
|
+
return D(w, null, [t.map(({ hidden: t, name: n, render: i, label: a, showColon: o, span: s = 6, rowSpan: c, offset: l = 0, tooltip: u, tooltipPlacement: d = e.tooltipPlacement, validationStatus: f = r[n]?.errors?.length ? "error" : r[n]?.warnings?.length ? "warnings" : r[n] ? "success" : void 0, readonly: p = e.readonly, showRequireMark: h = !p, showTooltipWhenReadonly: g = !1, ..._ }) => {
|
|
645
|
+
if (t) return;
|
|
646
|
+
let v;
|
|
647
|
+
return v = n[0] === "$" ? i({}) : D(ge, N({
|
|
648
|
+
path: n,
|
|
649
|
+
validationStatus: f,
|
|
650
|
+
showRequireMark: _.required && h
|
|
651
|
+
}, _), {
|
|
652
|
+
label: () => D(ke, {
|
|
653
|
+
depth: e.readonly ? 3 : 2,
|
|
654
|
+
style: "display: inline-flex; align-items: flex-start; gap: 1px"
|
|
655
|
+
}, { default: () => [
|
|
656
|
+
D("span", null, [I(a)]),
|
|
657
|
+
d === "icon" ? D(Ae, null, {
|
|
658
|
+
default: () => I(u),
|
|
659
|
+
trigger: () => D(z, {
|
|
660
|
+
text: !0,
|
|
661
|
+
style: "font-size: 1.25em; opacity: 0.8"
|
|
662
|
+
}, { default: () => [D(W, null, { default: () => [D(m, null, null)] })] })
|
|
663
|
+
}) : void 0,
|
|
664
|
+
e.showColon && o !== !1 ? D("span", { style: "place-self: center" }, [E(":")]) : void 0
|
|
665
|
+
] }),
|
|
666
|
+
default: () => {
|
|
667
|
+
let t, n = D("div", { style: "width: 100%; font-size: calc(1rem - 2px); min-height: 32px; display: flex; align-items: center" }, [i({
|
|
668
|
+
disabled: e.disabled,
|
|
669
|
+
size: e.size,
|
|
670
|
+
readonly: e.readonly
|
|
671
|
+
})]);
|
|
672
|
+
return u && d === "bottom" && (!e.readonly || g) ? D("div", { style: "width: 100%; display: flex; flex-direction: column" }, [n, D(ke, {
|
|
673
|
+
depth: 3,
|
|
674
|
+
style: "font-size: calc(1rem - 3px); margin-top: 6px"
|
|
675
|
+
}, it(t = I(u)) ? t : { default: () => [t] })]) : n;
|
|
676
|
+
},
|
|
677
|
+
feedback: () => r[n]?.errors?.[0] ?? r[n]?.warnings?.[0]
|
|
678
|
+
}), e.grid === !1 ? v : D(U, {
|
|
679
|
+
key: n,
|
|
680
|
+
offset: l,
|
|
681
|
+
span: s,
|
|
682
|
+
style: c ? { gridRowEnd: `span ${c}` } : void 0
|
|
683
|
+
}, it(v) ? v : { default: () => [v] });
|
|
684
|
+
}), i === !1 || e.readonly === !0 && !n.action ? void 0 : D(U, N({
|
|
685
|
+
key: "action",
|
|
686
|
+
span: 2 ** 53 - 1
|
|
687
|
+
}, typeof e.showAction == "object" ? e.showAction : {}), { default: s })]);
|
|
688
|
+
};
|
|
689
|
+
return () => {
|
|
690
|
+
let { items: t, loading: n, validation: a, showColon: s, tooltipPlacement: l, showFeedback: u, labelWidth: d = "7.2em", labelAlign: f = e.labelPlacement === "top" ? "left" : "right", grid: p, showAction: m, showSubmitBtn: h, showResetBtn: g, showCancelBtn: _, actionAlign: v, actionJustify: y, actionGap: b, submitDisabled: x, submitText: S, resetText: C, cancelText: w, succeeded: T, successText: E, failureText: O, ...k } = e, A = !e.readonly && u !== !1;
|
|
691
|
+
return D(he, N({
|
|
692
|
+
labelWidth: d,
|
|
693
|
+
labelAlign: f,
|
|
694
|
+
onReset: i,
|
|
695
|
+
onSubmit: r,
|
|
696
|
+
showFeedback: A
|
|
697
|
+
}, k), { default: () => [D(_e, N({
|
|
698
|
+
ref: o,
|
|
699
|
+
itemResponsive: !0
|
|
700
|
+
}, p, { yGap: A ? 0 : p?.yGap ?? 24 }), { default: c })] });
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
}), ot = k({
|
|
704
|
+
name: "DataFilter",
|
|
705
|
+
props: {
|
|
706
|
+
grid: {
|
|
707
|
+
type: Object,
|
|
708
|
+
default: () => ({})
|
|
709
|
+
},
|
|
710
|
+
...G(Pe, "disabled", "model"),
|
|
711
|
+
labelWidth: {
|
|
712
|
+
type: [String, Number],
|
|
713
|
+
default: "5em"
|
|
714
|
+
},
|
|
715
|
+
labelPlacement: {
|
|
716
|
+
type: String,
|
|
717
|
+
default: "left"
|
|
718
|
+
},
|
|
719
|
+
items: {
|
|
720
|
+
type: Array,
|
|
721
|
+
required: !0
|
|
722
|
+
},
|
|
723
|
+
loading: {
|
|
724
|
+
type: Boolean,
|
|
725
|
+
required: !1,
|
|
726
|
+
default: !1
|
|
727
|
+
},
|
|
728
|
+
filterOnReset: {
|
|
729
|
+
type: Boolean,
|
|
730
|
+
required: !1,
|
|
731
|
+
default: !0
|
|
732
|
+
},
|
|
733
|
+
filterText: {
|
|
734
|
+
type: String,
|
|
735
|
+
default: void 0
|
|
736
|
+
},
|
|
737
|
+
resetText: {
|
|
738
|
+
type: String,
|
|
739
|
+
default: void 0
|
|
740
|
+
},
|
|
741
|
+
customizable: {
|
|
742
|
+
type: Boolean,
|
|
743
|
+
required: !1,
|
|
744
|
+
default: !0
|
|
745
|
+
},
|
|
746
|
+
collapsible: {
|
|
747
|
+
type: Boolean,
|
|
748
|
+
required: !1,
|
|
749
|
+
default: !0
|
|
750
|
+
},
|
|
751
|
+
defaultCollapsed: {
|
|
752
|
+
type: Boolean,
|
|
753
|
+
required: !1,
|
|
754
|
+
default: !0
|
|
755
|
+
},
|
|
756
|
+
collapsedRows: Number
|
|
757
|
+
},
|
|
758
|
+
emits: [
|
|
759
|
+
"filter",
|
|
760
|
+
"reset",
|
|
761
|
+
"custom",
|
|
762
|
+
"collapse"
|
|
763
|
+
],
|
|
764
|
+
setup(t, { expose: n, emit: r }) {
|
|
765
|
+
let { t: i } = e(), a = (e) => {
|
|
766
|
+
r("filter", t.model, e);
|
|
767
|
+
}, o = (e) => {
|
|
768
|
+
r("reset", e), t.filterOnReset && r("filter", t.model, e);
|
|
769
|
+
}, s = F(t.defaultCollapsed), c = (e) => {
|
|
770
|
+
s.value = e;
|
|
771
|
+
};
|
|
772
|
+
n({ collapse: c });
|
|
773
|
+
let l = P({
|
|
774
|
+
span: 6,
|
|
775
|
+
suffix: !0
|
|
776
|
+
});
|
|
777
|
+
return () => {
|
|
778
|
+
let { filterOnReset: e, filterText: n, resetText: u, customizable: d, defaultCollapsed: f, collapsible: p, grid: m, collapsedRows: h, ...g } = t;
|
|
779
|
+
return D(at, N({ grid: {
|
|
780
|
+
cols: "12 768:18 1280:24 1536:30",
|
|
781
|
+
yGap: 20,
|
|
782
|
+
xGap: 8,
|
|
783
|
+
...m,
|
|
784
|
+
collapsed: s.value,
|
|
785
|
+
collapsedRows: h
|
|
786
|
+
} }, g, {
|
|
787
|
+
showFeedback: !1,
|
|
788
|
+
showAction: l,
|
|
789
|
+
onSubmit: a,
|
|
790
|
+
onReset: o,
|
|
791
|
+
style: "position: relative"
|
|
792
|
+
}), { action: ({ grid: e }) => (te(() => {
|
|
793
|
+
l.suffix = e?.collapsedOverflow || e?.contentEl.children.item(e?.contentEl.children.length - 1).offsetTop > 0;
|
|
794
|
+
}), D("div", { style: "display: flex; gap: 12px; align-items: center; justify-content: " + (l.suffix ? "flex-end" : "flex-start") }, [
|
|
795
|
+
l.suffix ? void 0 : D("span", null, [E("\xA0\xA0\xA0\xA0")]),
|
|
796
|
+
D(z, {
|
|
797
|
+
attrType: "submit",
|
|
798
|
+
type: "primary",
|
|
799
|
+
disabled: t.disabled,
|
|
800
|
+
loading: t.loading
|
|
801
|
+
}, { default: () => [n || i("common.page.filter.submitText")] }),
|
|
802
|
+
D(z, {
|
|
803
|
+
attrType: "reset",
|
|
804
|
+
disabled: t.disabled || t.loading
|
|
805
|
+
}, { default: () => [u || i("common.page.form.resetText")] }),
|
|
806
|
+
d ? D(Xe, {
|
|
807
|
+
keyField: "name",
|
|
808
|
+
showFixed: !1,
|
|
809
|
+
data: g.items,
|
|
810
|
+
size: 18,
|
|
811
|
+
type: "primary",
|
|
812
|
+
onCustom: (e) => r("custom", e)
|
|
813
|
+
}, null) : void 0,
|
|
814
|
+
p && e?.collapsedOverflow ? D(z, {
|
|
815
|
+
text: !0,
|
|
816
|
+
type: "primary",
|
|
817
|
+
iconPlacement: "right",
|
|
818
|
+
renderIcon: s.value ? _ : C,
|
|
819
|
+
onClick: () => c(!s.value)
|
|
820
|
+
}, { default: () => [s.value ? i("common.page.filter.expand") : i("common.page.filter.collapse")] }) : void 0
|
|
821
|
+
])) });
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
});
|
|
825
|
+
function st(e) {
|
|
826
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !j(e);
|
|
827
|
+
}
|
|
828
|
+
function ct(t, n, r = 1) {
|
|
829
|
+
let { t: i } = e(), a = F(!1), o = [], { open: s, reinit: c } = Ue({
|
|
830
|
+
title: t,
|
|
831
|
+
showColon: !0,
|
|
832
|
+
submitText: i("common.confirm.defaultOk"),
|
|
833
|
+
items: ({ it: e }) => o.map((t) => e(t.value, t.label, "input", {
|
|
834
|
+
span: 24,
|
|
835
|
+
required: t.required,
|
|
836
|
+
inputProps: {
|
|
837
|
+
readonly: a,
|
|
838
|
+
clearable: !0,
|
|
839
|
+
type: "textarea",
|
|
840
|
+
showCount: !0,
|
|
841
|
+
autosize: {
|
|
842
|
+
minRows: ae(r),
|
|
843
|
+
maxRows: Math.max(ae(r), 5)
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
})),
|
|
847
|
+
onSubmit: n
|
|
848
|
+
});
|
|
849
|
+
return {
|
|
850
|
+
open: (e, t = !1) => (a.value = t, s(e)),
|
|
851
|
+
setSupports: (e) => {
|
|
852
|
+
o = e, c();
|
|
853
|
+
}
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
const lt = k({
|
|
857
|
+
name: "DataLocaleInput",
|
|
858
|
+
props: {
|
|
859
|
+
label: { type: [
|
|
860
|
+
String,
|
|
861
|
+
Function,
|
|
862
|
+
Number,
|
|
863
|
+
Boolean,
|
|
864
|
+
Object
|
|
865
|
+
] },
|
|
866
|
+
mode: {
|
|
867
|
+
type: String,
|
|
868
|
+
default: "dialog"
|
|
869
|
+
},
|
|
870
|
+
defaultExpanded: {
|
|
871
|
+
type: Boolean,
|
|
872
|
+
default: !1
|
|
873
|
+
},
|
|
874
|
+
modelValue: Object,
|
|
875
|
+
supports: {
|
|
876
|
+
type: Array,
|
|
877
|
+
default: () => []
|
|
878
|
+
},
|
|
879
|
+
disabled: {
|
|
880
|
+
type: Boolean,
|
|
881
|
+
default: void 0
|
|
882
|
+
},
|
|
883
|
+
defaultLang: {
|
|
884
|
+
type: String,
|
|
885
|
+
default: "zh-CN"
|
|
886
|
+
},
|
|
887
|
+
showLang: {
|
|
888
|
+
type: String,
|
|
889
|
+
default: void 0
|
|
890
|
+
},
|
|
891
|
+
defaultRows: {
|
|
892
|
+
type: Number,
|
|
893
|
+
default: 1
|
|
894
|
+
}
|
|
895
|
+
},
|
|
896
|
+
emits: ["update:modelValue", "updateModelValue"],
|
|
897
|
+
setup(e, { emit: t }) {
|
|
898
|
+
let n = (n, r = e.showLang ?? e.defaultLang) => {
|
|
899
|
+
n = {
|
|
900
|
+
...e.modelValue,
|
|
901
|
+
[r]: n
|
|
902
|
+
}, t("update:modelValue", n), t("updateModelValue", n);
|
|
903
|
+
}, { open: r, setSupports: i } = ct(T(() => I(e.label)), (e) => {
|
|
904
|
+
t("update:modelValue", e), t("updateModelValue", e);
|
|
905
|
+
}, ie(e, "defaultRows")), o = F(e.defaultExpanded);
|
|
906
|
+
L(() => e.defaultExpanded, (e) => {
|
|
907
|
+
o.value = e;
|
|
908
|
+
});
|
|
909
|
+
let s = () => D(z, {
|
|
910
|
+
quaternary: !0,
|
|
911
|
+
onClick: () => {
|
|
912
|
+
o.value = !o.value;
|
|
913
|
+
},
|
|
914
|
+
style: "--n-padding: 0 8px"
|
|
915
|
+
}, { default: () => [D(W, {
|
|
916
|
+
size: "20",
|
|
917
|
+
depth: "3"
|
|
918
|
+
}, { default: () => [o.value ? D(S, null, null) : D(l, null, null)] })] }), c = (t) => {
|
|
919
|
+
let n = t.split("-")[0];
|
|
920
|
+
return e.supports.some((e) => e.value !== t && e.value.startsWith(n)) ? t : n;
|
|
921
|
+
}, d = `__slots${Ie(6)}`;
|
|
922
|
+
L(() => e.supports, (e) => {
|
|
923
|
+
i(e);
|
|
924
|
+
let t = 0;
|
|
925
|
+
for (let [n, r] of e.entries()) {
|
|
926
|
+
let e = c(r.value);
|
|
927
|
+
t = Math.max(t, He(e, "monospace")), r[d] = M({
|
|
928
|
+
prefix: () => D("div", { style: {
|
|
929
|
+
width: `${t + 4}px`,
|
|
930
|
+
height: "100%",
|
|
931
|
+
opacity: .5,
|
|
932
|
+
fontSize: "12px",
|
|
933
|
+
fontFamily: "monospace",
|
|
934
|
+
color: r.required ? "var(--color-danger)" : void 0
|
|
935
|
+
} }, [e]),
|
|
936
|
+
suffix: n === 0 ? s : void 0
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
}, { immediate: !0 });
|
|
940
|
+
let f = T(() => {
|
|
941
|
+
let t = c(e.showLang ?? e.defaultLang);
|
|
942
|
+
return [t, He(t, "monospace")];
|
|
943
|
+
}), p = {
|
|
944
|
+
prefix: () => D("div", { style: {
|
|
945
|
+
width: `${f.value[1] + 4}px`,
|
|
946
|
+
height: "100%",
|
|
947
|
+
opacity: .5,
|
|
948
|
+
fontSize: "12px",
|
|
949
|
+
fontFamily: "monospace"
|
|
950
|
+
} }, [f.value[0]]),
|
|
951
|
+
suffix: () => D(z, {
|
|
952
|
+
quaternary: !0,
|
|
953
|
+
onClick: () => r(e.modelValue, e.disabled),
|
|
954
|
+
style: "--n-padding: 0 8px"
|
|
955
|
+
}, { default: () => [D(W, {
|
|
956
|
+
size: "20",
|
|
957
|
+
depth: "3"
|
|
958
|
+
}, { default: () => [D(u, null, null)] })] })
|
|
959
|
+
}, m = { "--n-padding-right": "0" };
|
|
960
|
+
return () => {
|
|
961
|
+
let t;
|
|
962
|
+
return e.mode === "dialog" ? D(ve, {
|
|
963
|
+
value: e.modelValue?.[e.showLang ?? e.defaultLang] ?? e.modelValue?.[e.defaultLang],
|
|
964
|
+
onUpdateValue: n,
|
|
965
|
+
disabled: e.disabled,
|
|
966
|
+
clearable: !0,
|
|
967
|
+
style: m,
|
|
968
|
+
type: e.defaultRows > 1 ? "textarea" : "text",
|
|
969
|
+
rows: e.defaultRows
|
|
970
|
+
}, st(p) ? p : { default: () => [p] }) : D(H, {
|
|
971
|
+
vertical: !0,
|
|
972
|
+
wrap: !1,
|
|
973
|
+
style: "width: 100%"
|
|
974
|
+
}, st(t = e.supports.map((t, r) => {
|
|
975
|
+
if (!o.value && r !== 0) return;
|
|
976
|
+
let i = r == 0;
|
|
977
|
+
return oe(D(ve, {
|
|
978
|
+
key: t.value,
|
|
979
|
+
value: e.modelValue?.[t.value],
|
|
980
|
+
onUpdateValue: (e) => n(e, t.value),
|
|
981
|
+
disabled: e.disabled,
|
|
982
|
+
clearable: !0,
|
|
983
|
+
style: i ? m : void 0,
|
|
984
|
+
type: e.defaultRows > 1 ? "textarea" : "text",
|
|
985
|
+
rows: e.defaultRows
|
|
986
|
+
}, t[d]), [[
|
|
987
|
+
a,
|
|
988
|
+
t.label,
|
|
989
|
+
void 0,
|
|
990
|
+
{ left: !0 }
|
|
991
|
+
]]);
|
|
992
|
+
})) ? t : { default: () => [t] });
|
|
993
|
+
};
|
|
994
|
+
}
|
|
995
|
+
}), Y = k({
|
|
996
|
+
name: "DataPagination",
|
|
997
|
+
props: {
|
|
998
|
+
total: {
|
|
999
|
+
type: Number,
|
|
1000
|
+
default: 0
|
|
1001
|
+
},
|
|
1002
|
+
currentPage: { type: Number },
|
|
1003
|
+
pageSize: { type: Number },
|
|
1004
|
+
page: { type: Object },
|
|
1005
|
+
resetPageOnSizeChange: {
|
|
1006
|
+
type: Boolean,
|
|
1007
|
+
default: !0
|
|
1008
|
+
},
|
|
1009
|
+
pageSizes: { type: Array },
|
|
1010
|
+
simple: Boolean
|
|
1011
|
+
},
|
|
1012
|
+
emits: { change: () => !0 },
|
|
1013
|
+
setup(t, { emit: n }) {
|
|
1014
|
+
let { t: r } = e(), i = (e) => n("change", {
|
|
1015
|
+
pageSize: t.pageSize ?? t.page?.pageSize ?? 0,
|
|
1016
|
+
currentPage: e
|
|
1017
|
+
}), a = (e) => n("change", {
|
|
1018
|
+
pageSize: e,
|
|
1019
|
+
currentPage: t.resetPageOnSizeChange ? 1 : t.currentPage ?? t.page?.currentPage ?? 1
|
|
1020
|
+
}), o = ee(Y.DEFAULT_PAGE_SIZES_INJECTION_KEY, () => [
|
|
1021
|
+
10,
|
|
1022
|
+
20,
|
|
1023
|
+
30,
|
|
1024
|
+
50
|
|
1025
|
+
], !0), s = {
|
|
1026
|
+
prefix: () => r("common.page.pagination.prefix", { total: t.total }),
|
|
1027
|
+
suffix: () => r("common.page.pagination.suffix")
|
|
1028
|
+
};
|
|
1029
|
+
return () => D(xe, {
|
|
1030
|
+
page: t.currentPage ?? t.page?.currentPage,
|
|
1031
|
+
itemCount: t.total,
|
|
1032
|
+
pageSize: t.pageSize ?? t.page?.pageSize,
|
|
1033
|
+
onUpdatePage: i,
|
|
1034
|
+
onUpdatePageSize: a,
|
|
1035
|
+
pageSizes: t.pageSizes || o,
|
|
1036
|
+
showQuickJumper: !0,
|
|
1037
|
+
showSizePicker: !0,
|
|
1038
|
+
simple: t.simple,
|
|
1039
|
+
style: "justify-content: flex-end"
|
|
1040
|
+
}, t.simple ? void 0 : s);
|
|
1041
|
+
}
|
|
1042
|
+
});
|
|
1043
|
+
Y.DEFAULT_PAGE_SIZES_INJECTION_KEY = Symbol();
|
|
1044
|
+
function ut(e) {
|
|
1045
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !j(e);
|
|
1046
|
+
}
|
|
1047
|
+
const dt = k({
|
|
1048
|
+
name: "DataSelection",
|
|
1049
|
+
props: {
|
|
1050
|
+
modelValue: {
|
|
1051
|
+
type: String,
|
|
1052
|
+
required: !0
|
|
1053
|
+
},
|
|
1054
|
+
count: {
|
|
1055
|
+
type: Number,
|
|
1056
|
+
default: 0
|
|
1057
|
+
}
|
|
1058
|
+
},
|
|
1059
|
+
emits: {
|
|
1060
|
+
"update:modelValue": () => !0,
|
|
1061
|
+
clear: () => !0
|
|
1062
|
+
},
|
|
1063
|
+
setup(t, { emit: n }) {
|
|
1064
|
+
let { t: r } = e();
|
|
1065
|
+
return () => {
|
|
1066
|
+
let e;
|
|
1067
|
+
return t.modelValue !== "selection" && t.count === 0 ? D("div", null, null) : D("div", null, [D(H, {
|
|
1068
|
+
align: "center",
|
|
1069
|
+
"wrap-item": !1
|
|
1070
|
+
}, { default: () => [
|
|
1071
|
+
D("span", null, [r("common.page.selection.countText", { count: t.count })]),
|
|
1072
|
+
D(z, {
|
|
1073
|
+
text: !0,
|
|
1074
|
+
type: "primary",
|
|
1075
|
+
onClick: () => {
|
|
1076
|
+
n("update:modelValue", t.modelValue === "all" ? "selection" : "all");
|
|
1077
|
+
}
|
|
1078
|
+
}, { default: () => [t.modelValue === "all" ? r("common.page.selection.view") : r("common.page.selection.back")] }),
|
|
1079
|
+
D(z, {
|
|
1080
|
+
text: !0,
|
|
1081
|
+
onClick: () => {
|
|
1082
|
+
n("clear"), n("update:modelValue", "all");
|
|
1083
|
+
}
|
|
1084
|
+
}, ut(e = r("common.page.selection.clear")) ? e : { default: () => [e] })
|
|
1085
|
+
] })]);
|
|
1086
|
+
};
|
|
1087
|
+
}
|
|
1088
|
+
});
|
|
1089
|
+
function ft(e) {
|
|
1090
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !j(e);
|
|
1091
|
+
}
|
|
1092
|
+
const pt = k({
|
|
1093
|
+
name: "Radios",
|
|
1094
|
+
props: {
|
|
1095
|
+
options: {
|
|
1096
|
+
type: Array,
|
|
1097
|
+
default: () => []
|
|
1098
|
+
},
|
|
1099
|
+
vertical: {
|
|
1100
|
+
type: Boolean,
|
|
1101
|
+
default: !1
|
|
1102
|
+
},
|
|
1103
|
+
type: {
|
|
1104
|
+
type: String,
|
|
1105
|
+
default: "radio"
|
|
1106
|
+
},
|
|
1107
|
+
default: {
|
|
1108
|
+
type: [
|
|
1109
|
+
Boolean,
|
|
1110
|
+
String,
|
|
1111
|
+
Object
|
|
1112
|
+
],
|
|
1113
|
+
default: !1
|
|
1114
|
+
},
|
|
1115
|
+
padding: {
|
|
1116
|
+
type: String,
|
|
1117
|
+
default: void 0
|
|
1118
|
+
},
|
|
1119
|
+
labelField: {
|
|
1120
|
+
type: String,
|
|
1121
|
+
default: "label"
|
|
1122
|
+
},
|
|
1123
|
+
valueField: {
|
|
1124
|
+
type: String,
|
|
1125
|
+
default: "value"
|
|
1126
|
+
},
|
|
1127
|
+
disabledField: {
|
|
1128
|
+
type: String,
|
|
1129
|
+
default: "disabled"
|
|
1130
|
+
},
|
|
1131
|
+
modelValue: {
|
|
1132
|
+
type: [
|
|
1133
|
+
String,
|
|
1134
|
+
Number,
|
|
1135
|
+
Boolean
|
|
1136
|
+
],
|
|
1137
|
+
default: void 0
|
|
1138
|
+
}
|
|
1139
|
+
},
|
|
1140
|
+
emits: {
|
|
1141
|
+
"update:modelValue": () => !0,
|
|
1142
|
+
updateModelValue: () => !0
|
|
1143
|
+
},
|
|
1144
|
+
setup(t, { emit: n }) {
|
|
1145
|
+
let { t: r } = e(), i = T(() => t.default === !1 ? "" : t.default === !0 ? r("common.all") : typeof t.default == "string" ? t.default : t.default?.[t.labelField] ?? r("common.all")), a = T(() => t.type === "button-primary" ? {
|
|
1146
|
+
"--n-button-color-active": "var(--color-primary)",
|
|
1147
|
+
"--n-button-text-color-active": "var(--color-base)"
|
|
1148
|
+
} : {}), o = (e) => {
|
|
1149
|
+
n("update:modelValue", e), n("updateModelValue", e);
|
|
1150
|
+
};
|
|
1151
|
+
return () => {
|
|
1152
|
+
let e = t.type === "button" ? we : Ce, n = D(w, null, [t.default ? D(e, { value: typeof t.default == "object" ? t.default?.[t.valueField] : null }, { default: () => [i.value] }) : void 0, t.options?.map((n) => {
|
|
1153
|
+
let r = typeof n[t.labelField] == "string" ? n[t.labelField] : n[t.labelField]?.();
|
|
1154
|
+
return D(e, {
|
|
1155
|
+
value: n[t.valueField],
|
|
1156
|
+
disabled: n[t.disabledField],
|
|
1157
|
+
style: t.padding ? {
|
|
1158
|
+
paddingLeft: t.padding,
|
|
1159
|
+
paddingRight: t.padding
|
|
1160
|
+
} : {}
|
|
1161
|
+
}, { default: () => [n.tip ? D(Ae, null, {
|
|
1162
|
+
default: () => n.tip,
|
|
1163
|
+
trigger: () => r
|
|
1164
|
+
}) : r] });
|
|
1165
|
+
})]);
|
|
1166
|
+
return D(Te, {
|
|
1167
|
+
style: t.vertical ? {
|
|
1168
|
+
...a.value,
|
|
1169
|
+
padding: "6px 0 0"
|
|
1170
|
+
} : a.value,
|
|
1171
|
+
value: t.modelValue,
|
|
1172
|
+
onUpdateValue: o
|
|
1173
|
+
}, { default: () => [t.type === "radio" ? D(H, {
|
|
1174
|
+
size: t.vertical ? void 0 : "small",
|
|
1175
|
+
vertical: t.vertical
|
|
1176
|
+
}, ft(n) ? n : { default: () => [n] }) : n] });
|
|
1177
|
+
};
|
|
1178
|
+
}
|
|
1179
|
+
});
|
|
1180
|
+
function X(e) {
|
|
1181
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !j(e);
|
|
1182
|
+
}
|
|
1183
|
+
const mt = k({
|
|
1184
|
+
name: "UserDept",
|
|
1185
|
+
inheritAttrs: !1,
|
|
1186
|
+
props: {
|
|
1187
|
+
users: {
|
|
1188
|
+
type: Array,
|
|
1189
|
+
default: () => []
|
|
1190
|
+
},
|
|
1191
|
+
groups: {
|
|
1192
|
+
type: Array,
|
|
1193
|
+
default: () => []
|
|
1194
|
+
},
|
|
1195
|
+
depts: {
|
|
1196
|
+
type: Array,
|
|
1197
|
+
default: () => []
|
|
1198
|
+
},
|
|
1199
|
+
modelValue: {
|
|
1200
|
+
type: [Array, String],
|
|
1201
|
+
default: void 0
|
|
1202
|
+
},
|
|
1203
|
+
placeholder: {
|
|
1204
|
+
type: String,
|
|
1205
|
+
default: void 0
|
|
1206
|
+
},
|
|
1207
|
+
size: {
|
|
1208
|
+
type: String,
|
|
1209
|
+
default: void 0
|
|
1210
|
+
},
|
|
1211
|
+
type: {
|
|
1212
|
+
type: String,
|
|
1213
|
+
default: "user"
|
|
1214
|
+
},
|
|
1215
|
+
selectType: {
|
|
1216
|
+
type: String,
|
|
1217
|
+
default: "dropdown"
|
|
1218
|
+
},
|
|
1219
|
+
max: {
|
|
1220
|
+
type: Number,
|
|
1221
|
+
default: void 0
|
|
1222
|
+
},
|
|
1223
|
+
multiple: {
|
|
1224
|
+
type: Boolean,
|
|
1225
|
+
default: !1
|
|
1226
|
+
},
|
|
1227
|
+
defaultExpandAll: {
|
|
1228
|
+
type: Boolean,
|
|
1229
|
+
default: !1
|
|
1230
|
+
},
|
|
1231
|
+
filterable: {
|
|
1232
|
+
type: Boolean,
|
|
1233
|
+
default: !1
|
|
1234
|
+
},
|
|
1235
|
+
disabled: {
|
|
1236
|
+
type: Boolean,
|
|
1237
|
+
default: void 0
|
|
1238
|
+
},
|
|
1239
|
+
getUsersByGroup: {
|
|
1240
|
+
type: Function,
|
|
1241
|
+
default: () => []
|
|
1242
|
+
},
|
|
1243
|
+
getUsersByDept: {
|
|
1244
|
+
type: Function,
|
|
1245
|
+
default: () => []
|
|
1246
|
+
},
|
|
1247
|
+
valueField: { type: String },
|
|
1248
|
+
renderUserInfo: Function
|
|
1249
|
+
},
|
|
1250
|
+
emits: ["update:modelValue", "updateModelValue"],
|
|
1251
|
+
setup(t, { emit: n, attrs: r }) {
|
|
1252
|
+
let { t: i } = e(), { localeRef: a } = We("Popconfirm"), o = T(() => t.valueField || (t.type === "user" ? "username" : "code")), l = T(() => {
|
|
1253
|
+
if (t.multiple) return t.modelValue || [];
|
|
1254
|
+
let e = t.modelValue?.trim();
|
|
1255
|
+
return e ? [e] : [];
|
|
1256
|
+
}), u = new Map(), f = T(() => (u.clear(), t.users.map((e) => (e = P(e), e.label = e.nickname + e.username, e.value = e[o.value], e.type = "user", u.set(e[o.value], e), e)))), p = ne([]);
|
|
1257
|
+
L(() => t.depts, (e) => {
|
|
1258
|
+
Ke(e, (e) => {
|
|
1259
|
+
e.label = e.name, e.value = e[o.value], e.type = "dept", e.children?.length || delete e.children;
|
|
1260
|
+
}), p.value = Ge(e);
|
|
1261
|
+
}, { immediate: !0 });
|
|
1262
|
+
let m = T(() => [
|
|
1263
|
+
...t.depts,
|
|
1264
|
+
...t.groups.map((e) => ({
|
|
1265
|
+
label: e.name,
|
|
1266
|
+
value: e.code,
|
|
1267
|
+
type: "group"
|
|
1268
|
+
})),
|
|
1269
|
+
...f.value
|
|
1270
|
+
]), h = F([]), g = F(), _ = async (e) => {
|
|
1271
|
+
let n = await (e.type === "group" ? t.getUsersByGroup(e.value) : t.getUsersByDept(e.value));
|
|
1272
|
+
for (let e of f.value) e.disabled = !0;
|
|
1273
|
+
g.value = [...e.type === "dept" ? e.children ?? [] : [], ...n.map((e) => {
|
|
1274
|
+
let t = u.get(e[o.value]);
|
|
1275
|
+
return t && (t.disabled = !1), {
|
|
1276
|
+
...e,
|
|
1277
|
+
label: e.nickname + e.username,
|
|
1278
|
+
value: e[o.value],
|
|
1279
|
+
type: "user"
|
|
1280
|
+
};
|
|
1281
|
+
})];
|
|
1282
|
+
}, y = new WeakMap(), b = (e, n, r) => {
|
|
1283
|
+
let a;
|
|
1284
|
+
if (t.type === "dept") return D(Me, {
|
|
1285
|
+
data: t.depts,
|
|
1286
|
+
keyField: "value",
|
|
1287
|
+
labelField: "name",
|
|
1288
|
+
defaultExpandAll: t.defaultExpandAll,
|
|
1289
|
+
checkable: t.multiple,
|
|
1290
|
+
selectable: !t.multiple,
|
|
1291
|
+
multiple: !1,
|
|
1292
|
+
blockLine: !0,
|
|
1293
|
+
checkOnClick: !0,
|
|
1294
|
+
pattern: r,
|
|
1295
|
+
filter: (e, t) => t.label.includes(e) || t.value.includes(e),
|
|
1296
|
+
checkedKeys: t.multiple ? e : void 0,
|
|
1297
|
+
selectedKeys: t.multiple ? void 0 : e,
|
|
1298
|
+
onUpdateCheckedKeys: (e) => {
|
|
1299
|
+
t.max && e?.length > t.max || n(e);
|
|
1300
|
+
},
|
|
1301
|
+
onUpdateSelectedKeys: (e) => {
|
|
1302
|
+
n(e);
|
|
1303
|
+
}
|
|
1304
|
+
}, null);
|
|
1305
|
+
let o = e ? y.get(e) : new Set();
|
|
1306
|
+
if (e && !o && (o = new Set(e), y.set(e, o)), g.value === !1) return D(De, { show: !0 }, null);
|
|
1307
|
+
let l = g.value || m.value;
|
|
1308
|
+
r = r?.trim(), r && (l = l?.filter((e) => e.label.includes(r) || e.value.includes(r)));
|
|
1309
|
+
let u = h.value;
|
|
1310
|
+
return D(w, null, [D("div", { style: "margin: 12px 16px; display: flex; justify-content: space-between; align-items: center" }, [u.length > 0 ? D(w, null, [D("span", { style: "display: flex; align-items: center" }, [
|
|
1311
|
+
u.length >= 2 ? u.at(-2).label : i("common.all"),
|
|
1312
|
+
D("span", { style: "padding: 0 4px" }, [D(d, null, null)]),
|
|
1313
|
+
u.at(-1).label
|
|
1314
|
+
]), D(z, {
|
|
1315
|
+
text: !0,
|
|
1316
|
+
type: "warning",
|
|
1317
|
+
onClick: () => {
|
|
1318
|
+
if (u.pop(), g.value = u.length > 0 ? !1 : void 0, u.length > 0) _(u.at(-1));
|
|
1319
|
+
else for (let e of f.value) e.disabled = !1;
|
|
1320
|
+
}
|
|
1321
|
+
}, { default: () => [D(W, null, { default: () => [D(v, null, null)] }), i("common.back")] })]) : D("span", null, [i("common.all")])]), l?.length ? D(ye, {
|
|
1322
|
+
showDivider: !1,
|
|
1323
|
+
style: "padding: 0 16px"
|
|
1324
|
+
}, X(a = l.map((r) => {
|
|
1325
|
+
let i, a;
|
|
1326
|
+
return D(be, {
|
|
1327
|
+
key: r.type + "_" + r.value,
|
|
1328
|
+
style: "padding: 6px 0"
|
|
1329
|
+
}, { default: () => [r.type === "user" ? t.multiple ? D(B, {
|
|
1330
|
+
checked: o.has(r.value) || !1,
|
|
1331
|
+
onUpdateChecked: (i) => {
|
|
1332
|
+
if (i && t.max && e.length >= t.max) return;
|
|
1333
|
+
let a = [...e || []];
|
|
1334
|
+
if (i) a.push(r.value);
|
|
1335
|
+
else {
|
|
1336
|
+
let e = a.indexOf(r.value);
|
|
1337
|
+
a.splice(e, 1);
|
|
1338
|
+
}
|
|
1339
|
+
n(a);
|
|
1340
|
+
},
|
|
1341
|
+
style: "margin-left: 3px"
|
|
1342
|
+
}, X(i = Q([r], {
|
|
1343
|
+
max: 1,
|
|
1344
|
+
size: 24,
|
|
1345
|
+
placement: "right",
|
|
1346
|
+
tooltip: !1,
|
|
1347
|
+
username: !0,
|
|
1348
|
+
renderInfo: t.renderUserInfo
|
|
1349
|
+
})) ? i : { default: () => [i] }) : D(Ce, {
|
|
1350
|
+
checked: o.has(r.value) || !1,
|
|
1351
|
+
onUpdateChecked: (e) => {
|
|
1352
|
+
n(e ? [r.value] : []);
|
|
1353
|
+
},
|
|
1354
|
+
style: "margin-left: 3px;"
|
|
1355
|
+
}, X(a = Q([r], {
|
|
1356
|
+
max: 1,
|
|
1357
|
+
size: 24,
|
|
1358
|
+
placement: "right",
|
|
1359
|
+
tooltip: !1,
|
|
1360
|
+
username: !0,
|
|
1361
|
+
renderInfo: t.renderUserInfo
|
|
1362
|
+
})) ? a : { default: () => [a] }) : D("div", {
|
|
1363
|
+
onClick: () => {
|
|
1364
|
+
g.value = !1, h.value.push(r), _(r);
|
|
1365
|
+
},
|
|
1366
|
+
style: "cursor: pointer; display: flex; align-items: center; gap: 8px"
|
|
1367
|
+
}, [
|
|
1368
|
+
r.type === "dept" ? D(R, {
|
|
1369
|
+
size: 24,
|
|
1370
|
+
style: "background-color: red"
|
|
1371
|
+
}, { default: () => [D(W, null, { default: () => [D(s, null, null)] })] }) : D(R, {
|
|
1372
|
+
size: 24,
|
|
1373
|
+
style: "background-color: green"
|
|
1374
|
+
}, { default: () => [D(W, null, { default: () => [D(c, null, null)] })] }),
|
|
1375
|
+
D("span", { style: "flex: 1 1 auto" }, [r.label]),
|
|
1376
|
+
D(W, null, { default: () => [D(d, null, null)] })
|
|
1377
|
+
])] });
|
|
1378
|
+
})) ? a : { default: () => [a] }) : D(me, null, null)]);
|
|
1379
|
+
}, x = () => D(me, { description: t.placeholder }, null), S = ({ option: e }) => e.type === "user" ? D("span", null, [e.nickname, D("span", { style: {
|
|
1380
|
+
opacity: .4,
|
|
1381
|
+
marginLeft: "8px"
|
|
1382
|
+
} }, [e.username])]) : D("span", null, [e.label]), C = (e, n, r, i, a) => D(je, N(e, {
|
|
1383
|
+
key: t.type,
|
|
1384
|
+
options: n,
|
|
1385
|
+
renderSourceList: ({ onCheck: e, pattern: t }) => b(r, e, t),
|
|
1386
|
+
renderTargetList: t.placeholder?.trim() && !t.modelValue?.length ? x : void 0,
|
|
1387
|
+
renderTargetLabel: S,
|
|
1388
|
+
sourceFilterable: t.filterable,
|
|
1389
|
+
size: t.size,
|
|
1390
|
+
disabled: t.disabled || void 0,
|
|
1391
|
+
value: r,
|
|
1392
|
+
filter: (e, t) => t.label.includes(e) || t.value.includes(e),
|
|
1393
|
+
"onUpdate:value": (e) => {
|
|
1394
|
+
i?.(e);
|
|
1395
|
+
},
|
|
1396
|
+
onUpdateValue: (e) => {
|
|
1397
|
+
a?.(e);
|
|
1398
|
+
}
|
|
1399
|
+
}), null), E = ({ option: e, handleClose: n }) => D(Oe, {
|
|
1400
|
+
type: t.type === "user" ? "primary" : "info",
|
|
1401
|
+
closable: !0,
|
|
1402
|
+
onMousedown: (e) => e.preventDefault(),
|
|
1403
|
+
onClose: (e) => {
|
|
1404
|
+
e.stopPropagation(), n();
|
|
1405
|
+
}
|
|
1406
|
+
}, { default: () => [e.label] }), O = (e, r = "updateModelValue") => {
|
|
1407
|
+
t.multiple ? n(r, e) : n(r, e?.[0]);
|
|
1408
|
+
}, k = F(), A = !1, ee = Fe(), j = () => {
|
|
1409
|
+
if (A) return;
|
|
1410
|
+
A = !0;
|
|
1411
|
+
let e = ne([...l.value || []]);
|
|
1412
|
+
ee.create({
|
|
1413
|
+
showIcon: !1,
|
|
1414
|
+
title: t.placeholder,
|
|
1415
|
+
style: { width: "700px" },
|
|
1416
|
+
content: () => D("div", { style: { height: "550px" } }, [C({ style: { height: "100%" } }, t.type === "user" ? f.value : p.value, e.value, (t) => e.value = t)]),
|
|
1417
|
+
positiveText: a.value.positiveText,
|
|
1418
|
+
negativeText: a.value.negativeText,
|
|
1419
|
+
onPositiveClick() {
|
|
1420
|
+
O(e.value, "update:modelValue"), O(e.value, "updateModelValue");
|
|
1421
|
+
},
|
|
1422
|
+
onAfterLeave() {
|
|
1423
|
+
te(() => {
|
|
1424
|
+
k.value?.blur(), A = !1;
|
|
1425
|
+
});
|
|
1426
|
+
}
|
|
1427
|
+
});
|
|
1428
|
+
}, M = { arrow: () => D(W, null, { default: () => [t.type === "user" ? D(c, null, null) : D(s, null, null)] }) };
|
|
1429
|
+
return () => {
|
|
1430
|
+
let e = t.type === "user" ? f.value : p.value;
|
|
1431
|
+
if (t.selectType === "dropdown" && t.type === "dept") return D(Ne, {
|
|
1432
|
+
options: e,
|
|
1433
|
+
keyField: "value",
|
|
1434
|
+
defaultExpandAll: t.defaultExpandAll,
|
|
1435
|
+
checkable: t.multiple,
|
|
1436
|
+
multiple: t.multiple,
|
|
1437
|
+
filter: (e, t) => t.label.includes(e) || t.value.includes(e),
|
|
1438
|
+
value: t.modelValue,
|
|
1439
|
+
onUpdateValue: (e) => {
|
|
1440
|
+
t.multiple && t.max && e?.length > t.max || n("updateModelValue", e);
|
|
1441
|
+
},
|
|
1442
|
+
"onUpdate:value": (e) => {
|
|
1443
|
+
t.multiple && t.max && e?.length > t.max || n("update:modelValue", e);
|
|
1444
|
+
}
|
|
1445
|
+
}, X(M) ? M : { default: () => [M] });
|
|
1446
|
+
if (t.selectType === "transfer") return C(r, e, l.value, (e) => O(e, "update:modelValue"), (e) => O(e, "updateModelValue"));
|
|
1447
|
+
let i = t.selectType === "dropdown";
|
|
1448
|
+
return D(Ee, N(r, {
|
|
1449
|
+
key: t.type,
|
|
1450
|
+
ref: k,
|
|
1451
|
+
show: i ? void 0 : !1,
|
|
1452
|
+
filterable: i ? t.filterable : !1,
|
|
1453
|
+
options: e,
|
|
1454
|
+
multiple: t.multiple,
|
|
1455
|
+
size: t.size,
|
|
1456
|
+
placeholder: t.placeholder,
|
|
1457
|
+
disabled: t.disabled || void 0,
|
|
1458
|
+
value: t.modelValue,
|
|
1459
|
+
renderTag: t.multiple ? E : void 0,
|
|
1460
|
+
onFocus: i ? void 0 : j,
|
|
1461
|
+
onUpdateValue: (e) => {
|
|
1462
|
+
n("updateModelValue", e);
|
|
1463
|
+
},
|
|
1464
|
+
"onUpdate:value": (e) => {
|
|
1465
|
+
n("update:modelValue", e);
|
|
1466
|
+
}
|
|
1467
|
+
}), X(M) ? M : { default: () => [M] });
|
|
1468
|
+
};
|
|
1469
|
+
}
|
|
1470
|
+
});
|
|
1471
|
+
function Z(e, t, { placement: n = "left", size: r = 24, tooltip: i = !0, username: a = !1, renderInfo: o }) {
|
|
1472
|
+
let s = e.nickname.split(" ").at(-1), c = s;
|
|
1473
|
+
if (/^[\u4E00-\u9FA5]+$/.test(s)) {
|
|
1474
|
+
let e = s.length;
|
|
1475
|
+
c = e === 3 || e === 4 ? s.slice(-2) : e > 4 ? s.slice(0, 1) : s;
|
|
1476
|
+
} else s.length > 4 && (c = D(W, null, { default: () => [D(x, null, null)] }));
|
|
1477
|
+
let l = (e) => D(R, {
|
|
1478
|
+
color: "var(--color-primary)",
|
|
1479
|
+
round: !0,
|
|
1480
|
+
size: e
|
|
1481
|
+
}, X(c) ? c : { default: () => [c] });
|
|
1482
|
+
return D(Se, {
|
|
1483
|
+
key: e.username,
|
|
1484
|
+
raw: !0,
|
|
1485
|
+
placement: n,
|
|
1486
|
+
disabled: i === !1
|
|
1487
|
+
}, {
|
|
1488
|
+
default: () => D(de, {
|
|
1489
|
+
style: "min-width: 200px",
|
|
1490
|
+
size: "small"
|
|
1491
|
+
}, { default: () => [D("div", { style: "display: flex; align-items: center; gap: 12px" }, [l(48), D("div", null, [D("div", { style: "font-size: 16px; font-weight: 500;" }, [e.nickname]), D("div", { style: "font-size: 14px; color: #999" }, [e.username])])]), o?.(e)] }),
|
|
1492
|
+
trigger: () => {
|
|
1493
|
+
let n = l(r);
|
|
1494
|
+
return t ? D("div", { style: "max-width: 100%; overflow: hidden; display: inline-flex; align-items: center; gap: 6px" }, [n, D("div", { style: "overflow: hidden; white-space: nowrap; text-overflow: ellipsis" }, [D("span", null, [e.nickname]), a ? D("span", { style: "margin-left: 8px; opacity: 0.4" }, [e.username]) : void 0])]) : n;
|
|
1495
|
+
}
|
|
1496
|
+
});
|
|
1497
|
+
}
|
|
1498
|
+
function Q(e, t = {}) {
|
|
1499
|
+
let { max: n = 4, size: r = 24 } = t;
|
|
1500
|
+
return e.length <= 1 ? e[0] ? Z(e[0], !0, t) : null : D("span", { style: {
|
|
1501
|
+
display: "inline-block",
|
|
1502
|
+
height: r + "px"
|
|
1503
|
+
} }, [D(ue, {
|
|
1504
|
+
options: e,
|
|
1505
|
+
size: r,
|
|
1506
|
+
max: n || 4,
|
|
1507
|
+
style: "top: -2px"
|
|
1508
|
+
}, {
|
|
1509
|
+
avatar: ({ option: e }) => Z(e, !1, t),
|
|
1510
|
+
rest: ({ options: e, rest: t }) => D(V, {
|
|
1511
|
+
options: e,
|
|
1512
|
+
keyField: "username",
|
|
1513
|
+
labelField: "nickname",
|
|
1514
|
+
renderOption: ({ option: t }) => Z(t, !1, e)
|
|
1515
|
+
}, { default: () => [D(R, null, { default: () => [E("+"), t] })] })
|
|
1516
|
+
})]);
|
|
1517
|
+
}
|
|
1518
|
+
const ht = k({
|
|
1519
|
+
name: "DeptRender",
|
|
1520
|
+
props: {
|
|
1521
|
+
value: [String, Array],
|
|
1522
|
+
multiple: Boolean,
|
|
1523
|
+
getDeptsByCode: Function
|
|
1524
|
+
},
|
|
1525
|
+
setup(e) {
|
|
1526
|
+
let t = F([]), n = {};
|
|
1527
|
+
return L([() => e.modelValue, () => e.multiple], ([r, i]) => {
|
|
1528
|
+
t.value = [];
|
|
1529
|
+
let a = r ? i ? Array.isArray(r) ? r : r.trim() ? r.trim().split(",") : [] : [r] : [], o = [];
|
|
1530
|
+
for (let [e, r] of a.entries()) n[r] || (n[r] = P({
|
|
1531
|
+
code: r,
|
|
1532
|
+
name: r
|
|
1533
|
+
}), o.push(r)), t.value[e] = n[r];
|
|
1534
|
+
o.length > 0 && e.getDeptsByCode(o).then((e) => {
|
|
1535
|
+
for (let t of e) Object.assign(n[t.code], t);
|
|
1536
|
+
});
|
|
1537
|
+
}, { immediate: !0 }), () => t.value.map((e) => D(Oe, { key: e.code }, { default: () => [e.name] }));
|
|
1538
|
+
}
|
|
1539
|
+
}), gt = k({
|
|
1540
|
+
name: "UserRender",
|
|
1541
|
+
props: {
|
|
1542
|
+
value: [String, Array],
|
|
1543
|
+
multiple: Boolean,
|
|
1544
|
+
max: Number,
|
|
1545
|
+
size: Number,
|
|
1546
|
+
placement: String,
|
|
1547
|
+
getUsersByUsername: Function,
|
|
1548
|
+
renderInfo: Function
|
|
1549
|
+
},
|
|
1550
|
+
setup(e) {
|
|
1551
|
+
let t = F([]), n = {};
|
|
1552
|
+
return L([() => e.value, () => e.multiple], ([r, i]) => {
|
|
1553
|
+
t.value = [];
|
|
1554
|
+
let a = r ? i ? Array.isArray(r) ? r : r.trim() ? r.trim().split(",") : [] : [r] : [], o = [];
|
|
1555
|
+
for (let [e, r] of a.entries()) n[r] || (n[r] = P({
|
|
1556
|
+
username: r,
|
|
1557
|
+
nickname: r
|
|
1558
|
+
}), o.push(r)), t.value[e] = n[r];
|
|
1559
|
+
o.length > 0 && e.getUsersByUsername(o).then((e) => {
|
|
1560
|
+
for (let t of e) Object.assign(n[t.username], t);
|
|
1561
|
+
});
|
|
1562
|
+
}, { immediate: !0 }), () => Q(t.value, e);
|
|
1563
|
+
}
|
|
1564
|
+
}), $ = {
|
|
1565
|
+
disabled: {
|
|
1566
|
+
type: Boolean,
|
|
1567
|
+
default: void 0
|
|
1568
|
+
},
|
|
1569
|
+
type: {
|
|
1570
|
+
type: String,
|
|
1571
|
+
default: void 0
|
|
1572
|
+
},
|
|
1573
|
+
succeeded: {
|
|
1574
|
+
type: [Boolean, Object],
|
|
1575
|
+
default: void 0
|
|
1576
|
+
},
|
|
1577
|
+
successText: {
|
|
1578
|
+
type: [
|
|
1579
|
+
String,
|
|
1580
|
+
Number,
|
|
1581
|
+
Object
|
|
1582
|
+
],
|
|
1583
|
+
default: void 0
|
|
1584
|
+
},
|
|
1585
|
+
failureText: {
|
|
1586
|
+
type: [
|
|
1587
|
+
String,
|
|
1588
|
+
Number,
|
|
1589
|
+
Object
|
|
1590
|
+
],
|
|
1591
|
+
default: void 0
|
|
1592
|
+
}
|
|
1593
|
+
}, _t = k({
|
|
1594
|
+
name: "StateButton",
|
|
1595
|
+
props: $,
|
|
1596
|
+
setup(e, { slots: t }) {
|
|
1597
|
+
return () => {
|
|
1598
|
+
let { type: n, disabled: r, succeeded: i, successText: a, failureText: o } = e;
|
|
1599
|
+
return D(z, {
|
|
1600
|
+
type: i ? "success" : i === !1 ? "error" : n,
|
|
1601
|
+
disabled: typeof i == "boolean" ? !0 : r
|
|
1602
|
+
}, {
|
|
1603
|
+
default: () => (i ? t.success ? t.success() : a : i === !1 ? t.failure ? t.failure() : o : t.default?.()) ?? t.default(),
|
|
1604
|
+
icon: () => i ? t.successIcon ? t.successIcon() : D(W, null, { default: () => [D(g, null, null)] }) : i === !1 ? t.failureIcon ? t.failureIcon() : D(W, null, { default: () => [D(y, null, null)] }) : t.icon?.()
|
|
1605
|
+
});
|
|
1606
|
+
};
|
|
1607
|
+
}
|
|
1608
|
+
}), vt = O(() => import("./DataTable-D6hPSWvx.js"));
|
|
1609
|
+
export { Je as DataActions, Xe as DataCustom, tt as DataDescriptions, ot as DataFilter, at as DataForm, rt as DataFormActions, lt as DataLocaleInput, Y as DataPagination, dt as DataSelection, vt as DataTable, ht as DtDeptRender, mt as DtUserDept, gt as DtUserRender, qe as NCheckboxes, pt as NRadios, _t as NStateButton, $ as StateButtonProps, J as dataFormActionsProps, Q as renderUsers, ct as useLocaleEdit };
|