@ithinkdt/ui 4.0.0-51 → 4.0.0-53
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-BdbuJNhZ.js} +541 -503
- package/dist/components.js +1 -1
- package/dist/page.js +139 -139
- package/esm/components.d.ts +3 -1
- package/esm/page.d.ts +2 -2
- package/package.json +2 -2
|
@@ -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(b, { emit: x, attrs: S }) {
|
|
68
|
+
let { t: C } = useI18n(), w = computed(() => b.default ? b.default === !0 ? C("common.all") : typeof b.default == "string" ? b.default : b.default?.[b.labelField] ?? C("common.all") : ""), T = ref([]);
|
|
69
|
+
watch(() => b.modelValue, (e) => T.value = e, { immediate: !0 });
|
|
70
|
+
let E = (e) => {
|
|
71
|
+
x("update:modelValue", e), x("updateModelValue", e);
|
|
72
|
+
}, O = () => {
|
|
73
|
+
E(T.value?.length === b.options.length ? [] : b.options.map((e) => e[b.valueField]));
|
|
74
|
+
}, k = computed(() => b.options.length > T.value?.length && T.value?.length > 0), A = computed(() => ({ "--n-label-padding": b.labelPadding }));
|
|
74
75
|
return () => {
|
|
75
|
-
let e = createVNode(NCheckboxGroup, mergeProps(
|
|
76
|
-
value:
|
|
77
|
-
onUpdateValue:
|
|
76
|
+
let e = createVNode(NCheckboxGroup, mergeProps(S, {
|
|
77
|
+
value: T.value,
|
|
78
|
+
onUpdateValue: E
|
|
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: b.gap ?? (b.vertical ? void 0 : "small"),
|
|
81
|
+
vertical: b.vertical,
|
|
82
|
+
style: !b.default && b.vertical ? { padding: "6px 0 0" } : {}
|
|
83
|
+
}, { default: () => [b.options?.map((e) => createVNode(NCheckbox, {
|
|
84
|
+
value: e[b.valueField],
|
|
85
|
+
disabled: e[b.disabledField],
|
|
86
|
+
style: A.value
|
|
87
|
+
}, { default: () => [e[b.labelField]] }))] })] });
|
|
88
|
+
return b.default ? createVNode(NFlex, {
|
|
89
|
+
size: b.gap ?? (b.vertical ? void 0 : "small"),
|
|
90
|
+
vertical: b.vertical,
|
|
91
|
+
style: b.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: k.value,
|
|
94
|
+
checked: T.value?.length > 0,
|
|
95
|
+
onUpdateChecked: O,
|
|
96
|
+
style: A.value
|
|
97
|
+
}, { default: () => [w.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 b = ref(), x = !0, S = () => {
|
|
260
|
+
x ? x = !1 : b.value?.sync({ showAllItemsBeforeCalculate: !0 });
|
|
261
|
+
}, C = ref(), w = () => C.value, T = ref(-1), E = (b) => {
|
|
262
|
+
T.value = e.options.length - b;
|
|
263
|
+
}, O = (e) => {
|
|
264
|
+
e || (T.value = -1);
|
|
265
|
+
}, k = () => {}, A = computed(() => T.value === -1 ? [] : e.options.slice(T.value).map((e) => ({
|
|
245
266
|
...e,
|
|
246
267
|
key: e.text
|
|
247
|
-
}))),
|
|
268
|
+
}))), j = (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] }), M = (e, b) => {
|
|
280
|
+
b.onClick?.();
|
|
260
281
|
};
|
|
261
|
-
return () => createVNode(VResizeObserver, { onResize:
|
|
262
|
-
ref:
|
|
263
|
-
getCounter:
|
|
264
|
-
onUpdateCount:
|
|
265
|
-
onUpdateOverflow:
|
|
266
|
-
updateCounter:
|
|
282
|
+
return () => createVNode(VResizeObserver, { onResize: S }, { default: () => [createVNode(VOverflow, {
|
|
283
|
+
ref: b,
|
|
284
|
+
getCounter: w,
|
|
285
|
+
onUpdateCount: E,
|
|
286
|
+
onUpdateOverflow: O,
|
|
287
|
+
updateCounter: k,
|
|
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: C,
|
|
285
306
|
style: "position: absolute"
|
|
286
307
|
}, [createVNode(NDropdown, {
|
|
287
|
-
options:
|
|
288
|
-
renderLabel:
|
|
289
|
-
onSelect:
|
|
308
|
+
options: A.value,
|
|
309
|
+
renderLabel: j,
|
|
310
|
+
onSelect: M
|
|
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: b }) {
|
|
311
332
|
return () => {
|
|
312
|
-
let
|
|
333
|
+
let x;
|
|
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) => b("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(x = toValue(e.label)) ? x : { default: () => [x] }),
|
|
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: () => b("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: () => b("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(x, { emit: S }) {
|
|
407
|
+
let { t: C } = useI18n();
|
|
408
|
+
function w(e, b, C) {
|
|
409
|
+
S("custom", {
|
|
410
|
+
key: e[x.keyField],
|
|
411
|
+
[b]: C
|
|
391
412
|
});
|
|
392
413
|
}
|
|
393
|
-
let
|
|
394
|
-
return watch(
|
|
414
|
+
let T = ref();
|
|
415
|
+
return watch(T, (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 b = x.data.map((e) => e[x.keyField]), [C] = b.splice(e.oldIndex, 1);
|
|
423
|
+
b.splice(e.newIndex, 0, C), S("custom", b);
|
|
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: x.type
|
|
436
|
+
}, { default: () => [createVNode(NIcon, { size: x.size }, { default: () => [createVNode(ICustom, null, null)] })] }), [[vTooltip, x.tooltip ?? C("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, b;
|
|
439
|
+
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, {
|
|
419
440
|
text: !0,
|
|
420
441
|
type: "primary",
|
|
421
442
|
size: "small",
|
|
422
|
-
onClick: () =>
|
|
423
|
-
}, _isSlot$6(e =
|
|
424
|
-
ref:
|
|
443
|
+
onClick: () => S("custom", !0)
|
|
444
|
+
}, _isSlot$6(e = C("common.page.custom.reset")) ? e : { default: () => [e] })] }), createVNode(NFlex, {
|
|
445
|
+
ref: T,
|
|
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(b = x.data.filter((e) => e[x.visiblityField] !== !1).map((e) => createVNode(DataCustomItem, {
|
|
448
|
+
key: e[x.keyField],
|
|
449
|
+
label: e[x.labelField],
|
|
450
|
+
hidden: e[x.hiddenField],
|
|
451
|
+
fixed: e[x.fixedField],
|
|
452
|
+
showFixed: x.showFixed,
|
|
453
|
+
onUpdateHidden: (b) => w(e, "hidden", b),
|
|
454
|
+
onUpdateFixed: (b) => w(e, "fixed", b)
|
|
455
|
+
}, null))) ? b : { default: () => [b] })] });
|
|
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(b, { emit: x, slots: S }) {
|
|
562
|
+
let { t: C } = useI18n(), w = (e) => {
|
|
563
|
+
e?.preventDefault?.(), x("submit", { ...toRaw(b.model) }, e);
|
|
564
|
+
}, T = (e) => {
|
|
565
|
+
e?.preventDefault?.(), x("reset");
|
|
566
|
+
}, D = (e) => {
|
|
567
|
+
e?.preventDefault?.(), x("cancel");
|
|
568
|
+
}, k = ref(), A = ref(), { width: j } = useElementSize(useCurrentElement());
|
|
569
|
+
return watchDebounced([k, j], () => {
|
|
570
|
+
A.value = void 0, setTimeout(() => {
|
|
571
|
+
A.value = k.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: x, validation: j, showColon: N, showAction: P, actionAlign: F, submitText: I, submitDisabled: L, resetText: R, tooltipPlacement: B, showFeedback: V, labelWidth: H = "7.2em", labelAlign: U = b.labelPlacement === "top" ? "left" : "right", grid: W, succeeded: G, successText: K = I,...q } = b, J = !b.readonly && V !== !1;
|
|
557
578
|
return createVNode(NForm, mergeProps({
|
|
558
|
-
labelWidth:
|
|
559
|
-
labelAlign:
|
|
560
|
-
onReset:
|
|
561
|
-
onSubmit:
|
|
562
|
-
showFeedback:
|
|
563
|
-
},
|
|
564
|
-
ref:
|
|
579
|
+
labelWidth: H,
|
|
580
|
+
labelAlign: U,
|
|
581
|
+
onReset: T,
|
|
582
|
+
onSubmit: w,
|
|
583
|
+
showFeedback: J
|
|
584
|
+
}, q), { default: () => [createVNode(NGrid, mergeProps({
|
|
585
|
+
ref: k,
|
|
565
586
|
itemResponsive: !0
|
|
566
|
-
},
|
|
567
|
-
let
|
|
568
|
-
return createVNode(Fragment, null, [e.map(({ hidden: e, name:
|
|
587
|
+
}, W, { yGap: J ? 0 : W?.yGap ?? 24 }), { default: () => {
|
|
588
|
+
let w = 0;
|
|
589
|
+
return createVNode(Fragment, null, [e.map(({ hidden: e, name: x, render: S, label: C, showColon: T, span: E = 6, rowSpan: D, offset: k = 0, tooltip: A, tooltipPlacement: N = b.tooltipPlacement, validationStatus: P = j[x]?.errors?.some((e) => e !== void 0) ? "error" : j[x]?.warnings?.some((e) => e !== void 0) ? "warnings" : j[x] ? "success" : void 0, readonly: F = b.readonly, showRequireMark: I = !F, showTooltipWhenReadonly: L = !1,...R }) => {
|
|
569
590
|
if (e) return;
|
|
570
|
-
|
|
571
|
-
let
|
|
572
|
-
return
|
|
573
|
-
path:
|
|
574
|
-
validationStatus:
|
|
575
|
-
showRequireMark:
|
|
576
|
-
},
|
|
591
|
+
w += E;
|
|
592
|
+
let B;
|
|
593
|
+
return B = x[0] === "$" ? S({}) : createVNode(NFormItem, mergeProps({
|
|
594
|
+
path: x,
|
|
595
|
+
validationStatus: P,
|
|
596
|
+
showRequireMark: R.required && I
|
|
597
|
+
}, R), {
|
|
577
598
|
label: () => createVNode(NText, {
|
|
578
|
-
depth:
|
|
599
|
+
depth: b.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(C)]),
|
|
603
|
+
N === "icon" ? createVNode(NTooltip, null, {
|
|
604
|
+
default: () => toValue(A),
|
|
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
|
+
b.showColon && T !== !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, x = createVNode("div", { style: "width: 100%; font-size: calc(1rem - 2px); min-height: 32px; display: flex; align-items: center" }, [S({
|
|
614
|
+
disabled: b.disabled,
|
|
615
|
+
size: b.size,
|
|
616
|
+
readonly: b.readonly
|
|
596
617
|
})]);
|
|
597
|
-
return
|
|
618
|
+
return A && N === "bottom" && (!b.readonly || L) ? createVNode("div", { style: "width: 100%; display: flex; flex-direction: column" }, [x, 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(A)) ? e : { default: () => [e] })]) : x;
|
|
601
622
|
},
|
|
602
|
-
feedback: () =>
|
|
603
|
-
}),
|
|
604
|
-
key:
|
|
605
|
-
offset:
|
|
606
|
-
span:
|
|
607
|
-
style:
|
|
608
|
-
}, _isSlot$5(
|
|
609
|
-
}),
|
|
623
|
+
feedback: () => j[x]?.errors[0] ?? j[x]?.warnings[0]
|
|
624
|
+
}), b.grid === !1 ? B : createVNode(NGi, {
|
|
625
|
+
key: x,
|
|
626
|
+
offset: k,
|
|
627
|
+
span: E,
|
|
628
|
+
style: D ? { gridRowEnd: `span ${D}` } : void 0
|
|
629
|
+
}, _isSlot$5(B) ? B : { default: () => [B] });
|
|
630
|
+
}), P === !1 || b.readonly === !0 && !S.action ? void 0 : createVNode(NGi, mergeProps({
|
|
610
631
|
key: "action",
|
|
611
632
|
span: 2 ** 53 - 1
|
|
612
|
-
}, typeof
|
|
613
|
-
cols:
|
|
614
|
-
spans:
|
|
633
|
+
}, typeof b.showAction == "object" ? b.showAction : {}), { default: ({ overflow: e }) => S.action ? S.action({
|
|
634
|
+
cols: A.value,
|
|
635
|
+
spans: w,
|
|
615
636
|
overflow: e
|
|
616
637
|
}) : createVNode(NFormItem, {
|
|
617
|
-
label:
|
|
618
|
-
showLabel:
|
|
638
|
+
label: b.actionAlign === "start" ? " " : void 0,
|
|
639
|
+
showLabel: b.labelPlacement !== "top",
|
|
619
640
|
style: "padding-top: 16px"
|
|
620
641
|
}, { default: () => [createVNode(NFlex, {
|
|
621
|
-
justify:
|
|
642
|
+
justify: b.actionAlign,
|
|
622
643
|
align: "center"
|
|
623
644
|
}, { default: () => [
|
|
624
|
-
|
|
645
|
+
b.showSubmitBtn === !1 ? void 0 : createVNode(NButton, {
|
|
625
646
|
attrType: "submit",
|
|
626
|
-
type:
|
|
627
|
-
disabled:
|
|
628
|
-
loading:
|
|
647
|
+
type: G ? "success" : "primary",
|
|
648
|
+
disabled: G || b.disabled || b.submitDisabled || x,
|
|
649
|
+
loading: x
|
|
629
650
|
}, {
|
|
630
|
-
default: () => (
|
|
631
|
-
icon: () =>
|
|
651
|
+
default: () => (G ? K : I) || C("common.page.form.submitText"),
|
|
652
|
+
icon: () => G ? createVNode(NIcon, null, { default: () => [createVNode(ICheck, null, null)] }) : void 0
|
|
632
653
|
}),
|
|
633
|
-
|
|
654
|
+
b.showResetBtn === !1 ? void 0 : createVNode(NButton, {
|
|
634
655
|
attrType: "reset",
|
|
635
|
-
disabled:
|
|
636
|
-
type:
|
|
637
|
-
secondary:
|
|
638
|
-
}, { default: () => [
|
|
639
|
-
|
|
656
|
+
disabled: b.disabled || x,
|
|
657
|
+
type: b.showCancelBtn ? "primary" : "default",
|
|
658
|
+
secondary: b.showCancelBtn
|
|
659
|
+
}, { default: () => [b.resetText || C("common.page.form.resetText")] }),
|
|
660
|
+
b.showCancelBtn === !1 ? void 0 : createVNode(NButton, {
|
|
640
661
|
attrType: "button",
|
|
641
|
-
disabled:
|
|
642
|
-
onClick:
|
|
643
|
-
}, { default: () => [
|
|
662
|
+
disabled: b.disabled || x,
|
|
663
|
+
onClick: D
|
|
664
|
+
}, { default: () => [b.cancelText || C("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(b, { expose: x, emit: S }) {
|
|
730
|
+
let { t: C } = useI18n(), w = (e) => {
|
|
731
|
+
S("filter", b.model, e);
|
|
732
|
+
}, T = (e) => {
|
|
733
|
+
S("reset", e), b.filterOnReset && S("filter", b.model, e);
|
|
734
|
+
}, E = ref(b.defaultCollapsed), D = (e) => {
|
|
735
|
+
E.value = e;
|
|
715
736
|
};
|
|
716
|
-
|
|
717
|
-
let
|
|
737
|
+
x({ collapse: D });
|
|
738
|
+
let k = reactive({
|
|
718
739
|
span: 6,
|
|
719
740
|
suffix: !0
|
|
720
741
|
});
|
|
721
742
|
return () => {
|
|
722
|
-
let { filterOnReset: e, filterText:
|
|
743
|
+
let { filterOnReset: e, filterText: x, resetText: A, customizable: j, defaultCollapsed: N, collapsible: P, grid: F,...I } = b;
|
|
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
|
+
...F,
|
|
749
|
+
collapsed: E.value
|
|
750
|
+
} }, I, {
|
|
730
751
|
showFeedback: !1,
|
|
731
|
-
showAction:
|
|
732
|
-
onSubmit:
|
|
733
|
-
onReset:
|
|
734
|
-
}), { action: ({ cols: e, spans:
|
|
735
|
-
justify:
|
|
752
|
+
showAction: k,
|
|
753
|
+
onSubmit: w,
|
|
754
|
+
onReset: T
|
|
755
|
+
}), { action: ({ cols: e, spans: w }) => (k.suffix = e < w + k.span, createVNode(NFlex, {
|
|
756
|
+
justify: k.suffix ? "end" : "start",
|
|
736
757
|
align: "center"
|
|
737
758
|
}, { default: () => [
|
|
738
|
-
|
|
759
|
+
k.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: b.disabled,
|
|
764
|
+
loading: b.loading
|
|
765
|
+
}, { default: () => [x || C("common.page.filter.submitText")] }),
|
|
745
766
|
createVNode(NButton, {
|
|
746
767
|
attrType: "reset",
|
|
747
|
-
disabled:
|
|
748
|
-
}, { default: () => [
|
|
749
|
-
|
|
768
|
+
disabled: b.disabled || b.loading
|
|
769
|
+
}, { default: () => [A || C("common.page.form.resetText")] }),
|
|
770
|
+
j ? createVNode(DataCustom, {
|
|
750
771
|
keyField: "name",
|
|
751
772
|
showFixed: !1,
|
|
752
|
-
data:
|
|
753
|
-
onCustom: (e) =>
|
|
773
|
+
data: I.items,
|
|
774
|
+
onCustom: (e) => S("custom", e),
|
|
754
775
|
size: 18,
|
|
755
776
|
type: "primary"
|
|
756
777
|
}, null) : void 0,
|
|
757
|
-
|
|
778
|
+
P && k.suffix ? createVNode(NButton, {
|
|
758
779
|
text: !0,
|
|
759
780
|
type: "primary",
|
|
760
781
|
iconPlacement: "right",
|
|
761
|
-
renderIcon:
|
|
762
|
-
onClick: () =>
|
|
763
|
-
}, { default: () => [
|
|
782
|
+
renderIcon: E.value ? IDown : IUp,
|
|
783
|
+
onClick: () => D(!E.value)
|
|
784
|
+
}, { default: () => [E.value ? C("common.page.filter.expand") : C("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(b, x, S = 1) {
|
|
793
|
+
let { t: C } = useI18n(), w = ref(!1), T = [], { open: E, reinit: D } = useFormModal({
|
|
794
|
+
title: b,
|
|
774
795
|
showColon: !0,
|
|
775
|
-
submitText:
|
|
776
|
-
items: ({ it: e }) =>
|
|
796
|
+
submitText: C("common.confirm.defaultOk"),
|
|
797
|
+
items: ({ it: e }) => T.map((b) => e(b.value, b.label, "input", {
|
|
777
798
|
span: 24,
|
|
778
|
-
required:
|
|
799
|
+
required: b.required,
|
|
779
800
|
inputProps: {
|
|
780
|
-
readonly:
|
|
801
|
+
readonly: w,
|
|
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(S),
|
|
807
|
+
maxRows: Math.max(unref(S), 5)
|
|
787
808
|
}
|
|
788
809
|
}
|
|
789
810
|
})),
|
|
790
|
-
onSubmit:
|
|
811
|
+
onSubmit: x
|
|
791
812
|
});
|
|
792
813
|
return {
|
|
793
|
-
open: (e,
|
|
814
|
+
open: (e, b = !1) => (w.value = b, E(e)),
|
|
794
815
|
setSupports: (e) => {
|
|
795
|
-
|
|
816
|
+
T = e, D();
|
|
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: b }) {
|
|
854
|
+
let x = (x) => {
|
|
855
|
+
x = {
|
|
835
856
|
...e.modelValue,
|
|
836
|
-
[e.showLang ?? e.defaultLang]:
|
|
837
|
-
},
|
|
838
|
-
}, { open:
|
|
839
|
-
|
|
857
|
+
[e.showLang ?? e.defaultLang]: x
|
|
858
|
+
}, b("update:modelValue", x), b("updateModelValue", x);
|
|
859
|
+
}, { open: S, setSupports: C } = useLocaleEdit(computed(() => toValue(e.label)), (e) => {
|
|
860
|
+
b("update:modelValue", e), b("updateModelValue", e);
|
|
840
861
|
}, toRef(e, "defaultRows"));
|
|
841
|
-
watch(() => e.supports,
|
|
842
|
-
let
|
|
862
|
+
watch(() => e.supports, C, { immediate: !0 });
|
|
863
|
+
let w = { suffix: () => createVNode(NButton, {
|
|
843
864
|
quaternary: !0,
|
|
844
|
-
onClick: () =>
|
|
865
|
+
onClick: () => S(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)] })] }) }, T = { "--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: x,
|
|
853
874
|
disabled: e.disabled,
|
|
854
875
|
clearable: !0,
|
|
855
|
-
style:
|
|
876
|
+
style: T,
|
|
856
877
|
type: e.defaultRows > 1 ? "textarea" : "text",
|
|
857
878
|
rows: e.defaultRows
|
|
858
|
-
}, _isSlot$4(
|
|
879
|
+
}, _isSlot$4(w) ? w : { default: () => [w] });
|
|
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(b, { emit: x }) {
|
|
903
|
+
let { t: S } = useI18n(), C = (e) => x("change", {
|
|
904
|
+
pageSize: b.pageSize ?? b.page?.pageSize ?? 0,
|
|
884
905
|
currentPage: e
|
|
885
|
-
}),
|
|
906
|
+
}), w = (e) => x("change", {
|
|
886
907
|
pageSize: e,
|
|
887
|
-
currentPage:
|
|
908
|
+
currentPage: b.currentPage ?? b.page?.currentPage ?? 0
|
|
888
909
|
});
|
|
889
910
|
return () => createVNode(NPagination, {
|
|
890
|
-
page:
|
|
891
|
-
itemCount:
|
|
892
|
-
pageSize:
|
|
893
|
-
onUpdatePage:
|
|
894
|
-
onUpdatePageSize:
|
|
895
|
-
pageSizes:
|
|
911
|
+
page: b.currentPage ?? b.page?.currentPage,
|
|
912
|
+
itemCount: b.total,
|
|
913
|
+
pageSize: b.pageSize ?? b.page?.pageSize,
|
|
914
|
+
onUpdatePage: C,
|
|
915
|
+
onUpdatePageSize: w,
|
|
916
|
+
pageSizes: b.pageSizes,
|
|
896
917
|
showQuickJumper: !0,
|
|
897
918
|
showSizePicker: !0,
|
|
898
919
|
style: "justify-content: flex-end"
|
|
899
920
|
}, {
|
|
900
|
-
prefix: () =>
|
|
901
|
-
suffix: () =>
|
|
921
|
+
prefix: () => S("common.page.pagination.prefix", { total: b.total }),
|
|
922
|
+
suffix: () => S("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(b, { emit: x }) {
|
|
946
|
+
let { t: S } = useI18n();
|
|
926
947
|
return () => {
|
|
927
948
|
let e;
|
|
928
|
-
return
|
|
949
|
+
return b.modelValue !== "selection" && b.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, [S("common.page.selection.countText", { count: b.count })]),
|
|
933
954
|
createVNode(NButton, {
|
|
934
955
|
text: !0,
|
|
935
956
|
type: "primary",
|
|
936
957
|
onClick: () => {
|
|
937
|
-
|
|
958
|
+
x("update:modelValue", b.modelValue === "all" ? "selection" : "all");
|
|
938
959
|
}
|
|
939
|
-
}, { default: () => [
|
|
960
|
+
}, { default: () => [b.modelValue === "all" ? S("common.page.selection.view") : S("common.page.selection.back")] }),
|
|
940
961
|
createVNode(NButton, {
|
|
941
962
|
text: !0,
|
|
942
963
|
onClick: () => {
|
|
943
|
-
|
|
964
|
+
x("clear"), x("update:modelValue", "all");
|
|
944
965
|
}
|
|
945
|
-
}, _isSlot$3(e =
|
|
966
|
+
}, _isSlot$3(e = S("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, x) {
|
|
954
975
|
return (e ?? []).map((e) => {
|
|
955
|
-
let
|
|
976
|
+
let S = {
|
|
956
977
|
csvTitle: e.exportTitle,
|
|
957
978
|
...e,
|
|
958
979
|
title: () => {
|
|
959
|
-
let
|
|
980
|
+
let x = toValue(e.title), S = x && withDirectives(createVNode("span", null, [x]), [[
|
|
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: () => [S, 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
|
+
})] }) : S;
|
|
977
998
|
}
|
|
978
999
|
};
|
|
979
|
-
if (e.children?.length)
|
|
1000
|
+
if (e.children?.length) S.children = _map(e.children, x);
|
|
980
1001
|
else {
|
|
981
|
-
e.hidden !== !0 && (
|
|
982
|
-
let
|
|
983
|
-
e.ellipsis !== !1 && (
|
|
984
|
-
let
|
|
1002
|
+
e.hidden !== !0 && (S.width ??= 100, x.value += Number(S.width));
|
|
1003
|
+
let b = e.render ?? ((e) => e);
|
|
1004
|
+
e.ellipsis !== !1 && (S.ellipsis = !1, S.render = (...x) => {
|
|
1005
|
+
let S = b(...x);
|
|
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(S) ? S : { default: () => [S] });
|
|
1014
|
+
}, e.ellipsisTooltip === !0 && (S.ellipsisTooltip ??= b)), Object.assign(S, {
|
|
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 ? (b) => e.selectable(b) === !1 : void 0
|
|
998
1019
|
});
|
|
999
1020
|
}
|
|
1000
|
-
return
|
|
1021
|
+
return S.key === "$actions" && (S.cellProps ??= () => ({ style: { padding: "0 2px" } })), S;
|
|
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: b, emit: C, expose: w }) {
|
|
1060
|
+
let { keyField: T } = inject(PAGE_INJECTION), E = useMergedClsPrefix(), O = `${E.value}-datatable`;
|
|
1061
|
+
useStyle("-datatable", style, E);
|
|
1062
|
+
let k = useTemplateRef("table-ref"), j = ({ sortField: e, sortOrder: b } = {}, x) => {
|
|
1063
|
+
e == x?.sortField && b == x?.sortOrder || k.value?.sort(e, b ? b + "end" : !1);
|
|
1043
1064
|
};
|
|
1044
|
-
watch(() => ({ ...e.sorter }),
|
|
1045
|
-
let
|
|
1046
|
-
let
|
|
1047
|
-
return (e) => e[
|
|
1048
|
-
}),
|
|
1065
|
+
watch(() => ({ ...e.sorter }), j, { deep: !0 });
|
|
1066
|
+
let M = computed(() => {
|
|
1067
|
+
let b = e.keyField || T || "key";
|
|
1068
|
+
return (e) => e[b];
|
|
1069
|
+
}), N = 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(k).changed().then(() => {
|
|
1076
|
+
j(e.sorter);
|
|
1077
|
+
let b = N.value.cache;
|
|
1078
|
+
N.value = k.value, N.value.scrollToView = (b) => {
|
|
1079
|
+
let x = e.data.findIndex((e) => M.value(e) === b);
|
|
1080
|
+
if (x === -1) return;
|
|
1081
|
+
let S = k.value.$el.querySelector(`.${O}__row-marker:nth-child(${x + 1})`);
|
|
1082
|
+
k.value.scrollTo({
|
|
1083
|
+
top: S.offsetTop,
|
|
1063
1084
|
behavior: "smooth"
|
|
1064
1085
|
});
|
|
1065
1086
|
};
|
|
1066
|
-
for (let e of
|
|
1067
|
-
}),
|
|
1068
|
-
let
|
|
1087
|
+
for (let e of b) N.value.scrollToView(...e);
|
|
1088
|
+
}), w(toReactive(N));
|
|
1089
|
+
let P = ref(0), L = shallowRef([]);
|
|
1069
1090
|
watch(() => e.columns, () => {
|
|
1070
|
-
|
|
1091
|
+
P.value = 0, L.value = _map(e.columns, P);
|
|
1071
1092
|
}, {
|
|
1072
1093
|
immediate: !0,
|
|
1073
1094
|
deep: 1
|
|
1074
1095
|
});
|
|
1075
|
-
let
|
|
1096
|
+
let R = ref();
|
|
1076
1097
|
watch(() => e.highlight, (e) => {
|
|
1077
|
-
|
|
1098
|
+
R.value = typeof e == "boolean" ? null : e ?? null;
|
|
1078
1099
|
}, { immediate: !0 });
|
|
1079
|
-
let
|
|
1080
|
-
e.rowClassName?.(
|
|
1081
|
-
`${
|
|
1082
|
-
|
|
1083
|
-
].join(" ")),
|
|
1084
|
-
let
|
|
1100
|
+
let z = computed(() => (b, x) => [
|
|
1101
|
+
e.rowClassName?.(b, x) || "",
|
|
1102
|
+
`${O}__row-marker`,
|
|
1103
|
+
R.value != null && M.value(b) === R.value ? `${O}__row-highlight` : ""
|
|
1104
|
+
].join(" ")), B = computed(() => (b, x) => {
|
|
1105
|
+
let S = e.rowProps?.(b, x);
|
|
1085
1106
|
return {
|
|
1086
|
-
...
|
|
1087
|
-
onClick: (
|
|
1088
|
-
let
|
|
1089
|
-
e.highlight === !0 && (
|
|
1107
|
+
...S,
|
|
1108
|
+
onClick: (x) => {
|
|
1109
|
+
let w = M.value(b);
|
|
1110
|
+
e.highlight === !0 && (R.value = w), C("highlight", w), S?.onClick?.(x);
|
|
1090
1111
|
}
|
|
1091
1112
|
};
|
|
1092
|
-
}),
|
|
1113
|
+
}), U = (b) => {
|
|
1093
1114
|
if (e.sorter) {
|
|
1094
|
-
let { sortField:
|
|
1095
|
-
if (
|
|
1115
|
+
let { sortField: x, sortOrder: S } = e.sorter;
|
|
1116
|
+
if (b?.columnKey == x && (b?.order ? b.order === S + "end" : !S)) return;
|
|
1096
1117
|
}
|
|
1097
|
-
|
|
1098
|
-
sortField:
|
|
1099
|
-
sortOrder:
|
|
1118
|
+
C("sort", {
|
|
1119
|
+
sortField: b?.order ? b?.columnKey : void 0,
|
|
1120
|
+
sortOrder: b?.order ? b.order.replace("end", "") : void 0
|
|
1100
1121
|
});
|
|
1101
|
-
},
|
|
1102
|
-
|
|
1103
|
-
},
|
|
1104
|
-
|
|
1105
|
-
key:
|
|
1122
|
+
}, G = (e) => {
|
|
1123
|
+
C("select", e);
|
|
1124
|
+
}, q = (e, b, x) => {
|
|
1125
|
+
C("custom", {
|
|
1126
|
+
key: x.key,
|
|
1106
1127
|
width: e
|
|
1107
1128
|
});
|
|
1108
1129
|
};
|
|
1109
1130
|
return () => createVNode(NDataTable, {
|
|
1110
|
-
class:
|
|
1131
|
+
class: O,
|
|
1111
1132
|
data: e.data,
|
|
1112
|
-
columns:
|
|
1113
|
-
rowKey:
|
|
1133
|
+
columns: L.value,
|
|
1134
|
+
rowKey: M.value,
|
|
1114
1135
|
tableLayout: "fixed",
|
|
1115
1136
|
ref: "table-ref",
|
|
1116
|
-
scrollX:
|
|
1117
|
-
rowClassName:
|
|
1118
|
-
rowProps:
|
|
1137
|
+
scrollX: P.value,
|
|
1138
|
+
rowClassName: z.value,
|
|
1139
|
+
rowProps: B.value,
|
|
1119
1140
|
checkedRowKeys: e.selectedKeys,
|
|
1120
|
-
onUpdateSorter:
|
|
1121
|
-
onUpdateCheckedRowKeys:
|
|
1122
|
-
onUnstableColumnResize:
|
|
1123
|
-
}, _isSlot$2(
|
|
1141
|
+
onUpdateSorter: U,
|
|
1142
|
+
onUpdateCheckedRowKeys: G,
|
|
1143
|
+
onUnstableColumnResize: q
|
|
1144
|
+
}, _isSlot$2(b) ? b : { default: () => [b] });
|
|
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: b, onSort: x,...S }) {
|
|
1149
|
+
watch([ref(b), e], async ([e, b]) => {
|
|
1129
1150
|
if (e.length === 0) return;
|
|
1130
1151
|
await nextTick();
|
|
1131
|
-
let
|
|
1132
|
-
if (!
|
|
1133
|
-
let
|
|
1152
|
+
let C = unrefElement(b)?.querySelector(".n-data-table-base-table-body .n-data-table-tbody");
|
|
1153
|
+
if (!C) return;
|
|
1154
|
+
let w = Sortable$1.create(C, {
|
|
1134
1155
|
animation: 150,
|
|
1135
|
-
...
|
|
1156
|
+
...S,
|
|
1136
1157
|
onSort(e) {
|
|
1137
|
-
|
|
1158
|
+
x({
|
|
1138
1159
|
from: e.oldIndex,
|
|
1139
1160
|
to: e.newIndex
|
|
1140
1161
|
});
|
|
1141
1162
|
}
|
|
1142
1163
|
});
|
|
1143
1164
|
return () => {
|
|
1144
|
-
|
|
1165
|
+
w.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(b, { emit: x }) {
|
|
1225
|
+
let { t: S } = useI18n(), C = computed(() => b.default === !1 ? "" : b.default === !0 ? S("common.all") : typeof b.default == "string" ? b.default : b.default?.[b.labelField] ?? S("common.all")), w = computed(() => b.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
|
+
} : {}), T = (e) => {
|
|
1229
|
+
x("update:modelValue", e), x("updateModelValue", e);
|
|
1209
1230
|
};
|
|
1210
1231
|
return () => {
|
|
1211
|
-
let e =
|
|
1212
|
-
let
|
|
1232
|
+
let e = b.type === "button" ? NRadioButton : NRadio, x = createVNode(Fragment, null, [b.default ? createVNode(e, { value: typeof b.default == "object" ? b.default?.[b.valueField] : null }, { default: () => [C.value] }) : void 0, b.options?.map((x) => {
|
|
1233
|
+
let S = typeof x[b.labelField] == "string" ? x[b.labelField] : x[b.labelField]?.();
|
|
1213
1234
|
return createVNode(e, {
|
|
1214
|
-
value:
|
|
1215
|
-
disabled:
|
|
1216
|
-
style:
|
|
1217
|
-
paddingLeft:
|
|
1218
|
-
paddingRight:
|
|
1235
|
+
value: x[b.valueField],
|
|
1236
|
+
disabled: x[b.disabledField],
|
|
1237
|
+
style: b.padding ? {
|
|
1238
|
+
paddingLeft: b.padding,
|
|
1239
|
+
paddingRight: b.padding
|
|
1219
1240
|
} : {}
|
|
1220
|
-
}, { default: () => [
|
|
1221
|
-
default: () =>
|
|
1222
|
-
trigger: () =>
|
|
1223
|
-
}) :
|
|
1241
|
+
}, { default: () => [x.tip ? createVNode(NTooltip, null, {
|
|
1242
|
+
default: () => x.tip,
|
|
1243
|
+
trigger: () => S
|
|
1244
|
+
}) : S] });
|
|
1224
1245
|
})]);
|
|
1225
1246
|
return createVNode(NRadioGroup, {
|
|
1226
|
-
style:
|
|
1227
|
-
...
|
|
1247
|
+
style: b.vertical ? {
|
|
1248
|
+
...w.value,
|
|
1228
1249
|
padding: "6px 0 0"
|
|
1229
|
-
} :
|
|
1230
|
-
value:
|
|
1231
|
-
onUpdateValue:
|
|
1232
|
-
}, { default: () => [
|
|
1233
|
-
size:
|
|
1234
|
-
vertical:
|
|
1235
|
-
}, _isSlot$1(
|
|
1250
|
+
} : w.value,
|
|
1251
|
+
value: b.modelValue,
|
|
1252
|
+
onUpdateValue: T
|
|
1253
|
+
}, { default: () => [b.type === "radio" ? createVNode(NFlex, {
|
|
1254
|
+
size: b.vertical ? void 0 : "small",
|
|
1255
|
+
vertical: b.vertical
|
|
1256
|
+
}, _isSlot$1(x) ? x : { default: () => [x] }) : x] });
|
|
1236
1257
|
};
|
|
1237
1258
|
}
|
|
1238
1259
|
});
|
|
@@ -1302,265 +1323,282 @@ 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(b, { emit: x, attrs: S }) {
|
|
1331
|
+
let { t: C } = useI18n(), { localeRef: w } = useLocale("Popconfirm"), T = computed(() => b.valueField || (b.type === "user" ? "username" : "code")), O = computed(() => {
|
|
1332
|
+
if (b.multiple) return b.modelValue || [];
|
|
1333
|
+
let e = b.modelValue?.trim();
|
|
1312
1334
|
return e ? [e] : [];
|
|
1313
|
-
}), k = /* @__PURE__ */ new Map(),
|
|
1314
|
-
watch(() =>
|
|
1335
|
+
}), k = /* @__PURE__ */ new Map(), A = computed(() => (k.clear(), b.users.map((e) => (e = reactive(e), e.label = e.nickname + e.username, e.value = e[T.value], e.type = "user", k.set(e[T.value], e), e)))), j = shallowRef([]);
|
|
1336
|
+
watch(() => b.depts, (e) => {
|
|
1315
1337
|
walkTree(e, (e) => {
|
|
1316
|
-
e.label = e.name, e.value = e.
|
|
1317
|
-
}),
|
|
1338
|
+
e.label = e.name, e.value = e[T.value], e.type = "dept", e.children?.length || delete e.children;
|
|
1339
|
+
}), j.value = flattenTree(e);
|
|
1318
1340
|
}, { immediate: !0 });
|
|
1319
|
-
let
|
|
1320
|
-
...
|
|
1321
|
-
...
|
|
1341
|
+
let L = computed(() => [
|
|
1342
|
+
...b.depts,
|
|
1343
|
+
...b.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
|
+
...A.value
|
|
1349
|
+
]), R = ref([]), z = ref(), B = async (e) => {
|
|
1350
|
+
let x = await (e.type === "group" ? b.getUsersByGroup(e.value) : b.getUsersByDept(e.value));
|
|
1351
|
+
for (let e of A.value) e.disabled = !0;
|
|
1352
|
+
z.value = [...e.type === "dept" ? e.children ?? [] : [], ...x.map((e) => {
|
|
1353
|
+
let b = k.get(e[T.value]);
|
|
1354
|
+
return b && (b.disabled = !1), {
|
|
1333
1355
|
...e,
|
|
1334
|
-
label: e.nickname,
|
|
1335
|
-
value: e.
|
|
1356
|
+
label: e.nickname + e.username,
|
|
1357
|
+
value: e[T.value],
|
|
1336
1358
|
type: "user"
|
|
1337
1359
|
};
|
|
1338
1360
|
})];
|
|
1339
|
-
},
|
|
1340
|
-
let
|
|
1341
|
-
if (
|
|
1342
|
-
data:
|
|
1361
|
+
}, V = /* @__PURE__ */ new WeakMap(), U = (e, x, S) => {
|
|
1362
|
+
let w;
|
|
1363
|
+
if (b.type === "dept") return createVNode(NTree, {
|
|
1364
|
+
data: b.depts,
|
|
1343
1365
|
keyField: "value",
|
|
1344
1366
|
labelField: "name",
|
|
1345
|
-
defaultExpandAll:
|
|
1346
|
-
checkable:
|
|
1347
|
-
selectable: !
|
|
1367
|
+
defaultExpandAll: b.defaultExpandAll,
|
|
1368
|
+
checkable: b.multiple,
|
|
1369
|
+
selectable: !b.multiple,
|
|
1348
1370
|
multiple: !1,
|
|
1349
1371
|
blockLine: !0,
|
|
1350
1372
|
checkOnClick: !0,
|
|
1351
|
-
pattern:
|
|
1352
|
-
filter: (e,
|
|
1353
|
-
checkedKeys:
|
|
1354
|
-
selectedKeys:
|
|
1373
|
+
pattern: S,
|
|
1374
|
+
filter: (e, b) => b.label.includes(e) || b.value.includes(e),
|
|
1375
|
+
checkedKeys: b.multiple ? e : void 0,
|
|
1376
|
+
selectedKeys: b.multiple ? void 0 : e,
|
|
1355
1377
|
onUpdateCheckedKeys: (e) => {
|
|
1356
|
-
|
|
1378
|
+
b.max && e?.length > b.max || x(e);
|
|
1357
1379
|
},
|
|
1358
1380
|
onUpdateSelectedKeys: (e) => {
|
|
1359
|
-
|
|
1381
|
+
x(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 T = e ? V.get(e) : /* @__PURE__ */ new Set();
|
|
1385
|
+
if (e && !T && (T = new Set(e), V.set(e, T)), z.value === !1) return createVNode(NSpin, { show: !0 }, null);
|
|
1386
|
+
let D = z.value || L.value;
|
|
1387
|
+
S = S?.trim(), S && (D = D?.filter((e) => e.label.includes(S) || e.value.includes(S)));
|
|
1388
|
+
let O = R.value;
|
|
1389
|
+
return createVNode(Fragment, null, [createVNode("div", { style: "margin: 12px 16px; display: flex; justify-content: space-between; align-items: center" }, [O.length > 0 ? createVNode(Fragment, null, [createVNode("span", { style: "display: flex; align-items: center" }, [
|
|
1390
|
+
O.length >= 2 ? O.at(-2).label : C("common.all"),
|
|
1369
1391
|
createVNode("span", { style: "padding: 0 4px" }, [createVNode(IRight, null, null)]),
|
|
1370
|
-
|
|
1392
|
+
O.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 (O.pop(), z.value = O.length > 0 ? !1 : void 0, O.length > 0) B(O.at(-1));
|
|
1398
|
+
else for (let e of A.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)] }), C("common.back")] })]) : createVNode("span", null, [C("common.all")])]), D?.length ? createVNode(NList, {
|
|
1379
1401
|
showDivider: !1,
|
|
1380
1402
|
style: "padding: 0 16px"
|
|
1381
|
-
}, _isSlot(
|
|
1382
|
-
let
|
|
1403
|
+
}, _isSlot(w = D.map((S) => {
|
|
1404
|
+
let C, w;
|
|
1383
1405
|
return createVNode(NListItem, {
|
|
1384
|
-
key:
|
|
1406
|
+
key: S.type + "_" + S.value,
|
|
1385
1407
|
style: "padding: 6px 0"
|
|
1386
|
-
}, { default: () => [
|
|
1387
|
-
checked:
|
|
1388
|
-
onUpdateChecked: (
|
|
1389
|
-
if (
|
|
1390
|
-
let
|
|
1391
|
-
if (
|
|
1408
|
+
}, { default: () => [S.type === "user" ? b.multiple ? createVNode(NCheckbox, {
|
|
1409
|
+
checked: T.has(S.value) || !1,
|
|
1410
|
+
onUpdateChecked: (C) => {
|
|
1411
|
+
if (C && b.max && e.length >= b.max) return;
|
|
1412
|
+
let w = [...e || []];
|
|
1413
|
+
if (C) w.push(S.value);
|
|
1392
1414
|
else {
|
|
1393
|
-
let e =
|
|
1394
|
-
|
|
1415
|
+
let e = w.indexOf(S.value);
|
|
1416
|
+
w.splice(e, 1);
|
|
1395
1417
|
}
|
|
1396
|
-
|
|
1418
|
+
x(w);
|
|
1397
1419
|
},
|
|
1398
1420
|
style: "margin-left: 3px"
|
|
1399
|
-
}, _isSlot(
|
|
1421
|
+
}, _isSlot(C = renderUsers([S], {
|
|
1400
1422
|
max: 1,
|
|
1401
1423
|
size: 24,
|
|
1402
|
-
placement: "right"
|
|
1403
|
-
|
|
1404
|
-
|
|
1424
|
+
placement: "right",
|
|
1425
|
+
tooltip: !1,
|
|
1426
|
+
username: !0
|
|
1427
|
+
})) ? C : { default: () => [C] }) : createVNode(NRadio, {
|
|
1428
|
+
checked: T.has(S.value) || !1,
|
|
1405
1429
|
onUpdateChecked: (e) => {
|
|
1406
|
-
|
|
1430
|
+
x(e ? [S.value] : []);
|
|
1407
1431
|
},
|
|
1408
|
-
style: "margin-left: 3px"
|
|
1409
|
-
}, _isSlot(
|
|
1432
|
+
style: "margin-left: 3px;"
|
|
1433
|
+
}, _isSlot(w = renderUsers([S], {
|
|
1410
1434
|
max: 1,
|
|
1411
1435
|
size: 24,
|
|
1412
|
-
placement: "right"
|
|
1413
|
-
|
|
1436
|
+
placement: "right",
|
|
1437
|
+
tooltip: !1,
|
|
1438
|
+
username: !0
|
|
1439
|
+
})) ? w : { default: () => [w] }) : createVNode("div", {
|
|
1414
1440
|
onClick: () => {
|
|
1415
|
-
|
|
1441
|
+
z.value = !1, R.value.push(S), B(S);
|
|
1416
1442
|
},
|
|
1417
1443
|
style: "cursor: pointer; display: flex; align-items: center; gap: 8px"
|
|
1418
1444
|
}, [
|
|
1419
|
-
|
|
1445
|
+
S.type === "dept" ? createVNode(NAvatar, {
|
|
1420
1446
|
size: 24,
|
|
1421
1447
|
style: "background-color: red"
|
|
1422
1448
|
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(IDept, null, null)] })] }) : createVNode(NAvatar, {
|
|
1423
1449
|
size: 24,
|
|
1424
1450
|
style: "background-color: green"
|
|
1425
1451
|
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(IGroup, null, null)] })] }),
|
|
1426
|
-
createVNode("span", { style: "flex: 1 1 auto" }, [
|
|
1452
|
+
createVNode("span", { style: "flex: 1 1 auto" }, [S.label]),
|
|
1427
1453
|
createVNode(NIcon, null, { default: () => [createVNode(IRight, null, null)] })
|
|
1428
1454
|
])] });
|
|
1429
|
-
})) ?
|
|
1430
|
-
},
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1455
|
+
})) ? w : { default: () => [w] }) : createVNode(NEmpty, null, null)]);
|
|
1456
|
+
}, W = () => createVNode(NEmpty, { description: b.placeholder }, null), G = ({ option: e }) => e.type === "user" ? createVNode("span", null, [e.nickname, createVNode("span", { style: {
|
|
1457
|
+
opacity: .4,
|
|
1458
|
+
marginLeft: "8px"
|
|
1459
|
+
} }, [e.username])]) : createVNode("span", null, [e.label]), K = (e, x, S, C, w) => createVNode(NTransfer, mergeProps(e, {
|
|
1460
|
+
key: b.type,
|
|
1461
|
+
options: x,
|
|
1462
|
+
renderSourceList: ({ onCheck: e, pattern: b }) => U(S, e, b),
|
|
1463
|
+
renderTargetList: b.placeholder?.trim() && !b.modelValue?.length ? W : void 0,
|
|
1464
|
+
renderTargetLabel: G,
|
|
1465
|
+
sourceFilterable: b.filterable,
|
|
1466
|
+
size: b.size,
|
|
1467
|
+
disabled: b.disabled || void 0,
|
|
1468
|
+
value: S,
|
|
1469
|
+
filter: (e, b) => b.label.includes(e) || b.value.includes(e),
|
|
1440
1470
|
"onUpdate:value": (e) => {
|
|
1441
|
-
|
|
1471
|
+
C?.(e);
|
|
1442
1472
|
},
|
|
1443
1473
|
onUpdateValue: (e) => {
|
|
1444
|
-
|
|
1474
|
+
w?.(e);
|
|
1445
1475
|
}
|
|
1446
|
-
}), null),
|
|
1447
|
-
type:
|
|
1476
|
+
}), null), q = ({ option: e, handleClose: x }) => createVNode(NTag, {
|
|
1477
|
+
type: b.type === "user" ? "primary" : "info",
|
|
1448
1478
|
closable: !0,
|
|
1449
1479
|
onMousedown: (e) => e.preventDefault(),
|
|
1450
1480
|
onClose: (e) => {
|
|
1451
|
-
e.stopPropagation(),
|
|
1481
|
+
e.stopPropagation(), x();
|
|
1452
1482
|
}
|
|
1453
|
-
}, { default: () => [e.label] }),
|
|
1454
|
-
|
|
1455
|
-
},
|
|
1456
|
-
if (
|
|
1457
|
-
|
|
1483
|
+
}, { default: () => [e.label] }), J = (e, S = "updateModelValue") => {
|
|
1484
|
+
b.multiple ? x(S, e) : x(S, e?.[0]);
|
|
1485
|
+
}, Y = ref(), X = !1, Z = useDialog(), Q = () => {
|
|
1486
|
+
if (X) return;
|
|
1487
|
+
X = !0;
|
|
1458
1488
|
let e = shallowRef([...O.value || []]);
|
|
1459
|
-
|
|
1489
|
+
Z.create({
|
|
1460
1490
|
showIcon: !1,
|
|
1461
|
-
title:
|
|
1491
|
+
title: b.placeholder,
|
|
1462
1492
|
style: { width: "700px" },
|
|
1463
|
-
content: () => createVNode("div", { style: { height: "550px" } }, [
|
|
1464
|
-
|
|
1465
|
-
|
|
1493
|
+
content: () => createVNode("div", { style: { height: "550px" } }, [K({ style: { height: "100%" } }, b.type === "user" ? A.value : j.value, e.value, (b) => e.value = b)]),
|
|
1494
|
+
positiveText: w.value.positiveText,
|
|
1495
|
+
negativeText: w.value.negativeText,
|
|
1496
|
+
onPositiveClick() {
|
|
1497
|
+
J(e.value, "update:modelValue"), J(e.value, "updateModelValue");
|
|
1466
1498
|
},
|
|
1467
1499
|
onAfterLeave() {
|
|
1468
1500
|
nextTick(() => {
|
|
1469
|
-
|
|
1501
|
+
Y.value?.blur(), X = !1;
|
|
1470
1502
|
});
|
|
1471
1503
|
}
|
|
1472
1504
|
});
|
|
1473
|
-
}, $ = { arrow: () => createVNode(NIcon, null, { default: () => [
|
|
1505
|
+
}, $ = { arrow: () => createVNode(NIcon, null, { default: () => [b.type === "user" ? createVNode(IGroup, null, null) : createVNode(IDept, null, null)] }) };
|
|
1474
1506
|
return () => {
|
|
1475
|
-
let e =
|
|
1476
|
-
if (
|
|
1507
|
+
let e = b.type === "user" ? A.value : j.value;
|
|
1508
|
+
if (b.selectType === "dropdown" && b.type === "dept") return createVNode(NTreeSelect, {
|
|
1477
1509
|
options: e,
|
|
1478
1510
|
keyField: "value",
|
|
1479
|
-
defaultExpandAll:
|
|
1480
|
-
checkable:
|
|
1481
|
-
multiple:
|
|
1482
|
-
filter: (e,
|
|
1483
|
-
value:
|
|
1511
|
+
defaultExpandAll: b.defaultExpandAll,
|
|
1512
|
+
checkable: b.multiple,
|
|
1513
|
+
multiple: b.multiple,
|
|
1514
|
+
filter: (e, b) => b.label.includes(e) || b.value.includes(e),
|
|
1515
|
+
value: b.modelValue,
|
|
1484
1516
|
onUpdateValue: (e) => {
|
|
1485
|
-
|
|
1517
|
+
b.multiple && b.max && e?.length > b.max || x("updateModelValue", e);
|
|
1486
1518
|
},
|
|
1487
1519
|
"onUpdate:value": (e) => {
|
|
1488
|
-
|
|
1520
|
+
b.multiple && b.max && e?.length > b.max || x("update:modelValue", e);
|
|
1489
1521
|
}
|
|
1490
1522
|
}, _isSlot($) ? $ : { default: () => [$] });
|
|
1491
|
-
if (
|
|
1492
|
-
let
|
|
1493
|
-
return createVNode(NSelect, mergeProps(
|
|
1494
|
-
key:
|
|
1495
|
-
ref:
|
|
1496
|
-
show:
|
|
1497
|
-
filterable:
|
|
1523
|
+
if (b.selectType === "transfer") return K(S, e, O.value, (e) => J(e, "update:modelValue"), (e) => J(e, "updateModelValue"));
|
|
1524
|
+
let C = b.selectType === "dropdown";
|
|
1525
|
+
return createVNode(NSelect, mergeProps(S, {
|
|
1526
|
+
key: b.type,
|
|
1527
|
+
ref: Y,
|
|
1528
|
+
show: C ? void 0 : !1,
|
|
1529
|
+
filterable: C ? b.filterable : !1,
|
|
1498
1530
|
options: e,
|
|
1499
|
-
multiple:
|
|
1500
|
-
size:
|
|
1501
|
-
placeholder:
|
|
1502
|
-
disabled:
|
|
1503
|
-
value:
|
|
1504
|
-
renderTag:
|
|
1505
|
-
onFocus:
|
|
1531
|
+
multiple: b.multiple,
|
|
1532
|
+
size: b.size,
|
|
1533
|
+
placeholder: b.placeholder,
|
|
1534
|
+
disabled: b.disabled || void 0,
|
|
1535
|
+
value: b.modelValue,
|
|
1536
|
+
renderTag: b.multiple ? q : void 0,
|
|
1537
|
+
onFocus: C ? void 0 : Q,
|
|
1506
1538
|
onUpdateValue: (e) => {
|
|
1507
|
-
|
|
1539
|
+
x("updateModelValue", e);
|
|
1508
1540
|
},
|
|
1509
1541
|
"onUpdate:value": (e) => {
|
|
1510
|
-
|
|
1542
|
+
x("update:modelValue", e);
|
|
1511
1543
|
}
|
|
1512
1544
|
}), _isSlot($) ? $ : { default: () => [$] });
|
|
1513
1545
|
};
|
|
1514
1546
|
}
|
|
1515
1547
|
});
|
|
1516
|
-
function renderUser(e,
|
|
1517
|
-
let
|
|
1518
|
-
return /^[\u4E00-\u9FA5]+$/.test(
|
|
1548
|
+
function renderUser(e, b, { placement: x, size: S, tooltip: C = !0, username: w = !1 }) {
|
|
1549
|
+
let T = e.nickname.split(" ").at(-1), D = T;
|
|
1550
|
+
return /^[\u4E00-\u9FA5]+$/.test(T) ? D = T.length >= 3 ? T.slice(-2) : T : T.length > 4 && (D = createVNode(NIcon, null, { default: () => [createVNode(IAccount, null, null)] })), createVNode(NPopover, {
|
|
1519
1551
|
key: e.username,
|
|
1520
1552
|
raw: !0,
|
|
1521
|
-
placement:
|
|
1553
|
+
placement: x,
|
|
1554
|
+
disabled: C === !1
|
|
1522
1555
|
}, {
|
|
1523
1556
|
default: () => createVNode(NCard, {
|
|
1524
1557
|
style: "width: 200px",
|
|
1525
1558
|
size: "small"
|
|
1526
1559
|
}, { default: () => [createVNode(NH4, null, { default: () => [e.nickname] }), createVNode("span", null, [e.username])] }),
|
|
1527
1560
|
trigger: () => {
|
|
1528
|
-
let
|
|
1561
|
+
let x = createVNode(NAvatar, {
|
|
1529
1562
|
color: "var(--color-primary)",
|
|
1530
1563
|
round: !0,
|
|
1531
|
-
size:
|
|
1532
|
-
style:
|
|
1564
|
+
size: S,
|
|
1565
|
+
style: b ? {
|
|
1533
1566
|
position: "absolute",
|
|
1534
|
-
bottom: -(
|
|
1567
|
+
bottom: -(S - 16) / 2 + "px"
|
|
1535
1568
|
} : ""
|
|
1536
|
-
}, _isSlot(
|
|
1537
|
-
return
|
|
1538
|
-
display: "inline-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1569
|
+
}, _isSlot(D) ? D : { default: () => [D] });
|
|
1570
|
+
return b ? createVNode("div", { style: b ? {
|
|
1571
|
+
display: "inline-flex",
|
|
1572
|
+
itemsAlign: "center",
|
|
1573
|
+
whiteSpace: "nowrap",
|
|
1574
|
+
minWidth: S + "px",
|
|
1575
|
+
height: S + "px"
|
|
1576
|
+
} : "" }, [x, b ? createVNode(Fragment, null, [createVNode("span", { style: { marginLeft: S + 6 + "px" } }, [e.nickname]), w ? createVNode("span", { style: {
|
|
1577
|
+
marginLeft: "8px",
|
|
1578
|
+
opacity: .4
|
|
1579
|
+
} }, [e.username]) : void 0]) : void 0]) : x;
|
|
1542
1580
|
}
|
|
1543
1581
|
});
|
|
1544
1582
|
}
|
|
1545
|
-
function renderUsers(e,
|
|
1546
|
-
|
|
1547
|
-
let { max:
|
|
1548
|
-
return e.length <= 1 ? createVNode("span", { style: "position: relative" }, [e.map((e) => renderUser(e, !0,
|
|
1583
|
+
function renderUsers(e, b = {}) {
|
|
1584
|
+
b.size ||= 24, b.max ||= 4;
|
|
1585
|
+
let { max: x, size: S } = b;
|
|
1586
|
+
return e.length <= 1 ? createVNode("span", { style: "position: relative" }, [e.map((e) => renderUser(e, !0, b))]) : createVNode("span", { style: {
|
|
1549
1587
|
display: "inline-block",
|
|
1550
|
-
height:
|
|
1588
|
+
height: S + "px"
|
|
1551
1589
|
} }, [createVNode(NAvatarGroup, {
|
|
1552
1590
|
options: e,
|
|
1553
|
-
size:
|
|
1554
|
-
max:
|
|
1591
|
+
size: S,
|
|
1592
|
+
max: x || 4,
|
|
1555
1593
|
style: "top: -2px"
|
|
1556
1594
|
}, {
|
|
1557
|
-
avatar: ({ option: e }) => renderUser(e, !1,
|
|
1558
|
-
rest: ({ options: e, rest:
|
|
1595
|
+
avatar: ({ option: e }) => renderUser(e, !1, b),
|
|
1596
|
+
rest: ({ options: e, rest: b }) => createVNode(NDropdown, {
|
|
1559
1597
|
options: e,
|
|
1560
1598
|
keyField: "username",
|
|
1561
1599
|
labelField: "nickname",
|
|
1562
|
-
renderOption: ({ option:
|
|
1563
|
-
}, { default: () => [createVNode(NAvatar, null, { default: () => [createTextVNode("+"),
|
|
1600
|
+
renderOption: ({ option: b }) => renderUser(b, !1, e)
|
|
1601
|
+
}, { default: () => [createVNode(NAvatar, null, { default: () => [createTextVNode("+"), b] })] })
|
|
1564
1602
|
})]);
|
|
1565
1603
|
}
|
|
1566
1604
|
const DtDeptRender = /* @__PURE__ */ defineComponent({
|
|
@@ -1571,18 +1609,18 @@ const DtDeptRender = /* @__PURE__ */ defineComponent({
|
|
|
1571
1609
|
getDeptsByCode: Function
|
|
1572
1610
|
},
|
|
1573
1611
|
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
|
|
1612
|
+
let b = ref([]), x = {};
|
|
1613
|
+
return watch([() => e.modelValue, () => e.multiple], ([S, C]) => {
|
|
1614
|
+
b.value = [];
|
|
1615
|
+
let w = S ? C ? Array.isArray(S) ? S : S.trim() ? S.trim().split(",") : [] : [S] : [], T = [];
|
|
1616
|
+
for (let [e, S] of w.entries()) x[S] || (x[S] = reactive({
|
|
1617
|
+
code: S,
|
|
1618
|
+
name: S
|
|
1619
|
+
}), T.push(S)), b.value[e] = x[S];
|
|
1620
|
+
T.length > 0 && e.getDeptsByCode(T).then((e) => {
|
|
1621
|
+
for (let b of e) Object.assign(x[b.code], b);
|
|
1584
1622
|
});
|
|
1585
|
-
}, { immediate: !0 }), () =>
|
|
1623
|
+
}, { immediate: !0 }), () => b.value.map((e) => createVNode(NTag, { key: e.code }, { default: () => [e.name] }));
|
|
1586
1624
|
}
|
|
1587
1625
|
}), DtUserRender = /* @__PURE__ */ defineComponent({
|
|
1588
1626
|
name: "UserRender",
|
|
@@ -1595,18 +1633,18 @@ const DtDeptRender = /* @__PURE__ */ defineComponent({
|
|
|
1595
1633
|
getUsersByUsername: Function
|
|
1596
1634
|
},
|
|
1597
1635
|
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
|
|
1636
|
+
let b = ref([]), x = {};
|
|
1637
|
+
return watch([() => e.modelValue, () => e.multiple], ([S, C]) => {
|
|
1638
|
+
b.value = [];
|
|
1639
|
+
let w = S ? C ? Array.isArray(S) ? S : S.trim() ? S.trim().split(",") : [] : [S] : [], T = [];
|
|
1640
|
+
for (let [e, S] of w.entries()) x[S] || (x[S] = reactive({
|
|
1641
|
+
code: S,
|
|
1642
|
+
name: S
|
|
1643
|
+
}), T.push(S)), b.value[e] = x[S];
|
|
1644
|
+
T.length > 0 && e.getUsersByUsername(T).then((e) => {
|
|
1645
|
+
for (let b of e) Object.assign(x[b.code], b);
|
|
1608
1646
|
});
|
|
1609
|
-
}, { immediate: !0 }), () => renderUsers(
|
|
1647
|
+
}, { immediate: !0 }), () => renderUsers(b.value, e);
|
|
1610
1648
|
}
|
|
1611
1649
|
});
|
|
1612
1650
|
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 };
|