@ithinkdt/ui 4.0.10 → 4.0.11
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-DEb9CRCZ.js → DataTable-C5hx-Wo8.js} +1 -1
- package/dist/components.js +2 -2
- package/dist/{directives-pwYPe_53.js → directives-g3YmS-dM.js} +5 -1
- package/dist/directives.js +1 -1
- package/dist/index.js +1 -1
- package/dist/page.js +112 -111
- package/esm/components.d.ts +1 -0
- package/esm/page.d.ts +3 -5
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import e, { c as t, cB as n, cE as r, cM as i, useClsPrefix as a } from "./use-style.js";
|
|
2
|
-
import { i as o } from "./directives-
|
|
2
|
+
import { i as o } from "./directives-g3YmS-dM.js";
|
|
3
3
|
import { l as s } from "./assets-bJgPKDh1.js";
|
|
4
4
|
import { computed as c, createVNode as l, defineComponent as u, inject as d, isVNode as f, ref as p, shallowRef as m, toValue as h, useTemplateRef as g, watch as _, withDirectives as v } from "vue";
|
|
5
5
|
import { toReactive as y, until as b } from "@vueuse/core";
|
package/dist/components.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as e } from "./use-i18n-D1TTDOML.js";
|
|
2
2
|
import t, { cB as n, cE as r, useClsPrefix as i } from "./use-style.js";
|
|
3
|
-
import { i as a } from "./directives-
|
|
3
|
+
import { i as a } from "./directives-g3YmS-dM.js";
|
|
4
4
|
import { _ as o, a as s, c, d as l, f as u, g as d, h as f, i as p, l as m, m as h, n as g, o as _, p as v, r as y, s as b, t as x, u as S, v as C } from "./assets-bJgPKDh1.js";
|
|
5
5
|
import { Fragment as w, computed as T, createTextVNode as E, createVNode as D, defineAsyncComponent as O, defineComponent as k, h as A, inject as ee, isVNode as j, markRaw as M, mergeProps as N, nextTick as te, reactive as P, ref as F, renderSlot as I, shallowRef as ne, toRaw as re, toRef as ie, toValue as L, unref as ae, watch as R, withDirectives as oe } from "vue";
|
|
6
6
|
import { until as se } from "@vueuse/core";
|
|
@@ -1616,6 +1616,6 @@ var ht = /* @__PURE__ */ k({
|
|
|
1616
1616
|
});
|
|
1617
1617
|
};
|
|
1618
1618
|
}
|
|
1619
|
-
}), yt = O(() => import("./DataTable-
|
|
1619
|
+
}), yt = O(() => import("./DataTable-C5hx-Wo8.js").then((e) => e.DataTable));
|
|
1620
1620
|
//#endregion
|
|
1621
1621
|
export { Je as DataActions, Xe as DataCustom, tt as DataDescriptions, ot as DataFilter, at as DataForm, rt as DataFormActions, lt as DataLocaleInput, X as DataPagination, dt as DataSelection, yt as DataTable, ht as DtDeptRender, mt as DtUserDept, gt as DtUserRender, qe as NCheckboxes, pt as NRadios, vt as NStateButton, _t as StateButtonProps, Y as dataFormActionsProps, $ as renderUsers, ct as useLocaleEdit };
|
|
@@ -12,7 +12,11 @@ var C = [
|
|
|
12
12
|
3,
|
|
13
13
|
5
|
|
14
14
|
], w = /* @__PURE__ */ t([
|
|
15
|
-
|
|
15
|
+
...[
|
|
16
|
+
"span",
|
|
17
|
+
"a",
|
|
18
|
+
"img"
|
|
19
|
+
].map((e) => t(({ props: t }) => `:where(${e}${t.bPrefix}tooltip-host)`, { display: "inline-block" })),
|
|
16
20
|
t(({ props: e }) => `:where(${e.bPrefix}tooltip-host)`, {
|
|
17
21
|
maxWidth: "100%",
|
|
18
22
|
whiteSpace: "nowrap",
|
package/dist/directives.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as e, n as t, r as n, t as r } from "./directives-
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "./directives-g3YmS-dM.js";
|
|
2
2
|
export { r as SpinDirectiveProvider, n as TooltipDirectiveProvider, t as vSpin, e as vTooltip };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as e, t } from "./use-i18n-D1TTDOML.js";
|
|
2
2
|
import n, { c as r, cB as i, cE as a, cM as o } from "./use-style.js";
|
|
3
|
-
import { i as s, n as c, r as l, t as u } from "./directives-
|
|
3
|
+
import { i as s, n as c, r as l, t as u } from "./directives-g3YmS-dM.js";
|
|
4
4
|
import { Fragment as d, computed as f, createVNode as p, defineComponent as m, inject as h, isVNode as g, mergeProps as _, provide as v, reactive as y, ref as b, renderSlot as x, shallowRef as ee, toRef as S, toValue as C, unref as w, useTemplateRef as T, watch as E, withDirectives as D } from "vue";
|
|
5
5
|
import { computedAsync as te, promiseTimeout as O, useElementHover as k, useElementSize as ne, useEventListener as re, useFullscreen as ie, watchDebounced as ae } from "@vueuse/core";
|
|
6
6
|
import { NAvatar as A, NBadge as oe, NBreadcrumb as se, NBreadcrumbItem as ce, NButton as j, NDrawer as le, NDrawerContent as M, NDropdown as N, NEmpty as P, NIcon as F, NList as I, NListItem as L, NMenu as R, NPagination as z, NPopover as B, NScrollbar as V, NText as H, NThing as U, useThemeVars as W } from "ithinkdt-ui";
|
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, defineComponent as l, h as u, isVNode as d, mergeProps as f, nextTick as p, ref as m, renderSlot as h, shallowRef as g, toValue as _, unref as v } from "vue";
|
|
4
|
+
import { until as y, useClipboard as b } from "@vueuse/core";
|
|
5
|
+
import { NButton as x, NCheckbox as S, NColorPicker as C, NDatePicker 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, v(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]" && !d(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", f({
|
|
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", f({
|
|
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", f({
|
|
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", f({
|
|
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 = m(), t = m(), n = m(), { 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 } = b({ 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;" }, [_(t), a.value ? c(x, {
|
|
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(x, {
|
|
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(x, {
|
|
83
83
|
type: "info",
|
|
84
84
|
text: !0,
|
|
85
85
|
style: "position: sticky; right: 0; z-index: 2",
|
|
@@ -151,7 +151,7 @@ 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(C, {
|
|
155
155
|
value: e,
|
|
156
156
|
disabled: !0,
|
|
157
157
|
size: "small"
|
|
@@ -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]" && !d(e);
|
|
219
219
|
}
|
|
220
|
-
var J = /* @__PURE__ */ l(
|
|
220
|
+
var J = /* @__PURE__ */ l({
|
|
221
221
|
name: "SimpleUpload",
|
|
222
222
|
props: {
|
|
223
223
|
type: {
|
|
@@ -257,24 +257,24 @@ var J = /* @__PURE__ */ l(() => import("ithinkdt-ui/es/date-picker")), Y = /* @_
|
|
|
257
257
|
},
|
|
258
258
|
setup(t, { slots: n, expose: r }) {
|
|
259
259
|
let { t: i } = e();
|
|
260
|
-
|
|
260
|
+
J.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 = m();
|
|
268
268
|
r({ submit() {
|
|
269
|
-
return
|
|
269
|
+
return y(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), p(() => a.nTriggerFormChange());
|
|
274
274
|
};
|
|
275
275
|
return () => {
|
|
276
276
|
let { type: e, onUpdateFileList: r, ...o } = t;
|
|
277
|
-
return c(F,
|
|
277
|
+
return c(F, f(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(() => import("ithinkdt-ui/es/date-picker")), Y = /* @_
|
|
|
283
283
|
}), {
|
|
284
284
|
default: e === "image" ? void 0 : () => {
|
|
285
285
|
let e;
|
|
286
|
-
return c(
|
|
286
|
+
return c(x, {
|
|
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(() => import("ithinkdt-ui/es/date-picker")), Y = /* @_
|
|
|
293
293
|
};
|
|
294
294
|
}
|
|
295
295
|
});
|
|
296
|
-
function
|
|
297
|
-
let
|
|
296
|
+
function Y({ getUserGroups: e, getUsersByGroup: t, getDeptsByCode: n, getUsersByDept: s, getUsersByUsername: l, uploadFile: d, getFileInfos: p }) {
|
|
297
|
+
let _ = (e) => e, b = (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), u(k, f({ clearable: !0 }, t, o, {
|
|
303
303
|
value: n,
|
|
304
304
|
"onUpdate:value": r
|
|
305
305
|
}), e)),
|
|
@@ -310,20 +310,20 @@ function X({ 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: d = "number", ...p } = W(r), m = d === "string" ? x(i) : i;
|
|
314
|
+
return e = a, d === "string" && !t && (t = (t, ...n) => {
|
|
315
|
+
e(b(t), ...n);
|
|
316
|
+
}), u(A, f({ clearable: !0 }, p, l, {
|
|
317
317
|
value: m,
|
|
318
|
-
"onUpdate:value":
|
|
318
|
+
"onUpdate:value": d === "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": d, required: p, readonly: h, ...g }) => {
|
|
325
|
+
let { dictType: y, options: S, valueType: C = "string", ...w } = W(s), T = C === "number" ? b : _, E, D, O;
|
|
326
|
+
S ? typeof S == "function" ? (E = !0, n ??= m(!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 X({ 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 !== y && (e = y, !t && e && (t = H(e))));
|
|
335
335
|
let k = w.multiple ? l?.map(T) : T(l);
|
|
336
|
-
if (
|
|
336
|
+
if (h) 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) => v(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 = v(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 = d, C === "number" && !a && (a = (e, ...t) => {
|
|
353
353
|
i(r ? e?.map(x) : x(e), ...t);
|
|
354
|
-
}),
|
|
354
|
+
}), u(N, f({
|
|
355
355
|
clearable: !0,
|
|
356
|
-
filterable:
|
|
356
|
+
filterable: v(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, g, {
|
|
362
|
+
options: v(t),
|
|
363
363
|
value: k,
|
|
364
364
|
"onUpdate:value": C === "number" ? a : i
|
|
365
365
|
}), o);
|
|
@@ -367,78 +367,78 @@ function X({ 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) ? h(e, "checked", void 0, () => [c(S, { checked: !0 }, null)]) : h(e, "unchecked", void 0, () => [c(S, { 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 u(S, f(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: d, ...p }) => {
|
|
384
|
+
let { dictType: m, options: h, valueType: g = "string", ...v } = W(i), y = g === "number" ? b : _;
|
|
385
|
+
h ? t = h : e !== m && (e = m, !t && e && (t = H(e)));
|
|
386
|
+
let S = o?.map(y) ?? [];
|
|
387
|
+
if (d) {
|
|
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[v.valueField || "value"] === e)) ?? []).map((e, t, n) => {
|
|
393
|
+
let r = e ? e[v.labelField ?? "label"] ?? "" : S[t] ?? "";
|
|
394
|
+
return c("span", { key: e ? e[v.valueField ?? "value"] : S[t] ?? "" }, [r, t < n.length - 1 ? ", " : ""]);
|
|
395
395
|
})) ? e : { default: () => [e] });
|
|
396
396
|
}
|
|
397
|
-
return n = s,
|
|
397
|
+
return n = s, g === "number" && !r && (r = (e, ...t) => {
|
|
398
398
|
n(e?.map(x), ...t);
|
|
399
|
-
}),
|
|
399
|
+
}), u(a, f(v, p, {
|
|
400
400
|
options: t,
|
|
401
401
|
modelValue: S,
|
|
402
|
-
"onUpdate:modelValue":
|
|
402
|
+
"onUpdate:modelValue": g === "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: d, ...p }) => {
|
|
409
|
+
let { dictType: m, options: h, valueType: g = "string", ...v } = W(i), y = g === "number" ? b : _;
|
|
410
|
+
h ? t = h : e !== m && (e = m, !t && e && (t = H(e)));
|
|
411
|
+
let S = y(a);
|
|
412
|
+
if (d) {
|
|
413
|
+
let e = t?.find((e) => e[v.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[v.labelField ?? "label"] ?? "" : S ?? ""] });
|
|
418
418
|
}
|
|
419
|
-
return n = s,
|
|
419
|
+
return n = s, g === "number" && !r && (r = (e, ...t) => {
|
|
420
420
|
n(x(e), ...t);
|
|
421
|
-
}),
|
|
421
|
+
}), u(o, f(v, p, {
|
|
422
422
|
options: t,
|
|
423
423
|
modelValue: S,
|
|
424
|
-
"onUpdate:modelValue":
|
|
424
|
+
"onUpdate:modelValue": g === "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", ...d } = 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) : ""] }) : u(w, f({
|
|
437
437
|
actions: null,
|
|
438
438
|
updateValueOnClose: !0,
|
|
439
439
|
closeOnSelect: !0,
|
|
440
440
|
clearable: !0
|
|
441
|
-
},
|
|
441
|
+
}, d, o, {
|
|
442
442
|
type: s,
|
|
443
443
|
format: l,
|
|
444
444
|
value: n,
|
|
@@ -459,19 +459,19 @@ function X({ 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 u(J, f(t, o, {
|
|
463
463
|
defaultUpload: !1,
|
|
464
|
-
uploadFile:
|
|
464
|
+
uploadFile: d,
|
|
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 = g([]), 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 ? p(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 X({ 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: p, "onUpdate:modelValue": m, required: h, readonly: _, ...v }) => {
|
|
483
483
|
let y = W(l);
|
|
484
|
-
if (s = y.maxSize, o = y.ref ??=
|
|
484
|
+
if (s = y.maxSize, o = y.ref ??= g(), e !== p && (e = p, a(p?.split(",") ?? [])), _) {
|
|
485
485
|
let e;
|
|
486
486
|
return r.value.length === 0 ? void 0 : c(D, {
|
|
487
487
|
gap: "8",
|
|
@@ -497,8 +497,8 @@ function X({ 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 u(J, f(y, v, {
|
|
501
|
+
uploadFile: d,
|
|
502
502
|
fileList: r.value,
|
|
503
503
|
onUpdateFileList: (e = []) => {
|
|
504
504
|
n.clear();
|
|
@@ -508,99 +508,100 @@ function X({ 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 y(r).toMatch((e) => e.every((e) => !["pending", "uploading"].includes(e.status))), r.value.some((e) => e.size > s * 1024)) return J.t("common.page.form.validate.fileSizeExceeded", { maxSize: s });
|
|
512
|
+
if (r.value.some((e) => e.status === "error")) return J.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, d;
|
|
518
|
+
return ({ slots: p, props: m }, { modelValue: h, "onUpdate:modelValue": _, required: v, readonly: y, ...b }) => {
|
|
519
519
|
let x = W(m);
|
|
520
|
-
return a || (a =
|
|
520
|
+
return a || (a = g([]), o = g([]), d = g([]), 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
|
+
d.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) : u(r, f({
|
|
532
532
|
type: "user",
|
|
533
533
|
users: a.value,
|
|
534
|
-
depts:
|
|
534
|
+
depts: d.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": _
|
|
542
|
+
}), p);
|
|
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 X(e) {
|
|
550
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !d(e);
|
|
551
551
|
}
|
|
552
|
-
function
|
|
553
|
-
return () => ({ items: e, model: n, handleSubmit: r, reset: i, validation: a, readonly: o, inModal: s, showFeedback: l,
|
|
552
|
+
function Z() {
|
|
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: v(d) ?? !0,
|
|
559
|
+
labelWidth: v(f),
|
|
560
|
+
labelAlign: v(p),
|
|
561
|
+
labelPlacement: v(m),
|
|
562
|
+
showRequireMark: v(h),
|
|
563
|
+
requireMarkPlacement: v(g),
|
|
564
|
+
showFeedback: v(l) ?? !0,
|
|
565
565
|
showAction: !1,
|
|
566
|
+
grid: { cols: v(u) },
|
|
566
567
|
onSubmit: r,
|
|
567
568
|
onReset: i,
|
|
568
569
|
style: s ? "padding-right: 2rem; padding-top: 1rem" : void 0
|
|
569
570
|
}, null);
|
|
570
571
|
}
|
|
571
|
-
function
|
|
572
|
+
function Q() {
|
|
572
573
|
let e = (e) => typeof e == "number" ? `${e}px` : e, t = {
|
|
573
574
|
maxHeight: "calc(100vh - 130px)",
|
|
574
575
|
display: "flex",
|
|
575
576
|
flexDirection: "column"
|
|
576
577
|
}, n = { content: !0 };
|
|
577
|
-
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: p, closable: m, showMask: h, maskClosable: g, width: _, height: v, style: y, onClose: b, onCancel: S, onConfirm: C, onAfterClose: w, onAfterOpen: O, confirmText: k, confirmDisabled: A, confirmLoading: N, cancelText: P, cancelDisabled: F, cancelLoading: I, nativeScrollbar: L, ...R }) => {
|
|
578
579
|
let z = s ? () => s : s === null ? null : () => c(D, {
|
|
579
580
|
justify: "end",
|
|
580
581
|
gap: "16"
|
|
581
|
-
}, { default: () => [P === null ? void 0 : c(
|
|
582
|
-
onClick:
|
|
582
|
+
}, { default: () => [P === null ? void 0 : c(x, {
|
|
583
|
+
onClick: S,
|
|
583
584
|
disabled: F,
|
|
584
585
|
loading: I,
|
|
585
586
|
style: "min-width: 60px"
|
|
586
|
-
},
|
|
587
|
+
}, X(P) ? P : { default: () => [P] }), k === null ? void 0 : c(x, {
|
|
587
588
|
type: "primary",
|
|
588
589
|
onClick: C,
|
|
589
590
|
disabled: A,
|
|
590
591
|
loading: N,
|
|
591
592
|
style: "min-width: 60px"
|
|
592
|
-
},
|
|
593
|
+
}, X(k) ? k : { default: () => [k] })] });
|
|
593
594
|
if (r === "dialog") {
|
|
594
|
-
let { style: r } =
|
|
595
|
+
let { style: r } = f({ style: {
|
|
595
596
|
width: e(_ ?? 520),
|
|
596
597
|
height: e(v)
|
|
597
598
|
} }, { style: y });
|
|
598
|
-
return c(j,
|
|
599
|
+
return c(j, f({
|
|
599
600
|
show: i,
|
|
600
601
|
preset: "card",
|
|
601
602
|
title: () => a,
|
|
602
603
|
maskClosable: g ?? !1,
|
|
603
|
-
closeOnEsc:
|
|
604
|
+
closeOnEsc: p,
|
|
604
605
|
closable: m,
|
|
605
606
|
onClose: b,
|
|
606
607
|
segmented: n,
|
|
@@ -615,15 +616,15 @@ function $() {
|
|
|
615
616
|
default: () => c(M, {
|
|
616
617
|
abstract: !0,
|
|
617
618
|
style: "display: flex; flex-direction: column"
|
|
618
|
-
},
|
|
619
|
+
}, X(o) ? o : { default: () => [o] }),
|
|
619
620
|
action: z
|
|
620
621
|
});
|
|
621
622
|
}
|
|
622
623
|
let { bodyContentClass: B, bodyContentStyle: V, ...H } = R;
|
|
623
|
-
return c(T,
|
|
624
|
+
return c(T, f({
|
|
624
625
|
show: i,
|
|
625
626
|
trapFocus: !1,
|
|
626
|
-
closeOnEsc:
|
|
627
|
+
closeOnEsc: p,
|
|
627
628
|
showMask: h,
|
|
628
629
|
maskClosable: g,
|
|
629
630
|
resizable: u,
|
|
@@ -648,4 +649,4 @@ function $() {
|
|
|
648
649
|
};
|
|
649
650
|
}
|
|
650
651
|
//#endregion
|
|
651
|
-
export { K as createDescriptionHelper,
|
|
652
|
+
export { K as createDescriptionHelper, Z as createFormHelper, Y as createFormItemHelper, Q as createModalHelper };
|
package/esm/components.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ declare module '@ithinkdt/page' {
|
|
|
21
21
|
showRequireMark?: MaybeRef<boolean | undefined>
|
|
22
22
|
requireMarkPlacement?: MaybeRef<'left' | 'right' | 'right-hanging' | undefined>
|
|
23
23
|
showFeedback?: MaybeRef<boolean | undefined>
|
|
24
|
+
cols?: MaybeRef<number | string | undefined>
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
type FormItemOptionKeys = 'size' | 'showLabel' | 'labelWidth' | 'labelStyle' | 'labelAlign' | 'labelPlacement' | 'labelProps'
|
package/esm/page.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
CheckboxProps, DatePickerProps, DatePickerSlots, DrawerContentProps, DrawerProps,
|
|
3
|
-
|
|
4
|
-
ModalOptions, SelectGroupOption, SelectOption, SelectProps, SelectSlots,
|
|
5
|
-
UploadFileInfo, UploadProps,
|
|
2
|
+
CheckboxProps, DatePickerProps, DatePickerSlots, DrawerContentProps, DrawerProps, InputNumberProps, InputNumberSlots,
|
|
3
|
+
InputProps, InputSlots, ModalOptions, SelectGroupOption, SelectOption, SelectProps, SelectSlots, UploadFileInfo, UploadProps,
|
|
6
4
|
} from 'ithinkdt-ui'
|
|
7
5
|
import { MaybeRef, VNode, VNodeChild } from 'vue'
|
|
8
6
|
|
|
@@ -184,7 +182,7 @@ declare module '@ithinkdt/page' {
|
|
|
184
182
|
interface ModalDialogOptions extends ShallowMaybeRef<Omit<ModalOptions, ModalOptionsKey>> {}
|
|
185
183
|
}
|
|
186
184
|
|
|
187
|
-
export declare function
|
|
185
|
+
export declare function createFormItemHelper(options?: {
|
|
188
186
|
getUserGroups?: (() => Promise<UserGroupOption[]>) | undefined
|
|
189
187
|
getUsersByGroup?: ((code: string) => Promise<{ username: string, nickname: string }[]>) | undefined
|
|
190
188
|
getUsersByDept?: ((code: string) => Promise<{ username: string, nickname: string }[]>) | undefined
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ithinkdt/ui",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "iThinkDT UI",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"vue": "^3.5.31",
|
|
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.12"
|
|
98
98
|
},
|
|
99
99
|
"scripts": {
|
|
100
100
|
"dev": "vite build --watch",
|