@ithinkdt/ui 4.0.14 → 4.0.16

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