@otwb/ui 2.0.0
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/README.md +1 -0
- package/auto-imports.d.ts +15 -0
- package/auto-imports.js +34 -0
- package/dist/components-mcRUKEL_.js +1650 -0
- package/dist/components.js +5 -0
- package/dist/directives-CRvPGywW.js +183 -0
- package/dist/directives.js +3 -0
- package/dist/index.js +1224 -0
- package/dist/page.js +519 -0
- package/dist/use-i18n-Dx7V4KrY.js +6 -0
- package/dist/use-style-DcT-1dj4.js +29 -0
- package/dist/use-style.js +2 -0
- package/esm/components.d.ts +448 -0
- package/esm/components.js +1 -0
- package/esm/design.d.ts +243 -0
- package/esm/directives.d.ts +42 -0
- package/esm/directives.js +1 -0
- package/esm/index.d.ts +19 -0
- package/esm/index.js +1 -0
- package/esm/page.d.ts +170 -0
- package/esm/page.js +1 -0
- package/esm/use-style.d.ts +10 -0
- package/esm/use-style.js +1 -0
- package/locale.d.ts +78 -0
- package/package.json +99 -0
- package/unocss-preset.d.ts +5 -0
- package/unocss-preset.js +94 -0
|
@@ -0,0 +1,1650 @@
|
|
|
1
|
+
import { n as useI18n } from "./use-i18n-Dx7V4KrY.js";
|
|
2
|
+
import { i as vTooltip } from "./directives-CRvPGywW.js";
|
|
3
|
+
import { g as useStyle, h as useMergedClsPrefix, n as cB, r as cE, t as c } from "./use-style-DcT-1dj4.js";
|
|
4
|
+
import { Fragment, computed, createTextVNode, createVNode, defineComponent, 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 { 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 { pickProps } from "@otwb/common/object";
|
|
10
|
+
import { PAGE_INJECTION, useFormModal } from "@otwb/page";
|
|
11
|
+
import { Sortable as Sortable$1 } from "sortablejs";
|
|
12
|
+
import useLocale from "ithinkdt-ui/es/_mixins/use-locale.mjs";
|
|
13
|
+
import { flattenTree, walkTree } from "@otwb/common";
|
|
14
|
+
const NCheckboxes = /* @__PURE__ */ defineComponent({
|
|
15
|
+
name: "Checkboxes",
|
|
16
|
+
inheritAttrs: !1,
|
|
17
|
+
props: {
|
|
18
|
+
options: {
|
|
19
|
+
type: Array,
|
|
20
|
+
default: () => []
|
|
21
|
+
},
|
|
22
|
+
vertical: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: !1
|
|
25
|
+
},
|
|
26
|
+
default: {
|
|
27
|
+
type: [
|
|
28
|
+
Boolean,
|
|
29
|
+
String,
|
|
30
|
+
Object
|
|
31
|
+
],
|
|
32
|
+
default: !1
|
|
33
|
+
},
|
|
34
|
+
gap: {
|
|
35
|
+
type: [
|
|
36
|
+
Number,
|
|
37
|
+
String,
|
|
38
|
+
Array
|
|
39
|
+
],
|
|
40
|
+
default: void 0
|
|
41
|
+
},
|
|
42
|
+
modelValue: {
|
|
43
|
+
type: Array,
|
|
44
|
+
default: void 0
|
|
45
|
+
},
|
|
46
|
+
labelPadding: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: void 0
|
|
49
|
+
},
|
|
50
|
+
labelField: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: "label"
|
|
53
|
+
},
|
|
54
|
+
valueField: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: "value"
|
|
57
|
+
},
|
|
58
|
+
disabledField: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: "disabled"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
emits: {
|
|
64
|
+
"update:modelValue": () => !0,
|
|
65
|
+
updateModelValue: () => !0
|
|
66
|
+
},
|
|
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 }));
|
|
75
|
+
return () => {
|
|
76
|
+
let e = createVNode(NCheckboxGroup, mergeProps(S, {
|
|
77
|
+
value: T.value,
|
|
78
|
+
onUpdateValue: E
|
|
79
|
+
}), { default: () => [createVNode(NFlex, {
|
|
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" } : {}
|
|
92
|
+
}, { default: () => [createVNode("span", null, [createVNode(NCheckbox, {
|
|
93
|
+
indeterminate: k.value,
|
|
94
|
+
checked: T.value?.length > 0,
|
|
95
|
+
onUpdateChecked: O,
|
|
96
|
+
style: A.value
|
|
97
|
+
}, { default: () => [w.value] })]), e] }) : e;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}), IHelp = (e) => createVNode("svg", mergeProps({
|
|
101
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
102
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
103
|
+
role: "img",
|
|
104
|
+
width: "1em",
|
|
105
|
+
height: "1em",
|
|
106
|
+
viewBox: "0 0 24 24"
|
|
107
|
+
}, e), [createVNode("path", {
|
|
108
|
+
fill: "currentColor",
|
|
109
|
+
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"
|
|
110
|
+
}, null)]), ICustom = (e) => createVNode("svg", mergeProps({
|
|
111
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
112
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
113
|
+
role: "img",
|
|
114
|
+
width: "1em",
|
|
115
|
+
height: "1em",
|
|
116
|
+
viewBox: "0 0 1024 1024"
|
|
117
|
+
}, e), [createVNode("path", {
|
|
118
|
+
fill: "currentColor",
|
|
119
|
+
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"
|
|
120
|
+
}, null)]), IDrag = (e) => createVNode("svg", mergeProps({
|
|
121
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
122
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
123
|
+
role: "img",
|
|
124
|
+
width: "1em",
|
|
125
|
+
height: "1em",
|
|
126
|
+
viewBox: "0 0 1024 1024"
|
|
127
|
+
}, e), [createVNode("path", {
|
|
128
|
+
fill: "currentColor",
|
|
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"
|
|
130
|
+
}, null)]), ILeft2 = (e) => createVNode("svg", mergeProps({
|
|
131
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
132
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
133
|
+
role: "img",
|
|
134
|
+
width: "1em",
|
|
135
|
+
height: "1em",
|
|
136
|
+
viewBox: "0 0 1024 1024"
|
|
137
|
+
}, e), [createVNode("path", {
|
|
138
|
+
fill: "currentColor",
|
|
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"
|
|
140
|
+
}, null)]), IRight2 = (e) => createVNode("svg", mergeProps({
|
|
141
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
142
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
143
|
+
role: "img",
|
|
144
|
+
width: "1em",
|
|
145
|
+
height: "1em",
|
|
146
|
+
viewBox: "0 0 1024 1024"
|
|
147
|
+
}, e), [createVNode("path", {
|
|
148
|
+
fill: "currentColor",
|
|
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"
|
|
170
|
+
}, null)]), IDown = (e) => createVNode("svg", mergeProps({
|
|
171
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
172
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
173
|
+
role: "img",
|
|
174
|
+
width: "1em",
|
|
175
|
+
height: "1em",
|
|
176
|
+
viewBox: "0 0 32 32"
|
|
177
|
+
}, e), [createVNode("path", {
|
|
178
|
+
fill: "currentColor",
|
|
179
|
+
d: "M16 22L6 12l1.4-1.4l8.6 8.6l8.6-8.6L26 12z"
|
|
180
|
+
}, null)]), IUp = (e) => createVNode("svg", mergeProps({
|
|
181
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
182
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
183
|
+
role: "img",
|
|
184
|
+
width: "1em",
|
|
185
|
+
height: "1em",
|
|
186
|
+
viewBox: "0 0 32 32"
|
|
187
|
+
}, e), [createVNode("path", {
|
|
188
|
+
fill: "currentColor",
|
|
189
|
+
d: "m16 10l10 10l-1.4 1.4l-8.6-8.6l-8.6 8.6L6 20z"
|
|
190
|
+
}, null)]), ICheck = (e) => createVNode("svg", mergeProps({
|
|
191
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
192
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
193
|
+
role: "img",
|
|
194
|
+
width: "1em",
|
|
195
|
+
height: "1em",
|
|
196
|
+
viewBox: "0 0 24 24"
|
|
197
|
+
}, e), [createVNode("path", {
|
|
198
|
+
fill: "currentColor",
|
|
199
|
+
d: "m9.55 18l-5.7-5.7l1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"
|
|
200
|
+
}, null)]), ILanguage = (e) => createVNode("svg", mergeProps({
|
|
201
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
202
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
203
|
+
role: "img",
|
|
204
|
+
width: "1em",
|
|
205
|
+
height: "1em",
|
|
206
|
+
viewBox: "0 0 24 24"
|
|
207
|
+
}, e), [createVNode("path", {
|
|
208
|
+
fill: "currentColor",
|
|
209
|
+
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"
|
|
210
|
+
}, null)]), IMore = (e) => createVNode("svg", mergeProps({
|
|
211
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
212
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
213
|
+
role: "img",
|
|
214
|
+
width: "1em",
|
|
215
|
+
height: "1em",
|
|
216
|
+
viewBox: "0 0 20 20"
|
|
217
|
+
}, e), [createVNode("path", {
|
|
218
|
+
fill: "currentColor",
|
|
219
|
+
fillRule: "evenodd",
|
|
220
|
+
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"
|
|
221
|
+
}, null)]), IDept = (e) => createVNode("svg", mergeProps({
|
|
222
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
223
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
224
|
+
width: "1em",
|
|
225
|
+
height: "1em",
|
|
226
|
+
viewBox: "0 0 12 12"
|
|
227
|
+
}, e), [createVNode("path", {
|
|
228
|
+
fill: "currentColor",
|
|
229
|
+
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"
|
|
230
|
+
}, null)]), IGroup = (e) => createVNode("svg", mergeProps({
|
|
231
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
232
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
233
|
+
width: "1em",
|
|
234
|
+
height: "1em",
|
|
235
|
+
viewBox: "0 0 24 24"
|
|
236
|
+
}, e), [createVNode("g", {
|
|
237
|
+
fill: "none",
|
|
238
|
+
fillRule: "evenodd"
|
|
239
|
+
}, [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", {
|
|
240
|
+
fill: "currentColor",
|
|
241
|
+
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"
|
|
242
|
+
}, null)])]), IAccount = (e) => createVNode("svg", mergeProps({
|
|
243
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
244
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
245
|
+
role: "img",
|
|
246
|
+
width: "1em",
|
|
247
|
+
height: "1em",
|
|
248
|
+
viewBox: "0 0 256 256"
|
|
249
|
+
}, e), [createVNode("path", {
|
|
250
|
+
fill: "currentColor",
|
|
251
|
+
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"
|
|
252
|
+
}, null)]), DataActions = /* @__PURE__ */ defineComponent({
|
|
253
|
+
name: "DataActions",
|
|
254
|
+
props: { options: {
|
|
255
|
+
type: Array,
|
|
256
|
+
default: () => []
|
|
257
|
+
} },
|
|
258
|
+
setup(e) {
|
|
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) => ({
|
|
266
|
+
...e,
|
|
267
|
+
key: e.text
|
|
268
|
+
}))), j = (e) => createVNode(NButton, {
|
|
269
|
+
type: e.color === "danger" ? "error" : [
|
|
270
|
+
"default",
|
|
271
|
+
"tertiary",
|
|
272
|
+
"primary",
|
|
273
|
+
"info",
|
|
274
|
+
"success",
|
|
275
|
+
"warning",
|
|
276
|
+
"error"
|
|
277
|
+
].includes(e.color) ? e.color : "primary",
|
|
278
|
+
text: !0
|
|
279
|
+
}, { default: () => [e.text] }), M = (e, b) => {
|
|
280
|
+
b.onClick?.();
|
|
281
|
+
};
|
|
282
|
+
return () => createVNode(VResizeObserver, { onResize: S }, { default: () => [createVNode(VOverflow, {
|
|
283
|
+
ref: b,
|
|
284
|
+
getCounter: w,
|
|
285
|
+
onUpdateCount: E,
|
|
286
|
+
onUpdateOverflow: O,
|
|
287
|
+
updateCounter: k,
|
|
288
|
+
style: "margin-top: 2px"
|
|
289
|
+
}, {
|
|
290
|
+
default: () => e.options.map((e) => createVNode(NButton, {
|
|
291
|
+
quaternary: !0,
|
|
292
|
+
type: e.color === "danger" ? "error" : [
|
|
293
|
+
"default",
|
|
294
|
+
"tertiary",
|
|
295
|
+
"primary",
|
|
296
|
+
"info",
|
|
297
|
+
"success",
|
|
298
|
+
"warning",
|
|
299
|
+
"error"
|
|
300
|
+
].includes(e.color) ? e.color : "primary",
|
|
301
|
+
size: "small",
|
|
302
|
+
onClick: e.onClick
|
|
303
|
+
}, { default: () => [e.text] })),
|
|
304
|
+
counter: () => createVNode("span", {
|
|
305
|
+
ref: C,
|
|
306
|
+
style: "position: absolute"
|
|
307
|
+
}, [createVNode(NDropdown, {
|
|
308
|
+
options: A.value,
|
|
309
|
+
renderLabel: j,
|
|
310
|
+
onSelect: M
|
|
311
|
+
}, { default: () => [createVNode(NButton, {
|
|
312
|
+
quaternary: !0,
|
|
313
|
+
size: "small"
|
|
314
|
+
}, { default: () => [createVNode(IMore, { style: "font-size: 14px; color: #888" }, null)] })] })])
|
|
315
|
+
})] });
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
function _isSlot$6(e) {
|
|
319
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
|
|
320
|
+
}
|
|
321
|
+
var DataCustomItem = /* @__PURE__ */ defineComponent({
|
|
322
|
+
name: "DataCustomRow",
|
|
323
|
+
props: {
|
|
324
|
+
label: [String, Function],
|
|
325
|
+
disabled: Boolean,
|
|
326
|
+
hidden: Boolean,
|
|
327
|
+
showFixed: Boolean,
|
|
328
|
+
fixed: [Boolean, String]
|
|
329
|
+
},
|
|
330
|
+
emits: ["update-hidden", "update-fixed"],
|
|
331
|
+
setup(e, { emit: b }) {
|
|
332
|
+
return () => {
|
|
333
|
+
let x;
|
|
334
|
+
return createVNode(NFlex, {
|
|
335
|
+
align: "center",
|
|
336
|
+
wrap: !1,
|
|
337
|
+
size: "small"
|
|
338
|
+
}, { default: () => [
|
|
339
|
+
createVNode(NButton, {
|
|
340
|
+
type: "primary",
|
|
341
|
+
text: !0,
|
|
342
|
+
class: "icon-drag"
|
|
343
|
+
}, { default: () => [createVNode(NIcon, { size: "18" }, { default: () => [createVNode(IDrag, null, null)] })] }),
|
|
344
|
+
createVNode(NCheckbox, {
|
|
345
|
+
checked: !e.hidden,
|
|
346
|
+
disabled: e.disabled,
|
|
347
|
+
onUpdateChecked: (e) => b("update-hidden", !e)
|
|
348
|
+
}, null),
|
|
349
|
+
createVNode(NEllipsis, { style: "flex: 1 1 auto" }, _isSlot$6(x = toValue(e.label)) ? x : { default: () => [x] }),
|
|
350
|
+
e.showFixed ? [createVNode(NButton, {
|
|
351
|
+
text: !0,
|
|
352
|
+
type: e.fixed === "left" ? "primary" : void 0,
|
|
353
|
+
onClick: () => b("update-fixed", e.fixed === "left" ? !1 : "left")
|
|
354
|
+
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(ILeft2, null, null)] })] }), createVNode(NButton, {
|
|
355
|
+
text: !0,
|
|
356
|
+
type: e.fixed === "right" ? "primary" : void 0,
|
|
357
|
+
onClick: () => b("update-fixed", e.fixed === "right" ? !1 : "right")
|
|
358
|
+
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(IRight2, null, null)] })] })] : void 0
|
|
359
|
+
] });
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
const DataCustom = /* @__PURE__ */ defineComponent({
|
|
364
|
+
name: "DataCustom",
|
|
365
|
+
props: {
|
|
366
|
+
data: {
|
|
367
|
+
type: Array,
|
|
368
|
+
required: !0
|
|
369
|
+
},
|
|
370
|
+
keyField: {
|
|
371
|
+
type: String,
|
|
372
|
+
default: "key"
|
|
373
|
+
},
|
|
374
|
+
labelField: {
|
|
375
|
+
type: String,
|
|
376
|
+
default: "label"
|
|
377
|
+
},
|
|
378
|
+
fixedField: {
|
|
379
|
+
type: String,
|
|
380
|
+
default: "fixed"
|
|
381
|
+
},
|
|
382
|
+
hiddenField: {
|
|
383
|
+
type: String,
|
|
384
|
+
default: "hidden"
|
|
385
|
+
},
|
|
386
|
+
showFixed: {
|
|
387
|
+
type: Boolean,
|
|
388
|
+
default: !0
|
|
389
|
+
},
|
|
390
|
+
disabledField: {
|
|
391
|
+
type: String,
|
|
392
|
+
default: "disabled"
|
|
393
|
+
},
|
|
394
|
+
visiblityField: {
|
|
395
|
+
type: String,
|
|
396
|
+
default: "visiblity"
|
|
397
|
+
},
|
|
398
|
+
tooltip: [String, Object],
|
|
399
|
+
size: {
|
|
400
|
+
type: Number,
|
|
401
|
+
default: 20
|
|
402
|
+
},
|
|
403
|
+
type: { type: String }
|
|
404
|
+
},
|
|
405
|
+
emits: { custom: () => !0 },
|
|
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
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
let T = ref();
|
|
415
|
+
return watch(T, (e) => {
|
|
416
|
+
e.$el && Sortable.create(e.$el, {
|
|
417
|
+
animation: 150,
|
|
418
|
+
ghostClass: "ghost",
|
|
419
|
+
handle: ".icon-drag",
|
|
420
|
+
filter: ".disabled",
|
|
421
|
+
onEnd(e) {
|
|
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);
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
}), () => createVNode(NPopover, {
|
|
427
|
+
trigger: "click",
|
|
428
|
+
scrollable: !0,
|
|
429
|
+
placement: "left-start",
|
|
430
|
+
displayDirective: "show",
|
|
431
|
+
style: "max-height: 400px; width: 240px"
|
|
432
|
+
}, {
|
|
433
|
+
trigger: () => withDirectives(createVNode(NButton, {
|
|
434
|
+
text: !0,
|
|
435
|
+
type: x.type
|
|
436
|
+
}, { default: () => [createVNode(NIcon, { size: x.size }, { default: () => [createVNode(ICustom, null, null)] })] }), [[vTooltip, x.tooltip ?? C("common.page.custom.tooltip")]]),
|
|
437
|
+
default: () => {
|
|
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, {
|
|
440
|
+
text: !0,
|
|
441
|
+
type: "primary",
|
|
442
|
+
size: "small",
|
|
443
|
+
onClick: () => S("custom", !0)
|
|
444
|
+
}, _isSlot$6(e = C("common.page.custom.reset")) ? e : { default: () => [e] })] }), createVNode(NFlex, {
|
|
445
|
+
ref: T,
|
|
446
|
+
vertical: !0
|
|
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] })] });
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
function _isSlot$5(e) {
|
|
461
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
|
|
462
|
+
}
|
|
463
|
+
const DataForm = /* @__PURE__ */ defineComponent({
|
|
464
|
+
name: "DataForm",
|
|
465
|
+
props: {
|
|
466
|
+
grid: {
|
|
467
|
+
type: Object,
|
|
468
|
+
default: () => ({})
|
|
469
|
+
},
|
|
470
|
+
...pickProps(formProps, "disabled", "model", "labelWidth", "labelAlign", "showFeedback", "size"),
|
|
471
|
+
readonly: {
|
|
472
|
+
type: Boolean,
|
|
473
|
+
required: !1,
|
|
474
|
+
default: void 0
|
|
475
|
+
},
|
|
476
|
+
items: {
|
|
477
|
+
type: Array,
|
|
478
|
+
required: !0
|
|
479
|
+
},
|
|
480
|
+
validation: {
|
|
481
|
+
type: Object,
|
|
482
|
+
default: () => ({})
|
|
483
|
+
},
|
|
484
|
+
loading: Boolean,
|
|
485
|
+
showColon: Boolean,
|
|
486
|
+
actionAlign: {
|
|
487
|
+
type: String,
|
|
488
|
+
default: "start"
|
|
489
|
+
},
|
|
490
|
+
showAction: {
|
|
491
|
+
type: [Boolean, Object],
|
|
492
|
+
default: void 0
|
|
493
|
+
},
|
|
494
|
+
submitText: {
|
|
495
|
+
type: [
|
|
496
|
+
String,
|
|
497
|
+
Number,
|
|
498
|
+
Object
|
|
499
|
+
],
|
|
500
|
+
default: void 0
|
|
501
|
+
},
|
|
502
|
+
resetText: {
|
|
503
|
+
type: [
|
|
504
|
+
String,
|
|
505
|
+
Number,
|
|
506
|
+
Object
|
|
507
|
+
],
|
|
508
|
+
default: void 0
|
|
509
|
+
},
|
|
510
|
+
cancelText: {
|
|
511
|
+
type: [
|
|
512
|
+
String,
|
|
513
|
+
Number,
|
|
514
|
+
Object
|
|
515
|
+
],
|
|
516
|
+
default: void 0
|
|
517
|
+
},
|
|
518
|
+
showSubmitBtn: {
|
|
519
|
+
type: Boolean,
|
|
520
|
+
required: !1,
|
|
521
|
+
default: !0
|
|
522
|
+
},
|
|
523
|
+
showResetBtn: {
|
|
524
|
+
type: Boolean,
|
|
525
|
+
required: !1,
|
|
526
|
+
default: !0
|
|
527
|
+
},
|
|
528
|
+
showCancelBtn: {
|
|
529
|
+
type: Boolean,
|
|
530
|
+
required: !1,
|
|
531
|
+
default: !1
|
|
532
|
+
},
|
|
533
|
+
submitDisabled: Boolean,
|
|
534
|
+
succeeded: Boolean,
|
|
535
|
+
successText: {
|
|
536
|
+
type: [
|
|
537
|
+
String,
|
|
538
|
+
Number,
|
|
539
|
+
Object
|
|
540
|
+
],
|
|
541
|
+
default: void 0
|
|
542
|
+
},
|
|
543
|
+
tooltipPlacement: {
|
|
544
|
+
type: String,
|
|
545
|
+
default: "bottom"
|
|
546
|
+
},
|
|
547
|
+
requireMarkPlacement: {
|
|
548
|
+
type: String,
|
|
549
|
+
default: "left"
|
|
550
|
+
},
|
|
551
|
+
labelPlacement: {
|
|
552
|
+
type: String,
|
|
553
|
+
default: "left"
|
|
554
|
+
}
|
|
555
|
+
},
|
|
556
|
+
emits: [
|
|
557
|
+
"submit",
|
|
558
|
+
"reset",
|
|
559
|
+
"cancel"
|
|
560
|
+
],
|
|
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;
|
|
572
|
+
}, 30);
|
|
573
|
+
}, {
|
|
574
|
+
immediate: !0,
|
|
575
|
+
debounce: 100
|
|
576
|
+
}), () => {
|
|
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;
|
|
578
|
+
return createVNode(NForm, mergeProps({
|
|
579
|
+
labelWidth: H,
|
|
580
|
+
labelAlign: U,
|
|
581
|
+
onReset: T,
|
|
582
|
+
onSubmit: w,
|
|
583
|
+
showFeedback: J
|
|
584
|
+
}, q), { default: () => [createVNode(NGrid, mergeProps({
|
|
585
|
+
ref: k,
|
|
586
|
+
itemResponsive: !0
|
|
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 }) => {
|
|
590
|
+
if (e) return;
|
|
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), {
|
|
598
|
+
label: () => createVNode(NText, {
|
|
599
|
+
depth: b.readonly ? 3 : 2,
|
|
600
|
+
style: "display: inline-flex; align-items: flex-start; gap: 1px"
|
|
601
|
+
}, { default: () => [
|
|
602
|
+
createVNode("span", null, [toValue(C)]),
|
|
603
|
+
N === "icon" ? createVNode(NTooltip, null, {
|
|
604
|
+
default: () => toValue(A),
|
|
605
|
+
trigger: () => createVNode(NButton, {
|
|
606
|
+
text: !0,
|
|
607
|
+
style: "font-size: 1.25em; opacity: 0.8"
|
|
608
|
+
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(IHelp, null, null)] })] })
|
|
609
|
+
}) : void 0,
|
|
610
|
+
b.showColon && T !== !1 ? createVNode("span", { style: "place-self: center" }, [createTextVNode(":")]) : void 0
|
|
611
|
+
] }),
|
|
612
|
+
default: () => {
|
|
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
|
|
617
|
+
})]);
|
|
618
|
+
return A && N === "bottom" && (!b.readonly || L) ? createVNode("div", { style: "width: 100%; display: flex; flex-direction: column" }, [x, createVNode(NText, {
|
|
619
|
+
depth: 3,
|
|
620
|
+
style: "font-size: calc(1rem - 3px); margin-top: 6px"
|
|
621
|
+
}, _isSlot$5(e = toValue(A)) ? e : { default: () => [e] })]) : x;
|
|
622
|
+
},
|
|
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({
|
|
631
|
+
key: "action",
|
|
632
|
+
span: 2 ** 53 - 1
|
|
633
|
+
}, typeof b.showAction == "object" ? b.showAction : {}), { default: ({ overflow: e }) => S.action ? S.action({
|
|
634
|
+
cols: A.value,
|
|
635
|
+
spans: w,
|
|
636
|
+
overflow: e
|
|
637
|
+
}) : createVNode(NFormItem, {
|
|
638
|
+
label: b.actionAlign === "start" ? " " : void 0,
|
|
639
|
+
showLabel: b.labelPlacement !== "top",
|
|
640
|
+
style: "padding-top: 16px"
|
|
641
|
+
}, { default: () => [createVNode(NFlex, {
|
|
642
|
+
justify: b.actionAlign,
|
|
643
|
+
align: "center"
|
|
644
|
+
}, { default: () => [
|
|
645
|
+
b.showSubmitBtn === !1 ? void 0 : createVNode(NButton, {
|
|
646
|
+
attrType: "submit",
|
|
647
|
+
type: G ? "success" : "primary",
|
|
648
|
+
disabled: G || b.disabled || b.submitDisabled || x,
|
|
649
|
+
loading: x
|
|
650
|
+
}, {
|
|
651
|
+
default: () => (G ? K : I) || C("common.page.form.submitText"),
|
|
652
|
+
icon: () => G ? createVNode(NIcon, null, { default: () => [createVNode(ICheck, null, null)] }) : void 0
|
|
653
|
+
}),
|
|
654
|
+
b.showResetBtn === !1 ? void 0 : createVNode(NButton, {
|
|
655
|
+
attrType: "reset",
|
|
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, {
|
|
661
|
+
attrType: "button",
|
|
662
|
+
disabled: b.disabled || x,
|
|
663
|
+
onClick: D
|
|
664
|
+
}, { default: () => [b.cancelText || C("common.page.form.cancelText")] })
|
|
665
|
+
] })] }) })]);
|
|
666
|
+
} })] });
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
}), DataFilter = /* @__PURE__ */ defineComponent({
|
|
670
|
+
name: "DataFilter",
|
|
671
|
+
props: {
|
|
672
|
+
grid: {
|
|
673
|
+
type: Object,
|
|
674
|
+
default: () => ({})
|
|
675
|
+
},
|
|
676
|
+
...pickProps(formProps, "disabled", "model"),
|
|
677
|
+
labelWidth: {
|
|
678
|
+
type: [String, Number],
|
|
679
|
+
default: "5em"
|
|
680
|
+
},
|
|
681
|
+
labelPlacement: {
|
|
682
|
+
type: String,
|
|
683
|
+
default: "left"
|
|
684
|
+
},
|
|
685
|
+
items: {
|
|
686
|
+
type: Array,
|
|
687
|
+
required: !0
|
|
688
|
+
},
|
|
689
|
+
loading: {
|
|
690
|
+
type: Boolean,
|
|
691
|
+
required: !1,
|
|
692
|
+
default: !1
|
|
693
|
+
},
|
|
694
|
+
filterOnReset: {
|
|
695
|
+
type: Boolean,
|
|
696
|
+
required: !1,
|
|
697
|
+
default: !0
|
|
698
|
+
},
|
|
699
|
+
filterText: {
|
|
700
|
+
type: String,
|
|
701
|
+
default: void 0
|
|
702
|
+
},
|
|
703
|
+
resetText: {
|
|
704
|
+
type: String,
|
|
705
|
+
default: void 0
|
|
706
|
+
},
|
|
707
|
+
customizable: {
|
|
708
|
+
type: Boolean,
|
|
709
|
+
required: !1,
|
|
710
|
+
default: !0
|
|
711
|
+
},
|
|
712
|
+
collapsible: {
|
|
713
|
+
type: Boolean,
|
|
714
|
+
required: !1,
|
|
715
|
+
default: !0
|
|
716
|
+
},
|
|
717
|
+
defaultCollapsed: {
|
|
718
|
+
type: Boolean,
|
|
719
|
+
required: !1,
|
|
720
|
+
default: !0
|
|
721
|
+
}
|
|
722
|
+
},
|
|
723
|
+
emits: [
|
|
724
|
+
"filter",
|
|
725
|
+
"reset",
|
|
726
|
+
"custom",
|
|
727
|
+
"collapse"
|
|
728
|
+
],
|
|
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;
|
|
736
|
+
};
|
|
737
|
+
x({ collapse: D });
|
|
738
|
+
let k = reactive({
|
|
739
|
+
span: 6,
|
|
740
|
+
suffix: !0
|
|
741
|
+
});
|
|
742
|
+
return () => {
|
|
743
|
+
let { filterOnReset: e, filterText: x, resetText: A, customizable: j, defaultCollapsed: N, collapsible: P, grid: F,...I } = b;
|
|
744
|
+
return createVNode(DataForm, mergeProps({ grid: {
|
|
745
|
+
cols: "12 768:18 1280:24 1536:30",
|
|
746
|
+
yGap: 20,
|
|
747
|
+
xGap: 8,
|
|
748
|
+
...F,
|
|
749
|
+
collapsed: E.value
|
|
750
|
+
} }, I, {
|
|
751
|
+
showFeedback: !1,
|
|
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",
|
|
757
|
+
align: "center"
|
|
758
|
+
}, { default: () => [
|
|
759
|
+
k.suffix ? void 0 : createVNode("span", null, [createTextVNode("\xA0\xA0\xA0\xA0")]),
|
|
760
|
+
createVNode(NButton, {
|
|
761
|
+
attrType: "submit",
|
|
762
|
+
type: "primary",
|
|
763
|
+
disabled: b.disabled,
|
|
764
|
+
loading: b.loading
|
|
765
|
+
}, { default: () => [x || C("common.page.filter.submitText")] }),
|
|
766
|
+
createVNode(NButton, {
|
|
767
|
+
attrType: "reset",
|
|
768
|
+
disabled: b.disabled || b.loading
|
|
769
|
+
}, { default: () => [A || C("common.page.form.resetText")] }),
|
|
770
|
+
j ? createVNode(DataCustom, {
|
|
771
|
+
keyField: "name",
|
|
772
|
+
showFixed: !1,
|
|
773
|
+
data: I.items,
|
|
774
|
+
onCustom: (e) => S("custom", e),
|
|
775
|
+
size: 18,
|
|
776
|
+
type: "primary"
|
|
777
|
+
}, null) : void 0,
|
|
778
|
+
P && k.suffix ? createVNode(NButton, {
|
|
779
|
+
text: !0,
|
|
780
|
+
type: "primary",
|
|
781
|
+
iconPlacement: "right",
|
|
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
|
|
785
|
+
] })) });
|
|
786
|
+
};
|
|
787
|
+
}
|
|
788
|
+
});
|
|
789
|
+
function _isSlot$4(e) {
|
|
790
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
|
|
791
|
+
}
|
|
792
|
+
function useLocaleEdit(b, x, S = 1) {
|
|
793
|
+
let { t: C } = useI18n(), w = ref(!1), T = [], { open: E, reinit: D } = useFormModal({
|
|
794
|
+
title: b,
|
|
795
|
+
showColon: !0,
|
|
796
|
+
submitText: C("common.confirm.defaultOk"),
|
|
797
|
+
items: ({ it: e }) => T.map((b) => e(b.value, b.label, "input", {
|
|
798
|
+
span: 24,
|
|
799
|
+
required: b.required,
|
|
800
|
+
inputProps: {
|
|
801
|
+
readonly: w,
|
|
802
|
+
clearable: !0,
|
|
803
|
+
type: "textarea",
|
|
804
|
+
showCount: !0,
|
|
805
|
+
autosize: {
|
|
806
|
+
minRows: unref(S),
|
|
807
|
+
maxRows: Math.max(unref(S), 5)
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
})),
|
|
811
|
+
onSubmit: x
|
|
812
|
+
});
|
|
813
|
+
return {
|
|
814
|
+
open: (e, b = !1) => (w.value = b, E(e)),
|
|
815
|
+
setSupports: (e) => {
|
|
816
|
+
T = e, D();
|
|
817
|
+
}
|
|
818
|
+
};
|
|
819
|
+
}
|
|
820
|
+
const DataLocaleInput = /* @__PURE__ */ defineComponent({
|
|
821
|
+
name: "DataLocaleInput",
|
|
822
|
+
props: {
|
|
823
|
+
label: { type: [
|
|
824
|
+
String,
|
|
825
|
+
Function,
|
|
826
|
+
Number,
|
|
827
|
+
Boolean,
|
|
828
|
+
Object
|
|
829
|
+
] },
|
|
830
|
+
modelValue: Object,
|
|
831
|
+
supports: {
|
|
832
|
+
type: Array,
|
|
833
|
+
default: () => []
|
|
834
|
+
},
|
|
835
|
+
disabled: {
|
|
836
|
+
type: Boolean,
|
|
837
|
+
default: void 0
|
|
838
|
+
},
|
|
839
|
+
defaultLang: {
|
|
840
|
+
type: String,
|
|
841
|
+
default: "zh-CN"
|
|
842
|
+
},
|
|
843
|
+
showLang: {
|
|
844
|
+
type: String,
|
|
845
|
+
default: void 0
|
|
846
|
+
},
|
|
847
|
+
defaultRows: {
|
|
848
|
+
type: Number,
|
|
849
|
+
default: 1
|
|
850
|
+
}
|
|
851
|
+
},
|
|
852
|
+
emits: ["update:modelValue", "updateModelValue"],
|
|
853
|
+
setup(e, { emit: b }) {
|
|
854
|
+
let x = (x) => {
|
|
855
|
+
x = {
|
|
856
|
+
...e.modelValue,
|
|
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);
|
|
861
|
+
}, toRef(e, "defaultRows"));
|
|
862
|
+
watch(() => e.supports, C, { immediate: !0 });
|
|
863
|
+
let w = { suffix: () => createVNode(NButton, {
|
|
864
|
+
quaternary: !0,
|
|
865
|
+
onClick: () => S(e.modelValue, e.disabled),
|
|
866
|
+
style: "--n-padding: 0 8px"
|
|
867
|
+
}, { default: () => [createVNode(NIcon, {
|
|
868
|
+
size: "20",
|
|
869
|
+
depth: "3"
|
|
870
|
+
}, { default: () => [createVNode(ILanguage, null, null)] })] }) }, T = { "--n-padding-right": "0" };
|
|
871
|
+
return () => createVNode(NInput, {
|
|
872
|
+
value: e.modelValue?.[e.showLang ?? e.defaultLang] ?? e.modelValue?.[e.defaultLang],
|
|
873
|
+
onUpdateValue: x,
|
|
874
|
+
disabled: e.disabled,
|
|
875
|
+
clearable: !0,
|
|
876
|
+
style: T,
|
|
877
|
+
type: e.defaultRows > 1 ? "textarea" : "text",
|
|
878
|
+
rows: e.defaultRows
|
|
879
|
+
}, _isSlot$4(w) ? w : { default: () => [w] });
|
|
880
|
+
}
|
|
881
|
+
}), DataPagination = /* @__PURE__ */ defineComponent({
|
|
882
|
+
name: "DataPagination",
|
|
883
|
+
props: {
|
|
884
|
+
total: {
|
|
885
|
+
type: Number,
|
|
886
|
+
default: 0
|
|
887
|
+
},
|
|
888
|
+
currentPage: { type: Number },
|
|
889
|
+
pageSize: { type: Number },
|
|
890
|
+
page: { type: Object },
|
|
891
|
+
pageSizes: {
|
|
892
|
+
type: Array,
|
|
893
|
+
default: () => [
|
|
894
|
+
10,
|
|
895
|
+
20,
|
|
896
|
+
30,
|
|
897
|
+
50
|
|
898
|
+
]
|
|
899
|
+
}
|
|
900
|
+
},
|
|
901
|
+
emits: { change: () => !0 },
|
|
902
|
+
setup(b, { emit: x }) {
|
|
903
|
+
let { t: S } = useI18n(), C = (e) => x("change", {
|
|
904
|
+
pageSize: b.pageSize ?? b.page?.pageSize ?? 0,
|
|
905
|
+
currentPage: e
|
|
906
|
+
}), w = (e) => x("change", {
|
|
907
|
+
pageSize: e,
|
|
908
|
+
currentPage: b.currentPage ?? b.page?.currentPage ?? 0
|
|
909
|
+
});
|
|
910
|
+
return () => createVNode(NPagination, {
|
|
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,
|
|
917
|
+
showQuickJumper: !0,
|
|
918
|
+
showSizePicker: !0,
|
|
919
|
+
style: "justify-content: flex-end"
|
|
920
|
+
}, {
|
|
921
|
+
prefix: () => S("common.page.pagination.prefix", { total: b.total }),
|
|
922
|
+
suffix: () => S("common.page.pagination.suffix")
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
});
|
|
926
|
+
function _isSlot$3(e) {
|
|
927
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
|
|
928
|
+
}
|
|
929
|
+
const DataSelection = /* @__PURE__ */ defineComponent({
|
|
930
|
+
name: "DataSelection",
|
|
931
|
+
props: {
|
|
932
|
+
modelValue: {
|
|
933
|
+
type: String,
|
|
934
|
+
required: !0
|
|
935
|
+
},
|
|
936
|
+
count: {
|
|
937
|
+
type: Number,
|
|
938
|
+
default: 0
|
|
939
|
+
}
|
|
940
|
+
},
|
|
941
|
+
emits: {
|
|
942
|
+
"update:modelValue": () => !0,
|
|
943
|
+
clear: () => !0
|
|
944
|
+
},
|
|
945
|
+
setup(b, { emit: x }) {
|
|
946
|
+
let { t: S } = useI18n();
|
|
947
|
+
return () => {
|
|
948
|
+
let e;
|
|
949
|
+
return b.modelValue !== "selection" && b.count === 0 ? createVNode("div", null, null) : createVNode("div", null, [createVNode(NFlex, {
|
|
950
|
+
align: "center",
|
|
951
|
+
"wrap-item": !1
|
|
952
|
+
}, { default: () => [
|
|
953
|
+
createVNode("span", null, [S("common.page.selection.countText", { count: b.count })]),
|
|
954
|
+
createVNode(NButton, {
|
|
955
|
+
text: !0,
|
|
956
|
+
type: "primary",
|
|
957
|
+
onClick: () => {
|
|
958
|
+
x("update:modelValue", b.modelValue === "all" ? "selection" : "all");
|
|
959
|
+
}
|
|
960
|
+
}, { default: () => [b.modelValue === "all" ? S("common.page.selection.view") : S("common.page.selection.back")] }),
|
|
961
|
+
createVNode(NButton, {
|
|
962
|
+
text: !0,
|
|
963
|
+
onClick: () => {
|
|
964
|
+
x("clear"), x("update:modelValue", "all");
|
|
965
|
+
}
|
|
966
|
+
}, _isSlot$3(e = S("common.page.selection.clear")) ? e : { default: () => [e] })
|
|
967
|
+
] })]);
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
});
|
|
971
|
+
function _isSlot$2(e) {
|
|
972
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
|
|
973
|
+
}
|
|
974
|
+
function _map(e, x) {
|
|
975
|
+
return (e ?? []).map((e) => {
|
|
976
|
+
let S = {
|
|
977
|
+
csvTitle: e.exportTitle,
|
|
978
|
+
...e,
|
|
979
|
+
title: () => {
|
|
980
|
+
let x = toValue(e.title), S = x && withDirectives(createVNode("span", null, [x]), [[
|
|
981
|
+
vTooltip,
|
|
982
|
+
() => toValue(e.title),
|
|
983
|
+
void 0,
|
|
984
|
+
{ auto: !0 }
|
|
985
|
+
]]);
|
|
986
|
+
return e.tooltip ? createVNode(NFlex, {
|
|
987
|
+
size: 3,
|
|
988
|
+
wrap: !1,
|
|
989
|
+
inline: !0,
|
|
990
|
+
style: "max-width: 100%"
|
|
991
|
+
}, { default: () => [S, createVNode(NTooltip, null, {
|
|
992
|
+
default: toValue(e.tooltip),
|
|
993
|
+
trigger: () => createVNode(NButton, {
|
|
994
|
+
text: !0,
|
|
995
|
+
style: "font-size: 1.25em; opacity: 0.8"
|
|
996
|
+
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(IHelp, null, null)] })] })
|
|
997
|
+
})] }) : S;
|
|
998
|
+
}
|
|
999
|
+
};
|
|
1000
|
+
if (e.children?.length) S.children = _map(e.children, x);
|
|
1001
|
+
else {
|
|
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);
|
|
1006
|
+
return createVNode(NPerformantEllipsis, mergeProps({
|
|
1007
|
+
expandTrigger: "click",
|
|
1008
|
+
lineClamp: 1,
|
|
1009
|
+
tooltip: { style: {
|
|
1010
|
+
maxWidth: "61.8vw",
|
|
1011
|
+
wordBreak: "break-all"
|
|
1012
|
+
} }
|
|
1013
|
+
}, typeof e.ellipsis == "boolean" ? {} : e.ellipsis), _isSlot$2(S) ? S : { default: () => [S] });
|
|
1014
|
+
}, e.ellipsisTooltip === !0 && (S.ellipsisTooltip ??= b)), Object.assign(S, {
|
|
1015
|
+
resizable: e.resizable !== !1,
|
|
1016
|
+
sorter: e.sortable,
|
|
1017
|
+
type: ["selection", "expand"].includes(e.type) ? e.type : void 0,
|
|
1018
|
+
disabled: e.selectable ? (b) => e.selectable(b) === !1 : void 0
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
return S.key === "$actions" && (S.cellProps ??= () => ({ style: { padding: "0 2px" } })), S;
|
|
1022
|
+
}).filter((e) => e?.hidden !== !0);
|
|
1023
|
+
}
|
|
1024
|
+
const DataTable = /* @__PURE__ */ defineComponent({
|
|
1025
|
+
name: "DataTable",
|
|
1026
|
+
props: {
|
|
1027
|
+
data: {
|
|
1028
|
+
type: Array,
|
|
1029
|
+
default: () => []
|
|
1030
|
+
},
|
|
1031
|
+
columns: {
|
|
1032
|
+
type: Array,
|
|
1033
|
+
default: () => []
|
|
1034
|
+
},
|
|
1035
|
+
keyField: { type: String },
|
|
1036
|
+
sorter: {
|
|
1037
|
+
type: Object,
|
|
1038
|
+
default: () => ({})
|
|
1039
|
+
},
|
|
1040
|
+
selectedKeys: { type: Array },
|
|
1041
|
+
highlight: {
|
|
1042
|
+
type: [
|
|
1043
|
+
Boolean,
|
|
1044
|
+
String,
|
|
1045
|
+
Number,
|
|
1046
|
+
Object
|
|
1047
|
+
],
|
|
1048
|
+
default: !0
|
|
1049
|
+
},
|
|
1050
|
+
rowClassName: dataTableProps.rowClassName,
|
|
1051
|
+
rowProps: dataTableProps.rowProps
|
|
1052
|
+
},
|
|
1053
|
+
emits: [
|
|
1054
|
+
"sort",
|
|
1055
|
+
"select",
|
|
1056
|
+
"custom",
|
|
1057
|
+
"highlight"
|
|
1058
|
+
],
|
|
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);
|
|
1064
|
+
};
|
|
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({
|
|
1070
|
+
cache: [],
|
|
1071
|
+
scrollToView(...e) {
|
|
1072
|
+
this.cache.push(e);
|
|
1073
|
+
}
|
|
1074
|
+
});
|
|
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,
|
|
1084
|
+
behavior: "smooth"
|
|
1085
|
+
});
|
|
1086
|
+
};
|
|
1087
|
+
for (let e of b) N.value.scrollToView(...e);
|
|
1088
|
+
}), w(toReactive(N));
|
|
1089
|
+
let P = ref(0), L = shallowRef([]);
|
|
1090
|
+
watch(() => e.columns, () => {
|
|
1091
|
+
P.value = 0, L.value = _map(e.columns, P);
|
|
1092
|
+
}, {
|
|
1093
|
+
immediate: !0,
|
|
1094
|
+
deep: 1
|
|
1095
|
+
});
|
|
1096
|
+
let R = ref();
|
|
1097
|
+
watch(() => e.highlight, (e) => {
|
|
1098
|
+
R.value = typeof e == "boolean" ? null : e ?? null;
|
|
1099
|
+
}, { immediate: !0 });
|
|
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);
|
|
1106
|
+
return {
|
|
1107
|
+
...S,
|
|
1108
|
+
onClick: (x) => {
|
|
1109
|
+
let w = M.value(b);
|
|
1110
|
+
e.highlight === !0 && (R.value = w), C("highlight", w), S?.onClick?.(x);
|
|
1111
|
+
}
|
|
1112
|
+
};
|
|
1113
|
+
}), U = (b) => {
|
|
1114
|
+
if (e.sorter) {
|
|
1115
|
+
let { sortField: x, sortOrder: S } = e.sorter;
|
|
1116
|
+
if (b?.columnKey == x && (b?.order ? b.order === S + "end" : !S)) return;
|
|
1117
|
+
}
|
|
1118
|
+
C("sort", {
|
|
1119
|
+
sortField: b?.order ? b?.columnKey : void 0,
|
|
1120
|
+
sortOrder: b?.order ? b.order.replace("end", "") : void 0
|
|
1121
|
+
});
|
|
1122
|
+
}, G = (e) => {
|
|
1123
|
+
C("select", e);
|
|
1124
|
+
}, q = (e, b, x) => {
|
|
1125
|
+
C("custom", {
|
|
1126
|
+
key: x.key,
|
|
1127
|
+
width: e
|
|
1128
|
+
});
|
|
1129
|
+
};
|
|
1130
|
+
return () => createVNode(NDataTable, {
|
|
1131
|
+
class: O,
|
|
1132
|
+
data: e.data,
|
|
1133
|
+
columns: L.value,
|
|
1134
|
+
rowKey: M.value,
|
|
1135
|
+
tableLayout: "fixed",
|
|
1136
|
+
ref: "table-ref",
|
|
1137
|
+
scrollX: P.value,
|
|
1138
|
+
rowClassName: z.value,
|
|
1139
|
+
rowProps: B.value,
|
|
1140
|
+
checkedRowKeys: e.selectedKeys,
|
|
1141
|
+
onUpdateSorter: U,
|
|
1142
|
+
onUpdateCheckedRowKeys: G,
|
|
1143
|
+
onUnstableColumnResize: q
|
|
1144
|
+
}, _isSlot$2(b) ? b : { default: () => [b] });
|
|
1145
|
+
}
|
|
1146
|
+
});
|
|
1147
|
+
var style = /* @__PURE__ */ cB("datatable", [cE("row-highlight", [c("& > td", { backgroundColor: "var(--n-tr-highlight-color, var(--n-merged-border-color)) !important" })])]);
|
|
1148
|
+
function useDataTableDrag(e, { data: b, onSort: x,...S }) {
|
|
1149
|
+
watch([ref(b), e], async ([e, b]) => {
|
|
1150
|
+
if (e.length === 0) return;
|
|
1151
|
+
await nextTick();
|
|
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, {
|
|
1155
|
+
animation: 150,
|
|
1156
|
+
...S,
|
|
1157
|
+
onSort(e) {
|
|
1158
|
+
x({
|
|
1159
|
+
from: e.oldIndex,
|
|
1160
|
+
to: e.newIndex
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
});
|
|
1164
|
+
return () => {
|
|
1165
|
+
w.destroy();
|
|
1166
|
+
};
|
|
1167
|
+
}, { immediate: !0 });
|
|
1168
|
+
}
|
|
1169
|
+
function _isSlot$1(e) {
|
|
1170
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
|
|
1171
|
+
}
|
|
1172
|
+
const NRadios = /* @__PURE__ */ defineComponent({
|
|
1173
|
+
name: "Radios",
|
|
1174
|
+
props: {
|
|
1175
|
+
options: {
|
|
1176
|
+
type: Array,
|
|
1177
|
+
default: () => []
|
|
1178
|
+
},
|
|
1179
|
+
vertical: {
|
|
1180
|
+
type: Boolean,
|
|
1181
|
+
default: !1
|
|
1182
|
+
},
|
|
1183
|
+
type: {
|
|
1184
|
+
type: String,
|
|
1185
|
+
default: "radio"
|
|
1186
|
+
},
|
|
1187
|
+
default: {
|
|
1188
|
+
type: [
|
|
1189
|
+
Boolean,
|
|
1190
|
+
String,
|
|
1191
|
+
Object
|
|
1192
|
+
],
|
|
1193
|
+
default: !1
|
|
1194
|
+
},
|
|
1195
|
+
padding: {
|
|
1196
|
+
type: String,
|
|
1197
|
+
default: void 0
|
|
1198
|
+
},
|
|
1199
|
+
labelField: {
|
|
1200
|
+
type: String,
|
|
1201
|
+
default: "label"
|
|
1202
|
+
},
|
|
1203
|
+
valueField: {
|
|
1204
|
+
type: String,
|
|
1205
|
+
default: "value"
|
|
1206
|
+
},
|
|
1207
|
+
disabledField: {
|
|
1208
|
+
type: String,
|
|
1209
|
+
default: "disabled"
|
|
1210
|
+
},
|
|
1211
|
+
modelValue: {
|
|
1212
|
+
type: [
|
|
1213
|
+
String,
|
|
1214
|
+
Number,
|
|
1215
|
+
Boolean
|
|
1216
|
+
],
|
|
1217
|
+
default: void 0
|
|
1218
|
+
}
|
|
1219
|
+
},
|
|
1220
|
+
emits: {
|
|
1221
|
+
"update:modelValue": () => !0,
|
|
1222
|
+
updateModelValue: () => !0
|
|
1223
|
+
},
|
|
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" ? {
|
|
1226
|
+
"--n-button-color-active": "var(--color-primary)",
|
|
1227
|
+
"--n-button-text-color-active": "var(--color-base)"
|
|
1228
|
+
} : {}), T = (e) => {
|
|
1229
|
+
x("update:modelValue", e), x("updateModelValue", e);
|
|
1230
|
+
};
|
|
1231
|
+
return () => {
|
|
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]?.();
|
|
1234
|
+
return createVNode(e, {
|
|
1235
|
+
value: x[b.valueField],
|
|
1236
|
+
disabled: x[b.disabledField],
|
|
1237
|
+
style: b.padding ? {
|
|
1238
|
+
paddingLeft: b.padding,
|
|
1239
|
+
paddingRight: b.padding
|
|
1240
|
+
} : {}
|
|
1241
|
+
}, { default: () => [x.tip ? createVNode(NTooltip, null, {
|
|
1242
|
+
default: () => x.tip,
|
|
1243
|
+
trigger: () => S
|
|
1244
|
+
}) : S] });
|
|
1245
|
+
})]);
|
|
1246
|
+
return createVNode(NRadioGroup, {
|
|
1247
|
+
style: b.vertical ? {
|
|
1248
|
+
...w.value,
|
|
1249
|
+
padding: "6px 0 0"
|
|
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] });
|
|
1257
|
+
};
|
|
1258
|
+
}
|
|
1259
|
+
});
|
|
1260
|
+
function _isSlot(e) {
|
|
1261
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !isVNode(e);
|
|
1262
|
+
}
|
|
1263
|
+
const DtUserDept = /* @__PURE__ */ defineComponent({
|
|
1264
|
+
name: "UserDept",
|
|
1265
|
+
inheritAttrs: !1,
|
|
1266
|
+
props: {
|
|
1267
|
+
users: {
|
|
1268
|
+
type: Array,
|
|
1269
|
+
default: () => []
|
|
1270
|
+
},
|
|
1271
|
+
groups: {
|
|
1272
|
+
type: Array,
|
|
1273
|
+
default: () => []
|
|
1274
|
+
},
|
|
1275
|
+
depts: {
|
|
1276
|
+
type: Array,
|
|
1277
|
+
default: () => []
|
|
1278
|
+
},
|
|
1279
|
+
modelValue: {
|
|
1280
|
+
type: [Array, String],
|
|
1281
|
+
default: void 0
|
|
1282
|
+
},
|
|
1283
|
+
placeholder: {
|
|
1284
|
+
type: String,
|
|
1285
|
+
default: void 0
|
|
1286
|
+
},
|
|
1287
|
+
size: {
|
|
1288
|
+
type: String,
|
|
1289
|
+
default: void 0
|
|
1290
|
+
},
|
|
1291
|
+
type: {
|
|
1292
|
+
type: String,
|
|
1293
|
+
default: "user"
|
|
1294
|
+
},
|
|
1295
|
+
selectType: {
|
|
1296
|
+
type: String,
|
|
1297
|
+
default: "dropdown"
|
|
1298
|
+
},
|
|
1299
|
+
max: {
|
|
1300
|
+
type: Number,
|
|
1301
|
+
default: void 0
|
|
1302
|
+
},
|
|
1303
|
+
multiple: {
|
|
1304
|
+
type: Boolean,
|
|
1305
|
+
default: !1
|
|
1306
|
+
},
|
|
1307
|
+
defaultExpandAll: {
|
|
1308
|
+
type: Boolean,
|
|
1309
|
+
default: !1
|
|
1310
|
+
},
|
|
1311
|
+
filterable: {
|
|
1312
|
+
type: Boolean,
|
|
1313
|
+
default: !1
|
|
1314
|
+
},
|
|
1315
|
+
disabled: {
|
|
1316
|
+
type: Boolean,
|
|
1317
|
+
default: void 0
|
|
1318
|
+
},
|
|
1319
|
+
getUsersByGroup: {
|
|
1320
|
+
type: Function,
|
|
1321
|
+
default: () => []
|
|
1322
|
+
},
|
|
1323
|
+
getUsersByDept: {
|
|
1324
|
+
type: Function,
|
|
1325
|
+
default: () => []
|
|
1326
|
+
},
|
|
1327
|
+
valueField: { type: String }
|
|
1328
|
+
},
|
|
1329
|
+
emits: ["update:modelValue", "updateModelValue"],
|
|
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();
|
|
1334
|
+
return e ? [e] : [];
|
|
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) => {
|
|
1337
|
+
walkTree(e, (e) => {
|
|
1338
|
+
e.label = e.name, e.value = e[T.value], e.type = "dept", e.children?.length || delete e.children;
|
|
1339
|
+
}), j.value = flattenTree(e);
|
|
1340
|
+
}, { immediate: !0 });
|
|
1341
|
+
let L = computed(() => [
|
|
1342
|
+
...b.depts,
|
|
1343
|
+
...b.groups.map((e) => ({
|
|
1344
|
+
label: e.name,
|
|
1345
|
+
value: e.code,
|
|
1346
|
+
type: "group"
|
|
1347
|
+
})),
|
|
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), {
|
|
1355
|
+
...e,
|
|
1356
|
+
label: e.nickname + e.username,
|
|
1357
|
+
value: e[T.value],
|
|
1358
|
+
type: "user"
|
|
1359
|
+
};
|
|
1360
|
+
})];
|
|
1361
|
+
}, V = /* @__PURE__ */ new WeakMap(), U = (e, x, S) => {
|
|
1362
|
+
let w;
|
|
1363
|
+
if (b.type === "dept") return createVNode(NTree, {
|
|
1364
|
+
data: b.depts,
|
|
1365
|
+
keyField: "value",
|
|
1366
|
+
labelField: "name",
|
|
1367
|
+
defaultExpandAll: b.defaultExpandAll,
|
|
1368
|
+
checkable: b.multiple,
|
|
1369
|
+
selectable: !b.multiple,
|
|
1370
|
+
multiple: !1,
|
|
1371
|
+
blockLine: !0,
|
|
1372
|
+
checkOnClick: !0,
|
|
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,
|
|
1377
|
+
onUpdateCheckedKeys: (e) => {
|
|
1378
|
+
b.max && e?.length > b.max || x(e);
|
|
1379
|
+
},
|
|
1380
|
+
onUpdateSelectedKeys: (e) => {
|
|
1381
|
+
x(e);
|
|
1382
|
+
}
|
|
1383
|
+
}, null);
|
|
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"),
|
|
1391
|
+
createVNode("span", { style: "padding: 0 4px" }, [createVNode(IRight, null, null)]),
|
|
1392
|
+
O.at(-1).label
|
|
1393
|
+
]), createVNode(NButton, {
|
|
1394
|
+
text: !0,
|
|
1395
|
+
type: "warning",
|
|
1396
|
+
onClick: () => {
|
|
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;
|
|
1399
|
+
}
|
|
1400
|
+
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(ILeft, null, null)] }), C("common.back")] })]) : createVNode("span", null, [C("common.all")])]), D?.length ? createVNode(NList, {
|
|
1401
|
+
showDivider: !1,
|
|
1402
|
+
style: "padding: 0 16px"
|
|
1403
|
+
}, _isSlot(w = D.map((S) => {
|
|
1404
|
+
let C, w;
|
|
1405
|
+
return createVNode(NListItem, {
|
|
1406
|
+
key: S.type + "_" + S.value,
|
|
1407
|
+
style: "padding: 6px 0"
|
|
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);
|
|
1414
|
+
else {
|
|
1415
|
+
let e = w.indexOf(S.value);
|
|
1416
|
+
w.splice(e, 1);
|
|
1417
|
+
}
|
|
1418
|
+
x(w);
|
|
1419
|
+
},
|
|
1420
|
+
style: "margin-left: 3px"
|
|
1421
|
+
}, _isSlot(C = renderUsers([S], {
|
|
1422
|
+
max: 1,
|
|
1423
|
+
size: 24,
|
|
1424
|
+
placement: "right",
|
|
1425
|
+
tooltip: !1,
|
|
1426
|
+
username: !0
|
|
1427
|
+
})) ? C : { default: () => [C] }) : createVNode(NRadio, {
|
|
1428
|
+
checked: T.has(S.value) || !1,
|
|
1429
|
+
onUpdateChecked: (e) => {
|
|
1430
|
+
x(e ? [S.value] : []);
|
|
1431
|
+
},
|
|
1432
|
+
style: "margin-left: 3px;"
|
|
1433
|
+
}, _isSlot(w = renderUsers([S], {
|
|
1434
|
+
max: 1,
|
|
1435
|
+
size: 24,
|
|
1436
|
+
placement: "right",
|
|
1437
|
+
tooltip: !1,
|
|
1438
|
+
username: !0
|
|
1439
|
+
})) ? w : { default: () => [w] }) : createVNode("div", {
|
|
1440
|
+
onClick: () => {
|
|
1441
|
+
z.value = !1, R.value.push(S), B(S);
|
|
1442
|
+
},
|
|
1443
|
+
style: "cursor: pointer; display: flex; align-items: center; gap: 8px"
|
|
1444
|
+
}, [
|
|
1445
|
+
S.type === "dept" ? createVNode(NAvatar, {
|
|
1446
|
+
size: 24,
|
|
1447
|
+
style: "background-color: red"
|
|
1448
|
+
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(IDept, null, null)] })] }) : createVNode(NAvatar, {
|
|
1449
|
+
size: 24,
|
|
1450
|
+
style: "background-color: green"
|
|
1451
|
+
}, { default: () => [createVNode(NIcon, null, { default: () => [createVNode(IGroup, null, null)] })] }),
|
|
1452
|
+
createVNode("span", { style: "flex: 1 1 auto" }, [S.label]),
|
|
1453
|
+
createVNode(NIcon, null, { default: () => [createVNode(IRight, null, null)] })
|
|
1454
|
+
])] });
|
|
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),
|
|
1470
|
+
"onUpdate:value": (e) => {
|
|
1471
|
+
C?.(e);
|
|
1472
|
+
},
|
|
1473
|
+
onUpdateValue: (e) => {
|
|
1474
|
+
w?.(e);
|
|
1475
|
+
}
|
|
1476
|
+
}), null), q = ({ option: e, handleClose: x }) => createVNode(NTag, {
|
|
1477
|
+
type: b.type === "user" ? "primary" : "info",
|
|
1478
|
+
closable: !0,
|
|
1479
|
+
onMousedown: (e) => e.preventDefault(),
|
|
1480
|
+
onClose: (e) => {
|
|
1481
|
+
e.stopPropagation(), x();
|
|
1482
|
+
}
|
|
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;
|
|
1488
|
+
let e = shallowRef([...O.value || []]);
|
|
1489
|
+
Z.create({
|
|
1490
|
+
showIcon: !1,
|
|
1491
|
+
title: b.placeholder,
|
|
1492
|
+
style: { width: "700px" },
|
|
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");
|
|
1498
|
+
},
|
|
1499
|
+
onAfterLeave() {
|
|
1500
|
+
nextTick(() => {
|
|
1501
|
+
Y.value?.blur(), X = !1;
|
|
1502
|
+
});
|
|
1503
|
+
}
|
|
1504
|
+
});
|
|
1505
|
+
}, $ = { arrow: () => createVNode(NIcon, null, { default: () => [b.type === "user" ? createVNode(IGroup, null, null) : createVNode(IDept, null, null)] }) };
|
|
1506
|
+
return () => {
|
|
1507
|
+
let e = b.type === "user" ? A.value : j.value;
|
|
1508
|
+
if (b.selectType === "dropdown" && b.type === "dept") return createVNode(NTreeSelect, {
|
|
1509
|
+
options: e,
|
|
1510
|
+
keyField: "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,
|
|
1516
|
+
onUpdateValue: (e) => {
|
|
1517
|
+
b.multiple && b.max && e?.length > b.max || x("updateModelValue", e);
|
|
1518
|
+
},
|
|
1519
|
+
"onUpdate:value": (e) => {
|
|
1520
|
+
b.multiple && b.max && e?.length > b.max || x("update:modelValue", e);
|
|
1521
|
+
}
|
|
1522
|
+
}, _isSlot($) ? $ : { default: () => [$] });
|
|
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,
|
|
1530
|
+
options: e,
|
|
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,
|
|
1538
|
+
onUpdateValue: (e) => {
|
|
1539
|
+
x("updateModelValue", e);
|
|
1540
|
+
},
|
|
1541
|
+
"onUpdate:value": (e) => {
|
|
1542
|
+
x("update:modelValue", e);
|
|
1543
|
+
}
|
|
1544
|
+
}), _isSlot($) ? $ : { default: () => [$] });
|
|
1545
|
+
};
|
|
1546
|
+
}
|
|
1547
|
+
});
|
|
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, {
|
|
1551
|
+
key: e.username,
|
|
1552
|
+
raw: !0,
|
|
1553
|
+
placement: x,
|
|
1554
|
+
disabled: C === !1
|
|
1555
|
+
}, {
|
|
1556
|
+
default: () => createVNode(NCard, {
|
|
1557
|
+
style: "width: 200px",
|
|
1558
|
+
size: "small"
|
|
1559
|
+
}, { default: () => [createVNode(NH4, null, { default: () => [e.nickname] }), createVNode("span", null, [e.username])] }),
|
|
1560
|
+
trigger: () => {
|
|
1561
|
+
let x = createVNode(NAvatar, {
|
|
1562
|
+
color: "var(--color-primary)",
|
|
1563
|
+
round: !0,
|
|
1564
|
+
size: S,
|
|
1565
|
+
style: b ? {
|
|
1566
|
+
position: "absolute",
|
|
1567
|
+
bottom: -(S - 16) / 2 + "px"
|
|
1568
|
+
} : ""
|
|
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;
|
|
1580
|
+
}
|
|
1581
|
+
});
|
|
1582
|
+
}
|
|
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: {
|
|
1587
|
+
display: "inline-block",
|
|
1588
|
+
height: S + "px"
|
|
1589
|
+
} }, [createVNode(NAvatarGroup, {
|
|
1590
|
+
options: e,
|
|
1591
|
+
size: S,
|
|
1592
|
+
max: x || 4,
|
|
1593
|
+
style: "top: -2px"
|
|
1594
|
+
}, {
|
|
1595
|
+
avatar: ({ option: e }) => renderUser(e, !1, b),
|
|
1596
|
+
rest: ({ options: e, rest: b }) => createVNode(NDropdown, {
|
|
1597
|
+
options: e,
|
|
1598
|
+
keyField: "username",
|
|
1599
|
+
labelField: "nickname",
|
|
1600
|
+
renderOption: ({ option: b }) => renderUser(b, !1, e)
|
|
1601
|
+
}, { default: () => [createVNode(NAvatar, null, { default: () => [createTextVNode("+"), b] })] })
|
|
1602
|
+
})]);
|
|
1603
|
+
}
|
|
1604
|
+
const DtDeptRender = /* @__PURE__ */ defineComponent({
|
|
1605
|
+
name: "DeptRender",
|
|
1606
|
+
props: {
|
|
1607
|
+
value: [String, Array],
|
|
1608
|
+
multiple: Boolean,
|
|
1609
|
+
getDeptsByCode: Function
|
|
1610
|
+
},
|
|
1611
|
+
setup(e) {
|
|
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);
|
|
1622
|
+
});
|
|
1623
|
+
}, { immediate: !0 }), () => b.value.map((e) => createVNode(NTag, { key: e.code }, { default: () => [e.name] }));
|
|
1624
|
+
}
|
|
1625
|
+
}), DtUserRender = /* @__PURE__ */ defineComponent({
|
|
1626
|
+
name: "UserRender",
|
|
1627
|
+
props: {
|
|
1628
|
+
value: [String, Array],
|
|
1629
|
+
multiple: Boolean,
|
|
1630
|
+
max: Number,
|
|
1631
|
+
size: Number,
|
|
1632
|
+
placement: String,
|
|
1633
|
+
getUsersByUsername: Function
|
|
1634
|
+
},
|
|
1635
|
+
setup(e) {
|
|
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);
|
|
1646
|
+
});
|
|
1647
|
+
}, { immediate: !0 }), () => renderUsers(b.value, e);
|
|
1648
|
+
}
|
|
1649
|
+
});
|
|
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 };
|