@ithinkdt/ui 4.0.7 → 4.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DataTable-D6hPSWvx.js → DataTable-DEb9CRCZ.js} +6 -5
- package/dist/{assets-_Fpf0gbI.js → assets-bJgPKDh1.js} +3 -1
- package/dist/components.js +180 -168
- package/dist/composables.js +2 -0
- package/dist/{directives-DXNnV4xc.js → directives-pwYPe_53.js} +11 -16
- package/dist/directives.js +1 -1
- package/dist/index.js +143 -130
- package/dist/page.js +184 -183
- package/dist/{use-i18n-Cmb7Xx7d.js → use-i18n-D1TTDOML.js} +3 -1
- package/dist/use-style.js +3 -1
- package/esm/page.d.ts +2 -2
- package/package.json +10 -10
- package/unocss-preset.js +1 -1
package/dist/page.js
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import { n as e } from "./use-i18n-
|
|
1
|
+
import { n as e } from "./use-i18n-D1TTDOML.js";
|
|
2
2
|
import { DataForm as t, DtDeptRender as n, DtUserDept as r, DtUserRender as i, NCheckboxes as a, NRadios as o } from "./components.js";
|
|
3
|
-
import { computed as s, createVNode as c, defineAsyncComponent as l, defineComponent as u, h as d, isVNode as f, mergeProps as p, nextTick as m, ref as h,
|
|
4
|
-
import { until as
|
|
5
|
-
import { NButton as
|
|
6
|
-
import { nanoid as
|
|
7
|
-
import { format as
|
|
8
|
-
import { useFormItem as
|
|
9
|
-
import { useModal as
|
|
10
|
-
import { isNullish as
|
|
11
|
-
import { useDict as
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
import { computed as s, createVNode as c, defineAsyncComponent as l, defineComponent as u, h as d, isVNode as f, mergeProps as p, nextTick as m, ref as h, renderSlot as g, shallowRef as _, toValue as v, unref as y } from "vue";
|
|
4
|
+
import { until as b, useClipboard as x } from "@vueuse/core";
|
|
5
|
+
import { NButton as S, NCheckbox as C, NColorPicker as w, NDrawer as T, NDrawerContent as E, NFlex as D, NIcon as O, NInput as k, NInputNumber as A, NModal as j, NScrollbar as M, NSelect as N, NText as P, NUpload as F, useMessage as I } from "ithinkdt-ui";
|
|
6
|
+
import { nanoid as L } from "nanoid";
|
|
7
|
+
import { format as R } from "date-fns";
|
|
8
|
+
import { useFormItem as z } from "ithinkdt-ui/es/_mixins";
|
|
9
|
+
import { useModal as B } from "@ithinkdt/page";
|
|
10
|
+
import { isNullish as V } from "@ithinkdt/common";
|
|
11
|
+
import { useDict as H, useDictMap as U } from "@ithinkdt/common/dict";
|
|
12
|
+
//#region src/page-util.js
|
|
13
|
+
var W = (e) => Object.fromEntries(Object.entries(e || {}).map(([e, t]) => [e, y(t)]));
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/page-description.jsx
|
|
16
|
+
function G(e) {
|
|
14
17
|
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !f(e);
|
|
15
18
|
}
|
|
16
|
-
function
|
|
19
|
+
function K({ getDeptsByCode: e, getUsersByUsername: t, getFileInfos: r, previewFileUrl: a }) {
|
|
17
20
|
let o = (e) => (t, n, { params: r = {} }) => {
|
|
18
|
-
if (t != null) return
|
|
21
|
+
if (t != null) return R(t, r.formatter ?? e);
|
|
19
22
|
}, s = (e = {}) => c("svg", p({
|
|
20
23
|
xmlns: "http://www.w3.org/2000/svg",
|
|
21
24
|
width: "1em",
|
|
@@ -53,37 +56,37 @@ function G({ getDeptsByCode: e, getUsersByUsername: t, getFileInfos: r, previewF
|
|
|
53
56
|
}, null)]);
|
|
54
57
|
return {
|
|
55
58
|
longtext: () => {
|
|
56
|
-
let e = h(), t = h(), n = h(), { open: r } =
|
|
59
|
+
let e = h(), t = h(), n = h(), { open: r } = B({
|
|
57
60
|
type: "drawer",
|
|
58
61
|
resizable: !0,
|
|
59
62
|
content: () => c("div", null, [c("span", null, [e.value])]),
|
|
60
63
|
width: t,
|
|
61
64
|
footer: () => n.value?.() ?? null,
|
|
62
65
|
maskClosable: !0
|
|
63
|
-
}), { copy: i, copied: a } =
|
|
66
|
+
}), { copy: i, copied: a } = x({ legacy: !0 }), o = (t, n, o) => {
|
|
64
67
|
if (!n) return r(t);
|
|
65
68
|
let s = () => {
|
|
66
69
|
o ? o(e.value) : i(e.value);
|
|
67
70
|
};
|
|
68
|
-
return r(() => c("div", { style: "display: flex; align-items: center; justify-content: space-between; margin-right: 4px;" }, [
|
|
71
|
+
return r(() => c("div", { style: "display: flex; align-items: center; justify-content: space-between; margin-right: 4px;" }, [v(t), a.value ? c(S, {
|
|
69
72
|
quaternary: !0,
|
|
70
73
|
size: "tiny",
|
|
71
74
|
type: "success"
|
|
72
|
-
}, { icon: () => c(
|
|
75
|
+
}, { icon: () => c(O, { size: 18 }, { default: () => [c(d, null, null)] }) }) : c(S, {
|
|
73
76
|
quaternary: !0,
|
|
74
77
|
size: "tiny",
|
|
75
78
|
onClick: s
|
|
76
|
-
}, { icon: () => c(
|
|
79
|
+
}, { icon: () => c(O, { size: 16 }, { default: () => [c(u, null, null)] }) })]));
|
|
77
80
|
};
|
|
78
81
|
return {
|
|
79
|
-
renderer: (r, i, { params: a = {} }, { label: s }) => c("div", { style: "white-space: nowrap; overflow: hidden; display: flex; gap: 8px; align-items: center; justify-content: space-between" }, [c("div", { style: "flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" }, [r]), c(
|
|
82
|
+
renderer: (r, i, { params: a = {} }, { label: s }) => c("div", { style: "white-space: nowrap; overflow: hidden; display: flex; gap: 8px; align-items: center; justify-content: space-between" }, [c("div", { style: "flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" }, [r]), c(S, {
|
|
80
83
|
type: "info",
|
|
81
84
|
text: !0,
|
|
82
85
|
style: "position: sticky; right: 0; z-index: 2",
|
|
83
86
|
onClick: a.showText ? () => a.showText(r) : () => {
|
|
84
87
|
e.value = a.formatText ? a.formatText(r) : r, t.value = a.drawerWidth ?? 600, n.value = () => a.drawerFooter?.(r, i), o(a.title || s, a.copyable !== !1, a.onCopy);
|
|
85
88
|
}
|
|
86
|
-
}, { default: () => [c(
|
|
89
|
+
}, { default: () => [c(O, { size: 18 }, { default: () => [c(l, null, null)] })] })]),
|
|
87
90
|
default: { table: { ellipsis: !1 } }
|
|
88
91
|
};
|
|
89
92
|
},
|
|
@@ -107,8 +110,8 @@ function G({ getDeptsByCode: e, getUsersByUsername: t, getFileInfos: r, previewF
|
|
|
107
110
|
let e, t, n;
|
|
108
111
|
return (r, i, { params: a = {} }) => {
|
|
109
112
|
if (r == null) return;
|
|
110
|
-
let { dictType: o, options: l, multiple: u, statusMap: d } =
|
|
111
|
-
if (l ? t !== l && (t = l, n = new Map(l.map((e) => [e[a.valueField || "value"], e]))) : e !== o && (e = o, !n && e && (n =
|
|
113
|
+
let { dictType: o, options: l, multiple: u, statusMap: d } = W(a);
|
|
114
|
+
if (l ? t !== l && (t = l, n = new Map(l.map((e) => [e[a.valueField || "value"], e]))) : e !== o && (e = o, !n && e && (n = U(e))), !u) {
|
|
112
115
|
if (r = r.toString(), d && r in d) {
|
|
113
116
|
let e = d[r] ?? "default";
|
|
114
117
|
return [
|
|
@@ -148,32 +151,32 @@ function G({ getDeptsByCode: e, getUsersByUsername: t, getFileInfos: r, previewF
|
|
|
148
151
|
}),
|
|
149
152
|
email: () => (e) => c("a", { href: `mailto:${e}` }, [e]),
|
|
150
153
|
url: () => (e) => c("a", { href: e }, [e]),
|
|
151
|
-
color: () => (e) => c(
|
|
154
|
+
color: () => (e) => c(w, {
|
|
152
155
|
value: e,
|
|
153
156
|
disabled: !0,
|
|
154
157
|
size: "small"
|
|
155
158
|
}, null),
|
|
156
159
|
image: () => (e, t, { params: n = {} }) => {
|
|
157
160
|
let r;
|
|
158
|
-
return e ? c(
|
|
161
|
+
return e ? c(D, {
|
|
159
162
|
gap: "8",
|
|
160
163
|
wrap: !0
|
|
161
|
-
},
|
|
164
|
+
}, G(r = (Array.isArray(e) ? e : n?.multiple ? e.split(",") : [e]).map((e) => a(e)).map((e) => c("img", {
|
|
162
165
|
key: e,
|
|
163
166
|
src: e,
|
|
164
167
|
style: "max-height: 32px; max-width: 100px; object-fit: contain"
|
|
165
168
|
}, null))) ? r : { default: () => [r] }) : void 0;
|
|
166
169
|
},
|
|
167
170
|
file: () => {
|
|
168
|
-
let e =
|
|
171
|
+
let e = L();
|
|
169
172
|
return (t, n, { params: i = {} }) => {
|
|
170
173
|
let a;
|
|
171
174
|
return t ? (n.__file_urls ??= {}, n.__file_urls[e] || r(Array.isArray(t) ? t : i?.multiple ? t.split(",") : [t]).then((t) => {
|
|
172
175
|
n.__file_urls[e] = t;
|
|
173
|
-
}), c(
|
|
176
|
+
}), c(D, {
|
|
174
177
|
gap: "8",
|
|
175
178
|
wrap: !0
|
|
176
|
-
},
|
|
179
|
+
}, G(a = (n.__file_urls[e] || []).map((e) => c("a", {
|
|
177
180
|
key: e.id,
|
|
178
181
|
href: e.url,
|
|
179
182
|
target: "_blank",
|
|
@@ -209,10 +212,12 @@ function G({ getDeptsByCode: e, getUsersByUsername: t, getFileInfos: r, previewF
|
|
|
209
212
|
}
|
|
210
213
|
};
|
|
211
214
|
}
|
|
212
|
-
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/page-form.jsx
|
|
217
|
+
function q(e) {
|
|
213
218
|
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !f(e);
|
|
214
219
|
}
|
|
215
|
-
var
|
|
220
|
+
var J = /* @__PURE__ */ l(() => import("ithinkdt-ui/es/date-picker")), Y = /* @__PURE__ */ u({
|
|
216
221
|
name: "SimpleUpload",
|
|
217
222
|
props: {
|
|
218
223
|
type: {
|
|
@@ -252,8 +257,8 @@ var q = l(() => import("ithinkdt-ui/es/date-picker")), J = u({
|
|
|
252
257
|
},
|
|
253
258
|
setup(t, { slots: n, expose: r }) {
|
|
254
259
|
let { t: i } = e();
|
|
255
|
-
|
|
256
|
-
let a =
|
|
260
|
+
Y.t = i;
|
|
261
|
+
let a = z(t), o = I(), l = s(() => t.customRequest || (({ file: e, onProgress: n, onFinish: r, onError: i }) => {
|
|
257
262
|
t.uploadFile(e.file, (e) => n({ percent: e })).then((t) => {
|
|
258
263
|
e.file.fileId = t, r();
|
|
259
264
|
}).catch((e) => {
|
|
@@ -261,7 +266,7 @@ var q = l(() => import("ithinkdt-ui/es/date-picker")), J = u({
|
|
|
261
266
|
});
|
|
262
267
|
})), u = h();
|
|
263
268
|
r({ submit() {
|
|
264
|
-
return
|
|
269
|
+
return b(u).toBeTruthy().then((e) => e.submit());
|
|
265
270
|
} });
|
|
266
271
|
let d = (e) => {
|
|
267
272
|
if (e) for (let n of e) n.size > t.maxSize * 1024 && (n.status = "error");
|
|
@@ -269,7 +274,7 @@ var q = l(() => import("ithinkdt-ui/es/date-picker")), J = u({
|
|
|
269
274
|
};
|
|
270
275
|
return () => {
|
|
271
276
|
let { type: e, onUpdateFileList: r, ...o } = t;
|
|
272
|
-
return c(
|
|
277
|
+
return c(F, p(o, {
|
|
273
278
|
ref: u,
|
|
274
279
|
customRequest: l.value,
|
|
275
280
|
listType: e === "image" ? "image-card" : "text",
|
|
@@ -278,177 +283,175 @@ var q = l(() => import("ithinkdt-ui/es/date-picker")), J = u({
|
|
|
278
283
|
}), {
|
|
279
284
|
default: e === "image" ? void 0 : () => {
|
|
280
285
|
let e;
|
|
281
|
-
return c(
|
|
286
|
+
return c(S, {
|
|
282
287
|
disabled: a.mergedDisabledRef.value,
|
|
283
288
|
size: a.mergedSizeRef.value
|
|
284
|
-
},
|
|
289
|
+
}, q(e = i("common.page.form.selectFileText")) ? e : { default: () => [e] });
|
|
285
290
|
},
|
|
286
291
|
...n
|
|
287
292
|
});
|
|
288
293
|
};
|
|
289
294
|
}
|
|
290
295
|
});
|
|
291
|
-
function
|
|
292
|
-
let
|
|
296
|
+
function X({ getUserGroups: e, getUsersByGroup: t, getDeptsByCode: n, getUsersByDept: s, getUsersByUsername: l, uploadFile: u, getFileInfos: f }) {
|
|
297
|
+
let m = (e) => e, v = (e) => V(e) ? e : String(e), x = (e) => V(e) ? e : Number(e);
|
|
293
298
|
return {
|
|
294
|
-
input: () => ({ slots: e, props: t }, { modelValue: n, "onUpdate:modelValue": r, required: i, readonly: a, ...o }) => a ? c(
|
|
299
|
+
input: () => ({ slots: e, props: t }, { modelValue: n, "onUpdate:modelValue": r, required: i, readonly: a, ...o }) => a ? c(P, {
|
|
295
300
|
depth: 2,
|
|
296
301
|
style: "line-height: 1.25"
|
|
297
|
-
}, { default: () => [n ?? ""] }) : (t =
|
|
298
|
-
clearable: !0,
|
|
299
|
-
...t,
|
|
300
|
-
...o,
|
|
302
|
+
}, { default: () => [n ?? ""] }) : (t = W(t), d(k, p({ clearable: !0 }, t, o, {
|
|
301
303
|
value: n,
|
|
302
304
|
"onUpdate:value": r
|
|
303
|
-
}, e)),
|
|
305
|
+
}), e)),
|
|
304
306
|
number: () => {
|
|
305
307
|
let e, t;
|
|
306
308
|
return ({ slots: n, props: r }, { modelValue: i, "onUpdate:modelValue": a, required: o, readonly: s, ...l }) => {
|
|
307
|
-
if (s) return c(
|
|
309
|
+
if (s) return c(P, {
|
|
308
310
|
depth: 2,
|
|
309
311
|
style: "line-height: 1.25"
|
|
310
312
|
}, { default: () => [i ?? ""] });
|
|
311
|
-
let { valueType: u = "number", ...f } =
|
|
313
|
+
let { valueType: u = "number", ...f } = W(r), m = u === "string" ? x(i) : i;
|
|
312
314
|
return e = a, u === "string" && !t && (t = (t, ...n) => {
|
|
313
|
-
e(
|
|
314
|
-
}), d(
|
|
315
|
-
|
|
316
|
-
...f,
|
|
317
|
-
...l,
|
|
318
|
-
value: p,
|
|
315
|
+
e(v(t), ...n);
|
|
316
|
+
}), d(A, p({ clearable: !0 }, f, l, {
|
|
317
|
+
value: m,
|
|
319
318
|
"onUpdate:value": u === "string" ? t : e
|
|
320
|
-
}, n);
|
|
319
|
+
}), n);
|
|
321
320
|
};
|
|
322
321
|
},
|
|
323
322
|
select: () => {
|
|
324
|
-
let e, t, n, r, i;
|
|
325
|
-
return ({ slots:
|
|
326
|
-
let { dictType:
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
323
|
+
let e, t, n, r, i, a;
|
|
324
|
+
return ({ slots: o, props: s }, { modelValue: l, "onUpdate:modelValue": u, required: f, readonly: g, ..._ }) => {
|
|
325
|
+
let { dictType: b, options: S, valueType: C = "string", ...w } = W(s), T = C === "number" ? v : m, E, D, O;
|
|
326
|
+
S ? typeof S == "function" ? (E = !0, n ??= h(!1), D = (e) => {
|
|
327
|
+
n.value = !0, Promise.resolve(S(e.trim())).then((e) => {
|
|
328
|
+
t = e;
|
|
329
|
+
}).finally(() => {
|
|
330
|
+
n.value = !1;
|
|
331
|
+
});
|
|
332
|
+
}, O = () => {
|
|
333
|
+
D("");
|
|
334
|
+
}, O()) : (n = void 0, t = S) : (n = void 0, e !== b && (e = b, !t && e && (t = H(e))));
|
|
335
|
+
let k = w.multiple ? l?.map(T) : T(l);
|
|
336
|
+
if (g) if (w.multiple) {
|
|
330
337
|
let e;
|
|
331
|
-
return c(
|
|
338
|
+
return c(P, {
|
|
332
339
|
depth: 2,
|
|
333
340
|
style: "line-height: 1.25"
|
|
334
|
-
},
|
|
335
|
-
let r = e ?
|
|
336
|
-
return c("span", { key: e ? e[
|
|
341
|
+
}, q(e = (k?.map((e) => y(t)?.find((t) => t[w.valueField || "value"] === e)) ?? []).map((e, t, n) => {
|
|
342
|
+
let r = e ? w.renderLabel ? w.renderLabel(e) ?? "" : e[w.labelField || "label"] ?? "" : k[t] ?? "";
|
|
343
|
+
return c("span", { key: e ? e[w.valueField || "value"] : k[t] ?? "" }, [r, t < n.length - 1 ? ", " : ""]);
|
|
337
344
|
})) ? e : { default: () => [e] });
|
|
338
345
|
} else {
|
|
339
|
-
let e =
|
|
340
|
-
return c(
|
|
346
|
+
let e = y(t)?.find((e) => e[w.valueField || "value"] === k);
|
|
347
|
+
return c(P, {
|
|
341
348
|
depth: 2,
|
|
342
349
|
style: "line-height: 1.25"
|
|
343
|
-
}, { default: () => [e ?
|
|
350
|
+
}, { default: () => [e ? w.renderLabel ? w.renderLabel(e) ?? "" : e[w.labelField || "label"] ?? "" : k ?? ""] });
|
|
344
351
|
}
|
|
345
|
-
return r =
|
|
346
|
-
|
|
347
|
-
}), d(
|
|
352
|
+
return r = w.multiple, i = u, C === "number" && !a && (a = (e, ...t) => {
|
|
353
|
+
i(r ? e?.map(x) : x(e), ...t);
|
|
354
|
+
}), d(N, p({
|
|
348
355
|
clearable: !0,
|
|
349
|
-
filterable:
|
|
350
|
-
loading: t?.loading,
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
356
|
+
filterable: y(t)?.length > 9,
|
|
357
|
+
loading: n?.value || t?.loading,
|
|
358
|
+
remote: E,
|
|
359
|
+
onSearch: D,
|
|
360
|
+
onClear: O
|
|
361
|
+
}, w, _, {
|
|
362
|
+
options: y(t),
|
|
363
|
+
value: k,
|
|
364
|
+
"onUpdate:value": C === "number" ? a : i
|
|
365
|
+
}), o);
|
|
357
366
|
};
|
|
358
367
|
},
|
|
359
368
|
checkbox: () => ({ slots: e, props: t }, { modelValue: n, "onUpdate:modelValue": r, required: i, readonly: a, ...o }) => {
|
|
360
|
-
if (t =
|
|
361
|
-
let r;
|
|
362
|
-
return
|
|
369
|
+
if (t = W(t), a) {
|
|
370
|
+
let r = n === (t.checkedValue ?? !0) ? g(e, "checked", void 0, () => [c(C, { checked: !0 }, null)]) : g(e, "unchecked", void 0, () => [c(C, { disabled: !0 }, null)]);
|
|
371
|
+
return c(P, {
|
|
363
372
|
depth: 2,
|
|
364
373
|
style: "line-height: 1.25"
|
|
365
|
-
},
|
|
374
|
+
}, q(r) ? r : { default: () => [r] });
|
|
366
375
|
}
|
|
367
|
-
return d(
|
|
368
|
-
...t,
|
|
369
|
-
...o,
|
|
376
|
+
return d(C, p(t, o, {
|
|
370
377
|
checked: n,
|
|
371
378
|
"onUpdate:checked": r
|
|
372
|
-
}, e);
|
|
379
|
+
}), e);
|
|
373
380
|
},
|
|
374
381
|
checkboxes: () => {
|
|
375
382
|
let e, t, n, r;
|
|
376
383
|
return ({ props: i }, { modelValue: o, "onUpdate:modelValue": s, required: l, readonly: u, ...f }) => {
|
|
377
|
-
let { dictType:
|
|
378
|
-
|
|
379
|
-
let
|
|
384
|
+
let { dictType: h, options: g, valueType: _ = "string", ...y } = W(i), b = _ === "number" ? v : m;
|
|
385
|
+
g ? t = g : e !== h && (e = h, !t && e && (t = H(e)));
|
|
386
|
+
let S = o?.map(b) ?? [];
|
|
380
387
|
if (u) {
|
|
381
388
|
let e;
|
|
382
|
-
return c(
|
|
389
|
+
return c(P, {
|
|
383
390
|
depth: 2,
|
|
384
391
|
style: "line-height: 2.4"
|
|
385
|
-
},
|
|
386
|
-
let r = e ? e[y.labelField ?? "label"] ?? "" :
|
|
387
|
-
return c("span", { key: e ? e[y.valueField ?? "value"] :
|
|
392
|
+
}, q(e = (S?.map((e) => t?.find((t) => t[y.valueField || "value"] === e)) ?? []).map((e, t, n) => {
|
|
393
|
+
let r = e ? e[y.labelField ?? "label"] ?? "" : S[t] ?? "";
|
|
394
|
+
return c("span", { key: e ? e[y.valueField ?? "value"] : S[t] ?? "" }, [r, t < n.length - 1 ? ", " : ""]);
|
|
388
395
|
})) ? e : { default: () => [e] });
|
|
389
396
|
}
|
|
390
|
-
return n = s,
|
|
391
|
-
n(e?.map(
|
|
392
|
-
}), d(a, {
|
|
393
|
-
...y,
|
|
394
|
-
...f,
|
|
397
|
+
return n = s, _ === "number" && !r && (r = (e, ...t) => {
|
|
398
|
+
n(e?.map(x), ...t);
|
|
399
|
+
}), d(a, p(y, f, {
|
|
395
400
|
options: t,
|
|
396
|
-
modelValue:
|
|
397
|
-
"onUpdate:modelValue":
|
|
398
|
-
});
|
|
401
|
+
modelValue: S,
|
|
402
|
+
"onUpdate:modelValue": _ === "number" ? r : n
|
|
403
|
+
}));
|
|
399
404
|
};
|
|
400
405
|
},
|
|
401
406
|
radios: () => {
|
|
402
407
|
let e, t, n, r;
|
|
403
408
|
return ({ props: i }, { modelValue: a, "onUpdate:modelValue": s, required: l, readonly: u, ...f }) => {
|
|
404
|
-
let { dictType:
|
|
405
|
-
|
|
406
|
-
let
|
|
409
|
+
let { dictType: h, options: g, valueType: _ = "string", ...y } = W(i), b = _ === "number" ? v : m;
|
|
410
|
+
g ? t = g : e !== h && (e = h, !t && e && (t = H(e)));
|
|
411
|
+
let S = b(a);
|
|
407
412
|
if (u) {
|
|
408
|
-
let e = t?.find((e) => e[y.valueField ?? "value"] ===
|
|
409
|
-
return c(
|
|
413
|
+
let e = t?.find((e) => e[y.valueField ?? "value"] === S);
|
|
414
|
+
return c(P, {
|
|
410
415
|
depth: 2,
|
|
411
416
|
style: "line-height: 1.25"
|
|
412
|
-
}, { default: () => [e ? e[y.labelField ?? "label"] ?? "" :
|
|
417
|
+
}, { default: () => [e ? e[y.labelField ?? "label"] ?? "" : S ?? ""] });
|
|
413
418
|
}
|
|
414
|
-
return n = s,
|
|
415
|
-
n(
|
|
416
|
-
}), d(o, {
|
|
417
|
-
...y,
|
|
418
|
-
...f,
|
|
419
|
+
return n = s, _ === "number" && !r && (r = (e, ...t) => {
|
|
420
|
+
n(x(e), ...t);
|
|
421
|
+
}), d(o, p(y, f, {
|
|
419
422
|
options: t,
|
|
420
|
-
modelValue:
|
|
421
|
-
"onUpdate:modelValue":
|
|
422
|
-
});
|
|
423
|
+
modelValue: S,
|
|
424
|
+
"onUpdate:modelValue": _ === "number" ? r : n
|
|
425
|
+
}));
|
|
423
426
|
};
|
|
424
427
|
},
|
|
425
428
|
datepicker: () => ({ slots: e, props: t }, { modelValue: n, "onUpdate:modelValue": r, required: i, readonly: a, ...o }) => {
|
|
426
|
-
let { type: s = "date", format: l = s.startsWith("datetime") ? "yyyy-MM-dd HH:mm:ss" : "yyyy-MM-dd", ...u } =
|
|
427
|
-
return a ? s.endsWith("range") ? c(
|
|
429
|
+
let { type: s = "date", format: l = s.startsWith("datetime") ? "yyyy-MM-dd HH:mm:ss" : "yyyy-MM-dd", ...u } = W(t);
|
|
430
|
+
return a ? s.endsWith("range") ? c(P, {
|
|
428
431
|
depth: 2,
|
|
429
432
|
style: "line-height: 1.25"
|
|
430
|
-
}, { default: () => [n ? `${n[0] ?
|
|
433
|
+
}, { default: () => [n ? `${n[0] ? R(n[0], l) : ""} ~ ${n[1] ? R(n[1], l) : ""}` : ""] }) : c(P, {
|
|
431
434
|
depth: 2,
|
|
432
435
|
style: "line-height: 1.25"
|
|
433
|
-
}, { default: () => [n ?
|
|
436
|
+
}, { default: () => [n ? R(n, l) : ""] }) : d(J, p({
|
|
434
437
|
actions: null,
|
|
435
438
|
updateValueOnClose: !0,
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
+
closeOnSelect: !0,
|
|
440
|
+
clearable: !0
|
|
441
|
+
}, u, o, {
|
|
439
442
|
type: s,
|
|
440
443
|
format: l,
|
|
441
444
|
value: n,
|
|
442
445
|
"onUpdate:value": r
|
|
443
|
-
}, e);
|
|
446
|
+
}), e);
|
|
444
447
|
},
|
|
445
448
|
file: () => ({ slots: e, props: t }, { modelValue: n, "onUpdate:modelValue": r, required: i, readonly: a, ...o }) => {
|
|
446
|
-
if (t =
|
|
449
|
+
if (t = W(t), a) {
|
|
447
450
|
let e;
|
|
448
|
-
return console.warn("[file] 原则上此组建不应该显示在详情中"), n?.length ? c(
|
|
451
|
+
return console.warn("[file] 原则上此组建不应该显示在详情中"), n?.length ? c(D, {
|
|
449
452
|
gap: "8",
|
|
450
453
|
vertical: !0
|
|
451
|
-
},
|
|
454
|
+
}, q(e = n.map((e) => c("a", {
|
|
452
455
|
key: e.id,
|
|
453
456
|
href: e.url,
|
|
454
457
|
target: "_blank",
|
|
@@ -456,17 +459,15 @@ function Y({ getUserGroups: e, getUsersByGroup: t, getDeptsByCode: n, getUsersBy
|
|
|
456
459
|
style: "max-width: 100px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; display: inline-block"
|
|
457
460
|
}, [e.name]))) ? e : { default: () => [e] }) : void 0;
|
|
458
461
|
}
|
|
459
|
-
return d(
|
|
460
|
-
...t,
|
|
461
|
-
...o,
|
|
462
|
+
return d(Y, p(t, o, {
|
|
462
463
|
defaultUpload: !1,
|
|
463
464
|
uploadFile: u,
|
|
464
465
|
fileList: n,
|
|
465
466
|
onUpdateFileList: r
|
|
466
|
-
}, e);
|
|
467
|
+
}), e);
|
|
467
468
|
},
|
|
468
469
|
upload: () => {
|
|
469
|
-
let e = null, t = new Map(), n = new Map(), r =
|
|
470
|
+
let e = null, t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = _([]), i = 0, a = (e) => {
|
|
470
471
|
let t = ++i;
|
|
471
472
|
r.value = e.map((e) => n.get(e)).filter(Boolean);
|
|
472
473
|
let a = e.filter((e) => !n.has(e));
|
|
@@ -478,15 +479,15 @@ function Y({ getUserGroups: e, getUsersByGroup: t, getDeptsByCode: n, getUsersBy
|
|
|
478
479
|
});
|
|
479
480
|
}, o, s;
|
|
480
481
|
return {
|
|
481
|
-
renderer: ({ slots: i, props: l }, { modelValue: f, "onUpdate:modelValue":
|
|
482
|
-
let
|
|
483
|
-
if (s =
|
|
482
|
+
renderer: ({ slots: i, props: l }, { modelValue: f, "onUpdate:modelValue": m, required: h, readonly: g, ...v }) => {
|
|
483
|
+
let y = W(l);
|
|
484
|
+
if (s = y.maxSize, o = y.ref ??= _(), e !== f && (e = f, a(f?.split(",") ?? [])), g) {
|
|
484
485
|
let e;
|
|
485
|
-
return r.value.length === 0 ? void 0 : c(
|
|
486
|
+
return r.value.length === 0 ? void 0 : c(D, {
|
|
486
487
|
gap: "8",
|
|
487
488
|
vertical: !0,
|
|
488
489
|
style: "padding: 6px 0"
|
|
489
|
-
},
|
|
490
|
+
}, q(e = r.value.map((e) => c("a", {
|
|
490
491
|
key: e.id,
|
|
491
492
|
href: e.url,
|
|
492
493
|
target: "_blank",
|
|
@@ -496,106 +497,105 @@ function Y({ getUserGroups: e, getUsersByGroup: t, getDeptsByCode: n, getUsersBy
|
|
|
496
497
|
style: "max-width: 100%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; display: inline-block"
|
|
497
498
|
}, [e.name]))) ? e : { default: () => [e] });
|
|
498
499
|
}
|
|
499
|
-
return d(
|
|
500
|
-
...v,
|
|
501
|
-
..._,
|
|
500
|
+
return d(Y, p(y, v, {
|
|
502
501
|
uploadFile: u,
|
|
503
502
|
fileList: r.value,
|
|
504
503
|
onUpdateFileList: (e = []) => {
|
|
505
504
|
n.clear();
|
|
506
505
|
for (let r of e) r.file?.fileId && t.set(r.id, r.file.fileId), r.file?.fileId ? n.set(r.file.fileId, r) : n.set(r.id, r);
|
|
507
|
-
r.value = e,
|
|
506
|
+
r.value = e, m(r.value.map((e) => t.get(e.id) || e.id).join(",") || null);
|
|
508
507
|
}
|
|
509
|
-
}, i);
|
|
508
|
+
}), i);
|
|
510
509
|
},
|
|
511
510
|
beforeSubmit: async () => {
|
|
512
|
-
if (await o?.value?.submit(), await
|
|
513
|
-
if (r.value.some((e) => e.status === "error")) return
|
|
511
|
+
if (await o?.value?.submit(), await b(r).toMatch((e) => e.every((e) => !["pending", "uploading"].includes(e.status))), r.value.some((e) => e.size > s * 1024)) return Y.t("common.page.form.validate.fileSizeExceeded", { maxSize: s });
|
|
512
|
+
if (r.value.some((e) => e.status === "error")) return Y.t("common.page.form.validate.fileErrorMessage");
|
|
514
513
|
}
|
|
515
514
|
};
|
|
516
515
|
},
|
|
517
516
|
user: () => {
|
|
518
517
|
let a, o, u;
|
|
519
|
-
return ({ slots: f, props:
|
|
520
|
-
let
|
|
521
|
-
return a || (a =
|
|
518
|
+
return ({ slots: f, props: m }, { modelValue: h, "onUpdate:modelValue": g, required: v, readonly: y, ...b }) => {
|
|
519
|
+
let x = W(m);
|
|
520
|
+
return a || (a = _([]), o = _([]), u = _([]), l().then((e) => {
|
|
522
521
|
a.value = e;
|
|
523
522
|
}), e().then((e) => {
|
|
524
523
|
o.value = e;
|
|
525
524
|
}), n().then((e) => {
|
|
526
525
|
u.value = e;
|
|
527
|
-
})),
|
|
528
|
-
value:
|
|
529
|
-
multiple:
|
|
526
|
+
})), y ? c(i, {
|
|
527
|
+
value: h,
|
|
528
|
+
multiple: x.multiple,
|
|
530
529
|
getUsersByUsername: l,
|
|
531
|
-
renderInfo:
|
|
532
|
-
}, null) : d(r, {
|
|
530
|
+
renderInfo: x.renderInfo
|
|
531
|
+
}, null) : d(r, p({
|
|
533
532
|
type: "user",
|
|
534
533
|
users: a.value,
|
|
535
534
|
depts: u.value,
|
|
536
535
|
groups: o.value,
|
|
537
536
|
getUsersByDept: s,
|
|
538
|
-
getUsersByGroup: t
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
modelValue:
|
|
543
|
-
|
|
544
|
-
}, f);
|
|
537
|
+
getUsersByGroup: t
|
|
538
|
+
}, x, b, {
|
|
539
|
+
renderUserInfo: x.renderInfo,
|
|
540
|
+
modelValue: h,
|
|
541
|
+
"onUpdate:modelValue": g
|
|
542
|
+
}), f);
|
|
545
543
|
};
|
|
546
544
|
}
|
|
547
545
|
};
|
|
548
546
|
}
|
|
549
|
-
|
|
547
|
+
//#endregion
|
|
548
|
+
//#region src/page.jsx
|
|
549
|
+
function Z(e) {
|
|
550
550
|
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !f(e);
|
|
551
551
|
}
|
|
552
|
-
function
|
|
552
|
+
function Q() {
|
|
553
553
|
return () => ({ items: e, model: n, handleSubmit: r, reset: i, validation: a, readonly: o, inModal: s, showFeedback: l, showColon: u, labelWidth: d, labelAlign: f, labelPlacement: p, showRequireMark: m, requireMarkPlacement: h }) => c(t, {
|
|
554
554
|
readonly: o,
|
|
555
555
|
model: n,
|
|
556
556
|
items: e,
|
|
557
557
|
validation: a,
|
|
558
|
-
showColon:
|
|
559
|
-
labelWidth:
|
|
560
|
-
labelAlign:
|
|
561
|
-
labelPlacement:
|
|
562
|
-
showRequireMark:
|
|
563
|
-
requireMarkPlacement:
|
|
564
|
-
showFeedback:
|
|
558
|
+
showColon: y(u) ?? !0,
|
|
559
|
+
labelWidth: y(d),
|
|
560
|
+
labelAlign: y(f),
|
|
561
|
+
labelPlacement: y(p),
|
|
562
|
+
showRequireMark: y(m),
|
|
563
|
+
requireMarkPlacement: y(h),
|
|
564
|
+
showFeedback: y(l) ?? !0,
|
|
565
565
|
showAction: !1,
|
|
566
566
|
onSubmit: r,
|
|
567
567
|
onReset: i,
|
|
568
568
|
style: s ? "padding-right: 2rem; padding-top: 1rem" : void 0
|
|
569
569
|
}, null);
|
|
570
570
|
}
|
|
571
|
-
function
|
|
571
|
+
function $() {
|
|
572
572
|
let e = (e) => typeof e == "number" ? `${e}px` : e, t = {
|
|
573
573
|
maxHeight: "calc(100vh - 130px)",
|
|
574
574
|
display: "flex",
|
|
575
575
|
flexDirection: "column"
|
|
576
576
|
}, n = { content: !0 };
|
|
577
|
-
return () => ({ type: r = "dialog", visible: i, title: a, content: o, footer: s, placement: l, resizable: u, draggable: d, closeOnEsc: f, closable: m, showMask: h, maskClosable: g, width: _, height: v, style: y, onClose: b, onCancel:
|
|
578
|
-
let z = s ? () => s : s === null ? null : () => c(
|
|
577
|
+
return () => ({ type: r = "dialog", visible: i, title: a, content: o, footer: s, placement: l, resizable: u, draggable: d, closeOnEsc: f, closable: m, showMask: h, maskClosable: g, width: _, height: v, style: y, onClose: b, onCancel: x, onConfirm: C, onAfterClose: w, onAfterOpen: O, confirmText: k, confirmDisabled: A, confirmLoading: N, cancelText: P, cancelDisabled: F, cancelLoading: I, nativeScrollbar: L, ...R }) => {
|
|
578
|
+
let z = s ? () => s : s === null ? null : () => c(D, {
|
|
579
579
|
justify: "end",
|
|
580
580
|
gap: "16"
|
|
581
|
-
}, { default: () => [P === null ? void 0 : c(
|
|
582
|
-
onClick:
|
|
581
|
+
}, { default: () => [P === null ? void 0 : c(S, {
|
|
582
|
+
onClick: x,
|
|
583
583
|
disabled: F,
|
|
584
584
|
loading: I,
|
|
585
585
|
style: "min-width: 60px"
|
|
586
|
-
},
|
|
586
|
+
}, Z(P) ? P : { default: () => [P] }), k === null ? void 0 : c(S, {
|
|
587
587
|
type: "primary",
|
|
588
588
|
onClick: C,
|
|
589
|
-
disabled:
|
|
589
|
+
disabled: A,
|
|
590
590
|
loading: N,
|
|
591
591
|
style: "min-width: 60px"
|
|
592
|
-
},
|
|
592
|
+
}, Z(k) ? k : { default: () => [k] })] });
|
|
593
593
|
if (r === "dialog") {
|
|
594
594
|
let { style: r } = p({ style: {
|
|
595
595
|
width: e(_ ?? 520),
|
|
596
596
|
height: e(v)
|
|
597
597
|
} }, { style: y });
|
|
598
|
-
return c(
|
|
598
|
+
return c(j, p({
|
|
599
599
|
show: i,
|
|
600
600
|
preset: "card",
|
|
601
601
|
title: () => a,
|
|
@@ -606,21 +606,21 @@ function Q() {
|
|
|
606
606
|
segmented: n,
|
|
607
607
|
size: "small",
|
|
608
608
|
onAfterEnter: O,
|
|
609
|
-
onAfterLeave:
|
|
609
|
+
onAfterLeave: w,
|
|
610
610
|
onUpdateShow: b,
|
|
611
611
|
draggable: d ?? !0,
|
|
612
612
|
style: r,
|
|
613
613
|
contentStyle: t
|
|
614
614
|
}, R), {
|
|
615
|
-
default: () => c(
|
|
615
|
+
default: () => c(M, {
|
|
616
616
|
abstract: !0,
|
|
617
617
|
style: "display: flex; flex-direction: column"
|
|
618
|
-
},
|
|
618
|
+
}, Z(o) ? o : { default: () => [o] }),
|
|
619
619
|
action: z
|
|
620
620
|
});
|
|
621
621
|
}
|
|
622
622
|
let { bodyContentClass: B, bodyContentStyle: V, ...H } = R;
|
|
623
|
-
return c(
|
|
623
|
+
return c(T, p({
|
|
624
624
|
show: i,
|
|
625
625
|
trapFocus: !1,
|
|
626
626
|
closeOnEsc: f,
|
|
@@ -633,9 +633,9 @@ function Q() {
|
|
|
633
633
|
height: v,
|
|
634
634
|
onUpdateShow: b,
|
|
635
635
|
onAfterEnter: O,
|
|
636
|
-
onAfterLeave:
|
|
636
|
+
onAfterLeave: w,
|
|
637
637
|
style: y
|
|
638
|
-
}, H), { default: () => [c(
|
|
638
|
+
}, H), { default: () => [c(E, {
|
|
639
639
|
closable: m,
|
|
640
640
|
nativeScrollbar: L ?? !1,
|
|
641
641
|
bodyContentClass: B,
|
|
@@ -647,4 +647,5 @@ function Q() {
|
|
|
647
647
|
})] });
|
|
648
648
|
};
|
|
649
649
|
}
|
|
650
|
-
|
|
650
|
+
//#endregion
|
|
651
|
+
export { K as createDescriptionHelper, Q as createFormHelper, $ as createModalHelper, X as createPageFormHelper };
|