@ithinkdt/ui 4.0.0-50 → 4.0.0-52

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.
@@ -3,12 +3,13 @@ import { i as vTooltip } from "./directives-DUuJW647.js";
3
3
  import { g as useStyle, h as useMergedClsPrefix, n as cB, r as cE, t as c } from "./use-style-DcT-1dj4.js";
4
4
  import { Fragment, computed, createTextVNode, createVNode, defineComponent, inject, isVNode, mergeProps, nextTick, reactive, ref, shallowRef, toRaw, toRef, toValue, unref, useTemplateRef, watch, withDirectives } from "vue";
5
5
  import { toReactive, unrefElement, until, useCurrentElement, useElementSize, watchDebounced } from "@vueuse/core";
6
- import { NAvatar, NAvatarGroup, NButton, NCard, NCheckbox, NCheckboxGroup, NDataTable, NDropdown, NEllipsis, NEmpty, NFlex, NForm, NFormItem, NGi, NGrid, NH4, NIcon, NInput, NList, NListItem, NPagination, NPerformantEllipsis, NPopover, NRadio, NRadioButton, NRadioGroup, NSelect, NSpin, NTag, NText, NTooltip, NTransfer, NTree, NTreeSelect, dataTableProps, formProps } from "ithinkdt-ui";
6
+ import { NAvatar, NAvatarGroup, NButton, NCard, NCheckbox, NCheckboxGroup, NDataTable, NDropdown, NEllipsis, NEmpty, NFlex, NForm, NFormItem, NGi, NGrid, NH4, NIcon, NInput, NList, NListItem, NPagination, NPerformantEllipsis, NPopover, NRadio, NRadioButton, NRadioGroup, NSelect, NSpin, NTag, NText, NTooltip, NTransfer, NTree, NTreeSelect, dataTableProps, formProps, useDialog } from "ithinkdt-ui";
7
7
  import { VOverflow, VResizeObserver } from "vueuc";
8
8
  import { Sortable } from "sortablejs/modular/sortable.core.esm.js";
9
9
  import { pickProps } from "@ithinkdt/common/object";
10
10
  import { PAGE_INJECTION, useFormModal } from "@ithinkdt/page";
11
11
  import { Sortable as Sortable$1 } from "sortablejs";
12
+ import useLocale from "ithinkdt-ui/es/_mixins/use-locale.mjs";
12
13
  import { flattenTree, walkTree } from "@ithinkdt/common";
13
14
  const NCheckboxes = /* @__PURE__ */ defineComponent({
14
15
  name: "Checkboxes",
@@ -63,37 +64,37 @@ const NCheckboxes = /* @__PURE__ */ defineComponent({
63
64
  "update:modelValue": () => !0,
64
65
  updateModelValue: () => !0
65
66
  },
66
- setup(w, { emit: T, attrs: E }) {
67
- let { t: D } = useI18n(), O = computed(() => w.default ? w.default === !0 ? D("common.all") : typeof w.default == "string" ? w.default : w.default?.[w.labelField] ?? D("common.all") : ""), k = ref([]);
68
- watch(() => w.modelValue, (e) => k.value = e, { immediate: !0 });
69
- let A = (e) => {
70
- T("update:modelValue", e), T("updateModelValue", e);
71
- }, M = () => {
72
- A(k.value?.length === w.options.length ? [] : w.options.map((e) => e[w.valueField]));
73
- }, N = computed(() => w.options.length > k.value?.length && k.value?.length > 0), P = computed(() => ({ "--n-label-padding": w.labelPadding }));
67
+ setup(x, { emit: S, attrs: C }) {
68
+ let { t: w } = useI18n(), T = computed(() => x.default ? x.default === !0 ? w("common.all") : typeof x.default == "string" ? x.default : x.default?.[x.labelField] ?? w("common.all") : ""), E = ref([]);
69
+ watch(() => x.modelValue, (e) => E.value = e, { immediate: !0 });
70
+ let D = (e) => {
71
+ S("update:modelValue", e), S("updateModelValue", e);
72
+ }, k = () => {
73
+ D(E.value?.length === x.options.length ? [] : x.options.map((e) => e[x.valueField]));
74
+ }, A = computed(() => x.options.length > E.value?.length && E.value?.length > 0), j = computed(() => ({ "--n-label-padding": x.labelPadding }));
74
75
  return () => {
75
- let e = createVNode(NCheckboxGroup, mergeProps(E, {
76
- value: k.value,
77
- onUpdateValue: A
76
+ let e = createVNode(NCheckboxGroup, mergeProps(C, {
77
+ value: E.value,
78
+ onUpdateValue: D
78
79
  }), { default: () => [createVNode(NFlex, {
79
- size: w.gap ?? (w.vertical ? void 0 : "small"),
80
- vertical: w.vertical,
81
- style: !w.default && w.vertical ? { padding: "6px 0 0" } : {}
82
- }, { default: () => [w.options?.map((e) => createVNode(NCheckbox, {
83
- value: e[w.valueField],
84
- disabled: e[w.disabledField],
85
- style: P.value
86
- }, { default: () => [e[w.labelField]] }))] })] });
87
- return w.default ? createVNode(NFlex, {
88
- size: w.gap ?? (w.vertical ? void 0 : "small"),
89
- vertical: w.vertical,
90
- style: w.vertical ? { padding: "6px 0 0" } : {}
80
+ size: x.gap ?? (x.vertical ? void 0 : "small"),
81
+ vertical: x.vertical,
82
+ style: !x.default && x.vertical ? { padding: "6px 0 0" } : {}
83
+ }, { default: () => [x.options?.map((e) => createVNode(NCheckbox, {
84
+ value: e[x.valueField],
85
+ disabled: e[x.disabledField],
86
+ style: j.value
87
+ }, { default: () => [e[x.labelField]] }))] })] });
88
+ return x.default ? createVNode(NFlex, {
89
+ size: x.gap ?? (x.vertical ? void 0 : "small"),
90
+ vertical: x.vertical,
91
+ style: x.vertical ? { padding: "6px 0 0" } : {}
91
92
  }, { default: () => [createVNode("span", null, [createVNode(NCheckbox, {
92
- indeterminate: N.value,
93
- checked: k.value?.length > 0,
94
- onUpdateChecked: M,
95
- style: P.value
96
- }, { default: () => [O.value] })]), e] }) : e;
93
+ indeterminate: A.value,
94
+ checked: E.value?.length > 0,
95
+ onUpdateChecked: k,
96
+ style: j.value
97
+ }, { default: () => [T.value] })]), e] }) : e;
97
98
  };
98
99
  }
99
100
  }), IHelp = (e) => createVNode("svg", mergeProps({
@@ -126,7 +127,7 @@ const NCheckboxes = /* @__PURE__ */ defineComponent({
126
127
  }, e), [createVNode("path", {
127
128
  fill: "currentColor",
128
129
  d: "M300 276.497a56 56 0 1 0 56-96.994a56 56 0 0 0-56 96.994Zm0 284a56 56 0 1 0 56-96.994a56 56 0 0 0-56 96.994ZM640 228a56 56 0 1 0 112 0a56 56 0 0 0-112 0Zm0 284a56 56 0 1 0 112 0a56 56 0 0 0-112 0ZM300 844.497a56 56 0 1 0 56-96.994a56 56 0 0 0-56 96.994ZM640 796a56 56 0 1 0 112 0a56 56 0 0 0-112 0Z"
129
- }, null)]), ILeft = (e) => createVNode("svg", mergeProps({
130
+ }, null)]), ILeft2 = (e) => createVNode("svg", mergeProps({
130
131
  xmlns: "http://www.w3.org/2000/svg",
131
132
  "xmlns:xlink": "http://www.w3.org/1999/xlink",
132
133
  role: "img",
@@ -136,7 +137,7 @@ const NCheckboxes = /* @__PURE__ */ defineComponent({
136
137
  }, e), [createVNode("path", {
137
138
  fill: "currentColor",
138
139
  d: "M326 164h-64c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V172c0-4.4-3.6-8-8-8zm444 72.4V164c0-6.8-7.9-10.5-13.1-6.1L335 512l421.9 354.1c5.2 4.4 13.1.7 13.1-6.1v-72.4c0-9.4-4.2-18.4-11.4-24.5L459.4 512l299.2-251.1c7.2-6.1 11.4-15.1 11.4-24.5z"
139
- }, null)]), IRight = (e) => createVNode("svg", mergeProps({
140
+ }, null)]), IRight2 = (e) => createVNode("svg", mergeProps({
140
141
  xmlns: "http://www.w3.org/2000/svg",
141
142
  "xmlns:xlink": "http://www.w3.org/1999/xlink",
142
143
  role: "img",
@@ -146,6 +147,26 @@ const NCheckboxes = /* @__PURE__ */ defineComponent({
146
147
  }, e), [createVNode("path", {
147
148
  fill: "currentColor",
148
149
  d: "M762 164h-64c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V172c0-4.4-3.6-8-8-8zm-508 0v72.4c0 9.5 4.2 18.4 11.4 24.5L564.6 512L265.4 763.1c-7.2 6.1-11.4 15-11.4 24.5V860c0 6.8 7.9 10.5 13.1 6.1L689 512L267.1 157.9A7.95 7.95 0 0 0 254 164z"
150
+ }, null)]), ILeft = (e) => createVNode("svg", mergeProps({
151
+ xmlns: "http://www.w3.org/2000/svg",
152
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
153
+ role: "img",
154
+ width: "1em",
155
+ height: "1em",
156
+ viewBox: "0 0 24 24"
157
+ }, e), [createVNode("path", {
158
+ fill: "currentColor",
159
+ d: "M15.41 16.58L10.83 12l4.58-4.59L14 6l-6 6l6 6z"
160
+ }, null)]), IRight = (e) => createVNode("svg", mergeProps({
161
+ xmlns: "http://www.w3.org/2000/svg",
162
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
163
+ role: "img",
164
+ width: "1em",
165
+ height: "1em",
166
+ viewBox: "0 0 24 24"
167
+ }, e), [createVNode("path", {
168
+ fill: "currentColor",
169
+ d: "M8.59 16.58L13.17 12L8.59 7.41L10 6l6 6l-6 6z"
149
170
  }, null)]), IDown = (e) => createVNode("svg", mergeProps({
150
171
  xmlns: "http://www.w3.org/2000/svg",
151
172
  "xmlns:xlink": "http://www.w3.org/1999/xlink",
@@ -235,16 +256,16 @@ const NCheckboxes = /* @__PURE__ */ defineComponent({
235
256
  default: () => []
236
257
  } },
237
258
  setup(e) {
238
- let w = ref(), T = !0, E = () => {
239
- T ? T = !1 : w.value?.sync({ showAllItemsBeforeCalculate: !0 });
240
- }, D = ref(), O = () => D.value, k = ref(-1), A = (w) => {
241
- k.value = e.options.length - w;
242
- }, M = (e) => {
243
- e || (k.value = -1);
244
- }, N = () => {}, P = computed(() => k.value === -1 ? [] : e.options.slice(k.value).map((e) => ({
259
+ let x = ref(), S = !0, C = () => {
260
+ S ? S = !1 : x.value?.sync({ showAllItemsBeforeCalculate: !0 });
261
+ }, w = ref(), T = () => w.value, E = ref(-1), D = (x) => {
262
+ E.value = e.options.length - x;
263
+ }, k = (e) => {
264
+ e || (E.value = -1);
265
+ }, A = () => {}, j = computed(() => E.value === -1 ? [] : e.options.slice(E.value).map((e) => ({
245
266
  ...e,
246
267
  key: e.text
247
- }))), F = (e) => createVNode(NButton, {
268
+ }))), M = (e) => createVNode(NButton, {
248
269
  type: e.color === "danger" ? "error" : [
249
270
  "default",
250
271
  "tertiary",
@@ -255,15 +276,15 @@ const NCheckboxes = /* @__PURE__ */ defineComponent({
255
276
  "error"
256
277
  ].includes(e.color) ? e.color : "primary",
257
278
  text: !0
258
- }, { default: () => [e.text] }), I = (e, w) => {
259
- w.onClick?.();
279
+ }, { default: () => [e.text] }), N = (e, x) => {
280
+ x.onClick?.();
260
281
  };
261
- return () => createVNode(VResizeObserver, { onResize: E }, { default: () => [createVNode(VOverflow, {
262
- ref: w,
263
- getCounter: O,
264
- onUpdateCount: A,
265
- onUpdateOverflow: M,
266
- updateCounter: N,
282
+ return () => createVNode(VResizeObserver, { onResize: C }, { default: () => [createVNode(VOverflow, {
283
+ ref: x,
284
+ getCounter: T,
285
+ onUpdateCount: D,
286
+ onUpdateOverflow: k,
287
+ updateCounter: A,
267
288
  style: "margin-top: 2px"
268
289
  }, {
269
290
  default: () => e.options.map((e) => createVNode(NButton, {
@@ -281,12 +302,12 @@ const NCheckboxes = /* @__PURE__ */ defineComponent({
281
302
  onClick: e.onClick
282
303
  }, { default: () => [e.text] })),
283
304
  counter: () => createVNode("span", {
284
- ref: D,
305
+ ref: w,
285
306
  style: "position: absolute"
286
307
  }, [createVNode(NDropdown, {
287
- options: P.value,
288
- renderLabel: F,
289
- onSelect: I
308
+ options: j.value,
309
+ renderLabel: M,
310
+ onSelect: N
290
311
  }, { default: () => [createVNode(NButton, {
291
312
  quaternary: !0,
292
313
  size: "small"
@@ -307,9 +328,9 @@ var DataCustomItem = /* @__PURE__ */ defineComponent({
307
328
  fixed: [Boolean, String]
308
329
  },
309
330
  emits: ["update-hidden", "update-fixed"],
310
- setup(e, { emit: w }) {
331
+ setup(e, { emit: x }) {
311
332
  return () => {
312
- let T;
333
+ let S;
313
334
  return createVNode(NFlex, {
314
335
  align: "center",
315
336
  wrap: !1,
@@ -323,18 +344,18 @@ var DataCustomItem = /* @__PURE__ */ defineComponent({
323
344
  createVNode(NCheckbox, {
324
345
  checked: !e.hidden,
325
346
  disabled: e.disabled,
326
- onUpdateChecked: (e) => w("update-hidden", !e)
347
+ onUpdateChecked: (e) => x("update-hidden", !e)
327
348
  }, null),
328
- createVNode(NEllipsis, { style: "flex: 1 1 auto" }, _isSlot$6(T = toValue(e.label)) ? T : { default: () => [T] }),
349
+ createVNode(NEllipsis, { style: "flex: 1 1 auto" }, _isSlot$6(S = toValue(e.label)) ? S : { default: () => [S] }),
329
350
  e.showFixed ? [createVNode(NButton, {
330
351
  text: !0,
331
352
  type: e.fixed === "left" ? "primary" : void 0,
332
- onClick: () => w("update-fixed", e.fixed === "left" ? !1 : "left")
333
- }, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(ILeft, null, null)] })] }), createVNode(NButton, {
353
+ onClick: () => x("update-fixed", e.fixed === "left" ? !1 : "left")
354
+ }, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(ILeft2, null, null)] })] }), createVNode(NButton, {
334
355
  text: !0,
335
356
  type: e.fixed === "right" ? "primary" : void 0,
336
- onClick: () => w("update-fixed", e.fixed === "right" ? !1 : "right")
337
- }, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(IRight, null, null)] })] })] : void 0
357
+ onClick: () => x("update-fixed", e.fixed === "right" ? !1 : "right")
358
+ }, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(IRight2, null, null)] })] })] : void 0
338
359
  ] });
339
360
  };
340
361
  }
@@ -382,24 +403,24 @@ const DataCustom = /* @__PURE__ */ defineComponent({
382
403
  type: { type: String }
383
404
  },
384
405
  emits: { custom: () => !0 },
385
- setup(T, { emit: E }) {
386
- let { t: D } = useI18n();
387
- function O(e, w, D) {
388
- E("custom", {
389
- key: e[T.keyField],
390
- [w]: D
406
+ setup(S, { emit: C }) {
407
+ let { t: w } = useI18n();
408
+ function T(e, x, w) {
409
+ C("custom", {
410
+ key: e[S.keyField],
411
+ [x]: w
391
412
  });
392
413
  }
393
- let k = ref();
394
- return watch(k, (e) => {
414
+ let E = ref();
415
+ return watch(E, (e) => {
395
416
  e.$el && Sortable.create(e.$el, {
396
417
  animation: 150,
397
418
  ghostClass: "ghost",
398
419
  handle: ".icon-drag",
399
420
  filter: ".disabled",
400
421
  onEnd(e) {
401
- let w = T.data.map((e) => e[T.keyField]), [D] = w.splice(e.oldIndex, 1);
402
- w.splice(e.newIndex, 0, D), E("custom", w);
422
+ let x = S.data.map((e) => e[S.keyField]), [w] = x.splice(e.oldIndex, 1);
423
+ x.splice(e.newIndex, 0, w), C("custom", x);
403
424
  }
404
425
  });
405
426
  }), () => createVNode(NPopover, {
@@ -411,27 +432,27 @@ const DataCustom = /* @__PURE__ */ defineComponent({
411
432
  }, {
412
433
  trigger: () => withDirectives(createVNode(NButton, {
413
434
  text: !0,
414
- type: T.type
415
- }, { default: () => [createVNode(NIcon, { size: T.size }, { default: () => [createVNode(ICustom, null, null)] })] }), [[vTooltip, T.tooltip ?? D("common.page.custom.tooltip")]]),
435
+ type: S.type
436
+ }, { default: () => [createVNode(NIcon, { size: S.size }, { default: () => [createVNode(ICustom, null, null)] })] }), [[vTooltip, S.tooltip ?? w("common.page.custom.tooltip")]]),
416
437
  default: () => {
417
- let e, w;
418
- return createVNode(NFlex, { vertical: !0 }, { default: () => [createVNode(NFlex, { justify: "space-between" }, { default: () => [createVNode("div", { style: "font-weight: bold" }, [T.tooltip ?? D("common.page.custom.tooltip")]), createVNode(NButton, {
438
+ let e, x;
439
+ return createVNode(NFlex, { vertical: !0 }, { default: () => [createVNode(NFlex, { justify: "space-between" }, { default: () => [createVNode("div", { style: "font-weight: bold" }, [S.tooltip ?? w("common.page.custom.tooltip")]), createVNode(NButton, {
419
440
  text: !0,
420
441
  type: "primary",
421
442
  size: "small",
422
- onClick: () => E("custom", !0)
423
- }, _isSlot$6(e = D("common.page.custom.reset")) ? e : { default: () => [e] })] }), createVNode(NFlex, {
424
- ref: k,
443
+ onClick: () => C("custom", !0)
444
+ }, _isSlot$6(e = w("common.page.custom.reset")) ? e : { default: () => [e] })] }), createVNode(NFlex, {
445
+ ref: E,
425
446
  vertical: !0
426
- }, _isSlot$6(w = T.data.filter((e) => e[T.visiblityField] !== !1).map((e) => createVNode(DataCustomItem, {
427
- key: e[T.keyField],
428
- label: e[T.labelField],
429
- hidden: e[T.hiddenField],
430
- fixed: e[T.fixedField],
431
- showFixed: T.showFixed,
432
- onUpdateHidden: (w) => O(e, "hidden", w),
433
- onUpdateFixed: (w) => O(e, "fixed", w)
434
- }, null))) ? w : { default: () => [w] })] });
447
+ }, _isSlot$6(x = S.data.filter((e) => e[S.visiblityField] !== !1).map((e) => createVNode(DataCustomItem, {
448
+ key: e[S.keyField],
449
+ label: e[S.labelField],
450
+ hidden: e[S.hiddenField],
451
+ fixed: e[S.fixedField],
452
+ showFixed: S.showFixed,
453
+ onUpdateHidden: (x) => T(e, "hidden", x),
454
+ onUpdateFixed: (x) => T(e, "fixed", x)
455
+ }, null))) ? x : { default: () => [x] })] });
435
456
  }
436
457
  });
437
458
  }
@@ -537,110 +558,110 @@ const DataForm = /* @__PURE__ */ defineComponent({
537
558
  "reset",
538
559
  "cancel"
539
560
  ],
540
- setup(w, { emit: T, slots: E }) {
541
- let { t: D } = useI18n(), O = (e) => {
542
- e?.preventDefault?.(), T("submit", { ...toRaw(w.model) }, e);
543
- }, k = (e) => {
544
- e?.preventDefault?.(), T("reset");
545
- }, j = (e) => {
546
- e?.preventDefault?.(), T("cancel");
547
- }, N = ref(), P = ref(), { width: F } = useElementSize(useCurrentElement());
548
- return watchDebounced([N, F], () => {
549
- P.value = void 0, setTimeout(() => {
550
- P.value = N.value?.responsiveCols || void 0;
561
+ setup(x, { emit: S, slots: C }) {
562
+ let { t: w } = useI18n(), T = (e) => {
563
+ e?.preventDefault?.(), S("submit", { ...toRaw(x.model) }, e);
564
+ }, E = (e) => {
565
+ e?.preventDefault?.(), S("reset");
566
+ }, O = (e) => {
567
+ e?.preventDefault?.(), S("cancel");
568
+ }, A = ref(), j = ref(), { width: M } = useElementSize(useCurrentElement());
569
+ return watchDebounced([A, M], () => {
570
+ j.value = void 0, setTimeout(() => {
571
+ j.value = A.value?.responsiveCols || void 0;
551
572
  }, 30);
552
573
  }, {
553
574
  immediate: !0,
554
575
  debounce: 100
555
576
  }), () => {
556
- let { items: e, loading: T, validation: F, showColon: L, showAction: R, actionAlign: z, submitText: B, submitDisabled: V, resetText: H, tooltipPlacement: W, showFeedback: G, labelWidth: K = "7.2em", labelAlign: q = w.labelPlacement === "top" ? "left" : "right", grid: J, succeeded: Y, successText: X = B,...Z } = w, Q = !w.readonly && G !== !1;
577
+ let { items: e, loading: S, validation: M, showColon: P, showAction: F, actionAlign: I, submitText: L, submitDisabled: R, resetText: z, tooltipPlacement: V, showFeedback: H, labelWidth: U = "7.2em", labelAlign: W = x.labelPlacement === "top" ? "left" : "right", grid: G, succeeded: K, successText: q = L,...J } = x, Y = !x.readonly && H !== !1;
557
578
  return createVNode(NForm, mergeProps({
558
- labelWidth: K,
559
- labelAlign: q,
560
- onReset: k,
561
- onSubmit: O,
562
- showFeedback: Q
563
- }, Z), { default: () => [createVNode(NGrid, mergeProps({
564
- ref: N,
579
+ labelWidth: U,
580
+ labelAlign: W,
581
+ onReset: E,
582
+ onSubmit: T,
583
+ showFeedback: Y
584
+ }, J), { default: () => [createVNode(NGrid, mergeProps({
585
+ ref: A,
565
586
  itemResponsive: !0
566
- }, J, { yGap: Q ? 0 : J?.yGap ?? 24 }), { default: () => {
567
- let O = 0;
568
- return createVNode(Fragment, null, [e.map(({ hidden: e, name: T, render: E, label: D, showColon: k, span: A = 6, rowSpan: j, offset: N = 0, tooltip: P, tooltipPlacement: L = w.tooltipPlacement, validationStatus: R = F[T]?.errors?.some((e) => e !== void 0) ? "error" : F[T]?.warnings?.some((e) => e !== void 0) ? "warnings" : F[T] ? "success" : void 0, readonly: z = w.readonly, showRequireMark: B = !z, showTooltipWhenReadonly: V = !1,...H }) => {
587
+ }, G, { yGap: Y ? 0 : G?.yGap ?? 24 }), { default: () => {
588
+ let T = 0;
589
+ return createVNode(Fragment, null, [e.map(({ hidden: e, name: S, render: C, label: w, showColon: E, span: D = 6, rowSpan: O, offset: A = 0, tooltip: j, tooltipPlacement: P = x.tooltipPlacement, validationStatus: F = M[S]?.errors?.some((e) => e !== void 0) ? "error" : M[S]?.warnings?.some((e) => e !== void 0) ? "warnings" : M[S] ? "success" : void 0, readonly: I = x.readonly, showRequireMark: L = !I, showTooltipWhenReadonly: R = !1,...z }) => {
569
590
  if (e) return;
570
- O += A;
571
- let W;
572
- return W = T[0] === "$" ? E({}) : createVNode(NFormItem, mergeProps({
573
- path: T,
574
- validationStatus: R,
575
- showRequireMark: H.required && B
576
- }, H), {
591
+ T += D;
592
+ let V;
593
+ return V = S[0] === "$" ? C({}) : createVNode(NFormItem, mergeProps({
594
+ path: S,
595
+ validationStatus: F,
596
+ showRequireMark: z.required && L
597
+ }, z), {
577
598
  label: () => createVNode(NText, {
578
- depth: w.readonly ? 3 : 2,
599
+ depth: x.readonly ? 3 : 2,
579
600
  style: "display: inline-flex; align-items: flex-start; gap: 1px"
580
601
  }, { default: () => [
581
- createVNode("span", null, [toValue(D)]),
582
- L === "icon" ? createVNode(NTooltip, null, {
583
- default: () => toValue(P),
602
+ createVNode("span", null, [toValue(w)]),
603
+ P === "icon" ? createVNode(NTooltip, null, {
604
+ default: () => toValue(j),
584
605
  trigger: () => createVNode(NButton, {
585
606
  text: !0,
586
607
  style: "font-size: 1.25em; opacity: 0.8"
587
608
  }, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(IHelp, null, null)] })] })
588
609
  }) : void 0,
589
- w.showColon && k !== !1 ? createVNode("span", { style: "place-self: center" }, [createTextVNode(":")]) : void 0
610
+ x.showColon && E !== !1 ? createVNode("span", { style: "place-self: center" }, [createTextVNode(":")]) : void 0
590
611
  ] }),
591
612
  default: () => {
592
- let e, T = createVNode("div", { style: "width: 100%; font-size: calc(1rem - 2px); min-height: 32px; display: flex; align-items: center" }, [E({
593
- disabled: w.disabled,
594
- size: w.size,
595
- readonly: w.readonly
613
+ let e, S = createVNode("div", { style: "width: 100%; font-size: calc(1rem - 2px); min-height: 32px; display: flex; align-items: center" }, [C({
614
+ disabled: x.disabled,
615
+ size: x.size,
616
+ readonly: x.readonly
596
617
  })]);
597
- return P && L === "bottom" && (!w.readonly || V) ? createVNode("div", { style: "width: 100%; display: flex; flex-direction: column" }, [T, createVNode(NText, {
618
+ return j && P === "bottom" && (!x.readonly || R) ? createVNode("div", { style: "width: 100%; display: flex; flex-direction: column" }, [S, createVNode(NText, {
598
619
  depth: 3,
599
620
  style: "font-size: calc(1rem - 3px); margin-top: 6px"
600
- }, _isSlot$5(e = toValue(P)) ? e : { default: () => [e] })]) : T;
621
+ }, _isSlot$5(e = toValue(j)) ? e : { default: () => [e] })]) : S;
601
622
  },
602
- feedback: () => F[T]?.errors[0] ?? F[T]?.warnings[0]
603
- }), w.grid === !1 ? W : createVNode(NGi, {
604
- key: T,
605
- offset: N,
606
- span: A,
607
- style: j ? { gridRowEnd: `span ${j}` } : void 0
608
- }, _isSlot$5(W) ? W : { default: () => [W] });
609
- }), R === !1 || w.readonly === !0 && !E.action ? void 0 : createVNode(NGi, mergeProps({
623
+ feedback: () => M[S]?.errors[0] ?? M[S]?.warnings[0]
624
+ }), x.grid === !1 ? V : createVNode(NGi, {
625
+ key: S,
626
+ offset: A,
627
+ span: D,
628
+ style: O ? { gridRowEnd: `span ${O}` } : void 0
629
+ }, _isSlot$5(V) ? V : { default: () => [V] });
630
+ }), F === !1 || x.readonly === !0 && !C.action ? void 0 : createVNode(NGi, mergeProps({
610
631
  key: "action",
611
632
  span: 2 ** 53 - 1
612
- }, typeof w.showAction == "object" ? w.showAction : {}), { default: ({ overflow: e }) => E.action ? E.action({
613
- cols: P.value,
614
- spans: O,
633
+ }, typeof x.showAction == "object" ? x.showAction : {}), { default: ({ overflow: e }) => C.action ? C.action({
634
+ cols: j.value,
635
+ spans: T,
615
636
  overflow: e
616
637
  }) : createVNode(NFormItem, {
617
- label: w.actionAlign === "start" ? " " : void 0,
618
- showLabel: w.labelPlacement !== "top",
638
+ label: x.actionAlign === "start" ? " " : void 0,
639
+ showLabel: x.labelPlacement !== "top",
619
640
  style: "padding-top: 16px"
620
641
  }, { default: () => [createVNode(NFlex, {
621
- justify: w.actionAlign,
642
+ justify: x.actionAlign,
622
643
  align: "center"
623
644
  }, { default: () => [
624
- w.showSubmitBtn === !1 ? void 0 : createVNode(NButton, {
645
+ x.showSubmitBtn === !1 ? void 0 : createVNode(NButton, {
625
646
  attrType: "submit",
626
- type: Y ? "success" : "primary",
627
- disabled: Y || w.disabled || w.submitDisabled || T,
628
- loading: T
647
+ type: K ? "success" : "primary",
648
+ disabled: K || x.disabled || x.submitDisabled || S,
649
+ loading: S
629
650
  }, {
630
- default: () => (Y ? X : B) || D("common.page.form.submitText"),
631
- icon: () => Y ? createVNode(NIcon, null, { default: () => [createVNode(ICheck, null, null)] }) : void 0
651
+ default: () => (K ? q : L) || w("common.page.form.submitText"),
652
+ icon: () => K ? createVNode(NIcon, null, { default: () => [createVNode(ICheck, null, null)] }) : void 0
632
653
  }),
633
- w.showResetBtn === !1 ? void 0 : createVNode(NButton, {
654
+ x.showResetBtn === !1 ? void 0 : createVNode(NButton, {
634
655
  attrType: "reset",
635
- disabled: w.disabled || T,
636
- type: w.showCancelBtn ? "primary" : "default",
637
- secondary: w.showCancelBtn
638
- }, { default: () => [w.resetText || D("common.page.form.resetText")] }),
639
- w.showCancelBtn === !1 ? void 0 : createVNode(NButton, {
656
+ disabled: x.disabled || S,
657
+ type: x.showCancelBtn ? "primary" : "default",
658
+ secondary: x.showCancelBtn
659
+ }, { default: () => [x.resetText || w("common.page.form.resetText")] }),
660
+ x.showCancelBtn === !1 ? void 0 : createVNode(NButton, {
640
661
  attrType: "button",
641
- disabled: w.disabled || T,
642
- onClick: j
643
- }, { default: () => [w.cancelText || D("common.page.form.cancelText")] })
662
+ disabled: x.disabled || S,
663
+ onClick: O
664
+ }, { default: () => [x.cancelText || w("common.page.form.cancelText")] })
644
665
  ] })] }) })]);
645
666
  } })] });
646
667
  };
@@ -705,62 +726,62 @@ const DataForm = /* @__PURE__ */ defineComponent({
705
726
  "custom",
706
727
  "collapse"
707
728
  ],
708
- setup(w, { expose: T, emit: E }) {
709
- let { t: D } = useI18n(), O = (e) => {
710
- E("filter", w.model, e);
711
- }, k = (e) => {
712
- E("reset", e), w.filterOnReset && E("filter", w.model, e);
713
- }, A = ref(w.defaultCollapsed), j = (e) => {
714
- A.value = e;
729
+ setup(x, { expose: S, emit: C }) {
730
+ let { t: w } = useI18n(), T = (e) => {
731
+ C("filter", x.model, e);
732
+ }, E = (e) => {
733
+ C("reset", e), x.filterOnReset && C("filter", x.model, e);
734
+ }, D = ref(x.defaultCollapsed), O = (e) => {
735
+ D.value = e;
715
736
  };
716
- T({ collapse: j });
717
- let N = reactive({
737
+ S({ collapse: O });
738
+ let A = reactive({
718
739
  span: 6,
719
740
  suffix: !0
720
741
  });
721
742
  return () => {
722
- let { filterOnReset: e, filterText: T, resetText: P, customizable: F, defaultCollapsed: L, collapsible: R, grid: z,...B } = w;
743
+ let { filterOnReset: e, filterText: S, resetText: j, customizable: M, defaultCollapsed: P, collapsible: F, grid: I,...L } = x;
723
744
  return createVNode(DataForm, mergeProps({ grid: {
724
745
  cols: "12 768:18 1280:24 1536:30",
725
746
  yGap: 20,
726
747
  xGap: 8,
727
- ...z,
728
- collapsed: A.value
729
- } }, B, {
748
+ ...I,
749
+ collapsed: D.value
750
+ } }, L, {
730
751
  showFeedback: !1,
731
- showAction: N,
732
- onSubmit: O,
733
- onReset: k
734
- }), { action: ({ cols: e, spans: O }) => (N.suffix = e < O + N.span, createVNode(NFlex, {
735
- justify: N.suffix ? "end" : "start",
752
+ showAction: A,
753
+ onSubmit: T,
754
+ onReset: E
755
+ }), { action: ({ cols: e, spans: T }) => (A.suffix = e < T + A.span, createVNode(NFlex, {
756
+ justify: A.suffix ? "end" : "start",
736
757
  align: "center"
737
758
  }, { default: () => [
738
- N.suffix ? void 0 : createVNode("span", null, [createTextVNode("\xA0\xA0\xA0\xA0")]),
759
+ A.suffix ? void 0 : createVNode("span", null, [createTextVNode("\xA0\xA0\xA0\xA0")]),
739
760
  createVNode(NButton, {
740
761
  attrType: "submit",
741
762
  type: "primary",
742
- disabled: w.disabled,
743
- loading: w.loading
744
- }, { default: () => [T || D("common.page.filter.submitText")] }),
763
+ disabled: x.disabled,
764
+ loading: x.loading
765
+ }, { default: () => [S || w("common.page.filter.submitText")] }),
745
766
  createVNode(NButton, {
746
767
  attrType: "reset",
747
- disabled: w.disabled || w.loading
748
- }, { default: () => [P || D("common.page.form.resetText")] }),
749
- F ? createVNode(DataCustom, {
768
+ disabled: x.disabled || x.loading
769
+ }, { default: () => [j || w("common.page.form.resetText")] }),
770
+ M ? createVNode(DataCustom, {
750
771
  keyField: "name",
751
772
  showFixed: !1,
752
- data: B.items,
753
- onCustom: (e) => E("custom", e),
773
+ data: L.items,
774
+ onCustom: (e) => C("custom", e),
754
775
  size: 18,
755
776
  type: "primary"
756
777
  }, null) : void 0,
757
- R && N.suffix ? createVNode(NButton, {
778
+ F && A.suffix ? createVNode(NButton, {
758
779
  text: !0,
759
780
  type: "primary",
760
781
  iconPlacement: "right",
761
- renderIcon: A.value ? IDown : IUp,
762
- onClick: () => j(!A.value)
763
- }, { default: () => [A.value ? D("common.page.filter.expand") : D("common.page.filter.collapse")] }) : void 0
782
+ renderIcon: D.value ? IDown : IUp,
783
+ onClick: () => O(!D.value)
784
+ }, { default: () => [D.value ? w("common.page.filter.expand") : w("common.page.filter.collapse")] }) : void 0
764
785
  ] })) });
765
786
  };
766
787
  }
@@ -768,31 +789,31 @@ const DataForm = /* @__PURE__ */ defineComponent({
768
789
  function _isSlot$4(e) {
769
790
  return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
770
791
  }
771
- function useLocaleEdit(w, T, E = 1) {
772
- let { t: D } = useI18n(), O = ref(!1), k = [], { open: A, reinit: j } = useFormModal({
773
- title: w,
792
+ function useLocaleEdit(x, S, C = 1) {
793
+ let { t: w } = useI18n(), T = ref(!1), E = [], { open: D, reinit: O } = useFormModal({
794
+ title: x,
774
795
  showColon: !0,
775
- submitText: D("common.confirm.defaultOk"),
776
- items: ({ it: e }) => k.map((w) => e(w.value, w.label, "input", {
796
+ submitText: w("common.confirm.defaultOk"),
797
+ items: ({ it: e }) => E.map((x) => e(x.value, x.label, "input", {
777
798
  span: 24,
778
- required: w.required,
799
+ required: x.required,
779
800
  inputProps: {
780
- readonly: O,
801
+ readonly: T,
781
802
  clearable: !0,
782
803
  type: "textarea",
783
804
  showCount: !0,
784
805
  autosize: {
785
- minRows: unref(E),
786
- maxRows: Math.max(unref(E), 5)
806
+ minRows: unref(C),
807
+ maxRows: Math.max(unref(C), 5)
787
808
  }
788
809
  }
789
810
  })),
790
- onSubmit: T
811
+ onSubmit: S
791
812
  });
792
813
  return {
793
- open: (e, w = !1) => (O.value = w, A(e)),
814
+ open: (e, x = !1) => (T.value = x, D(e)),
794
815
  setSupports: (e) => {
795
- k = e, j();
816
+ E = e, O();
796
817
  }
797
818
  };
798
819
  }
@@ -829,33 +850,33 @@ const DataLocaleInput = /* @__PURE__ */ defineComponent({
829
850
  }
830
851
  },
831
852
  emits: ["update:modelValue", "updateModelValue"],
832
- setup(e, { emit: w }) {
833
- let T = (T) => {
834
- T = {
853
+ setup(e, { emit: x }) {
854
+ let S = (S) => {
855
+ S = {
835
856
  ...e.modelValue,
836
- [e.showLang ?? e.defaultLang]: T
837
- }, w("update:modelValue", T), w("updateModelValue", T);
838
- }, { open: E, setSupports: D } = useLocaleEdit(computed(() => toValue(e.label)), (e) => {
839
- w("update:modelValue", e), w("updateModelValue", e);
857
+ [e.showLang ?? e.defaultLang]: S
858
+ }, x("update:modelValue", S), x("updateModelValue", S);
859
+ }, { open: C, setSupports: w } = useLocaleEdit(computed(() => toValue(e.label)), (e) => {
860
+ x("update:modelValue", e), x("updateModelValue", e);
840
861
  }, toRef(e, "defaultRows"));
841
- watch(() => e.supports, D, { immediate: !0 });
842
- let O = { suffix: () => createVNode(NButton, {
862
+ watch(() => e.supports, w, { immediate: !0 });
863
+ let T = { suffix: () => createVNode(NButton, {
843
864
  quaternary: !0,
844
- onClick: () => E(e.modelValue, e.disabled),
865
+ onClick: () => C(e.modelValue, e.disabled),
845
866
  style: "--n-padding: 0 8px"
846
867
  }, { default: () => [createVNode(NIcon, {
847
868
  size: "20",
848
869
  depth: "3"
849
- }, { default: () => [createVNode(ILanguage, null, null)] })] }) }, k = { "--n-padding-right": "0" };
870
+ }, { default: () => [createVNode(ILanguage, null, null)] })] }) }, E = { "--n-padding-right": "0" };
850
871
  return () => createVNode(NInput, {
851
872
  value: e.modelValue?.[e.showLang ?? e.defaultLang] ?? e.modelValue?.[e.defaultLang],
852
- onUpdateValue: T,
873
+ onUpdateValue: S,
853
874
  disabled: e.disabled,
854
875
  clearable: !0,
855
- style: k,
876
+ style: E,
856
877
  type: e.defaultRows > 1 ? "textarea" : "text",
857
878
  rows: e.defaultRows
858
- }, _isSlot$4(O) ? O : { default: () => [O] });
879
+ }, _isSlot$4(T) ? T : { default: () => [T] });
859
880
  }
860
881
  }), DataPagination = /* @__PURE__ */ defineComponent({
861
882
  name: "DataPagination",
@@ -878,27 +899,27 @@ const DataLocaleInput = /* @__PURE__ */ defineComponent({
878
899
  }
879
900
  },
880
901
  emits: { change: () => !0 },
881
- setup(w, { emit: T }) {
882
- let { t: E } = useI18n(), D = (e) => T("change", {
883
- pageSize: w.pageSize ?? w.page?.pageSize ?? 0,
902
+ setup(x, { emit: S }) {
903
+ let { t: C } = useI18n(), w = (e) => S("change", {
904
+ pageSize: x.pageSize ?? x.page?.pageSize ?? 0,
884
905
  currentPage: e
885
- }), O = (e) => T("change", {
906
+ }), T = (e) => S("change", {
886
907
  pageSize: e,
887
- currentPage: w.currentPage ?? w.page?.currentPage ?? 0
908
+ currentPage: x.currentPage ?? x.page?.currentPage ?? 0
888
909
  });
889
910
  return () => createVNode(NPagination, {
890
- page: w.currentPage ?? w.page?.currentPage,
891
- itemCount: w.total,
892
- pageSize: w.pageSize ?? w.page?.pageSize,
893
- onUpdatePage: D,
894
- onUpdatePageSize: O,
895
- pageSizes: w.pageSizes,
911
+ page: x.currentPage ?? x.page?.currentPage,
912
+ itemCount: x.total,
913
+ pageSize: x.pageSize ?? x.page?.pageSize,
914
+ onUpdatePage: w,
915
+ onUpdatePageSize: T,
916
+ pageSizes: x.pageSizes,
896
917
  showQuickJumper: !0,
897
918
  showSizePicker: !0,
898
919
  style: "justify-content: flex-end"
899
920
  }, {
900
- prefix: () => E("common.page.pagination.prefix", { total: w.total }),
901
- suffix: () => E("common.page.pagination.suffix")
921
+ prefix: () => C("common.page.pagination.prefix", { total: x.total }),
922
+ suffix: () => C("common.page.pagination.suffix")
902
923
  });
903
924
  }
904
925
  });
@@ -921,28 +942,28 @@ const DataSelection = /* @__PURE__ */ defineComponent({
921
942
  "update:modelValue": () => !0,
922
943
  clear: () => !0
923
944
  },
924
- setup(w, { emit: T }) {
925
- let { t: E } = useI18n();
945
+ setup(x, { emit: S }) {
946
+ let { t: C } = useI18n();
926
947
  return () => {
927
948
  let e;
928
- return w.modelValue !== "selection" && w.count === 0 ? createVNode("div", null, null) : createVNode("div", null, [createVNode(NFlex, {
949
+ return x.modelValue !== "selection" && x.count === 0 ? createVNode("div", null, null) : createVNode("div", null, [createVNode(NFlex, {
929
950
  align: "center",
930
951
  "wrap-item": !1
931
952
  }, { default: () => [
932
- createVNode("span", null, [E("common.page.selection.countText", { count: w.count })]),
953
+ createVNode("span", null, [C("common.page.selection.countText", { count: x.count })]),
933
954
  createVNode(NButton, {
934
955
  text: !0,
935
956
  type: "primary",
936
957
  onClick: () => {
937
- T("update:modelValue", w.modelValue === "all" ? "selection" : "all");
958
+ S("update:modelValue", x.modelValue === "all" ? "selection" : "all");
938
959
  }
939
- }, { default: () => [w.modelValue === "all" ? E("common.page.selection.view") : E("common.page.selection.back")] }),
960
+ }, { default: () => [x.modelValue === "all" ? C("common.page.selection.view") : C("common.page.selection.back")] }),
940
961
  createVNode(NButton, {
941
962
  text: !0,
942
963
  onClick: () => {
943
- T("clear"), T("update:modelValue", "all");
964
+ S("clear"), S("update:modelValue", "all");
944
965
  }
945
- }, _isSlot$3(e = E("common.page.selection.clear")) ? e : { default: () => [e] })
966
+ }, _isSlot$3(e = C("common.page.selection.clear")) ? e : { default: () => [e] })
946
967
  ] })]);
947
968
  };
948
969
  }
@@ -950,13 +971,13 @@ const DataSelection = /* @__PURE__ */ defineComponent({
950
971
  function _isSlot$2(e) {
951
972
  return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
952
973
  }
953
- function _map(e, T) {
974
+ function _map(e, S) {
954
975
  return (e ?? []).map((e) => {
955
- let E = {
976
+ let C = {
956
977
  csvTitle: e.exportTitle,
957
978
  ...e,
958
979
  title: () => {
959
- let T = toValue(e.title), E = T && withDirectives(createVNode("span", null, [T]), [[
980
+ let S = toValue(e.title), C = S && withDirectives(createVNode("span", null, [S]), [[
960
981
  vTooltip,
961
982
  () => toValue(e.title),
962
983
  void 0,
@@ -967,21 +988,21 @@ function _map(e, T) {
967
988
  wrap: !1,
968
989
  inline: !0,
969
990
  style: "max-width: 100%"
970
- }, { default: () => [E, createVNode(NTooltip, null, {
991
+ }, { default: () => [C, createVNode(NTooltip, null, {
971
992
  default: toValue(e.tooltip),
972
993
  trigger: () => createVNode(NButton, {
973
994
  text: !0,
974
995
  style: "font-size: 1.25em; opacity: 0.8"
975
996
  }, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(IHelp, null, null)] })] })
976
- })] }) : E;
997
+ })] }) : C;
977
998
  }
978
999
  };
979
- if (e.children?.length) E.children = _map(e.children, T);
1000
+ if (e.children?.length) C.children = _map(e.children, S);
980
1001
  else {
981
- e.hidden !== !0 && (E.width ??= 100, T.value += Number(E.width));
982
- let w = e.render ?? ((e) => e);
983
- e.ellipsis !== !1 && (E.ellipsis = !1, E.render = (...T) => {
984
- let E = w(...T);
1002
+ e.hidden !== !0 && (C.width ??= 100, S.value += Number(C.width));
1003
+ let x = e.render ?? ((e) => e);
1004
+ e.ellipsis !== !1 && (C.ellipsis = !1, C.render = (...S) => {
1005
+ let C = x(...S);
985
1006
  return createVNode(NPerformantEllipsis, mergeProps({
986
1007
  expandTrigger: "click",
987
1008
  lineClamp: 1,
@@ -989,15 +1010,15 @@ function _map(e, T) {
989
1010
  maxWidth: "61.8vw",
990
1011
  wordBreak: "break-all"
991
1012
  } }
992
- }, typeof e.ellipsis == "boolean" ? {} : e.ellipsis), _isSlot$2(E) ? E : { default: () => [E] });
993
- }, e.ellipsisTooltip === !0 && (E.ellipsisTooltip ??= w)), Object.assign(E, {
1013
+ }, typeof e.ellipsis == "boolean" ? {} : e.ellipsis), _isSlot$2(C) ? C : { default: () => [C] });
1014
+ }, e.ellipsisTooltip === !0 && (C.ellipsisTooltip ??= x)), Object.assign(C, {
994
1015
  resizable: e.resizable !== !1,
995
1016
  sorter: e.sortable,
996
1017
  type: ["selection", "expand"].includes(e.type) ? e.type : void 0,
997
- disabled: e.selectable ? (w) => e.selectable(w) === !1 : void 0
1018
+ disabled: e.selectable ? (x) => e.selectable(x) === !1 : void 0
998
1019
  });
999
1020
  }
1000
- return E.key === "$actions" && (E.cellProps ??= () => ({ style: { padding: "0 2px" } })), E;
1021
+ return C.key === "$actions" && (C.cellProps ??= () => ({ style: { padding: "0 2px" } })), C;
1001
1022
  }).filter((e) => e?.hidden !== !0);
1002
1023
  }
1003
1024
  const DataTable = /* @__PURE__ */ defineComponent({
@@ -1035,113 +1056,113 @@ const DataTable = /* @__PURE__ */ defineComponent({
1035
1056
  "custom",
1036
1057
  "highlight"
1037
1058
  ],
1038
- setup(e, { slots: w, emit: D, expose: O }) {
1039
- let { keyField: k } = inject(PAGE_INJECTION), A = useMergedClsPrefix(), M = `${A.value}-datatable`;
1040
- useStyle("-datatable", style, A);
1041
- let N = useTemplateRef("table-ref"), F = ({ sortField: e, sortOrder: w } = {}, T) => {
1042
- e == T?.sortField && w == T?.sortOrder || N.value?.sort(e, w ? w + "end" : !1);
1059
+ setup(e, { slots: x, emit: w, expose: T }) {
1060
+ let { keyField: E } = inject(PAGE_INJECTION), D = useMergedClsPrefix(), k = `${D.value}-datatable`;
1061
+ useStyle("-datatable", style, D);
1062
+ let A = useTemplateRef("table-ref"), M = ({ sortField: e, sortOrder: x } = {}, S) => {
1063
+ e == S?.sortField && x == S?.sortOrder || A.value?.sort(e, x ? x + "end" : !1);
1043
1064
  };
1044
- watch(() => ({ ...e.sorter }), F, { deep: !0 });
1045
- let I = computed(() => {
1046
- let w = e.keyField || k || "key";
1047
- return (e) => e[w];
1048
- }), L = shallowRef({
1065
+ watch(() => ({ ...e.sorter }), M, { deep: !0 });
1066
+ let N = computed(() => {
1067
+ let x = e.keyField || E || "key";
1068
+ return (e) => e[x];
1069
+ }), P = shallowRef({
1049
1070
  cache: [],
1050
1071
  scrollToView(...e) {
1051
1072
  this.cache.push(e);
1052
1073
  }
1053
1074
  });
1054
- until(N).changed().then(() => {
1055
- F(e.sorter);
1056
- let w = L.value.cache;
1057
- L.value = N.value, L.value.scrollToView = (w) => {
1058
- let T = e.data.findIndex((e) => I.value(e) === w);
1059
- if (T === -1) return;
1060
- let E = N.value.$el.querySelector(`.${M}__row-marker:nth-child(${T + 1})`);
1061
- N.value.scrollTo({
1062
- top: E.offsetTop,
1075
+ until(A).changed().then(() => {
1076
+ M(e.sorter);
1077
+ let x = P.value.cache;
1078
+ P.value = A.value, P.value.scrollToView = (x) => {
1079
+ let S = e.data.findIndex((e) => N.value(e) === x);
1080
+ if (S === -1) return;
1081
+ let C = A.value.$el.querySelector(`.${k}__row-marker:nth-child(${S + 1})`);
1082
+ A.value.scrollTo({
1083
+ top: C.offsetTop,
1063
1084
  behavior: "smooth"
1064
1085
  });
1065
1086
  };
1066
- for (let e of w) L.value.scrollToView(...e);
1067
- }), O(toReactive(L));
1068
- let R = ref(0), V = shallowRef([]);
1087
+ for (let e of x) P.value.scrollToView(...e);
1088
+ }), T(toReactive(P));
1089
+ let F = ref(0), R = shallowRef([]);
1069
1090
  watch(() => e.columns, () => {
1070
- R.value = 0, V.value = _map(e.columns, R);
1091
+ F.value = 0, R.value = _map(e.columns, F);
1071
1092
  }, {
1072
1093
  immediate: !0,
1073
1094
  deep: 1
1074
1095
  });
1075
- let H = ref();
1096
+ let z = ref();
1076
1097
  watch(() => e.highlight, (e) => {
1077
- H.value = typeof e == "boolean" ? null : e ?? null;
1098
+ z.value = typeof e == "boolean" ? null : e ?? null;
1078
1099
  }, { immediate: !0 });
1079
- let U = computed(() => (w, T) => [
1080
- e.rowClassName?.(w, T) || "",
1081
- `${M}__row-marker`,
1082
- H.value != null && I.value(w) === H.value ? `${M}__row-highlight` : ""
1083
- ].join(" ")), W = computed(() => (w, T) => {
1084
- let E = e.rowProps?.(w, T);
1100
+ let B = computed(() => (x, S) => [
1101
+ e.rowClassName?.(x, S) || "",
1102
+ `${k}__row-marker`,
1103
+ z.value != null && N.value(x) === z.value ? `${k}__row-highlight` : ""
1104
+ ].join(" ")), V = computed(() => (x, S) => {
1105
+ let C = e.rowProps?.(x, S);
1085
1106
  return {
1086
- ...E,
1087
- onClick: (T) => {
1088
- let O = I.value(w);
1089
- e.highlight === !0 && (H.value = O), D("highlight", O), E?.onClick?.(T);
1107
+ ...C,
1108
+ onClick: (S) => {
1109
+ let T = N.value(x);
1110
+ e.highlight === !0 && (z.value = T), w("highlight", T), C?.onClick?.(S);
1090
1111
  }
1091
1112
  };
1092
- }), q = (w) => {
1113
+ }), W = (x) => {
1093
1114
  if (e.sorter) {
1094
- let { sortField: T, sortOrder: E } = e.sorter;
1095
- if (w?.columnKey == T && (w?.order ? w.order === E + "end" : !E)) return;
1115
+ let { sortField: S, sortOrder: C } = e.sorter;
1116
+ if (x?.columnKey == S && (x?.order ? x.order === C + "end" : !C)) return;
1096
1117
  }
1097
- D("sort", {
1098
- sortField: w?.order ? w?.columnKey : void 0,
1099
- sortOrder: w?.order ? w.order.replace("end", "") : void 0
1118
+ w("sort", {
1119
+ sortField: x?.order ? x?.columnKey : void 0,
1120
+ sortOrder: x?.order ? x.order.replace("end", "") : void 0
1100
1121
  });
1101
- }, Y = (e) => {
1102
- D("select", e);
1103
- }, Z = (e, w, T) => {
1104
- D("custom", {
1105
- key: T.key,
1122
+ }, K = (e) => {
1123
+ w("select", e);
1124
+ }, J = (e, x, S) => {
1125
+ w("custom", {
1126
+ key: S.key,
1106
1127
  width: e
1107
1128
  });
1108
1129
  };
1109
1130
  return () => createVNode(NDataTable, {
1110
- class: M,
1131
+ class: k,
1111
1132
  data: e.data,
1112
- columns: V.value,
1113
- rowKey: I.value,
1133
+ columns: R.value,
1134
+ rowKey: N.value,
1114
1135
  tableLayout: "fixed",
1115
1136
  ref: "table-ref",
1116
- scrollX: R.value,
1117
- rowClassName: U.value,
1118
- rowProps: W.value,
1137
+ scrollX: F.value,
1138
+ rowClassName: B.value,
1139
+ rowProps: V.value,
1119
1140
  checkedRowKeys: e.selectedKeys,
1120
- onUpdateSorter: q,
1121
- onUpdateCheckedRowKeys: Y,
1122
- onUnstableColumnResize: Z
1123
- }, _isSlot$2(w) ? w : { default: () => [w] });
1141
+ onUpdateSorter: W,
1142
+ onUpdateCheckedRowKeys: K,
1143
+ onUnstableColumnResize: J
1144
+ }, _isSlot$2(x) ? x : { default: () => [x] });
1124
1145
  }
1125
1146
  });
1126
1147
  var style = /* @__PURE__ */ cB("datatable", [cE("row-highlight", [c("& > td", { backgroundColor: "var(--n-tr-highlight-color, var(--n-merged-border-color)) !important" })])]);
1127
- function useDataTableDrag(e, { data: w, onSort: T,...E }) {
1128
- watch([ref(w), e], async ([e, w]) => {
1148
+ function useDataTableDrag(e, { data: x, onSort: S,...C }) {
1149
+ watch([ref(x), e], async ([e, x]) => {
1129
1150
  if (e.length === 0) return;
1130
1151
  await nextTick();
1131
- let D = unrefElement(w)?.querySelector(".n-data-table-base-table-body .n-data-table-tbody");
1132
- if (!D) return;
1133
- let O = Sortable$1.create(D, {
1152
+ let w = unrefElement(x)?.querySelector(".n-data-table-base-table-body .n-data-table-tbody");
1153
+ if (!w) return;
1154
+ let T = Sortable$1.create(w, {
1134
1155
  animation: 150,
1135
- ...E,
1156
+ ...C,
1136
1157
  onSort(e) {
1137
- T({
1158
+ S({
1138
1159
  from: e.oldIndex,
1139
1160
  to: e.newIndex
1140
1161
  });
1141
1162
  }
1142
1163
  });
1143
1164
  return () => {
1144
- O.destroy();
1165
+ T.destroy();
1145
1166
  };
1146
1167
  }, { immediate: !0 });
1147
1168
  }
@@ -1200,39 +1221,39 @@ const NRadios = /* @__PURE__ */ defineComponent({
1200
1221
  "update:modelValue": () => !0,
1201
1222
  updateModelValue: () => !0
1202
1223
  },
1203
- setup(w, { emit: T }) {
1204
- let { t: E } = useI18n(), D = computed(() => w.default === !1 ? "" : w.default === !0 ? E("common.all") : typeof w.default == "string" ? w.default : w.default?.[w.labelField] ?? E("common.all")), O = computed(() => w.type === "button-primary" ? {
1224
+ setup(x, { emit: S }) {
1225
+ let { t: C } = useI18n(), w = computed(() => x.default === !1 ? "" : x.default === !0 ? C("common.all") : typeof x.default == "string" ? x.default : x.default?.[x.labelField] ?? C("common.all")), T = computed(() => x.type === "button-primary" ? {
1205
1226
  "--n-button-color-active": "var(--color-primary)",
1206
1227
  "--n-button-text-color-active": "var(--color-base)"
1207
- } : {}), k = (e) => {
1208
- T("update:modelValue", e), T("updateModelValue", e);
1228
+ } : {}), E = (e) => {
1229
+ S("update:modelValue", e), S("updateModelValue", e);
1209
1230
  };
1210
1231
  return () => {
1211
- let e = w.type === "button" ? NRadioButton : NRadio, T = createVNode(Fragment, null, [w.default ? createVNode(e, { value: typeof w.default == "object" ? w.default?.[w.valueField] : null }, { default: () => [D.value] }) : void 0, w.options?.map((T) => {
1212
- let E = typeof T[w.labelField] == "string" ? T[w.labelField] : T[w.labelField]?.();
1232
+ let e = x.type === "button" ? NRadioButton : NRadio, S = createVNode(Fragment, null, [x.default ? createVNode(e, { value: typeof x.default == "object" ? x.default?.[x.valueField] : null }, { default: () => [w.value] }) : void 0, x.options?.map((S) => {
1233
+ let C = typeof S[x.labelField] == "string" ? S[x.labelField] : S[x.labelField]?.();
1213
1234
  return createVNode(e, {
1214
- value: T[w.valueField],
1215
- disabled: T[w.disabledField],
1216
- style: w.padding ? {
1217
- paddingLeft: w.padding,
1218
- paddingRight: w.padding
1235
+ value: S[x.valueField],
1236
+ disabled: S[x.disabledField],
1237
+ style: x.padding ? {
1238
+ paddingLeft: x.padding,
1239
+ paddingRight: x.padding
1219
1240
  } : {}
1220
- }, { default: () => [T.tip ? createVNode(NTooltip, null, {
1221
- default: () => T.tip,
1222
- trigger: () => E
1223
- }) : E] });
1241
+ }, { default: () => [S.tip ? createVNode(NTooltip, null, {
1242
+ default: () => S.tip,
1243
+ trigger: () => C
1244
+ }) : C] });
1224
1245
  })]);
1225
1246
  return createVNode(NRadioGroup, {
1226
- style: w.vertical ? {
1227
- ...O.value,
1247
+ style: x.vertical ? {
1248
+ ...T.value,
1228
1249
  padding: "6px 0 0"
1229
- } : O.value,
1230
- value: w.modelValue,
1231
- onUpdateValue: k
1232
- }, { default: () => [w.type === "radio" ? createVNode(NFlex, {
1233
- size: w.vertical ? void 0 : "small",
1234
- vertical: w.vertical
1235
- }, _isSlot$1(T) ? T : { default: () => [T] }) : T] });
1250
+ } : T.value,
1251
+ value: x.modelValue,
1252
+ onUpdateValue: E
1253
+ }, { default: () => [x.type === "radio" ? createVNode(NFlex, {
1254
+ size: x.vertical ? void 0 : "small",
1255
+ vertical: x.vertical
1256
+ }, _isSlot$1(S) ? S : { default: () => [S] }) : S] });
1236
1257
  };
1237
1258
  }
1238
1259
  });
@@ -1302,265 +1323,268 @@ const DtUserDept = /* @__PURE__ */ defineComponent({
1302
1323
  getUsersByDept: {
1303
1324
  type: Function,
1304
1325
  default: () => []
1305
- }
1326
+ },
1327
+ valueField: { type: String }
1306
1328
  },
1307
1329
  emits: ["update:modelValue", "updateModelValue"],
1308
- setup(w, { emit: T, attrs: E }) {
1309
- let { t: D } = useI18n(), O = computed(() => {
1310
- if (w.multiple) return w.modelValue || [];
1311
- let e = w.modelValue?.trim();
1330
+ setup(x, { emit: S, attrs: C }) {
1331
+ let { t: w } = useI18n(), { localeRef: T } = useLocale("Popconfirm"), E = computed(() => x.valueField || (x.type === "user" ? "username" : "code")), k = computed(() => {
1332
+ if (x.multiple) return x.modelValue || [];
1333
+ let e = x.modelValue?.trim();
1312
1334
  return e ? [e] : [];
1313
- }), k = /* @__PURE__ */ new Map(), M = computed(() => (k.clear(), w.users.map((e) => (e = reactive(e), e.label = e.nickname, e.value = e.username, e.type = "user", k.set(e.username, e), e)))), N = shallowRef([]);
1314
- watch(() => w.depts, (e) => {
1335
+ }), A = /* @__PURE__ */ new Map(), j = computed(() => (A.clear(), x.users.map((e) => (e = reactive(e), e.label = e.nickname, e.value = e[E.value], e.type = "user", A.set(e[E.value], e), e)))), M = shallowRef([]);
1336
+ watch(() => x.depts, (e) => {
1315
1337
  walkTree(e, (e) => {
1316
- e.label = e.name, e.value = e.code, e.type = "dept", e.children?.length || delete e.children;
1317
- }), N.value = flattenTree(e);
1338
+ e.label = e.name, e.value = e[E.value], e.type = "dept", e.children?.length || delete e.children;
1339
+ }), M.value = flattenTree(e);
1318
1340
  }, { immediate: !0 });
1319
- let P = computed(() => [
1320
- ...w.depts,
1321
- ...w.groups.map((e) => ({
1341
+ let R = computed(() => [
1342
+ ...x.depts,
1343
+ ...x.groups.map((e) => ({
1322
1344
  label: e.name,
1323
1345
  value: e.code,
1324
1346
  type: "group"
1325
1347
  })),
1326
- ...M.value
1327
- ]), F = ref([]), V = ref(), H = async (e) => {
1328
- let T = await (e.type === "group" ? w.getUsersByGroup(e.value) : w.getUsersByDept(e.value));
1329
- for (let e of M.value) e.disabled = !0;
1330
- V.value = [...e.type === "dept" ? e.children ?? [] : [], ...T.map((e) => {
1331
- let w = k.get(e.username);
1332
- return w && (w.disabled = !1), {
1348
+ ...j.value
1349
+ ]), z = ref([]), B = ref(), V = async (e) => {
1350
+ let S = await (e.type === "group" ? x.getUsersByGroup(e.value) : x.getUsersByDept(e.value));
1351
+ for (let e of j.value) e.disabled = !0;
1352
+ B.value = [...e.type === "dept" ? e.children ?? [] : [], ...S.map((e) => {
1353
+ let x = A.get(e[E.value]);
1354
+ return x && (x.disabled = !1), {
1333
1355
  ...e,
1334
1356
  label: e.nickname,
1335
- value: e.username,
1357
+ value: e[E.value],
1336
1358
  type: "user"
1337
1359
  };
1338
1360
  })];
1339
- }, U = /* @__PURE__ */ new WeakMap(), W = (e, T, E) => {
1340
- let O;
1341
- if (w.type === "dept") return createVNode(NTree, {
1342
- data: w.depts,
1361
+ }, H = /* @__PURE__ */ new WeakMap(), W = (e, S, C) => {
1362
+ let T;
1363
+ if (x.type === "dept") return createVNode(NTree, {
1364
+ data: x.depts,
1343
1365
  keyField: "value",
1344
1366
  labelField: "name",
1345
- defaultExpandAll: w.defaultExpandAll,
1346
- checkable: w.multiple,
1347
- selectable: !w.multiple,
1367
+ defaultExpandAll: x.defaultExpandAll,
1368
+ checkable: x.multiple,
1369
+ selectable: !x.multiple,
1348
1370
  multiple: !1,
1349
1371
  blockLine: !0,
1350
1372
  checkOnClick: !0,
1351
- pattern: E,
1352
- filter: (e, w) => w.label.includes(e) || w.value.includes(e),
1353
- checkedKeys: w.multiple ? e : void 0,
1354
- selectedKeys: w.multiple ? void 0 : e,
1373
+ pattern: C,
1374
+ filter: (e, x) => x.label.includes(e) || x.value.includes(e),
1375
+ checkedKeys: x.multiple ? e : void 0,
1376
+ selectedKeys: x.multiple ? void 0 : e,
1355
1377
  onUpdateCheckedKeys: (e) => {
1356
- w.max && e?.length > w.max || T(e);
1378
+ x.max && e?.length > x.max || S(e);
1357
1379
  },
1358
1380
  onUpdateSelectedKeys: (e) => {
1359
- T(e);
1381
+ S(e);
1360
1382
  }
1361
1383
  }, null);
1362
- let k = e ? U.get(e) : /* @__PURE__ */ new Set();
1363
- if (e && !k && (k = new Set(e), U.set(e, k)), V.value === !1) return createVNode(NSpin, { show: !0 }, null);
1364
- let j = V.value || P.value;
1365
- E = E?.trim(), E && (j = j?.filter((e) => e.label.includes(E) || e.value.includes(E)));
1366
- let N = F.value;
1367
- return createVNode(Fragment, null, [createVNode("div", { style: "margin: 12px 16px; display: flex; justify-content: space-between; align-items: center" }, [N.length > 0 ? createVNode(Fragment, null, [createVNode("span", { style: "display: flex; align-items: center" }, [
1368
- N.length >= 2 ? N.at(-2).label : D("common.all"),
1384
+ let E = e ? H.get(e) : /* @__PURE__ */ new Set();
1385
+ if (e && !E && (E = new Set(e), H.set(e, E)), B.value === !1) return createVNode(NSpin, { show: !0 }, null);
1386
+ let O = B.value || R.value;
1387
+ C = C?.trim(), C && (O = O?.filter((e) => e.label.includes(C) || e.value.includes(C)));
1388
+ let k = z.value;
1389
+ return createVNode(Fragment, null, [createVNode("div", { style: "margin: 12px 16px; display: flex; justify-content: space-between; align-items: center" }, [k.length > 0 ? createVNode(Fragment, null, [createVNode("span", { style: "display: flex; align-items: center" }, [
1390
+ k.length >= 2 ? k.at(-2).label : w("common.all"),
1369
1391
  createVNode("span", { style: "padding: 0 4px" }, [createVNode(IRight, null, null)]),
1370
- N.at(-1).label
1392
+ k.at(-1).label
1371
1393
  ]), createVNode(NButton, {
1372
1394
  text: !0,
1373
1395
  type: "warning",
1374
1396
  onClick: () => {
1375
- if (N.pop(), V.value = N.length > 0 ? !1 : void 0, N.length > 0) H(N.at(-1));
1376
- else for (let e of M.value) e.disabled = !1;
1397
+ if (k.pop(), B.value = k.length > 0 ? !1 : void 0, k.length > 0) V(k.at(-1));
1398
+ else for (let e of j.value) e.disabled = !1;
1377
1399
  }
1378
- }, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(ILeft, null, null)] }), D("common.back")] })]) : createVNode("span", null, [D("common.all")])]), j?.length ? createVNode(NList, {
1400
+ }, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(ILeft, null, null)] }), w("common.back")] })]) : createVNode("span", null, [w("common.all")])]), O?.length ? createVNode(NList, {
1379
1401
  showDivider: !1,
1380
1402
  style: "padding: 0 16px"
1381
- }, _isSlot(O = j.map((E) => {
1382
- let D, O;
1403
+ }, _isSlot(T = O.map((C) => {
1404
+ let w, T;
1383
1405
  return createVNode(NListItem, {
1384
- key: E.type + "_" + E.value,
1406
+ key: C.type + "_" + C.value,
1385
1407
  style: "padding: 6px 0"
1386
- }, { default: () => [E.type === "user" ? w.multiple ? createVNode(NCheckbox, {
1387
- checked: k.has(E.value) || !1,
1388
- onUpdateChecked: (D) => {
1389
- if (D && w.max && e.length >= w.max) return;
1390
- let O = [...e || []];
1391
- if (D) O.push(E.value);
1408
+ }, { default: () => [C.type === "user" ? x.multiple ? createVNode(NCheckbox, {
1409
+ checked: E.has(C.value) || !1,
1410
+ onUpdateChecked: (w) => {
1411
+ if (w && x.max && e.length >= x.max) return;
1412
+ let T = [...e || []];
1413
+ if (w) T.push(C.value);
1392
1414
  else {
1393
- let e = O.indexOf(E.value);
1394
- O.splice(e, 1);
1415
+ let e = T.indexOf(C.value);
1416
+ T.splice(e, 1);
1395
1417
  }
1396
- T(O);
1418
+ S(T);
1397
1419
  },
1398
1420
  style: "margin-left: 3px"
1399
- }, _isSlot(D = renderUsers([E], {
1421
+ }, _isSlot(w = renderUsers([C], {
1400
1422
  max: 1,
1401
1423
  size: 24,
1402
1424
  placement: "right"
1403
- })) ? D : { default: () => [D] }) : createVNode(NRadio, {
1404
- checked: k.has(E.value) || !1,
1425
+ })) ? w : { default: () => [w] }) : createVNode(NRadio, {
1426
+ checked: E.has(C.value) || !1,
1405
1427
  onUpdateChecked: (e) => {
1406
- T(e ? [E.value] : []);
1428
+ S(e ? [C.value] : []);
1407
1429
  },
1408
1430
  style: "margin-left: 3px"
1409
- }, _isSlot(O = renderUsers([E], {
1431
+ }, _isSlot(T = renderUsers([C], {
1410
1432
  max: 1,
1411
1433
  size: 24,
1412
1434
  placement: "right"
1413
- })) ? O : { default: () => [O] }) : createVNode("div", {
1435
+ })) ? T : { default: () => [T] }) : createVNode("div", {
1414
1436
  onClick: () => {
1415
- V.value = !1, F.value.push(E), H(E);
1437
+ B.value = !1, z.value.push(C), V(C);
1416
1438
  },
1417
1439
  style: "cursor: pointer; display: flex; align-items: center; gap: 8px"
1418
1440
  }, [
1419
- E.type === "dept" ? createVNode(NAvatar, {
1441
+ C.type === "dept" ? createVNode(NAvatar, {
1420
1442
  size: 24,
1421
1443
  style: "background-color: red"
1422
1444
  }, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(IDept, null, null)] })] }) : createVNode(NAvatar, {
1423
1445
  size: 24,
1424
1446
  style: "background-color: green"
1425
1447
  }, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(IGroup, null, null)] })] }),
1426
- createVNode("span", { style: "flex: 1 1 auto" }, [E.label]),
1448
+ createVNode("span", { style: "flex: 1 1 auto" }, [C.label]),
1427
1449
  createVNode(NIcon, null, { default: () => [createVNode(IRight, null, null)] })
1428
1450
  ])] });
1429
- })) ? O : { default: () => [O] }) : createVNode(NEmpty, null, null)]);
1430
- }, G = () => createVNode(NEmpty, { description: w.placeholder }, null), q = (e, T, E, D, O) => createVNode(NTransfer, mergeProps(e, {
1431
- key: w.type,
1432
- options: T,
1433
- renderSourceList: ({ onCheck: e, pattern: w }) => W(E, e, w),
1434
- renderTargetList: w.placeholder?.trim() && !w.modelValue?.length ? G : void 0,
1435
- sourceFilterable: w.filterable,
1436
- size: w.size,
1437
- disabled: w.disabled || void 0,
1438
- value: E,
1439
- filter: (e, w) => w.label.includes(e) || w.value.includes(e),
1451
+ })) ? T : { default: () => [T] }) : createVNode(NEmpty, null, null)]);
1452
+ }, G = () => createVNode(NEmpty, { description: x.placeholder }, null), K = (e, S, C, w, T) => createVNode(NTransfer, mergeProps(e, {
1453
+ key: x.type,
1454
+ options: S,
1455
+ renderSourceList: ({ onCheck: e, pattern: x }) => W(C, e, x),
1456
+ renderTargetList: x.placeholder?.trim() && !x.modelValue?.length ? G : void 0,
1457
+ sourceFilterable: x.filterable,
1458
+ size: x.size,
1459
+ disabled: x.disabled || void 0,
1460
+ value: C,
1461
+ filter: (e, x) => x.label.includes(e) || x.value.includes(e),
1440
1462
  "onUpdate:value": (e) => {
1441
- D?.(e);
1463
+ w?.(e);
1442
1464
  },
1443
1465
  onUpdateValue: (e) => {
1444
- O?.(e);
1466
+ T?.(e);
1445
1467
  }
1446
- }), null), J = ({ option: e, handleClose: T }) => createVNode(NTag, {
1447
- type: w.type === "user" ? "primary" : "info",
1468
+ }), null), q = ({ option: e, handleClose: S }) => createVNode(NTag, {
1469
+ type: x.type === "user" ? "primary" : "info",
1448
1470
  closable: !0,
1449
1471
  onMousedown: (e) => e.preventDefault(),
1450
1472
  onClose: (e) => {
1451
- e.stopPropagation(), T();
1473
+ e.stopPropagation(), S();
1452
1474
  }
1453
- }, { default: () => [e.label] }), Y = (e, E = "updateModelValue") => {
1454
- w.multiple ? T(E, e) : T(E, e?.[0]);
1455
- }, X = ref(), Z = !1, Q = () => {
1456
- if (Z) return;
1457
- Z = !0;
1458
- let e = shallowRef([...O.value || []]);
1459
- $dialog({
1475
+ }, { default: () => [e.label] }), J = (e, C = "updateModelValue") => {
1476
+ x.multiple ? S(C, e) : S(C, e?.[0]);
1477
+ }, Y = ref(), X = !1, Z = useDialog(), Q = () => {
1478
+ if (X) return;
1479
+ X = !0;
1480
+ let e = shallowRef([...k.value || []]);
1481
+ Z.create({
1460
1482
  showIcon: !1,
1461
- title: w.placeholder,
1483
+ title: x.placeholder,
1462
1484
  style: { width: "700px" },
1463
- content: () => createVNode("div", { style: { height: "550px" } }, [q({ style: { height: "100%" } }, w.type === "user" ? M.value : N.value, e.value, (w) => e.value = w)]),
1464
- onOk() {
1465
- Y(e.value, "update:modelValue"), Y(e.value, "updateModelValue");
1485
+ content: () => createVNode("div", { style: { height: "550px" } }, [K({ style: { height: "100%" } }, x.type === "user" ? j.value : M.value, e.value, (x) => e.value = x)]),
1486
+ positiveText: T.value.positiveText,
1487
+ negativeText: T.value.negativeText,
1488
+ onPositiveClick() {
1489
+ J(e.value, "update:modelValue"), J(e.value, "updateModelValue");
1466
1490
  },
1467
1491
  onAfterLeave() {
1468
1492
  nextTick(() => {
1469
- X.value?.blur(), Z = !1;
1493
+ Y.value?.blur(), X = !1;
1470
1494
  });
1471
1495
  }
1472
1496
  });
1473
- }, $ = { arrow: () => createVNode(NIcon, null, { default: () => [w.type === "user" ? createVNode(IGroup, null, null) : createVNode(IDept, null, null)] }) };
1497
+ }, $ = { arrow: () => createVNode(NIcon, null, { default: () => [x.type === "user" ? createVNode(IGroup, null, null) : createVNode(IDept, null, null)] }) };
1474
1498
  return () => {
1475
- let e = w.type === "user" ? M.value : N.value;
1476
- if (w.selectType === "dropdown" && w.type === "dept") return createVNode(NTreeSelect, {
1499
+ let e = x.type === "user" ? j.value : M.value;
1500
+ if (x.selectType === "dropdown" && x.type === "dept") return createVNode(NTreeSelect, {
1477
1501
  options: e,
1478
1502
  keyField: "value",
1479
- defaultExpandAll: w.defaultExpandAll,
1480
- checkable: w.multiple,
1481
- multiple: w.multiple,
1482
- filter: (e, w) => w.label.includes(e) || w.value.includes(e),
1483
- value: w.modelValue,
1503
+ defaultExpandAll: x.defaultExpandAll,
1504
+ checkable: x.multiple,
1505
+ multiple: x.multiple,
1506
+ filter: (e, x) => x.label.includes(e) || x.value.includes(e),
1507
+ value: x.modelValue,
1484
1508
  onUpdateValue: (e) => {
1485
- w.multiple && w.max && e?.length > w.max || T("updateModelValue", e);
1509
+ x.multiple && x.max && e?.length > x.max || S("updateModelValue", e);
1486
1510
  },
1487
1511
  "onUpdate:value": (e) => {
1488
- w.multiple && w.max && e?.length > w.max || T("update:modelValue", e);
1512
+ x.multiple && x.max && e?.length > x.max || S("update:modelValue", e);
1489
1513
  }
1490
1514
  }, _isSlot($) ? $ : { default: () => [$] });
1491
- if (w.selectType === "transfer") return q(E, e, O.value, (e) => Y(e, "update:modelValue"), (e) => Y(e, "updateModelValue"));
1492
- let D = w.selectType === "dropdown";
1493
- return createVNode(NSelect, mergeProps(E, {
1494
- key: w.type,
1495
- ref: X,
1496
- show: D ? void 0 : !1,
1497
- filterable: D ? w.filterable : !1,
1515
+ if (x.selectType === "transfer") return K(C, e, k.value, (e) => J(e, "update:modelValue"), (e) => J(e, "updateModelValue"));
1516
+ let w = x.selectType === "dropdown";
1517
+ return createVNode(NSelect, mergeProps(C, {
1518
+ key: x.type,
1519
+ ref: Y,
1520
+ show: w ? void 0 : !1,
1521
+ filterable: w ? x.filterable : !1,
1498
1522
  options: e,
1499
- multiple: w.multiple,
1500
- size: w.size,
1501
- placeholder: w.placeholder,
1502
- disabled: w.disabled || void 0,
1503
- value: w.modelValue,
1504
- renderTag: w.multiple ? J : void 0,
1505
- onFocus: D ? void 0 : Q,
1523
+ multiple: x.multiple,
1524
+ size: x.size,
1525
+ placeholder: x.placeholder,
1526
+ disabled: x.disabled || void 0,
1527
+ value: x.modelValue,
1528
+ renderTag: x.multiple ? q : void 0,
1529
+ onFocus: w ? void 0 : Q,
1506
1530
  onUpdateValue: (e) => {
1507
- T("updateModelValue", e);
1531
+ S("updateModelValue", e);
1508
1532
  },
1509
1533
  "onUpdate:value": (e) => {
1510
- T("update:modelValue", e);
1534
+ S("update:modelValue", e);
1511
1535
  }
1512
1536
  }), _isSlot($) ? $ : { default: () => [$] });
1513
1537
  };
1514
1538
  }
1515
1539
  });
1516
- function renderUser(e, w, { placement: T, size: E }) {
1517
- let D = e.nickname.split(" ").at(-1), O = D;
1518
- return /^[\u4E00-\u9FA5]+$/.test(D) ? O = D.length >= 3 ? D.slice(-2) : D : D.length > 4 && (O = createVNode(NIcon, null, { default: () => [createVNode(IAccount, null, null)] })), createVNode(NPopover, {
1540
+ function renderUser(e, x, { placement: S, size: C }) {
1541
+ let w = e.nickname.split(" ").at(-1), T = w;
1542
+ return /^[\u4E00-\u9FA5]+$/.test(w) ? T = w.length >= 3 ? w.slice(-2) : w : w.length > 4 && (T = createVNode(NIcon, null, { default: () => [createVNode(IAccount, null, null)] })), createVNode(NPopover, {
1519
1543
  key: e.username,
1520
1544
  raw: !0,
1521
- placement: T
1545
+ placement: S
1522
1546
  }, {
1523
1547
  default: () => createVNode(NCard, {
1524
1548
  style: "width: 200px",
1525
1549
  size: "small"
1526
1550
  }, { default: () => [createVNode(NH4, null, { default: () => [e.nickname] }), createVNode("span", null, [e.username])] }),
1527
1551
  trigger: () => {
1528
- let T = createVNode(NAvatar, {
1552
+ let S = createVNode(NAvatar, {
1529
1553
  color: "var(--color-primary)",
1530
1554
  round: !0,
1531
- size: E,
1532
- style: w ? {
1555
+ size: C,
1556
+ style: x ? {
1533
1557
  position: "absolute",
1534
- bottom: -(E - 20) / 2 + "px"
1558
+ bottom: -(C - 20) / 2 + "px"
1535
1559
  } : ""
1536
- }, _isSlot(O) ? O : { default: () => [O] });
1537
- return w ? createVNode("div", { style: w ? {
1560
+ }, _isSlot(T) ? T : { default: () => [T] });
1561
+ return x ? createVNode("div", { style: x ? {
1538
1562
  display: "inline-block",
1539
- minWidth: E + "px",
1540
- height: E + "px"
1541
- } : "" }, [T, w ? createVNode("span", { style: { marginLeft: E + 6 + "px" } }, [e.nickname]) : void 0]) : T;
1563
+ minWidth: C + "px",
1564
+ height: C + "px"
1565
+ } : "" }, [S, x ? createVNode("span", { style: { marginLeft: C + 6 + "px" } }, [e.nickname]) : void 0]) : S;
1542
1566
  }
1543
1567
  });
1544
1568
  }
1545
- function renderUsers(e, w = {}) {
1546
- w.size ||= 24, w.max ||= 4;
1547
- let { max: T, size: E } = w;
1548
- return e.length <= 1 ? createVNode("span", { style: "position: relative" }, [e.map((e) => renderUser(e, !0, w))]) : createVNode("span", { style: {
1569
+ function renderUsers(e, x = {}) {
1570
+ x.size ||= 24, x.max ||= 4;
1571
+ let { max: S, size: C } = x;
1572
+ return e.length <= 1 ? createVNode("span", { style: "position: relative" }, [e.map((e) => renderUser(e, !0, x))]) : createVNode("span", { style: {
1549
1573
  display: "inline-block",
1550
- height: E + "px"
1574
+ height: C + "px"
1551
1575
  } }, [createVNode(NAvatarGroup, {
1552
1576
  options: e,
1553
- size: E,
1554
- max: T || 4,
1577
+ size: C,
1578
+ max: S || 4,
1555
1579
  style: "top: -2px"
1556
1580
  }, {
1557
- avatar: ({ option: e }) => renderUser(e, !1, w),
1558
- rest: ({ options: e, rest: w }) => createVNode(NDropdown, {
1581
+ avatar: ({ option: e }) => renderUser(e, !1, x),
1582
+ rest: ({ options: e, rest: x }) => createVNode(NDropdown, {
1559
1583
  options: e,
1560
1584
  keyField: "username",
1561
1585
  labelField: "nickname",
1562
- renderOption: ({ option: w }) => renderUser(w, !1, e)
1563
- }, { default: () => [createVNode(NAvatar, null, { default: () => [createTextVNode("+"), w] })] })
1586
+ renderOption: ({ option: x }) => renderUser(x, !1, e)
1587
+ }, { default: () => [createVNode(NAvatar, null, { default: () => [createTextVNode("+"), x] })] })
1564
1588
  })]);
1565
1589
  }
1566
1590
  const DtDeptRender = /* @__PURE__ */ defineComponent({
@@ -1571,18 +1595,18 @@ const DtDeptRender = /* @__PURE__ */ defineComponent({
1571
1595
  getDeptsByCode: Function
1572
1596
  },
1573
1597
  setup(e) {
1574
- let w = ref([]), T = {};
1575
- return watch([() => e.modelValue, () => e.multiple], ([E, D]) => {
1576
- w.value = [];
1577
- let O = E ? D ? Array.isArray(E) ? E : E.trim() ? E.trim().split(",") : [] : [E] : [], k = [];
1578
- for (let [e, E] of O.entries()) T[E] || (T[E] = reactive({
1579
- code: E,
1580
- name: E
1581
- }), k.push(E)), w.value[e] = T[E];
1582
- k.length > 0 && e.getDeptsByCode(k).then((e) => {
1583
- for (let w of e) Object.assign(T[w.code], w);
1598
+ let x = ref([]), S = {};
1599
+ return watch([() => e.modelValue, () => e.multiple], ([C, w]) => {
1600
+ x.value = [];
1601
+ let T = C ? w ? Array.isArray(C) ? C : C.trim() ? C.trim().split(",") : [] : [C] : [], E = [];
1602
+ for (let [e, C] of T.entries()) S[C] || (S[C] = reactive({
1603
+ code: C,
1604
+ name: C
1605
+ }), E.push(C)), x.value[e] = S[C];
1606
+ E.length > 0 && e.getDeptsByCode(E).then((e) => {
1607
+ for (let x of e) Object.assign(S[x.code], x);
1584
1608
  });
1585
- }, { immediate: !0 }), () => w.value.map((e) => createVNode(NTag, { key: e.code }, { default: () => [e.name] }));
1609
+ }, { immediate: !0 }), () => x.value.map((e) => createVNode(NTag, { key: e.code }, { default: () => [e.name] }));
1586
1610
  }
1587
1611
  }), DtUserRender = /* @__PURE__ */ defineComponent({
1588
1612
  name: "UserRender",
@@ -1595,18 +1619,18 @@ const DtDeptRender = /* @__PURE__ */ defineComponent({
1595
1619
  getUsersByUsername: Function
1596
1620
  },
1597
1621
  setup(e) {
1598
- let w = ref([]), T = {};
1599
- return watch([() => e.modelValue, () => e.multiple], ([E, D]) => {
1600
- w.value = [];
1601
- let O = E ? D ? Array.isArray(E) ? E : E.trim() ? E.trim().split(",") : [] : [E] : [], k = [];
1602
- for (let [e, E] of O.entries()) T[E] || (T[E] = reactive({
1603
- code: E,
1604
- name: E
1605
- }), k.push(E)), w.value[e] = T[E];
1606
- k.length > 0 && e.getUsersByUsername(k).then((e) => {
1607
- for (let w of e) Object.assign(T[w.code], w);
1622
+ let x = ref([]), S = {};
1623
+ return watch([() => e.modelValue, () => e.multiple], ([C, w]) => {
1624
+ x.value = [];
1625
+ let T = C ? w ? Array.isArray(C) ? C : C.trim() ? C.trim().split(",") : [] : [C] : [], E = [];
1626
+ for (let [e, C] of T.entries()) S[C] || (S[C] = reactive({
1627
+ code: C,
1628
+ name: C
1629
+ }), E.push(C)), x.value[e] = S[C];
1630
+ E.length > 0 && e.getUsersByUsername(E).then((e) => {
1631
+ for (let x of e) Object.assign(S[x.code], x);
1608
1632
  });
1609
- }, { immediate: !0 }), () => renderUsers(w.value, e);
1633
+ }, { immediate: !0 }), () => renderUsers(x.value, e);
1610
1634
  }
1611
1635
  });
1612
1636
  export { NRadios as a, DataSelection as c, useLocaleEdit as d, DataFilter as f, NCheckboxes as g, DataActions as h, renderUsers as i, DataPagination as l, DataCustom as m, DtUserDept as n, DataTable as o, DataForm as p, DtUserRender as r, useDataTableDrag as s, DtDeptRender as t, DataLocaleInput as u };