@ithinkdt/ui 4.0.0-50 → 4.0.0-501
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/auto-imports.js +5 -2
- package/dist/components-C-o-dBCE.js +1893 -0
- package/dist/components.js +5 -5
- package/dist/{directives-DUuJW647.js → directives-Bpfh9AKg.js} +73 -62
- package/dist/directives.js +2 -2
- package/dist/index.js +6 -18
- package/dist/page.js +310 -277
- package/dist/use-style.js +1 -1
- package/esm/components.d.ts +104 -19
- package/esm/page.d.ts +55 -36
- package/package.json +12 -12
- package/unocss-preset.d.ts +5 -0
- package/unocss-preset.js +163 -0
- package/dist/components-BC8oa62b.js +0 -1612
- package/unocss.d.ts +0 -5
- package/unocss.js +0 -94
- /package/dist/{use-i18n-Dx7V4KrY.js → use-i18n-D-AJ8KbA.js} +0 -0
- /package/dist/{use-style-DcT-1dj4.js → use-style-mj2B1q0l.js} +0 -0
|
@@ -0,0 +1,1893 @@
|
|
|
1
|
+
import { n as useI18n } from "./use-i18n-D-AJ8KbA.js";
|
|
2
|
+
import { i as vTooltip } from "./directives-Bpfh9AKg.js";
|
|
3
|
+
import { g as useStyle, h as useMergedClsPrefix, n as cB, r as cE, t as c } from "./use-style-mj2B1q0l.js";
|
|
4
|
+
import { Fragment, computed, createTextVNode, createVNode, defineComponent, h, inject, isVNode, mergeProps, nextTick, reactive, ref, shallowRef, toRaw, toRef, toValue, unref, useTemplateRef, watch, withDirectives } from "vue";
|
|
5
|
+
import { toReactive, unrefElement, until, useCurrentElement, useElementSize, watchDebounced } from "@vueuse/core";
|
|
6
|
+
import { NAnchor, NAnchorLink, NAvatar, NAvatarGroup, NButton, NCard, NCheckbox, NCheckboxGroup, NDataTable, NDropdown, NEllipsis, NEmpty, NFlex, NForm, NFormItem, NGi, NGrid, NH4, NIcon, NInput, NList, NListItem, NPagination, NPerformantEllipsis, NPopover, NRadio, NRadioButton, NRadioGroup, NSelect, NSpin, NTag, NText, NTooltip, NTransfer, NTree, NTreeSelect, dataTableProps, formProps, useDialog } from "ithinkdt-ui";
|
|
7
|
+
import { VOverflow, VResizeObserver } from "vueuc";
|
|
8
|
+
import { Sortable } from "sortablejs/modular/sortable.core.esm.js";
|
|
9
|
+
import { isNullish, pickProps } from "@ithinkdt/common/object";
|
|
10
|
+
import { useFormItem } from "ithinkdt-ui/es/_mixins";
|
|
11
|
+
import { PAGE_INJECTION, useFormModal } from "@ithinkdt/page";
|
|
12
|
+
import { Sortable as Sortable$1 } from "sortablejs";
|
|
13
|
+
import useLocale from "ithinkdt-ui/es/_mixins/use-locale.mjs";
|
|
14
|
+
import { flattenTree, walkTree } from "@ithinkdt/common";
|
|
15
|
+
const NCheckboxes = /* @__PURE__ */ defineComponent({
|
|
16
|
+
name: "Checkboxes",
|
|
17
|
+
inheritAttrs: !1,
|
|
18
|
+
props: {
|
|
19
|
+
options: {
|
|
20
|
+
type: Array,
|
|
21
|
+
default: () => []
|
|
22
|
+
},
|
|
23
|
+
vertical: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: !1
|
|
26
|
+
},
|
|
27
|
+
default: {
|
|
28
|
+
type: [
|
|
29
|
+
Boolean,
|
|
30
|
+
String,
|
|
31
|
+
Object
|
|
32
|
+
],
|
|
33
|
+
default: !1
|
|
34
|
+
},
|
|
35
|
+
gap: {
|
|
36
|
+
type: [
|
|
37
|
+
Number,
|
|
38
|
+
String,
|
|
39
|
+
Array
|
|
40
|
+
],
|
|
41
|
+
default: void 0
|
|
42
|
+
},
|
|
43
|
+
modelValue: {
|
|
44
|
+
type: Array,
|
|
45
|
+
default: void 0
|
|
46
|
+
},
|
|
47
|
+
labelPadding: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: void 0
|
|
50
|
+
},
|
|
51
|
+
labelField: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: "label"
|
|
54
|
+
},
|
|
55
|
+
valueField: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: "value"
|
|
58
|
+
},
|
|
59
|
+
disabledField: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: "disabled"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
emits: {
|
|
65
|
+
"update:modelValue": () => !0,
|
|
66
|
+
updateModelValue: () => !0
|
|
67
|
+
},
|
|
68
|
+
setup(y, { emit: b, attrs: x }) {
|
|
69
|
+
let { t: S } = useI18n(), C = computed(() => y.default ? y.default === !0 ? S("common.all") : typeof y.default == "string" ? y.default : y.default?.[y.labelField] ?? S("common.all") : ""), w = ref([]);
|
|
70
|
+
watch(() => y.modelValue, (e) => w.value = e, { immediate: !0 });
|
|
71
|
+
let T = (e) => {
|
|
72
|
+
b("update:modelValue", e), b("updateModelValue", e);
|
|
73
|
+
}, D = () => {
|
|
74
|
+
T(w.value?.length === y.options.length ? [] : y.options.map((e) => e[y.valueField]));
|
|
75
|
+
}, O = computed(() => y.options.length > w.value?.length && w.value?.length > 0), k = computed(() => ({ "--n-label-padding": y.labelPadding }));
|
|
76
|
+
return () => {
|
|
77
|
+
let e = createVNode(NCheckboxGroup, mergeProps(x, {
|
|
78
|
+
value: w.value,
|
|
79
|
+
onUpdateValue: T
|
|
80
|
+
}), { default: () => [createVNode(NFlex, {
|
|
81
|
+
size: y.gap ?? (y.vertical ? void 0 : "small"),
|
|
82
|
+
vertical: y.vertical,
|
|
83
|
+
style: !y.default && y.vertical ? { padding: "6px 0 0" } : {}
|
|
84
|
+
}, { default: () => [y.options?.map((e) => createVNode(NCheckbox, {
|
|
85
|
+
value: e[y.valueField],
|
|
86
|
+
disabled: e[y.disabledField],
|
|
87
|
+
style: k.value
|
|
88
|
+
}, { default: () => [e[y.labelField]] }))] })] });
|
|
89
|
+
return y.default ? createVNode(NFlex, {
|
|
90
|
+
size: y.gap ?? (y.vertical ? void 0 : "small"),
|
|
91
|
+
vertical: y.vertical,
|
|
92
|
+
style: y.vertical ? { padding: "6px 0 0" } : {}
|
|
93
|
+
}, { default: () => [createVNode("span", null, [createVNode(NCheckbox, {
|
|
94
|
+
indeterminate: O.value,
|
|
95
|
+
checked: w.value?.length > 0,
|
|
96
|
+
onUpdateChecked: D,
|
|
97
|
+
style: k.value
|
|
98
|
+
}, { default: () => [C.value] })]), e] }) : e;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}), IHelp = (e) => createVNode("svg", mergeProps({
|
|
102
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
103
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
104
|
+
role: "img",
|
|
105
|
+
width: "1em",
|
|
106
|
+
height: "1em",
|
|
107
|
+
viewBox: "0 0 24 24"
|
|
108
|
+
}, e), [createVNode("path", {
|
|
109
|
+
fill: "currentColor",
|
|
110
|
+
d: "M11 18h2v-2h-2v2m1-16A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8s8 3.59 8 8s-3.59 8-8 8m0-14a4 4 0 0 0-4 4h2a2 2 0 0 1 2-2a2 2 0 0 1 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5a4 4 0 0 0-4-4Z"
|
|
111
|
+
}, null)]), ICustom = (e) => createVNode("svg", mergeProps({
|
|
112
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
113
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
114
|
+
role: "img",
|
|
115
|
+
width: "1em",
|
|
116
|
+
height: "1em",
|
|
117
|
+
viewBox: "0 0 1024 1024"
|
|
118
|
+
}, e), [createVNode("path", {
|
|
119
|
+
fill: "currentColor",
|
|
120
|
+
d: "m924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 0 0 9.3-35.2l-.9-2.6a443.74 443.74 0 0 0-79.7-137.9l-1.8-2.1a32.12 32.12 0 0 0-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 0 0-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 0 0-25.8 25.7l-15.8 85.4a351.86 351.86 0 0 0-99 57.4l-81.9-29.1a32 32 0 0 0-35.1 9.5l-1.8 2.1a446.02 446.02 0 0 0-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1c0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 0 0-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0 0 35.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0 0 25.8 25.7l2.7.5a449.4 449.4 0 0 0 159 0l2.7-.5a32.05 32.05 0 0 0 25.8-25.7l15.7-85a350 350 0 0 0 99.7-57.6l81.3 28.9a32 32 0 0 0 35.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1l74.7 63.9a370.03 370.03 0 0 1-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3l-17.9 97a377.5 377.5 0 0 1-85 0l-17.9-97.2l-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9l-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5l-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5c0-15.3 1.2-30.6 3.7-45.5l6.5-40l-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2l31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3l17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97l38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8l92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176s176-78.8 176-176s-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 0 1 512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 0 1 400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 0 1 624 502c0 29.9-11.7 58-32.8 79.2z"
|
|
121
|
+
}, null)]), IDrag = (e) => createVNode("svg", mergeProps({
|
|
122
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
123
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
124
|
+
role: "img",
|
|
125
|
+
width: "1em",
|
|
126
|
+
height: "1em",
|
|
127
|
+
viewBox: "0 0 1024 1024"
|
|
128
|
+
}, e), [createVNode("path", {
|
|
129
|
+
fill: "currentColor",
|
|
130
|
+
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"
|
|
131
|
+
}, null)]), ILeft2 = (e) => createVNode("svg", mergeProps({
|
|
132
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
133
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
134
|
+
role: "img",
|
|
135
|
+
width: "1em",
|
|
136
|
+
height: "1em",
|
|
137
|
+
viewBox: "0 0 1024 1024"
|
|
138
|
+
}, e), [createVNode("path", {
|
|
139
|
+
fill: "currentColor",
|
|
140
|
+
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"
|
|
141
|
+
}, null)]), IRight2 = (e) => createVNode("svg", mergeProps({
|
|
142
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
143
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
144
|
+
role: "img",
|
|
145
|
+
width: "1em",
|
|
146
|
+
height: "1em",
|
|
147
|
+
viewBox: "0 0 1024 1024"
|
|
148
|
+
}, e), [createVNode("path", {
|
|
149
|
+
fill: "currentColor",
|
|
150
|
+
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"
|
|
151
|
+
}, null)]), ILeft = (e) => createVNode("svg", mergeProps({
|
|
152
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
153
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
154
|
+
role: "img",
|
|
155
|
+
width: "1em",
|
|
156
|
+
height: "1em",
|
|
157
|
+
viewBox: "0 0 24 24"
|
|
158
|
+
}, e), [createVNode("path", {
|
|
159
|
+
fill: "currentColor",
|
|
160
|
+
d: "M15.41 16.58L10.83 12l4.58-4.59L14 6l-6 6l6 6z"
|
|
161
|
+
}, null)]), IRight = (e) => createVNode("svg", mergeProps({
|
|
162
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
163
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
164
|
+
role: "img",
|
|
165
|
+
width: "1em",
|
|
166
|
+
height: "1em",
|
|
167
|
+
viewBox: "0 0 24 24"
|
|
168
|
+
}, e), [createVNode("path", {
|
|
169
|
+
fill: "currentColor",
|
|
170
|
+
d: "M8.59 16.58L13.17 12L8.59 7.41L10 6l6 6l-6 6z"
|
|
171
|
+
}, null)]), IDown = (e) => createVNode("svg", mergeProps({
|
|
172
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
173
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
174
|
+
role: "img",
|
|
175
|
+
width: "1em",
|
|
176
|
+
height: "1em",
|
|
177
|
+
viewBox: "0 0 32 32"
|
|
178
|
+
}, e), [createVNode("path", {
|
|
179
|
+
fill: "currentColor",
|
|
180
|
+
d: "M16 22L6 12l1.4-1.4l8.6 8.6l8.6-8.6L26 12z"
|
|
181
|
+
}, null)]), IUp = (e) => createVNode("svg", mergeProps({
|
|
182
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
183
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
184
|
+
role: "img",
|
|
185
|
+
width: "1em",
|
|
186
|
+
height: "1em",
|
|
187
|
+
viewBox: "0 0 32 32"
|
|
188
|
+
}, e), [createVNode("path", {
|
|
189
|
+
fill: "currentColor",
|
|
190
|
+
d: "m16 10l10 10l-1.4 1.4l-8.6-8.6l-8.6 8.6L6 20z"
|
|
191
|
+
}, null)]), ICheck = (e) => createVNode("svg", mergeProps({
|
|
192
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
193
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
194
|
+
role: "img",
|
|
195
|
+
width: "1em",
|
|
196
|
+
height: "1em",
|
|
197
|
+
viewBox: "0 0 24 24"
|
|
198
|
+
}, e), [createVNode("path", {
|
|
199
|
+
fill: "currentColor",
|
|
200
|
+
d: "m9.55 18l-5.7-5.7l1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"
|
|
201
|
+
}, null)]), ILanguage = (e) => createVNode("svg", mergeProps({
|
|
202
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
203
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
204
|
+
role: "img",
|
|
205
|
+
width: "1em",
|
|
206
|
+
height: "1em",
|
|
207
|
+
viewBox: "0 0 24 24"
|
|
208
|
+
}, e), [createVNode("path", {
|
|
209
|
+
fill: "currentColor",
|
|
210
|
+
d: "M12 22q-2.05 0-3.875-.788t-3.187-2.15t-2.15-3.187T2 12q0-2.075.788-3.887t2.15-3.175t3.187-2.15T12 2q2.075 0 3.888.788t3.174 2.15t2.15 3.175T22 12q0 2.05-.788 3.875t-2.15 3.188t-3.175 2.15T12 22m0-2.05q.65-.9 1.125-1.875T13.9 16h-3.8q.3 1.1.775 2.075T12 19.95m-2.6-.4q-.45-.825-.787-1.713T8.05 16H5.1q.725 1.25 1.813 2.175T9.4 19.55m5.2 0q1.4-.45 2.488-1.375T18.9 16h-2.95q-.225.95-.562 1.838T14.6 19.55M4.25 14h3.4q-.075-.5-.112-.987T7.5 12t.038-1.012T7.65 10h-3.4q-.125.5-.187.988T4 12t.063 1.013t.187.987m5.4 0h4.7q.075-.5.113-.987T14.5 12t-.038-1.012T14.35 10h-4.7q-.075.5-.112.988T9.5 12t.038 1.013t.112.987m6.7 0h3.4q.125-.5.188-.987T20 12t-.062-1.012T19.75 10h-3.4q.075.5.113.988T16.5 12t-.038 1.013t-.112.987m-.4-6h2.95q-.725-1.25-1.812-2.175T14.6 4.45q.45.825.788 1.713T15.95 8M10.1 8h3.8q-.3-1.1-.775-2.075T12 4.05q-.65.9-1.125 1.875T10.1 8m-5 0h2.95q.225-.95.563-1.838T9.4 4.45Q8 4.9 6.912 5.825T5.1 8"
|
|
211
|
+
}, null)]), IMore = (e) => createVNode("svg", mergeProps({
|
|
212
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
213
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
214
|
+
role: "img",
|
|
215
|
+
width: "1em",
|
|
216
|
+
height: "1em",
|
|
217
|
+
viewBox: "0 0 20 20"
|
|
218
|
+
}, e), [createVNode("path", {
|
|
219
|
+
fill: "currentColor",
|
|
220
|
+
fillRule: "evenodd",
|
|
221
|
+
d: "M2.5 7.5a2.5 2.5 0 1 1 0 5a2.5 2.5 0 0 1 0-5m15 0a2.5 2.5 0 1 1 0 5a2.5 2.5 0 0 1 0-5m-7.274 0a2.5 2.5 0 1 1 0 5a2.5 2.5 0 0 1 0-5"
|
|
222
|
+
}, null)]), IDept = (e) => createVNode("svg", mergeProps({
|
|
223
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
224
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
225
|
+
width: "1em",
|
|
226
|
+
height: "1em",
|
|
227
|
+
viewBox: "0 0 12 12"
|
|
228
|
+
}, e), [createVNode("path", {
|
|
229
|
+
fill: "currentColor",
|
|
230
|
+
d: "M5.5 4.937a2 2 0 1 1 1 0V6h2a1 1 0 0 1 1 1v1.063a2 2 0 1 1-1 0V7h-5v1.063a2 2 0 1 1-1 0V7a1 1 0 0 1 1-1h2zM6 4a1 1 0 1 0 0-2a1 1 0 0 0 0 2m-3 7a1 1 0 1 0 0-2a1 1 0 0 0 0 2m5-1a1 1 0 1 0 2 0a1 1 0 0 0-2 0"
|
|
231
|
+
}, null)]), IGroup = (e) => createVNode("svg", mergeProps({
|
|
232
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
233
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
234
|
+
width: "1em",
|
|
235
|
+
height: "1em",
|
|
236
|
+
viewBox: "0 0 24 24"
|
|
237
|
+
}, e), [createVNode("g", {
|
|
238
|
+
fill: "none",
|
|
239
|
+
fillRule: "evenodd"
|
|
240
|
+
}, [createVNode("path", { d: "M24 0v24H0V0zM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035c-.01-.004-.019-.001-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427c-.002-.01-.009-.017-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093c.012.004.023 0 .029-.008l.004-.014l-.034-.614c-.003-.012-.01-.02-.02-.022m-.715.002a.023.023 0 0 0-.027.006l-.006.014l-.034.614c0 .012.007.02.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z" }, null), createVNode("path", {
|
|
241
|
+
fill: "currentColor",
|
|
242
|
+
d: "M13 13a4 4 0 0 1 4 4v2a1 1 0 1 1-2 0v-2a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v2a1 1 0 1 1-2 0v-2a4 4 0 0 1 4-4zm6 0a3 3 0 0 1 3 3v2a1 1 0 1 1-2 0v-2a1 1 0 0 0-1-1h-1.416a5.02 5.02 0 0 0-1.583-2zM9.5 3a4.5 4.5 0 1 1 0 9a4.5 4.5 0 0 1 0-9M18 6a3 3 0 1 1 0 6a3 3 0 0 1 0-6M9.5 5a2.5 2.5 0 1 0 0 5a2.5 2.5 0 0 0 0-5M18 8a1 1 0 1 0 0 2a1 1 0 0 0 0-2"
|
|
243
|
+
}, null)])]), IAccount = (e) => createVNode("svg", mergeProps({
|
|
244
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
245
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
246
|
+
role: "img",
|
|
247
|
+
width: "1em",
|
|
248
|
+
height: "1em",
|
|
249
|
+
viewBox: "0 0 256 256"
|
|
250
|
+
}, e), [createVNode("path", {
|
|
251
|
+
fill: "currentColor",
|
|
252
|
+
d: "M235.4 210a124.2 124.2 0 0 0-61.8-53.2a76 76 0 1 0-91.2 0A124.2 124.2 0 0 0 20.6 210a12 12 0 0 0 20.8 12a100 100 0 0 1 173.2 0a12.1 12.1 0 0 0 10.4 6a11.7 11.7 0 0 0 6-1.6a12 12 0 0 0 4.4-16.4ZM76 96a52 52 0 1 1 52 52a52 52 0 0 1-52-52Z"
|
|
253
|
+
}, null)]), IClose = (e) => createVNode("svg", mergeProps({
|
|
254
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
255
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
256
|
+
role: "img",
|
|
257
|
+
width: "1em",
|
|
258
|
+
height: "1em",
|
|
259
|
+
viewBox: "0 0 24 24"
|
|
260
|
+
}, e), [createVNode("path", {
|
|
261
|
+
fill: "currentColor",
|
|
262
|
+
d: "m6.4 18.308l-.708-.708l5.6-5.6l-5.6-5.6l.708-.708l5.6 5.6l5.6-5.6l.708.708l-5.6 5.6l5.6 5.6l-.708.708l-5.6-5.6z"
|
|
263
|
+
}, null)]), DataActions = /* @__PURE__ */ defineComponent({
|
|
264
|
+
name: "DataActions",
|
|
265
|
+
props: { options: {
|
|
266
|
+
type: Array,
|
|
267
|
+
default: () => []
|
|
268
|
+
} },
|
|
269
|
+
setup(e) {
|
|
270
|
+
let y = ref(), b = !0, x = () => {
|
|
271
|
+
b ? b = !1 : y.value?.sync({ showAllItemsBeforeCalculate: !0 });
|
|
272
|
+
}, S = ref(), C = () => S.value, w = ref(-1), T = (y) => {
|
|
273
|
+
w.value = e.options.length - y;
|
|
274
|
+
}, D = (e) => {
|
|
275
|
+
e || (w.value = -1);
|
|
276
|
+
}, O = () => {}, k = computed(() => w.value === -1 ? [] : e.options.slice(w.value).map((e) => ({
|
|
277
|
+
...e,
|
|
278
|
+
key: e.text
|
|
279
|
+
}))), A = (e) => createVNode(NButton, {
|
|
280
|
+
type: e.color === "danger" ? "error" : [
|
|
281
|
+
"default",
|
|
282
|
+
"tertiary",
|
|
283
|
+
"primary",
|
|
284
|
+
"info",
|
|
285
|
+
"success",
|
|
286
|
+
"warning",
|
|
287
|
+
"error"
|
|
288
|
+
].includes(e.color) ? e.color : "primary",
|
|
289
|
+
text: !0
|
|
290
|
+
}, { default: () => [e.text] }), j = (e, y) => {
|
|
291
|
+
y.onClick?.();
|
|
292
|
+
};
|
|
293
|
+
return () => createVNode(VResizeObserver, { onResize: x }, { default: () => [createVNode(VOverflow, {
|
|
294
|
+
ref: y,
|
|
295
|
+
getCounter: C,
|
|
296
|
+
onUpdateCount: T,
|
|
297
|
+
onUpdateOverflow: D,
|
|
298
|
+
updateCounter: O,
|
|
299
|
+
style: "margin-top: 2px"
|
|
300
|
+
}, {
|
|
301
|
+
default: () => e.options.map((e) => createVNode(NButton, {
|
|
302
|
+
quaternary: !0,
|
|
303
|
+
type: e.color === "danger" ? "error" : [
|
|
304
|
+
"default",
|
|
305
|
+
"tertiary",
|
|
306
|
+
"primary",
|
|
307
|
+
"info",
|
|
308
|
+
"success",
|
|
309
|
+
"warning",
|
|
310
|
+
"error"
|
|
311
|
+
].includes(e.color) ? e.color : "primary",
|
|
312
|
+
size: "small",
|
|
313
|
+
onClick: e.onClick
|
|
314
|
+
}, { default: () => [e.text] })),
|
|
315
|
+
counter: () => createVNode("span", {
|
|
316
|
+
ref: S,
|
|
317
|
+
style: "position: absolute"
|
|
318
|
+
}, [createVNode(NDropdown, {
|
|
319
|
+
options: k.value,
|
|
320
|
+
renderLabel: A,
|
|
321
|
+
onSelect: j
|
|
322
|
+
}, { default: () => [createVNode(NButton, {
|
|
323
|
+
quaternary: !0,
|
|
324
|
+
size: "small"
|
|
325
|
+
}, { default: () => [createVNode(IMore, { style: "font-size: 14px; color: #888" }, null)] })] })])
|
|
326
|
+
})] });
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
function _isSlot$7(e) {
|
|
330
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
|
|
331
|
+
}
|
|
332
|
+
var DataCustomItem = /* @__PURE__ */ defineComponent({
|
|
333
|
+
name: "DataCustomRow",
|
|
334
|
+
props: {
|
|
335
|
+
label: [String, Function],
|
|
336
|
+
disabled: Boolean,
|
|
337
|
+
hidden: Boolean,
|
|
338
|
+
showFixed: Boolean,
|
|
339
|
+
fixed: [Boolean, String]
|
|
340
|
+
},
|
|
341
|
+
emits: ["update-hidden", "update-fixed"],
|
|
342
|
+
setup(e, { emit: y }) {
|
|
343
|
+
return () => {
|
|
344
|
+
let b;
|
|
345
|
+
return createVNode(NFlex, {
|
|
346
|
+
align: "center",
|
|
347
|
+
wrap: !1,
|
|
348
|
+
size: "small"
|
|
349
|
+
}, { default: () => [
|
|
350
|
+
createVNode(NButton, {
|
|
351
|
+
type: "primary",
|
|
352
|
+
text: !0,
|
|
353
|
+
class: "icon-drag"
|
|
354
|
+
}, { default: () => [createVNode(NIcon, { size: "18" }, { default: () => [createVNode(IDrag, null, null)] })] }),
|
|
355
|
+
createVNode(NCheckbox, {
|
|
356
|
+
checked: !e.hidden,
|
|
357
|
+
disabled: e.disabled,
|
|
358
|
+
onUpdateChecked: (e) => y("update-hidden", !e)
|
|
359
|
+
}, null),
|
|
360
|
+
createVNode(NEllipsis, { style: "flex: 1 1 auto" }, _isSlot$7(b = toValue(e.label)) ? b : { default: () => [b] }),
|
|
361
|
+
e.showFixed ? [createVNode(NButton, {
|
|
362
|
+
text: !0,
|
|
363
|
+
type: e.fixed === "left" ? "primary" : void 0,
|
|
364
|
+
onClick: () => y("update-fixed", e.fixed === "left" ? !1 : "left")
|
|
365
|
+
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(ILeft2, null, null)] })] }), createVNode(NButton, {
|
|
366
|
+
text: !0,
|
|
367
|
+
type: e.fixed === "right" ? "primary" : void 0,
|
|
368
|
+
onClick: () => y("update-fixed", e.fixed === "right" ? !1 : "right")
|
|
369
|
+
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(IRight2, null, null)] })] })] : void 0
|
|
370
|
+
] });
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
const DataCustom = /* @__PURE__ */ defineComponent({
|
|
375
|
+
name: "DataCustom",
|
|
376
|
+
props: {
|
|
377
|
+
data: {
|
|
378
|
+
type: Array,
|
|
379
|
+
required: !0
|
|
380
|
+
},
|
|
381
|
+
keyField: {
|
|
382
|
+
type: String,
|
|
383
|
+
default: "key"
|
|
384
|
+
},
|
|
385
|
+
labelField: {
|
|
386
|
+
type: String,
|
|
387
|
+
default: "label"
|
|
388
|
+
},
|
|
389
|
+
fixedField: {
|
|
390
|
+
type: String,
|
|
391
|
+
default: "fixed"
|
|
392
|
+
},
|
|
393
|
+
hiddenField: {
|
|
394
|
+
type: String,
|
|
395
|
+
default: "hidden"
|
|
396
|
+
},
|
|
397
|
+
showFixed: {
|
|
398
|
+
type: Boolean,
|
|
399
|
+
default: !0
|
|
400
|
+
},
|
|
401
|
+
disabledField: {
|
|
402
|
+
type: String,
|
|
403
|
+
default: "disabled"
|
|
404
|
+
},
|
|
405
|
+
visiblityField: {
|
|
406
|
+
type: String,
|
|
407
|
+
default: "visiblity"
|
|
408
|
+
},
|
|
409
|
+
tooltip: [String, Object],
|
|
410
|
+
size: {
|
|
411
|
+
type: Number,
|
|
412
|
+
default: 20
|
|
413
|
+
},
|
|
414
|
+
type: { type: String }
|
|
415
|
+
},
|
|
416
|
+
emits: { custom: () => !0 },
|
|
417
|
+
setup(b, { emit: x }) {
|
|
418
|
+
let { t: S } = useI18n();
|
|
419
|
+
function C(e, y, S) {
|
|
420
|
+
x("custom", {
|
|
421
|
+
key: e[b.keyField],
|
|
422
|
+
[y]: S
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
let w = ref();
|
|
426
|
+
return watch(w, (e) => {
|
|
427
|
+
e.$el && Sortable.create(e.$el, {
|
|
428
|
+
animation: 150,
|
|
429
|
+
ghostClass: "ghost",
|
|
430
|
+
handle: ".icon-drag",
|
|
431
|
+
filter: ".disabled",
|
|
432
|
+
onEnd(e) {
|
|
433
|
+
let y = b.data.map((e) => e[b.keyField]), [S] = y.splice(e.oldIndex, 1);
|
|
434
|
+
y.splice(e.newIndex, 0, S), x("custom", y);
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
}), () => createVNode(NPopover, {
|
|
438
|
+
trigger: "click",
|
|
439
|
+
scrollable: !0,
|
|
440
|
+
placement: "left-start",
|
|
441
|
+
displayDirective: "show",
|
|
442
|
+
style: "max-height: 400px; width: 240px"
|
|
443
|
+
}, {
|
|
444
|
+
trigger: () => withDirectives(createVNode(NButton, {
|
|
445
|
+
text: !0,
|
|
446
|
+
type: b.type
|
|
447
|
+
}, { default: () => [createVNode(NIcon, { size: b.size }, { default: () => [createVNode(ICustom, null, null)] })] }), [[vTooltip, b.tooltip ?? S("common.page.custom.tooltip")]]),
|
|
448
|
+
default: () => {
|
|
449
|
+
let e, y;
|
|
450
|
+
return createVNode(NFlex, { vertical: !0 }, { default: () => [createVNode(NFlex, { justify: "space-between" }, { default: () => [createVNode("div", { style: "font-weight: bold" }, [b.tooltip ?? S("common.page.custom.tooltip")]), createVNode(NButton, {
|
|
451
|
+
text: !0,
|
|
452
|
+
type: "primary",
|
|
453
|
+
size: "small",
|
|
454
|
+
onClick: () => x("custom", !0)
|
|
455
|
+
}, _isSlot$7(e = S("common.page.custom.reset")) ? e : { default: () => [e] })] }), createVNode(NFlex, {
|
|
456
|
+
ref: w,
|
|
457
|
+
vertical: !0
|
|
458
|
+
}, _isSlot$7(y = b.data.filter((e) => e[b.visiblityField] !== !1).map((e) => createVNode(DataCustomItem, {
|
|
459
|
+
key: e[b.keyField],
|
|
460
|
+
label: e[b.labelField],
|
|
461
|
+
hidden: e[b.hiddenField],
|
|
462
|
+
fixed: e[b.fixedField],
|
|
463
|
+
showFixed: b.showFixed,
|
|
464
|
+
onUpdateHidden: (y) => C(e, "hidden", y),
|
|
465
|
+
onUpdateFixed: (y) => C(e, "fixed", y)
|
|
466
|
+
}, null))) ? y : { default: () => [y] })] });
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
function _isSlot$6(e) {
|
|
472
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
|
|
473
|
+
}
|
|
474
|
+
function renderLabel(e, y) {
|
|
475
|
+
return typeof e == "function" ? e(y) : e;
|
|
476
|
+
}
|
|
477
|
+
function renderAnchorLink(e, y) {
|
|
478
|
+
return e.isGroup ? (e.__children ??= e.children?.filter((e) => e.isGroup) ?? [], createVNode(NAnchorLink, { href: `#${e.prop}` }, {
|
|
479
|
+
title: () => renderLabel(e.label, y),
|
|
480
|
+
default: e.__children?.length ? () => e.__children.map((e) => renderAnchorLink(e, y)) : void 0
|
|
481
|
+
})) : null;
|
|
482
|
+
}
|
|
483
|
+
function getSpan(e, y, b) {
|
|
484
|
+
return typeof e == "function" ? e(y, b) : e;
|
|
485
|
+
}
|
|
486
|
+
function renderItem(e, y, b, x) {
|
|
487
|
+
return e.isGroup ? createVNode("div", {
|
|
488
|
+
key: e.prop,
|
|
489
|
+
class: `${x}__group`,
|
|
490
|
+
id: e.prop
|
|
491
|
+
}, [createVNode("div", { class: `${x}__title` }, [renderLabel(e.label, b)]), createVNode("div", { class: `${x}__wrapper` }, [e.children?.map((e) => renderItem(e, y, b, x))])]) : createVNode("div", {
|
|
492
|
+
key: e.prop,
|
|
493
|
+
class: `${x}__item`,
|
|
494
|
+
style: {
|
|
495
|
+
"--descriptions-col-span": getSpan(e.colSpan, y, b) ?? 1,
|
|
496
|
+
"--descriptions-row-span": getSpan(e.rowSpan, y, b) ?? 1
|
|
497
|
+
}
|
|
498
|
+
}, [e.label ? createVNode("div", { class: `${x}__label` }, [renderLabel(e.label, b)]) : void 0, createVNode("div", { class: `${x}__content` }, [(b ? e.render ? e.render(b) : b[e.prop] : void 0) ?? createVNode("span", { class: `${x}__nothing` }, [createTextVNode("--")])])]);
|
|
499
|
+
}
|
|
500
|
+
const DataDescriptions = /* @__PURE__ */ defineComponent({
|
|
501
|
+
name: "DataDescriptions",
|
|
502
|
+
props: {
|
|
503
|
+
cols: {
|
|
504
|
+
type: Number,
|
|
505
|
+
default: 3
|
|
506
|
+
},
|
|
507
|
+
data: { type: Object },
|
|
508
|
+
items: {
|
|
509
|
+
type: Array,
|
|
510
|
+
default: () => []
|
|
511
|
+
},
|
|
512
|
+
title: { type: [String, Function] },
|
|
513
|
+
anchor: {
|
|
514
|
+
type: [Boolean, Object],
|
|
515
|
+
default: void 0
|
|
516
|
+
}
|
|
517
|
+
},
|
|
518
|
+
setup(e) {
|
|
519
|
+
let y = useMergedClsPrefix(), S = `${y.value}-data-descriptions`;
|
|
520
|
+
useStyle("-data-descriptions", style$1, y);
|
|
521
|
+
let C = ref();
|
|
522
|
+
watch(() => e.items, () => {
|
|
523
|
+
location.hash && until(C).toBeTruthy().then((e) => {
|
|
524
|
+
e.scrollTo(location.hash);
|
|
525
|
+
});
|
|
526
|
+
}, { immediate: !0 });
|
|
527
|
+
let w = computed(() => ({ "--descriptions-cols": e.cols })), T = computed(() => mergeProps({
|
|
528
|
+
ref: C,
|
|
529
|
+
class: `${S}__anchor`,
|
|
530
|
+
showBackground: !1,
|
|
531
|
+
affix: !0
|
|
532
|
+
}, e.anchor && typeof e.anchor == "object" ? e.anchor : {}));
|
|
533
|
+
return () => {
|
|
534
|
+
let y, { cols: b, title: x, data: C, items: E, anchor: D } = e, O = isNullish(x) ? void 0 : createVNode("div", { class: `${S}__header` }, [typeof x == "string" ? createVNode("span", null, [x]) : x(C ?? void 0)]), A = E.filter((e) => !e.hiddden).map((e) => renderItem(e, b, C, S)), j = D === !1 ? void 0 : createVNode(NAnchor, T.value, _isSlot$6(y = E.map((e) => h(renderAnchorLink(e, C), { key: e.prop }))) ? y : { default: () => [y] });
|
|
535
|
+
return createVNode("div", {
|
|
536
|
+
class: S,
|
|
537
|
+
style: w.value
|
|
538
|
+
}, [
|
|
539
|
+
O,
|
|
540
|
+
createVNode("div", { class: `${S}__wrapper` }, [A]),
|
|
541
|
+
j
|
|
542
|
+
]);
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
var style$1 = /* @__PURE__ */ cB("data-descriptions", [
|
|
547
|
+
cE("header", {
|
|
548
|
+
fontWeight: "bold",
|
|
549
|
+
fontSize: "1.125rem",
|
|
550
|
+
marginBottom: "24px"
|
|
551
|
+
}),
|
|
552
|
+
cE("wrapper", {
|
|
553
|
+
gridTemplateColumns: "repeat(var(--descriptions-cols, 3), 1fr)",
|
|
554
|
+
display: "grid",
|
|
555
|
+
gap: "20px"
|
|
556
|
+
}, []),
|
|
557
|
+
cE("group", { gridColumn: "span var(--descriptions-cols, 3)" }),
|
|
558
|
+
cE("item", {
|
|
559
|
+
gridColumn: "span var(--descriptions-col-span, 3)",
|
|
560
|
+
gridRow: "span var(--descriptions-row-span, 3)"
|
|
561
|
+
}),
|
|
562
|
+
cE("title", {
|
|
563
|
+
fontWeight: "bold",
|
|
564
|
+
fontSize: "1.125rem",
|
|
565
|
+
marginBottom: "20px",
|
|
566
|
+
marginTop: "24px"
|
|
567
|
+
}),
|
|
568
|
+
cE("label", {
|
|
569
|
+
color: "#888",
|
|
570
|
+
paddingBottom: "6px"
|
|
571
|
+
}),
|
|
572
|
+
cE("content", {
|
|
573
|
+
fontSize: "15px",
|
|
574
|
+
color: "var(--color-text)"
|
|
575
|
+
}),
|
|
576
|
+
cE("anchor", {
|
|
577
|
+
position: "absolute",
|
|
578
|
+
zIndex: 2,
|
|
579
|
+
top: "40px",
|
|
580
|
+
right: "40px"
|
|
581
|
+
})
|
|
582
|
+
]);
|
|
583
|
+
const dataFormActionsProps = {
|
|
584
|
+
size: {
|
|
585
|
+
type: String,
|
|
586
|
+
default: void 0
|
|
587
|
+
},
|
|
588
|
+
gap: {
|
|
589
|
+
type: Number,
|
|
590
|
+
default: void 0
|
|
591
|
+
},
|
|
592
|
+
submitText: {
|
|
593
|
+
type: [
|
|
594
|
+
String,
|
|
595
|
+
Number,
|
|
596
|
+
Object
|
|
597
|
+
],
|
|
598
|
+
default: void 0
|
|
599
|
+
},
|
|
600
|
+
resetText: {
|
|
601
|
+
type: [
|
|
602
|
+
String,
|
|
603
|
+
Number,
|
|
604
|
+
Object
|
|
605
|
+
],
|
|
606
|
+
default: void 0
|
|
607
|
+
},
|
|
608
|
+
cancelText: {
|
|
609
|
+
type: [
|
|
610
|
+
String,
|
|
611
|
+
Number,
|
|
612
|
+
Object
|
|
613
|
+
],
|
|
614
|
+
default: void 0
|
|
615
|
+
},
|
|
616
|
+
showSubmitBtn: {
|
|
617
|
+
type: Boolean,
|
|
618
|
+
required: !1,
|
|
619
|
+
default: !0
|
|
620
|
+
},
|
|
621
|
+
showResetBtn: {
|
|
622
|
+
type: Boolean,
|
|
623
|
+
required: !1,
|
|
624
|
+
default: !0
|
|
625
|
+
},
|
|
626
|
+
showCancelBtn: {
|
|
627
|
+
type: Boolean,
|
|
628
|
+
required: !1,
|
|
629
|
+
default: !1
|
|
630
|
+
},
|
|
631
|
+
submitDisabled: Boolean,
|
|
632
|
+
submitLoading: Boolean,
|
|
633
|
+
succeeded: {
|
|
634
|
+
type: Boolean,
|
|
635
|
+
default: void 0
|
|
636
|
+
},
|
|
637
|
+
successText: {
|
|
638
|
+
type: [
|
|
639
|
+
String,
|
|
640
|
+
Number,
|
|
641
|
+
Object
|
|
642
|
+
],
|
|
643
|
+
default: void 0
|
|
644
|
+
},
|
|
645
|
+
failureText: {
|
|
646
|
+
type: [
|
|
647
|
+
String,
|
|
648
|
+
Number,
|
|
649
|
+
Object
|
|
650
|
+
],
|
|
651
|
+
default: void 0
|
|
652
|
+
},
|
|
653
|
+
nativeButtonType: Boolean
|
|
654
|
+
}, DataFormActions = /* @__PURE__ */ defineComponent({
|
|
655
|
+
name: "DataFormActions",
|
|
656
|
+
props: dataFormActionsProps,
|
|
657
|
+
emits: [
|
|
658
|
+
"submit",
|
|
659
|
+
"reset",
|
|
660
|
+
"cancel"
|
|
661
|
+
],
|
|
662
|
+
setup(y, { emit: b, slots: x }) {
|
|
663
|
+
let { t: S } = useI18n(), C = () => {
|
|
664
|
+
b("submit");
|
|
665
|
+
}, w = () => {
|
|
666
|
+
b("reset");
|
|
667
|
+
}, T = () => {
|
|
668
|
+
b("cancel");
|
|
669
|
+
}, { mergedDisabledRef: E, mergedSizeRef: D } = useFormItem(y);
|
|
670
|
+
return () => {
|
|
671
|
+
let e = D.value, b = E.value, { gap: O = e === "small" ? 8 : e === "medium" ? 12 : 16, submitText: k, resetText: A, cancelText: j, submitDisabled: M, submitLoading: N, showSubmitBtn: P, showResetBtn: F, showCancelBtn: I, succeeded: L, successText: R = k, failureText: z = k, nativeButtonType: B } = y;
|
|
672
|
+
return createVNode(NFlex, { size: O === void 0 ? e : O }, { default: () => [
|
|
673
|
+
x.prefix?.(),
|
|
674
|
+
P === !1 ? void 0 : createVNode(NButton, {
|
|
675
|
+
attrType: B ? "submit" : "button",
|
|
676
|
+
size: e,
|
|
677
|
+
type: L ? "success" : L === !1 ? "error" : "primary",
|
|
678
|
+
disabled: L !== void 0 || b || M || N,
|
|
679
|
+
loading: N,
|
|
680
|
+
onClick: B ? void 0 : C
|
|
681
|
+
}, {
|
|
682
|
+
default: () => (L ? R : L === !1 ? z : k) || S("common.page.form.submitText"),
|
|
683
|
+
icon: () => L ? createVNode(NIcon, null, { default: () => [createVNode(ICheck, null, null)] }) : L === !1 ? createVNode(NIcon, null, { default: () => [createVNode(IClose, null, null)] }) : void 0
|
|
684
|
+
}),
|
|
685
|
+
F === !1 ? void 0 : createVNode(NButton, {
|
|
686
|
+
size: D.value,
|
|
687
|
+
attrType: B ? "reset" : "button",
|
|
688
|
+
disabled: b || N || L,
|
|
689
|
+
type: I ? "primary" : "default",
|
|
690
|
+
secondary: I,
|
|
691
|
+
onClick: B ? void 0 : w
|
|
692
|
+
}, { default: () => [A || S("common.page.form.resetText")] }),
|
|
693
|
+
I === !1 || L ? void 0 : createVNode(NButton, {
|
|
694
|
+
attrType: "button",
|
|
695
|
+
disabled: b || N,
|
|
696
|
+
onClick: T
|
|
697
|
+
}, { default: () => [j || S("common.page.form.cancelText")] }),
|
|
698
|
+
x.suffix?.()
|
|
699
|
+
] });
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
});
|
|
703
|
+
function _isSlot$5(e) {
|
|
704
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
|
|
705
|
+
}
|
|
706
|
+
const DataForm = /* @__PURE__ */ defineComponent({
|
|
707
|
+
name: "DataForm",
|
|
708
|
+
props: {
|
|
709
|
+
grid: {
|
|
710
|
+
type: Object,
|
|
711
|
+
default: () => ({})
|
|
712
|
+
},
|
|
713
|
+
...pickProps(formProps, "disabled", "model", "labelWidth", "labelAlign", "showFeedback", "size"),
|
|
714
|
+
...pickProps(dataFormActionsProps, "submitText", "resetText", "cancelText", "showSubmitBtn", "showResetBtn", "showCancelBtn", "submitDisabled", "succeeded", "successText", "failureText"),
|
|
715
|
+
readonly: {
|
|
716
|
+
type: Boolean,
|
|
717
|
+
required: !1,
|
|
718
|
+
default: void 0
|
|
719
|
+
},
|
|
720
|
+
items: {
|
|
721
|
+
type: Array,
|
|
722
|
+
required: !0
|
|
723
|
+
},
|
|
724
|
+
validation: {
|
|
725
|
+
type: Object,
|
|
726
|
+
default: () => ({})
|
|
727
|
+
},
|
|
728
|
+
loading: Boolean,
|
|
729
|
+
showColon: Boolean,
|
|
730
|
+
tooltipPlacement: {
|
|
731
|
+
type: String,
|
|
732
|
+
default: "bottom"
|
|
733
|
+
},
|
|
734
|
+
requireMarkPlacement: {
|
|
735
|
+
type: String,
|
|
736
|
+
default: "left"
|
|
737
|
+
},
|
|
738
|
+
labelPlacement: {
|
|
739
|
+
type: String,
|
|
740
|
+
default: "left"
|
|
741
|
+
},
|
|
742
|
+
showAction: {
|
|
743
|
+
type: [Boolean, Object],
|
|
744
|
+
default: void 0
|
|
745
|
+
},
|
|
746
|
+
actionAlign: {
|
|
747
|
+
type: String,
|
|
748
|
+
default: "center"
|
|
749
|
+
},
|
|
750
|
+
actionJustify: {
|
|
751
|
+
type: String,
|
|
752
|
+
default: "start"
|
|
753
|
+
},
|
|
754
|
+
actionGap: {
|
|
755
|
+
type: String,
|
|
756
|
+
default: void 0
|
|
757
|
+
}
|
|
758
|
+
},
|
|
759
|
+
emits: [
|
|
760
|
+
"submit",
|
|
761
|
+
"reset",
|
|
762
|
+
"cancel"
|
|
763
|
+
],
|
|
764
|
+
setup(e, { emit: y, slots: b }) {
|
|
765
|
+
let x = (b) => {
|
|
766
|
+
b?.preventDefault?.(), y("submit", { ...toRaw(e.model) }, b);
|
|
767
|
+
}, S = (e) => {
|
|
768
|
+
e?.preventDefault?.(), y("reset");
|
|
769
|
+
}, C = (e) => {
|
|
770
|
+
e?.preventDefault?.(), y("cancel");
|
|
771
|
+
}, w = ref(), E = ref(), { width: O } = useElementSize(useCurrentElement());
|
|
772
|
+
return watchDebounced([w, O], () => {
|
|
773
|
+
E.value = void 0, setTimeout(() => {
|
|
774
|
+
E.value = w.value?.responsiveCols || void 0;
|
|
775
|
+
}, 30);
|
|
776
|
+
}, {
|
|
777
|
+
immediate: !0,
|
|
778
|
+
debounce: 100
|
|
779
|
+
}), () => {
|
|
780
|
+
let { items: y, loading: O, validation: k, showColon: A, tooltipPlacement: j, showFeedback: N, labelWidth: P = "7.2em", labelAlign: F = e.labelPlacement === "top" ? "left" : "right", grid: I, showAction: L, showSubmitBtn: R, showResetBtn: B, showCancelBtn: V, actionAlign: H, actionJustify: U, actionGap: W, submitDisabled: G, submitText: K, resetText: q, cancelText: J, succeeded: Y, successText: X, failureText: Z, ...Q } = e, $ = !e.readonly && N !== !1;
|
|
781
|
+
return createVNode(NForm, mergeProps({
|
|
782
|
+
labelWidth: P,
|
|
783
|
+
labelAlign: F,
|
|
784
|
+
onReset: S,
|
|
785
|
+
onSubmit: x,
|
|
786
|
+
showFeedback: $
|
|
787
|
+
}, Q), { default: () => [createVNode(NGrid, mergeProps({
|
|
788
|
+
ref: w,
|
|
789
|
+
itemResponsive: !0
|
|
790
|
+
}, I, { yGap: $ ? 0 : I?.yGap ?? 24 }), { default: () => {
|
|
791
|
+
let x = 0;
|
|
792
|
+
return createVNode(Fragment, null, [y.map(({ hidden: y, name: b, render: S, label: C, showColon: w, span: T = 6, rowSpan: E, offset: O = 0, tooltip: A, tooltipPlacement: j = e.tooltipPlacement, validationStatus: N = k[b]?.errors?.some((e) => e !== void 0) ? "error" : k[b]?.warnings?.some((e) => e !== void 0) ? "warnings" : k[b] ? "success" : void 0, readonly: P = e.readonly, showRequireMark: F = !P, showTooltipWhenReadonly: I = !1, ...L }) => {
|
|
793
|
+
if (y) return;
|
|
794
|
+
x += T;
|
|
795
|
+
let R;
|
|
796
|
+
return R = b[0] === "$" ? S({}) : createVNode(NFormItem, mergeProps({
|
|
797
|
+
path: b,
|
|
798
|
+
validationStatus: N,
|
|
799
|
+
showRequireMark: L.required && F
|
|
800
|
+
}, L), {
|
|
801
|
+
label: () => createVNode(NText, {
|
|
802
|
+
depth: e.readonly ? 3 : 2,
|
|
803
|
+
style: "display: inline-flex; align-items: flex-start; gap: 1px"
|
|
804
|
+
}, { default: () => [
|
|
805
|
+
createVNode("span", null, [toValue(C)]),
|
|
806
|
+
j === "icon" ? createVNode(NTooltip, null, {
|
|
807
|
+
default: () => toValue(A),
|
|
808
|
+
trigger: () => createVNode(NButton, {
|
|
809
|
+
text: !0,
|
|
810
|
+
style: "font-size: 1.25em; opacity: 0.8"
|
|
811
|
+
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(IHelp, null, null)] })] })
|
|
812
|
+
}) : void 0,
|
|
813
|
+
e.showColon && w !== !1 ? createVNode("span", { style: "place-self: center" }, [createTextVNode(":")]) : void 0
|
|
814
|
+
] }),
|
|
815
|
+
default: () => {
|
|
816
|
+
let y, b = createVNode("div", { style: "width: 100%; font-size: calc(1rem - 2px); min-height: 32px; display: flex; align-items: center" }, [S({
|
|
817
|
+
disabled: e.disabled,
|
|
818
|
+
size: e.size,
|
|
819
|
+
readonly: e.readonly
|
|
820
|
+
})]);
|
|
821
|
+
return A && j === "bottom" && (!e.readonly || I) ? createVNode("div", { style: "width: 100%; display: flex; flex-direction: column" }, [b, createVNode(NText, {
|
|
822
|
+
depth: 3,
|
|
823
|
+
style: "font-size: calc(1rem - 3px); margin-top: 6px"
|
|
824
|
+
}, _isSlot$5(y = toValue(A)) ? y : { default: () => [y] })]) : b;
|
|
825
|
+
},
|
|
826
|
+
feedback: () => k[b]?.errors[0] ?? k[b]?.warnings[0]
|
|
827
|
+
}), e.grid === !1 ? R : createVNode(NGi, {
|
|
828
|
+
key: b,
|
|
829
|
+
offset: O,
|
|
830
|
+
span: T,
|
|
831
|
+
style: E ? { gridRowEnd: `span ${E}` } : void 0
|
|
832
|
+
}, _isSlot$5(R) ? R : { default: () => [R] });
|
|
833
|
+
}), L === !1 || e.readonly === !0 && !b.action ? void 0 : createVNode(NGi, mergeProps({
|
|
834
|
+
key: "action",
|
|
835
|
+
span: 2 ** 53 - 1
|
|
836
|
+
}, typeof e.showAction == "object" ? e.showAction : {}), { default: ({ overflow: y }) => b.action ? b.action({
|
|
837
|
+
cols: E.value,
|
|
838
|
+
spans: x,
|
|
839
|
+
overflow: y
|
|
840
|
+
}) : createVNode(NFormItem, {
|
|
841
|
+
label: U === "start" ? " " : void 0,
|
|
842
|
+
showLabel: e.labelPlacement !== "top",
|
|
843
|
+
style: "padding-top: 16px"
|
|
844
|
+
}, { default: () => [createVNode(DataFormActions, {
|
|
845
|
+
align: H,
|
|
846
|
+
justify: U,
|
|
847
|
+
gap: W,
|
|
848
|
+
showSubmitBtn: R,
|
|
849
|
+
showResetBtn: B,
|
|
850
|
+
showCancelBtn: V,
|
|
851
|
+
submitText: K,
|
|
852
|
+
resetText: q,
|
|
853
|
+
cancelText: J,
|
|
854
|
+
submitDisabled: G,
|
|
855
|
+
submitloading: O,
|
|
856
|
+
succeeded: Y,
|
|
857
|
+
successText: X,
|
|
858
|
+
failureText: Z,
|
|
859
|
+
nativeButtonType: !0,
|
|
860
|
+
onCancel: C
|
|
861
|
+
}, {
|
|
862
|
+
prefix: () => b.actionPrefix?.(),
|
|
863
|
+
suffix: () => b.actionSuffix?.()
|
|
864
|
+
})] }) })]);
|
|
865
|
+
} })] });
|
|
866
|
+
};
|
|
867
|
+
}
|
|
868
|
+
}), DataFilter = /* @__PURE__ */ defineComponent({
|
|
869
|
+
name: "DataFilter",
|
|
870
|
+
props: {
|
|
871
|
+
grid: {
|
|
872
|
+
type: Object,
|
|
873
|
+
default: () => ({})
|
|
874
|
+
},
|
|
875
|
+
...pickProps(formProps, "disabled", "model"),
|
|
876
|
+
labelWidth: {
|
|
877
|
+
type: [String, Number],
|
|
878
|
+
default: "5em"
|
|
879
|
+
},
|
|
880
|
+
labelPlacement: {
|
|
881
|
+
type: String,
|
|
882
|
+
default: "left"
|
|
883
|
+
},
|
|
884
|
+
items: {
|
|
885
|
+
type: Array,
|
|
886
|
+
required: !0
|
|
887
|
+
},
|
|
888
|
+
loading: {
|
|
889
|
+
type: Boolean,
|
|
890
|
+
required: !1,
|
|
891
|
+
default: !1
|
|
892
|
+
},
|
|
893
|
+
filterOnReset: {
|
|
894
|
+
type: Boolean,
|
|
895
|
+
required: !1,
|
|
896
|
+
default: !0
|
|
897
|
+
},
|
|
898
|
+
filterText: {
|
|
899
|
+
type: String,
|
|
900
|
+
default: void 0
|
|
901
|
+
},
|
|
902
|
+
resetText: {
|
|
903
|
+
type: String,
|
|
904
|
+
default: void 0
|
|
905
|
+
},
|
|
906
|
+
customizable: {
|
|
907
|
+
type: Boolean,
|
|
908
|
+
required: !1,
|
|
909
|
+
default: !0
|
|
910
|
+
},
|
|
911
|
+
collapsible: {
|
|
912
|
+
type: Boolean,
|
|
913
|
+
required: !1,
|
|
914
|
+
default: !0
|
|
915
|
+
},
|
|
916
|
+
defaultCollapsed: {
|
|
917
|
+
type: Boolean,
|
|
918
|
+
required: !1,
|
|
919
|
+
default: !0
|
|
920
|
+
}
|
|
921
|
+
},
|
|
922
|
+
emits: [
|
|
923
|
+
"filter",
|
|
924
|
+
"reset",
|
|
925
|
+
"custom",
|
|
926
|
+
"collapse"
|
|
927
|
+
],
|
|
928
|
+
setup(y, { expose: b, emit: x }) {
|
|
929
|
+
let { t: S } = useI18n(), C = (e) => {
|
|
930
|
+
x("filter", y.model, e);
|
|
931
|
+
}, w = (e) => {
|
|
932
|
+
x("reset", e), y.filterOnReset && x("filter", y.model, e);
|
|
933
|
+
}, T = ref(y.defaultCollapsed), E = (e) => {
|
|
934
|
+
T.value = e;
|
|
935
|
+
};
|
|
936
|
+
b({ collapse: E });
|
|
937
|
+
let O = reactive({
|
|
938
|
+
span: 6,
|
|
939
|
+
suffix: !0
|
|
940
|
+
});
|
|
941
|
+
return () => {
|
|
942
|
+
let { filterOnReset: e, filterText: b, resetText: k, customizable: A, defaultCollapsed: j, collapsible: N, grid: P, ...F } = y;
|
|
943
|
+
return createVNode(DataForm, mergeProps({ grid: {
|
|
944
|
+
cols: "12 768:18 1280:24 1536:30",
|
|
945
|
+
yGap: 20,
|
|
946
|
+
xGap: 8,
|
|
947
|
+
...P,
|
|
948
|
+
collapsed: T.value
|
|
949
|
+
} }, F, {
|
|
950
|
+
showFeedback: !1,
|
|
951
|
+
showAction: O,
|
|
952
|
+
onSubmit: C,
|
|
953
|
+
onReset: w
|
|
954
|
+
}), { action: ({ cols: e, spans: C }) => (O.suffix = e < C + O.span, createVNode(NFlex, {
|
|
955
|
+
justify: O.suffix ? "end" : "start",
|
|
956
|
+
align: "center"
|
|
957
|
+
}, { default: () => [
|
|
958
|
+
O.suffix ? void 0 : createVNode("span", null, [createTextVNode("\xA0\xA0\xA0\xA0")]),
|
|
959
|
+
createVNode(NButton, {
|
|
960
|
+
attrType: "submit",
|
|
961
|
+
type: "primary",
|
|
962
|
+
disabled: y.disabled,
|
|
963
|
+
loading: y.loading
|
|
964
|
+
}, { default: () => [b || S("common.page.filter.submitText")] }),
|
|
965
|
+
createVNode(NButton, {
|
|
966
|
+
attrType: "reset",
|
|
967
|
+
disabled: y.disabled || y.loading
|
|
968
|
+
}, { default: () => [k || S("common.page.form.resetText")] }),
|
|
969
|
+
A ? createVNode(DataCustom, {
|
|
970
|
+
keyField: "name",
|
|
971
|
+
showFixed: !1,
|
|
972
|
+
data: F.items,
|
|
973
|
+
onCustom: (e) => x("custom", e),
|
|
974
|
+
size: 18,
|
|
975
|
+
type: "primary"
|
|
976
|
+
}, null) : void 0,
|
|
977
|
+
N && O.suffix ? createVNode(NButton, {
|
|
978
|
+
text: !0,
|
|
979
|
+
type: "primary",
|
|
980
|
+
iconPlacement: "right",
|
|
981
|
+
renderIcon: T.value ? IDown : IUp,
|
|
982
|
+
onClick: () => E(!T.value)
|
|
983
|
+
}, { default: () => [T.value ? S("common.page.filter.expand") : S("common.page.filter.collapse")] }) : void 0
|
|
984
|
+
] })) });
|
|
985
|
+
};
|
|
986
|
+
}
|
|
987
|
+
});
|
|
988
|
+
function _isSlot$4(e) {
|
|
989
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
|
|
990
|
+
}
|
|
991
|
+
function useLocaleEdit(y, b, x = 1) {
|
|
992
|
+
let { t: S } = useI18n(), C = ref(!1), w = [], { open: T, reinit: E } = useFormModal({
|
|
993
|
+
title: y,
|
|
994
|
+
showColon: !0,
|
|
995
|
+
submitText: S("common.confirm.defaultOk"),
|
|
996
|
+
items: ({ it: e }) => w.map((y) => e(y.value, y.label, "input", {
|
|
997
|
+
span: 24,
|
|
998
|
+
required: y.required,
|
|
999
|
+
inputProps: {
|
|
1000
|
+
readonly: C,
|
|
1001
|
+
clearable: !0,
|
|
1002
|
+
type: "textarea",
|
|
1003
|
+
showCount: !0,
|
|
1004
|
+
autosize: {
|
|
1005
|
+
minRows: unref(x),
|
|
1006
|
+
maxRows: Math.max(unref(x), 5)
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
})),
|
|
1010
|
+
onSubmit: b
|
|
1011
|
+
});
|
|
1012
|
+
return {
|
|
1013
|
+
open: (e, y = !1) => (C.value = y, T(e)),
|
|
1014
|
+
setSupports: (e) => {
|
|
1015
|
+
w = e, E();
|
|
1016
|
+
}
|
|
1017
|
+
};
|
|
1018
|
+
}
|
|
1019
|
+
const DataLocaleInput = /* @__PURE__ */ defineComponent({
|
|
1020
|
+
name: "DataLocaleInput",
|
|
1021
|
+
props: {
|
|
1022
|
+
label: { type: [
|
|
1023
|
+
String,
|
|
1024
|
+
Function,
|
|
1025
|
+
Number,
|
|
1026
|
+
Boolean,
|
|
1027
|
+
Object
|
|
1028
|
+
] },
|
|
1029
|
+
modelValue: Object,
|
|
1030
|
+
supports: {
|
|
1031
|
+
type: Array,
|
|
1032
|
+
default: () => []
|
|
1033
|
+
},
|
|
1034
|
+
disabled: {
|
|
1035
|
+
type: Boolean,
|
|
1036
|
+
default: void 0
|
|
1037
|
+
},
|
|
1038
|
+
defaultLang: {
|
|
1039
|
+
type: String,
|
|
1040
|
+
default: "zh-CN"
|
|
1041
|
+
},
|
|
1042
|
+
showLang: {
|
|
1043
|
+
type: String,
|
|
1044
|
+
default: void 0
|
|
1045
|
+
},
|
|
1046
|
+
defaultRows: {
|
|
1047
|
+
type: Number,
|
|
1048
|
+
default: 1
|
|
1049
|
+
}
|
|
1050
|
+
},
|
|
1051
|
+
emits: ["update:modelValue", "updateModelValue"],
|
|
1052
|
+
setup(e, { emit: y }) {
|
|
1053
|
+
let b = (b) => {
|
|
1054
|
+
b = {
|
|
1055
|
+
...e.modelValue,
|
|
1056
|
+
[e.showLang ?? e.defaultLang]: b
|
|
1057
|
+
}, y("update:modelValue", b), y("updateModelValue", b);
|
|
1058
|
+
}, { open: x, setSupports: S } = useLocaleEdit(computed(() => toValue(e.label)), (e) => {
|
|
1059
|
+
y("update:modelValue", e), y("updateModelValue", e);
|
|
1060
|
+
}, toRef(e, "defaultRows"));
|
|
1061
|
+
watch(() => e.supports, S, { immediate: !0 });
|
|
1062
|
+
let C = { suffix: () => createVNode(NButton, {
|
|
1063
|
+
quaternary: !0,
|
|
1064
|
+
onClick: () => x(e.modelValue, e.disabled),
|
|
1065
|
+
style: "--n-padding: 0 8px"
|
|
1066
|
+
}, { default: () => [createVNode(NIcon, {
|
|
1067
|
+
size: "20",
|
|
1068
|
+
depth: "3"
|
|
1069
|
+
}, { default: () => [createVNode(ILanguage, null, null)] })] }) }, w = { "--n-padding-right": "0" };
|
|
1070
|
+
return () => createVNode(NInput, {
|
|
1071
|
+
value: e.modelValue?.[e.showLang ?? e.defaultLang] ?? e.modelValue?.[e.defaultLang],
|
|
1072
|
+
onUpdateValue: b,
|
|
1073
|
+
disabled: e.disabled,
|
|
1074
|
+
clearable: !0,
|
|
1075
|
+
style: w,
|
|
1076
|
+
type: e.defaultRows > 1 ? "textarea" : "text",
|
|
1077
|
+
rows: e.defaultRows
|
|
1078
|
+
}, _isSlot$4(C) ? C : { default: () => [C] });
|
|
1079
|
+
}
|
|
1080
|
+
}), DataPagination = /* @__PURE__ */ defineComponent({
|
|
1081
|
+
name: "DataPagination",
|
|
1082
|
+
props: {
|
|
1083
|
+
total: {
|
|
1084
|
+
type: Number,
|
|
1085
|
+
default: 0
|
|
1086
|
+
},
|
|
1087
|
+
currentPage: { type: Number },
|
|
1088
|
+
pageSize: { type: Number },
|
|
1089
|
+
page: { type: Object },
|
|
1090
|
+
pageSizes: {
|
|
1091
|
+
type: Array,
|
|
1092
|
+
default: () => [
|
|
1093
|
+
10,
|
|
1094
|
+
20,
|
|
1095
|
+
30,
|
|
1096
|
+
50
|
|
1097
|
+
]
|
|
1098
|
+
}
|
|
1099
|
+
},
|
|
1100
|
+
emits: { change: () => !0 },
|
|
1101
|
+
setup(y, { emit: b }) {
|
|
1102
|
+
let { t: x } = useI18n(), S = (e) => b("change", {
|
|
1103
|
+
pageSize: y.pageSize ?? y.page?.pageSize ?? 0,
|
|
1104
|
+
currentPage: e
|
|
1105
|
+
}), C = (e) => b("change", {
|
|
1106
|
+
pageSize: e,
|
|
1107
|
+
currentPage: y.currentPage ?? y.page?.currentPage ?? 0
|
|
1108
|
+
});
|
|
1109
|
+
return () => createVNode(NPagination, {
|
|
1110
|
+
page: y.currentPage ?? y.page?.currentPage,
|
|
1111
|
+
itemCount: y.total,
|
|
1112
|
+
pageSize: y.pageSize ?? y.page?.pageSize,
|
|
1113
|
+
onUpdatePage: S,
|
|
1114
|
+
onUpdatePageSize: C,
|
|
1115
|
+
pageSizes: y.pageSizes,
|
|
1116
|
+
showQuickJumper: !0,
|
|
1117
|
+
showSizePicker: !0,
|
|
1118
|
+
style: "justify-content: flex-end"
|
|
1119
|
+
}, {
|
|
1120
|
+
prefix: () => x("common.page.pagination.prefix", { total: y.total }),
|
|
1121
|
+
suffix: () => x("common.page.pagination.suffix")
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
});
|
|
1125
|
+
function _isSlot$3(e) {
|
|
1126
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
|
|
1127
|
+
}
|
|
1128
|
+
const DataSelection = /* @__PURE__ */ defineComponent({
|
|
1129
|
+
name: "DataSelection",
|
|
1130
|
+
props: {
|
|
1131
|
+
modelValue: {
|
|
1132
|
+
type: String,
|
|
1133
|
+
required: !0
|
|
1134
|
+
},
|
|
1135
|
+
count: {
|
|
1136
|
+
type: Number,
|
|
1137
|
+
default: 0
|
|
1138
|
+
}
|
|
1139
|
+
},
|
|
1140
|
+
emits: {
|
|
1141
|
+
"update:modelValue": () => !0,
|
|
1142
|
+
clear: () => !0
|
|
1143
|
+
},
|
|
1144
|
+
setup(y, { emit: b }) {
|
|
1145
|
+
let { t: x } = useI18n();
|
|
1146
|
+
return () => {
|
|
1147
|
+
let e;
|
|
1148
|
+
return y.modelValue !== "selection" && y.count === 0 ? createVNode("div", null, null) : createVNode("div", null, [createVNode(NFlex, {
|
|
1149
|
+
align: "center",
|
|
1150
|
+
"wrap-item": !1
|
|
1151
|
+
}, { default: () => [
|
|
1152
|
+
createVNode("span", null, [x("common.page.selection.countText", { count: y.count })]),
|
|
1153
|
+
createVNode(NButton, {
|
|
1154
|
+
text: !0,
|
|
1155
|
+
type: "primary",
|
|
1156
|
+
onClick: () => {
|
|
1157
|
+
b("update:modelValue", y.modelValue === "all" ? "selection" : "all");
|
|
1158
|
+
}
|
|
1159
|
+
}, { default: () => [y.modelValue === "all" ? x("common.page.selection.view") : x("common.page.selection.back")] }),
|
|
1160
|
+
createVNode(NButton, {
|
|
1161
|
+
text: !0,
|
|
1162
|
+
onClick: () => {
|
|
1163
|
+
b("clear"), b("update:modelValue", "all");
|
|
1164
|
+
}
|
|
1165
|
+
}, _isSlot$3(e = x("common.page.selection.clear")) ? e : { default: () => [e] })
|
|
1166
|
+
] })]);
|
|
1167
|
+
};
|
|
1168
|
+
}
|
|
1169
|
+
});
|
|
1170
|
+
function _isSlot$2(e) {
|
|
1171
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
|
|
1172
|
+
}
|
|
1173
|
+
function _map(e, b) {
|
|
1174
|
+
return (e ?? []).map((e) => {
|
|
1175
|
+
let x = {
|
|
1176
|
+
csvTitle: e.exportTitle,
|
|
1177
|
+
...e,
|
|
1178
|
+
title: () => {
|
|
1179
|
+
let b = toValue(e.title), x = b && withDirectives(createVNode("span", null, [b]), [[
|
|
1180
|
+
vTooltip,
|
|
1181
|
+
() => toValue(e.title),
|
|
1182
|
+
void 0,
|
|
1183
|
+
{ auto: !0 }
|
|
1184
|
+
]]);
|
|
1185
|
+
return e.tooltip ? createVNode(NFlex, {
|
|
1186
|
+
size: 3,
|
|
1187
|
+
wrap: !1,
|
|
1188
|
+
inline: !0,
|
|
1189
|
+
style: "max-width: 100%"
|
|
1190
|
+
}, { default: () => [x, createVNode(NTooltip, null, {
|
|
1191
|
+
default: toValue(e.tooltip),
|
|
1192
|
+
trigger: () => createVNode(NButton, {
|
|
1193
|
+
text: !0,
|
|
1194
|
+
style: "font-size: 1.25em; opacity: 0.8"
|
|
1195
|
+
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(IHelp, null, null)] })] })
|
|
1196
|
+
})] }) : x;
|
|
1197
|
+
}
|
|
1198
|
+
};
|
|
1199
|
+
if (e.children?.length) x.children = _map(e.children, b);
|
|
1200
|
+
else {
|
|
1201
|
+
e.hidden !== !0 && (x.width ??= 100, b.value += Number(x.width));
|
|
1202
|
+
let y = e.render ?? ((e) => e);
|
|
1203
|
+
e.ellipsis !== !1 && (x.ellipsis = !1, x.render = (...b) => {
|
|
1204
|
+
let x = y(...b);
|
|
1205
|
+
return createVNode(NPerformantEllipsis, mergeProps({
|
|
1206
|
+
expandTrigger: "click",
|
|
1207
|
+
lineClamp: 1,
|
|
1208
|
+
tooltip: { style: {
|
|
1209
|
+
maxWidth: "61.8vw",
|
|
1210
|
+
wordBreak: "break-all"
|
|
1211
|
+
} }
|
|
1212
|
+
}, typeof e.ellipsis == "boolean" ? {} : e.ellipsis), _isSlot$2(x) ? x : { default: () => [x] });
|
|
1213
|
+
}, e.ellipsisTooltip === !0 && (x.ellipsisTooltip ??= y)), Object.assign(x, {
|
|
1214
|
+
resizable: e.resizable !== !1,
|
|
1215
|
+
sorter: e.sortable,
|
|
1216
|
+
type: ["selection", "expand"].includes(e.type) ? e.type : void 0,
|
|
1217
|
+
disabled: e.selectable ? (y) => e.selectable(y) === !1 : void 0
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
return x.key === "$actions" && (x.cellProps ??= () => ({ style: { padding: "0 2px" } })), x;
|
|
1221
|
+
}).filter((e) => e?.hidden !== !0);
|
|
1222
|
+
}
|
|
1223
|
+
const DataTable = /* @__PURE__ */ defineComponent({
|
|
1224
|
+
name: "DataTable",
|
|
1225
|
+
props: {
|
|
1226
|
+
data: {
|
|
1227
|
+
type: Array,
|
|
1228
|
+
default: () => []
|
|
1229
|
+
},
|
|
1230
|
+
columns: {
|
|
1231
|
+
type: Array,
|
|
1232
|
+
default: () => []
|
|
1233
|
+
},
|
|
1234
|
+
keyField: { type: String },
|
|
1235
|
+
sorter: {
|
|
1236
|
+
type: Object,
|
|
1237
|
+
default: () => ({})
|
|
1238
|
+
},
|
|
1239
|
+
selectedKeys: { type: Array },
|
|
1240
|
+
highlight: {
|
|
1241
|
+
type: [
|
|
1242
|
+
Boolean,
|
|
1243
|
+
String,
|
|
1244
|
+
Number,
|
|
1245
|
+
Object
|
|
1246
|
+
],
|
|
1247
|
+
default: !0
|
|
1248
|
+
},
|
|
1249
|
+
rowClassName: dataTableProps.rowClassName,
|
|
1250
|
+
rowProps: dataTableProps.rowProps
|
|
1251
|
+
},
|
|
1252
|
+
emits: [
|
|
1253
|
+
"sort",
|
|
1254
|
+
"select",
|
|
1255
|
+
"custom",
|
|
1256
|
+
"highlight"
|
|
1257
|
+
],
|
|
1258
|
+
setup(e, { slots: y, emit: S, expose: C }) {
|
|
1259
|
+
let { keyField: w } = inject(PAGE_INJECTION), T = useMergedClsPrefix(), D = `${T.value}-datatable`;
|
|
1260
|
+
useStyle("-datatable", style, T);
|
|
1261
|
+
let O = useTemplateRef("table-ref"), k = ({ sortField: e, sortOrder: y } = {}, b) => {
|
|
1262
|
+
e == b?.sortField && y == b?.sortOrder || O.value?.sort(e, y ? y + "end" : !1);
|
|
1263
|
+
};
|
|
1264
|
+
watch(() => ({ ...e.sorter }), k, { deep: !0 });
|
|
1265
|
+
let j = computed(() => {
|
|
1266
|
+
let y = e.keyField || w || "key";
|
|
1267
|
+
return (e) => e[y];
|
|
1268
|
+
}), M = shallowRef({
|
|
1269
|
+
cache: [],
|
|
1270
|
+
scrollToView(...e) {
|
|
1271
|
+
this.cache.push(e);
|
|
1272
|
+
}
|
|
1273
|
+
});
|
|
1274
|
+
until(O).changed().then(() => {
|
|
1275
|
+
k(e.sorter);
|
|
1276
|
+
let y = M.value.cache;
|
|
1277
|
+
M.value = O.value, M.value.scrollToView = (y) => {
|
|
1278
|
+
let b = e.data.findIndex((e) => j.value(e) === y);
|
|
1279
|
+
if (b === -1) return;
|
|
1280
|
+
let x = O.value.$el.querySelector(`.${D}__row-marker:nth-child(${b + 1})`);
|
|
1281
|
+
O.value.scrollTo({
|
|
1282
|
+
top: x.offsetTop,
|
|
1283
|
+
behavior: "smooth"
|
|
1284
|
+
});
|
|
1285
|
+
};
|
|
1286
|
+
for (let e of y) M.value.scrollToView(...e);
|
|
1287
|
+
}), C(toReactive(M));
|
|
1288
|
+
let N = ref(0), P = shallowRef([]);
|
|
1289
|
+
watch(() => e.columns, () => {
|
|
1290
|
+
N.value = 0, P.value = _map(e.columns, N);
|
|
1291
|
+
}, {
|
|
1292
|
+
immediate: !0,
|
|
1293
|
+
deep: 1
|
|
1294
|
+
});
|
|
1295
|
+
let L = ref();
|
|
1296
|
+
watch(() => e.highlight, (e) => {
|
|
1297
|
+
L.value = typeof e == "boolean" ? null : e ?? null;
|
|
1298
|
+
}, { immediate: !0 });
|
|
1299
|
+
let R = computed(() => (y, b) => [
|
|
1300
|
+
e.rowClassName?.(y, b) || "",
|
|
1301
|
+
`${D}__row-marker`,
|
|
1302
|
+
L.value != null && j.value(y) === L.value ? `${D}__row-highlight` : ""
|
|
1303
|
+
].join(" ")), z = computed(() => (y, b) => {
|
|
1304
|
+
let x = e.rowProps?.(y, b);
|
|
1305
|
+
return {
|
|
1306
|
+
...x,
|
|
1307
|
+
onClick: (b) => {
|
|
1308
|
+
let C = j.value(y);
|
|
1309
|
+
e.highlight === !0 && (L.value = C), S("highlight", C), x?.onClick?.(b);
|
|
1310
|
+
}
|
|
1311
|
+
};
|
|
1312
|
+
}), B = (y) => {
|
|
1313
|
+
if (e.sorter) {
|
|
1314
|
+
let { sortField: b, sortOrder: x } = e.sorter;
|
|
1315
|
+
if (y?.columnKey == b && (y?.order ? y.order === x + "end" : !x)) return;
|
|
1316
|
+
}
|
|
1317
|
+
S("sort", {
|
|
1318
|
+
sortField: y?.order ? y?.columnKey : void 0,
|
|
1319
|
+
sortOrder: y?.order ? y.order.replace("end", "") : void 0
|
|
1320
|
+
});
|
|
1321
|
+
}, U = (e) => {
|
|
1322
|
+
S("select", e);
|
|
1323
|
+
}, G = (e, y, b) => {
|
|
1324
|
+
S("custom", {
|
|
1325
|
+
key: b.key,
|
|
1326
|
+
width: e
|
|
1327
|
+
});
|
|
1328
|
+
};
|
|
1329
|
+
return () => createVNode(NDataTable, {
|
|
1330
|
+
class: D,
|
|
1331
|
+
data: e.data,
|
|
1332
|
+
columns: P.value,
|
|
1333
|
+
rowKey: j.value,
|
|
1334
|
+
tableLayout: "fixed",
|
|
1335
|
+
ref: "table-ref",
|
|
1336
|
+
scrollX: N.value,
|
|
1337
|
+
rowClassName: R.value,
|
|
1338
|
+
rowProps: z.value,
|
|
1339
|
+
checkedRowKeys: e.selectedKeys,
|
|
1340
|
+
onUpdateSorter: B,
|
|
1341
|
+
onUpdateCheckedRowKeys: U,
|
|
1342
|
+
onUnstableColumnResize: G
|
|
1343
|
+
}, _isSlot$2(y) ? y : { default: () => [y] });
|
|
1344
|
+
}
|
|
1345
|
+
});
|
|
1346
|
+
var style = /* @__PURE__ */ cB("datatable", [cE("row-highlight", [c("& > td", { backgroundColor: "var(--n-tr-highlight-color, var(--n-merged-border-color)) !important" })])]);
|
|
1347
|
+
function useDataTableDrag(e, { data: y, onSort: b, ...x }) {
|
|
1348
|
+
watch([ref(y), e], async ([e, y]) => {
|
|
1349
|
+
if (e.length === 0) return;
|
|
1350
|
+
await nextTick();
|
|
1351
|
+
let S = unrefElement(y)?.querySelector(".n-data-table-base-table-body .n-data-table-tbody");
|
|
1352
|
+
if (!S) return;
|
|
1353
|
+
let C = Sortable$1.create(S, {
|
|
1354
|
+
animation: 150,
|
|
1355
|
+
...x,
|
|
1356
|
+
onSort(e) {
|
|
1357
|
+
b({
|
|
1358
|
+
from: e.oldIndex,
|
|
1359
|
+
to: e.newIndex
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1362
|
+
});
|
|
1363
|
+
return () => {
|
|
1364
|
+
C.destroy();
|
|
1365
|
+
};
|
|
1366
|
+
}, { immediate: !0 });
|
|
1367
|
+
}
|
|
1368
|
+
function _isSlot$1(e) {
|
|
1369
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
|
|
1370
|
+
}
|
|
1371
|
+
const NRadios = /* @__PURE__ */ defineComponent({
|
|
1372
|
+
name: "Radios",
|
|
1373
|
+
props: {
|
|
1374
|
+
options: {
|
|
1375
|
+
type: Array,
|
|
1376
|
+
default: () => []
|
|
1377
|
+
},
|
|
1378
|
+
vertical: {
|
|
1379
|
+
type: Boolean,
|
|
1380
|
+
default: !1
|
|
1381
|
+
},
|
|
1382
|
+
type: {
|
|
1383
|
+
type: String,
|
|
1384
|
+
default: "radio"
|
|
1385
|
+
},
|
|
1386
|
+
default: {
|
|
1387
|
+
type: [
|
|
1388
|
+
Boolean,
|
|
1389
|
+
String,
|
|
1390
|
+
Object
|
|
1391
|
+
],
|
|
1392
|
+
default: !1
|
|
1393
|
+
},
|
|
1394
|
+
padding: {
|
|
1395
|
+
type: String,
|
|
1396
|
+
default: void 0
|
|
1397
|
+
},
|
|
1398
|
+
labelField: {
|
|
1399
|
+
type: String,
|
|
1400
|
+
default: "label"
|
|
1401
|
+
},
|
|
1402
|
+
valueField: {
|
|
1403
|
+
type: String,
|
|
1404
|
+
default: "value"
|
|
1405
|
+
},
|
|
1406
|
+
disabledField: {
|
|
1407
|
+
type: String,
|
|
1408
|
+
default: "disabled"
|
|
1409
|
+
},
|
|
1410
|
+
modelValue: {
|
|
1411
|
+
type: [
|
|
1412
|
+
String,
|
|
1413
|
+
Number,
|
|
1414
|
+
Boolean
|
|
1415
|
+
],
|
|
1416
|
+
default: void 0
|
|
1417
|
+
}
|
|
1418
|
+
},
|
|
1419
|
+
emits: {
|
|
1420
|
+
"update:modelValue": () => !0,
|
|
1421
|
+
updateModelValue: () => !0
|
|
1422
|
+
},
|
|
1423
|
+
setup(y, { emit: b }) {
|
|
1424
|
+
let { t: x } = useI18n(), S = computed(() => y.default === !1 ? "" : y.default === !0 ? x("common.all") : typeof y.default == "string" ? y.default : y.default?.[y.labelField] ?? x("common.all")), C = computed(() => y.type === "button-primary" ? {
|
|
1425
|
+
"--n-button-color-active": "var(--color-primary)",
|
|
1426
|
+
"--n-button-text-color-active": "var(--color-base)"
|
|
1427
|
+
} : {}), w = (e) => {
|
|
1428
|
+
b("update:modelValue", e), b("updateModelValue", e);
|
|
1429
|
+
};
|
|
1430
|
+
return () => {
|
|
1431
|
+
let e = y.type === "button" ? NRadioButton : NRadio, b = createVNode(Fragment, null, [y.default ? createVNode(e, { value: typeof y.default == "object" ? y.default?.[y.valueField] : null }, { default: () => [S.value] }) : void 0, y.options?.map((b) => {
|
|
1432
|
+
let x = typeof b[y.labelField] == "string" ? b[y.labelField] : b[y.labelField]?.();
|
|
1433
|
+
return createVNode(e, {
|
|
1434
|
+
value: b[y.valueField],
|
|
1435
|
+
disabled: b[y.disabledField],
|
|
1436
|
+
style: y.padding ? {
|
|
1437
|
+
paddingLeft: y.padding,
|
|
1438
|
+
paddingRight: y.padding
|
|
1439
|
+
} : {}
|
|
1440
|
+
}, { default: () => [b.tip ? createVNode(NTooltip, null, {
|
|
1441
|
+
default: () => b.tip,
|
|
1442
|
+
trigger: () => x
|
|
1443
|
+
}) : x] });
|
|
1444
|
+
})]);
|
|
1445
|
+
return createVNode(NRadioGroup, {
|
|
1446
|
+
style: y.vertical ? {
|
|
1447
|
+
...C.value,
|
|
1448
|
+
padding: "6px 0 0"
|
|
1449
|
+
} : C.value,
|
|
1450
|
+
value: y.modelValue,
|
|
1451
|
+
onUpdateValue: w
|
|
1452
|
+
}, { default: () => [y.type === "radio" ? createVNode(NFlex, {
|
|
1453
|
+
size: y.vertical ? void 0 : "small",
|
|
1454
|
+
vertical: y.vertical
|
|
1455
|
+
}, _isSlot$1(b) ? b : { default: () => [b] }) : b] });
|
|
1456
|
+
};
|
|
1457
|
+
}
|
|
1458
|
+
});
|
|
1459
|
+
function _isSlot(e) {
|
|
1460
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
|
|
1461
|
+
}
|
|
1462
|
+
const DtUserDept = /* @__PURE__ */ defineComponent({
|
|
1463
|
+
name: "UserDept",
|
|
1464
|
+
inheritAttrs: !1,
|
|
1465
|
+
props: {
|
|
1466
|
+
users: {
|
|
1467
|
+
type: Array,
|
|
1468
|
+
default: () => []
|
|
1469
|
+
},
|
|
1470
|
+
groups: {
|
|
1471
|
+
type: Array,
|
|
1472
|
+
default: () => []
|
|
1473
|
+
},
|
|
1474
|
+
depts: {
|
|
1475
|
+
type: Array,
|
|
1476
|
+
default: () => []
|
|
1477
|
+
},
|
|
1478
|
+
modelValue: {
|
|
1479
|
+
type: [Array, String],
|
|
1480
|
+
default: void 0
|
|
1481
|
+
},
|
|
1482
|
+
placeholder: {
|
|
1483
|
+
type: String,
|
|
1484
|
+
default: void 0
|
|
1485
|
+
},
|
|
1486
|
+
size: {
|
|
1487
|
+
type: String,
|
|
1488
|
+
default: void 0
|
|
1489
|
+
},
|
|
1490
|
+
type: {
|
|
1491
|
+
type: String,
|
|
1492
|
+
default: "user"
|
|
1493
|
+
},
|
|
1494
|
+
selectType: {
|
|
1495
|
+
type: String,
|
|
1496
|
+
default: "dropdown"
|
|
1497
|
+
},
|
|
1498
|
+
max: {
|
|
1499
|
+
type: Number,
|
|
1500
|
+
default: void 0
|
|
1501
|
+
},
|
|
1502
|
+
multiple: {
|
|
1503
|
+
type: Boolean,
|
|
1504
|
+
default: !1
|
|
1505
|
+
},
|
|
1506
|
+
defaultExpandAll: {
|
|
1507
|
+
type: Boolean,
|
|
1508
|
+
default: !1
|
|
1509
|
+
},
|
|
1510
|
+
filterable: {
|
|
1511
|
+
type: Boolean,
|
|
1512
|
+
default: !1
|
|
1513
|
+
},
|
|
1514
|
+
disabled: {
|
|
1515
|
+
type: Boolean,
|
|
1516
|
+
default: void 0
|
|
1517
|
+
},
|
|
1518
|
+
getUsersByGroup: {
|
|
1519
|
+
type: Function,
|
|
1520
|
+
default: () => []
|
|
1521
|
+
},
|
|
1522
|
+
getUsersByDept: {
|
|
1523
|
+
type: Function,
|
|
1524
|
+
default: () => []
|
|
1525
|
+
},
|
|
1526
|
+
valueField: { type: String }
|
|
1527
|
+
},
|
|
1528
|
+
emits: ["update:modelValue", "updateModelValue"],
|
|
1529
|
+
setup(y, { emit: b, attrs: x }) {
|
|
1530
|
+
let { t: S } = useI18n(), { localeRef: C } = useLocale("Popconfirm"), w = computed(() => y.valueField || (y.type === "user" ? "username" : "code")), D = computed(() => {
|
|
1531
|
+
if (y.multiple) return y.modelValue || [];
|
|
1532
|
+
let e = y.modelValue?.trim();
|
|
1533
|
+
return e ? [e] : [];
|
|
1534
|
+
}), O = /* @__PURE__ */ new Map(), k = computed(() => (O.clear(), y.users.map((e) => (e = reactive(e), e.label = e.nickname + e.username, e.value = e[w.value], e.type = "user", O.set(e[w.value], e), e)))), A = shallowRef([]);
|
|
1535
|
+
watch(() => y.depts, (e) => {
|
|
1536
|
+
walkTree(e, (e) => {
|
|
1537
|
+
e.label = e.name, e.value = e[w.value], e.type = "dept", e.children?.length || delete e.children;
|
|
1538
|
+
}), A.value = flattenTree(e);
|
|
1539
|
+
}, { immediate: !0 });
|
|
1540
|
+
let j = computed(() => [
|
|
1541
|
+
...y.depts,
|
|
1542
|
+
...y.groups.map((e) => ({
|
|
1543
|
+
label: e.name,
|
|
1544
|
+
value: e.code,
|
|
1545
|
+
type: "group"
|
|
1546
|
+
})),
|
|
1547
|
+
...k.value
|
|
1548
|
+
]), L = ref([]), R = ref(), z = async (e) => {
|
|
1549
|
+
let b = await (e.type === "group" ? y.getUsersByGroup(e.value) : y.getUsersByDept(e.value));
|
|
1550
|
+
for (let e of k.value) e.disabled = !0;
|
|
1551
|
+
R.value = [...e.type === "dept" ? e.children ?? [] : [], ...b.map((e) => {
|
|
1552
|
+
let y = O.get(e[w.value]);
|
|
1553
|
+
return y && (y.disabled = !1), {
|
|
1554
|
+
...e,
|
|
1555
|
+
label: e.nickname + e.username,
|
|
1556
|
+
value: e[w.value],
|
|
1557
|
+
type: "user"
|
|
1558
|
+
};
|
|
1559
|
+
})];
|
|
1560
|
+
}, B = /* @__PURE__ */ new WeakMap(), V = (e, b, x) => {
|
|
1561
|
+
let C;
|
|
1562
|
+
if (y.type === "dept") return createVNode(NTree, {
|
|
1563
|
+
data: y.depts,
|
|
1564
|
+
keyField: "value",
|
|
1565
|
+
labelField: "name",
|
|
1566
|
+
defaultExpandAll: y.defaultExpandAll,
|
|
1567
|
+
checkable: y.multiple,
|
|
1568
|
+
selectable: !y.multiple,
|
|
1569
|
+
multiple: !1,
|
|
1570
|
+
blockLine: !0,
|
|
1571
|
+
checkOnClick: !0,
|
|
1572
|
+
pattern: x,
|
|
1573
|
+
filter: (e, y) => y.label.includes(e) || y.value.includes(e),
|
|
1574
|
+
checkedKeys: y.multiple ? e : void 0,
|
|
1575
|
+
selectedKeys: y.multiple ? void 0 : e,
|
|
1576
|
+
onUpdateCheckedKeys: (e) => {
|
|
1577
|
+
y.max && e?.length > y.max || b(e);
|
|
1578
|
+
},
|
|
1579
|
+
onUpdateSelectedKeys: (e) => {
|
|
1580
|
+
b(e);
|
|
1581
|
+
}
|
|
1582
|
+
}, null);
|
|
1583
|
+
let w = e ? B.get(e) : /* @__PURE__ */ new Set();
|
|
1584
|
+
if (e && !w && (w = new Set(e), B.set(e, w)), R.value === !1) return createVNode(NSpin, { show: !0 }, null);
|
|
1585
|
+
let E = R.value || j.value;
|
|
1586
|
+
x = x?.trim(), x && (E = E?.filter((e) => e.label.includes(x) || e.value.includes(x)));
|
|
1587
|
+
let D = L.value;
|
|
1588
|
+
return createVNode(Fragment, null, [createVNode("div", { style: "margin: 12px 16px; display: flex; justify-content: space-between; align-items: center" }, [D.length > 0 ? createVNode(Fragment, null, [createVNode("span", { style: "display: flex; align-items: center" }, [
|
|
1589
|
+
D.length >= 2 ? D.at(-2).label : S("common.all"),
|
|
1590
|
+
createVNode("span", { style: "padding: 0 4px" }, [createVNode(IRight, null, null)]),
|
|
1591
|
+
D.at(-1).label
|
|
1592
|
+
]), createVNode(NButton, {
|
|
1593
|
+
text: !0,
|
|
1594
|
+
type: "warning",
|
|
1595
|
+
onClick: () => {
|
|
1596
|
+
if (D.pop(), R.value = D.length > 0 ? !1 : void 0, D.length > 0) z(D.at(-1));
|
|
1597
|
+
else for (let e of k.value) e.disabled = !1;
|
|
1598
|
+
}
|
|
1599
|
+
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(ILeft, null, null)] }), S("common.back")] })]) : createVNode("span", null, [S("common.all")])]), E?.length ? createVNode(NList, {
|
|
1600
|
+
showDivider: !1,
|
|
1601
|
+
style: "padding: 0 16px"
|
|
1602
|
+
}, _isSlot(C = E.map((x) => {
|
|
1603
|
+
let S, C;
|
|
1604
|
+
return createVNode(NListItem, {
|
|
1605
|
+
key: x.type + "_" + x.value,
|
|
1606
|
+
style: "padding: 6px 0"
|
|
1607
|
+
}, { default: () => [x.type === "user" ? y.multiple ? createVNode(NCheckbox, {
|
|
1608
|
+
checked: w.has(x.value) || !1,
|
|
1609
|
+
onUpdateChecked: (S) => {
|
|
1610
|
+
if (S && y.max && e.length >= y.max) return;
|
|
1611
|
+
let C = [...e || []];
|
|
1612
|
+
if (S) C.push(x.value);
|
|
1613
|
+
else {
|
|
1614
|
+
let e = C.indexOf(x.value);
|
|
1615
|
+
C.splice(e, 1);
|
|
1616
|
+
}
|
|
1617
|
+
b(C);
|
|
1618
|
+
},
|
|
1619
|
+
style: "margin-left: 3px"
|
|
1620
|
+
}, _isSlot(S = renderUsers([x], {
|
|
1621
|
+
max: 1,
|
|
1622
|
+
size: 24,
|
|
1623
|
+
placement: "right",
|
|
1624
|
+
tooltip: !1,
|
|
1625
|
+
username: !0
|
|
1626
|
+
})) ? S : { default: () => [S] }) : createVNode(NRadio, {
|
|
1627
|
+
checked: w.has(x.value) || !1,
|
|
1628
|
+
onUpdateChecked: (e) => {
|
|
1629
|
+
b(e ? [x.value] : []);
|
|
1630
|
+
},
|
|
1631
|
+
style: "margin-left: 3px;"
|
|
1632
|
+
}, _isSlot(C = renderUsers([x], {
|
|
1633
|
+
max: 1,
|
|
1634
|
+
size: 24,
|
|
1635
|
+
placement: "right",
|
|
1636
|
+
tooltip: !1,
|
|
1637
|
+
username: !0
|
|
1638
|
+
})) ? C : { default: () => [C] }) : createVNode("div", {
|
|
1639
|
+
onClick: () => {
|
|
1640
|
+
R.value = !1, L.value.push(x), z(x);
|
|
1641
|
+
},
|
|
1642
|
+
style: "cursor: pointer; display: flex; align-items: center; gap: 8px"
|
|
1643
|
+
}, [
|
|
1644
|
+
x.type === "dept" ? createVNode(NAvatar, {
|
|
1645
|
+
size: 24,
|
|
1646
|
+
style: "background-color: red"
|
|
1647
|
+
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(IDept, null, null)] })] }) : createVNode(NAvatar, {
|
|
1648
|
+
size: 24,
|
|
1649
|
+
style: "background-color: green"
|
|
1650
|
+
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(IGroup, null, null)] })] }),
|
|
1651
|
+
createVNode("span", { style: "flex: 1 1 auto" }, [x.label]),
|
|
1652
|
+
createVNode(NIcon, null, { default: () => [createVNode(IRight, null, null)] })
|
|
1653
|
+
])] });
|
|
1654
|
+
})) ? C : { default: () => [C] }) : createVNode(NEmpty, null, null)]);
|
|
1655
|
+
}, U = () => createVNode(NEmpty, { description: y.placeholder }, null), W = ({ option: e }) => e.type === "user" ? createVNode("span", null, [e.nickname, createVNode("span", { style: {
|
|
1656
|
+
opacity: .4,
|
|
1657
|
+
marginLeft: "8px"
|
|
1658
|
+
} }, [e.username])]) : createVNode("span", null, [e.label]), G = (e, b, x, S, C) => createVNode(NTransfer, mergeProps(e, {
|
|
1659
|
+
key: y.type,
|
|
1660
|
+
options: b,
|
|
1661
|
+
renderSourceList: ({ onCheck: e, pattern: y }) => V(x, e, y),
|
|
1662
|
+
renderTargetList: y.placeholder?.trim() && !y.modelValue?.length ? U : void 0,
|
|
1663
|
+
renderTargetLabel: W,
|
|
1664
|
+
sourceFilterable: y.filterable,
|
|
1665
|
+
size: y.size,
|
|
1666
|
+
disabled: y.disabled || void 0,
|
|
1667
|
+
value: x,
|
|
1668
|
+
filter: (e, y) => y.label.includes(e) || y.value.includes(e),
|
|
1669
|
+
"onUpdate:value": (e) => {
|
|
1670
|
+
S?.(e);
|
|
1671
|
+
},
|
|
1672
|
+
onUpdateValue: (e) => {
|
|
1673
|
+
C?.(e);
|
|
1674
|
+
}
|
|
1675
|
+
}), null), K = ({ option: e, handleClose: b }) => createVNode(NTag, {
|
|
1676
|
+
type: y.type === "user" ? "primary" : "info",
|
|
1677
|
+
closable: !0,
|
|
1678
|
+
onMousedown: (e) => e.preventDefault(),
|
|
1679
|
+
onClose: (e) => {
|
|
1680
|
+
e.stopPropagation(), b();
|
|
1681
|
+
}
|
|
1682
|
+
}, { default: () => [e.label] }), q = (e, x = "updateModelValue") => {
|
|
1683
|
+
y.multiple ? b(x, e) : b(x, e?.[0]);
|
|
1684
|
+
}, J = ref(), Y = !1, X = useDialog(), Z = () => {
|
|
1685
|
+
if (Y) return;
|
|
1686
|
+
Y = !0;
|
|
1687
|
+
let e = shallowRef([...D.value || []]);
|
|
1688
|
+
X.create({
|
|
1689
|
+
showIcon: !1,
|
|
1690
|
+
title: y.placeholder,
|
|
1691
|
+
style: { width: "700px" },
|
|
1692
|
+
content: () => createVNode("div", { style: { height: "550px" } }, [G({ style: { height: "100%" } }, y.type === "user" ? k.value : A.value, e.value, (y) => e.value = y)]),
|
|
1693
|
+
positiveText: C.value.positiveText,
|
|
1694
|
+
negativeText: C.value.negativeText,
|
|
1695
|
+
onPositiveClick() {
|
|
1696
|
+
q(e.value, "update:modelValue"), q(e.value, "updateModelValue");
|
|
1697
|
+
},
|
|
1698
|
+
onAfterLeave() {
|
|
1699
|
+
nextTick(() => {
|
|
1700
|
+
J.value?.blur(), Y = !1;
|
|
1701
|
+
});
|
|
1702
|
+
}
|
|
1703
|
+
});
|
|
1704
|
+
}, $ = { arrow: () => createVNode(NIcon, null, { default: () => [y.type === "user" ? createVNode(IGroup, null, null) : createVNode(IDept, null, null)] }) };
|
|
1705
|
+
return () => {
|
|
1706
|
+
let e = y.type === "user" ? k.value : A.value;
|
|
1707
|
+
if (y.selectType === "dropdown" && y.type === "dept") return createVNode(NTreeSelect, {
|
|
1708
|
+
options: e,
|
|
1709
|
+
keyField: "value",
|
|
1710
|
+
defaultExpandAll: y.defaultExpandAll,
|
|
1711
|
+
checkable: y.multiple,
|
|
1712
|
+
multiple: y.multiple,
|
|
1713
|
+
filter: (e, y) => y.label.includes(e) || y.value.includes(e),
|
|
1714
|
+
value: y.modelValue,
|
|
1715
|
+
onUpdateValue: (e) => {
|
|
1716
|
+
y.multiple && y.max && e?.length > y.max || b("updateModelValue", e);
|
|
1717
|
+
},
|
|
1718
|
+
"onUpdate:value": (e) => {
|
|
1719
|
+
y.multiple && y.max && e?.length > y.max || b("update:modelValue", e);
|
|
1720
|
+
}
|
|
1721
|
+
}, _isSlot($) ? $ : { default: () => [$] });
|
|
1722
|
+
if (y.selectType === "transfer") return G(x, e, D.value, (e) => q(e, "update:modelValue"), (e) => q(e, "updateModelValue"));
|
|
1723
|
+
let S = y.selectType === "dropdown";
|
|
1724
|
+
return createVNode(NSelect, mergeProps(x, {
|
|
1725
|
+
key: y.type,
|
|
1726
|
+
ref: J,
|
|
1727
|
+
show: S ? void 0 : !1,
|
|
1728
|
+
filterable: S ? y.filterable : !1,
|
|
1729
|
+
options: e,
|
|
1730
|
+
multiple: y.multiple,
|
|
1731
|
+
size: y.size,
|
|
1732
|
+
placeholder: y.placeholder,
|
|
1733
|
+
disabled: y.disabled || void 0,
|
|
1734
|
+
value: y.modelValue,
|
|
1735
|
+
renderTag: y.multiple ? K : void 0,
|
|
1736
|
+
onFocus: S ? void 0 : Z,
|
|
1737
|
+
onUpdateValue: (e) => {
|
|
1738
|
+
b("updateModelValue", e);
|
|
1739
|
+
},
|
|
1740
|
+
"onUpdate:value": (e) => {
|
|
1741
|
+
b("update:modelValue", e);
|
|
1742
|
+
}
|
|
1743
|
+
}), _isSlot($) ? $ : { default: () => [$] });
|
|
1744
|
+
};
|
|
1745
|
+
}
|
|
1746
|
+
});
|
|
1747
|
+
function renderUser(e, y, { placement: b, size: x, tooltip: S = !0, username: C = !1 }) {
|
|
1748
|
+
let w = e.nickname.split(" ").at(-1), E = w;
|
|
1749
|
+
return /^[\u4E00-\u9FA5]+$/.test(w) ? E = w.length >= 3 ? w.slice(-2) : w : w.length > 4 && (E = createVNode(NIcon, null, { default: () => [createVNode(IAccount, null, null)] })), createVNode(NPopover, {
|
|
1750
|
+
key: e.username,
|
|
1751
|
+
raw: !0,
|
|
1752
|
+
placement: b,
|
|
1753
|
+
disabled: S === !1
|
|
1754
|
+
}, {
|
|
1755
|
+
default: () => createVNode(NCard, {
|
|
1756
|
+
style: "width: 200px",
|
|
1757
|
+
size: "small"
|
|
1758
|
+
}, { default: () => [createVNode(NH4, null, { default: () => [e.nickname] }), createVNode("span", null, [e.username])] }),
|
|
1759
|
+
trigger: () => {
|
|
1760
|
+
let b = createVNode(NAvatar, {
|
|
1761
|
+
color: "var(--color-primary)",
|
|
1762
|
+
round: !0,
|
|
1763
|
+
size: x,
|
|
1764
|
+
style: y ? {
|
|
1765
|
+
position: "absolute",
|
|
1766
|
+
bottom: -(x - 16) / 2 + "px"
|
|
1767
|
+
} : ""
|
|
1768
|
+
}, _isSlot(E) ? E : { default: () => [E] });
|
|
1769
|
+
return y ? createVNode("div", { style: y ? {
|
|
1770
|
+
display: "inline-flex",
|
|
1771
|
+
itemsAlign: "center",
|
|
1772
|
+
whiteSpace: "nowrap",
|
|
1773
|
+
minWidth: x + "px",
|
|
1774
|
+
height: x + "px"
|
|
1775
|
+
} : "" }, [b, y ? createVNode(Fragment, null, [createVNode("span", { style: { marginLeft: x + 6 + "px" } }, [e.nickname]), C ? createVNode("span", { style: {
|
|
1776
|
+
marginLeft: "8px",
|
|
1777
|
+
opacity: .4
|
|
1778
|
+
} }, [e.username]) : void 0]) : void 0]) : b;
|
|
1779
|
+
}
|
|
1780
|
+
});
|
|
1781
|
+
}
|
|
1782
|
+
function renderUsers(e, y = {}) {
|
|
1783
|
+
y.size ||= 24, y.max ||= 4;
|
|
1784
|
+
let { max: b, size: x } = y;
|
|
1785
|
+
return e.length <= 1 ? createVNode("span", { style: "position: relative" }, [e.map((e) => renderUser(e, !0, y))]) : createVNode("span", { style: {
|
|
1786
|
+
display: "inline-block",
|
|
1787
|
+
height: x + "px"
|
|
1788
|
+
} }, [createVNode(NAvatarGroup, {
|
|
1789
|
+
options: e,
|
|
1790
|
+
size: x,
|
|
1791
|
+
max: b || 4,
|
|
1792
|
+
style: "top: -2px"
|
|
1793
|
+
}, {
|
|
1794
|
+
avatar: ({ option: e }) => renderUser(e, !1, y),
|
|
1795
|
+
rest: ({ options: e, rest: y }) => createVNode(NDropdown, {
|
|
1796
|
+
options: e,
|
|
1797
|
+
keyField: "username",
|
|
1798
|
+
labelField: "nickname",
|
|
1799
|
+
renderOption: ({ option: y }) => renderUser(y, !1, e)
|
|
1800
|
+
}, { default: () => [createVNode(NAvatar, null, { default: () => [createTextVNode("+"), y] })] })
|
|
1801
|
+
})]);
|
|
1802
|
+
}
|
|
1803
|
+
const DtDeptRender = /* @__PURE__ */ defineComponent({
|
|
1804
|
+
name: "DeptRender",
|
|
1805
|
+
props: {
|
|
1806
|
+
value: [String, Array],
|
|
1807
|
+
multiple: Boolean,
|
|
1808
|
+
getDeptsByCode: Function
|
|
1809
|
+
},
|
|
1810
|
+
setup(e) {
|
|
1811
|
+
let y = ref([]), b = {};
|
|
1812
|
+
return watch([() => e.modelValue, () => e.multiple], ([x, S]) => {
|
|
1813
|
+
y.value = [];
|
|
1814
|
+
let C = x ? S ? Array.isArray(x) ? x : x.trim() ? x.trim().split(",") : [] : [x] : [], w = [];
|
|
1815
|
+
for (let [e, x] of C.entries()) b[x] || (b[x] = reactive({
|
|
1816
|
+
code: x,
|
|
1817
|
+
name: x
|
|
1818
|
+
}), w.push(x)), y.value[e] = b[x];
|
|
1819
|
+
w.length > 0 && e.getDeptsByCode(w).then((e) => {
|
|
1820
|
+
for (let y of e) Object.assign(b[y.code], y);
|
|
1821
|
+
});
|
|
1822
|
+
}, { immediate: !0 }), () => y.value.map((e) => createVNode(NTag, { key: e.code }, { default: () => [e.name] }));
|
|
1823
|
+
}
|
|
1824
|
+
}), DtUserRender = /* @__PURE__ */ defineComponent({
|
|
1825
|
+
name: "UserRender",
|
|
1826
|
+
props: {
|
|
1827
|
+
value: [String, Array],
|
|
1828
|
+
multiple: Boolean,
|
|
1829
|
+
max: Number,
|
|
1830
|
+
size: Number,
|
|
1831
|
+
placement: String,
|
|
1832
|
+
getUsersByUsername: Function
|
|
1833
|
+
},
|
|
1834
|
+
setup(e) {
|
|
1835
|
+
let y = ref([]), b = {};
|
|
1836
|
+
return watch([() => e.modelValue, () => e.multiple], ([x, S]) => {
|
|
1837
|
+
y.value = [];
|
|
1838
|
+
let C = x ? S ? Array.isArray(x) ? x : x.trim() ? x.trim().split(",") : [] : [x] : [], w = [];
|
|
1839
|
+
for (let [e, x] of C.entries()) b[x] || (b[x] = reactive({
|
|
1840
|
+
code: x,
|
|
1841
|
+
name: x
|
|
1842
|
+
}), w.push(x)), y.value[e] = b[x];
|
|
1843
|
+
w.length > 0 && e.getUsersByUsername(w).then((e) => {
|
|
1844
|
+
for (let y of e) Object.assign(b[y.code], y);
|
|
1845
|
+
});
|
|
1846
|
+
}, { immediate: !0 }), () => renderUsers(y.value, e);
|
|
1847
|
+
}
|
|
1848
|
+
}), StateButtonProps = {
|
|
1849
|
+
disabled: {
|
|
1850
|
+
type: Boolean,
|
|
1851
|
+
default: void 0
|
|
1852
|
+
},
|
|
1853
|
+
type: {
|
|
1854
|
+
type: String,
|
|
1855
|
+
default: void 0
|
|
1856
|
+
},
|
|
1857
|
+
succeeded: {
|
|
1858
|
+
type: [Boolean, Object],
|
|
1859
|
+
default: void 0
|
|
1860
|
+
},
|
|
1861
|
+
successText: {
|
|
1862
|
+
type: [
|
|
1863
|
+
String,
|
|
1864
|
+
Number,
|
|
1865
|
+
Object
|
|
1866
|
+
],
|
|
1867
|
+
default: void 0
|
|
1868
|
+
},
|
|
1869
|
+
failureText: {
|
|
1870
|
+
type: [
|
|
1871
|
+
String,
|
|
1872
|
+
Number,
|
|
1873
|
+
Object
|
|
1874
|
+
],
|
|
1875
|
+
default: void 0
|
|
1876
|
+
}
|
|
1877
|
+
}, NStateButton = /* @__PURE__ */ defineComponent({
|
|
1878
|
+
name: "StateButton",
|
|
1879
|
+
props: StateButtonProps,
|
|
1880
|
+
setup(e, { slots: y }) {
|
|
1881
|
+
return () => {
|
|
1882
|
+
let { type: b, disabled: x, succeeded: S, successText: C, failureText: w } = e;
|
|
1883
|
+
return createVNode(NButton, {
|
|
1884
|
+
type: S ? "success" : S === !1 ? "error" : b,
|
|
1885
|
+
disabled: typeof S == "boolean" ? !0 : x
|
|
1886
|
+
}, {
|
|
1887
|
+
default: () => (S ? y.success ? y.success() : C : S === !1 ? y.failure ? y.failure() : w : y.default?.()) ?? y.default(),
|
|
1888
|
+
icon: () => S ? y.successIcon ? y.successIcon() : createVNode(NIcon, null, { default: () => [createVNode(ICheck, null, null)] }) : S === !1 ? y.failureIcon ? y.failureIcon() : createVNode(NIcon, null, { default: () => [createVNode(IClose, null, null)] }) : y.icon?.()
|
|
1889
|
+
});
|
|
1890
|
+
};
|
|
1891
|
+
}
|
|
1892
|
+
});
|
|
1893
|
+
export { dataFormActionsProps as _, DtUserRender as a, DataActions as b, DataTable as c, DataPagination as d, DataLocaleInput as f, DataFormActions as g, DataForm as h, DtUserDept as i, useDataTableDrag as l, DataFilter as m, StateButtonProps as n, renderUsers as o, useLocaleEdit as p, DtDeptRender as r, NRadios as s, NStateButton as t, DataSelection as u, DataDescriptions as v, NCheckboxes as x, DataCustom as y };
|