@ithinkdt/ui 4.0.11 → 4.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components.js +12 -7
- package/dist/index.js +1 -1
- package/dist/page.js +115 -115
- package/package.json +6 -6
package/dist/components.js
CHANGED
|
@@ -319,10 +319,11 @@ function J(e, t) {
|
|
|
319
319
|
return typeof e == "function" ? e(t) : e;
|
|
320
320
|
}
|
|
321
321
|
function Qe(e, t) {
|
|
322
|
-
|
|
322
|
+
let n = e.children?.filter((e) => e.isGroup);
|
|
323
|
+
return D(le, { href: `#${e.prop}` }, {
|
|
323
324
|
title: () => J(e.label, t),
|
|
324
|
-
default:
|
|
325
|
-
})
|
|
325
|
+
default: n?.length ? () => n.map((e) => Qe(e, t)) : void 0
|
|
326
|
+
});
|
|
326
327
|
}
|
|
327
328
|
function $e(e, t, n) {
|
|
328
329
|
return typeof e == "function" ? e(t, n) : e;
|
|
@@ -375,14 +376,18 @@ var tt = /* @__PURE__ */ k({
|
|
|
375
376
|
affix: !0
|
|
376
377
|
}, e.anchor && typeof e.anchor == "object" ? e.anchor : {}));
|
|
377
378
|
return () => {
|
|
378
|
-
let
|
|
379
|
+
let { cols: t, title: n, data: i, items: a, anchor: c } = e, l = Le(n) ? void 0 : D("div", { class: `${r}__header` }, [typeof n == "string" ? D("span", null, [n]) : n(i ?? void 0)]), u = a.filter((e) => !e.hidden).map((e) => et(e, t, i, r)), d;
|
|
380
|
+
if (c !== !1) {
|
|
381
|
+
let e;
|
|
382
|
+
d = D(ce, s.value, Ze(e = a.filter((e) => e.isGroup).map((e) => A(Qe(e, i), { key: e.prop }))) ? e : { default: () => [e] });
|
|
383
|
+
}
|
|
379
384
|
return D("div", {
|
|
380
385
|
class: r,
|
|
381
386
|
style: o.value
|
|
382
387
|
}, [
|
|
383
|
-
|
|
384
|
-
D("div", { class: `${r}__wrapper` }, [
|
|
385
|
-
|
|
388
|
+
l,
|
|
389
|
+
D("div", { class: `${r}__wrapper` }, [u]),
|
|
390
|
+
d
|
|
386
391
|
]);
|
|
387
392
|
};
|
|
388
393
|
}
|
package/dist/index.js
CHANGED
|
@@ -580,7 +580,7 @@ var Me = /* @__PURE__ */ m({
|
|
|
580
580
|
i = p(de, { to: t.path }, Z(e = t.label()) ? e : { default: () => [e] });
|
|
581
581
|
}
|
|
582
582
|
else i = p("span", null, [t.label()]);
|
|
583
|
-
return i.key = `${t.key}:${r
|
|
583
|
+
return i.key = `${t.key}:${+!!r}`, t.depth === 0 && !r && (i = D(p("div", null, [i]), [[
|
|
584
584
|
s,
|
|
585
585
|
t.label(),
|
|
586
586
|
void 0,
|
package/dist/page.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
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,
|
|
4
|
-
import { until as
|
|
5
|
-
import { NButton as
|
|
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
6
|
import { nanoid as L } from "nanoid";
|
|
7
7
|
import { format as R } from "date-fns";
|
|
8
8
|
import { useFormItem as z } from "ithinkdt-ui/es/_mixins";
|
|
@@ -10,16 +10,16 @@ import { useModal as B } from "@ithinkdt/page";
|
|
|
10
10
|
import { isNullish as V } from "@ithinkdt/common";
|
|
11
11
|
import { useDict as H, useDictMap as U } from "@ithinkdt/common/dict";
|
|
12
12
|
//#region src/page-util.js
|
|
13
|
-
var W = (e) => Object.fromEntries(Object.entries(e || {}).map(([e, t]) => [e,
|
|
13
|
+
var W = (e) => Object.fromEntries(Object.entries(e || {}).map(([e, t]) => [e, y(t)]));
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/page-description.jsx
|
|
16
16
|
function G(e) {
|
|
17
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
17
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !f(e);
|
|
18
18
|
}
|
|
19
19
|
function K({ getDeptsByCode: e, getUsersByUsername: t, getFileInfos: r, previewFileUrl: a }) {
|
|
20
20
|
let o = (e) => (t, n, { params: r = {} }) => {
|
|
21
21
|
if (t != null) return R(t, r.formatter ?? e);
|
|
22
|
-
}, s = (e = {}) => c("svg",
|
|
22
|
+
}, s = (e = {}) => c("svg", p({
|
|
23
23
|
xmlns: "http://www.w3.org/2000/svg",
|
|
24
24
|
width: "1em",
|
|
25
25
|
height: "1em",
|
|
@@ -29,7 +29,7 @@ function K({ getDeptsByCode: e, getUsersByUsername: t, getFileInfos: r, previewF
|
|
|
29
29
|
cy: "16",
|
|
30
30
|
r: "8",
|
|
31
31
|
fill: "currentColor"
|
|
32
|
-
}, null)]), l = (e = {}) => c("svg",
|
|
32
|
+
}, null)]), l = (e = {}) => c("svg", p({
|
|
33
33
|
xmlns: "http://www.w3.org/2000/svg",
|
|
34
34
|
width: "1em",
|
|
35
35
|
height: "1em",
|
|
@@ -37,7 +37,7 @@ function K({ getDeptsByCode: e, getUsersByUsername: t, getFileInfos: r, previewF
|
|
|
37
37
|
}, e), [c("path", {
|
|
38
38
|
fill: "currentColor",
|
|
39
39
|
d: "M12 9a3 3 0 0 1 3 3a3 3 0 0 1-3 3a3 3 0 0 1-3-3a3 3 0 0 1 3-3m0-4.5c5 0 9.27 3.11 11 7.5c-1.73 4.39-6 7.5-11 7.5S2.73 16.39 1 12c1.73-4.39 6-7.5 11-7.5M3.18 12a9.821 9.821 0 0 0 17.64 0a9.821 9.821 0 0 0-17.64 0"
|
|
40
|
-
}, null)]), u = (e) => c("svg",
|
|
40
|
+
}, null)]), u = (e) => c("svg", p({
|
|
41
41
|
xmlns: "http://www.w3.org/2000/svg",
|
|
42
42
|
width: "1em",
|
|
43
43
|
height: "1em",
|
|
@@ -45,7 +45,7 @@ function K({ getDeptsByCode: e, getUsersByUsername: t, getFileInfos: r, previewF
|
|
|
45
45
|
}, e), [c("path", {
|
|
46
46
|
fill: "currentColor",
|
|
47
47
|
d: "M19 21H8V7h11m0-2H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2m-3-4H4a2 2 0 0 0-2 2v14h2V3h12z"
|
|
48
|
-
}, null)]), d = (e) => c("svg",
|
|
48
|
+
}, null)]), d = (e) => c("svg", p({
|
|
49
49
|
xmlns: "http://www.w3.org/2000/svg",
|
|
50
50
|
width: "1em",
|
|
51
51
|
height: "1em",
|
|
@@ -56,30 +56,30 @@ function K({ getDeptsByCode: e, getUsersByUsername: t, getFileInfos: r, previewF
|
|
|
56
56
|
}, null)]);
|
|
57
57
|
return {
|
|
58
58
|
longtext: () => {
|
|
59
|
-
let e =
|
|
59
|
+
let e = h(), t = h(), n = h(), { open: r } = B({
|
|
60
60
|
type: "drawer",
|
|
61
61
|
resizable: !0,
|
|
62
62
|
content: () => c("div", null, [c("span", null, [e.value])]),
|
|
63
63
|
width: t,
|
|
64
64
|
footer: () => n.value?.() ?? null,
|
|
65
65
|
maskClosable: !0
|
|
66
|
-
}), { copy: i, copied: a } =
|
|
66
|
+
}), { copy: i, copied: a } = x({ legacy: !0 }), o = (t, n, o) => {
|
|
67
67
|
if (!n) return r(t);
|
|
68
68
|
let s = () => {
|
|
69
69
|
o ? o(e.value) : i(e.value);
|
|
70
70
|
};
|
|
71
|
-
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, {
|
|
72
72
|
quaternary: !0,
|
|
73
73
|
size: "tiny",
|
|
74
74
|
type: "success"
|
|
75
|
-
}, { icon: () => c(O, { size: 18 }, { default: () => [c(d, null, null)] }) }) : c(
|
|
75
|
+
}, { icon: () => c(O, { size: 18 }, { default: () => [c(d, null, null)] }) }) : c(S, {
|
|
76
76
|
quaternary: !0,
|
|
77
77
|
size: "tiny",
|
|
78
78
|
onClick: s
|
|
79
79
|
}, { icon: () => c(O, { size: 16 }, { default: () => [c(u, null, null)] }) })]));
|
|
80
80
|
};
|
|
81
81
|
return {
|
|
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(
|
|
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, {
|
|
83
83
|
type: "info",
|
|
84
84
|
text: !0,
|
|
85
85
|
style: "position: sticky; right: 0; z-index: 2",
|
|
@@ -151,27 +151,27 @@ function K({ getDeptsByCode: e, getUsersByUsername: t, getFileInfos: r, previewF
|
|
|
151
151
|
}),
|
|
152
152
|
email: () => (e) => c("a", { href: `mailto:${e}` }, [e]),
|
|
153
153
|
url: () => (e) => c("a", { href: e }, [e]),
|
|
154
|
-
color: () => (e) => c(
|
|
154
|
+
color: () => (e) => c(w, {
|
|
155
155
|
value: e,
|
|
156
156
|
disabled: !0,
|
|
157
157
|
size: "small"
|
|
158
158
|
}, null),
|
|
159
159
|
image: () => (e, t, { params: n = {} }) => {
|
|
160
160
|
let r;
|
|
161
|
-
|
|
161
|
+
if (e) return c(D, {
|
|
162
162
|
gap: "8",
|
|
163
163
|
wrap: !0
|
|
164
164
|
}, G(r = (Array.isArray(e) ? e : n?.multiple ? e.split(",") : [e]).map((e) => a(e)).map((e) => c("img", {
|
|
165
165
|
key: e,
|
|
166
166
|
src: e,
|
|
167
167
|
style: "max-height: 32px; max-width: 100px; object-fit: contain"
|
|
168
|
-
}, null))) ? r : { default: () => [r] })
|
|
168
|
+
}, null))) ? r : { default: () => [r] });
|
|
169
169
|
},
|
|
170
170
|
file: () => {
|
|
171
171
|
let e = L();
|
|
172
172
|
return (t, n, { params: i = {} }) => {
|
|
173
173
|
let a;
|
|
174
|
-
|
|
174
|
+
if (t) return n.__file_urls ??= {}, n.__file_urls[e] || r(Array.isArray(t) ? t : i?.multiple ? t.split(",") : [t]).then((t) => {
|
|
175
175
|
n.__file_urls[e] = t;
|
|
176
176
|
}), c(D, {
|
|
177
177
|
gap: "8",
|
|
@@ -182,7 +182,7 @@ function K({ getDeptsByCode: e, getUsersByUsername: t, getFileInfos: r, previewF
|
|
|
182
182
|
target: "_blank",
|
|
183
183
|
rel: "noreferrer",
|
|
184
184
|
style: "max-width: 100px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; display: inline-block"
|
|
185
|
-
}, [e.name]))) ? a : { default: () => [a] })
|
|
185
|
+
}, [e.name]))) ? a : { default: () => [a] });
|
|
186
186
|
};
|
|
187
187
|
},
|
|
188
188
|
dept: () => (t, r, { params: i = {} }) => {
|
|
@@ -215,9 +215,9 @@ function K({ getDeptsByCode: e, getUsersByUsername: t, getFileInfos: r, previewF
|
|
|
215
215
|
//#endregion
|
|
216
216
|
//#region src/page-form.jsx
|
|
217
217
|
function q(e) {
|
|
218
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
218
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !f(e);
|
|
219
219
|
}
|
|
220
|
-
var J = /* @__PURE__ */ l({
|
|
220
|
+
var J = /* @__PURE__ */ l(() => import("ithinkdt-ui/es/date-picker/index.mjs").then((e) => e.NDatePicker)), Y = /* @__PURE__ */ u({
|
|
221
221
|
name: "SimpleUpload",
|
|
222
222
|
props: {
|
|
223
223
|
type: {
|
|
@@ -257,24 +257,24 @@ var J = /* @__PURE__ */ l({
|
|
|
257
257
|
},
|
|
258
258
|
setup(t, { slots: n, expose: r }) {
|
|
259
259
|
let { t: i } = e();
|
|
260
|
-
|
|
260
|
+
Y.t = i;
|
|
261
261
|
let a = z(t), o = I(), l = s(() => t.customRequest || (({ file: e, onProgress: n, onFinish: r, onError: i }) => {
|
|
262
262
|
t.uploadFile(e.file, (e) => n({ percent: e })).then((t) => {
|
|
263
263
|
e.file.fileId = t, r();
|
|
264
264
|
}).catch((e) => {
|
|
265
265
|
o.error(e.message), i(e);
|
|
266
266
|
});
|
|
267
|
-
})), u =
|
|
267
|
+
})), u = h();
|
|
268
268
|
r({ submit() {
|
|
269
|
-
return
|
|
269
|
+
return b(u).toBeTruthy().then((e) => e.submit());
|
|
270
270
|
} });
|
|
271
271
|
let d = (e) => {
|
|
272
272
|
if (e) for (let n of e) n.size > t.maxSize * 1024 && (n.status = "error");
|
|
273
|
-
t.onUpdateFileList?.(e),
|
|
273
|
+
t.onUpdateFileList?.(e), m(() => a.nTriggerFormChange());
|
|
274
274
|
};
|
|
275
275
|
return () => {
|
|
276
276
|
let { type: e, onUpdateFileList: r, ...o } = t;
|
|
277
|
-
return c(F,
|
|
277
|
+
return c(F, p(o, {
|
|
278
278
|
ref: u,
|
|
279
279
|
customRequest: l.value,
|
|
280
280
|
listType: e === "image" ? "image-card" : "text",
|
|
@@ -283,7 +283,7 @@ var J = /* @__PURE__ */ l({
|
|
|
283
283
|
}), {
|
|
284
284
|
default: e === "image" ? void 0 : () => {
|
|
285
285
|
let e;
|
|
286
|
-
return c(
|
|
286
|
+
return c(S, {
|
|
287
287
|
disabled: a.mergedDisabledRef.value,
|
|
288
288
|
size: a.mergedSizeRef.value
|
|
289
289
|
}, q(e = i("common.page.form.selectFileText")) ? e : { default: () => [e] });
|
|
@@ -293,13 +293,13 @@ var J = /* @__PURE__ */ l({
|
|
|
293
293
|
};
|
|
294
294
|
}
|
|
295
295
|
});
|
|
296
|
-
function
|
|
297
|
-
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);
|
|
298
298
|
return {
|
|
299
299
|
input: () => ({ slots: e, props: t }, { modelValue: n, "onUpdate:modelValue": r, required: i, readonly: a, ...o }) => a ? c(P, {
|
|
300
300
|
depth: 2,
|
|
301
301
|
style: "line-height: 1.25"
|
|
302
|
-
}, { default: () => [n ?? ""] }) : (t = W(t),
|
|
302
|
+
}, { default: () => [n ?? ""] }) : (t = W(t), d(k, p({ clearable: !0 }, t, o, {
|
|
303
303
|
value: n,
|
|
304
304
|
"onUpdate:value": r
|
|
305
305
|
}), e)),
|
|
@@ -310,20 +310,20 @@ function Y({ getUserGroups: e, getUsersByGroup: t, getDeptsByCode: n, getUsersBy
|
|
|
310
310
|
depth: 2,
|
|
311
311
|
style: "line-height: 1.25"
|
|
312
312
|
}, { default: () => [i ?? ""] });
|
|
313
|
-
let { valueType:
|
|
314
|
-
return e = a,
|
|
315
|
-
e(
|
|
316
|
-
}),
|
|
313
|
+
let { valueType: u = "number", ...f } = W(r), m = u === "string" ? x(i) : i;
|
|
314
|
+
return e = a, u === "string" && !t && (t = (t, ...n) => {
|
|
315
|
+
e(v(t), ...n);
|
|
316
|
+
}), d(A, p({ clearable: !0 }, f, l, {
|
|
317
317
|
value: m,
|
|
318
|
-
"onUpdate:value":
|
|
318
|
+
"onUpdate:value": u === "string" ? t : e
|
|
319
319
|
}), n);
|
|
320
320
|
};
|
|
321
321
|
},
|
|
322
322
|
select: () => {
|
|
323
323
|
let e, t, n, r, i, a;
|
|
324
|
-
return ({ slots: o, props: s }, { modelValue: l, "onUpdate:modelValue":
|
|
325
|
-
let { dictType:
|
|
326
|
-
S ? typeof S == "function" ? (E = !0, n ??=
|
|
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
327
|
n.value = !0, Promise.resolve(S(e.trim())).then((e) => {
|
|
328
328
|
t = e;
|
|
329
329
|
}).finally(() => {
|
|
@@ -331,35 +331,35 @@ function Y({ getUserGroups: e, getUsersByGroup: t, getDeptsByCode: n, getUsersBy
|
|
|
331
331
|
});
|
|
332
332
|
}, O = () => {
|
|
333
333
|
D("");
|
|
334
|
-
}, O()) : (n = void 0, t = S) : (n = void 0, e !==
|
|
334
|
+
}, O()) : (n = void 0, t = S) : (n = void 0, e !== b && (e = b, !t && e && (t = H(e))));
|
|
335
335
|
let k = w.multiple ? l?.map(T) : T(l);
|
|
336
|
-
if (
|
|
336
|
+
if (g) if (w.multiple) {
|
|
337
337
|
let e;
|
|
338
338
|
return c(P, {
|
|
339
339
|
depth: 2,
|
|
340
340
|
style: "line-height: 1.25"
|
|
341
|
-
}, q(e = (k?.map((e) =>
|
|
341
|
+
}, q(e = (k?.map((e) => y(t)?.find((t) => t[w.valueField || "value"] === e)) ?? []).map((e, t, n) => {
|
|
342
342
|
let r = e ? w.renderLabel ? w.renderLabel(e) ?? "" : e[w.labelField || "label"] ?? "" : k[t] ?? "";
|
|
343
343
|
return c("span", { key: e ? e[w.valueField || "value"] : k[t] ?? "" }, [r, t < n.length - 1 ? ", " : ""]);
|
|
344
344
|
})) ? e : { default: () => [e] });
|
|
345
345
|
} else {
|
|
346
|
-
let e =
|
|
346
|
+
let e = y(t)?.find((e) => e[w.valueField || "value"] === k);
|
|
347
347
|
return c(P, {
|
|
348
348
|
depth: 2,
|
|
349
349
|
style: "line-height: 1.25"
|
|
350
350
|
}, { default: () => [e ? w.renderLabel ? w.renderLabel(e) ?? "" : e[w.labelField || "label"] ?? "" : k ?? ""] });
|
|
351
351
|
}
|
|
352
|
-
return r = w.multiple, i =
|
|
352
|
+
return r = w.multiple, i = u, C === "number" && !a && (a = (e, ...t) => {
|
|
353
353
|
i(r ? e?.map(x) : x(e), ...t);
|
|
354
|
-
}),
|
|
354
|
+
}), d(N, p({
|
|
355
355
|
clearable: !0,
|
|
356
|
-
filterable:
|
|
356
|
+
filterable: y(t)?.length > 9,
|
|
357
357
|
loading: n?.value || t?.loading,
|
|
358
358
|
remote: E,
|
|
359
359
|
onSearch: D,
|
|
360
360
|
onClear: O
|
|
361
|
-
}, w,
|
|
362
|
-
options:
|
|
361
|
+
}, w, _, {
|
|
362
|
+
options: y(t),
|
|
363
363
|
value: k,
|
|
364
364
|
"onUpdate:value": C === "number" ? a : i
|
|
365
365
|
}), o);
|
|
@@ -367,78 +367,78 @@ function Y({ getUserGroups: e, getUsersByGroup: t, getDeptsByCode: n, getUsersBy
|
|
|
367
367
|
},
|
|
368
368
|
checkbox: () => ({ slots: e, props: t }, { modelValue: n, "onUpdate:modelValue": r, required: i, readonly: a, ...o }) => {
|
|
369
369
|
if (t = W(t), a) {
|
|
370
|
-
let r = n === (t.checkedValue ?? !0) ?
|
|
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
371
|
return c(P, {
|
|
372
372
|
depth: 2,
|
|
373
373
|
style: "line-height: 1.25"
|
|
374
374
|
}, q(r) ? r : { default: () => [r] });
|
|
375
375
|
}
|
|
376
|
-
return
|
|
376
|
+
return d(C, p(t, o, {
|
|
377
377
|
checked: n,
|
|
378
378
|
"onUpdate:checked": r
|
|
379
379
|
}), e);
|
|
380
380
|
},
|
|
381
381
|
checkboxes: () => {
|
|
382
382
|
let e, t, n, r;
|
|
383
|
-
return ({ props: i }, { modelValue: o, "onUpdate:modelValue": s, required: l, readonly:
|
|
384
|
-
let { dictType:
|
|
385
|
-
|
|
386
|
-
let S = o?.map(
|
|
387
|
-
if (
|
|
383
|
+
return ({ props: i }, { modelValue: o, "onUpdate:modelValue": s, required: l, readonly: u, ...f }) => {
|
|
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) ?? [];
|
|
387
|
+
if (u) {
|
|
388
388
|
let e;
|
|
389
389
|
return c(P, {
|
|
390
390
|
depth: 2,
|
|
391
391
|
style: "line-height: 2.4"
|
|
392
|
-
}, q(e = (S?.map((e) => t?.find((t) => t[
|
|
393
|
-
let r = e ? e[
|
|
394
|
-
return c("span", { key: e ? e[
|
|
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 ? ", " : ""]);
|
|
395
395
|
})) ? e : { default: () => [e] });
|
|
396
396
|
}
|
|
397
|
-
return n = s,
|
|
397
|
+
return n = s, _ === "number" && !r && (r = (e, ...t) => {
|
|
398
398
|
n(e?.map(x), ...t);
|
|
399
|
-
}),
|
|
399
|
+
}), d(a, p(y, f, {
|
|
400
400
|
options: t,
|
|
401
401
|
modelValue: S,
|
|
402
|
-
"onUpdate:modelValue":
|
|
402
|
+
"onUpdate:modelValue": _ === "number" ? r : n
|
|
403
403
|
}));
|
|
404
404
|
};
|
|
405
405
|
},
|
|
406
406
|
radios: () => {
|
|
407
407
|
let e, t, n, r;
|
|
408
|
-
return ({ props: i }, { modelValue: a, "onUpdate:modelValue": s, required: l, readonly:
|
|
409
|
-
let { dictType:
|
|
410
|
-
|
|
411
|
-
let S =
|
|
412
|
-
if (
|
|
413
|
-
let e = t?.find((e) => e[
|
|
408
|
+
return ({ props: i }, { modelValue: a, "onUpdate:modelValue": s, required: l, readonly: u, ...f }) => {
|
|
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);
|
|
412
|
+
if (u) {
|
|
413
|
+
let e = t?.find((e) => e[y.valueField ?? "value"] === S);
|
|
414
414
|
return c(P, {
|
|
415
415
|
depth: 2,
|
|
416
416
|
style: "line-height: 1.25"
|
|
417
|
-
}, { default: () => [e ? e[
|
|
417
|
+
}, { default: () => [e ? e[y.labelField ?? "label"] ?? "" : S ?? ""] });
|
|
418
418
|
}
|
|
419
|
-
return n = s,
|
|
419
|
+
return n = s, _ === "number" && !r && (r = (e, ...t) => {
|
|
420
420
|
n(x(e), ...t);
|
|
421
|
-
}),
|
|
421
|
+
}), d(o, p(y, f, {
|
|
422
422
|
options: t,
|
|
423
423
|
modelValue: S,
|
|
424
|
-
"onUpdate:modelValue":
|
|
424
|
+
"onUpdate:modelValue": _ === "number" ? r : n
|
|
425
425
|
}));
|
|
426
426
|
};
|
|
427
427
|
},
|
|
428
428
|
datepicker: () => ({ slots: e, props: t }, { modelValue: n, "onUpdate:modelValue": r, required: i, readonly: a, ...o }) => {
|
|
429
|
-
let { type: s = "date", format: l = s.startsWith("datetime") ? "yyyy-MM-dd HH:mm:ss" : "yyyy-MM-dd", ...
|
|
429
|
+
let { type: s = "date", format: l = s.startsWith("datetime") ? "yyyy-MM-dd HH:mm:ss" : "yyyy-MM-dd", ...u } = W(t);
|
|
430
430
|
return a ? s.endsWith("range") ? c(P, {
|
|
431
431
|
depth: 2,
|
|
432
432
|
style: "line-height: 1.25"
|
|
433
433
|
}, { default: () => [n ? `${n[0] ? R(n[0], l) : ""} ~ ${n[1] ? R(n[1], l) : ""}` : ""] }) : c(P, {
|
|
434
434
|
depth: 2,
|
|
435
435
|
style: "line-height: 1.25"
|
|
436
|
-
}, { default: () => [n ? R(n, l) : ""] }) :
|
|
436
|
+
}, { default: () => [n ? R(n, l) : ""] }) : d(J, p({
|
|
437
437
|
actions: null,
|
|
438
438
|
updateValueOnClose: !0,
|
|
439
439
|
closeOnSelect: !0,
|
|
440
440
|
clearable: !0
|
|
441
|
-
},
|
|
441
|
+
}, u, o, {
|
|
442
442
|
type: s,
|
|
443
443
|
format: l,
|
|
444
444
|
value: n,
|
|
@@ -459,19 +459,19 @@ function Y({ getUserGroups: e, getUsersByGroup: t, getDeptsByCode: n, getUsersBy
|
|
|
459
459
|
style: "max-width: 100px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; display: inline-block"
|
|
460
460
|
}, [e.name]))) ? e : { default: () => [e] }) : void 0;
|
|
461
461
|
}
|
|
462
|
-
return
|
|
462
|
+
return d(Y, p(t, o, {
|
|
463
463
|
defaultUpload: !1,
|
|
464
|
-
uploadFile:
|
|
464
|
+
uploadFile: u,
|
|
465
465
|
fileList: n,
|
|
466
466
|
onUpdateFileList: r
|
|
467
467
|
}), e);
|
|
468
468
|
},
|
|
469
469
|
upload: () => {
|
|
470
|
-
let e = null, t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r =
|
|
470
|
+
let e = null, t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = _([]), i = 0, a = (e) => {
|
|
471
471
|
let t = ++i;
|
|
472
472
|
r.value = e.map((e) => n.get(e)).filter(Boolean);
|
|
473
473
|
let a = e.filter((e) => !n.has(e));
|
|
474
|
-
Promise.resolve(a.length > 0 ?
|
|
474
|
+
Promise.resolve(a.length > 0 ? f(a) : []).then((a) => {
|
|
475
475
|
if (t === i) {
|
|
476
476
|
r.value = e.map((e) => n.get(e) || a.find((t) => t.id === e)), n.clear();
|
|
477
477
|
for (let e of r.value) n.set(e.id, e);
|
|
@@ -479,9 +479,9 @@ function Y({ getUserGroups: e, getUsersByGroup: t, getDeptsByCode: n, getUsersBy
|
|
|
479
479
|
});
|
|
480
480
|
}, o, s;
|
|
481
481
|
return {
|
|
482
|
-
renderer: ({ slots: i, props: l }, { modelValue:
|
|
482
|
+
renderer: ({ slots: i, props: l }, { modelValue: f, "onUpdate:modelValue": m, required: h, readonly: g, ...v }) => {
|
|
483
483
|
let y = W(l);
|
|
484
|
-
if (s = y.maxSize, o = y.ref ??=
|
|
484
|
+
if (s = y.maxSize, o = y.ref ??= _(), e !== f && (e = f, a(f?.split(",") ?? [])), g) {
|
|
485
485
|
let e;
|
|
486
486
|
return r.value.length === 0 ? void 0 : c(D, {
|
|
487
487
|
gap: "8",
|
|
@@ -497,8 +497,8 @@ function Y({ getUserGroups: e, getUsersByGroup: t, getDeptsByCode: n, getUsersBy
|
|
|
497
497
|
style: "max-width: 100%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; display: inline-block"
|
|
498
498
|
}, [e.name]))) ? e : { default: () => [e] });
|
|
499
499
|
}
|
|
500
|
-
return
|
|
501
|
-
uploadFile:
|
|
500
|
+
return d(Y, p(y, v, {
|
|
501
|
+
uploadFile: u,
|
|
502
502
|
fileList: r.value,
|
|
503
503
|
onUpdateFileList: (e = []) => {
|
|
504
504
|
n.clear();
|
|
@@ -508,100 +508,100 @@ function Y({ getUserGroups: e, getUsersByGroup: t, getDeptsByCode: n, getUsersBy
|
|
|
508
508
|
}), i);
|
|
509
509
|
},
|
|
510
510
|
beforeSubmit: async () => {
|
|
511
|
-
if (await o?.value?.submit(), await
|
|
512
|
-
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");
|
|
513
513
|
}
|
|
514
514
|
};
|
|
515
515
|
},
|
|
516
516
|
user: () => {
|
|
517
|
-
let a, o,
|
|
518
|
-
return ({ slots:
|
|
517
|
+
let a, o, u;
|
|
518
|
+
return ({ slots: f, props: m }, { modelValue: h, "onUpdate:modelValue": g, required: v, readonly: y, ...b }) => {
|
|
519
519
|
let x = W(m);
|
|
520
|
-
return a || (a =
|
|
520
|
+
return a || (a = _([]), o = _([]), u = _([]), l().then((e) => {
|
|
521
521
|
a.value = e;
|
|
522
522
|
}), e().then((e) => {
|
|
523
523
|
o.value = e;
|
|
524
524
|
}), n().then((e) => {
|
|
525
|
-
|
|
525
|
+
u.value = e;
|
|
526
526
|
})), y ? c(i, {
|
|
527
527
|
value: h,
|
|
528
528
|
multiple: x.multiple,
|
|
529
529
|
getUsersByUsername: l,
|
|
530
530
|
renderInfo: x.renderInfo
|
|
531
|
-
}, null) :
|
|
531
|
+
}, null) : d(r, p({
|
|
532
532
|
type: "user",
|
|
533
533
|
users: a.value,
|
|
534
|
-
depts:
|
|
534
|
+
depts: u.value,
|
|
535
535
|
groups: o.value,
|
|
536
536
|
getUsersByDept: s,
|
|
537
537
|
getUsersByGroup: t
|
|
538
538
|
}, x, b, {
|
|
539
539
|
renderUserInfo: x.renderInfo,
|
|
540
540
|
modelValue: h,
|
|
541
|
-
"onUpdate:modelValue":
|
|
542
|
-
}),
|
|
541
|
+
"onUpdate:modelValue": g
|
|
542
|
+
}), f);
|
|
543
543
|
};
|
|
544
544
|
}
|
|
545
545
|
};
|
|
546
546
|
}
|
|
547
547
|
//#endregion
|
|
548
548
|
//#region src/page.jsx
|
|
549
|
-
function
|
|
550
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
549
|
+
function Z(e) {
|
|
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, cols: u, showColon: d, labelWidth: f, labelAlign: p, labelPlacement: m, showRequireMark: h, requireMarkPlacement: g }) => 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(d) ?? !0,
|
|
559
|
+
labelWidth: y(f),
|
|
560
|
+
labelAlign: y(p),
|
|
561
|
+
labelPlacement: y(m),
|
|
562
|
+
showRequireMark: y(h),
|
|
563
|
+
requireMarkPlacement: y(g),
|
|
564
|
+
showFeedback: y(l) ?? !0,
|
|
565
565
|
showAction: !1,
|
|
566
|
-
grid: { cols:
|
|
566
|
+
grid: { cols: y(u) },
|
|
567
567
|
onSubmit: r,
|
|
568
568
|
onReset: i,
|
|
569
569
|
style: s ? "padding-right: 2rem; padding-top: 1rem" : void 0
|
|
570
570
|
}, null);
|
|
571
571
|
}
|
|
572
|
-
function
|
|
572
|
+
function $() {
|
|
573
573
|
let e = (e) => typeof e == "number" ? `${e}px` : e, t = {
|
|
574
574
|
maxHeight: "calc(100vh - 130px)",
|
|
575
575
|
display: "flex",
|
|
576
576
|
flexDirection: "column"
|
|
577
577
|
}, n = { content: !0 };
|
|
578
|
-
return () => ({ type: r = "dialog", visible: i, title: a, content: o, footer: s, placement: l, resizable: u, draggable: d, closeOnEsc:
|
|
578
|
+
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 }) => {
|
|
579
579
|
let z = s ? () => s : s === null ? null : () => c(D, {
|
|
580
580
|
justify: "end",
|
|
581
581
|
gap: "16"
|
|
582
|
-
}, { default: () => [P === null ? void 0 : c(
|
|
583
|
-
onClick:
|
|
582
|
+
}, { default: () => [P === null ? void 0 : c(S, {
|
|
583
|
+
onClick: x,
|
|
584
584
|
disabled: F,
|
|
585
585
|
loading: I,
|
|
586
586
|
style: "min-width: 60px"
|
|
587
|
-
},
|
|
587
|
+
}, Z(P) ? P : { default: () => [P] }), k === null ? void 0 : c(S, {
|
|
588
588
|
type: "primary",
|
|
589
589
|
onClick: C,
|
|
590
590
|
disabled: A,
|
|
591
591
|
loading: N,
|
|
592
592
|
style: "min-width: 60px"
|
|
593
|
-
},
|
|
593
|
+
}, Z(k) ? k : { default: () => [k] })] });
|
|
594
594
|
if (r === "dialog") {
|
|
595
|
-
let { style: r } =
|
|
595
|
+
let { style: r } = p({ style: {
|
|
596
596
|
width: e(_ ?? 520),
|
|
597
597
|
height: e(v)
|
|
598
598
|
} }, { style: y });
|
|
599
|
-
return c(j,
|
|
599
|
+
return c(j, p({
|
|
600
600
|
show: i,
|
|
601
601
|
preset: "card",
|
|
602
602
|
title: () => a,
|
|
603
603
|
maskClosable: g ?? !1,
|
|
604
|
-
closeOnEsc:
|
|
604
|
+
closeOnEsc: f,
|
|
605
605
|
closable: m,
|
|
606
606
|
onClose: b,
|
|
607
607
|
segmented: n,
|
|
@@ -616,15 +616,15 @@ function Q() {
|
|
|
616
616
|
default: () => c(M, {
|
|
617
617
|
abstract: !0,
|
|
618
618
|
style: "display: flex; flex-direction: column"
|
|
619
|
-
},
|
|
619
|
+
}, Z(o) ? o : { default: () => [o] }),
|
|
620
620
|
action: z
|
|
621
621
|
});
|
|
622
622
|
}
|
|
623
623
|
let { bodyContentClass: B, bodyContentStyle: V, ...H } = R;
|
|
624
|
-
return c(T,
|
|
624
|
+
return c(T, p({
|
|
625
625
|
show: i,
|
|
626
626
|
trapFocus: !1,
|
|
627
|
-
closeOnEsc:
|
|
627
|
+
closeOnEsc: f,
|
|
628
628
|
showMask: h,
|
|
629
629
|
maskClosable: g,
|
|
630
630
|
resizable: u,
|
|
@@ -649,4 +649,4 @@ function Q() {
|
|
|
649
649
|
};
|
|
650
650
|
}
|
|
651
651
|
//#endregion
|
|
652
|
-
export { K as createDescriptionHelper,
|
|
652
|
+
export { K as createDescriptionHelper, Q as createFormHelper, X as createFormItemHelper, $ as createModalHelper };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ithinkdt/ui",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "iThinkDT UI",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@vueuse/core": "^14.2.1",
|
|
66
66
|
"date-fns": "^4.1.0",
|
|
67
|
-
"vueuc": "
|
|
67
|
+
"vueuc": ">=0.4.65",
|
|
68
68
|
"sortablejs": "^1.15.7",
|
|
69
69
|
"@types/sortablejs": "^1.15.9",
|
|
70
70
|
"nanoid": "^5.1.7",
|
|
@@ -89,12 +89,12 @@
|
|
|
89
89
|
"@vitejs/plugin-vue-jsx": "^5.1.5",
|
|
90
90
|
"ithinkdt-ui": "^1.9.1",
|
|
91
91
|
"typescript": "~6.0.2",
|
|
92
|
-
"unocss": "
|
|
93
|
-
"vite": "^8.0.
|
|
94
|
-
"vue": "^3.5.
|
|
92
|
+
"unocss": "^66.6.8",
|
|
93
|
+
"vite": "^8.0.8",
|
|
94
|
+
"vue": "^3.5.32",
|
|
95
95
|
"vue-router": "^5.0.4",
|
|
96
96
|
"@vue/test-utils": "^2.4.6",
|
|
97
|
-
"@ithinkdt/page": "^4.0.
|
|
97
|
+
"@ithinkdt/page": "^4.0.15"
|
|
98
98
|
},
|
|
99
99
|
"scripts": {
|
|
100
100
|
"dev": "vite build --watch",
|