@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.
- package/dist/{components-BC8oa62b.js → components-CTdt73l6.js} +523 -499
- package/dist/components.js +1 -1
- package/dist/page.js +34 -28
- package/esm/components.d.ts +9 -1
- package/esm/page.d.ts +2 -2
- package/package.json +1 -1
|
@@ -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(
|
|
67
|
-
let { t:
|
|
68
|
-
watch(() =>
|
|
69
|
-
let
|
|
70
|
-
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
},
|
|
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(
|
|
76
|
-
value:
|
|
77
|
-
onUpdateValue:
|
|
76
|
+
let e = createVNode(NCheckboxGroup, mergeProps(C, {
|
|
77
|
+
value: E.value,
|
|
78
|
+
onUpdateValue: D
|
|
78
79
|
}), { default: () => [createVNode(NFlex, {
|
|
79
|
-
size:
|
|
80
|
-
vertical:
|
|
81
|
-
style: !
|
|
82
|
-
}, { default: () => [
|
|
83
|
-
value: e[
|
|
84
|
-
disabled: e[
|
|
85
|
-
style:
|
|
86
|
-
}, { default: () => [e[
|
|
87
|
-
return
|
|
88
|
-
size:
|
|
89
|
-
vertical:
|
|
90
|
-
style:
|
|
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:
|
|
93
|
-
checked:
|
|
94
|
-
onUpdateChecked:
|
|
95
|
-
style:
|
|
96
|
-
}, { default: () => [
|
|
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)]),
|
|
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)]),
|
|
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
|
|
239
|
-
|
|
240
|
-
},
|
|
241
|
-
|
|
242
|
-
},
|
|
243
|
-
e || (
|
|
244
|
-
},
|
|
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
|
-
}))),
|
|
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] }),
|
|
259
|
-
|
|
279
|
+
}, { default: () => [e.text] }), N = (e, x) => {
|
|
280
|
+
x.onClick?.();
|
|
260
281
|
};
|
|
261
|
-
return () => createVNode(VResizeObserver, { onResize:
|
|
262
|
-
ref:
|
|
263
|
-
getCounter:
|
|
264
|
-
onUpdateCount:
|
|
265
|
-
onUpdateOverflow:
|
|
266
|
-
updateCounter:
|
|
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:
|
|
305
|
+
ref: w,
|
|
285
306
|
style: "position: absolute"
|
|
286
307
|
}, [createVNode(NDropdown, {
|
|
287
|
-
options:
|
|
288
|
-
renderLabel:
|
|
289
|
-
onSelect:
|
|
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:
|
|
331
|
+
setup(e, { emit: x }) {
|
|
311
332
|
return () => {
|
|
312
|
-
let
|
|
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) =>
|
|
347
|
+
onUpdateChecked: (e) => x("update-hidden", !e)
|
|
327
348
|
}, null),
|
|
328
|
-
createVNode(NEllipsis, { style: "flex: 1 1 auto" }, _isSlot$6(
|
|
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: () =>
|
|
333
|
-
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(
|
|
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: () =>
|
|
337
|
-
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(
|
|
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(
|
|
386
|
-
let { t:
|
|
387
|
-
function
|
|
388
|
-
|
|
389
|
-
key: e[
|
|
390
|
-
[
|
|
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
|
|
394
|
-
return watch(
|
|
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
|
|
402
|
-
|
|
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:
|
|
415
|
-
}, { default: () => [createVNode(NIcon, { size:
|
|
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,
|
|
418
|
-
return createVNode(NFlex, { vertical: !0 }, { default: () => [createVNode(NFlex, { justify: "space-between" }, { default: () => [createVNode("div", { style: "font-weight: bold" }, [
|
|
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: () =>
|
|
423
|
-
}, _isSlot$6(e =
|
|
424
|
-
ref:
|
|
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(
|
|
427
|
-
key: e[
|
|
428
|
-
label: e[
|
|
429
|
-
hidden: e[
|
|
430
|
-
fixed: e[
|
|
431
|
-
showFixed:
|
|
432
|
-
onUpdateHidden: (
|
|
433
|
-
onUpdateFixed: (
|
|
434
|
-
}, null))) ?
|
|
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(
|
|
541
|
-
let { t:
|
|
542
|
-
e?.preventDefault?.(),
|
|
543
|
-
},
|
|
544
|
-
e?.preventDefault?.(),
|
|
545
|
-
},
|
|
546
|
-
e?.preventDefault?.(),
|
|
547
|
-
},
|
|
548
|
-
return watchDebounced([
|
|
549
|
-
|
|
550
|
-
|
|
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:
|
|
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:
|
|
559
|
-
labelAlign:
|
|
560
|
-
onReset:
|
|
561
|
-
onSubmit:
|
|
562
|
-
showFeedback:
|
|
563
|
-
},
|
|
564
|
-
ref:
|
|
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
|
-
},
|
|
567
|
-
let
|
|
568
|
-
return createVNode(Fragment, null, [e.map(({ hidden: e, name:
|
|
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
|
-
|
|
571
|
-
let
|
|
572
|
-
return
|
|
573
|
-
path:
|
|
574
|
-
validationStatus:
|
|
575
|
-
showRequireMark:
|
|
576
|
-
},
|
|
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:
|
|
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(
|
|
582
|
-
|
|
583
|
-
default: () => toValue(
|
|
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
|
-
|
|
610
|
+
x.showColon && E !== !1 ? createVNode("span", { style: "place-self: center" }, [createTextVNode(":")]) : void 0
|
|
590
611
|
] }),
|
|
591
612
|
default: () => {
|
|
592
|
-
let e,
|
|
593
|
-
disabled:
|
|
594
|
-
size:
|
|
595
|
-
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
|
|
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(
|
|
621
|
+
}, _isSlot$5(e = toValue(j)) ? e : { default: () => [e] })]) : S;
|
|
601
622
|
},
|
|
602
|
-
feedback: () =>
|
|
603
|
-
}),
|
|
604
|
-
key:
|
|
605
|
-
offset:
|
|
606
|
-
span:
|
|
607
|
-
style:
|
|
608
|
-
}, _isSlot$5(
|
|
609
|
-
}),
|
|
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
|
|
613
|
-
cols:
|
|
614
|
-
spans:
|
|
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:
|
|
618
|
-
showLabel:
|
|
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:
|
|
642
|
+
justify: x.actionAlign,
|
|
622
643
|
align: "center"
|
|
623
644
|
}, { default: () => [
|
|
624
|
-
|
|
645
|
+
x.showSubmitBtn === !1 ? void 0 : createVNode(NButton, {
|
|
625
646
|
attrType: "submit",
|
|
626
|
-
type:
|
|
627
|
-
disabled:
|
|
628
|
-
loading:
|
|
647
|
+
type: K ? "success" : "primary",
|
|
648
|
+
disabled: K || x.disabled || x.submitDisabled || S,
|
|
649
|
+
loading: S
|
|
629
650
|
}, {
|
|
630
|
-
default: () => (
|
|
631
|
-
icon: () =>
|
|
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
|
-
|
|
654
|
+
x.showResetBtn === !1 ? void 0 : createVNode(NButton, {
|
|
634
655
|
attrType: "reset",
|
|
635
|
-
disabled:
|
|
636
|
-
type:
|
|
637
|
-
secondary:
|
|
638
|
-
}, { default: () => [
|
|
639
|
-
|
|
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:
|
|
642
|
-
onClick:
|
|
643
|
-
}, { default: () => [
|
|
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(
|
|
709
|
-
let { t:
|
|
710
|
-
|
|
711
|
-
},
|
|
712
|
-
|
|
713
|
-
},
|
|
714
|
-
|
|
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
|
-
|
|
717
|
-
let
|
|
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:
|
|
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
|
-
...
|
|
728
|
-
collapsed:
|
|
729
|
-
} },
|
|
748
|
+
...I,
|
|
749
|
+
collapsed: D.value
|
|
750
|
+
} }, L, {
|
|
730
751
|
showFeedback: !1,
|
|
731
|
-
showAction:
|
|
732
|
-
onSubmit:
|
|
733
|
-
onReset:
|
|
734
|
-
}), { action: ({ cols: e, spans:
|
|
735
|
-
justify:
|
|
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
|
-
|
|
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:
|
|
743
|
-
loading:
|
|
744
|
-
}, { default: () => [
|
|
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:
|
|
748
|
-
}, { default: () => [
|
|
749
|
-
|
|
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:
|
|
753
|
-
onCustom: (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
|
-
|
|
778
|
+
F && A.suffix ? createVNode(NButton, {
|
|
758
779
|
text: !0,
|
|
759
780
|
type: "primary",
|
|
760
781
|
iconPlacement: "right",
|
|
761
|
-
renderIcon:
|
|
762
|
-
onClick: () =>
|
|
763
|
-
}, { default: () => [
|
|
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(
|
|
772
|
-
let { t:
|
|
773
|
-
title:
|
|
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:
|
|
776
|
-
items: ({ it: e }) =>
|
|
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:
|
|
799
|
+
required: x.required,
|
|
779
800
|
inputProps: {
|
|
780
|
-
readonly:
|
|
801
|
+
readonly: T,
|
|
781
802
|
clearable: !0,
|
|
782
803
|
type: "textarea",
|
|
783
804
|
showCount: !0,
|
|
784
805
|
autosize: {
|
|
785
|
-
minRows: unref(
|
|
786
|
-
maxRows: Math.max(unref(
|
|
806
|
+
minRows: unref(C),
|
|
807
|
+
maxRows: Math.max(unref(C), 5)
|
|
787
808
|
}
|
|
788
809
|
}
|
|
789
810
|
})),
|
|
790
|
-
onSubmit:
|
|
811
|
+
onSubmit: S
|
|
791
812
|
});
|
|
792
813
|
return {
|
|
793
|
-
open: (e,
|
|
814
|
+
open: (e, x = !1) => (T.value = x, D(e)),
|
|
794
815
|
setSupports: (e) => {
|
|
795
|
-
|
|
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:
|
|
833
|
-
let
|
|
834
|
-
|
|
853
|
+
setup(e, { emit: x }) {
|
|
854
|
+
let S = (S) => {
|
|
855
|
+
S = {
|
|
835
856
|
...e.modelValue,
|
|
836
|
-
[e.showLang ?? e.defaultLang]:
|
|
837
|
-
},
|
|
838
|
-
}, { open:
|
|
839
|
-
|
|
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,
|
|
842
|
-
let
|
|
862
|
+
watch(() => e.supports, w, { immediate: !0 });
|
|
863
|
+
let T = { suffix: () => createVNode(NButton, {
|
|
843
864
|
quaternary: !0,
|
|
844
|
-
onClick: () =>
|
|
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)] })] }) },
|
|
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:
|
|
873
|
+
onUpdateValue: S,
|
|
853
874
|
disabled: e.disabled,
|
|
854
875
|
clearable: !0,
|
|
855
|
-
style:
|
|
876
|
+
style: E,
|
|
856
877
|
type: e.defaultRows > 1 ? "textarea" : "text",
|
|
857
878
|
rows: e.defaultRows
|
|
858
|
-
}, _isSlot$4(
|
|
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(
|
|
882
|
-
let { t:
|
|
883
|
-
pageSize:
|
|
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
|
-
}),
|
|
906
|
+
}), T = (e) => S("change", {
|
|
886
907
|
pageSize: e,
|
|
887
|
-
currentPage:
|
|
908
|
+
currentPage: x.currentPage ?? x.page?.currentPage ?? 0
|
|
888
909
|
});
|
|
889
910
|
return () => createVNode(NPagination, {
|
|
890
|
-
page:
|
|
891
|
-
itemCount:
|
|
892
|
-
pageSize:
|
|
893
|
-
onUpdatePage:
|
|
894
|
-
onUpdatePageSize:
|
|
895
|
-
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: () =>
|
|
901
|
-
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(
|
|
925
|
-
let { t:
|
|
945
|
+
setup(x, { emit: S }) {
|
|
946
|
+
let { t: C } = useI18n();
|
|
926
947
|
return () => {
|
|
927
948
|
let e;
|
|
928
|
-
return
|
|
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, [
|
|
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
|
-
|
|
958
|
+
S("update:modelValue", x.modelValue === "all" ? "selection" : "all");
|
|
938
959
|
}
|
|
939
|
-
}, { default: () => [
|
|
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
|
-
|
|
964
|
+
S("clear"), S("update:modelValue", "all");
|
|
944
965
|
}
|
|
945
|
-
}, _isSlot$3(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,
|
|
974
|
+
function _map(e, S) {
|
|
954
975
|
return (e ?? []).map((e) => {
|
|
955
|
-
let
|
|
976
|
+
let C = {
|
|
956
977
|
csvTitle: e.exportTitle,
|
|
957
978
|
...e,
|
|
958
979
|
title: () => {
|
|
959
|
-
let
|
|
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: () => [
|
|
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
|
-
})] }) :
|
|
997
|
+
})] }) : C;
|
|
977
998
|
}
|
|
978
999
|
};
|
|
979
|
-
if (e.children?.length)
|
|
1000
|
+
if (e.children?.length) C.children = _map(e.children, S);
|
|
980
1001
|
else {
|
|
981
|
-
e.hidden !== !0 && (
|
|
982
|
-
let
|
|
983
|
-
e.ellipsis !== !1 && (
|
|
984
|
-
let
|
|
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(
|
|
993
|
-
}, e.ellipsisTooltip === !0 && (
|
|
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 ? (
|
|
1018
|
+
disabled: e.selectable ? (x) => e.selectable(x) === !1 : void 0
|
|
998
1019
|
});
|
|
999
1020
|
}
|
|
1000
|
-
return
|
|
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:
|
|
1039
|
-
let { keyField:
|
|
1040
|
-
useStyle("-datatable", style,
|
|
1041
|
-
let
|
|
1042
|
-
e ==
|
|
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 }),
|
|
1045
|
-
let
|
|
1046
|
-
let
|
|
1047
|
-
return (e) => e[
|
|
1048
|
-
}),
|
|
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(
|
|
1055
|
-
|
|
1056
|
-
let
|
|
1057
|
-
|
|
1058
|
-
let
|
|
1059
|
-
if (
|
|
1060
|
-
let
|
|
1061
|
-
|
|
1062
|
-
top:
|
|
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
|
|
1067
|
-
}),
|
|
1068
|
-
let
|
|
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
|
-
|
|
1091
|
+
F.value = 0, R.value = _map(e.columns, F);
|
|
1071
1092
|
}, {
|
|
1072
1093
|
immediate: !0,
|
|
1073
1094
|
deep: 1
|
|
1074
1095
|
});
|
|
1075
|
-
let
|
|
1096
|
+
let z = ref();
|
|
1076
1097
|
watch(() => e.highlight, (e) => {
|
|
1077
|
-
|
|
1098
|
+
z.value = typeof e == "boolean" ? null : e ?? null;
|
|
1078
1099
|
}, { immediate: !0 });
|
|
1079
|
-
let
|
|
1080
|
-
e.rowClassName?.(
|
|
1081
|
-
`${
|
|
1082
|
-
|
|
1083
|
-
].join(" ")),
|
|
1084
|
-
let
|
|
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
|
-
...
|
|
1087
|
-
onClick: (
|
|
1088
|
-
let
|
|
1089
|
-
e.highlight === !0 && (
|
|
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
|
-
}),
|
|
1113
|
+
}), W = (x) => {
|
|
1093
1114
|
if (e.sorter) {
|
|
1094
|
-
let { sortField:
|
|
1095
|
-
if (
|
|
1115
|
+
let { sortField: S, sortOrder: C } = e.sorter;
|
|
1116
|
+
if (x?.columnKey == S && (x?.order ? x.order === C + "end" : !C)) return;
|
|
1096
1117
|
}
|
|
1097
|
-
|
|
1098
|
-
sortField:
|
|
1099
|
-
sortOrder:
|
|
1118
|
+
w("sort", {
|
|
1119
|
+
sortField: x?.order ? x?.columnKey : void 0,
|
|
1120
|
+
sortOrder: x?.order ? x.order.replace("end", "") : void 0
|
|
1100
1121
|
});
|
|
1101
|
-
},
|
|
1102
|
-
|
|
1103
|
-
},
|
|
1104
|
-
|
|
1105
|
-
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:
|
|
1131
|
+
class: k,
|
|
1111
1132
|
data: e.data,
|
|
1112
|
-
columns:
|
|
1113
|
-
rowKey:
|
|
1133
|
+
columns: R.value,
|
|
1134
|
+
rowKey: N.value,
|
|
1114
1135
|
tableLayout: "fixed",
|
|
1115
1136
|
ref: "table-ref",
|
|
1116
|
-
scrollX:
|
|
1117
|
-
rowClassName:
|
|
1118
|
-
rowProps:
|
|
1137
|
+
scrollX: F.value,
|
|
1138
|
+
rowClassName: B.value,
|
|
1139
|
+
rowProps: V.value,
|
|
1119
1140
|
checkedRowKeys: e.selectedKeys,
|
|
1120
|
-
onUpdateSorter:
|
|
1121
|
-
onUpdateCheckedRowKeys:
|
|
1122
|
-
onUnstableColumnResize:
|
|
1123
|
-
}, _isSlot$2(
|
|
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:
|
|
1128
|
-
watch([ref(
|
|
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
|
|
1132
|
-
if (!
|
|
1133
|
-
let
|
|
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
|
-
...
|
|
1156
|
+
...C,
|
|
1136
1157
|
onSort(e) {
|
|
1137
|
-
|
|
1158
|
+
S({
|
|
1138
1159
|
from: e.oldIndex,
|
|
1139
1160
|
to: e.newIndex
|
|
1140
1161
|
});
|
|
1141
1162
|
}
|
|
1142
1163
|
});
|
|
1143
1164
|
return () => {
|
|
1144
|
-
|
|
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(
|
|
1204
|
-
let { t:
|
|
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
|
-
} : {}),
|
|
1208
|
-
|
|
1228
|
+
} : {}), E = (e) => {
|
|
1229
|
+
S("update:modelValue", e), S("updateModelValue", e);
|
|
1209
1230
|
};
|
|
1210
1231
|
return () => {
|
|
1211
|
-
let e =
|
|
1212
|
-
let
|
|
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:
|
|
1215
|
-
disabled:
|
|
1216
|
-
style:
|
|
1217
|
-
paddingLeft:
|
|
1218
|
-
paddingRight:
|
|
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: () => [
|
|
1221
|
-
default: () =>
|
|
1222
|
-
trigger: () =>
|
|
1223
|
-
}) :
|
|
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:
|
|
1227
|
-
...
|
|
1247
|
+
style: x.vertical ? {
|
|
1248
|
+
...T.value,
|
|
1228
1249
|
padding: "6px 0 0"
|
|
1229
|
-
} :
|
|
1230
|
-
value:
|
|
1231
|
-
onUpdateValue:
|
|
1232
|
-
}, { default: () => [
|
|
1233
|
-
size:
|
|
1234
|
-
vertical:
|
|
1235
|
-
}, _isSlot$1(
|
|
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(
|
|
1309
|
-
let { t:
|
|
1310
|
-
if (
|
|
1311
|
-
let e =
|
|
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
|
-
}),
|
|
1314
|
-
watch(() =>
|
|
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.
|
|
1317
|
-
}),
|
|
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
|
|
1320
|
-
...
|
|
1321
|
-
...
|
|
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
|
-
...
|
|
1327
|
-
]),
|
|
1328
|
-
let
|
|
1329
|
-
for (let e of
|
|
1330
|
-
|
|
1331
|
-
let
|
|
1332
|
-
return
|
|
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.
|
|
1357
|
+
value: e[E.value],
|
|
1336
1358
|
type: "user"
|
|
1337
1359
|
};
|
|
1338
1360
|
})];
|
|
1339
|
-
},
|
|
1340
|
-
let
|
|
1341
|
-
if (
|
|
1342
|
-
data:
|
|
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:
|
|
1346
|
-
checkable:
|
|
1347
|
-
selectable: !
|
|
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:
|
|
1352
|
-
filter: (e,
|
|
1353
|
-
checkedKeys:
|
|
1354
|
-
selectedKeys:
|
|
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
|
-
|
|
1378
|
+
x.max && e?.length > x.max || S(e);
|
|
1357
1379
|
},
|
|
1358
1380
|
onUpdateSelectedKeys: (e) => {
|
|
1359
|
-
|
|
1381
|
+
S(e);
|
|
1360
1382
|
}
|
|
1361
1383
|
}, null);
|
|
1362
|
-
let
|
|
1363
|
-
if (e && !
|
|
1364
|
-
let
|
|
1365
|
-
|
|
1366
|
-
let
|
|
1367
|
-
return createVNode(Fragment, null, [createVNode("div", { style: "margin: 12px 16px; display: flex; justify-content: space-between; align-items: center" }, [
|
|
1368
|
-
|
|
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
|
-
|
|
1392
|
+
k.at(-1).label
|
|
1371
1393
|
]), createVNode(NButton, {
|
|
1372
1394
|
text: !0,
|
|
1373
1395
|
type: "warning",
|
|
1374
1396
|
onClick: () => {
|
|
1375
|
-
if (
|
|
1376
|
-
else for (let e of
|
|
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)] }),
|
|
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(
|
|
1382
|
-
let
|
|
1403
|
+
}, _isSlot(T = O.map((C) => {
|
|
1404
|
+
let w, T;
|
|
1383
1405
|
return createVNode(NListItem, {
|
|
1384
|
-
key:
|
|
1406
|
+
key: C.type + "_" + C.value,
|
|
1385
1407
|
style: "padding: 6px 0"
|
|
1386
|
-
}, { default: () => [
|
|
1387
|
-
checked:
|
|
1388
|
-
onUpdateChecked: (
|
|
1389
|
-
if (
|
|
1390
|
-
let
|
|
1391
|
-
if (
|
|
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 =
|
|
1394
|
-
|
|
1415
|
+
let e = T.indexOf(C.value);
|
|
1416
|
+
T.splice(e, 1);
|
|
1395
1417
|
}
|
|
1396
|
-
T
|
|
1418
|
+
S(T);
|
|
1397
1419
|
},
|
|
1398
1420
|
style: "margin-left: 3px"
|
|
1399
|
-
}, _isSlot(
|
|
1421
|
+
}, _isSlot(w = renderUsers([C], {
|
|
1400
1422
|
max: 1,
|
|
1401
1423
|
size: 24,
|
|
1402
1424
|
placement: "right"
|
|
1403
|
-
})) ?
|
|
1404
|
-
checked:
|
|
1425
|
+
})) ? w : { default: () => [w] }) : createVNode(NRadio, {
|
|
1426
|
+
checked: E.has(C.value) || !1,
|
|
1405
1427
|
onUpdateChecked: (e) => {
|
|
1406
|
-
|
|
1428
|
+
S(e ? [C.value] : []);
|
|
1407
1429
|
},
|
|
1408
1430
|
style: "margin-left: 3px"
|
|
1409
|
-
}, _isSlot(
|
|
1431
|
+
}, _isSlot(T = renderUsers([C], {
|
|
1410
1432
|
max: 1,
|
|
1411
1433
|
size: 24,
|
|
1412
1434
|
placement: "right"
|
|
1413
|
-
})) ?
|
|
1435
|
+
})) ? T : { default: () => [T] }) : createVNode("div", {
|
|
1414
1436
|
onClick: () => {
|
|
1415
|
-
|
|
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
|
-
|
|
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" }, [
|
|
1448
|
+
createVNode("span", { style: "flex: 1 1 auto" }, [C.label]),
|
|
1427
1449
|
createVNode(NIcon, null, { default: () => [createVNode(IRight, null, null)] })
|
|
1428
1450
|
])] });
|
|
1429
|
-
})) ?
|
|
1430
|
-
}, G = () => createVNode(NEmpty, { description:
|
|
1431
|
-
key:
|
|
1432
|
-
options:
|
|
1433
|
-
renderSourceList: ({ onCheck: e, pattern:
|
|
1434
|
-
renderTargetList:
|
|
1435
|
-
sourceFilterable:
|
|
1436
|
-
size:
|
|
1437
|
-
disabled:
|
|
1438
|
-
value:
|
|
1439
|
-
filter: (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
|
-
|
|
1463
|
+
w?.(e);
|
|
1442
1464
|
},
|
|
1443
1465
|
onUpdateValue: (e) => {
|
|
1444
|
-
|
|
1466
|
+
T?.(e);
|
|
1445
1467
|
}
|
|
1446
|
-
}), null),
|
|
1447
|
-
type:
|
|
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(),
|
|
1473
|
+
e.stopPropagation(), S();
|
|
1452
1474
|
}
|
|
1453
|
-
}, { default: () => [e.label] }),
|
|
1454
|
-
|
|
1455
|
-
},
|
|
1456
|
-
if (
|
|
1457
|
-
|
|
1458
|
-
let e = shallowRef([...
|
|
1459
|
-
|
|
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:
|
|
1483
|
+
title: x.placeholder,
|
|
1462
1484
|
style: { width: "700px" },
|
|
1463
|
-
content: () => createVNode("div", { style: { height: "550px" } }, [
|
|
1464
|
-
|
|
1465
|
-
|
|
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
|
-
|
|
1493
|
+
Y.value?.blur(), X = !1;
|
|
1470
1494
|
});
|
|
1471
1495
|
}
|
|
1472
1496
|
});
|
|
1473
|
-
}, $ = { arrow: () => createVNode(NIcon, null, { default: () => [
|
|
1497
|
+
}, $ = { arrow: () => createVNode(NIcon, null, { default: () => [x.type === "user" ? createVNode(IGroup, null, null) : createVNode(IDept, null, null)] }) };
|
|
1474
1498
|
return () => {
|
|
1475
|
-
let e =
|
|
1476
|
-
if (
|
|
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:
|
|
1480
|
-
checkable:
|
|
1481
|
-
multiple:
|
|
1482
|
-
filter: (e,
|
|
1483
|
-
value:
|
|
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
|
-
|
|
1509
|
+
x.multiple && x.max && e?.length > x.max || S("updateModelValue", e);
|
|
1486
1510
|
},
|
|
1487
1511
|
"onUpdate:value": (e) => {
|
|
1488
|
-
|
|
1512
|
+
x.multiple && x.max && e?.length > x.max || S("update:modelValue", e);
|
|
1489
1513
|
}
|
|
1490
1514
|
}, _isSlot($) ? $ : { default: () => [$] });
|
|
1491
|
-
if (
|
|
1492
|
-
let
|
|
1493
|
-
return createVNode(NSelect, mergeProps(
|
|
1494
|
-
key:
|
|
1495
|
-
ref:
|
|
1496
|
-
show:
|
|
1497
|
-
filterable:
|
|
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:
|
|
1500
|
-
size:
|
|
1501
|
-
placeholder:
|
|
1502
|
-
disabled:
|
|
1503
|
-
value:
|
|
1504
|
-
renderTag:
|
|
1505
|
-
onFocus:
|
|
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
|
-
|
|
1531
|
+
S("updateModelValue", e);
|
|
1508
1532
|
},
|
|
1509
1533
|
"onUpdate:value": (e) => {
|
|
1510
|
-
|
|
1534
|
+
S("update:modelValue", e);
|
|
1511
1535
|
}
|
|
1512
1536
|
}), _isSlot($) ? $ : { default: () => [$] });
|
|
1513
1537
|
};
|
|
1514
1538
|
}
|
|
1515
1539
|
});
|
|
1516
|
-
function renderUser(e,
|
|
1517
|
-
let
|
|
1518
|
-
return /^[\u4E00-\u9FA5]+$/.test(
|
|
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:
|
|
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
|
|
1552
|
+
let S = createVNode(NAvatar, {
|
|
1529
1553
|
color: "var(--color-primary)",
|
|
1530
1554
|
round: !0,
|
|
1531
|
-
size:
|
|
1532
|
-
style:
|
|
1555
|
+
size: C,
|
|
1556
|
+
style: x ? {
|
|
1533
1557
|
position: "absolute",
|
|
1534
|
-
bottom: -(
|
|
1558
|
+
bottom: -(C - 20) / 2 + "px"
|
|
1535
1559
|
} : ""
|
|
1536
|
-
}, _isSlot(
|
|
1537
|
-
return
|
|
1560
|
+
}, _isSlot(T) ? T : { default: () => [T] });
|
|
1561
|
+
return x ? createVNode("div", { style: x ? {
|
|
1538
1562
|
display: "inline-block",
|
|
1539
|
-
minWidth:
|
|
1540
|
-
height:
|
|
1541
|
-
} : "" }, [
|
|
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,
|
|
1546
|
-
|
|
1547
|
-
let { max:
|
|
1548
|
-
return e.length <= 1 ? createVNode("span", { style: "position: relative" }, [e.map((e) => renderUser(e, !0,
|
|
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:
|
|
1574
|
+
height: C + "px"
|
|
1551
1575
|
} }, [createVNode(NAvatarGroup, {
|
|
1552
1576
|
options: e,
|
|
1553
|
-
size:
|
|
1554
|
-
max:
|
|
1577
|
+
size: C,
|
|
1578
|
+
max: S || 4,
|
|
1555
1579
|
style: "top: -2px"
|
|
1556
1580
|
}, {
|
|
1557
|
-
avatar: ({ option: e }) => renderUser(e, !1,
|
|
1558
|
-
rest: ({ options: e, rest:
|
|
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:
|
|
1563
|
-
}, { default: () => [createVNode(NAvatar, null, { default: () => [createTextVNode("+"),
|
|
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
|
|
1575
|
-
return watch([() => e.modelValue, () => e.multiple], ([
|
|
1576
|
-
|
|
1577
|
-
let
|
|
1578
|
-
for (let [e,
|
|
1579
|
-
code:
|
|
1580
|
-
name:
|
|
1581
|
-
}),
|
|
1582
|
-
|
|
1583
|
-
for (let
|
|
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 }), () =>
|
|
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
|
|
1599
|
-
return watch([() => e.modelValue, () => e.multiple], ([
|
|
1600
|
-
|
|
1601
|
-
let
|
|
1602
|
-
for (let [e,
|
|
1603
|
-
code:
|
|
1604
|
-
name:
|
|
1605
|
-
}),
|
|
1606
|
-
|
|
1607
|
-
for (let
|
|
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(
|
|
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 };
|