@ithinkdt/ui 4.0.0-600 → 4.0.0-700
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{components-BMKQsJ4d.js → components-Yo5FKzwp.js} +671 -635
- package/dist/components.js +1 -4
- package/dist/directives-RPqFovTo.js +237 -0
- package/dist/directives.js +1 -2
- package/dist/index.js +2 -3
- package/dist/page.js +320 -321
- package/esm/components.d.ts +3 -0
- package/esm/directives.d.ts +6 -0
- package/package.json +5 -5
- package/dist/directives-CB8tcZsk.js +0 -203
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { n as useI18n } from "./use-i18n-D-AJ8KbA.js";
|
|
2
|
-
import { g as useStyle, h as useMergedClsPrefix, n as cB, r as cE, t as c } from "./use-style-DrH-89qR.js";
|
|
3
|
-
import { i as vTooltip } from "./directives-
|
|
4
|
-
import { Fragment, computed, createTextVNode, createVNode, defineComponent, h, inject, isVNode, mergeProps, nextTick, reactive, ref, shallowRef, toRaw, toRef, toValue, unref, useTemplateRef, watch, withDirectives } from "vue";
|
|
2
|
+
import { g as useStyle, h as useMergedClsPrefix, i as cM, n as cB, r as cE, t as c } from "./use-style-DrH-89qR.js";
|
|
3
|
+
import { i as vTooltip } from "./directives-RPqFovTo.js";
|
|
4
|
+
import { Fragment, computed, createTextVNode, createVNode, defineComponent, h, inject, isVNode, markRaw, 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 { NAnchor, NAnchorLink, NAvatar, NAvatarGroup, NButton, NCard, NCheckbox, NCheckboxGroup, NDataTable, NDropdown, NEllipsis, NEmpty, NFlex, NForm, NFormItem, NGi, NGrid, NH4, NIcon, NInput, NList, NListItem, NPagination,
|
|
6
|
+
import { NAnchor, NAnchorLink, NAvatar, NAvatarGroup, NButton, NCard, NCheckbox, NCheckboxGroup, NDataTable, NDropdown, NEllipsis, NEmpty, NFlex, NForm, NFormItem, NGi, NGrid, NH4, NIcon, NInput, NList, NListItem, NPagination, NPopover, NRadio, NRadioButton, NRadioGroup, NSelect, NSpin, NTag, NText, NTooltip, NTransfer, NTree, NTreeSelect, dataTableProps, formProps, useDialog } from "ithinkdt-ui";
|
|
7
7
|
import { nanoid } from "nanoid";
|
|
8
8
|
import { VOverflow, VResizeObserver } from "vueuc";
|
|
9
9
|
import { Sortable } from "sortablejs/modular/sortable.core.esm.js";
|
|
@@ -67,37 +67,37 @@ const NCheckboxes = /* @__PURE__ */ defineComponent({
|
|
|
67
67
|
"update:modelValue": () => !0,
|
|
68
68
|
updateModelValue: () => !0
|
|
69
69
|
},
|
|
70
|
-
setup(
|
|
71
|
-
let { t:
|
|
72
|
-
watch(() =>
|
|
73
|
-
let
|
|
74
|
-
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
},
|
|
70
|
+
setup(x, { emit: S, attrs: C }) {
|
|
71
|
+
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([]);
|
|
72
|
+
watch(() => x.modelValue, (e) => E.value = e, { immediate: !0 });
|
|
73
|
+
let D = (e) => {
|
|
74
|
+
S("update:modelValue", e), S("updateModelValue", e);
|
|
75
|
+
}, O = () => {
|
|
76
|
+
D(E.value?.length === x.options.length ? [] : x.options.map((e) => e[x.valueField]));
|
|
77
|
+
}, A = computed(() => x.options.length > E.value?.length && E.value?.length > 0), j = computed(() => ({ "--n-label-padding": x.labelPadding }));
|
|
78
78
|
return () => {
|
|
79
|
-
let e = createVNode(NCheckboxGroup, mergeProps(
|
|
80
|
-
value:
|
|
81
|
-
onUpdateValue:
|
|
79
|
+
let e = createVNode(NCheckboxGroup, mergeProps(C, {
|
|
80
|
+
value: E.value,
|
|
81
|
+
onUpdateValue: D
|
|
82
82
|
}), { default: () => [createVNode(NFlex, {
|
|
83
|
-
size:
|
|
84
|
-
vertical:
|
|
85
|
-
style: !
|
|
86
|
-
}, { default: () => [
|
|
87
|
-
value: e[
|
|
88
|
-
disabled: e[
|
|
89
|
-
style:
|
|
90
|
-
}, { default: () => [e[
|
|
91
|
-
return
|
|
92
|
-
size:
|
|
93
|
-
vertical:
|
|
94
|
-
style:
|
|
83
|
+
size: x.gap ?? (x.vertical ? void 0 : "small"),
|
|
84
|
+
vertical: x.vertical,
|
|
85
|
+
style: !x.default && x.vertical ? { padding: "6px 0 0" } : {}
|
|
86
|
+
}, { default: () => [x.options?.map((e) => createVNode(NCheckbox, {
|
|
87
|
+
value: e[x.valueField],
|
|
88
|
+
disabled: e[x.disabledField],
|
|
89
|
+
style: j.value
|
|
90
|
+
}, { default: () => [e[x.labelField]] }))] })] });
|
|
91
|
+
return x.default ? createVNode(NFlex, {
|
|
92
|
+
size: x.gap ?? (x.vertical ? void 0 : "small"),
|
|
93
|
+
vertical: x.vertical,
|
|
94
|
+
style: x.vertical ? { padding: "6px 0 0" } : {}
|
|
95
95
|
}, { default: () => [createVNode("span", null, [createVNode(NCheckbox, {
|
|
96
|
-
indeterminate:
|
|
97
|
-
checked:
|
|
98
|
-
onUpdateChecked:
|
|
99
|
-
style:
|
|
100
|
-
}, { default: () => [
|
|
96
|
+
indeterminate: A.value,
|
|
97
|
+
checked: E.value?.length > 0,
|
|
98
|
+
onUpdateChecked: O,
|
|
99
|
+
style: j.value
|
|
100
|
+
}, { default: () => [T.value] })]), e] }) : e;
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
103
|
}), IHelp = (e) => createVNode("svg", mergeProps({
|
|
@@ -289,16 +289,16 @@ const NCheckboxes = /* @__PURE__ */ defineComponent({
|
|
|
289
289
|
default: () => []
|
|
290
290
|
} },
|
|
291
291
|
setup(e) {
|
|
292
|
-
let
|
|
293
|
-
|
|
294
|
-
},
|
|
295
|
-
|
|
296
|
-
},
|
|
297
|
-
e || (
|
|
298
|
-
},
|
|
292
|
+
let x = ref(), S = !0, C = () => {
|
|
293
|
+
S ? S = !1 : x.value?.sync({ showAllItemsBeforeCalculate: !0 });
|
|
294
|
+
}, w = ref(), T = () => w.value, E = ref(-1), D = (x) => {
|
|
295
|
+
E.value = e.options.length - x;
|
|
296
|
+
}, O = (e) => {
|
|
297
|
+
e || (E.value = -1);
|
|
298
|
+
}, A = () => {}, j = computed(() => E.value === -1 ? [] : e.options.slice(E.value).map((e) => ({
|
|
299
299
|
...e,
|
|
300
300
|
key: e.text
|
|
301
|
-
}))),
|
|
301
|
+
}))), M = (e) => createVNode(NButton, {
|
|
302
302
|
type: e.color === "danger" ? "error" : [
|
|
303
303
|
"default",
|
|
304
304
|
"tertiary",
|
|
@@ -309,15 +309,15 @@ const NCheckboxes = /* @__PURE__ */ defineComponent({
|
|
|
309
309
|
"error"
|
|
310
310
|
].includes(e.color) ? e.color : "primary",
|
|
311
311
|
text: !0
|
|
312
|
-
}, { default: () => [e.text] }),
|
|
313
|
-
|
|
312
|
+
}, { default: () => [e.text] }), N = (e, x) => {
|
|
313
|
+
x.onClick?.();
|
|
314
314
|
};
|
|
315
|
-
return () => createVNode(VResizeObserver, { onResize:
|
|
316
|
-
ref:
|
|
317
|
-
getCounter:
|
|
318
|
-
onUpdateCount:
|
|
319
|
-
onUpdateOverflow:
|
|
320
|
-
updateCounter:
|
|
315
|
+
return () => createVNode(VResizeObserver, { onResize: C }, { default: () => [createVNode(VOverflow, {
|
|
316
|
+
ref: x,
|
|
317
|
+
getCounter: T,
|
|
318
|
+
onUpdateCount: D,
|
|
319
|
+
onUpdateOverflow: O,
|
|
320
|
+
updateCounter: A,
|
|
321
321
|
style: "margin-top: 2px"
|
|
322
322
|
}, {
|
|
323
323
|
default: () => e.options.map((e) => createVNode(NButton, {
|
|
@@ -335,12 +335,12 @@ const NCheckboxes = /* @__PURE__ */ defineComponent({
|
|
|
335
335
|
onClick: e.onClick
|
|
336
336
|
}, { default: () => [e.text] })),
|
|
337
337
|
counter: () => createVNode("span", {
|
|
338
|
-
ref:
|
|
338
|
+
ref: w,
|
|
339
339
|
style: "position: absolute"
|
|
340
340
|
}, [createVNode(NDropdown, {
|
|
341
|
-
options:
|
|
342
|
-
renderLabel:
|
|
343
|
-
onSelect:
|
|
341
|
+
options: j.value,
|
|
342
|
+
renderLabel: M,
|
|
343
|
+
onSelect: N
|
|
344
344
|
}, { default: () => [createVNode(NButton, {
|
|
345
345
|
quaternary: !0,
|
|
346
346
|
size: "small"
|
|
@@ -361,9 +361,9 @@ var DataCustomItem = /* @__PURE__ */ defineComponent({
|
|
|
361
361
|
fixed: [Boolean, String]
|
|
362
362
|
},
|
|
363
363
|
emits: ["update-hidden", "update-fixed"],
|
|
364
|
-
setup(e, { emit:
|
|
364
|
+
setup(e, { emit: x }) {
|
|
365
365
|
return () => {
|
|
366
|
-
let
|
|
366
|
+
let S;
|
|
367
367
|
return createVNode(NFlex, {
|
|
368
368
|
align: "center",
|
|
369
369
|
wrap: !1,
|
|
@@ -377,17 +377,17 @@ var DataCustomItem = /* @__PURE__ */ defineComponent({
|
|
|
377
377
|
createVNode(NCheckbox, {
|
|
378
378
|
checked: !e.hidden,
|
|
379
379
|
disabled: e.disabled,
|
|
380
|
-
onUpdateChecked: (e) =>
|
|
380
|
+
onUpdateChecked: (e) => x("update-hidden", !e)
|
|
381
381
|
}, null),
|
|
382
|
-
createVNode(NEllipsis, { style: "flex: 1 1 auto" }, _isSlot$7(
|
|
382
|
+
createVNode(NEllipsis, { style: "flex: 1 1 auto" }, _isSlot$7(S = toValue(e.label)) ? S : { default: () => [S] }),
|
|
383
383
|
e.showFixed ? [createVNode(NButton, {
|
|
384
384
|
text: !0,
|
|
385
385
|
type: e.fixed === "left" ? "primary" : void 0,
|
|
386
|
-
onClick: () =>
|
|
386
|
+
onClick: () => x("update-fixed", e.fixed === "left" ? !1 : "left")
|
|
387
387
|
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(ILeft2, null, null)] })] }), createVNode(NButton, {
|
|
388
388
|
text: !0,
|
|
389
389
|
type: e.fixed === "right" ? "primary" : void 0,
|
|
390
|
-
onClick: () =>
|
|
390
|
+
onClick: () => x("update-fixed", e.fixed === "right" ? !1 : "right")
|
|
391
391
|
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(IRight2, null, null)] })] })] : void 0
|
|
392
392
|
] });
|
|
393
393
|
};
|
|
@@ -436,24 +436,24 @@ const DataCustom = /* @__PURE__ */ defineComponent({
|
|
|
436
436
|
type: { type: String }
|
|
437
437
|
},
|
|
438
438
|
emits: { custom: () => !0 },
|
|
439
|
-
setup(
|
|
440
|
-
let { t:
|
|
441
|
-
function
|
|
442
|
-
|
|
443
|
-
key: e[
|
|
444
|
-
[
|
|
439
|
+
setup(x, { emit: S }) {
|
|
440
|
+
let { t: C } = useI18n();
|
|
441
|
+
function w(e, C, w) {
|
|
442
|
+
S("custom", {
|
|
443
|
+
key: e[x.keyField],
|
|
444
|
+
[C]: w
|
|
445
445
|
});
|
|
446
446
|
}
|
|
447
|
-
let
|
|
448
|
-
return watch(
|
|
447
|
+
let T = ref();
|
|
448
|
+
return watch(T, (e) => {
|
|
449
449
|
e.$el && Sortable.create(e.$el, {
|
|
450
450
|
animation: 150,
|
|
451
451
|
ghostClass: "ghost",
|
|
452
452
|
handle: ".icon-drag",
|
|
453
453
|
filter: ".disabled",
|
|
454
454
|
onEnd(e) {
|
|
455
|
-
let
|
|
456
|
-
|
|
455
|
+
let C = x.data.map((e) => e[x.keyField]), [w] = C.splice(e.oldIndex, 1);
|
|
456
|
+
C.splice(e.newIndex, 0, w), S("custom", C);
|
|
457
457
|
}
|
|
458
458
|
});
|
|
459
459
|
}), () => createVNode(NPopover, {
|
|
@@ -465,27 +465,27 @@ const DataCustom = /* @__PURE__ */ defineComponent({
|
|
|
465
465
|
}, {
|
|
466
466
|
trigger: () => withDirectives(createVNode(NButton, {
|
|
467
467
|
text: !0,
|
|
468
|
-
type:
|
|
469
|
-
}, { default: () => [createVNode(NIcon, { size:
|
|
468
|
+
type: x.type
|
|
469
|
+
}, { default: () => [createVNode(NIcon, { size: x.size }, { default: () => [createVNode(ICustom, null, null)] })] }), [[vTooltip, x.tooltip ?? C("common.page.custom.tooltip")]]),
|
|
470
470
|
default: () => {
|
|
471
|
-
let e,
|
|
472
|
-
return createVNode(NFlex, { vertical: !0 }, { default: () => [createVNode(NFlex, { justify: "space-between" }, { default: () => [createVNode("div", { style: "font-weight: bold" }, [
|
|
471
|
+
let e, E;
|
|
472
|
+
return createVNode(NFlex, { vertical: !0 }, { default: () => [createVNode(NFlex, { justify: "space-between" }, { default: () => [createVNode("div", { style: "font-weight: bold" }, [x.tooltip ?? C("common.page.custom.tooltip")]), createVNode(NButton, {
|
|
473
473
|
text: !0,
|
|
474
474
|
type: "primary",
|
|
475
475
|
size: "small",
|
|
476
|
-
onClick: () =>
|
|
477
|
-
}, _isSlot$7(e =
|
|
478
|
-
ref:
|
|
476
|
+
onClick: () => S("custom", !0)
|
|
477
|
+
}, _isSlot$7(e = C("common.page.custom.reset")) ? e : { default: () => [e] })] }), createVNode(NFlex, {
|
|
478
|
+
ref: T,
|
|
479
479
|
vertical: !0
|
|
480
|
-
}, _isSlot$7(
|
|
481
|
-
key: e[
|
|
482
|
-
label: e[
|
|
483
|
-
hidden: e[
|
|
484
|
-
fixed: e[
|
|
485
|
-
showFixed:
|
|
486
|
-
onUpdateHidden: (
|
|
487
|
-
onUpdateFixed: (
|
|
488
|
-
}, null))) ?
|
|
480
|
+
}, _isSlot$7(E = x.data.filter((e) => e[x.visiblityField] !== !1).map((e) => createVNode(DataCustomItem, {
|
|
481
|
+
key: e[x.keyField],
|
|
482
|
+
label: e[x.labelField],
|
|
483
|
+
hidden: e[x.hiddenField],
|
|
484
|
+
fixed: e[x.fixedField],
|
|
485
|
+
showFixed: x.showFixed,
|
|
486
|
+
onUpdateHidden: (x) => w(e, "hidden", x),
|
|
487
|
+
onUpdateFixed: (x) => w(e, "fixed", x)
|
|
488
|
+
}, null))) ? E : { default: () => [E] })] });
|
|
489
489
|
}
|
|
490
490
|
});
|
|
491
491
|
}
|
|
@@ -493,31 +493,31 @@ const DataCustom = /* @__PURE__ */ defineComponent({
|
|
|
493
493
|
function _isSlot$6(e) {
|
|
494
494
|
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
|
|
495
495
|
}
|
|
496
|
-
function renderLabel(e,
|
|
497
|
-
return typeof e == "function" ? e(
|
|
496
|
+
function renderLabel(e, x) {
|
|
497
|
+
return typeof e == "function" ? e(x) : e;
|
|
498
498
|
}
|
|
499
|
-
function renderAnchorLink(e,
|
|
499
|
+
function renderAnchorLink(e, x) {
|
|
500
500
|
return e.isGroup ? (e.__children ??= e.children?.filter((e) => e.isGroup) ?? [], createVNode(NAnchorLink, { href: `#${e.prop}` }, {
|
|
501
|
-
title: () => renderLabel(e.label,
|
|
502
|
-
default: e.__children?.length ? () => e.__children.map((e) => renderAnchorLink(e,
|
|
501
|
+
title: () => renderLabel(e.label, x),
|
|
502
|
+
default: e.__children?.length ? () => e.__children.map((e) => renderAnchorLink(e, x)) : void 0
|
|
503
503
|
})) : null;
|
|
504
504
|
}
|
|
505
|
-
function getSpan(e,
|
|
506
|
-
return typeof e == "function" ? e(
|
|
505
|
+
function getSpan(e, x, S) {
|
|
506
|
+
return typeof e == "function" ? e(x, S) : e;
|
|
507
507
|
}
|
|
508
|
-
function renderItem(e,
|
|
508
|
+
function renderItem(e, x, S, C) {
|
|
509
509
|
return e.isGroup ? createVNode("div", {
|
|
510
510
|
key: e.prop,
|
|
511
|
-
class: `${
|
|
511
|
+
class: `${C}__group`,
|
|
512
512
|
id: e.prop
|
|
513
|
-
}, [createVNode("div", { class: `${
|
|
513
|
+
}, [createVNode("div", { class: `${C}__title` }, [renderLabel(e.label, S)]), createVNode("div", { class: `${C}__wrapper` }, [e.children?.map((e) => renderItem(e, x, S, C))])]) : createVNode("div", {
|
|
514
514
|
key: e.prop,
|
|
515
|
-
class: `${
|
|
515
|
+
class: `${C}__item`,
|
|
516
516
|
style: {
|
|
517
|
-
"--descriptions-col-span": getSpan(e.colSpan,
|
|
518
|
-
"--descriptions-row-span": getSpan(e.rowSpan,
|
|
517
|
+
"--descriptions-col-span": getSpan(e.colSpan, x, S) ?? 1,
|
|
518
|
+
"--descriptions-row-span": getSpan(e.rowSpan, x, S) ?? 1
|
|
519
519
|
}
|
|
520
|
-
}, [e.label ? createVNode("div", { class: `${
|
|
520
|
+
}, [e.label ? createVNode("div", { class: `${C}__label` }, [renderLabel(e.label, S)]) : void 0, createVNode("div", { class: `${C}__content` }, [(S ? e.render ? e.render(S) : S[e.prop] : void 0) ?? createVNode("span", { class: `${C}__nothing` }, [createTextVNode("--")])])]);
|
|
521
521
|
}
|
|
522
522
|
const DataDescriptions = /* @__PURE__ */ defineComponent({
|
|
523
523
|
name: "DataDescriptions",
|
|
@@ -538,29 +538,29 @@ const DataDescriptions = /* @__PURE__ */ defineComponent({
|
|
|
538
538
|
}
|
|
539
539
|
},
|
|
540
540
|
setup(e) {
|
|
541
|
-
let
|
|
542
|
-
useStyle("-data-descriptions", style$1,
|
|
543
|
-
let
|
|
541
|
+
let C = useMergedClsPrefix(), w = `${C.value}-data-descriptions`;
|
|
542
|
+
useStyle("-data-descriptions", style$1, C);
|
|
543
|
+
let T = ref();
|
|
544
544
|
watch(() => e.items, () => {
|
|
545
|
-
location.hash && until(
|
|
545
|
+
location.hash && until(T).toBeTruthy().then((e) => {
|
|
546
546
|
e.scrollTo(location.hash);
|
|
547
547
|
});
|
|
548
548
|
}, { immediate: !0 });
|
|
549
|
-
let
|
|
550
|
-
ref:
|
|
551
|
-
class: `${
|
|
549
|
+
let E = computed(() => ({ "--descriptions-cols": e.cols })), D = computed(() => mergeProps({
|
|
550
|
+
ref: T,
|
|
551
|
+
class: `${w}__anchor`,
|
|
552
552
|
showBackground: !1,
|
|
553
553
|
affix: !0
|
|
554
554
|
}, e.anchor && typeof e.anchor == "object" ? e.anchor : {}));
|
|
555
555
|
return () => {
|
|
556
|
-
let
|
|
556
|
+
let x, { cols: S, title: C, data: T, items: O, anchor: k } = e, A = isNullish(C) ? void 0 : createVNode("div", { class: `${w}__header` }, [typeof C == "string" ? createVNode("span", null, [C]) : C(T ?? void 0)]), j = O.filter((e) => !e.hiddden).map((e) => renderItem(e, S, T, w)), N = k === !1 ? void 0 : createVNode(NAnchor, D.value, _isSlot$6(x = O.map((e) => h(renderAnchorLink(e, T), { key: e.prop }))) ? x : { default: () => [x] });
|
|
557
557
|
return createVNode("div", {
|
|
558
|
-
class:
|
|
559
|
-
style:
|
|
558
|
+
class: w,
|
|
559
|
+
style: E.value
|
|
560
560
|
}, [
|
|
561
|
-
|
|
562
|
-
createVNode("div", { class: `${
|
|
563
|
-
|
|
561
|
+
A,
|
|
562
|
+
createVNode("div", { class: `${w}__wrapper` }, [j]),
|
|
563
|
+
N
|
|
564
564
|
]);
|
|
565
565
|
};
|
|
566
566
|
}
|
|
@@ -681,43 +681,43 @@ const dataFormActionsProps = {
|
|
|
681
681
|
"reset",
|
|
682
682
|
"cancel"
|
|
683
683
|
],
|
|
684
|
-
setup(
|
|
685
|
-
let { t:
|
|
686
|
-
|
|
687
|
-
},
|
|
688
|
-
|
|
689
|
-
},
|
|
690
|
-
|
|
691
|
-
}, { mergedDisabledRef:
|
|
684
|
+
setup(x, { emit: S, slots: C }) {
|
|
685
|
+
let { t: w } = useI18n(), T = () => {
|
|
686
|
+
S("submit");
|
|
687
|
+
}, E = () => {
|
|
688
|
+
S("reset");
|
|
689
|
+
}, D = () => {
|
|
690
|
+
S("cancel");
|
|
691
|
+
}, { mergedDisabledRef: O, mergedSizeRef: k } = useFormItem(x);
|
|
692
692
|
return () => {
|
|
693
|
-
let e =
|
|
694
|
-
return createVNode(NFlex, { size:
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
attrType:
|
|
693
|
+
let e = k.value, S = O.value, { gap: A = e === "small" ? 8 : e === "medium" ? 12 : 16, submitText: j, resetText: M, cancelText: N, submitDisabled: P, submitLoading: F, showSubmitBtn: I, showResetBtn: L, showCancelBtn: R, succeeded: z, successText: B = j, failureText: V = j, nativeButtonType: H } = x;
|
|
694
|
+
return createVNode(NFlex, { size: A === void 0 ? e : A }, { default: () => [
|
|
695
|
+
C.prefix?.(),
|
|
696
|
+
I === !1 ? void 0 : createVNode(NButton, {
|
|
697
|
+
attrType: H ? "submit" : "button",
|
|
698
698
|
size: e,
|
|
699
|
-
type:
|
|
700
|
-
disabled:
|
|
701
|
-
loading:
|
|
702
|
-
onClick:
|
|
699
|
+
type: z ? "success" : z === !1 ? "error" : "primary",
|
|
700
|
+
disabled: z !== void 0 || S || P || F,
|
|
701
|
+
loading: F,
|
|
702
|
+
onClick: H ? void 0 : T
|
|
703
703
|
}, {
|
|
704
|
-
default: () => (
|
|
705
|
-
icon: () =>
|
|
704
|
+
default: () => (z ? B : z === !1 ? V : j) || w("common.page.form.submitText"),
|
|
705
|
+
icon: () => z ? createVNode(NIcon, null, { default: () => [createVNode(ICheck, null, null)] }) : z === !1 ? createVNode(NIcon, null, { default: () => [createVNode(IClose, null, null)] }) : void 0
|
|
706
706
|
}),
|
|
707
|
-
|
|
708
|
-
size:
|
|
709
|
-
attrType:
|
|
710
|
-
disabled:
|
|
711
|
-
type:
|
|
712
|
-
secondary:
|
|
713
|
-
onClick:
|
|
714
|
-
}, { default: () => [
|
|
715
|
-
|
|
707
|
+
L === !1 ? void 0 : createVNode(NButton, {
|
|
708
|
+
size: k.value,
|
|
709
|
+
attrType: H ? "reset" : "button",
|
|
710
|
+
disabled: S || F || z,
|
|
711
|
+
type: R ? "primary" : "default",
|
|
712
|
+
secondary: R,
|
|
713
|
+
onClick: H ? void 0 : E
|
|
714
|
+
}, { default: () => [M || w("common.page.form.resetText")] }),
|
|
715
|
+
R === !1 || z ? void 0 : createVNode(NButton, {
|
|
716
716
|
attrType: "button",
|
|
717
|
-
disabled:
|
|
718
|
-
onClick:
|
|
719
|
-
}, { default: () => [
|
|
720
|
-
|
|
717
|
+
disabled: S || F,
|
|
718
|
+
onClick: D
|
|
719
|
+
}, { default: () => [N || w("common.page.form.cancelText")] }),
|
|
720
|
+
C.suffix?.()
|
|
721
721
|
] });
|
|
722
722
|
};
|
|
723
723
|
}
|
|
@@ -783,108 +783,114 @@ const DataForm = /* @__PURE__ */ defineComponent({
|
|
|
783
783
|
"reset",
|
|
784
784
|
"cancel"
|
|
785
785
|
],
|
|
786
|
-
setup(e, { emit:
|
|
787
|
-
let
|
|
788
|
-
|
|
789
|
-
},
|
|
790
|
-
e?.preventDefault?.(),
|
|
791
|
-
},
|
|
792
|
-
e?.preventDefault?.(),
|
|
793
|
-
},
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
}
|
|
786
|
+
setup(e, { emit: x, slots: S }) {
|
|
787
|
+
let C = (S) => {
|
|
788
|
+
S?.preventDefault?.(), x("submit", { ...toRaw(e.model) }, S);
|
|
789
|
+
}, w = (e) => {
|
|
790
|
+
e?.preventDefault?.(), x("reset");
|
|
791
|
+
}, T = (e) => {
|
|
792
|
+
e?.preventDefault?.(), x("cancel");
|
|
793
|
+
}, E = ref(), D = ref(), { width: k } = useElementSize(useCurrentElement());
|
|
794
|
+
watchDebounced([E, k], () => {
|
|
795
|
+
D.value = void 0, nextTick(() => {
|
|
796
|
+
D.value = E.value?.responsiveCols || void 0;
|
|
797
|
+
});
|
|
798
798
|
}, {
|
|
799
799
|
immediate: !0,
|
|
800
|
-
debounce:
|
|
801
|
-
})
|
|
802
|
-
|
|
800
|
+
debounce: 1e3 / 20
|
|
801
|
+
});
|
|
802
|
+
let j = 0, M = ({ overflow: x }) => {
|
|
803
|
+
if (S.action) return S.action({
|
|
804
|
+
cols: D.value,
|
|
805
|
+
spans: j,
|
|
806
|
+
overflow: x
|
|
807
|
+
});
|
|
808
|
+
let { loading: C, showSubmitBtn: w, showResetBtn: E, showCancelBtn: O, actionAlign: k, actionJustify: A, actionGap: M, submitDisabled: N, submitText: P, resetText: F, cancelText: I, succeeded: L, successText: R, failureText: z } = e;
|
|
809
|
+
return createVNode(NFormItem, {
|
|
810
|
+
label: A === "start" ? " " : void 0,
|
|
811
|
+
showLabel: e.labelPlacement !== "top",
|
|
812
|
+
style: "padding-top: 16px"
|
|
813
|
+
}, { default: () => [createVNode(DataFormActions, {
|
|
814
|
+
align: k,
|
|
815
|
+
justify: A,
|
|
816
|
+
gap: M,
|
|
817
|
+
showSubmitBtn: w,
|
|
818
|
+
showResetBtn: E,
|
|
819
|
+
showCancelBtn: O,
|
|
820
|
+
submitText: P,
|
|
821
|
+
resetText: F,
|
|
822
|
+
cancelText: I,
|
|
823
|
+
submitDisabled: N,
|
|
824
|
+
submitLoading: C,
|
|
825
|
+
succeeded: L,
|
|
826
|
+
successText: R,
|
|
827
|
+
failureText: z,
|
|
828
|
+
nativeButtonType: !0,
|
|
829
|
+
onCancel: T
|
|
830
|
+
}, {
|
|
831
|
+
prefix: () => S.actionPrefix?.(),
|
|
832
|
+
suffix: () => S.actionSuffix?.()
|
|
833
|
+
})] });
|
|
834
|
+
}, N = () => {
|
|
835
|
+
let { items: x, validation: C, showAction: w } = e;
|
|
836
|
+
return j = 0, createVNode(Fragment, null, [x.map(({ hidden: x, name: S, render: w, label: T, showColon: E, span: D = 6, rowSpan: O, offset: k = 0, tooltip: M, tooltipPlacement: N = e.tooltipPlacement, validationStatus: P = C[S]?.errors?.some((e) => e !== void 0) ? "error" : C[S]?.warnings?.some((e) => e !== void 0) ? "warnings" : C[S] ? "success" : void 0, readonly: F = e.readonly, showRequireMark: L = !F, showTooltipWhenReadonly: R = !1, ...z }) => {
|
|
837
|
+
if (x) return;
|
|
838
|
+
j += D;
|
|
839
|
+
let B;
|
|
840
|
+
return B = S[0] === "$" ? w({}) : createVNode(NFormItem, mergeProps({
|
|
841
|
+
path: S,
|
|
842
|
+
validationStatus: P,
|
|
843
|
+
showRequireMark: z.required && L
|
|
844
|
+
}, z), {
|
|
845
|
+
label: () => createVNode(NText, {
|
|
846
|
+
depth: e.readonly ? 3 : 2,
|
|
847
|
+
style: "display: inline-flex; align-items: flex-start; gap: 1px"
|
|
848
|
+
}, { default: () => [
|
|
849
|
+
createVNode("span", null, [toValue(T)]),
|
|
850
|
+
N === "icon" ? createVNode(NTooltip, null, {
|
|
851
|
+
default: () => toValue(M),
|
|
852
|
+
trigger: () => createVNode(NButton, {
|
|
853
|
+
text: !0,
|
|
854
|
+
style: "font-size: 1.25em; opacity: 0.8"
|
|
855
|
+
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(IHelp, null, null)] })] })
|
|
856
|
+
}) : void 0,
|
|
857
|
+
e.showColon && E !== !1 ? createVNode("span", { style: "place-self: center" }, [createTextVNode(":")]) : void 0
|
|
858
|
+
] }),
|
|
859
|
+
default: () => {
|
|
860
|
+
let x, S = createVNode("div", { style: "width: 100%; font-size: calc(1rem - 2px); min-height: 32px; display: flex; align-items: center" }, [w({
|
|
861
|
+
disabled: e.disabled,
|
|
862
|
+
size: e.size,
|
|
863
|
+
readonly: e.readonly
|
|
864
|
+
})]);
|
|
865
|
+
return M && N === "bottom" && (!e.readonly || R) ? createVNode("div", { style: "width: 100%; display: flex; flex-direction: column" }, [S, createVNode(NText, {
|
|
866
|
+
depth: 3,
|
|
867
|
+
style: "font-size: calc(1rem - 3px); margin-top: 6px"
|
|
868
|
+
}, _isSlot$5(x = toValue(M)) ? x : { default: () => [x] })]) : S;
|
|
869
|
+
},
|
|
870
|
+
feedback: () => C[S]?.errors[0] ?? C[S]?.warnings[0]
|
|
871
|
+
}), e.grid === !1 ? B : createVNode(NGi, {
|
|
872
|
+
key: S,
|
|
873
|
+
offset: k,
|
|
874
|
+
span: D,
|
|
875
|
+
style: O ? { gridRowEnd: `span ${O}` } : void 0
|
|
876
|
+
}, _isSlot$5(B) ? B : { default: () => [B] });
|
|
877
|
+
}), w === !1 || e.readonly === !0 && !S.action ? void 0 : createVNode(NGi, mergeProps({
|
|
878
|
+
key: "action",
|
|
879
|
+
span: 2 ** 53 - 1
|
|
880
|
+
}, typeof e.showAction == "object" ? e.showAction : {}), { default: M })]);
|
|
881
|
+
};
|
|
882
|
+
return () => {
|
|
883
|
+
let { items: x, loading: S, validation: T, showColon: D, tooltipPlacement: O, showFeedback: k, labelWidth: A = "7.2em", labelAlign: j = e.labelPlacement === "top" ? "left" : "right", grid: M, showAction: P, showSubmitBtn: F, showResetBtn: L, showCancelBtn: R, actionAlign: z, actionJustify: B, actionGap: V, submitDisabled: H, submitText: U, resetText: W, cancelText: G, succeeded: It, successText: K, failureText: q, ...J } = e, Y = !e.readonly && k !== !1;
|
|
803
884
|
return createVNode(NForm, mergeProps({
|
|
804
|
-
labelWidth:
|
|
805
|
-
labelAlign:
|
|
806
|
-
onReset:
|
|
807
|
-
onSubmit:
|
|
808
|
-
showFeedback:
|
|
809
|
-
},
|
|
810
|
-
ref:
|
|
885
|
+
labelWidth: A,
|
|
886
|
+
labelAlign: j,
|
|
887
|
+
onReset: w,
|
|
888
|
+
onSubmit: C,
|
|
889
|
+
showFeedback: Y
|
|
890
|
+
}, J), { default: () => [createVNode(NGrid, mergeProps({
|
|
891
|
+
ref: E,
|
|
811
892
|
itemResponsive: !0
|
|
812
|
-
},
|
|
813
|
-
let x = 0;
|
|
814
|
-
return createVNode(Fragment, null, [y.map(({ hidden: y, name: b, render: S, label: C, showColon: w, span: T = 6, rowSpan: E, offset: O = 0, tooltip: A, tooltipPlacement: j = e.tooltipPlacement, validationStatus: N = k[b]?.errors?.some((e) => e !== void 0) ? "error" : k[b]?.warnings?.some((e) => e !== void 0) ? "warnings" : k[b] ? "success" : void 0, readonly: P = e.readonly, showRequireMark: F = !P, showTooltipWhenReadonly: I = !1, ...L }) => {
|
|
815
|
-
if (y) return;
|
|
816
|
-
x += T;
|
|
817
|
-
let R;
|
|
818
|
-
return R = b[0] === "$" ? S({}) : createVNode(NFormItem, mergeProps({
|
|
819
|
-
path: b,
|
|
820
|
-
validationStatus: N,
|
|
821
|
-
showRequireMark: L.required && F
|
|
822
|
-
}, L), {
|
|
823
|
-
label: () => createVNode(NText, {
|
|
824
|
-
depth: e.readonly ? 3 : 2,
|
|
825
|
-
style: "display: inline-flex; align-items: flex-start; gap: 1px"
|
|
826
|
-
}, { default: () => [
|
|
827
|
-
createVNode("span", null, [toValue(C)]),
|
|
828
|
-
j === "icon" ? createVNode(NTooltip, null, {
|
|
829
|
-
default: () => toValue(A),
|
|
830
|
-
trigger: () => createVNode(NButton, {
|
|
831
|
-
text: !0,
|
|
832
|
-
style: "font-size: 1.25em; opacity: 0.8"
|
|
833
|
-
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(IHelp, null, null)] })] })
|
|
834
|
-
}) : void 0,
|
|
835
|
-
e.showColon && w !== !1 ? createVNode("span", { style: "place-self: center" }, [createTextVNode(":")]) : void 0
|
|
836
|
-
] }),
|
|
837
|
-
default: () => {
|
|
838
|
-
let y, b = createVNode("div", { style: "width: 100%; font-size: calc(1rem - 2px); min-height: 32px; display: flex; align-items: center" }, [S({
|
|
839
|
-
disabled: e.disabled,
|
|
840
|
-
size: e.size,
|
|
841
|
-
readonly: e.readonly
|
|
842
|
-
})]);
|
|
843
|
-
return A && j === "bottom" && (!e.readonly || I) ? createVNode("div", { style: "width: 100%; display: flex; flex-direction: column" }, [b, createVNode(NText, {
|
|
844
|
-
depth: 3,
|
|
845
|
-
style: "font-size: calc(1rem - 3px); margin-top: 6px"
|
|
846
|
-
}, _isSlot$5(y = toValue(A)) ? y : { default: () => [y] })]) : b;
|
|
847
|
-
},
|
|
848
|
-
feedback: () => k[b]?.errors[0] ?? k[b]?.warnings[0]
|
|
849
|
-
}), e.grid === !1 ? R : createVNode(NGi, {
|
|
850
|
-
key: b,
|
|
851
|
-
offset: O,
|
|
852
|
-
span: T,
|
|
853
|
-
style: E ? { gridRowEnd: `span ${E}` } : void 0
|
|
854
|
-
}, _isSlot$5(R) ? R : { default: () => [R] });
|
|
855
|
-
}), L === !1 || e.readonly === !0 && !b.action ? void 0 : createVNode(NGi, mergeProps({
|
|
856
|
-
key: "action",
|
|
857
|
-
span: 2 ** 53 - 1
|
|
858
|
-
}, typeof e.showAction == "object" ? e.showAction : {}), { default: ({ overflow: y }) => b.action ? b.action({
|
|
859
|
-
cols: E.value,
|
|
860
|
-
spans: x,
|
|
861
|
-
overflow: y
|
|
862
|
-
}) : createVNode(NFormItem, {
|
|
863
|
-
label: U === "start" ? " " : void 0,
|
|
864
|
-
showLabel: e.labelPlacement !== "top",
|
|
865
|
-
style: "padding-top: 16px"
|
|
866
|
-
}, { default: () => [createVNode(DataFormActions, {
|
|
867
|
-
align: H,
|
|
868
|
-
justify: U,
|
|
869
|
-
gap: W,
|
|
870
|
-
showSubmitBtn: R,
|
|
871
|
-
showResetBtn: B,
|
|
872
|
-
showCancelBtn: V,
|
|
873
|
-
submitText: K,
|
|
874
|
-
resetText: q,
|
|
875
|
-
cancelText: J,
|
|
876
|
-
submitDisabled: G,
|
|
877
|
-
submitloading: O,
|
|
878
|
-
succeeded: Y,
|
|
879
|
-
successText: X,
|
|
880
|
-
failureText: Z,
|
|
881
|
-
nativeButtonType: !0,
|
|
882
|
-
onCancel: C
|
|
883
|
-
}, {
|
|
884
|
-
prefix: () => b.actionPrefix?.(),
|
|
885
|
-
suffix: () => b.actionSuffix?.()
|
|
886
|
-
})] }) })]);
|
|
887
|
-
} })] });
|
|
893
|
+
}, M, { yGap: Y ? 0 : M?.yGap ?? 24 }), { default: N })] });
|
|
888
894
|
};
|
|
889
895
|
}
|
|
890
896
|
}), DataFilter = /* @__PURE__ */ defineComponent({
|
|
@@ -947,62 +953,62 @@ const DataForm = /* @__PURE__ */ defineComponent({
|
|
|
947
953
|
"custom",
|
|
948
954
|
"collapse"
|
|
949
955
|
],
|
|
950
|
-
setup(
|
|
951
|
-
let { t:
|
|
952
|
-
|
|
953
|
-
},
|
|
954
|
-
|
|
955
|
-
},
|
|
956
|
-
|
|
956
|
+
setup(x, { expose: S, emit: C }) {
|
|
957
|
+
let { t: w } = useI18n(), T = (e) => {
|
|
958
|
+
C("filter", x.model, e);
|
|
959
|
+
}, E = (e) => {
|
|
960
|
+
C("reset", e), x.filterOnReset && C("filter", x.model, e);
|
|
961
|
+
}, D = ref(x.defaultCollapsed), O = (e) => {
|
|
962
|
+
D.value = e;
|
|
957
963
|
};
|
|
958
|
-
|
|
959
|
-
let
|
|
964
|
+
S({ collapse: O });
|
|
965
|
+
let k = reactive({
|
|
960
966
|
span: 6,
|
|
961
967
|
suffix: !0
|
|
962
968
|
});
|
|
963
969
|
return () => {
|
|
964
|
-
let { filterOnReset: e, filterText:
|
|
970
|
+
let { filterOnReset: e, filterText: S, resetText: j, customizable: M, defaultCollapsed: N, collapsible: P, grid: F, ...L } = x;
|
|
965
971
|
return createVNode(DataForm, mergeProps({ grid: {
|
|
966
972
|
cols: "12 768:18 1280:24 1536:30",
|
|
967
973
|
yGap: 20,
|
|
968
974
|
xGap: 8,
|
|
969
|
-
...
|
|
970
|
-
collapsed:
|
|
971
|
-
} },
|
|
975
|
+
...F,
|
|
976
|
+
collapsed: D.value
|
|
977
|
+
} }, L, {
|
|
972
978
|
showFeedback: !1,
|
|
973
|
-
showAction:
|
|
974
|
-
onSubmit:
|
|
975
|
-
onReset:
|
|
976
|
-
}), { action: ({ cols: e, spans:
|
|
977
|
-
justify:
|
|
979
|
+
showAction: k,
|
|
980
|
+
onSubmit: T,
|
|
981
|
+
onReset: E
|
|
982
|
+
}), { action: ({ cols: e, spans: T }) => (k.suffix = e < T + k.span, createVNode(NFlex, {
|
|
983
|
+
justify: k.suffix ? "end" : "start",
|
|
978
984
|
align: "center"
|
|
979
985
|
}, { default: () => [
|
|
980
|
-
|
|
986
|
+
k.suffix ? void 0 : createVNode("span", null, [createTextVNode("\xA0\xA0\xA0\xA0")]),
|
|
981
987
|
createVNode(NButton, {
|
|
982
988
|
attrType: "submit",
|
|
983
989
|
type: "primary",
|
|
984
|
-
disabled:
|
|
985
|
-
loading:
|
|
986
|
-
}, { default: () => [
|
|
990
|
+
disabled: x.disabled,
|
|
991
|
+
loading: x.loading
|
|
992
|
+
}, { default: () => [S || w("common.page.filter.submitText")] }),
|
|
987
993
|
createVNode(NButton, {
|
|
988
994
|
attrType: "reset",
|
|
989
|
-
disabled:
|
|
990
|
-
}, { default: () => [
|
|
991
|
-
|
|
995
|
+
disabled: x.disabled || x.loading
|
|
996
|
+
}, { default: () => [j || w("common.page.form.resetText")] }),
|
|
997
|
+
M ? createVNode(DataCustom, {
|
|
992
998
|
keyField: "name",
|
|
993
999
|
showFixed: !1,
|
|
994
|
-
data:
|
|
995
|
-
onCustom: (e) => x("custom", e),
|
|
1000
|
+
data: L.items,
|
|
996
1001
|
size: 18,
|
|
997
|
-
type: "primary"
|
|
1002
|
+
type: "primary",
|
|
1003
|
+
onCustom: (e) => C("custom", e)
|
|
998
1004
|
}, null) : void 0,
|
|
999
|
-
|
|
1005
|
+
P && k.suffix ? createVNode(NButton, {
|
|
1000
1006
|
text: !0,
|
|
1001
1007
|
type: "primary",
|
|
1002
1008
|
iconPlacement: "right",
|
|
1003
|
-
renderIcon:
|
|
1004
|
-
onClick: () =>
|
|
1005
|
-
}, { default: () => [
|
|
1009
|
+
renderIcon: D.value ? IDown : IUp,
|
|
1010
|
+
onClick: () => O(!D.value)
|
|
1011
|
+
}, { default: () => [D.value ? w("common.page.filter.expand") : w("common.page.filter.collapse")] }) : void 0
|
|
1006
1012
|
] })) });
|
|
1007
1013
|
};
|
|
1008
1014
|
}
|
|
@@ -1010,31 +1016,31 @@ const DataForm = /* @__PURE__ */ defineComponent({
|
|
|
1010
1016
|
function _isSlot$4(e) {
|
|
1011
1017
|
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
|
|
1012
1018
|
}
|
|
1013
|
-
function useLocaleEdit(
|
|
1014
|
-
let { t:
|
|
1015
|
-
title:
|
|
1019
|
+
function useLocaleEdit(x, S, C = 1) {
|
|
1020
|
+
let { t: w } = useI18n(), T = ref(!1), E = [], { open: D, reinit: O } = useFormModal({
|
|
1021
|
+
title: x,
|
|
1016
1022
|
showColon: !0,
|
|
1017
|
-
submitText:
|
|
1018
|
-
items: ({ it: e }) =>
|
|
1023
|
+
submitText: w("common.confirm.defaultOk"),
|
|
1024
|
+
items: ({ it: e }) => E.map((x) => e(x.value, x.label, "input", {
|
|
1019
1025
|
span: 24,
|
|
1020
|
-
required:
|
|
1026
|
+
required: x.required,
|
|
1021
1027
|
inputProps: {
|
|
1022
|
-
readonly:
|
|
1028
|
+
readonly: T,
|
|
1023
1029
|
clearable: !0,
|
|
1024
1030
|
type: "textarea",
|
|
1025
1031
|
showCount: !0,
|
|
1026
1032
|
autosize: {
|
|
1027
|
-
minRows: unref(
|
|
1028
|
-
maxRows: Math.max(unref(
|
|
1033
|
+
minRows: unref(C),
|
|
1034
|
+
maxRows: Math.max(unref(C), 5)
|
|
1029
1035
|
}
|
|
1030
1036
|
}
|
|
1031
1037
|
})),
|
|
1032
|
-
onSubmit:
|
|
1038
|
+
onSubmit: S
|
|
1033
1039
|
});
|
|
1034
1040
|
return {
|
|
1035
|
-
open: (e,
|
|
1041
|
+
open: (e, x = !1) => (T.value = x, D(e)),
|
|
1036
1042
|
setSupports: (e) => {
|
|
1037
|
-
|
|
1043
|
+
E = e, O();
|
|
1038
1044
|
}
|
|
1039
1045
|
};
|
|
1040
1046
|
}
|
|
@@ -1079,102 +1085,102 @@ const DataLocaleInput = /* @__PURE__ */ defineComponent({
|
|
|
1079
1085
|
}
|
|
1080
1086
|
},
|
|
1081
1087
|
emits: ["update:modelValue", "updateModelValue"],
|
|
1082
|
-
setup(e, { emit:
|
|
1083
|
-
let
|
|
1084
|
-
|
|
1088
|
+
setup(e, { emit: x }) {
|
|
1089
|
+
let S = (S, C = e.showLang ?? e.defaultLang) => {
|
|
1090
|
+
S = {
|
|
1085
1091
|
...e.modelValue,
|
|
1086
|
-
[
|
|
1087
|
-
},
|
|
1088
|
-
}, { open:
|
|
1089
|
-
|
|
1090
|
-
}, toRef(e, "defaultRows")),
|
|
1092
|
+
[C]: S
|
|
1093
|
+
}, x("update:modelValue", S), x("updateModelValue", S);
|
|
1094
|
+
}, { open: C, setSupports: w } = useLocaleEdit(computed(() => toValue(e.label)), (e) => {
|
|
1095
|
+
x("update:modelValue", e), x("updateModelValue", e);
|
|
1096
|
+
}, toRef(e, "defaultRows")), T = ref(e.defaultExpanded);
|
|
1091
1097
|
watch(() => e.defaultExpanded, (e) => {
|
|
1092
|
-
|
|
1098
|
+
T.value = e;
|
|
1093
1099
|
});
|
|
1094
|
-
let
|
|
1100
|
+
let E = () => createVNode(NButton, {
|
|
1095
1101
|
quaternary: !0,
|
|
1096
1102
|
onClick: () => {
|
|
1097
|
-
|
|
1103
|
+
T.value = !T.value;
|
|
1098
1104
|
},
|
|
1099
1105
|
style: "--n-padding: 0 8px"
|
|
1100
1106
|
}, { default: () => [createVNode(NIcon, {
|
|
1101
1107
|
size: "20",
|
|
1102
1108
|
depth: "3"
|
|
1103
|
-
}, { default: () => [
|
|
1104
|
-
let
|
|
1105
|
-
return e.supports.some((e) => e.value !==
|
|
1106
|
-
},
|
|
1109
|
+
}, { default: () => [T.value ? createVNode(ILangCollapse, null, null) : createVNode(ILangExpand, null, null)] })] }), O = (x) => {
|
|
1110
|
+
let S = x.split("-")[0];
|
|
1111
|
+
return e.supports.some((e) => e.value !== x && e.value.startsWith(S)) ? x : S;
|
|
1112
|
+
}, A = `__slots${nanoid(6)}`;
|
|
1107
1113
|
watch(() => e.supports, (e) => {
|
|
1108
|
-
|
|
1109
|
-
let
|
|
1110
|
-
for (let [
|
|
1111
|
-
let e =
|
|
1112
|
-
|
|
1114
|
+
w(e);
|
|
1115
|
+
let x = 0;
|
|
1116
|
+
for (let [S, C] of e.entries()) {
|
|
1117
|
+
let e = O(C.value);
|
|
1118
|
+
x = Math.max(x, measureText(e, "monospace")), C[A] = markRaw({
|
|
1113
1119
|
prefix: () => createVNode("div", { style: {
|
|
1114
|
-
width: `${
|
|
1120
|
+
width: `${x + 4}px`,
|
|
1115
1121
|
height: "100%",
|
|
1116
1122
|
opacity: .5,
|
|
1117
1123
|
fontSize: "12px",
|
|
1118
1124
|
fontFamily: "monospace",
|
|
1119
|
-
color:
|
|
1125
|
+
color: C.required ? "var(--color-danger)" : void 0
|
|
1120
1126
|
} }, [e]),
|
|
1121
|
-
suffix:
|
|
1127
|
+
suffix: S === 0 ? E : void 0
|
|
1122
1128
|
});
|
|
1123
1129
|
}
|
|
1124
1130
|
}, { immediate: !0 });
|
|
1125
|
-
let
|
|
1126
|
-
let
|
|
1127
|
-
return [
|
|
1128
|
-
}),
|
|
1131
|
+
let j = computed(() => {
|
|
1132
|
+
let x = O(e.showLang ?? e.defaultLang);
|
|
1133
|
+
return [x, measureText(x, "monospace")];
|
|
1134
|
+
}), M = {
|
|
1129
1135
|
prefix: () => createVNode("div", { style: {
|
|
1130
|
-
width: `${
|
|
1136
|
+
width: `${j.value[1] + 4}px`,
|
|
1131
1137
|
height: "100%",
|
|
1132
1138
|
opacity: .5,
|
|
1133
1139
|
fontSize: "12px",
|
|
1134
1140
|
fontFamily: "monospace"
|
|
1135
|
-
} }, [
|
|
1141
|
+
} }, [j.value[0]]),
|
|
1136
1142
|
suffix: () => createVNode(NButton, {
|
|
1137
1143
|
quaternary: !0,
|
|
1138
|
-
onClick: () =>
|
|
1144
|
+
onClick: () => C(e.modelValue, e.disabled),
|
|
1139
1145
|
style: "--n-padding: 0 8px"
|
|
1140
1146
|
}, { default: () => [createVNode(NIcon, {
|
|
1141
1147
|
size: "20",
|
|
1142
1148
|
depth: "3"
|
|
1143
1149
|
}, { default: () => [createVNode(ILanguage, null, null)] })] })
|
|
1144
|
-
},
|
|
1150
|
+
}, N = { "--n-padding-right": "0" };
|
|
1145
1151
|
return () => {
|
|
1146
|
-
let
|
|
1152
|
+
let x;
|
|
1147
1153
|
return e.mode === "dialog" ? createVNode(NInput, {
|
|
1148
1154
|
value: e.modelValue?.[e.showLang ?? e.defaultLang] ?? e.modelValue?.[e.defaultLang],
|
|
1149
|
-
onUpdateValue:
|
|
1155
|
+
onUpdateValue: S,
|
|
1150
1156
|
disabled: e.disabled,
|
|
1151
1157
|
clearable: !0,
|
|
1152
|
-
style:
|
|
1158
|
+
style: N,
|
|
1153
1159
|
type: e.defaultRows > 1 ? "textarea" : "text",
|
|
1154
1160
|
rows: e.defaultRows
|
|
1155
|
-
}, _isSlot$4(
|
|
1161
|
+
}, _isSlot$4(M) ? M : { default: () => [M] }) : createVNode(NFlex, {
|
|
1156
1162
|
vertical: !0,
|
|
1157
1163
|
wrap: !1,
|
|
1158
1164
|
style: "width: 100%"
|
|
1159
|
-
}, _isSlot$4(
|
|
1160
|
-
if (!
|
|
1161
|
-
let
|
|
1165
|
+
}, _isSlot$4(x = e.supports.map((x, C) => {
|
|
1166
|
+
if (!T.value && C !== 0) return;
|
|
1167
|
+
let w = C == 0;
|
|
1162
1168
|
return withDirectives(createVNode(NInput, {
|
|
1163
|
-
key:
|
|
1164
|
-
value: e.modelValue?.[
|
|
1165
|
-
onUpdateValue: (e) =>
|
|
1169
|
+
key: x.value,
|
|
1170
|
+
value: e.modelValue?.[x.value],
|
|
1171
|
+
onUpdateValue: (e) => S(e, x.value),
|
|
1166
1172
|
disabled: e.disabled,
|
|
1167
1173
|
clearable: !0,
|
|
1168
|
-
style:
|
|
1174
|
+
style: w ? N : void 0,
|
|
1169
1175
|
type: e.defaultRows > 1 ? "textarea" : "text",
|
|
1170
1176
|
rows: e.defaultRows
|
|
1171
|
-
},
|
|
1177
|
+
}, x[A]), [[
|
|
1172
1178
|
vTooltip,
|
|
1173
|
-
|
|
1179
|
+
x.label,
|
|
1174
1180
|
void 0,
|
|
1175
1181
|
{ left: !0 }
|
|
1176
1182
|
]]);
|
|
1177
|
-
})) ?
|
|
1183
|
+
})) ? x : { default: () => [x] });
|
|
1178
1184
|
};
|
|
1179
1185
|
}
|
|
1180
1186
|
}), DataPagination = /* @__PURE__ */ defineComponent({
|
|
@@ -1198,27 +1204,27 @@ const DataLocaleInput = /* @__PURE__ */ defineComponent({
|
|
|
1198
1204
|
}
|
|
1199
1205
|
},
|
|
1200
1206
|
emits: { change: () => !0 },
|
|
1201
|
-
setup(
|
|
1202
|
-
let { t:
|
|
1203
|
-
pageSize:
|
|
1207
|
+
setup(x, { emit: S }) {
|
|
1208
|
+
let { t: C } = useI18n(), w = (e) => S("change", {
|
|
1209
|
+
pageSize: x.pageSize ?? x.page?.pageSize ?? 0,
|
|
1204
1210
|
currentPage: e
|
|
1205
|
-
}),
|
|
1211
|
+
}), T = (e) => S("change", {
|
|
1206
1212
|
pageSize: e,
|
|
1207
|
-
currentPage:
|
|
1213
|
+
currentPage: x.currentPage ?? x.page?.currentPage ?? 0
|
|
1208
1214
|
});
|
|
1209
1215
|
return () => createVNode(NPagination, {
|
|
1210
|
-
page:
|
|
1211
|
-
itemCount:
|
|
1212
|
-
pageSize:
|
|
1213
|
-
onUpdatePage:
|
|
1214
|
-
onUpdatePageSize:
|
|
1215
|
-
pageSizes:
|
|
1216
|
+
page: x.currentPage ?? x.page?.currentPage,
|
|
1217
|
+
itemCount: x.total,
|
|
1218
|
+
pageSize: x.pageSize ?? x.page?.pageSize,
|
|
1219
|
+
onUpdatePage: w,
|
|
1220
|
+
onUpdatePageSize: T,
|
|
1221
|
+
pageSizes: x.pageSizes,
|
|
1216
1222
|
showQuickJumper: !0,
|
|
1217
1223
|
showSizePicker: !0,
|
|
1218
1224
|
style: "justify-content: flex-end"
|
|
1219
1225
|
}, {
|
|
1220
|
-
prefix: () =>
|
|
1221
|
-
suffix: () =>
|
|
1226
|
+
prefix: () => C("common.page.pagination.prefix", { total: x.total }),
|
|
1227
|
+
suffix: () => C("common.page.pagination.suffix")
|
|
1222
1228
|
});
|
|
1223
1229
|
}
|
|
1224
1230
|
});
|
|
@@ -1241,28 +1247,28 @@ const DataSelection = /* @__PURE__ */ defineComponent({
|
|
|
1241
1247
|
"update:modelValue": () => !0,
|
|
1242
1248
|
clear: () => !0
|
|
1243
1249
|
},
|
|
1244
|
-
setup(
|
|
1245
|
-
let { t:
|
|
1250
|
+
setup(x, { emit: S }) {
|
|
1251
|
+
let { t: C } = useI18n();
|
|
1246
1252
|
return () => {
|
|
1247
1253
|
let e;
|
|
1248
|
-
return
|
|
1254
|
+
return x.modelValue !== "selection" && x.count === 0 ? createVNode("div", null, null) : createVNode("div", null, [createVNode(NFlex, {
|
|
1249
1255
|
align: "center",
|
|
1250
1256
|
"wrap-item": !1
|
|
1251
1257
|
}, { default: () => [
|
|
1252
|
-
createVNode("span", null, [
|
|
1258
|
+
createVNode("span", null, [C("common.page.selection.countText", { count: x.count })]),
|
|
1253
1259
|
createVNode(NButton, {
|
|
1254
1260
|
text: !0,
|
|
1255
1261
|
type: "primary",
|
|
1256
1262
|
onClick: () => {
|
|
1257
|
-
|
|
1263
|
+
S("update:modelValue", x.modelValue === "all" ? "selection" : "all");
|
|
1258
1264
|
}
|
|
1259
|
-
}, { default: () => [
|
|
1265
|
+
}, { default: () => [x.modelValue === "all" ? C("common.page.selection.view") : C("common.page.selection.back")] }),
|
|
1260
1266
|
createVNode(NButton, {
|
|
1261
1267
|
text: !0,
|
|
1262
1268
|
onClick: () => {
|
|
1263
|
-
|
|
1269
|
+
S("clear"), S("update:modelValue", "all");
|
|
1264
1270
|
}
|
|
1265
|
-
}, _isSlot$3(e =
|
|
1271
|
+
}, _isSlot$3(e = C("common.page.selection.clear")) ? e : { default: () => [e] })
|
|
1266
1272
|
] })]);
|
|
1267
1273
|
};
|
|
1268
1274
|
}
|
|
@@ -1270,13 +1276,13 @@ const DataSelection = /* @__PURE__ */ defineComponent({
|
|
|
1270
1276
|
function _isSlot$2(e) {
|
|
1271
1277
|
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
|
|
1272
1278
|
}
|
|
1273
|
-
function _map(e,
|
|
1279
|
+
function _map(e, x) {
|
|
1274
1280
|
return (e ?? []).map((e) => {
|
|
1275
|
-
let
|
|
1281
|
+
let S = {
|
|
1276
1282
|
csvTitle: e.exportTitle,
|
|
1277
1283
|
...e,
|
|
1278
1284
|
title: () => {
|
|
1279
|
-
let
|
|
1285
|
+
let x = toValue(e.title), S = x && withDirectives(createVNode("div", null, [x]), [[
|
|
1280
1286
|
vTooltip,
|
|
1281
1287
|
() => toValue(e.title),
|
|
1282
1288
|
void 0,
|
|
@@ -1287,44 +1293,41 @@ function _map(e, y) {
|
|
|
1287
1293
|
wrap: !1,
|
|
1288
1294
|
inline: !0,
|
|
1289
1295
|
style: "max-width: 100%"
|
|
1290
|
-
}, { default: () => [
|
|
1296
|
+
}, { default: () => [S, createVNode(NTooltip, null, {
|
|
1291
1297
|
default: toValue(e.tooltip),
|
|
1292
1298
|
trigger: () => createVNode(NButton, {
|
|
1293
1299
|
text: !0,
|
|
1294
1300
|
style: "font-size: 1.25em; opacity: 0.8"
|
|
1295
1301
|
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(IHelp, null, null)] })] })
|
|
1296
|
-
})] }) :
|
|
1302
|
+
})] }) : S;
|
|
1297
1303
|
}
|
|
1298
1304
|
};
|
|
1299
|
-
if (e.children?.length)
|
|
1305
|
+
if (e.children?.length) S.children = _map(e.children, x);
|
|
1300
1306
|
else {
|
|
1301
|
-
e.hidden !== !0 && (
|
|
1302
|
-
let
|
|
1303
|
-
e.ellipsis !== !1 && (
|
|
1304
|
-
let
|
|
1305
|
-
return
|
|
1306
|
-
return
|
|
1307
|
-
})(),
|
|
1308
|
-
expandTrigger: "click",
|
|
1309
|
-
lineClamp: 1,
|
|
1310
|
-
tooltip: { style: {
|
|
1311
|
-
maxWidth: "61.8vw",
|
|
1312
|
-
wordBreak: "break-all"
|
|
1313
|
-
} }
|
|
1314
|
-
}, typeof e.ellipsis == "boolean" ? {} : e.ellipsis), _isSlot$2(b) ? b : { default: () => [b] }) : withDirectives(b, [[
|
|
1307
|
+
e.hidden !== !0 && (S.width ??= 100, x.value += Number(S.width));
|
|
1308
|
+
let C = e.render ?? ((e) => e);
|
|
1309
|
+
e.ellipsis !== !1 && (S.ellipsis = !1, S.render = (...x) => {
|
|
1310
|
+
let S = C(...x);
|
|
1311
|
+
return S && (isVNode(S) || ((function() {
|
|
1312
|
+
return S;
|
|
1313
|
+
})(), S = createVNode("span", null, [S])), withDirectives(S, [[
|
|
1315
1314
|
vTooltip,
|
|
1316
|
-
() => e.ellipsisTooltip ? e.ellipsisTooltip(...
|
|
1315
|
+
() => e.ellipsisTooltip ? e.ellipsisTooltip(...x) : S,
|
|
1317
1316
|
void 0,
|
|
1318
|
-
{
|
|
1317
|
+
{
|
|
1318
|
+
auto: !0,
|
|
1319
|
+
expandable: e.ellipsisExpandable,
|
|
1320
|
+
[`ell${e.ellipsis}`]: !0
|
|
1321
|
+
}
|
|
1319
1322
|
]]));
|
|
1320
|
-
}, e.ellipsisTooltip === !0 && (
|
|
1323
|
+
}, e.ellipsisTooltip === !0 && (S.ellipsisTooltip = C)), Object.assign(S, {
|
|
1321
1324
|
resizable: e.resizable !== !1,
|
|
1322
1325
|
sorter: e.sortable,
|
|
1323
1326
|
type: ["selection", "expand"].includes(e.type) ? e.type : void 0,
|
|
1324
|
-
disabled: e.selectable ? (
|
|
1327
|
+
disabled: e.selectable ? (x) => e.selectable(x) === !1 : void 0
|
|
1325
1328
|
});
|
|
1326
1329
|
}
|
|
1327
|
-
return
|
|
1330
|
+
return S.key === "$actions" && (S.cellProps ??= () => ({ style: { padding: "0 2px" } })), S;
|
|
1328
1331
|
}).filter((e) => e?.hidden !== !0);
|
|
1329
1332
|
}
|
|
1330
1333
|
const DataTable = /* @__PURE__ */ defineComponent({
|
|
@@ -1353,8 +1356,14 @@ const DataTable = /* @__PURE__ */ defineComponent({
|
|
|
1353
1356
|
],
|
|
1354
1357
|
default: !0
|
|
1355
1358
|
},
|
|
1359
|
+
highlightColor: String,
|
|
1360
|
+
appear: {
|
|
1361
|
+
type: String,
|
|
1362
|
+
default: "normal"
|
|
1363
|
+
},
|
|
1356
1364
|
rowClassName: dataTableProps.rowClassName,
|
|
1357
|
-
rowProps: dataTableProps.rowProps
|
|
1365
|
+
rowProps: dataTableProps.rowProps,
|
|
1366
|
+
maxHeight: [String, Number]
|
|
1358
1367
|
},
|
|
1359
1368
|
emits: [
|
|
1360
1369
|
"sort",
|
|
@@ -1362,39 +1371,39 @@ const DataTable = /* @__PURE__ */ defineComponent({
|
|
|
1362
1371
|
"custom",
|
|
1363
1372
|
"highlight"
|
|
1364
1373
|
],
|
|
1365
|
-
setup(e, { slots:
|
|
1366
|
-
let { keyField:
|
|
1367
|
-
useStyle("-datatable", style,
|
|
1368
|
-
let
|
|
1369
|
-
e ==
|
|
1374
|
+
setup(e, { slots: C, emit: w, expose: T }) {
|
|
1375
|
+
let { keyField: E } = inject(PAGE_INJECTION), D = useMergedClsPrefix(), O = `${D.value}-datatable`;
|
|
1376
|
+
useStyle("-datatable", style, D);
|
|
1377
|
+
let A = useTemplateRef("table-ref"), j = ({ sortField: e, sortOrder: x } = {}, S) => {
|
|
1378
|
+
e == S?.sortField && x == S?.sortOrder || A.value?.sort(e, x ? x + "end" : !1);
|
|
1370
1379
|
};
|
|
1371
|
-
watch(() => ({ ...e.sorter }),
|
|
1372
|
-
let
|
|
1373
|
-
let
|
|
1374
|
-
return (e) => e[
|
|
1375
|
-
}),
|
|
1380
|
+
watch(() => ({ ...e.sorter }), j, { deep: !0 });
|
|
1381
|
+
let M = computed(() => {
|
|
1382
|
+
let x = e.keyField || E || "key";
|
|
1383
|
+
return (e) => e[x];
|
|
1384
|
+
}), P = shallowRef({
|
|
1376
1385
|
cache: [],
|
|
1377
1386
|
scrollToView(...e) {
|
|
1378
1387
|
this.cache.push(e);
|
|
1379
1388
|
}
|
|
1380
1389
|
});
|
|
1381
|
-
until(
|
|
1382
|
-
|
|
1383
|
-
let
|
|
1384
|
-
|
|
1385
|
-
let
|
|
1386
|
-
if (
|
|
1387
|
-
let
|
|
1388
|
-
|
|
1389
|
-
top:
|
|
1390
|
+
until(A).changed().then(() => {
|
|
1391
|
+
j(e.sorter);
|
|
1392
|
+
let x = P.value.cache;
|
|
1393
|
+
P.value = A.value, P.value.scrollToView = (x) => {
|
|
1394
|
+
let S = e.data.findIndex((e) => M.value(e) === x);
|
|
1395
|
+
if (S === -1) return;
|
|
1396
|
+
let C = A.value.$el.querySelector(`.${O}__row-marker:nth-child(${S + 1})`);
|
|
1397
|
+
A.value.scrollTo({
|
|
1398
|
+
top: C.offsetTop,
|
|
1390
1399
|
behavior: "smooth"
|
|
1391
1400
|
});
|
|
1392
1401
|
};
|
|
1393
|
-
for (let e of
|
|
1394
|
-
}),
|
|
1395
|
-
let
|
|
1402
|
+
for (let e of x) P.value.scrollToView(...e);
|
|
1403
|
+
}), T(toReactive(P));
|
|
1404
|
+
let F = ref(0), I = shallowRef([]);
|
|
1396
1405
|
watch(() => e.columns, () => {
|
|
1397
|
-
|
|
1406
|
+
F.value = 0, I.value = _map(e.columns, F);
|
|
1398
1407
|
}, {
|
|
1399
1408
|
immediate: !0,
|
|
1400
1409
|
deep: 1
|
|
@@ -1403,72 +1412,99 @@ const DataTable = /* @__PURE__ */ defineComponent({
|
|
|
1403
1412
|
watch(() => e.highlight, (e) => {
|
|
1404
1413
|
L.value = typeof e == "boolean" ? null : e ?? null;
|
|
1405
1414
|
}, { immediate: !0 });
|
|
1406
|
-
let R = computed(() => (
|
|
1407
|
-
e.rowClassName?.(
|
|
1408
|
-
`${
|
|
1409
|
-
L.value != null &&
|
|
1410
|
-
].join(" ")),
|
|
1411
|
-
let
|
|
1415
|
+
let R = computed(() => (x, S) => [
|
|
1416
|
+
e.rowClassName?.(x, S) || "",
|
|
1417
|
+
`${O}__row-marker`,
|
|
1418
|
+
L.value != null && M.value(x) === L.value ? `${O}__row-highlight` : ""
|
|
1419
|
+
].join(" ")), V = computed(() => (x, S) => {
|
|
1420
|
+
let C = e.rowProps?.(x, S);
|
|
1412
1421
|
return {
|
|
1413
|
-
...
|
|
1414
|
-
onClick: (
|
|
1415
|
-
let
|
|
1416
|
-
e.highlight === !0 && (L.value =
|
|
1422
|
+
...C,
|
|
1423
|
+
onClick: (S) => {
|
|
1424
|
+
let T = M.value(x);
|
|
1425
|
+
e.highlight === !0 && (L.value = T), w("highlight", T), C?.onClick?.(S);
|
|
1417
1426
|
}
|
|
1418
1427
|
};
|
|
1419
|
-
}),
|
|
1428
|
+
}), H = (x) => {
|
|
1420
1429
|
if (e.sorter) {
|
|
1421
|
-
let { sortField:
|
|
1422
|
-
if (
|
|
1430
|
+
let { sortField: S, sortOrder: C } = e.sorter;
|
|
1431
|
+
if (x?.columnKey == S && (x?.order ? x.order === C + "end" : !C)) return;
|
|
1423
1432
|
}
|
|
1424
|
-
|
|
1425
|
-
sortField:
|
|
1426
|
-
sortOrder:
|
|
1433
|
+
w("sort", {
|
|
1434
|
+
sortField: x?.order ? x?.columnKey : void 0,
|
|
1435
|
+
sortOrder: x?.order ? x.order.replace("end", "") : void 0
|
|
1427
1436
|
});
|
|
1428
1437
|
}, U = (e) => {
|
|
1429
|
-
|
|
1430
|
-
},
|
|
1431
|
-
|
|
1432
|
-
key:
|
|
1438
|
+
w("select", e);
|
|
1439
|
+
}, W = (e, x, S) => {
|
|
1440
|
+
w("custom", {
|
|
1441
|
+
key: S.key,
|
|
1433
1442
|
width: e
|
|
1434
1443
|
});
|
|
1435
1444
|
};
|
|
1436
1445
|
return () => createVNode(NDataTable, {
|
|
1437
|
-
class:
|
|
1446
|
+
class: [O, e.appear === "sticky" ? `${O}--sticky` : ""],
|
|
1438
1447
|
data: e.data,
|
|
1439
|
-
columns:
|
|
1440
|
-
rowKey:
|
|
1448
|
+
columns: I.value,
|
|
1449
|
+
rowKey: M.value,
|
|
1441
1450
|
tableLayout: "fixed",
|
|
1442
1451
|
ref: "table-ref",
|
|
1443
|
-
scrollX:
|
|
1452
|
+
scrollX: F.value,
|
|
1444
1453
|
rowClassName: R.value,
|
|
1445
|
-
rowProps:
|
|
1454
|
+
rowProps: V.value,
|
|
1446
1455
|
checkedRowKeys: e.selectedKeys,
|
|
1447
|
-
|
|
1456
|
+
style: { "--n-tr-highlight-color": e.highlightColor },
|
|
1457
|
+
maxHeight: e.maxHeight ?? (e.appear === "sticky" ? "auto" : void 0),
|
|
1458
|
+
onUpdateSorter: H,
|
|
1448
1459
|
onUpdateCheckedRowKeys: U,
|
|
1449
|
-
onUnstableColumnResize:
|
|
1450
|
-
}, _isSlot$2(
|
|
1460
|
+
onUnstableColumnResize: W
|
|
1461
|
+
}, _isSlot$2(C) ? C : { default: () => [C] });
|
|
1451
1462
|
}
|
|
1452
1463
|
});
|
|
1453
|
-
var style = /* @__PURE__ */ cB("datatable", [cE("row-highlight", [c("& > td", { backgroundColor: "var(--n-tr-highlight-color, var(--n-merged-border-color)) !important" })])
|
|
1454
|
-
|
|
1455
|
-
|
|
1464
|
+
var style = /* @__PURE__ */ cB("datatable", [cE("row-highlight", [c("& > td", { backgroundColor: "var(--n-tr-highlight-color, var(--n-merged-border-color)) !important" })]), cM("sticky", [
|
|
1465
|
+
c(".n-data-table-base-table-header", {
|
|
1466
|
+
position: "sticky",
|
|
1467
|
+
top: "-1px",
|
|
1468
|
+
zIndex: 10,
|
|
1469
|
+
overflowY: "hidden"
|
|
1470
|
+
}),
|
|
1471
|
+
c(".n-data-table-base-table-body", { overflow: "initial" }, [c("& > .n-scrollbar-container", {
|
|
1472
|
+
overflow: "initial",
|
|
1473
|
+
overflowX: "scroll"
|
|
1474
|
+
}), c("& > .n-scrollbar-rail--horizontal", {
|
|
1475
|
+
position: "sticky",
|
|
1476
|
+
bottom: "0"
|
|
1477
|
+
})]),
|
|
1478
|
+
c(".n-data-table-base-table:has(.n-data-table-empty) .n-data-table-base-table-header", {
|
|
1479
|
+
scrollbarWidth: "thin",
|
|
1480
|
+
overflowX: "auto"
|
|
1481
|
+
}),
|
|
1482
|
+
c(".n-data-table-td > *", {
|
|
1483
|
+
lineHeight: "1",
|
|
1484
|
+
verticalAlign: "middle",
|
|
1485
|
+
contentVisibility: "auto"
|
|
1486
|
+
}),
|
|
1487
|
+
c(".n-data-table-td > .n-checkbox--inside-table", { lineHeight: "16px" }),
|
|
1488
|
+
c(".n-data-table-td > .n-tooltip-expanded", { lineHeight: "1.25" })
|
|
1489
|
+
])]);
|
|
1490
|
+
function useDataTableDrag(e, { data: x, onSort: S, ...C }) {
|
|
1491
|
+
watch([ref(x), e], async ([e, x]) => {
|
|
1456
1492
|
if (e.length === 0) return;
|
|
1457
1493
|
await nextTick();
|
|
1458
|
-
let
|
|
1459
|
-
if (!
|
|
1460
|
-
let
|
|
1494
|
+
let w = unrefElement(x)?.querySelector(".n-data-table-base-table-body .n-data-table-tbody");
|
|
1495
|
+
if (!w) return;
|
|
1496
|
+
let T = Sortable$1.create(w, {
|
|
1461
1497
|
animation: 150,
|
|
1462
|
-
...
|
|
1498
|
+
...C,
|
|
1463
1499
|
onSort(e) {
|
|
1464
|
-
|
|
1500
|
+
S({
|
|
1465
1501
|
from: e.oldIndex,
|
|
1466
1502
|
to: e.newIndex
|
|
1467
1503
|
});
|
|
1468
1504
|
}
|
|
1469
1505
|
});
|
|
1470
1506
|
return () => {
|
|
1471
|
-
|
|
1507
|
+
T.destroy();
|
|
1472
1508
|
};
|
|
1473
1509
|
}, { immediate: !0 });
|
|
1474
1510
|
}
|
|
@@ -1527,39 +1563,39 @@ const NRadios = /* @__PURE__ */ defineComponent({
|
|
|
1527
1563
|
"update:modelValue": () => !0,
|
|
1528
1564
|
updateModelValue: () => !0
|
|
1529
1565
|
},
|
|
1530
|
-
setup(
|
|
1531
|
-
let { t:
|
|
1566
|
+
setup(x, { emit: S }) {
|
|
1567
|
+
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" ? {
|
|
1532
1568
|
"--n-button-color-active": "var(--color-primary)",
|
|
1533
1569
|
"--n-button-text-color-active": "var(--color-base)"
|
|
1534
|
-
} : {}),
|
|
1535
|
-
|
|
1570
|
+
} : {}), E = (e) => {
|
|
1571
|
+
S("update:modelValue", e), S("updateModelValue", e);
|
|
1536
1572
|
};
|
|
1537
1573
|
return () => {
|
|
1538
|
-
let e =
|
|
1539
|
-
let
|
|
1574
|
+
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) => {
|
|
1575
|
+
let C = typeof S[x.labelField] == "string" ? S[x.labelField] : S[x.labelField]?.();
|
|
1540
1576
|
return createVNode(e, {
|
|
1541
|
-
value:
|
|
1542
|
-
disabled:
|
|
1543
|
-
style:
|
|
1544
|
-
paddingLeft:
|
|
1545
|
-
paddingRight:
|
|
1577
|
+
value: S[x.valueField],
|
|
1578
|
+
disabled: S[x.disabledField],
|
|
1579
|
+
style: x.padding ? {
|
|
1580
|
+
paddingLeft: x.padding,
|
|
1581
|
+
paddingRight: x.padding
|
|
1546
1582
|
} : {}
|
|
1547
|
-
}, { default: () => [
|
|
1548
|
-
default: () =>
|
|
1549
|
-
trigger: () =>
|
|
1550
|
-
}) :
|
|
1583
|
+
}, { default: () => [S.tip ? createVNode(NTooltip, null, {
|
|
1584
|
+
default: () => S.tip,
|
|
1585
|
+
trigger: () => C
|
|
1586
|
+
}) : C] });
|
|
1551
1587
|
})]);
|
|
1552
1588
|
return createVNode(NRadioGroup, {
|
|
1553
|
-
style:
|
|
1554
|
-
...
|
|
1589
|
+
style: x.vertical ? {
|
|
1590
|
+
...T.value,
|
|
1555
1591
|
padding: "6px 0 0"
|
|
1556
|
-
} :
|
|
1557
|
-
value:
|
|
1558
|
-
onUpdateValue:
|
|
1559
|
-
}, { default: () => [
|
|
1560
|
-
size:
|
|
1561
|
-
vertical:
|
|
1562
|
-
}, _isSlot$1(
|
|
1592
|
+
} : T.value,
|
|
1593
|
+
value: x.modelValue,
|
|
1594
|
+
onUpdateValue: E
|
|
1595
|
+
}, { default: () => [x.type === "radio" ? createVNode(NFlex, {
|
|
1596
|
+
size: x.vertical ? void 0 : "small",
|
|
1597
|
+
vertical: x.vertical
|
|
1598
|
+
}, _isSlot$1(S) ? S : { default: () => [S] }) : S] });
|
|
1563
1599
|
};
|
|
1564
1600
|
}
|
|
1565
1601
|
});
|
|
@@ -1633,278 +1669,278 @@ const DtUserDept = /* @__PURE__ */ defineComponent({
|
|
|
1633
1669
|
valueField: { type: String }
|
|
1634
1670
|
},
|
|
1635
1671
|
emits: ["update:modelValue", "updateModelValue"],
|
|
1636
|
-
setup(
|
|
1637
|
-
let { t:
|
|
1638
|
-
if (
|
|
1639
|
-
let e =
|
|
1672
|
+
setup(x, { emit: S, attrs: C }) {
|
|
1673
|
+
let { t: w } = useI18n(), { localeRef: T } = useLocale("Popconfirm"), E = computed(() => x.valueField || (x.type === "user" ? "username" : "code")), D = computed(() => {
|
|
1674
|
+
if (x.multiple) return x.modelValue || [];
|
|
1675
|
+
let e = x.modelValue?.trim();
|
|
1640
1676
|
return e ? [e] : [];
|
|
1641
|
-
}),
|
|
1642
|
-
watch(() =>
|
|
1677
|
+
}), A = /* @__PURE__ */ new Map(), j = computed(() => (A.clear(), x.users.map((e) => (e = reactive(e), e.label = e.nickname + e.username, e.value = e[E.value], e.type = "user", A.set(e[E.value], e), e)))), M = shallowRef([]);
|
|
1678
|
+
watch(() => x.depts, (e) => {
|
|
1643
1679
|
walkTree(e, (e) => {
|
|
1644
|
-
e.label = e.name, e.value = e[
|
|
1645
|
-
}),
|
|
1680
|
+
e.label = e.name, e.value = e[E.value], e.type = "dept", e.children?.length || delete e.children;
|
|
1681
|
+
}), M.value = flattenTree(e);
|
|
1646
1682
|
}, { immediate: !0 });
|
|
1647
|
-
let
|
|
1648
|
-
...
|
|
1649
|
-
...
|
|
1683
|
+
let N = computed(() => [
|
|
1684
|
+
...x.depts,
|
|
1685
|
+
...x.groups.map((e) => ({
|
|
1650
1686
|
label: e.name,
|
|
1651
1687
|
value: e.code,
|
|
1652
1688
|
type: "group"
|
|
1653
1689
|
})),
|
|
1654
|
-
...
|
|
1655
|
-
]),
|
|
1656
|
-
let
|
|
1657
|
-
for (let e of
|
|
1658
|
-
|
|
1659
|
-
let
|
|
1660
|
-
return
|
|
1690
|
+
...j.value
|
|
1691
|
+
]), P = ref([]), F = ref(), V = async (e) => {
|
|
1692
|
+
let S = await (e.type === "group" ? x.getUsersByGroup(e.value) : x.getUsersByDept(e.value));
|
|
1693
|
+
for (let e of j.value) e.disabled = !0;
|
|
1694
|
+
F.value = [...e.type === "dept" ? e.children ?? [] : [], ...S.map((e) => {
|
|
1695
|
+
let x = A.get(e[E.value]);
|
|
1696
|
+
return x && (x.disabled = !1), {
|
|
1661
1697
|
...e,
|
|
1662
1698
|
label: e.nickname + e.username,
|
|
1663
|
-
value: e[
|
|
1699
|
+
value: e[E.value],
|
|
1664
1700
|
type: "user"
|
|
1665
1701
|
};
|
|
1666
1702
|
})];
|
|
1667
|
-
},
|
|
1668
|
-
let
|
|
1669
|
-
if (
|
|
1670
|
-
data:
|
|
1703
|
+
}, H = /* @__PURE__ */ new WeakMap(), U = (e, S, C) => {
|
|
1704
|
+
let T;
|
|
1705
|
+
if (x.type === "dept") return createVNode(NTree, {
|
|
1706
|
+
data: x.depts,
|
|
1671
1707
|
keyField: "value",
|
|
1672
1708
|
labelField: "name",
|
|
1673
|
-
defaultExpandAll:
|
|
1674
|
-
checkable:
|
|
1675
|
-
selectable: !
|
|
1709
|
+
defaultExpandAll: x.defaultExpandAll,
|
|
1710
|
+
checkable: x.multiple,
|
|
1711
|
+
selectable: !x.multiple,
|
|
1676
1712
|
multiple: !1,
|
|
1677
1713
|
blockLine: !0,
|
|
1678
1714
|
checkOnClick: !0,
|
|
1679
|
-
pattern:
|
|
1680
|
-
filter: (e,
|
|
1681
|
-
checkedKeys:
|
|
1682
|
-
selectedKeys:
|
|
1715
|
+
pattern: C,
|
|
1716
|
+
filter: (e, x) => x.label.includes(e) || x.value.includes(e),
|
|
1717
|
+
checkedKeys: x.multiple ? e : void 0,
|
|
1718
|
+
selectedKeys: x.multiple ? void 0 : e,
|
|
1683
1719
|
onUpdateCheckedKeys: (e) => {
|
|
1684
|
-
|
|
1720
|
+
x.max && e?.length > x.max || S(e);
|
|
1685
1721
|
},
|
|
1686
1722
|
onUpdateSelectedKeys: (e) => {
|
|
1687
|
-
|
|
1723
|
+
S(e);
|
|
1688
1724
|
}
|
|
1689
1725
|
}, null);
|
|
1690
|
-
let
|
|
1691
|
-
if (e && !
|
|
1692
|
-
let
|
|
1693
|
-
|
|
1694
|
-
let
|
|
1695
|
-
return createVNode(Fragment, null, [createVNode("div", { style: "margin: 12px 16px; display: flex; justify-content: space-between; align-items: center" }, [
|
|
1696
|
-
|
|
1726
|
+
let E = e ? H.get(e) : /* @__PURE__ */ new Set();
|
|
1727
|
+
if (e && !E && (E = new Set(e), H.set(e, E)), F.value === !1) return createVNode(NSpin, { show: !0 }, null);
|
|
1728
|
+
let D = F.value || N.value;
|
|
1729
|
+
C = C?.trim(), C && (D = D?.filter((e) => e.label.includes(C) || e.value.includes(C)));
|
|
1730
|
+
let k = P.value;
|
|
1731
|
+
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" }, [
|
|
1732
|
+
k.length >= 2 ? k.at(-2).label : w("common.all"),
|
|
1697
1733
|
createVNode("span", { style: "padding: 0 4px" }, [createVNode(IRight, null, null)]),
|
|
1698
|
-
|
|
1734
|
+
k.at(-1).label
|
|
1699
1735
|
]), createVNode(NButton, {
|
|
1700
1736
|
text: !0,
|
|
1701
1737
|
type: "warning",
|
|
1702
1738
|
onClick: () => {
|
|
1703
|
-
if (
|
|
1704
|
-
else for (let e of
|
|
1739
|
+
if (k.pop(), F.value = k.length > 0 ? !1 : void 0, k.length > 0) V(k.at(-1));
|
|
1740
|
+
else for (let e of j.value) e.disabled = !1;
|
|
1705
1741
|
}
|
|
1706
|
-
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(ILeft, null, null)] }),
|
|
1742
|
+
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(ILeft, null, null)] }), w("common.back")] })]) : createVNode("span", null, [w("common.all")])]), D?.length ? createVNode(NList, {
|
|
1707
1743
|
showDivider: !1,
|
|
1708
1744
|
style: "padding: 0 16px"
|
|
1709
|
-
}, _isSlot(
|
|
1710
|
-
let
|
|
1745
|
+
}, _isSlot(T = D.map((C) => {
|
|
1746
|
+
let w, T;
|
|
1711
1747
|
return createVNode(NListItem, {
|
|
1712
|
-
key:
|
|
1748
|
+
key: C.type + "_" + C.value,
|
|
1713
1749
|
style: "padding: 6px 0"
|
|
1714
|
-
}, { default: () => [
|
|
1715
|
-
checked:
|
|
1716
|
-
onUpdateChecked: (
|
|
1717
|
-
if (
|
|
1718
|
-
let
|
|
1719
|
-
if (
|
|
1750
|
+
}, { default: () => [C.type === "user" ? x.multiple ? createVNode(NCheckbox, {
|
|
1751
|
+
checked: E.has(C.value) || !1,
|
|
1752
|
+
onUpdateChecked: (w) => {
|
|
1753
|
+
if (w && x.max && e.length >= x.max) return;
|
|
1754
|
+
let T = [...e || []];
|
|
1755
|
+
if (w) T.push(C.value);
|
|
1720
1756
|
else {
|
|
1721
|
-
let e =
|
|
1722
|
-
|
|
1757
|
+
let e = T.indexOf(C.value);
|
|
1758
|
+
T.splice(e, 1);
|
|
1723
1759
|
}
|
|
1724
|
-
|
|
1760
|
+
S(T);
|
|
1725
1761
|
},
|
|
1726
1762
|
style: "margin-left: 3px"
|
|
1727
|
-
}, _isSlot(
|
|
1763
|
+
}, _isSlot(w = renderUsers([C], {
|
|
1728
1764
|
max: 1,
|
|
1729
1765
|
size: 24,
|
|
1730
1766
|
placement: "right",
|
|
1731
1767
|
tooltip: !1,
|
|
1732
1768
|
username: !0
|
|
1733
|
-
})) ?
|
|
1734
|
-
checked:
|
|
1769
|
+
})) ? w : { default: () => [w] }) : createVNode(NRadio, {
|
|
1770
|
+
checked: E.has(C.value) || !1,
|
|
1735
1771
|
onUpdateChecked: (e) => {
|
|
1736
|
-
|
|
1772
|
+
S(e ? [C.value] : []);
|
|
1737
1773
|
},
|
|
1738
1774
|
style: "margin-left: 3px;"
|
|
1739
|
-
}, _isSlot(
|
|
1775
|
+
}, _isSlot(T = renderUsers([C], {
|
|
1740
1776
|
max: 1,
|
|
1741
1777
|
size: 24,
|
|
1742
1778
|
placement: "right",
|
|
1743
1779
|
tooltip: !1,
|
|
1744
1780
|
username: !0
|
|
1745
|
-
})) ?
|
|
1781
|
+
})) ? T : { default: () => [T] }) : createVNode("div", {
|
|
1746
1782
|
onClick: () => {
|
|
1747
|
-
|
|
1783
|
+
F.value = !1, P.value.push(C), V(C);
|
|
1748
1784
|
},
|
|
1749
1785
|
style: "cursor: pointer; display: flex; align-items: center; gap: 8px"
|
|
1750
1786
|
}, [
|
|
1751
|
-
|
|
1787
|
+
C.type === "dept" ? createVNode(NAvatar, {
|
|
1752
1788
|
size: 24,
|
|
1753
1789
|
style: "background-color: red"
|
|
1754
1790
|
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(IDept, null, null)] })] }) : createVNode(NAvatar, {
|
|
1755
1791
|
size: 24,
|
|
1756
1792
|
style: "background-color: green"
|
|
1757
1793
|
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(IGroup, null, null)] })] }),
|
|
1758
|
-
createVNode("span", { style: "flex: 1 1 auto" }, [
|
|
1794
|
+
createVNode("span", { style: "flex: 1 1 auto" }, [C.label]),
|
|
1759
1795
|
createVNode(NIcon, null, { default: () => [createVNode(IRight, null, null)] })
|
|
1760
1796
|
])] });
|
|
1761
|
-
})) ?
|
|
1762
|
-
},
|
|
1797
|
+
})) ? T : { default: () => [T] }) : createVNode(NEmpty, null, null)]);
|
|
1798
|
+
}, W = () => createVNode(NEmpty, { description: x.placeholder }, null), G = ({ option: e }) => e.type === "user" ? createVNode("span", null, [e.nickname, createVNode("span", { style: {
|
|
1763
1799
|
opacity: .4,
|
|
1764
1800
|
marginLeft: "8px"
|
|
1765
|
-
} }, [e.username])]) : createVNode("span", null, [e.label]),
|
|
1766
|
-
key:
|
|
1767
|
-
options:
|
|
1768
|
-
renderSourceList: ({ onCheck: e, pattern:
|
|
1769
|
-
renderTargetList:
|
|
1770
|
-
renderTargetLabel:
|
|
1771
|
-
sourceFilterable:
|
|
1772
|
-
size:
|
|
1773
|
-
disabled:
|
|
1774
|
-
value:
|
|
1775
|
-
filter: (e,
|
|
1801
|
+
} }, [e.username])]) : createVNode("span", null, [e.label]), K = (e, S, C, w, T) => createVNode(NTransfer, mergeProps(e, {
|
|
1802
|
+
key: x.type,
|
|
1803
|
+
options: S,
|
|
1804
|
+
renderSourceList: ({ onCheck: e, pattern: x }) => U(C, e, x),
|
|
1805
|
+
renderTargetList: x.placeholder?.trim() && !x.modelValue?.length ? W : void 0,
|
|
1806
|
+
renderTargetLabel: G,
|
|
1807
|
+
sourceFilterable: x.filterable,
|
|
1808
|
+
size: x.size,
|
|
1809
|
+
disabled: x.disabled || void 0,
|
|
1810
|
+
value: C,
|
|
1811
|
+
filter: (e, x) => x.label.includes(e) || x.value.includes(e),
|
|
1776
1812
|
"onUpdate:value": (e) => {
|
|
1777
|
-
|
|
1813
|
+
w?.(e);
|
|
1778
1814
|
},
|
|
1779
1815
|
onUpdateValue: (e) => {
|
|
1780
|
-
|
|
1816
|
+
T?.(e);
|
|
1781
1817
|
}
|
|
1782
|
-
}), null),
|
|
1783
|
-
type:
|
|
1818
|
+
}), null), q = ({ option: e, handleClose: S }) => createVNode(NTag, {
|
|
1819
|
+
type: x.type === "user" ? "primary" : "info",
|
|
1784
1820
|
closable: !0,
|
|
1785
1821
|
onMousedown: (e) => e.preventDefault(),
|
|
1786
1822
|
onClose: (e) => {
|
|
1787
|
-
e.stopPropagation(),
|
|
1823
|
+
e.stopPropagation(), S();
|
|
1788
1824
|
}
|
|
1789
|
-
}, { default: () => [e.label] }),
|
|
1790
|
-
|
|
1791
|
-
},
|
|
1792
|
-
if (
|
|
1793
|
-
|
|
1825
|
+
}, { default: () => [e.label] }), J = (e, C = "updateModelValue") => {
|
|
1826
|
+
x.multiple ? S(C, e) : S(C, e?.[0]);
|
|
1827
|
+
}, Y = ref(), X = !1, Z = useDialog(), Q = () => {
|
|
1828
|
+
if (X) return;
|
|
1829
|
+
X = !0;
|
|
1794
1830
|
let e = shallowRef([...D.value || []]);
|
|
1795
|
-
|
|
1831
|
+
Z.create({
|
|
1796
1832
|
showIcon: !1,
|
|
1797
|
-
title:
|
|
1833
|
+
title: x.placeholder,
|
|
1798
1834
|
style: { width: "700px" },
|
|
1799
|
-
content: () => createVNode("div", { style: { height: "550px" } }, [
|
|
1800
|
-
positiveText:
|
|
1801
|
-
negativeText:
|
|
1835
|
+
content: () => createVNode("div", { style: { height: "550px" } }, [K({ style: { height: "100%" } }, x.type === "user" ? j.value : M.value, e.value, (x) => e.value = x)]),
|
|
1836
|
+
positiveText: T.value.positiveText,
|
|
1837
|
+
negativeText: T.value.negativeText,
|
|
1802
1838
|
onPositiveClick() {
|
|
1803
|
-
|
|
1839
|
+
J(e.value, "update:modelValue"), J(e.value, "updateModelValue");
|
|
1804
1840
|
},
|
|
1805
1841
|
onAfterLeave() {
|
|
1806
1842
|
nextTick(() => {
|
|
1807
|
-
|
|
1843
|
+
Y.value?.blur(), X = !1;
|
|
1808
1844
|
});
|
|
1809
1845
|
}
|
|
1810
1846
|
});
|
|
1811
|
-
}, $ = { arrow: () => createVNode(NIcon, null, { default: () => [
|
|
1847
|
+
}, $ = { arrow: () => createVNode(NIcon, null, { default: () => [x.type === "user" ? createVNode(IGroup, null, null) : createVNode(IDept, null, null)] }) };
|
|
1812
1848
|
return () => {
|
|
1813
|
-
let e =
|
|
1814
|
-
if (
|
|
1849
|
+
let e = x.type === "user" ? j.value : M.value;
|
|
1850
|
+
if (x.selectType === "dropdown" && x.type === "dept") return createVNode(NTreeSelect, {
|
|
1815
1851
|
options: e,
|
|
1816
1852
|
keyField: "value",
|
|
1817
|
-
defaultExpandAll:
|
|
1818
|
-
checkable:
|
|
1819
|
-
multiple:
|
|
1820
|
-
filter: (e,
|
|
1821
|
-
value:
|
|
1853
|
+
defaultExpandAll: x.defaultExpandAll,
|
|
1854
|
+
checkable: x.multiple,
|
|
1855
|
+
multiple: x.multiple,
|
|
1856
|
+
filter: (e, x) => x.label.includes(e) || x.value.includes(e),
|
|
1857
|
+
value: x.modelValue,
|
|
1822
1858
|
onUpdateValue: (e) => {
|
|
1823
|
-
|
|
1859
|
+
x.multiple && x.max && e?.length > x.max || S("updateModelValue", e);
|
|
1824
1860
|
},
|
|
1825
1861
|
"onUpdate:value": (e) => {
|
|
1826
|
-
|
|
1862
|
+
x.multiple && x.max && e?.length > x.max || S("update:modelValue", e);
|
|
1827
1863
|
}
|
|
1828
1864
|
}, _isSlot($) ? $ : { default: () => [$] });
|
|
1829
|
-
if (
|
|
1830
|
-
let
|
|
1831
|
-
return createVNode(NSelect, mergeProps(
|
|
1832
|
-
key:
|
|
1833
|
-
ref:
|
|
1834
|
-
show:
|
|
1835
|
-
filterable:
|
|
1865
|
+
if (x.selectType === "transfer") return K(C, e, D.value, (e) => J(e, "update:modelValue"), (e) => J(e, "updateModelValue"));
|
|
1866
|
+
let w = x.selectType === "dropdown";
|
|
1867
|
+
return createVNode(NSelect, mergeProps(C, {
|
|
1868
|
+
key: x.type,
|
|
1869
|
+
ref: Y,
|
|
1870
|
+
show: w ? void 0 : !1,
|
|
1871
|
+
filterable: w ? x.filterable : !1,
|
|
1836
1872
|
options: e,
|
|
1837
|
-
multiple:
|
|
1838
|
-
size:
|
|
1839
|
-
placeholder:
|
|
1840
|
-
disabled:
|
|
1841
|
-
value:
|
|
1842
|
-
renderTag:
|
|
1843
|
-
onFocus:
|
|
1873
|
+
multiple: x.multiple,
|
|
1874
|
+
size: x.size,
|
|
1875
|
+
placeholder: x.placeholder,
|
|
1876
|
+
disabled: x.disabled || void 0,
|
|
1877
|
+
value: x.modelValue,
|
|
1878
|
+
renderTag: x.multiple ? q : void 0,
|
|
1879
|
+
onFocus: w ? void 0 : Q,
|
|
1844
1880
|
onUpdateValue: (e) => {
|
|
1845
|
-
|
|
1881
|
+
S("updateModelValue", e);
|
|
1846
1882
|
},
|
|
1847
1883
|
"onUpdate:value": (e) => {
|
|
1848
|
-
|
|
1884
|
+
S("update:modelValue", e);
|
|
1849
1885
|
}
|
|
1850
1886
|
}), _isSlot($) ? $ : { default: () => [$] });
|
|
1851
1887
|
};
|
|
1852
1888
|
}
|
|
1853
1889
|
});
|
|
1854
|
-
function renderUser(e,
|
|
1855
|
-
let
|
|
1856
|
-
return /^[\u4E00-\u9FA5]+$/.test(
|
|
1890
|
+
function renderUser(e, x, { placement: S, size: C, tooltip: w = !0, username: T = !1 }) {
|
|
1891
|
+
let E = e.nickname.split(" ").at(-1), D = E;
|
|
1892
|
+
return /^[\u4E00-\u9FA5]+$/.test(E) ? D = E.length >= 3 ? E.slice(-2) : E : E.length > 4 && (D = createVNode(NIcon, null, { default: () => [createVNode(IAccount, null, null)] })), createVNode(NPopover, {
|
|
1857
1893
|
key: e.username,
|
|
1858
1894
|
raw: !0,
|
|
1859
|
-
placement:
|
|
1860
|
-
disabled:
|
|
1895
|
+
placement: S,
|
|
1896
|
+
disabled: w === !1
|
|
1861
1897
|
}, {
|
|
1862
1898
|
default: () => createVNode(NCard, {
|
|
1863
1899
|
style: "width: 200px",
|
|
1864
1900
|
size: "small"
|
|
1865
1901
|
}, { default: () => [createVNode(NH4, null, { default: () => [e.nickname] }), createVNode("span", null, [e.username])] }),
|
|
1866
1902
|
trigger: () => {
|
|
1867
|
-
let
|
|
1903
|
+
let S = createVNode(NAvatar, {
|
|
1868
1904
|
color: "var(--color-primary)",
|
|
1869
1905
|
round: !0,
|
|
1870
|
-
size:
|
|
1871
|
-
style:
|
|
1906
|
+
size: C,
|
|
1907
|
+
style: x ? {
|
|
1872
1908
|
position: "absolute",
|
|
1873
|
-
bottom: -(
|
|
1909
|
+
bottom: -(C - 16) / 2 + "px"
|
|
1874
1910
|
} : ""
|
|
1875
|
-
}, _isSlot(
|
|
1876
|
-
return
|
|
1911
|
+
}, _isSlot(D) ? D : { default: () => [D] });
|
|
1912
|
+
return x ? createVNode("div", { style: x ? {
|
|
1877
1913
|
display: "inline-flex",
|
|
1878
1914
|
itemsAlign: "center",
|
|
1879
1915
|
whiteSpace: "nowrap",
|
|
1880
|
-
minWidth:
|
|
1881
|
-
height:
|
|
1882
|
-
} : "" }, [
|
|
1916
|
+
minWidth: C + "px",
|
|
1917
|
+
height: C + "px"
|
|
1918
|
+
} : "" }, [S, x ? createVNode(Fragment, null, [createVNode("span", { style: { marginLeft: C + 6 + "px" } }, [e.nickname]), T ? createVNode("span", { style: {
|
|
1883
1919
|
marginLeft: "8px",
|
|
1884
1920
|
opacity: .4
|
|
1885
|
-
} }, [e.username]) : void 0]) : void 0]) :
|
|
1921
|
+
} }, [e.username]) : void 0]) : void 0]) : S;
|
|
1886
1922
|
}
|
|
1887
1923
|
});
|
|
1888
1924
|
}
|
|
1889
|
-
function renderUsers(e,
|
|
1890
|
-
|
|
1891
|
-
let { max:
|
|
1892
|
-
return e.length <= 1 ? createVNode("span", { style: "position: relative" }, [e.map((e) => renderUser(e, !0,
|
|
1925
|
+
function renderUsers(e, x = {}) {
|
|
1926
|
+
x.size ||= 24, x.max ||= 4;
|
|
1927
|
+
let { max: S, size: C } = x;
|
|
1928
|
+
return e.length <= 1 ? createVNode("span", { style: "position: relative" }, [e.map((e) => renderUser(e, !0, x))]) : createVNode("span", { style: {
|
|
1893
1929
|
display: "inline-block",
|
|
1894
|
-
height:
|
|
1930
|
+
height: C + "px"
|
|
1895
1931
|
} }, [createVNode(NAvatarGroup, {
|
|
1896
1932
|
options: e,
|
|
1897
|
-
size:
|
|
1898
|
-
max:
|
|
1933
|
+
size: C,
|
|
1934
|
+
max: S || 4,
|
|
1899
1935
|
style: "top: -2px"
|
|
1900
1936
|
}, {
|
|
1901
|
-
avatar: ({ option: e }) => renderUser(e, !1,
|
|
1902
|
-
rest: ({ options: e, rest:
|
|
1937
|
+
avatar: ({ option: e }) => renderUser(e, !1, x),
|
|
1938
|
+
rest: ({ options: e, rest: x }) => createVNode(NDropdown, {
|
|
1903
1939
|
options: e,
|
|
1904
1940
|
keyField: "username",
|
|
1905
1941
|
labelField: "nickname",
|
|
1906
|
-
renderOption: ({ option:
|
|
1907
|
-
}, { default: () => [createVNode(NAvatar, null, { default: () => [createTextVNode("+"),
|
|
1942
|
+
renderOption: ({ option: x }) => renderUser(x, !1, e)
|
|
1943
|
+
}, { default: () => [createVNode(NAvatar, null, { default: () => [createTextVNode("+"), x] })] })
|
|
1908
1944
|
})]);
|
|
1909
1945
|
}
|
|
1910
1946
|
const DtDeptRender = /* @__PURE__ */ defineComponent({
|
|
@@ -1915,18 +1951,18 @@ const DtDeptRender = /* @__PURE__ */ defineComponent({
|
|
|
1915
1951
|
getDeptsByCode: Function
|
|
1916
1952
|
},
|
|
1917
1953
|
setup(e) {
|
|
1918
|
-
let
|
|
1919
|
-
return watch([() => e.modelValue, () => e.multiple], ([
|
|
1920
|
-
|
|
1921
|
-
let
|
|
1922
|
-
for (let [e,
|
|
1923
|
-
code:
|
|
1924
|
-
name:
|
|
1925
|
-
}),
|
|
1926
|
-
|
|
1927
|
-
for (let
|
|
1954
|
+
let x = ref([]), S = {};
|
|
1955
|
+
return watch([() => e.modelValue, () => e.multiple], ([C, w]) => {
|
|
1956
|
+
x.value = [];
|
|
1957
|
+
let T = C ? w ? Array.isArray(C) ? C : C.trim() ? C.trim().split(",") : [] : [C] : [], E = [];
|
|
1958
|
+
for (let [e, C] of T.entries()) S[C] || (S[C] = reactive({
|
|
1959
|
+
code: C,
|
|
1960
|
+
name: C
|
|
1961
|
+
}), E.push(C)), x.value[e] = S[C];
|
|
1962
|
+
E.length > 0 && e.getDeptsByCode(E).then((e) => {
|
|
1963
|
+
for (let x of e) Object.assign(S[x.code], x);
|
|
1928
1964
|
});
|
|
1929
|
-
}, { immediate: !0 }), () =>
|
|
1965
|
+
}, { immediate: !0 }), () => x.value.map((e) => createVNode(NTag, { key: e.code }, { default: () => [e.name] }));
|
|
1930
1966
|
}
|
|
1931
1967
|
}), DtUserRender = /* @__PURE__ */ defineComponent({
|
|
1932
1968
|
name: "UserRender",
|
|
@@ -1939,18 +1975,18 @@ const DtDeptRender = /* @__PURE__ */ defineComponent({
|
|
|
1939
1975
|
getUsersByUsername: Function
|
|
1940
1976
|
},
|
|
1941
1977
|
setup(e) {
|
|
1942
|
-
let
|
|
1943
|
-
return watch([() => e.modelValue, () => e.multiple], ([
|
|
1944
|
-
|
|
1945
|
-
let
|
|
1946
|
-
for (let [e,
|
|
1947
|
-
code:
|
|
1948
|
-
name:
|
|
1949
|
-
}),
|
|
1950
|
-
|
|
1951
|
-
for (let
|
|
1978
|
+
let x = ref([]), S = {};
|
|
1979
|
+
return watch([() => e.modelValue, () => e.multiple], ([C, w]) => {
|
|
1980
|
+
x.value = [];
|
|
1981
|
+
let T = C ? w ? Array.isArray(C) ? C : C.trim() ? C.trim().split(",") : [] : [C] : [], E = [];
|
|
1982
|
+
for (let [e, C] of T.entries()) S[C] || (S[C] = reactive({
|
|
1983
|
+
code: C,
|
|
1984
|
+
name: C
|
|
1985
|
+
}), E.push(C)), x.value[e] = S[C];
|
|
1986
|
+
E.length > 0 && e.getUsersByUsername(E).then((e) => {
|
|
1987
|
+
for (let x of e) Object.assign(S[x.code], x);
|
|
1952
1988
|
});
|
|
1953
|
-
}, { immediate: !0 }), () => renderUsers(
|
|
1989
|
+
}, { immediate: !0 }), () => renderUsers(x.value, e);
|
|
1954
1990
|
}
|
|
1955
1991
|
}), StateButtonProps = {
|
|
1956
1992
|
disabled: {
|
|
@@ -1984,15 +2020,15 @@ const DtDeptRender = /* @__PURE__ */ defineComponent({
|
|
|
1984
2020
|
}, NStateButton = /* @__PURE__ */ defineComponent({
|
|
1985
2021
|
name: "StateButton",
|
|
1986
2022
|
props: StateButtonProps,
|
|
1987
|
-
setup(e, { slots:
|
|
2023
|
+
setup(e, { slots: x }) {
|
|
1988
2024
|
return () => {
|
|
1989
|
-
let { type:
|
|
2025
|
+
let { type: S, disabled: C, succeeded: w, successText: T, failureText: E } = e;
|
|
1990
2026
|
return createVNode(NButton, {
|
|
1991
|
-
type:
|
|
1992
|
-
disabled: typeof
|
|
2027
|
+
type: w ? "success" : w === !1 ? "error" : S,
|
|
2028
|
+
disabled: typeof w == "boolean" ? !0 : C
|
|
1993
2029
|
}, {
|
|
1994
|
-
default: () => (
|
|
1995
|
-
icon: () =>
|
|
2030
|
+
default: () => (w ? x.success ? x.success() : T : w === !1 ? x.failure ? x.failure() : E : x.default?.()) ?? x.default(),
|
|
2031
|
+
icon: () => w ? x.successIcon ? x.successIcon() : createVNode(NIcon, null, { default: () => [createVNode(ICheck, null, null)] }) : w === !1 ? x.failureIcon ? x.failureIcon() : createVNode(NIcon, null, { default: () => [createVNode(IClose, null, null)] }) : x.icon?.()
|
|
1996
2032
|
});
|
|
1997
2033
|
};
|
|
1998
2034
|
}
|