@ithinkdt/ui 4.0.2 → 4.0.4

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.
@@ -1,2023 +0,0 @@
1
- import { n as e } from "./use-i18n-Cmb7Xx7d.js";
2
- import t, { c as n, cB as r, cE as i, cM as a, useClsPrefix as o } from "./use-style.js";
3
- import { i as s } from "./directives-pSAvXd5F.js";
4
- import { Fragment as c, computed as l, createTextVNode as u, createVNode as d, defineComponent as f, h as p, inject as m, isVNode as h, markRaw as g, mergeProps as _, nextTick as v, reactive as y, ref as b, shallowRef as x, toRaw as S, toRef as C, toValue as w, unref as T, useTemplateRef as E, watch as D, withDirectives as O } from "vue";
5
- import { toReactive as ee, unrefElement as k, until as A } from "@vueuse/core";
6
- import { NAnchor as j, NAnchorLink as te, NAvatar as M, NAvatarGroup as ne, NButton as N, NCard as P, NCheckbox as F, NCheckboxGroup as re, NDataTable as ie, NDropdown as ae, NEllipsis as oe, NEmpty as se, NFlex as I, NForm as ce, NFormItem as le, NGi as ue, NGrid as de, NIcon as L, NInput as R, NList as fe, NListItem as pe, NPagination as me, NPopover as z, NRadio as B, NRadioButton as he, NRadioGroup as ge, NSelect as _e, NSpin as ve, NTag as V, NText as H, NTooltip as U, NTransfer as ye, NTree as be, NTreeSelect as xe, dataTableProps as Se, formProps as Ce, useDialog as we } from "ithinkdt-ui";
7
- import { nanoid as Te } from "nanoid";
8
- import { VOverflow as Ee, VResizeObserver as De } from "vueuc";
9
- import { Sortable as Oe } from "sortablejs/modular/sortable.core.esm.js";
10
- import { isNullish as ke, pickProps as W } from "@ithinkdt/common/object";
11
- import { useFormItem as Ae } from "ithinkdt-ui/es/_mixins";
12
- import { measureText as je } from "@ithinkdt/common/string";
13
- import { PAGE_INJECTION as Me, useFormModal as Ne } from "@ithinkdt/page";
14
- import { Sortable as Pe } from "sortablejs";
15
- import Fe from "ithinkdt-ui/es/_mixins/use-locale.mjs";
16
- import { flattenTree as Ie, walkTree as Le } from "@ithinkdt/common";
17
- const Re = /* @__PURE__ */ f({
18
- name: "Checkboxes",
19
- inheritAttrs: !1,
20
- props: {
21
- options: {
22
- type: Array,
23
- default: () => []
24
- },
25
- vertical: {
26
- type: Boolean,
27
- default: !1
28
- },
29
- default: {
30
- type: [
31
- Boolean,
32
- String,
33
- Object
34
- ],
35
- default: !1
36
- },
37
- gap: {
38
- type: [
39
- Number,
40
- String,
41
- Array
42
- ],
43
- default: void 0
44
- },
45
- modelValue: {
46
- type: Array,
47
- default: void 0
48
- },
49
- labelPadding: {
50
- type: String,
51
- default: void 0
52
- },
53
- labelField: {
54
- type: String,
55
- default: "label"
56
- },
57
- valueField: {
58
- type: String,
59
- default: "value"
60
- },
61
- disabledField: {
62
- type: String,
63
- default: "disabled"
64
- }
65
- },
66
- emits: {
67
- "update:modelValue": () => !0,
68
- updateModelValue: () => !0
69
- },
70
- setup(t, { emit: n, attrs: r }) {
71
- let { t: i } = e(), a = l(() => t.default ? t.default === !0 ? i("common.all") : typeof t.default == "string" ? t.default : t.default?.[t.labelField] ?? i("common.all") : ""), o = b([]);
72
- D(() => t.modelValue, (e) => o.value = e, { immediate: !0 });
73
- let s = (e) => {
74
- n("update:modelValue", e), n("updateModelValue", e);
75
- }, c = () => {
76
- s(o.value?.length === t.options.length ? [] : t.options.map((e) => e[t.valueField]));
77
- }, u = l(() => t.options.length > o.value?.length && o.value?.length > 0), f = l(() => ({ "--n-label-padding": t.labelPadding }));
78
- return () => {
79
- let e = d(re, _(r, {
80
- value: o.value,
81
- onUpdateValue: s
82
- }), { default: () => [d(I, {
83
- size: t.gap ?? (t.vertical ? void 0 : "small"),
84
- vertical: t.vertical,
85
- style: !t.default && t.vertical ? { padding: "6px 0 0" } : {}
86
- }, { default: () => [t.options?.map((e) => d(F, {
87
- value: e[t.valueField],
88
- disabled: e[t.disabledField],
89
- style: f.value
90
- }, { default: () => [e[t.labelField]] }))] })] });
91
- return t.default ? d(I, {
92
- size: t.gap ?? (t.vertical ? void 0 : "small"),
93
- vertical: t.vertical,
94
- style: t.vertical ? { padding: "6px 0 0" } : {}
95
- }, { default: () => [d("span", null, [d(F, {
96
- indeterminate: u.value,
97
- checked: o.value?.length > 0,
98
- onUpdateChecked: c,
99
- style: f.value
100
- }, { default: () => [a.value] })]), e] }) : e;
101
- };
102
- }
103
- }), ze = (e) => d("svg", _({
104
- xmlns: "http://www.w3.org/2000/svg",
105
- "xmlns:xlink": "http://www.w3.org/1999/xlink",
106
- role: "img",
107
- width: "1em",
108
- height: "1em",
109
- viewBox: "0 0 24 24"
110
- }, e), [d("path", {
111
- fill: "currentColor",
112
- 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"
113
- }, null)]), Be = (e) => d("svg", _({
114
- xmlns: "http://www.w3.org/2000/svg",
115
- "xmlns:xlink": "http://www.w3.org/1999/xlink",
116
- role: "img",
117
- width: "1em",
118
- height: "1em",
119
- viewBox: "0 0 1024 1024"
120
- }, e), [d("path", {
121
- fill: "currentColor",
122
- 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"
123
- }, null)]), Ve = (e) => d("svg", _({
124
- xmlns: "http://www.w3.org/2000/svg",
125
- "xmlns:xlink": "http://www.w3.org/1999/xlink",
126
- role: "img",
127
- width: "1em",
128
- height: "1em",
129
- viewBox: "0 0 1024 1024"
130
- }, e), [d("path", {
131
- fill: "currentColor",
132
- 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"
133
- }, null)]), He = (e) => d("svg", _({
134
- xmlns: "http://www.w3.org/2000/svg",
135
- "xmlns:xlink": "http://www.w3.org/1999/xlink",
136
- role: "img",
137
- width: "1em",
138
- height: "1em",
139
- viewBox: "0 0 1024 1024"
140
- }, e), [d("path", {
141
- fill: "currentColor",
142
- 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"
143
- }, null)]), Ue = (e) => d("svg", _({
144
- xmlns: "http://www.w3.org/2000/svg",
145
- "xmlns:xlink": "http://www.w3.org/1999/xlink",
146
- role: "img",
147
- width: "1em",
148
- height: "1em",
149
- viewBox: "0 0 1024 1024"
150
- }, e), [d("path", {
151
- fill: "currentColor",
152
- 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"
153
- }, null)]), We = (e) => d("svg", _({
154
- xmlns: "http://www.w3.org/2000/svg",
155
- "xmlns:xlink": "http://www.w3.org/1999/xlink",
156
- role: "img",
157
- width: "1em",
158
- height: "1em",
159
- viewBox: "0 0 24 24"
160
- }, e), [d("path", {
161
- fill: "currentColor",
162
- d: "M15.41 16.58L10.83 12l4.58-4.59L14 6l-6 6l6 6z"
163
- }, null)]), Ge = (e) => d("svg", _({
164
- xmlns: "http://www.w3.org/2000/svg",
165
- "xmlns:xlink": "http://www.w3.org/1999/xlink",
166
- role: "img",
167
- width: "1em",
168
- height: "1em",
169
- viewBox: "0 0 24 24"
170
- }, e), [d("path", {
171
- fill: "currentColor",
172
- d: "M8.59 16.58L13.17 12L8.59 7.41L10 6l6 6l-6 6z"
173
- }, null)]), Ke = (e) => d("svg", _({
174
- xmlns: "http://www.w3.org/2000/svg",
175
- "xmlns:xlink": "http://www.w3.org/1999/xlink",
176
- role: "img",
177
- width: "1em",
178
- height: "1em",
179
- viewBox: "0 0 32 32"
180
- }, e), [d("path", {
181
- fill: "currentColor",
182
- d: "M16 22L6 12l1.4-1.4l8.6 8.6l8.6-8.6L26 12z"
183
- }, null)]), qe = (e) => d("svg", _({
184
- xmlns: "http://www.w3.org/2000/svg",
185
- "xmlns:xlink": "http://www.w3.org/1999/xlink",
186
- role: "img",
187
- width: "1em",
188
- height: "1em",
189
- viewBox: "0 0 32 32"
190
- }, e), [d("path", {
191
- fill: "currentColor",
192
- d: "m16 10l10 10l-1.4 1.4l-8.6-8.6l-8.6 8.6L6 20z"
193
- }, null)]), Je = (e) => d("svg", _({
194
- xmlns: "http://www.w3.org/2000/svg",
195
- "xmlns:xlink": "http://www.w3.org/1999/xlink",
196
- role: "img",
197
- width: "1em",
198
- height: "1em",
199
- viewBox: "0 0 24 24"
200
- }, e), [d("path", {
201
- fill: "currentColor",
202
- d: "m9.55 18l-5.7-5.7l1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"
203
- }, null)]), Ye = (e) => d("svg", _({
204
- xmlns: "http://www.w3.org/2000/svg",
205
- "xmlns:xlink": "http://www.w3.org/1999/xlink",
206
- role: "img",
207
- width: "1em",
208
- height: "1em",
209
- viewBox: "0 0 24 24"
210
- }, e), [d("path", {
211
- fill: "currentColor",
212
- 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"
213
- }, null)]), Xe = (e) => d("svg", _({
214
- xmlns: "http://www.w3.org/2000/svg",
215
- "xmlns:xlink": "http://www.w3.org/1999/xlink",
216
- role: "img",
217
- width: "1em",
218
- height: "1em",
219
- viewBox: "0 0 24 24"
220
- }, e), [d("path", {
221
- fill: "currentColor",
222
- d: "m12 19.24l-4.95-4.95l-1.41 1.42L12 22.07l6.36-6.36l-1.41-1.42zM5.64 8.29l1.41 1.42L12 4.76l4.95 4.95l1.41-1.42L12 1.93z"
223
- }, null)]), Ze = (e) => d("svg", _({
224
- xmlns: "http://www.w3.org/2000/svg",
225
- "xmlns:xlink": "http://www.w3.org/1999/xlink",
226
- role: "img",
227
- width: "1em",
228
- height: "1em",
229
- viewBox: "0 0 24 24"
230
- }, e), [d("path", {
231
- fill: "currentColor",
232
- d: "M12 7.59L7.05 2.64L5.64 4.05L12 10.41l6.36-6.36l-1.41-1.41zM5.64 19.95l1.41 1.41L12 16.41l4.95 4.95l1.41-1.41L12 13.59z"
233
- }, null)]), Qe = (e) => d("svg", _({
234
- xmlns: "http://www.w3.org/2000/svg",
235
- "xmlns:xlink": "http://www.w3.org/1999/xlink",
236
- role: "img",
237
- width: "1em",
238
- height: "1em",
239
- viewBox: "0 0 20 20"
240
- }, e), [d("path", {
241
- fill: "currentColor",
242
- fillRule: "evenodd",
243
- 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"
244
- }, null)]), $e = (e) => d("svg", _({
245
- xmlns: "http://www.w3.org/2000/svg",
246
- "xmlns:xlink": "http://www.w3.org/1999/xlink",
247
- width: "1em",
248
- height: "1em",
249
- viewBox: "0 0 12 12"
250
- }, e), [d("path", {
251
- fill: "currentColor",
252
- 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"
253
- }, null)]), et = (e) => d("svg", _({
254
- xmlns: "http://www.w3.org/2000/svg",
255
- "xmlns:xlink": "http://www.w3.org/1999/xlink",
256
- width: "1em",
257
- height: "1em",
258
- viewBox: "0 0 24 24"
259
- }, e), [d("g", {
260
- fill: "none",
261
- fillRule: "evenodd"
262
- }, [d("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), d("path", {
263
- fill: "currentColor",
264
- 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"
265
- }, null)])]), tt = (e) => d("svg", _({
266
- xmlns: "http://www.w3.org/2000/svg",
267
- "xmlns:xlink": "http://www.w3.org/1999/xlink",
268
- role: "img",
269
- width: "1em",
270
- height: "1em",
271
- viewBox: "0 0 256 256"
272
- }, e), [d("path", {
273
- fill: "currentColor",
274
- 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"
275
- }, null)]), nt = (e) => d("svg", _({
276
- xmlns: "http://www.w3.org/2000/svg",
277
- "xmlns:xlink": "http://www.w3.org/1999/xlink",
278
- role: "img",
279
- width: "1em",
280
- height: "1em",
281
- viewBox: "0 0 24 24"
282
- }, e), [d("path", {
283
- fill: "currentColor",
284
- 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"
285
- }, null)]), rt = /* @__PURE__ */ f({
286
- name: "DataActions",
287
- props: { options: {
288
- type: Array,
289
- default: () => []
290
- } },
291
- setup(e) {
292
- let t = b(), n = !0, r = () => {
293
- n ? n = !1 : t.value?.sync({ showAllItemsBeforeCalculate: !0 });
294
- }, i = b(), a = () => i.value, o = b(-1), s = (t) => {
295
- o.value = e.options.length - t;
296
- }, c = (e) => {
297
- e || (o.value = -1);
298
- }, u = () => {}, f = l(() => o.value === -1 ? [] : e.options.slice(o.value).map((e) => ({
299
- ...e,
300
- key: e.text
301
- }))), p = (e) => d(N, {
302
- type: e.color === "danger" ? "error" : [
303
- "default",
304
- "tertiary",
305
- "primary",
306
- "info",
307
- "success",
308
- "warning",
309
- "error"
310
- ].includes(e.color) ? e.color : "primary",
311
- text: !0
312
- }, { default: () => [e.text] }), m = (e, t) => {
313
- t.onClick?.();
314
- };
315
- return () => d(De, { onResize: r }, { default: () => [d(Ee, {
316
- ref: t,
317
- getCounter: a,
318
- onUpdateCount: s,
319
- onUpdateOverflow: c,
320
- updateCounter: u,
321
- style: "margin-top: 2px"
322
- }, {
323
- default: () => e.options.map((e) => d(N, {
324
- quaternary: !0,
325
- type: e.color === "danger" ? "error" : [
326
- "default",
327
- "tertiary",
328
- "primary",
329
- "info",
330
- "success",
331
- "warning",
332
- "error"
333
- ].includes(e.color) ? e.color : "primary",
334
- size: "small",
335
- onClick: e.onClick
336
- }, { default: () => [e.text] })),
337
- counter: () => d("span", {
338
- ref: i,
339
- style: "position: absolute"
340
- }, [d(ae, {
341
- options: f.value,
342
- renderLabel: p,
343
- onSelect: m
344
- }, { default: () => [d(N, {
345
- quaternary: !0,
346
- size: "small"
347
- }, { default: () => [d(Qe, { style: "font-size: 14px; color: #888" }, null)] })] })])
348
- })] });
349
- }
350
- });
351
- function G(e) {
352
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !h(e);
353
- }
354
- var it = /* @__PURE__ */ f({
355
- name: "DataCustomRow",
356
- props: {
357
- label: [String, Function],
358
- disabled: Boolean,
359
- hidden: Boolean,
360
- showFixed: Boolean,
361
- fixed: [Boolean, String]
362
- },
363
- emits: ["update-hidden", "update-fixed"],
364
- setup(e, { emit: t }) {
365
- return () => {
366
- let n;
367
- return d(I, {
368
- align: "center",
369
- wrap: !1,
370
- size: "small"
371
- }, { default: () => [
372
- d(N, {
373
- type: "primary",
374
- text: !0,
375
- class: "icon-drag"
376
- }, { default: () => [d(L, { size: "18" }, { default: () => [d(Ve, null, null)] })] }),
377
- d(F, {
378
- checked: !e.hidden,
379
- disabled: e.disabled,
380
- onUpdateChecked: (e) => t("update-hidden", !e)
381
- }, null),
382
- d(oe, { style: "flex: 1 1 auto" }, G(n = w(e.label)) ? n : { default: () => [n] }),
383
- e.showFixed ? [d(N, {
384
- text: !0,
385
- type: e.fixed === "left" ? "primary" : void 0,
386
- onClick: () => t("update-fixed", e.fixed === "left" ? !1 : "left")
387
- }, { default: () => [d(L, null, { default: () => [d(He, null, null)] })] }), d(N, {
388
- text: !0,
389
- type: e.fixed === "right" ? "primary" : void 0,
390
- onClick: () => t("update-fixed", e.fixed === "right" ? !1 : "right")
391
- }, { default: () => [d(L, null, { default: () => [d(Ue, null, null)] })] })] : void 0
392
- ] });
393
- };
394
- }
395
- });
396
- const at = /* @__PURE__ */ f({
397
- name: "DataCustom",
398
- props: {
399
- data: {
400
- type: Array,
401
- required: !0
402
- },
403
- keyField: {
404
- type: String,
405
- default: "key"
406
- },
407
- labelField: {
408
- type: String,
409
- default: "label"
410
- },
411
- fixedField: {
412
- type: String,
413
- default: "fixed"
414
- },
415
- hiddenField: {
416
- type: String,
417
- default: "hidden"
418
- },
419
- showFixed: {
420
- type: Boolean,
421
- default: !0
422
- },
423
- disabledField: {
424
- type: String,
425
- default: "disabled"
426
- },
427
- visibleField: {
428
- type: String,
429
- default: "visible"
430
- },
431
- tooltip: [String, Object],
432
- size: {
433
- type: Number,
434
- default: 20
435
- },
436
- type: { type: String }
437
- },
438
- emits: { custom: () => !0 },
439
- setup(t, { emit: n }) {
440
- let { t: r } = e();
441
- function i(e, r, i) {
442
- n("custom", {
443
- key: e[t.keyField],
444
- [r]: i
445
- });
446
- }
447
- let a = b();
448
- return D(a, (e) => {
449
- e.$el && Oe.create(e.$el, {
450
- animation: 150,
451
- ghostClass: "ghost",
452
- handle: ".icon-drag",
453
- filter: ".disabled",
454
- onEnd(e) {
455
- let r = t.data.map((e) => e[t.keyField]), [i] = r.splice(e.oldIndex, 1);
456
- r.splice(e.newIndex, 0, i), n("custom", r);
457
- }
458
- });
459
- }), () => d(z, {
460
- trigger: "click",
461
- scrollable: !0,
462
- placement: "left-start",
463
- displayDirective: "show",
464
- style: "max-height: 400px; width: 240px"
465
- }, {
466
- trigger: () => O(d(N, {
467
- text: !0,
468
- type: t.type
469
- }, { default: () => [d(L, { size: t.size }, { default: () => [d(Be, null, null)] })] }), [[s, t.tooltip ?? r("common.page.custom.tooltip")]]),
470
- default: () => {
471
- let e, o;
472
- return d(I, { vertical: !0 }, { default: () => [d(I, { justify: "space-between" }, { default: () => [d("div", { style: "font-weight: bold" }, [t.tooltip ?? r("common.page.custom.tooltip")]), d(N, {
473
- text: !0,
474
- type: "primary",
475
- size: "small",
476
- onClick: () => n("custom", !0)
477
- }, G(e = r("common.page.custom.reset")) ? e : { default: () => [e] })] }), d(I, {
478
- ref: a,
479
- vertical: !0
480
- }, G(o = t.data.filter((e) => e[t.visibleField] !== !1).map((e) => d(it, {
481
- key: e[t.keyField],
482
- label: e[t.labelField],
483
- hidden: e[t.hiddenField],
484
- fixed: e[t.fixedField],
485
- showFixed: t.showFixed,
486
- onUpdateHidden: (t) => i(e, "hidden", t),
487
- onUpdateFixed: (t) => i(e, "fixed", t)
488
- }, null))) ? o : { default: () => [o] })] });
489
- }
490
- });
491
- }
492
- });
493
- function ot(e) {
494
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !h(e);
495
- }
496
- function K(e, t) {
497
- return typeof e == "function" ? e(t) : e;
498
- }
499
- function st(e, t) {
500
- return e.isGroup ? (e.__children ??= e.children?.filter((e) => e.isGroup) ?? [], d(te, { href: `#${e.prop}` }, {
501
- title: () => K(e.label, t),
502
- default: e.__children?.length ? () => e.__children.map((e) => st(e, t)) : void 0
503
- })) : null;
504
- }
505
- function ct(e, t, n) {
506
- return typeof e == "function" ? e(t, n) : e;
507
- }
508
- function lt(e, t, n, r) {
509
- return e.isGroup ? d("div", {
510
- key: e.prop,
511
- class: `${r}__group`,
512
- id: e.prop
513
- }, [d("div", { class: `${r}__title` }, [K(e.label, n)]), d("div", { class: `${r}__wrapper` }, [e.children?.map((e) => lt(e, t, n, r))])]) : d("div", {
514
- key: e.prop,
515
- class: `${r}__item`,
516
- style: {
517
- "--descriptions-col-span": ct(e.colSpan, t, n) ?? 1,
518
- "--descriptions-row-span": ct(e.rowSpan, t, n) ?? 1
519
- }
520
- }, [e.label ? d("div", { class: `${r}__label` }, [K(e.label, n)]) : void 0, d("div", { class: `${r}__content` }, [(n ? e.render ? e.render(n) : n[e.prop] : void 0) ?? d("span", { class: `${r}__nothing` }, [u("--")])])]);
521
- }
522
- const ut = /* @__PURE__ */ f({
523
- name: "DataDescriptions",
524
- props: {
525
- cols: {
526
- type: Number,
527
- default: 3
528
- },
529
- data: { type: Object },
530
- items: {
531
- type: Array,
532
- default: () => []
533
- },
534
- title: { type: [String, Function] },
535
- anchor: {
536
- type: [Boolean, Object],
537
- default: void 0
538
- }
539
- },
540
- setup(e) {
541
- let n = o(), r = `${n.value}-data-descriptions`;
542
- t("-data-descriptions", dt, n);
543
- let i = b();
544
- D(() => e.items, () => {
545
- location.hash && A(i).toBeTruthy().then((e) => {
546
- e.scrollTo(location.hash);
547
- });
548
- }, { immediate: !0 });
549
- let a = l(() => ({ "--descriptions-cols": e.cols })), s = l(() => _({
550
- ref: i,
551
- class: `${r}__anchor`,
552
- showBackground: !1,
553
- affix: !0
554
- }, e.anchor && typeof e.anchor == "object" ? e.anchor : {}));
555
- return () => {
556
- let t, { cols: n, title: i, data: o, items: c, anchor: l } = e, u = ke(i) ? void 0 : d("div", { class: `${r}__header` }, [typeof i == "string" ? d("span", null, [i]) : i(o ?? void 0)]), f = c.filter((e) => !e.hiddden).map((e) => lt(e, n, o, r)), m = l === !1 ? void 0 : d(j, s.value, ot(t = c.map((e) => p(st(e, o), { key: e.prop }))) ? t : { default: () => [t] });
557
- return d("div", {
558
- class: r,
559
- style: a.value
560
- }, [
561
- u,
562
- d("div", { class: `${r}__wrapper` }, [f]),
563
- m
564
- ]);
565
- };
566
- }
567
- });
568
- var dt = /* @__PURE__ */ r("data-descriptions", [
569
- i("header", {
570
- fontWeight: "bold",
571
- fontSize: "1.125rem",
572
- marginBottom: "24px"
573
- }),
574
- i("wrapper", {
575
- gridTemplateColumns: "repeat(var(--descriptions-cols, 3), 1fr)",
576
- display: "grid",
577
- gap: "20px"
578
- }, []),
579
- i("group", { gridColumn: "span var(--descriptions-cols, 3)" }),
580
- i("item", {
581
- gridColumn: "span var(--descriptions-col-span, 3)",
582
- gridRow: "span var(--descriptions-row-span, 3)"
583
- }),
584
- i("title", {
585
- fontWeight: "bold",
586
- fontSize: "1.125rem",
587
- marginBottom: "20px",
588
- marginTop: "24px"
589
- }),
590
- i("label", {
591
- color: "#888",
592
- paddingBottom: "6px"
593
- }),
594
- i("content", {
595
- fontSize: "15px",
596
- color: "var(--color-text)"
597
- }),
598
- i("anchor", {
599
- position: "absolute",
600
- zIndex: 2,
601
- top: "40px",
602
- right: "40px"
603
- })
604
- ]);
605
- const q = {
606
- size: {
607
- type: String,
608
- default: void 0
609
- },
610
- gap: {
611
- type: Number,
612
- default: void 0
613
- },
614
- submitText: {
615
- type: [
616
- String,
617
- Number,
618
- Object
619
- ],
620
- default: void 0
621
- },
622
- resetText: {
623
- type: [
624
- String,
625
- Number,
626
- Object
627
- ],
628
- default: void 0
629
- },
630
- cancelText: {
631
- type: [
632
- String,
633
- Number,
634
- Object
635
- ],
636
- default: void 0
637
- },
638
- showSubmitBtn: {
639
- type: Boolean,
640
- required: !1,
641
- default: !0
642
- },
643
- showResetBtn: {
644
- type: Boolean,
645
- required: !1,
646
- default: !0
647
- },
648
- showCancelBtn: {
649
- type: Boolean,
650
- required: !1,
651
- default: !1
652
- },
653
- submitDisabled: Boolean,
654
- submitLoading: Boolean,
655
- succeeded: {
656
- type: Boolean,
657
- default: void 0
658
- },
659
- successText: {
660
- type: [
661
- String,
662
- Number,
663
- Object
664
- ],
665
- default: void 0
666
- },
667
- failureText: {
668
- type: [
669
- String,
670
- Number,
671
- Object
672
- ],
673
- default: void 0
674
- },
675
- nativeButtonType: Boolean
676
- }, ft = /* @__PURE__ */ f({
677
- name: "DataFormActions",
678
- props: q,
679
- emits: [
680
- "submit",
681
- "reset",
682
- "cancel"
683
- ],
684
- setup(t, { emit: n, slots: r }) {
685
- let { t: i } = e(), a = () => {
686
- n("submit");
687
- }, o = () => {
688
- n("reset");
689
- }, s = () => {
690
- n("cancel");
691
- }, { mergedDisabledRef: c, mergedSizeRef: l } = Ae(t);
692
- return () => {
693
- let e = l.value, n = c.value, { gap: u = e === "small" ? 8 : e === "medium" ? 12 : 16, submitText: f, resetText: p, cancelText: m, submitDisabled: h, submitLoading: g, showSubmitBtn: _, showResetBtn: v, showCancelBtn: y, succeeded: b, successText: x = f, failureText: S = f, nativeButtonType: C } = t;
694
- return d(I, { size: u === void 0 ? e : u }, { default: () => [
695
- r.prefix?.(),
696
- _ === !1 ? void 0 : d(N, {
697
- attrType: C ? "submit" : "button",
698
- size: e,
699
- type: b ? "success" : b === !1 ? "error" : "primary",
700
- disabled: b !== void 0 || n || h || g,
701
- loading: g,
702
- onClick: C ? void 0 : a
703
- }, {
704
- default: () => (b ? x : b === !1 ? S : f) || i("common.page.form.submitText"),
705
- icon: () => b ? d(L, null, { default: () => [d(Je, null, null)] }) : b === !1 ? d(L, null, { default: () => [d(nt, null, null)] }) : void 0
706
- }),
707
- v === !1 ? void 0 : d(N, {
708
- size: l.value,
709
- attrType: C ? "reset" : "button",
710
- disabled: n || g || b,
711
- type: y ? "primary" : "default",
712
- secondary: y,
713
- onClick: C ? void 0 : o
714
- }, { default: () => [p || i("common.page.form.resetText")] }),
715
- y === !1 || b ? void 0 : d(N, {
716
- attrType: "button",
717
- disabled: n || g,
718
- onClick: s
719
- }, { default: () => [m || i("common.page.form.cancelText")] }),
720
- r.suffix?.()
721
- ] });
722
- };
723
- }
724
- });
725
- function pt(e) {
726
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !h(e);
727
- }
728
- const mt = /* @__PURE__ */ f({
729
- name: "DataForm",
730
- props: {
731
- grid: {
732
- type: Object,
733
- default: () => ({})
734
- },
735
- ...W(Ce, "disabled", "model", "labelWidth", "labelAlign", "showFeedback", "size"),
736
- ...W(q, "submitText", "resetText", "cancelText", "showSubmitBtn", "showResetBtn", "showCancelBtn", "submitDisabled", "succeeded", "successText", "failureText"),
737
- readonly: {
738
- type: Boolean,
739
- required: !1,
740
- default: void 0
741
- },
742
- items: {
743
- type: Array,
744
- required: !0
745
- },
746
- validation: {
747
- type: Object,
748
- default: () => ({})
749
- },
750
- loading: Boolean,
751
- showColon: Boolean,
752
- tooltipPlacement: {
753
- type: String,
754
- default: "bottom"
755
- },
756
- requireMarkPlacement: {
757
- type: String,
758
- default: "left"
759
- },
760
- labelPlacement: {
761
- type: String,
762
- default: "left"
763
- },
764
- showAction: {
765
- type: [Boolean, Object],
766
- default: void 0
767
- },
768
- actionAlign: {
769
- type: String,
770
- default: "center"
771
- },
772
- actionJustify: {
773
- type: String,
774
- default: "start"
775
- },
776
- actionGap: {
777
- type: String,
778
- default: void 0
779
- }
780
- },
781
- emits: [
782
- "submit",
783
- "reset",
784
- "cancel"
785
- ],
786
- setup(e, { emit: t, slots: n }) {
787
- let r = (n) => {
788
- n?.preventDefault?.(), t("submit", { ...S(e.model) }, n);
789
- }, i = (e) => {
790
- e?.preventDefault?.(), t("reset");
791
- }, a = (e) => {
792
- e?.preventDefault?.(), t("cancel");
793
- }, o = b(), s = ({ overflow: t }) => {
794
- if (n.action) return n.action({
795
- overflow: t,
796
- grid: o.value
797
- });
798
- let { loading: r, showSubmitBtn: i, showResetBtn: s, showCancelBtn: c, actionAlign: l, actionJustify: u, actionGap: f, submitDisabled: p, submitText: m, resetText: h, cancelText: g, succeeded: _, successText: v, failureText: y } = e;
799
- return d(le, {
800
- label: u === "start" ? " " : void 0,
801
- showLabel: e.labelPlacement !== "top",
802
- style: "padding-top: 16px"
803
- }, { default: () => [d(ft, {
804
- align: l,
805
- justify: u,
806
- gap: f,
807
- showSubmitBtn: i,
808
- showResetBtn: s,
809
- showCancelBtn: c,
810
- submitText: m,
811
- resetText: h,
812
- cancelText: g,
813
- submitDisabled: p,
814
- submitLoading: r,
815
- succeeded: _,
816
- successText: v,
817
- failureText: y,
818
- nativeButtonType: !0,
819
- onCancel: a
820
- }, {
821
- prefix: () => n.actionPrefix?.(),
822
- suffix: () => n.actionSuffix?.()
823
- })] });
824
- }, l = () => {
825
- let { items: t, validation: r, showAction: i } = e;
826
- return d(c, null, [t.map(({ hidden: t, name: n, render: i, label: a, showColon: o, span: s = 6, rowSpan: c, offset: l = 0, tooltip: f, tooltipPlacement: p = e.tooltipPlacement, validationStatus: m = r[n]?.errors?.length ? "error" : r[n]?.warnings?.length ? "warnings" : r[n] ? "success" : void 0, readonly: h = e.readonly, showRequireMark: g = !h, showTooltipWhenReadonly: v = !1, ...y }) => {
827
- if (t) return;
828
- let b;
829
- return b = n[0] === "$" ? i({}) : d(le, _({
830
- path: n,
831
- validationStatus: m,
832
- showRequireMark: y.required && g
833
- }, y), {
834
- label: () => d(H, {
835
- depth: e.readonly ? 3 : 2,
836
- style: "display: inline-flex; align-items: flex-start; gap: 1px"
837
- }, { default: () => [
838
- d("span", null, [w(a)]),
839
- p === "icon" ? d(U, null, {
840
- default: () => w(f),
841
- trigger: () => d(N, {
842
- text: !0,
843
- style: "font-size: 1.25em; opacity: 0.8"
844
- }, { default: () => [d(L, null, { default: () => [d(ze, null, null)] })] })
845
- }) : void 0,
846
- e.showColon && o !== !1 ? d("span", { style: "place-self: center" }, [u(":")]) : void 0
847
- ] }),
848
- default: () => {
849
- let t, n = d("div", { style: "width: 100%; font-size: calc(1rem - 2px); min-height: 32px; display: flex; align-items: center" }, [i({
850
- disabled: e.disabled,
851
- size: e.size,
852
- readonly: e.readonly
853
- })]);
854
- return f && p === "bottom" && (!e.readonly || v) ? d("div", { style: "width: 100%; display: flex; flex-direction: column" }, [n, d(H, {
855
- depth: 3,
856
- style: "font-size: calc(1rem - 3px); margin-top: 6px"
857
- }, pt(t = w(f)) ? t : { default: () => [t] })]) : n;
858
- },
859
- feedback: () => r[n]?.errors?.[0] ?? r[n]?.warnings?.[0]
860
- }), e.grid === !1 ? b : d(ue, {
861
- key: n,
862
- offset: l,
863
- span: s,
864
- style: c ? { gridRowEnd: `span ${c}` } : void 0
865
- }, pt(b) ? b : { default: () => [b] });
866
- }), i === !1 || e.readonly === !0 && !n.action ? void 0 : d(ue, _({
867
- key: "action",
868
- span: 2 ** 53 - 1
869
- }, typeof e.showAction == "object" ? e.showAction : {}), { default: s })]);
870
- };
871
- return () => {
872
- let { items: t, loading: n, validation: a, showColon: s, tooltipPlacement: c, showFeedback: u, labelWidth: f = "7.2em", labelAlign: p = e.labelPlacement === "top" ? "left" : "right", grid: m, showAction: h, showSubmitBtn: g, showResetBtn: v, showCancelBtn: y, actionAlign: b, actionJustify: x, actionGap: S, submitDisabled: C, submitText: w, resetText: T, cancelText: E, succeeded: D, successText: O, failureText: ee, ...k } = e, A = !e.readonly && u !== !1;
873
- return d(ce, _({
874
- labelWidth: f,
875
- labelAlign: p,
876
- onReset: i,
877
- onSubmit: r,
878
- showFeedback: A
879
- }, k), { default: () => [d(de, _({
880
- ref: o,
881
- itemResponsive: !0
882
- }, m, { yGap: A ? 0 : m?.yGap ?? 24 }), { default: l })] });
883
- };
884
- }
885
- }), ht = /* @__PURE__ */ f({
886
- name: "DataFilter",
887
- props: {
888
- grid: {
889
- type: Object,
890
- default: () => ({})
891
- },
892
- ...W(Ce, "disabled", "model"),
893
- labelWidth: {
894
- type: [String, Number],
895
- default: "5em"
896
- },
897
- labelPlacement: {
898
- type: String,
899
- default: "left"
900
- },
901
- items: {
902
- type: Array,
903
- required: !0
904
- },
905
- loading: {
906
- type: Boolean,
907
- required: !1,
908
- default: !1
909
- },
910
- filterOnReset: {
911
- type: Boolean,
912
- required: !1,
913
- default: !0
914
- },
915
- filterText: {
916
- type: String,
917
- default: void 0
918
- },
919
- resetText: {
920
- type: String,
921
- default: void 0
922
- },
923
- customizable: {
924
- type: Boolean,
925
- required: !1,
926
- default: !0
927
- },
928
- collapsible: {
929
- type: Boolean,
930
- required: !1,
931
- default: !0
932
- },
933
- defaultCollapsed: {
934
- type: Boolean,
935
- required: !1,
936
- default: !0
937
- },
938
- collapsedRows: Number
939
- },
940
- emits: [
941
- "filter",
942
- "reset",
943
- "custom",
944
- "collapse"
945
- ],
946
- setup(t, { expose: n, emit: r }) {
947
- let { t: i } = e(), a = (e) => {
948
- r("filter", t.model, e);
949
- }, o = (e) => {
950
- r("reset", e), t.filterOnReset && r("filter", t.model, e);
951
- }, s = b(t.defaultCollapsed), c = (e) => {
952
- s.value = e;
953
- };
954
- n({ collapse: c });
955
- let l = y({
956
- span: 6,
957
- suffix: !0
958
- });
959
- return () => {
960
- let { filterOnReset: e, filterText: n, resetText: f, customizable: p, defaultCollapsed: m, collapsible: h, grid: g, collapsedRows: y, ...b } = t;
961
- return d(mt, _({ grid: {
962
- cols: "12 768:18 1280:24 1536:30",
963
- yGap: 20,
964
- xGap: 8,
965
- ...g,
966
- collapsed: s.value,
967
- collapsedRows: y
968
- } }, b, {
969
- showFeedback: !1,
970
- showAction: l,
971
- onSubmit: a,
972
- onReset: o,
973
- style: "position: relative"
974
- }), { action: ({ grid: e }) => (v(() => {
975
- l.suffix = e?.collapsedOverflow || e?.contentEl.children.item(e?.contentEl.children.length - 1).offsetTop > 0;
976
- }), d("div", { style: "display: flex; gap: 12px; align-items: center; justify-content: " + (l.suffix ? "flex-end" : "flex-start") }, [
977
- l.suffix ? void 0 : d("span", null, [u("\xA0\xA0\xA0\xA0")]),
978
- d(N, {
979
- attrType: "submit",
980
- type: "primary",
981
- disabled: t.disabled,
982
- loading: t.loading
983
- }, { default: () => [n || i("common.page.filter.submitText")] }),
984
- d(N, {
985
- attrType: "reset",
986
- disabled: t.disabled || t.loading
987
- }, { default: () => [f || i("common.page.form.resetText")] }),
988
- p ? d(at, {
989
- keyField: "name",
990
- showFixed: !1,
991
- data: b.items,
992
- size: 18,
993
- type: "primary",
994
- onCustom: (e) => r("custom", e)
995
- }, null) : void 0,
996
- h && e?.collapsedOverflow ? d(N, {
997
- text: !0,
998
- type: "primary",
999
- iconPlacement: "right",
1000
- renderIcon: s.value ? Ke : qe,
1001
- onClick: () => c(!s.value)
1002
- }, { default: () => [s.value ? i("common.page.filter.expand") : i("common.page.filter.collapse")] }) : void 0
1003
- ])) });
1004
- };
1005
- }
1006
- });
1007
- function gt(e) {
1008
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !h(e);
1009
- }
1010
- function J(t, n, r = 1) {
1011
- let { t: i } = e(), a = b(!1), o = [], { open: s, reinit: c } = Ne({
1012
- title: t,
1013
- showColon: !0,
1014
- submitText: i("common.confirm.defaultOk"),
1015
- items: ({ it: e }) => o.map((t) => e(t.value, t.label, "input", {
1016
- span: 24,
1017
- required: t.required,
1018
- inputProps: {
1019
- readonly: a,
1020
- clearable: !0,
1021
- type: "textarea",
1022
- showCount: !0,
1023
- autosize: {
1024
- minRows: T(r),
1025
- maxRows: Math.max(T(r), 5)
1026
- }
1027
- }
1028
- })),
1029
- onSubmit: n
1030
- });
1031
- return {
1032
- open: (e, t = !1) => (a.value = t, s(e)),
1033
- setSupports: (e) => {
1034
- o = e, c();
1035
- }
1036
- };
1037
- }
1038
- const _t = /* @__PURE__ */ f({
1039
- name: "DataLocaleInput",
1040
- props: {
1041
- label: { type: [
1042
- String,
1043
- Function,
1044
- Number,
1045
- Boolean,
1046
- Object
1047
- ] },
1048
- mode: {
1049
- type: String,
1050
- default: "dialog"
1051
- },
1052
- defaultExpanded: {
1053
- type: Boolean,
1054
- default: !1
1055
- },
1056
- modelValue: Object,
1057
- supports: {
1058
- type: Array,
1059
- default: () => []
1060
- },
1061
- disabled: {
1062
- type: Boolean,
1063
- default: void 0
1064
- },
1065
- defaultLang: {
1066
- type: String,
1067
- default: "zh-CN"
1068
- },
1069
- showLang: {
1070
- type: String,
1071
- default: void 0
1072
- },
1073
- defaultRows: {
1074
- type: Number,
1075
- default: 1
1076
- }
1077
- },
1078
- emits: ["update:modelValue", "updateModelValue"],
1079
- setup(e, { emit: t }) {
1080
- let n = (n, r = e.showLang ?? e.defaultLang) => {
1081
- n = {
1082
- ...e.modelValue,
1083
- [r]: n
1084
- }, t("update:modelValue", n), t("updateModelValue", n);
1085
- }, { open: r, setSupports: i } = J(l(() => w(e.label)), (e) => {
1086
- t("update:modelValue", e), t("updateModelValue", e);
1087
- }, C(e, "defaultRows")), a = b(e.defaultExpanded);
1088
- D(() => e.defaultExpanded, (e) => {
1089
- a.value = e;
1090
- });
1091
- let o = () => d(N, {
1092
- quaternary: !0,
1093
- onClick: () => {
1094
- a.value = !a.value;
1095
- },
1096
- style: "--n-padding: 0 8px"
1097
- }, { default: () => [d(L, {
1098
- size: "20",
1099
- depth: "3"
1100
- }, { default: () => [a.value ? d(Ze, null, null) : d(Xe, null, null)] })] }), c = (t) => {
1101
- let n = t.split("-")[0];
1102
- return e.supports.some((e) => e.value !== t && e.value.startsWith(n)) ? t : n;
1103
- }, u = `__slots${Te(6)}`;
1104
- D(() => e.supports, (e) => {
1105
- i(e);
1106
- let t = 0;
1107
- for (let [n, r] of e.entries()) {
1108
- let e = c(r.value);
1109
- t = Math.max(t, je(e, "monospace")), r[u] = g({
1110
- prefix: () => d("div", { style: {
1111
- width: `${t + 4}px`,
1112
- height: "100%",
1113
- opacity: .5,
1114
- fontSize: "12px",
1115
- fontFamily: "monospace",
1116
- color: r.required ? "var(--color-danger)" : void 0
1117
- } }, [e]),
1118
- suffix: n === 0 ? o : void 0
1119
- });
1120
- }
1121
- }, { immediate: !0 });
1122
- let f = l(() => {
1123
- let t = c(e.showLang ?? e.defaultLang);
1124
- return [t, je(t, "monospace")];
1125
- }), p = {
1126
- prefix: () => d("div", { style: {
1127
- width: `${f.value[1] + 4}px`,
1128
- height: "100%",
1129
- opacity: .5,
1130
- fontSize: "12px",
1131
- fontFamily: "monospace"
1132
- } }, [f.value[0]]),
1133
- suffix: () => d(N, {
1134
- quaternary: !0,
1135
- onClick: () => r(e.modelValue, e.disabled),
1136
- style: "--n-padding: 0 8px"
1137
- }, { default: () => [d(L, {
1138
- size: "20",
1139
- depth: "3"
1140
- }, { default: () => [d(Ye, null, null)] })] })
1141
- }, m = { "--n-padding-right": "0" };
1142
- return () => {
1143
- let t;
1144
- return e.mode === "dialog" ? d(R, {
1145
- value: e.modelValue?.[e.showLang ?? e.defaultLang] ?? e.modelValue?.[e.defaultLang],
1146
- onUpdateValue: n,
1147
- disabled: e.disabled,
1148
- clearable: !0,
1149
- style: m,
1150
- type: e.defaultRows > 1 ? "textarea" : "text",
1151
- rows: e.defaultRows
1152
- }, gt(p) ? p : { default: () => [p] }) : d(I, {
1153
- vertical: !0,
1154
- wrap: !1,
1155
- style: "width: 100%"
1156
- }, gt(t = e.supports.map((t, r) => {
1157
- if (!a.value && r !== 0) return;
1158
- let i = r == 0;
1159
- return O(d(R, {
1160
- key: t.value,
1161
- value: e.modelValue?.[t.value],
1162
- onUpdateValue: (e) => n(e, t.value),
1163
- disabled: e.disabled,
1164
- clearable: !0,
1165
- style: i ? m : void 0,
1166
- type: e.defaultRows > 1 ? "textarea" : "text",
1167
- rows: e.defaultRows
1168
- }, t[u]), [[
1169
- s,
1170
- t.label,
1171
- void 0,
1172
- { left: !0 }
1173
- ]]);
1174
- })) ? t : { default: () => [t] });
1175
- };
1176
- }
1177
- }), Y = /* @__PURE__ */ f({
1178
- name: "DataPagination",
1179
- props: {
1180
- total: {
1181
- type: Number,
1182
- default: 0
1183
- },
1184
- currentPage: { type: Number },
1185
- pageSize: { type: Number },
1186
- page: { type: Object },
1187
- resetPageOnSizeChange: {
1188
- type: Boolean,
1189
- default: !0
1190
- },
1191
- pageSizes: { type: Array },
1192
- simple: Boolean
1193
- },
1194
- emits: { change: () => !0 },
1195
- setup(t, { emit: n }) {
1196
- let { t: r } = e(), i = (e) => n("change", {
1197
- pageSize: t.pageSize ?? t.page?.pageSize ?? 0,
1198
- currentPage: e
1199
- }), a = (e) => n("change", {
1200
- pageSize: e,
1201
- currentPage: t.resetPageOnSizeChange ? 1 : t.currentPage ?? t.page?.currentPage ?? 1
1202
- }), o = m(Y.DEFAULT_PAGE_SIZES_INJECTION_KEY, () => [
1203
- 10,
1204
- 20,
1205
- 30,
1206
- 50
1207
- ], !0), s = {
1208
- prefix: () => r("common.page.pagination.prefix", { total: t.total }),
1209
- suffix: () => r("common.page.pagination.suffix")
1210
- };
1211
- return () => d(me, {
1212
- page: t.currentPage ?? t.page?.currentPage,
1213
- itemCount: t.total,
1214
- pageSize: t.pageSize ?? t.page?.pageSize,
1215
- onUpdatePage: i,
1216
- onUpdatePageSize: a,
1217
- pageSizes: t.pageSizes || o,
1218
- showQuickJumper: !0,
1219
- showSizePicker: !0,
1220
- simple: t.simple,
1221
- style: "justify-content: flex-end"
1222
- }, t.simple ? void 0 : s);
1223
- }
1224
- });
1225
- Y.DEFAULT_PAGE_SIZES_INJECTION_KEY = Symbol();
1226
- function vt(e) {
1227
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !h(e);
1228
- }
1229
- const yt = /* @__PURE__ */ f({
1230
- name: "DataSelection",
1231
- props: {
1232
- modelValue: {
1233
- type: String,
1234
- required: !0
1235
- },
1236
- count: {
1237
- type: Number,
1238
- default: 0
1239
- }
1240
- },
1241
- emits: {
1242
- "update:modelValue": () => !0,
1243
- clear: () => !0
1244
- },
1245
- setup(t, { emit: n }) {
1246
- let { t: r } = e();
1247
- return () => {
1248
- let e;
1249
- return t.modelValue !== "selection" && t.count === 0 ? d("div", null, null) : d("div", null, [d(I, {
1250
- align: "center",
1251
- "wrap-item": !1
1252
- }, { default: () => [
1253
- d("span", null, [r("common.page.selection.countText", { count: t.count })]),
1254
- d(N, {
1255
- text: !0,
1256
- type: "primary",
1257
- onClick: () => {
1258
- n("update:modelValue", t.modelValue === "all" ? "selection" : "all");
1259
- }
1260
- }, { default: () => [t.modelValue === "all" ? r("common.page.selection.view") : r("common.page.selection.back")] }),
1261
- d(N, {
1262
- text: !0,
1263
- onClick: () => {
1264
- n("clear"), n("update:modelValue", "all");
1265
- }
1266
- }, vt(e = r("common.page.selection.clear")) ? e : { default: () => [e] })
1267
- ] })]);
1268
- };
1269
- }
1270
- });
1271
- function bt(e) {
1272
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !h(e);
1273
- }
1274
- function xt(e, t) {
1275
- return (e ?? []).map((e) => {
1276
- let n = {
1277
- csvTitle: e.exportTitle,
1278
- ...e,
1279
- title: () => {
1280
- let t = w(e.title), n = t && O(d("div", null, [t]), [[
1281
- s,
1282
- () => w(e.title),
1283
- void 0,
1284
- { auto: !0 }
1285
- ]]);
1286
- return e.tooltip ? d(I, {
1287
- size: 3,
1288
- wrap: !1,
1289
- inline: !0,
1290
- style: "max-width: 100%"
1291
- }, { default: () => [n, d(U, null, {
1292
- default: w(e.tooltip),
1293
- trigger: () => d(N, {
1294
- text: !0,
1295
- style: "font-size: 1.25em; opacity: 0.8"
1296
- }, { default: () => [d(L, null, { default: () => [d(ze, null, null)] })] })
1297
- })] }) : n;
1298
- }
1299
- };
1300
- if (e.children?.length) n.children = xt(e.children, t);
1301
- else {
1302
- e.hidden !== !0 && (n.width ??= 100, t.value += Number(n.width));
1303
- let r = e.render ?? ((e) => e);
1304
- e.ellipsis !== !1 && (n.ellipsis = !1, n.render = (...t) => {
1305
- let n = r(...t);
1306
- return n && (h(n) || ((function() {
1307
- return n;
1308
- })(), n = d("span", null, [n])), O(n, [[
1309
- s,
1310
- () => e.ellipsisTooltip ? e.ellipsisTooltip(...t) : n,
1311
- void 0,
1312
- {
1313
- auto: !0,
1314
- expandable: e.ellipsisExpandable,
1315
- [`ell${e.ellipsis}`]: !0
1316
- }
1317
- ]]));
1318
- }, e.ellipsisTooltip === !0 && (n.ellipsisTooltip = r)), Object.assign(n, {
1319
- resizable: e.resizable !== !1,
1320
- sorter: e.sortable,
1321
- type: ["selection", "expand"].includes(e.type) ? e.type : void 0,
1322
- disabled: e.selectable ? (t) => e.selectable(t) === !1 : void 0
1323
- });
1324
- }
1325
- return n.key === "$actions" && (n.cellProps ??= () => ({ style: { padding: "0 2px" } })), n;
1326
- }).filter((e) => e?.hidden !== !0);
1327
- }
1328
- const St = /* @__PURE__ */ f({
1329
- name: "DataTable",
1330
- props: {
1331
- data: {
1332
- type: Array,
1333
- default: () => []
1334
- },
1335
- columns: {
1336
- type: Array,
1337
- default: () => []
1338
- },
1339
- keyField: { type: String },
1340
- sorter: {
1341
- type: Object,
1342
- default: () => ({})
1343
- },
1344
- selectedKeys: { type: Array },
1345
- highlight: {
1346
- type: [
1347
- Boolean,
1348
- String,
1349
- Number,
1350
- Object
1351
- ],
1352
- default: !0
1353
- },
1354
- highlightColor: String,
1355
- appear: {
1356
- type: String,
1357
- default: "normal"
1358
- },
1359
- rowClassName: Se.rowClassName,
1360
- rowProps: Se.rowProps,
1361
- maxHeight: [String, Number]
1362
- },
1363
- emits: [
1364
- "sort",
1365
- "select",
1366
- "custom",
1367
- "highlight"
1368
- ],
1369
- setup(e, { slots: n, emit: r, expose: i }) {
1370
- let { keyField: a } = m(Me), s = o(), c = `${s.value}-datatable`;
1371
- t("-datatable", Ct, s);
1372
- let u = E("table-ref"), f = ({ sortField: e, sortOrder: t } = {}, n) => {
1373
- e == n?.sortField && t == n?.sortOrder || u.value?.sort(e, t ? t + "end" : !1);
1374
- };
1375
- D(() => ({ ...e.sorter }), f, { deep: !0 });
1376
- let p = l(() => {
1377
- let t = e.keyField || a || "key";
1378
- return (e) => e[t];
1379
- }), h = x({
1380
- cache: [],
1381
- scrollToView(...e) {
1382
- this.cache.push(e);
1383
- }
1384
- });
1385
- A(u).changed().then(() => {
1386
- f(e.sorter);
1387
- let t = h.value.cache;
1388
- h.value = u.value, h.value.scrollToView = (t) => {
1389
- let n = e.data.findIndex((e) => p.value(e) === t);
1390
- if (n === -1) return;
1391
- let r = u.value.$el.querySelector(`.${c}__row-marker:nth-child(${n + 1})`);
1392
- u.value.scrollTo({
1393
- top: r.offsetTop,
1394
- behavior: "smooth"
1395
- });
1396
- };
1397
- for (let e of t) h.value.scrollToView(...e);
1398
- }), i(ee(h));
1399
- let g = b(0), _ = x([]);
1400
- D(() => e.columns, () => {
1401
- g.value = 0, _.value = xt(e.columns, g);
1402
- }, {
1403
- immediate: !0,
1404
- deep: 1
1405
- });
1406
- let v = b();
1407
- D(() => e.highlight, (e) => {
1408
- v.value = typeof e == "boolean" ? null : e ?? null;
1409
- }, { immediate: !0 });
1410
- let y = l(() => (t, n) => [
1411
- e.rowClassName?.(t, n) || "",
1412
- `${c}__row-marker`,
1413
- v.value != null && p.value(t) === v.value ? `${c}__row-highlight` : ""
1414
- ].join(" ")), S = l(() => (t, n) => {
1415
- let i = e.rowProps?.(t, n);
1416
- return {
1417
- ...i,
1418
- onClick: (n) => {
1419
- let a = p.value(t);
1420
- e.highlight === !0 && (v.value = a), r("highlight", a), i?.onClick?.(n);
1421
- }
1422
- };
1423
- }), C = (t) => {
1424
- if (e.sorter) {
1425
- let { sortField: n, sortOrder: r } = e.sorter;
1426
- if (t?.columnKey == n && (t?.order ? t.order === r + "end" : !r)) return;
1427
- }
1428
- r("sort", {
1429
- sortField: t?.order ? t?.columnKey : void 0,
1430
- sortOrder: t?.order ? t.order.replace("end", "") : void 0
1431
- });
1432
- }, w = (e) => {
1433
- r("select", e);
1434
- }, T = (e, t, n) => {
1435
- r("custom", {
1436
- key: n.key,
1437
- width: e
1438
- });
1439
- };
1440
- return () => d(ie, {
1441
- class: [c, e.appear === "sticky" ? `${c}--sticky` : ""],
1442
- data: e.data,
1443
- columns: _.value,
1444
- rowKey: p.value,
1445
- tableLayout: "fixed",
1446
- ref: "table-ref",
1447
- scrollX: g.value,
1448
- rowClassName: y.value,
1449
- rowProps: S.value,
1450
- checkedRowKeys: e.selectedKeys,
1451
- style: { "--n-tr-highlight-color": e.highlightColor },
1452
- maxHeight: e.maxHeight ?? (e.appear === "sticky" ? "auto" : void 0),
1453
- onUpdateSorter: C,
1454
- onUpdateCheckedRowKeys: w,
1455
- onUnstableColumnResize: T
1456
- }, bt(n) ? n : { default: () => [n] });
1457
- }
1458
- });
1459
- var Ct = /* @__PURE__ */ r("datatable", [i("row-highlight", [n("& > td", { backgroundColor: "var(--n-tr-highlight-color, var(--n-merged-border-color)) !important" })]), a("sticky", [
1460
- n(".n-data-table-base-table-header", {
1461
- position: "sticky",
1462
- top: "-1px",
1463
- zIndex: 10,
1464
- overflowY: "hidden"
1465
- }),
1466
- n(".n-data-table-base-table-body", { overflow: "initial" }, [n("& > .n-scrollbar-container", {
1467
- overflow: "initial",
1468
- overflowX: "scroll"
1469
- }), n("& > .n-scrollbar-rail--horizontal", {
1470
- position: "sticky",
1471
- bottom: "0"
1472
- })]),
1473
- n(".n-data-table-base-table:has(.n-data-table-empty) .n-data-table-base-table-header", {
1474
- scrollbarWidth: "thin",
1475
- overflowX: "auto"
1476
- }),
1477
- n(".n-data-table-td > *", {
1478
- verticalAlign: "middle",
1479
- contentVisibility: "auto"
1480
- })
1481
- ])]);
1482
- function wt(e, { data: t, onSort: n, ...r }) {
1483
- D([b(t), e], async ([e, t]) => {
1484
- if (e.length === 0) return;
1485
- await v();
1486
- let i = k(t)?.querySelector(".n-data-table-base-table-body .n-data-table-tbody");
1487
- if (!i) return;
1488
- let a = Pe.create(i, {
1489
- animation: 150,
1490
- ...r,
1491
- onSort(e) {
1492
- n({
1493
- from: e.oldIndex,
1494
- to: e.newIndex
1495
- });
1496
- }
1497
- });
1498
- return () => {
1499
- a.destroy();
1500
- };
1501
- }, { immediate: !0 });
1502
- }
1503
- function Tt(e) {
1504
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !h(e);
1505
- }
1506
- const Et = /* @__PURE__ */ f({
1507
- name: "Radios",
1508
- props: {
1509
- options: {
1510
- type: Array,
1511
- default: () => []
1512
- },
1513
- vertical: {
1514
- type: Boolean,
1515
- default: !1
1516
- },
1517
- type: {
1518
- type: String,
1519
- default: "radio"
1520
- },
1521
- default: {
1522
- type: [
1523
- Boolean,
1524
- String,
1525
- Object
1526
- ],
1527
- default: !1
1528
- },
1529
- padding: {
1530
- type: String,
1531
- default: void 0
1532
- },
1533
- labelField: {
1534
- type: String,
1535
- default: "label"
1536
- },
1537
- valueField: {
1538
- type: String,
1539
- default: "value"
1540
- },
1541
- disabledField: {
1542
- type: String,
1543
- default: "disabled"
1544
- },
1545
- modelValue: {
1546
- type: [
1547
- String,
1548
- Number,
1549
- Boolean
1550
- ],
1551
- default: void 0
1552
- }
1553
- },
1554
- emits: {
1555
- "update:modelValue": () => !0,
1556
- updateModelValue: () => !0
1557
- },
1558
- setup(t, { emit: n }) {
1559
- let { t: r } = e(), i = l(() => t.default === !1 ? "" : t.default === !0 ? r("common.all") : typeof t.default == "string" ? t.default : t.default?.[t.labelField] ?? r("common.all")), a = l(() => t.type === "button-primary" ? {
1560
- "--n-button-color-active": "var(--color-primary)",
1561
- "--n-button-text-color-active": "var(--color-base)"
1562
- } : {}), o = (e) => {
1563
- n("update:modelValue", e), n("updateModelValue", e);
1564
- };
1565
- return () => {
1566
- let e = t.type === "button" ? he : B, n = d(c, null, [t.default ? d(e, { value: typeof t.default == "object" ? t.default?.[t.valueField] : null }, { default: () => [i.value] }) : void 0, t.options?.map((n) => {
1567
- let r = typeof n[t.labelField] == "string" ? n[t.labelField] : n[t.labelField]?.();
1568
- return d(e, {
1569
- value: n[t.valueField],
1570
- disabled: n[t.disabledField],
1571
- style: t.padding ? {
1572
- paddingLeft: t.padding,
1573
- paddingRight: t.padding
1574
- } : {}
1575
- }, { default: () => [n.tip ? d(U, null, {
1576
- default: () => n.tip,
1577
- trigger: () => r
1578
- }) : r] });
1579
- })]);
1580
- return d(ge, {
1581
- style: t.vertical ? {
1582
- ...a.value,
1583
- padding: "6px 0 0"
1584
- } : a.value,
1585
- value: t.modelValue,
1586
- onUpdateValue: o
1587
- }, { default: () => [t.type === "radio" ? d(I, {
1588
- size: t.vertical ? void 0 : "small",
1589
- vertical: t.vertical
1590
- }, Tt(n) ? n : { default: () => [n] }) : n] });
1591
- };
1592
- }
1593
- });
1594
- function X(e) {
1595
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !h(e);
1596
- }
1597
- const Dt = /* @__PURE__ */ f({
1598
- name: "UserDept",
1599
- inheritAttrs: !1,
1600
- props: {
1601
- users: {
1602
- type: Array,
1603
- default: () => []
1604
- },
1605
- groups: {
1606
- type: Array,
1607
- default: () => []
1608
- },
1609
- depts: {
1610
- type: Array,
1611
- default: () => []
1612
- },
1613
- modelValue: {
1614
- type: [Array, String],
1615
- default: void 0
1616
- },
1617
- placeholder: {
1618
- type: String,
1619
- default: void 0
1620
- },
1621
- size: {
1622
- type: String,
1623
- default: void 0
1624
- },
1625
- type: {
1626
- type: String,
1627
- default: "user"
1628
- },
1629
- selectType: {
1630
- type: String,
1631
- default: "dropdown"
1632
- },
1633
- max: {
1634
- type: Number,
1635
- default: void 0
1636
- },
1637
- multiple: {
1638
- type: Boolean,
1639
- default: !1
1640
- },
1641
- defaultExpandAll: {
1642
- type: Boolean,
1643
- default: !1
1644
- },
1645
- filterable: {
1646
- type: Boolean,
1647
- default: !1
1648
- },
1649
- disabled: {
1650
- type: Boolean,
1651
- default: void 0
1652
- },
1653
- getUsersByGroup: {
1654
- type: Function,
1655
- default: () => []
1656
- },
1657
- getUsersByDept: {
1658
- type: Function,
1659
- default: () => []
1660
- },
1661
- valueField: { type: String },
1662
- renderUserInfo: Function
1663
- },
1664
- emits: ["update:modelValue", "updateModelValue"],
1665
- setup(t, { emit: n, attrs: r }) {
1666
- let { t: i } = e(), { localeRef: a } = Fe("Popconfirm"), o = l(() => t.valueField || (t.type === "user" ? "username" : "code")), s = l(() => {
1667
- if (t.multiple) return t.modelValue || [];
1668
- let e = t.modelValue?.trim();
1669
- return e ? [e] : [];
1670
- }), u = /* @__PURE__ */ new Map(), f = l(() => (u.clear(), t.users.map((e) => (e = y(e), e.label = e.nickname + e.username, e.value = e[o.value], e.type = "user", u.set(e[o.value], e), e)))), p = x([]);
1671
- D(() => t.depts, (e) => {
1672
- Le(e, (e) => {
1673
- e.label = e.name, e.value = e[o.value], e.type = "dept", e.children?.length || delete e.children;
1674
- }), p.value = Ie(e);
1675
- }, { immediate: !0 });
1676
- let m = l(() => [
1677
- ...t.depts,
1678
- ...t.groups.map((e) => ({
1679
- label: e.name,
1680
- value: e.code,
1681
- type: "group"
1682
- })),
1683
- ...f.value
1684
- ]), h = b([]), g = b(), S = async (e) => {
1685
- let n = await (e.type === "group" ? t.getUsersByGroup(e.value) : t.getUsersByDept(e.value));
1686
- for (let e of f.value) e.disabled = !0;
1687
- g.value = [...e.type === "dept" ? e.children ?? [] : [], ...n.map((e) => {
1688
- let t = u.get(e[o.value]);
1689
- return t && (t.disabled = !1), {
1690
- ...e,
1691
- label: e.nickname + e.username,
1692
- value: e[o.value],
1693
- type: "user"
1694
- };
1695
- })];
1696
- }, C = /* @__PURE__ */ new WeakMap(), w = (e, n, r) => {
1697
- let a;
1698
- if (t.type === "dept") return d(be, {
1699
- data: t.depts,
1700
- keyField: "value",
1701
- labelField: "name",
1702
- defaultExpandAll: t.defaultExpandAll,
1703
- checkable: t.multiple,
1704
- selectable: !t.multiple,
1705
- multiple: !1,
1706
- blockLine: !0,
1707
- checkOnClick: !0,
1708
- pattern: r,
1709
- filter: (e, t) => t.label.includes(e) || t.value.includes(e),
1710
- checkedKeys: t.multiple ? e : void 0,
1711
- selectedKeys: t.multiple ? void 0 : e,
1712
- onUpdateCheckedKeys: (e) => {
1713
- t.max && e?.length > t.max || n(e);
1714
- },
1715
- onUpdateSelectedKeys: (e) => {
1716
- n(e);
1717
- }
1718
- }, null);
1719
- let o = e ? C.get(e) : /* @__PURE__ */ new Set();
1720
- if (e && !o && (o = new Set(e), C.set(e, o)), g.value === !1) return d(ve, { show: !0 }, null);
1721
- let s = g.value || m.value;
1722
- r = r?.trim(), r && (s = s?.filter((e) => e.label.includes(r) || e.value.includes(r)));
1723
- let l = h.value;
1724
- return d(c, null, [d("div", { style: "margin: 12px 16px; display: flex; justify-content: space-between; align-items: center" }, [l.length > 0 ? d(c, null, [d("span", { style: "display: flex; align-items: center" }, [
1725
- l.length >= 2 ? l.at(-2).label : i("common.all"),
1726
- d("span", { style: "padding: 0 4px" }, [d(Ge, null, null)]),
1727
- l.at(-1).label
1728
- ]), d(N, {
1729
- text: !0,
1730
- type: "warning",
1731
- onClick: () => {
1732
- if (l.pop(), g.value = l.length > 0 ? !1 : void 0, l.length > 0) S(l.at(-1));
1733
- else for (let e of f.value) e.disabled = !1;
1734
- }
1735
- }, { default: () => [d(L, null, { default: () => [d(We, null, null)] }), i("common.back")] })]) : d("span", null, [i("common.all")])]), s?.length ? d(fe, {
1736
- showDivider: !1,
1737
- style: "padding: 0 16px"
1738
- }, X(a = s.map((r) => {
1739
- let i, a;
1740
- return d(pe, {
1741
- key: r.type + "_" + r.value,
1742
- style: "padding: 6px 0"
1743
- }, { default: () => [r.type === "user" ? t.multiple ? d(F, {
1744
- checked: o.has(r.value) || !1,
1745
- onUpdateChecked: (i) => {
1746
- if (i && t.max && e.length >= t.max) return;
1747
- let a = [...e || []];
1748
- if (i) a.push(r.value);
1749
- else {
1750
- let e = a.indexOf(r.value);
1751
- a.splice(e, 1);
1752
- }
1753
- n(a);
1754
- },
1755
- style: "margin-left: 3px"
1756
- }, X(i = Q([r], {
1757
- max: 1,
1758
- size: 24,
1759
- placement: "right",
1760
- tooltip: !1,
1761
- username: !0,
1762
- renderInfo: t.renderUserInfo
1763
- })) ? i : { default: () => [i] }) : d(B, {
1764
- checked: o.has(r.value) || !1,
1765
- onUpdateChecked: (e) => {
1766
- n(e ? [r.value] : []);
1767
- },
1768
- style: "margin-left: 3px;"
1769
- }, X(a = Q([r], {
1770
- max: 1,
1771
- size: 24,
1772
- placement: "right",
1773
- tooltip: !1,
1774
- username: !0,
1775
- renderInfo: t.renderUserInfo
1776
- })) ? a : { default: () => [a] }) : d("div", {
1777
- onClick: () => {
1778
- g.value = !1, h.value.push(r), S(r);
1779
- },
1780
- style: "cursor: pointer; display: flex; align-items: center; gap: 8px"
1781
- }, [
1782
- r.type === "dept" ? d(M, {
1783
- size: 24,
1784
- style: "background-color: red"
1785
- }, { default: () => [d(L, null, { default: () => [d($e, null, null)] })] }) : d(M, {
1786
- size: 24,
1787
- style: "background-color: green"
1788
- }, { default: () => [d(L, null, { default: () => [d(et, null, null)] })] }),
1789
- d("span", { style: "flex: 1 1 auto" }, [r.label]),
1790
- d(L, null, { default: () => [d(Ge, null, null)] })
1791
- ])] });
1792
- })) ? a : { default: () => [a] }) : d(se, null, null)]);
1793
- }, T = () => d(se, { description: t.placeholder }, null), E = ({ option: e }) => e.type === "user" ? d("span", null, [e.nickname, d("span", { style: {
1794
- opacity: .4,
1795
- marginLeft: "8px"
1796
- } }, [e.username])]) : d("span", null, [e.label]), O = (e, n, r, i, a) => d(ye, _(e, {
1797
- key: t.type,
1798
- options: n,
1799
- renderSourceList: ({ onCheck: e, pattern: t }) => w(r, e, t),
1800
- renderTargetList: t.placeholder?.trim() && !t.modelValue?.length ? T : void 0,
1801
- renderTargetLabel: E,
1802
- sourceFilterable: t.filterable,
1803
- size: t.size,
1804
- disabled: t.disabled || void 0,
1805
- value: r,
1806
- filter: (e, t) => t.label.includes(e) || t.value.includes(e),
1807
- "onUpdate:value": (e) => {
1808
- i?.(e);
1809
- },
1810
- onUpdateValue: (e) => {
1811
- a?.(e);
1812
- }
1813
- }), null), ee = ({ option: e, handleClose: n }) => d(V, {
1814
- type: t.type === "user" ? "primary" : "info",
1815
- closable: !0,
1816
- onMousedown: (e) => e.preventDefault(),
1817
- onClose: (e) => {
1818
- e.stopPropagation(), n();
1819
- }
1820
- }, { default: () => [e.label] }), k = (e, r = "updateModelValue") => {
1821
- t.multiple ? n(r, e) : n(r, e?.[0]);
1822
- }, A = b(), j = !1, te = we(), ne = () => {
1823
- if (j) return;
1824
- j = !0;
1825
- let e = x([...s.value || []]);
1826
- te.create({
1827
- showIcon: !1,
1828
- title: t.placeholder,
1829
- style: { width: "700px" },
1830
- content: () => d("div", { style: { height: "550px" } }, [O({ style: { height: "100%" } }, t.type === "user" ? f.value : p.value, e.value, (t) => e.value = t)]),
1831
- positiveText: a.value.positiveText,
1832
- negativeText: a.value.negativeText,
1833
- onPositiveClick() {
1834
- k(e.value, "update:modelValue"), k(e.value, "updateModelValue");
1835
- },
1836
- onAfterLeave() {
1837
- v(() => {
1838
- A.value?.blur(), j = !1;
1839
- });
1840
- }
1841
- });
1842
- }, P = { arrow: () => d(L, null, { default: () => [t.type === "user" ? d(et, null, null) : d($e, null, null)] }) };
1843
- return () => {
1844
- let e = t.type === "user" ? f.value : p.value;
1845
- if (t.selectType === "dropdown" && t.type === "dept") return d(xe, {
1846
- options: e,
1847
- keyField: "value",
1848
- defaultExpandAll: t.defaultExpandAll,
1849
- checkable: t.multiple,
1850
- multiple: t.multiple,
1851
- filter: (e, t) => t.label.includes(e) || t.value.includes(e),
1852
- value: t.modelValue,
1853
- onUpdateValue: (e) => {
1854
- t.multiple && t.max && e?.length > t.max || n("updateModelValue", e);
1855
- },
1856
- "onUpdate:value": (e) => {
1857
- t.multiple && t.max && e?.length > t.max || n("update:modelValue", e);
1858
- }
1859
- }, X(P) ? P : { default: () => [P] });
1860
- if (t.selectType === "transfer") return O(r, e, s.value, (e) => k(e, "update:modelValue"), (e) => k(e, "updateModelValue"));
1861
- let i = t.selectType === "dropdown";
1862
- return d(_e, _(r, {
1863
- key: t.type,
1864
- ref: A,
1865
- show: i ? void 0 : !1,
1866
- filterable: i ? t.filterable : !1,
1867
- options: e,
1868
- multiple: t.multiple,
1869
- size: t.size,
1870
- placeholder: t.placeholder,
1871
- disabled: t.disabled || void 0,
1872
- value: t.modelValue,
1873
- renderTag: t.multiple ? ee : void 0,
1874
- onFocus: i ? void 0 : ne,
1875
- onUpdateValue: (e) => {
1876
- n("updateModelValue", e);
1877
- },
1878
- "onUpdate:value": (e) => {
1879
- n("update:modelValue", e);
1880
- }
1881
- }), X(P) ? P : { default: () => [P] });
1882
- };
1883
- }
1884
- });
1885
- function Z(e, t, { placement: n = "left", size: r = 24, tooltip: i = !0, username: a = !1, renderInfo: o }) {
1886
- let s = e.nickname.split(" ").at(-1), c = s;
1887
- if (/^[\u4E00-\u9FA5]+$/.test(s)) {
1888
- let e = s.length;
1889
- c = e === 3 || e === 4 ? s.slice(-2) : e > 4 ? s.slice(0, 1) : s;
1890
- } else s.length > 4 && (c = d(L, null, { default: () => [d(tt, null, null)] }));
1891
- let l = (e) => d(M, {
1892
- color: "var(--color-primary)",
1893
- round: !0,
1894
- size: e
1895
- }, X(c) ? c : { default: () => [c] });
1896
- return d(z, {
1897
- key: e.username,
1898
- raw: !0,
1899
- placement: n,
1900
- disabled: i === !1
1901
- }, {
1902
- default: () => d(P, {
1903
- style: "min-width: 200px",
1904
- size: "small"
1905
- }, { default: () => [d("div", { style: "display: flex; align-items: center; gap: 12px" }, [l(48), d("div", null, [d("div", { style: "font-size: 16px; font-weight: 500;" }, [e.nickname]), d("div", { style: "font-size: 14px; color: #999" }, [e.username])])]), o?.(e)] }),
1906
- trigger: () => {
1907
- let n = l(r);
1908
- return t ? d("div", { style: "max-width: 100%; overflow: hidden; display: inline-flex; align-items: center; gap: 6px" }, [n, d("div", { style: "overflow: hidden; white-space: nowrap; text-overflow: ellipsis" }, [d("span", null, [e.nickname]), a ? d("span", { style: "margin-left: 8px; opacity: 0.4" }, [e.username]) : void 0])]) : n;
1909
- }
1910
- });
1911
- }
1912
- function Q(e, t = {}) {
1913
- let { max: n = 4, size: r = 24 } = t;
1914
- return e.length <= 1 ? e[0] ? Z(e[0], !0, t) : null : d("span", { style: {
1915
- display: "inline-block",
1916
- height: r + "px"
1917
- } }, [d(ne, {
1918
- options: e,
1919
- size: r,
1920
- max: n || 4,
1921
- style: "top: -2px"
1922
- }, {
1923
- avatar: ({ option: e }) => Z(e, !1, t),
1924
- rest: ({ options: e, rest: t }) => d(ae, {
1925
- options: e,
1926
- keyField: "username",
1927
- labelField: "nickname",
1928
- renderOption: ({ option: t }) => Z(t, !1, e)
1929
- }, { default: () => [d(M, null, { default: () => [u("+"), t] })] })
1930
- })]);
1931
- }
1932
- const Ot = /* @__PURE__ */ f({
1933
- name: "DeptRender",
1934
- props: {
1935
- value: [String, Array],
1936
- multiple: Boolean,
1937
- getDeptsByCode: Function
1938
- },
1939
- setup(e) {
1940
- let t = b([]), n = {};
1941
- return D([() => e.modelValue, () => e.multiple], ([r, i]) => {
1942
- t.value = [];
1943
- let a = r ? i ? Array.isArray(r) ? r : r.trim() ? r.trim().split(",") : [] : [r] : [], o = [];
1944
- for (let [e, r] of a.entries()) n[r] || (n[r] = y({
1945
- code: r,
1946
- name: r
1947
- }), o.push(r)), t.value[e] = n[r];
1948
- o.length > 0 && e.getDeptsByCode(o).then((e) => {
1949
- for (let t of e) Object.assign(n[t.code], t);
1950
- });
1951
- }, { immediate: !0 }), () => t.value.map((e) => d(V, { key: e.code }, { default: () => [e.name] }));
1952
- }
1953
- }), kt = /* @__PURE__ */ f({
1954
- name: "UserRender",
1955
- props: {
1956
- value: [String, Array],
1957
- multiple: Boolean,
1958
- max: Number,
1959
- size: Number,
1960
- placement: String,
1961
- getUsersByUsername: Function,
1962
- renderInfo: Function
1963
- },
1964
- setup(e) {
1965
- let t = b([]), n = {};
1966
- return D([() => e.value, () => e.multiple], ([r, i]) => {
1967
- t.value = [];
1968
- let a = r ? i ? Array.isArray(r) ? r : r.trim() ? r.trim().split(",") : [] : [r] : [], o = [];
1969
- for (let [e, r] of a.entries()) n[r] || (n[r] = y({
1970
- username: r,
1971
- nickname: r
1972
- }), o.push(r)), t.value[e] = n[r];
1973
- o.length > 0 && e.getUsersByUsername(o).then((e) => {
1974
- for (let t of e) Object.assign(n[t.username], t);
1975
- });
1976
- }, { immediate: !0 }), () => Q(t.value, e);
1977
- }
1978
- }), $ = {
1979
- disabled: {
1980
- type: Boolean,
1981
- default: void 0
1982
- },
1983
- type: {
1984
- type: String,
1985
- default: void 0
1986
- },
1987
- succeeded: {
1988
- type: [Boolean, Object],
1989
- default: void 0
1990
- },
1991
- successText: {
1992
- type: [
1993
- String,
1994
- Number,
1995
- Object
1996
- ],
1997
- default: void 0
1998
- },
1999
- failureText: {
2000
- type: [
2001
- String,
2002
- Number,
2003
- Object
2004
- ],
2005
- default: void 0
2006
- }
2007
- }, At = /* @__PURE__ */ f({
2008
- name: "StateButton",
2009
- props: $,
2010
- setup(e, { slots: t }) {
2011
- return () => {
2012
- let { type: n, disabled: r, succeeded: i, successText: a, failureText: o } = e;
2013
- return d(N, {
2014
- type: i ? "success" : i === !1 ? "error" : n,
2015
- disabled: typeof i == "boolean" ? !0 : r
2016
- }, {
2017
- default: () => (i ? t.success ? t.success() : a : i === !1 ? t.failure ? t.failure() : o : t.default?.()) ?? t.default(),
2018
- icon: () => i ? t.successIcon ? t.successIcon() : d(L, null, { default: () => [d(Je, null, null)] }) : i === !1 ? t.failureIcon ? t.failureIcon() : d(L, null, { default: () => [d(nt, null, null)] }) : t.icon?.()
2019
- });
2020
- };
2021
- }
2022
- });
2023
- export { q as _, kt as a, rt as b, St as c, Y as d, _t as f, ft as g, mt as h, Dt as i, wt as l, ht as m, $ as n, Q as o, J as p, Ot as r, Et as s, At as t, yt as u, ut as v, Re as x, at as y };