@ithinkdt/ui 4.0.0 → 4.0.2
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-BXPJvdEe.js → components-BOgApmgo.js} +459 -459
- package/dist/components.js +2 -2
- package/dist/directives-pSAvXd5F.js +240 -0
- package/dist/directives.js +2 -2
- package/dist/index.js +270 -270
- package/dist/page.js +194 -194
- package/dist/use-i18n-Cmb7Xx7d.js +6 -0
- package/dist/use-style.js +29 -2
- package/esm/design.d.ts +4 -4
- package/esm/page.d.ts +2 -0
- package/package.json +9 -9
- package/dist/directives-pc2Vi93X.js +0 -240
- package/dist/use-i18n-D-AJ8KbA.js +0 -6
- package/dist/use-style-BGq0HdRK.js +0 -29
package/dist/page.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import { a as
|
|
3
|
-
import { computed, createVNode, defineComponent, h, isVNode, mergeProps, nextTick, ref, shallowRef, toValue, unref } from "vue";
|
|
4
|
-
import { until, useClipboard } from "@vueuse/core";
|
|
5
|
-
import { NButton, NCheckbox, NColorPicker, NDatePicker, NDrawer, NDrawerContent, NFlex, NIcon, NInput, NInputNumber, NModal, NScrollbar, NSelect, NText, NUpload, useMessage } from "ithinkdt-ui";
|
|
6
|
-
import { nanoid } from "nanoid";
|
|
7
|
-
import { format } from "date-fns";
|
|
8
|
-
import { useFormItem } from "ithinkdt-ui/es/_mixins";
|
|
9
|
-
import { useModal } from "@ithinkdt/page";
|
|
10
|
-
import { isNullish } from "@ithinkdt/common";
|
|
11
|
-
import { useDict, useDictMap } from "@ithinkdt/common/dict";
|
|
12
|
-
function
|
|
13
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
1
|
+
import { n as e } from "./use-i18n-Cmb7Xx7d.js";
|
|
2
|
+
import { a as t, h as n, i as r, r as i, s as a, x as o } from "./components-BOgApmgo.js";
|
|
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, shallowRef as h, toValue as g, unref as _ } from "vue";
|
|
4
|
+
import { until as v, useClipboard as y } from "@vueuse/core";
|
|
5
|
+
import { NButton as b, NCheckbox as x, NColorPicker as S, NDatePicker as C, NDrawer as w, NDrawerContent as T, NFlex as E, NIcon as D, NInput as O, NInputNumber as k, NModal as A, NScrollbar as j, NSelect as M, NText as N, NUpload as P, useMessage as F } from "ithinkdt-ui";
|
|
6
|
+
import { nanoid as I } from "nanoid";
|
|
7
|
+
import { format as L } from "date-fns";
|
|
8
|
+
import { useFormItem as R } from "ithinkdt-ui/es/_mixins";
|
|
9
|
+
import { useModal as z } from "@ithinkdt/page";
|
|
10
|
+
import { isNullish as B } from "@ithinkdt/common";
|
|
11
|
+
import { useDict as V, useDictMap as H } from "@ithinkdt/common/dict";
|
|
12
|
+
function U(e) {
|
|
13
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !d(e);
|
|
14
14
|
}
|
|
15
|
-
var
|
|
15
|
+
var W = (e) => Object.fromEntries(Object.entries(e || {}).map(([e, t]) => [e, _(t)])), G = /* @__PURE__ */ l({
|
|
16
16
|
name: "SimpleUpload",
|
|
17
17
|
props: {
|
|
18
18
|
type: {
|
|
@@ -51,50 +51,50 @@ var mapProps = (e) => Object.fromEntries(Object.entries(e || {}).map(([e, t]) =>
|
|
|
51
51
|
uploadFile: { type: Function }
|
|
52
52
|
},
|
|
53
53
|
setup(t, { slots: n, expose: r }) {
|
|
54
|
-
let { t: i } =
|
|
55
|
-
|
|
56
|
-
let a =
|
|
54
|
+
let { t: i } = e();
|
|
55
|
+
G.t = i;
|
|
56
|
+
let a = R(t), o = F(), l = s(() => t.customRequest || (({ file: e, onProgress: n, onFinish: r, onError: i }) => {
|
|
57
57
|
t.uploadFile(e.file, (e) => n({ percent: e })).then((t) => {
|
|
58
58
|
e.file.fileId = t, r();
|
|
59
59
|
}).catch((e) => {
|
|
60
60
|
o.error(e.message), i(e);
|
|
61
61
|
});
|
|
62
|
-
})),
|
|
62
|
+
})), u = m();
|
|
63
63
|
r({ submit() {
|
|
64
|
-
return
|
|
64
|
+
return v(u).toBeTruthy().then((e) => e.submit());
|
|
65
65
|
} });
|
|
66
|
-
let
|
|
66
|
+
let d = (e) => {
|
|
67
67
|
if (e) for (let n of e) n.size > t.maxSize * 1024 && (n.status = "error");
|
|
68
|
-
t.onUpdateFileList?.(e),
|
|
68
|
+
t.onUpdateFileList?.(e), p(() => a.nTriggerFormChange());
|
|
69
69
|
};
|
|
70
70
|
return () => {
|
|
71
71
|
let { type: e, onUpdateFileList: r, ...o } = t;
|
|
72
|
-
return
|
|
73
|
-
ref:
|
|
74
|
-
customRequest:
|
|
72
|
+
return c(P, f(o, {
|
|
73
|
+
ref: u,
|
|
74
|
+
customRequest: l.value,
|
|
75
75
|
listType: e === "image" ? "image-card" : "text",
|
|
76
76
|
accept: o.accept ?? e === "image" ? "image/*" : void 0,
|
|
77
|
-
"onUpdate:fileList":
|
|
77
|
+
"onUpdate:fileList": d
|
|
78
78
|
}), {
|
|
79
79
|
default: e === "image" ? void 0 : () => {
|
|
80
80
|
let e;
|
|
81
|
-
return
|
|
81
|
+
return c(b, {
|
|
82
82
|
disabled: a.mergedDisabledRef.value,
|
|
83
83
|
size: a.mergedSizeRef.value
|
|
84
|
-
},
|
|
84
|
+
}, U(e = i("common.page.form.selectFileText")) ? e : { default: () => [e] });
|
|
85
85
|
},
|
|
86
86
|
...n
|
|
87
87
|
});
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
|
-
function
|
|
92
|
-
let
|
|
91
|
+
function K({ getUserGroups: e, getUsersByGroup: n, getDeptsByCode: i, getUsersByDept: s, getUsersByUsername: l, uploadFile: d, getFileInfos: f }) {
|
|
92
|
+
let p = (e) => e, m = (e) => B(e) ? e : String(e), g = (e) => B(e) ? e : Number(e);
|
|
93
93
|
return {
|
|
94
|
-
input: () => ({ slots: e, props: t }, { modelValue: n, "onUpdate:modelValue": r, required: i, readonly: a, ...o }) => a ?
|
|
94
|
+
input: () => ({ slots: e, props: t }, { modelValue: n, "onUpdate:modelValue": r, required: i, readonly: a, ...o }) => a ? c(N, {
|
|
95
95
|
depth: 2,
|
|
96
96
|
style: "line-height: 1.25"
|
|
97
|
-
}, { default: () => [n ?? ""] }) : (t =
|
|
97
|
+
}, { default: () => [n ?? ""] }) : (t = W(t), u(O, {
|
|
98
98
|
clearable: !0,
|
|
99
99
|
...t,
|
|
100
100
|
...o,
|
|
@@ -103,67 +103,67 @@ function createPageFormHelper({ getUserGroups: e, getUsersByGroup: n, getDeptsBy
|
|
|
103
103
|
}, e)),
|
|
104
104
|
number: () => {
|
|
105
105
|
let e, t;
|
|
106
|
-
return ({ slots: n, props: r }, { modelValue: i, "onUpdate:modelValue": a, required: o, readonly: s, ...
|
|
107
|
-
if (s) return
|
|
106
|
+
return ({ slots: n, props: r }, { modelValue: i, "onUpdate:modelValue": a, required: o, readonly: s, ...l }) => {
|
|
107
|
+
if (s) return c(N, {
|
|
108
108
|
depth: 2,
|
|
109
109
|
style: "line-height: 1.25"
|
|
110
110
|
}, { default: () => [i ?? ""] });
|
|
111
|
-
let { valueType:
|
|
112
|
-
return e = a,
|
|
113
|
-
e(
|
|
114
|
-
}),
|
|
111
|
+
let { valueType: d = "number", ...f } = W(r), p = d === "string" ? g(i) : i;
|
|
112
|
+
return e = a, d === "string" && !t && (t = (t, ...n) => {
|
|
113
|
+
e(m(t), ...n);
|
|
114
|
+
}), u(k, {
|
|
115
115
|
clearable: !0,
|
|
116
|
-
...
|
|
117
|
-
...
|
|
118
|
-
value:
|
|
119
|
-
"onUpdate:value":
|
|
116
|
+
...f,
|
|
117
|
+
...l,
|
|
118
|
+
value: p,
|
|
119
|
+
"onUpdate:value": d === "string" ? t : e
|
|
120
120
|
}, n);
|
|
121
121
|
};
|
|
122
122
|
},
|
|
123
123
|
select: () => {
|
|
124
124
|
let e, t, n, r, i;
|
|
125
|
-
return ({ slots: a, props: o }, { modelValue: s, "onUpdate:modelValue":
|
|
126
|
-
let { dictType: v, options: y, valueType: b = "string", ...x } =
|
|
127
|
-
y ? t = y : e !== v && (e = v, !t && e && (t =
|
|
125
|
+
return ({ slots: a, props: o }, { modelValue: s, "onUpdate:modelValue": l, required: d, readonly: f, ...h }) => {
|
|
126
|
+
let { dictType: v, options: y, valueType: b = "string", ...x } = W(o), S = b === "number" ? m : p;
|
|
127
|
+
y ? t = y : e !== v && (e = v, !t && e && (t = V(e)));
|
|
128
128
|
let C = x.multiple ? s?.map(S) : S(s);
|
|
129
|
-
if (
|
|
129
|
+
if (f) if (x.multiple) {
|
|
130
130
|
let e;
|
|
131
|
-
return
|
|
131
|
+
return c(N, {
|
|
132
132
|
depth: 2,
|
|
133
133
|
style: "line-height: 1.25"
|
|
134
|
-
},
|
|
134
|
+
}, U(e = (C?.map((e) => t?.find((t) => t[x.valueField || "value"] === e)) ?? []).map((e, t, n) => {
|
|
135
135
|
let r = e ? x.renderLabel ? x.renderLabel(e) ?? "" : e[x.labelField || "label"] ?? "" : C[t] ?? "";
|
|
136
|
-
return
|
|
136
|
+
return c("span", { key: e ? e[x.valueField || "value"] : C[t] ?? "" }, [r, t < n.length - 1 ? ", " : ""]);
|
|
137
137
|
})) ? e : { default: () => [e] });
|
|
138
138
|
} else {
|
|
139
139
|
let e = t?.find((e) => e[x.valueField || "value"] === C);
|
|
140
|
-
return
|
|
140
|
+
return c(N, {
|
|
141
141
|
depth: 2,
|
|
142
142
|
style: "line-height: 1.25"
|
|
143
143
|
}, { default: () => [e ? x.renderLabel ? x.renderLabel(e) ?? "" : e[x.labelField || "label"] ?? "" : C ?? ""] });
|
|
144
144
|
}
|
|
145
|
-
return r = x.multiple, n =
|
|
145
|
+
return r = x.multiple, n = l, b === "number" && !i && (i = (e, ...t) => {
|
|
146
146
|
n(r ? e?.map(g) : g(e), ...t);
|
|
147
|
-
}),
|
|
147
|
+
}), u(M, {
|
|
148
148
|
clearable: !0,
|
|
149
149
|
loading: t?.loading,
|
|
150
150
|
...x,
|
|
151
|
-
options:
|
|
152
|
-
...
|
|
151
|
+
options: _(t),
|
|
152
|
+
...h,
|
|
153
153
|
value: C,
|
|
154
154
|
"onUpdate:value": b === "number" ? i : n
|
|
155
155
|
}, a);
|
|
156
156
|
};
|
|
157
157
|
},
|
|
158
158
|
checkbox: () => ({ slots: e, props: t }, { modelValue: n, "onUpdate:modelValue": r, required: i, readonly: a, ...o }) => {
|
|
159
|
-
if (t =
|
|
159
|
+
if (t = W(t), a) {
|
|
160
160
|
let r;
|
|
161
|
-
return r = n === (t.checkedValue ?? !0) ? e?.checked ? e.checked() :
|
|
161
|
+
return r = n === (t.checkedValue ?? !0) ? e?.checked ? e.checked() : c(x, { checked: !0 }, null) : e?.unchecked ? e.unchecked() : c(x, { disabled: !0 }, null), c(N, {
|
|
162
162
|
depth: 2,
|
|
163
163
|
style: "line-height: 1.25"
|
|
164
|
-
},
|
|
164
|
+
}, U(r) ? r : { default: () => [r] });
|
|
165
165
|
}
|
|
166
|
-
return
|
|
166
|
+
return u(x, {
|
|
167
167
|
...t,
|
|
168
168
|
...o,
|
|
169
169
|
checked: n,
|
|
@@ -172,25 +172,25 @@ function createPageFormHelper({ getUserGroups: e, getUsersByGroup: n, getDeptsBy
|
|
|
172
172
|
},
|
|
173
173
|
checkboxes: () => {
|
|
174
174
|
let e, t, n, r;
|
|
175
|
-
return ({ props: i }, { modelValue: a, "onUpdate:modelValue": s, required:
|
|
176
|
-
let { dictType:
|
|
177
|
-
_ ? t = _ : e !==
|
|
175
|
+
return ({ props: i }, { modelValue: a, "onUpdate:modelValue": s, required: l, readonly: d, ...f }) => {
|
|
176
|
+
let { dictType: h, options: _, valueType: v = "string", ...y } = W(i), b = v === "number" ? m : p;
|
|
177
|
+
_ ? t = _ : e !== h && (e = h, !t && e && (t = V(e)));
|
|
178
178
|
let x = a?.map(b) ?? [];
|
|
179
|
-
if (
|
|
179
|
+
if (d) {
|
|
180
180
|
let e;
|
|
181
|
-
return
|
|
181
|
+
return c(N, {
|
|
182
182
|
depth: 2,
|
|
183
183
|
style: "line-height: 2.4"
|
|
184
|
-
},
|
|
184
|
+
}, U(e = (x?.map((e) => t?.find((t) => t[y.valueField || "value"] === e)) ?? []).map((e, t, n) => {
|
|
185
185
|
let r = e ? e[y.labelField ?? "label"] ?? "" : x[t] ?? "";
|
|
186
|
-
return
|
|
186
|
+
return c("span", { key: e ? e[y.valueField ?? "value"] : x[t] ?? "" }, [r, t < n.length - 1 ? ", " : ""]);
|
|
187
187
|
})) ? e : { default: () => [e] });
|
|
188
188
|
}
|
|
189
189
|
return n = s, v === "number" && !r && (r = (e, ...t) => {
|
|
190
190
|
n(e?.map(g), ...t);
|
|
191
|
-
}),
|
|
191
|
+
}), u(o, {
|
|
192
192
|
...y,
|
|
193
|
-
...
|
|
193
|
+
...f,
|
|
194
194
|
options: t,
|
|
195
195
|
modelValue: x,
|
|
196
196
|
"onUpdate:modelValue": v === "number" ? r : n
|
|
@@ -199,22 +199,22 @@ function createPageFormHelper({ getUserGroups: e, getUsersByGroup: n, getDeptsBy
|
|
|
199
199
|
},
|
|
200
200
|
radios: () => {
|
|
201
201
|
let e, t, n, r;
|
|
202
|
-
return ({ props: i }, { modelValue: o, "onUpdate:modelValue": s, required:
|
|
203
|
-
let { dictType:
|
|
204
|
-
_ ? t = _ : e !==
|
|
202
|
+
return ({ props: i }, { modelValue: o, "onUpdate:modelValue": s, required: l, readonly: d, ...f }) => {
|
|
203
|
+
let { dictType: h, options: _, valueType: v = "string", ...y } = W(i), b = v === "number" ? m : p;
|
|
204
|
+
_ ? t = _ : e !== h && (e = h, !t && e && (t = V(e)));
|
|
205
205
|
let x = b(o);
|
|
206
|
-
if (
|
|
206
|
+
if (d) {
|
|
207
207
|
let e = t?.find((e) => e[y.valueField ?? "value"] === x);
|
|
208
|
-
return
|
|
208
|
+
return c(N, {
|
|
209
209
|
depth: 2,
|
|
210
210
|
style: "line-height: 1.25"
|
|
211
211
|
}, { default: () => [e ? e[y.labelField ?? "label"] ?? "" : x ?? ""] });
|
|
212
212
|
}
|
|
213
213
|
return n = s, v === "number" && !r && (r = (e, ...t) => {
|
|
214
214
|
n(g(e), ...t);
|
|
215
|
-
}),
|
|
215
|
+
}), u(a, {
|
|
216
216
|
...y,
|
|
217
|
-
...
|
|
217
|
+
...f,
|
|
218
218
|
options: t,
|
|
219
219
|
modelValue: x,
|
|
220
220
|
"onUpdate:modelValue": v === "number" ? r : n
|
|
@@ -222,32 +222,32 @@ function createPageFormHelper({ getUserGroups: e, getUsersByGroup: n, getDeptsBy
|
|
|
222
222
|
};
|
|
223
223
|
},
|
|
224
224
|
datepicker: () => ({ slots: e, props: t }, { modelValue: n, "onUpdate:modelValue": r, required: i, readonly: a, ...o }) => {
|
|
225
|
-
let { type: s = "date", format:
|
|
226
|
-
return a ? s.endsWith("range") ?
|
|
225
|
+
let { type: s = "date", format: l = s.startsWith("datetime") ? "yyyy-MM-dd HH:mm:ss" : "yyyy-MM-dd", ...d } = W(t);
|
|
226
|
+
return a ? s.endsWith("range") ? c(N, {
|
|
227
227
|
depth: 2,
|
|
228
228
|
style: "line-height: 1.25"
|
|
229
|
-
}, { default: () => [n ? `${n[0] ?
|
|
229
|
+
}, { default: () => [n ? `${n[0] ? L(n[0], l) : ""} ~ ${n[1] ? L(n[1], l) : ""}` : ""] }) : c(N, {
|
|
230
230
|
depth: 2,
|
|
231
231
|
style: "line-height: 1.25"
|
|
232
|
-
}, { default: () => [n ?
|
|
232
|
+
}, { default: () => [n ? L(n, l) : ""] }) : u(C, {
|
|
233
233
|
actions: null,
|
|
234
234
|
updateValueOnClose: !0,
|
|
235
235
|
clearable: !0,
|
|
236
|
-
...
|
|
236
|
+
...d,
|
|
237
237
|
...o,
|
|
238
238
|
type: s,
|
|
239
|
-
format:
|
|
239
|
+
format: l,
|
|
240
240
|
value: n,
|
|
241
241
|
"onUpdate:value": r
|
|
242
242
|
}, e);
|
|
243
243
|
},
|
|
244
244
|
file: () => ({ slots: e, props: t }, { modelValue: n, "onUpdate:modelValue": r, required: i, readonly: a, ...o }) => {
|
|
245
|
-
if (t =
|
|
245
|
+
if (t = W(t), a) {
|
|
246
246
|
let e;
|
|
247
|
-
return console.warn("[file] 原则上此组建不应该显示在详情中"), n?.length ?
|
|
247
|
+
return console.warn("[file] 原则上此组建不应该显示在详情中"), n?.length ? c(E, {
|
|
248
248
|
gap: "8",
|
|
249
249
|
vertical: !0
|
|
250
|
-
},
|
|
250
|
+
}, U(e = n.map((e) => c("a", {
|
|
251
251
|
key: e.id,
|
|
252
252
|
href: e.url,
|
|
253
253
|
target: "_blank",
|
|
@@ -255,21 +255,21 @@ function createPageFormHelper({ getUserGroups: e, getUsersByGroup: n, getDeptsBy
|
|
|
255
255
|
style: "max-width: 100px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; display: inline-block"
|
|
256
256
|
}, [e.name]))) ? e : { default: () => [e] }) : void 0;
|
|
257
257
|
}
|
|
258
|
-
return
|
|
258
|
+
return u(G, {
|
|
259
259
|
...t,
|
|
260
260
|
...o,
|
|
261
261
|
defaultUpload: !1,
|
|
262
|
-
uploadFile:
|
|
262
|
+
uploadFile: d,
|
|
263
263
|
fileList: n,
|
|
264
264
|
onUpdateFileList: r
|
|
265
265
|
}, e);
|
|
266
266
|
},
|
|
267
267
|
upload: () => {
|
|
268
|
-
let e = null, t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r =
|
|
268
|
+
let e = null, t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = h([]), i = 0, a = (e) => {
|
|
269
269
|
let t = ++i;
|
|
270
270
|
r.value = e.map((e) => n.get(e)).filter(Boolean);
|
|
271
271
|
let a = e.filter((e) => !n.has(e));
|
|
272
|
-
Promise.resolve(a.length > 0 ?
|
|
272
|
+
Promise.resolve(a.length > 0 ? f(a) : []).then((a) => {
|
|
273
273
|
if (t === i) {
|
|
274
274
|
r.value = e.map((e) => n.get(e) || a.find((t) => t.id === e)), n.clear();
|
|
275
275
|
for (let e of r.value) n.set(e.id, e);
|
|
@@ -277,15 +277,15 @@ function createPageFormHelper({ getUserGroups: e, getUsersByGroup: n, getDeptsBy
|
|
|
277
277
|
});
|
|
278
278
|
}, o, s;
|
|
279
279
|
return {
|
|
280
|
-
renderer: ({ slots: i, props:
|
|
281
|
-
let v =
|
|
282
|
-
if (s = v.maxSize, o = v.ref ??=
|
|
280
|
+
renderer: ({ slots: i, props: l }, { modelValue: f, "onUpdate:modelValue": p, required: m, readonly: g, ..._ }) => {
|
|
281
|
+
let v = W(l);
|
|
282
|
+
if (s = v.maxSize, o = v.ref ??= h(), e !== f && (e = f, a(f?.split(",") ?? [])), g) {
|
|
283
283
|
let e;
|
|
284
|
-
return r.value.length === 0 ? void 0 :
|
|
284
|
+
return r.value.length === 0 ? void 0 : c(E, {
|
|
285
285
|
gap: "8",
|
|
286
286
|
vertical: !0,
|
|
287
287
|
style: "padding: 6px 0"
|
|
288
|
-
},
|
|
288
|
+
}, U(e = r.value.map((e) => c("a", {
|
|
289
289
|
key: e.id,
|
|
290
290
|
href: e.url,
|
|
291
291
|
target: "_blank",
|
|
@@ -295,127 +295,127 @@ function createPageFormHelper({ getUserGroups: e, getUsersByGroup: n, getDeptsBy
|
|
|
295
295
|
style: "max-width: 100%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; display: inline-block"
|
|
296
296
|
}, [e.name]))) ? e : { default: () => [e] });
|
|
297
297
|
}
|
|
298
|
-
return
|
|
298
|
+
return u(G, {
|
|
299
299
|
...v,
|
|
300
300
|
..._,
|
|
301
|
-
uploadFile:
|
|
301
|
+
uploadFile: d,
|
|
302
302
|
fileList: r.value,
|
|
303
303
|
onUpdateFileList: (e = []) => {
|
|
304
304
|
n.clear();
|
|
305
305
|
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);
|
|
306
|
-
r.value = e,
|
|
306
|
+
r.value = e, p(r.value.map((e) => t.get(e.id) || e.id).join(",") || null);
|
|
307
307
|
}
|
|
308
308
|
}, i);
|
|
309
309
|
},
|
|
310
310
|
beforeSubmit: async () => {
|
|
311
|
-
if (await o?.value?.submit(), await
|
|
312
|
-
if (r.value.some((e) => e.status === "error")) return
|
|
311
|
+
if (await o?.value?.submit(), await v(r).toMatch((e) => e.every((e) => !["pending", "uploading"].includes(e.status))), r.value.some((e) => e.size > s * 1024)) return G.t("common.page.form.validate.fileSizeExceeded", { maxSize: s });
|
|
312
|
+
if (r.value.some((e) => e.status === "error")) return G.t("common.page.form.validate.fileErrorMessage");
|
|
313
313
|
}
|
|
314
314
|
};
|
|
315
315
|
},
|
|
316
316
|
user: () => {
|
|
317
|
-
let a, o,
|
|
318
|
-
return ({ slots:
|
|
319
|
-
let b =
|
|
320
|
-
return a || (a =
|
|
317
|
+
let a, o, d;
|
|
318
|
+
return ({ slots: f, props: p }, { modelValue: m, "onUpdate:modelValue": g, required: _, readonly: v, ...y }) => {
|
|
319
|
+
let b = W(p);
|
|
320
|
+
return a || (a = h([]), o = h([]), d = h([]), l().then((e) => {
|
|
321
321
|
a.value = e;
|
|
322
322
|
}), e().then((e) => {
|
|
323
323
|
o.value = e;
|
|
324
324
|
}), i().then((e) => {
|
|
325
|
-
|
|
326
|
-
})), v ?
|
|
327
|
-
value:
|
|
325
|
+
d.value = e;
|
|
326
|
+
})), v ? c(t, {
|
|
327
|
+
value: m,
|
|
328
328
|
multiple: b.multiple,
|
|
329
|
-
getUsersByUsername:
|
|
329
|
+
getUsersByUsername: l,
|
|
330
330
|
renderInfo: b.renderInfo
|
|
331
|
-
}, null) :
|
|
331
|
+
}, null) : u(r, {
|
|
332
332
|
type: "user",
|
|
333
333
|
users: a.value,
|
|
334
|
-
depts:
|
|
334
|
+
depts: d.value,
|
|
335
335
|
groups: o.value,
|
|
336
336
|
getUsersByDept: s,
|
|
337
337
|
getUsersByGroup: n,
|
|
338
338
|
...b,
|
|
339
339
|
...y,
|
|
340
340
|
renderUserInfo: b.renderInfo,
|
|
341
|
-
modelValue:
|
|
341
|
+
modelValue: m,
|
|
342
342
|
"onUpdate:modelValue": g
|
|
343
|
-
},
|
|
343
|
+
}, f);
|
|
344
344
|
};
|
|
345
345
|
}
|
|
346
346
|
};
|
|
347
347
|
}
|
|
348
|
-
function
|
|
348
|
+
function q({ getDeptsByCode: e, getUsersByUsername: n, getFileInfos: r, previewFileUrl: a }) {
|
|
349
349
|
let o = (e) => (t, n, { params: r = {} }) => {
|
|
350
|
-
if (t != null) return
|
|
351
|
-
}, s = (e = {}) =>
|
|
350
|
+
if (t != null) return L(t, r.formatter ?? e);
|
|
351
|
+
}, s = (e = {}) => c("svg", f({
|
|
352
352
|
xmlns: "http://www.w3.org/2000/svg",
|
|
353
353
|
width: "1em",
|
|
354
354
|
height: "1em",
|
|
355
355
|
viewBox: "0 0 32 32"
|
|
356
|
-
}, e), [
|
|
356
|
+
}, e), [c("circle", {
|
|
357
357
|
cx: "16",
|
|
358
358
|
cy: "16",
|
|
359
359
|
r: "8",
|
|
360
360
|
fill: "currentColor"
|
|
361
|
-
}, null)]),
|
|
361
|
+
}, null)]), l = (e = {}) => c("svg", f({
|
|
362
362
|
xmlns: "http://www.w3.org/2000/svg",
|
|
363
363
|
width: "1em",
|
|
364
364
|
height: "1em",
|
|
365
365
|
viewBox: "0 0 24 24"
|
|
366
|
-
}, e), [
|
|
366
|
+
}, e), [c("path", {
|
|
367
367
|
fill: "currentColor",
|
|
368
368
|
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"
|
|
369
|
-
}, null)]),
|
|
369
|
+
}, null)]), u = (e) => c("svg", f({
|
|
370
370
|
xmlns: "http://www.w3.org/2000/svg",
|
|
371
371
|
width: "1em",
|
|
372
372
|
height: "1em",
|
|
373
373
|
viewBox: "0 0 24 24"
|
|
374
|
-
}, e), [
|
|
374
|
+
}, e), [c("path", {
|
|
375
375
|
fill: "currentColor",
|
|
376
376
|
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"
|
|
377
|
-
}, null)]),
|
|
377
|
+
}, null)]), d = (e) => c("svg", f({
|
|
378
378
|
xmlns: "http://www.w3.org/2000/svg",
|
|
379
379
|
width: "1em",
|
|
380
380
|
height: "1em",
|
|
381
381
|
viewBox: "0 0 24 24"
|
|
382
|
-
}, e), [
|
|
382
|
+
}, e), [c("path", {
|
|
383
383
|
fill: "currentColor",
|
|
384
384
|
d: "M20 12a8 8 0 0 1-8 8a8 8 0 0 1-8-8a8 8 0 0 1 8-8c.76 0 1.5.11 2.2.31l1.57-1.57A9.8 9.8 0 0 0 12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10M7.91 10.08L6.5 11.5L11 16L21 6l-1.41-1.42L11 13.17z"
|
|
385
385
|
}, null)]);
|
|
386
386
|
return {
|
|
387
387
|
longtext: () => {
|
|
388
|
-
let e =
|
|
388
|
+
let e = m(), t = m(), n = m(), { open: r } = z({
|
|
389
389
|
type: "drawer",
|
|
390
390
|
resizable: !0,
|
|
391
|
-
content: () =>
|
|
392
|
-
width:
|
|
393
|
-
footer: null,
|
|
391
|
+
content: () => c("div", null, [c("span", null, [e.value])]),
|
|
392
|
+
width: t,
|
|
393
|
+
footer: () => n.value?.() ?? null,
|
|
394
394
|
maskClosable: !0
|
|
395
|
-
}), { copy:
|
|
396
|
-
if (!
|
|
395
|
+
}), { copy: i, copied: a } = y({ legacy: !0 }), o = (t, n, o) => {
|
|
396
|
+
if (!n) return r(t);
|
|
397
397
|
let s = () => {
|
|
398
|
-
o ? o(e.value) :
|
|
398
|
+
o ? o(e.value) : i(e.value);
|
|
399
399
|
};
|
|
400
|
-
return
|
|
400
|
+
return r(() => c("div", { style: "display: flex; align-items: center; justify-content: space-between; margin-right: 4px;" }, [g(t), a.value ? c(b, {
|
|
401
401
|
quaternary: !0,
|
|
402
402
|
size: "tiny",
|
|
403
403
|
type: "success"
|
|
404
|
-
}, { icon: () =>
|
|
404
|
+
}, { icon: () => c(D, { size: 18 }, { default: () => [c(d, null, null)] }) }) : c(b, {
|
|
405
405
|
quaternary: !0,
|
|
406
406
|
size: "tiny",
|
|
407
407
|
onClick: s
|
|
408
|
-
}, { icon: () =>
|
|
408
|
+
}, { icon: () => c(D, { size: 16 }, { default: () => [c(u, null, null)] }) })]));
|
|
409
409
|
};
|
|
410
410
|
return {
|
|
411
|
-
renderer: (
|
|
411
|
+
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(b, {
|
|
412
412
|
type: "info",
|
|
413
413
|
text: !0,
|
|
414
414
|
style: "position: sticky; right: 0; z-index: 2",
|
|
415
|
-
onClick:
|
|
416
|
-
e.value =
|
|
415
|
+
onClick: a.showText ? () => a.showText(r) : () => {
|
|
416
|
+
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);
|
|
417
417
|
}
|
|
418
|
-
}, { default: () => [
|
|
418
|
+
}, { default: () => [c(D, { size: 18 }, { default: () => [c(l, null, null)] })] })]),
|
|
419
419
|
default: { table: { ellipsis: !1 } }
|
|
420
420
|
};
|
|
421
421
|
},
|
|
@@ -439,16 +439,16 @@ function createDescriptionHelper({ getDeptsByCode: e, getUsersByUsername: n, get
|
|
|
439
439
|
let e, t, n;
|
|
440
440
|
return (r, i, { params: a = {} }) => {
|
|
441
441
|
if (r == null) return;
|
|
442
|
-
let { dictType: o, options:
|
|
443
|
-
if (
|
|
444
|
-
if (r = r.toString(),
|
|
445
|
-
let e =
|
|
442
|
+
let { dictType: o, options: l, multiple: u, statusMap: d } = W(a);
|
|
443
|
+
if (l ? t !== l && (t = l, n = new Map(l.map((e) => [e[a.valueField || "value"], e]))) : e !== o && (e = o, !n && e && (n = H(e))), !u) {
|
|
444
|
+
if (r = r.toString(), d && r in d) {
|
|
445
|
+
let e = d[r] ?? "default";
|
|
446
446
|
return [
|
|
447
447
|
"primary",
|
|
448
448
|
"success",
|
|
449
449
|
"warning",
|
|
450
450
|
"danger"
|
|
451
|
-
].includes(e) && (e = `var(--color-${e})`),
|
|
451
|
+
].includes(e) && (e = `var(--color-${e})`), c("span", { style: "position: relative; padding-left: 1.25em" }, [c(s, { style: `color: ${e}; position: absolute;left: 0; top: 1.5px` }, null), c("span", null, [n.get(r)?.[a.labelField || "label"] ?? r ?? ""])]);
|
|
452
452
|
}
|
|
453
453
|
return n.get(r)?.[a.labelField || "label"] ?? r ?? "";
|
|
454
454
|
}
|
|
@@ -478,34 +478,34 @@ function createDescriptionHelper({ getDeptsByCode: e, getUsersByUsername: n, get
|
|
|
478
478
|
sortable: !0
|
|
479
479
|
} }
|
|
480
480
|
}),
|
|
481
|
-
email: () => (e) =>
|
|
482
|
-
url: () => (e) =>
|
|
483
|
-
color: () => (e) =>
|
|
481
|
+
email: () => (e) => c("a", { href: `mailto:${e}` }, [e]),
|
|
482
|
+
url: () => (e) => c("a", { href: e }, [e]),
|
|
483
|
+
color: () => (e) => c(S, {
|
|
484
484
|
value: e,
|
|
485
485
|
disabled: !0,
|
|
486
486
|
size: "small"
|
|
487
487
|
}, null),
|
|
488
488
|
image: () => (e, t, { params: n = {} }) => {
|
|
489
489
|
let r;
|
|
490
|
-
return e ?
|
|
490
|
+
return e ? c(E, {
|
|
491
491
|
gap: "8",
|
|
492
492
|
wrap: !0
|
|
493
|
-
},
|
|
493
|
+
}, U(r = (Array.isArray(e) ? e : n?.multiple ? e.split(",") : [e]).map((e) => a(e)).map((e) => c("img", {
|
|
494
494
|
key: e,
|
|
495
495
|
src: e,
|
|
496
496
|
style: "max-height: 32px; max-width: 100px; object-fit: contain"
|
|
497
497
|
}, null))) ? r : { default: () => [r] }) : void 0;
|
|
498
498
|
},
|
|
499
499
|
file: () => {
|
|
500
|
-
let e =
|
|
500
|
+
let e = I();
|
|
501
501
|
return (t, n, { params: i = {} }) => {
|
|
502
502
|
let a;
|
|
503
503
|
return t ? (n.__file_urls ??= {}, n.__file_urls[e] || r(Array.isArray(t) ? t : i?.multiple ? t.split(",") : [t]).then((t) => {
|
|
504
504
|
n.__file_urls[e] = t;
|
|
505
|
-
}),
|
|
505
|
+
}), c(E, {
|
|
506
506
|
gap: "8",
|
|
507
507
|
wrap: !0
|
|
508
|
-
},
|
|
508
|
+
}, U(a = (n.__file_urls[e] || []).map((e) => c("a", {
|
|
509
509
|
key: e.id,
|
|
510
510
|
href: e.url,
|
|
511
511
|
target: "_blank",
|
|
@@ -515,7 +515,7 @@ function createDescriptionHelper({ getDeptsByCode: e, getUsersByUsername: n, get
|
|
|
515
515
|
};
|
|
516
516
|
},
|
|
517
517
|
dept: () => (t, n, { params: r = {} }) => {
|
|
518
|
-
if (t) return
|
|
518
|
+
if (t) return c(i, {
|
|
519
519
|
value: t,
|
|
520
520
|
multiple: r?.multiple,
|
|
521
521
|
getDeptsByCode: e
|
|
@@ -525,7 +525,7 @@ function createDescriptionHelper({ getDeptsByCode: e, getUsersByUsername: n, get
|
|
|
525
525
|
let e = { style: "padding-block: 0" };
|
|
526
526
|
return {
|
|
527
527
|
renderer: (e, r, { params: i = {} }) => {
|
|
528
|
-
if (e) return
|
|
528
|
+
if (e) return c(t, {
|
|
529
529
|
value: e,
|
|
530
530
|
multiple: i?.multiple,
|
|
531
531
|
getUsersByUsername: n
|
|
@@ -541,102 +541,102 @@ function createDescriptionHelper({ getDeptsByCode: e, getUsersByUsername: n, get
|
|
|
541
541
|
}
|
|
542
542
|
};
|
|
543
543
|
}
|
|
544
|
-
function
|
|
545
|
-
return () => ({ items: e, model: t, handleSubmit: r, reset: i, validation: a, readonly: o, inModal: s, showFeedback:
|
|
544
|
+
function J() {
|
|
545
|
+
return () => ({ items: e, model: t, 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(n, {
|
|
546
546
|
readonly: o,
|
|
547
547
|
model: t,
|
|
548
548
|
items: e,
|
|
549
549
|
validation: a,
|
|
550
|
-
showColon:
|
|
551
|
-
labelWidth:
|
|
552
|
-
labelAlign:
|
|
553
|
-
labelPlacement:
|
|
554
|
-
showRequireMark:
|
|
555
|
-
requireMarkPlacement:
|
|
556
|
-
showFeedback:
|
|
550
|
+
showColon: _(u) ?? !0,
|
|
551
|
+
labelWidth: _(d),
|
|
552
|
+
labelAlign: _(f),
|
|
553
|
+
labelPlacement: _(p),
|
|
554
|
+
showRequireMark: _(m),
|
|
555
|
+
requireMarkPlacement: _(h),
|
|
556
|
+
showFeedback: _(l) ?? !0,
|
|
557
557
|
showAction: !1,
|
|
558
558
|
onSubmit: r,
|
|
559
559
|
onReset: i,
|
|
560
560
|
style: s ? "padding-right: 2rem; padding-top: 1rem" : void 0
|
|
561
561
|
}, null);
|
|
562
562
|
}
|
|
563
|
-
function
|
|
563
|
+
function Y() {
|
|
564
564
|
let e = (e) => typeof e == "number" ? `${e}px` : e, t = {
|
|
565
565
|
maxHeight: "calc(100vh - 130px)",
|
|
566
566
|
display: "flex",
|
|
567
567
|
flexDirection: "column"
|
|
568
568
|
}, n = { content: !0 };
|
|
569
|
-
return () => ({ type: r = "dialog", visible: i, title: a, content: o, footer: s, placement:
|
|
570
|
-
let
|
|
569
|
+
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: x, onCancel: S, onConfirm: C, onAfterClose: D, onAfterOpen: O, confirmText: k, confirmDisabled: M, confirmLoading: N, cancelText: P, cancelDisabled: F, cancelLoading: I, nativeScrollbar: L, ...R }) => {
|
|
570
|
+
let z = s ? () => s : s === null ? null : () => c(E, {
|
|
571
571
|
justify: "end",
|
|
572
572
|
gap: "16"
|
|
573
|
-
}, { default: () => [
|
|
573
|
+
}, { default: () => [P === null ? void 0 : c(b, {
|
|
574
574
|
onClick: S,
|
|
575
|
-
disabled:
|
|
576
|
-
loading:
|
|
575
|
+
disabled: F,
|
|
576
|
+
loading: I,
|
|
577
577
|
style: "min-width: 60px"
|
|
578
|
-
},
|
|
578
|
+
}, U(P) ? P : { default: () => [P] }), k === null ? void 0 : c(b, {
|
|
579
579
|
type: "primary",
|
|
580
580
|
onClick: C,
|
|
581
|
-
disabled:
|
|
582
|
-
loading:
|
|
581
|
+
disabled: M,
|
|
582
|
+
loading: N,
|
|
583
583
|
style: "min-width: 60px"
|
|
584
|
-
},
|
|
584
|
+
}, U(k) ? k : { default: () => [k] })] });
|
|
585
585
|
if (r === "dialog") {
|
|
586
|
-
let { style: r } =
|
|
586
|
+
let { style: r } = f({ style: {
|
|
587
587
|
width: e(_ ?? 520),
|
|
588
588
|
height: e(v)
|
|
589
589
|
} }, { style: y });
|
|
590
|
-
return
|
|
590
|
+
return c(A, f({
|
|
591
591
|
show: i,
|
|
592
592
|
preset: "card",
|
|
593
593
|
title: () => a,
|
|
594
594
|
maskClosable: g ?? !1,
|
|
595
|
-
closeOnEsc:
|
|
596
|
-
closable:
|
|
595
|
+
closeOnEsc: p,
|
|
596
|
+
closable: m,
|
|
597
597
|
onClose: x,
|
|
598
598
|
segmented: n,
|
|
599
599
|
size: "small",
|
|
600
|
-
onAfterEnter:
|
|
601
|
-
onAfterLeave:
|
|
600
|
+
onAfterEnter: O,
|
|
601
|
+
onAfterLeave: D,
|
|
602
602
|
onUpdateShow: x,
|
|
603
|
-
draggable:
|
|
603
|
+
draggable: d ?? !0,
|
|
604
604
|
style: r,
|
|
605
605
|
contentStyle: t
|
|
606
|
-
},
|
|
607
|
-
default: () =>
|
|
606
|
+
}, R), {
|
|
607
|
+
default: () => c(j, {
|
|
608
608
|
abstract: !0,
|
|
609
609
|
style: "display: flex; flex-direction: column"
|
|
610
|
-
},
|
|
611
|
-
action:
|
|
610
|
+
}, U(o) ? o : { default: () => [o] }),
|
|
611
|
+
action: z
|
|
612
612
|
});
|
|
613
613
|
}
|
|
614
|
-
let { bodyContentClass:
|
|
615
|
-
return
|
|
614
|
+
let { bodyContentClass: B, bodyContentStyle: V, ...H } = R;
|
|
615
|
+
return c(w, f({
|
|
616
616
|
show: i,
|
|
617
617
|
trapFocus: !1,
|
|
618
|
-
closeOnEsc:
|
|
619
|
-
showMask:
|
|
618
|
+
closeOnEsc: p,
|
|
619
|
+
showMask: h,
|
|
620
620
|
maskClosable: g,
|
|
621
|
-
resizable:
|
|
622
|
-
placement:
|
|
623
|
-
width:
|
|
624
|
-
defaultWidth:
|
|
621
|
+
resizable: u,
|
|
622
|
+
placement: l,
|
|
623
|
+
width: u ? void 0 : _ ?? 440,
|
|
624
|
+
defaultWidth: u ? _ ?? 440 : void 0,
|
|
625
625
|
height: v,
|
|
626
626
|
onUpdateShow: x,
|
|
627
|
-
onAfterEnter:
|
|
628
|
-
onAfterLeave:
|
|
627
|
+
onAfterEnter: O,
|
|
628
|
+
onAfterLeave: D,
|
|
629
629
|
style: y
|
|
630
|
-
},
|
|
631
|
-
closable:
|
|
632
|
-
nativeScrollbar:
|
|
633
|
-
bodyContentClass:
|
|
634
|
-
bodyContentStyle:
|
|
630
|
+
}, H), { default: () => [c(T, {
|
|
631
|
+
closable: m,
|
|
632
|
+
nativeScrollbar: L ?? !1,
|
|
633
|
+
bodyContentClass: B,
|
|
634
|
+
bodyContentStyle: V
|
|
635
635
|
}, {
|
|
636
636
|
default: () => o,
|
|
637
637
|
header: () => a,
|
|
638
|
-
footer:
|
|
638
|
+
footer: z
|
|
639
639
|
})] });
|
|
640
640
|
};
|
|
641
641
|
}
|
|
642
|
-
export { createDescriptionHelper, createFormHelper, createModalHelper, createPageFormHelper };
|
|
642
|
+
export { q as createDescriptionHelper, J as createFormHelper, Y as createModalHelper, K as createPageFormHelper };
|