@ithinkdt/ui 4.0.1 → 4.0.3
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-Blh7O5zj.js} +459 -459
- package/dist/components.js +2 -2
- package/dist/directives-DXNnV4xc.js +240 -0
- package/dist/directives.js +2 -2
- package/dist/index.js +270 -270
- package/dist/page.js +196 -195
- package/dist/use-i18n-Cmb7Xx7d.js +6 -0
- package/dist/use-style.js +29 -2
- package/esm/page.d.ts +3 -1
- package/package.json +10 -10
- 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-Blh7O5zj.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 = 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,68 @@ 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
|
-
let e = t?.find((e) => e[x.valueField || "value"] === C);
|
|
140
|
-
return
|
|
139
|
+
let e = _(t)?.find((e) => e[x.valueField || "value"] === C);
|
|
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
|
+
filterable: _(t)?.length > 9,
|
|
149
150
|
loading: t?.loading,
|
|
150
151
|
...x,
|
|
151
|
-
options:
|
|
152
|
-
...
|
|
152
|
+
options: _(t),
|
|
153
|
+
...h,
|
|
153
154
|
value: C,
|
|
154
155
|
"onUpdate:value": b === "number" ? i : n
|
|
155
156
|
}, a);
|
|
156
157
|
};
|
|
157
158
|
},
|
|
158
159
|
checkbox: () => ({ slots: e, props: t }, { modelValue: n, "onUpdate:modelValue": r, required: i, readonly: a, ...o }) => {
|
|
159
|
-
if (t =
|
|
160
|
+
if (t = W(t), a) {
|
|
160
161
|
let r;
|
|
161
|
-
return r = n === (t.checkedValue ?? !0) ? e?.checked ? e.checked() :
|
|
162
|
+
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
163
|
depth: 2,
|
|
163
164
|
style: "line-height: 1.25"
|
|
164
|
-
},
|
|
165
|
+
}, U(r) ? r : { default: () => [r] });
|
|
165
166
|
}
|
|
166
|
-
return
|
|
167
|
+
return u(x, {
|
|
167
168
|
...t,
|
|
168
169
|
...o,
|
|
169
170
|
checked: n,
|
|
@@ -172,25 +173,25 @@ function createPageFormHelper({ getUserGroups: e, getUsersByGroup: n, getDeptsBy
|
|
|
172
173
|
},
|
|
173
174
|
checkboxes: () => {
|
|
174
175
|
let e, t, n, r;
|
|
175
|
-
return ({ props: i }, { modelValue: a, "onUpdate:modelValue": s, required:
|
|
176
|
-
let { dictType:
|
|
177
|
-
_ ? t = _ : e !==
|
|
176
|
+
return ({ props: i }, { modelValue: a, "onUpdate:modelValue": s, required: l, readonly: d, ...f }) => {
|
|
177
|
+
let { dictType: h, options: _, valueType: v = "string", ...y } = W(i), b = v === "number" ? m : p;
|
|
178
|
+
_ ? t = _ : e !== h && (e = h, !t && e && (t = V(e)));
|
|
178
179
|
let x = a?.map(b) ?? [];
|
|
179
|
-
if (
|
|
180
|
+
if (d) {
|
|
180
181
|
let e;
|
|
181
|
-
return
|
|
182
|
+
return c(N, {
|
|
182
183
|
depth: 2,
|
|
183
184
|
style: "line-height: 2.4"
|
|
184
|
-
},
|
|
185
|
+
}, U(e = (x?.map((e) => t?.find((t) => t[y.valueField || "value"] === e)) ?? []).map((e, t, n) => {
|
|
185
186
|
let r = e ? e[y.labelField ?? "label"] ?? "" : x[t] ?? "";
|
|
186
|
-
return
|
|
187
|
+
return c("span", { key: e ? e[y.valueField ?? "value"] : x[t] ?? "" }, [r, t < n.length - 1 ? ", " : ""]);
|
|
187
188
|
})) ? e : { default: () => [e] });
|
|
188
189
|
}
|
|
189
190
|
return n = s, v === "number" && !r && (r = (e, ...t) => {
|
|
190
191
|
n(e?.map(g), ...t);
|
|
191
|
-
}),
|
|
192
|
+
}), u(o, {
|
|
192
193
|
...y,
|
|
193
|
-
...
|
|
194
|
+
...f,
|
|
194
195
|
options: t,
|
|
195
196
|
modelValue: x,
|
|
196
197
|
"onUpdate:modelValue": v === "number" ? r : n
|
|
@@ -199,22 +200,22 @@ function createPageFormHelper({ getUserGroups: e, getUsersByGroup: n, getDeptsBy
|
|
|
199
200
|
},
|
|
200
201
|
radios: () => {
|
|
201
202
|
let e, t, n, r;
|
|
202
|
-
return ({ props: i }, { modelValue: o, "onUpdate:modelValue": s, required:
|
|
203
|
-
let { dictType:
|
|
204
|
-
_ ? t = _ : e !==
|
|
203
|
+
return ({ props: i }, { modelValue: o, "onUpdate:modelValue": s, required: l, readonly: d, ...f }) => {
|
|
204
|
+
let { dictType: h, options: _, valueType: v = "string", ...y } = W(i), b = v === "number" ? m : p;
|
|
205
|
+
_ ? t = _ : e !== h && (e = h, !t && e && (t = V(e)));
|
|
205
206
|
let x = b(o);
|
|
206
|
-
if (
|
|
207
|
+
if (d) {
|
|
207
208
|
let e = t?.find((e) => e[y.valueField ?? "value"] === x);
|
|
208
|
-
return
|
|
209
|
+
return c(N, {
|
|
209
210
|
depth: 2,
|
|
210
211
|
style: "line-height: 1.25"
|
|
211
212
|
}, { default: () => [e ? e[y.labelField ?? "label"] ?? "" : x ?? ""] });
|
|
212
213
|
}
|
|
213
214
|
return n = s, v === "number" && !r && (r = (e, ...t) => {
|
|
214
215
|
n(g(e), ...t);
|
|
215
|
-
}),
|
|
216
|
+
}), u(a, {
|
|
216
217
|
...y,
|
|
217
|
-
...
|
|
218
|
+
...f,
|
|
218
219
|
options: t,
|
|
219
220
|
modelValue: x,
|
|
220
221
|
"onUpdate:modelValue": v === "number" ? r : n
|
|
@@ -222,32 +223,32 @@ function createPageFormHelper({ getUserGroups: e, getUsersByGroup: n, getDeptsBy
|
|
|
222
223
|
};
|
|
223
224
|
},
|
|
224
225
|
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") ?
|
|
226
|
+
let { type: s = "date", format: l = s.startsWith("datetime") ? "yyyy-MM-dd HH:mm:ss" : "yyyy-MM-dd", ...d } = W(t);
|
|
227
|
+
return a ? s.endsWith("range") ? c(N, {
|
|
227
228
|
depth: 2,
|
|
228
229
|
style: "line-height: 1.25"
|
|
229
|
-
}, { default: () => [n ? `${n[0] ?
|
|
230
|
+
}, { default: () => [n ? `${n[0] ? L(n[0], l) : ""} ~ ${n[1] ? L(n[1], l) : ""}` : ""] }) : c(N, {
|
|
230
231
|
depth: 2,
|
|
231
232
|
style: "line-height: 1.25"
|
|
232
|
-
}, { default: () => [n ?
|
|
233
|
+
}, { default: () => [n ? L(n, l) : ""] }) : u(C, {
|
|
233
234
|
actions: null,
|
|
234
235
|
updateValueOnClose: !0,
|
|
235
236
|
clearable: !0,
|
|
236
|
-
...
|
|
237
|
+
...d,
|
|
237
238
|
...o,
|
|
238
239
|
type: s,
|
|
239
|
-
format:
|
|
240
|
+
format: l,
|
|
240
241
|
value: n,
|
|
241
242
|
"onUpdate:value": r
|
|
242
243
|
}, e);
|
|
243
244
|
},
|
|
244
245
|
file: () => ({ slots: e, props: t }, { modelValue: n, "onUpdate:modelValue": r, required: i, readonly: a, ...o }) => {
|
|
245
|
-
if (t =
|
|
246
|
+
if (t = W(t), a) {
|
|
246
247
|
let e;
|
|
247
|
-
return console.warn("[file] 原则上此组建不应该显示在详情中"), n?.length ?
|
|
248
|
+
return console.warn("[file] 原则上此组建不应该显示在详情中"), n?.length ? c(E, {
|
|
248
249
|
gap: "8",
|
|
249
250
|
vertical: !0
|
|
250
|
-
},
|
|
251
|
+
}, U(e = n.map((e) => c("a", {
|
|
251
252
|
key: e.id,
|
|
252
253
|
href: e.url,
|
|
253
254
|
target: "_blank",
|
|
@@ -255,21 +256,21 @@ function createPageFormHelper({ getUserGroups: e, getUsersByGroup: n, getDeptsBy
|
|
|
255
256
|
style: "max-width: 100px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; display: inline-block"
|
|
256
257
|
}, [e.name]))) ? e : { default: () => [e] }) : void 0;
|
|
257
258
|
}
|
|
258
|
-
return
|
|
259
|
+
return u(G, {
|
|
259
260
|
...t,
|
|
260
261
|
...o,
|
|
261
262
|
defaultUpload: !1,
|
|
262
|
-
uploadFile:
|
|
263
|
+
uploadFile: d,
|
|
263
264
|
fileList: n,
|
|
264
265
|
onUpdateFileList: r
|
|
265
266
|
}, e);
|
|
266
267
|
},
|
|
267
268
|
upload: () => {
|
|
268
|
-
let e = null, t =
|
|
269
|
+
let e = null, t = new Map(), n = new Map(), r = h([]), i = 0, a = (e) => {
|
|
269
270
|
let t = ++i;
|
|
270
271
|
r.value = e.map((e) => n.get(e)).filter(Boolean);
|
|
271
272
|
let a = e.filter((e) => !n.has(e));
|
|
272
|
-
Promise.resolve(a.length > 0 ?
|
|
273
|
+
Promise.resolve(a.length > 0 ? f(a) : []).then((a) => {
|
|
273
274
|
if (t === i) {
|
|
274
275
|
r.value = e.map((e) => n.get(e) || a.find((t) => t.id === e)), n.clear();
|
|
275
276
|
for (let e of r.value) n.set(e.id, e);
|
|
@@ -277,15 +278,15 @@ function createPageFormHelper({ getUserGroups: e, getUsersByGroup: n, getDeptsBy
|
|
|
277
278
|
});
|
|
278
279
|
}, o, s;
|
|
279
280
|
return {
|
|
280
|
-
renderer: ({ slots: i, props:
|
|
281
|
-
let v =
|
|
282
|
-
if (s = v.maxSize, o = v.ref ??=
|
|
281
|
+
renderer: ({ slots: i, props: l }, { modelValue: f, "onUpdate:modelValue": p, required: m, readonly: g, ..._ }) => {
|
|
282
|
+
let v = W(l);
|
|
283
|
+
if (s = v.maxSize, o = v.ref ??= h(), e !== f && (e = f, a(f?.split(",") ?? [])), g) {
|
|
283
284
|
let e;
|
|
284
|
-
return r.value.length === 0 ? void 0 :
|
|
285
|
+
return r.value.length === 0 ? void 0 : c(E, {
|
|
285
286
|
gap: "8",
|
|
286
287
|
vertical: !0,
|
|
287
288
|
style: "padding: 6px 0"
|
|
288
|
-
},
|
|
289
|
+
}, U(e = r.value.map((e) => c("a", {
|
|
289
290
|
key: e.id,
|
|
290
291
|
href: e.url,
|
|
291
292
|
target: "_blank",
|
|
@@ -295,127 +296,127 @@ function createPageFormHelper({ getUserGroups: e, getUsersByGroup: n, getDeptsBy
|
|
|
295
296
|
style: "max-width: 100%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; display: inline-block"
|
|
296
297
|
}, [e.name]))) ? e : { default: () => [e] });
|
|
297
298
|
}
|
|
298
|
-
return
|
|
299
|
+
return u(G, {
|
|
299
300
|
...v,
|
|
300
301
|
..._,
|
|
301
|
-
uploadFile:
|
|
302
|
+
uploadFile: d,
|
|
302
303
|
fileList: r.value,
|
|
303
304
|
onUpdateFileList: (e = []) => {
|
|
304
305
|
n.clear();
|
|
305
306
|
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,
|
|
307
|
+
r.value = e, p(r.value.map((e) => t.get(e.id) || e.id).join(",") || null);
|
|
307
308
|
}
|
|
308
309
|
}, i);
|
|
309
310
|
},
|
|
310
311
|
beforeSubmit: async () => {
|
|
311
|
-
if (await o?.value?.submit(), await
|
|
312
|
-
if (r.value.some((e) => e.status === "error")) return
|
|
312
|
+
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 });
|
|
313
|
+
if (r.value.some((e) => e.status === "error")) return G.t("common.page.form.validate.fileErrorMessage");
|
|
313
314
|
}
|
|
314
315
|
};
|
|
315
316
|
},
|
|
316
317
|
user: () => {
|
|
317
|
-
let a, o,
|
|
318
|
-
return ({ slots:
|
|
319
|
-
let b =
|
|
320
|
-
return a || (a =
|
|
318
|
+
let a, o, d;
|
|
319
|
+
return ({ slots: f, props: p }, { modelValue: m, "onUpdate:modelValue": g, required: _, readonly: v, ...y }) => {
|
|
320
|
+
let b = W(p);
|
|
321
|
+
return a || (a = h([]), o = h([]), d = h([]), l().then((e) => {
|
|
321
322
|
a.value = e;
|
|
322
323
|
}), e().then((e) => {
|
|
323
324
|
o.value = e;
|
|
324
325
|
}), i().then((e) => {
|
|
325
|
-
|
|
326
|
-
})), v ?
|
|
327
|
-
value:
|
|
326
|
+
d.value = e;
|
|
327
|
+
})), v ? c(t, {
|
|
328
|
+
value: m,
|
|
328
329
|
multiple: b.multiple,
|
|
329
|
-
getUsersByUsername:
|
|
330
|
+
getUsersByUsername: l,
|
|
330
331
|
renderInfo: b.renderInfo
|
|
331
|
-
}, null) :
|
|
332
|
+
}, null) : u(r, {
|
|
332
333
|
type: "user",
|
|
333
334
|
users: a.value,
|
|
334
|
-
depts:
|
|
335
|
+
depts: d.value,
|
|
335
336
|
groups: o.value,
|
|
336
337
|
getUsersByDept: s,
|
|
337
338
|
getUsersByGroup: n,
|
|
338
339
|
...b,
|
|
339
340
|
...y,
|
|
340
341
|
renderUserInfo: b.renderInfo,
|
|
341
|
-
modelValue:
|
|
342
|
+
modelValue: m,
|
|
342
343
|
"onUpdate:modelValue": g
|
|
343
|
-
},
|
|
344
|
+
}, f);
|
|
344
345
|
};
|
|
345
346
|
}
|
|
346
347
|
};
|
|
347
348
|
}
|
|
348
|
-
function
|
|
349
|
+
function q({ getDeptsByCode: e, getUsersByUsername: n, getFileInfos: r, previewFileUrl: a }) {
|
|
349
350
|
let o = (e) => (t, n, { params: r = {} }) => {
|
|
350
|
-
if (t != null) return
|
|
351
|
-
}, s = (e = {}) =>
|
|
351
|
+
if (t != null) return L(t, r.formatter ?? e);
|
|
352
|
+
}, s = (e = {}) => c("svg", f({
|
|
352
353
|
xmlns: "http://www.w3.org/2000/svg",
|
|
353
354
|
width: "1em",
|
|
354
355
|
height: "1em",
|
|
355
356
|
viewBox: "0 0 32 32"
|
|
356
|
-
}, e), [
|
|
357
|
+
}, e), [c("circle", {
|
|
357
358
|
cx: "16",
|
|
358
359
|
cy: "16",
|
|
359
360
|
r: "8",
|
|
360
361
|
fill: "currentColor"
|
|
361
|
-
}, null)]),
|
|
362
|
+
}, null)]), l = (e = {}) => c("svg", f({
|
|
362
363
|
xmlns: "http://www.w3.org/2000/svg",
|
|
363
364
|
width: "1em",
|
|
364
365
|
height: "1em",
|
|
365
366
|
viewBox: "0 0 24 24"
|
|
366
|
-
}, e), [
|
|
367
|
+
}, e), [c("path", {
|
|
367
368
|
fill: "currentColor",
|
|
368
369
|
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)]),
|
|
370
|
+
}, null)]), u = (e) => c("svg", f({
|
|
370
371
|
xmlns: "http://www.w3.org/2000/svg",
|
|
371
372
|
width: "1em",
|
|
372
373
|
height: "1em",
|
|
373
374
|
viewBox: "0 0 24 24"
|
|
374
|
-
}, e), [
|
|
375
|
+
}, e), [c("path", {
|
|
375
376
|
fill: "currentColor",
|
|
376
377
|
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)]),
|
|
378
|
+
}, null)]), d = (e) => c("svg", f({
|
|
378
379
|
xmlns: "http://www.w3.org/2000/svg",
|
|
379
380
|
width: "1em",
|
|
380
381
|
height: "1em",
|
|
381
382
|
viewBox: "0 0 24 24"
|
|
382
|
-
}, e), [
|
|
383
|
+
}, e), [c("path", {
|
|
383
384
|
fill: "currentColor",
|
|
384
385
|
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
386
|
}, null)]);
|
|
386
387
|
return {
|
|
387
388
|
longtext: () => {
|
|
388
|
-
let e =
|
|
389
|
+
let e = m(), t = m(), n = m(), { open: r } = z({
|
|
389
390
|
type: "drawer",
|
|
390
391
|
resizable: !0,
|
|
391
|
-
content: () =>
|
|
392
|
-
width:
|
|
393
|
-
footer: null,
|
|
392
|
+
content: () => c("div", null, [c("span", null, [e.value])]),
|
|
393
|
+
width: t,
|
|
394
|
+
footer: () => n.value?.() ?? null,
|
|
394
395
|
maskClosable: !0
|
|
395
|
-
}), { copy:
|
|
396
|
-
if (!
|
|
396
|
+
}), { copy: i, copied: a } = y({ legacy: !0 }), o = (t, n, o) => {
|
|
397
|
+
if (!n) return r(t);
|
|
397
398
|
let s = () => {
|
|
398
|
-
o ? o(e.value) :
|
|
399
|
+
o ? o(e.value) : i(e.value);
|
|
399
400
|
};
|
|
400
|
-
return
|
|
401
|
+
return r(() => c("div", { style: "display: flex; align-items: center; justify-content: space-between; margin-right: 4px;" }, [g(t), a.value ? c(b, {
|
|
401
402
|
quaternary: !0,
|
|
402
403
|
size: "tiny",
|
|
403
404
|
type: "success"
|
|
404
|
-
}, { icon: () =>
|
|
405
|
+
}, { icon: () => c(D, { size: 18 }, { default: () => [c(d, null, null)] }) }) : c(b, {
|
|
405
406
|
quaternary: !0,
|
|
406
407
|
size: "tiny",
|
|
407
408
|
onClick: s
|
|
408
|
-
}, { icon: () =>
|
|
409
|
+
}, { icon: () => c(D, { size: 16 }, { default: () => [c(u, null, null)] }) })]));
|
|
409
410
|
};
|
|
410
411
|
return {
|
|
411
|
-
renderer: (
|
|
412
|
+
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
413
|
type: "info",
|
|
413
414
|
text: !0,
|
|
414
415
|
style: "position: sticky; right: 0; z-index: 2",
|
|
415
|
-
onClick:
|
|
416
|
-
e.value =
|
|
416
|
+
onClick: a.showText ? () => a.showText(r) : () => {
|
|
417
|
+
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
418
|
}
|
|
418
|
-
}, { default: () => [
|
|
419
|
+
}, { default: () => [c(D, { size: 18 }, { default: () => [c(l, null, null)] })] })]),
|
|
419
420
|
default: { table: { ellipsis: !1 } }
|
|
420
421
|
};
|
|
421
422
|
},
|
|
@@ -439,16 +440,16 @@ function createDescriptionHelper({ getDeptsByCode: e, getUsersByUsername: n, get
|
|
|
439
440
|
let e, t, n;
|
|
440
441
|
return (r, i, { params: a = {} }) => {
|
|
441
442
|
if (r == null) return;
|
|
442
|
-
let { dictType: o, options:
|
|
443
|
-
if (
|
|
444
|
-
if (r = r.toString(),
|
|
445
|
-
let e =
|
|
443
|
+
let { dictType: o, options: l, multiple: u, statusMap: d } = W(a);
|
|
444
|
+
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) {
|
|
445
|
+
if (r = r.toString(), d && r in d) {
|
|
446
|
+
let e = d[r] ?? "default";
|
|
446
447
|
return [
|
|
447
448
|
"primary",
|
|
448
449
|
"success",
|
|
449
450
|
"warning",
|
|
450
451
|
"danger"
|
|
451
|
-
].includes(e) && (e = `var(--color-${e})`),
|
|
452
|
+
].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
453
|
}
|
|
453
454
|
return n.get(r)?.[a.labelField || "label"] ?? r ?? "";
|
|
454
455
|
}
|
|
@@ -478,34 +479,34 @@ function createDescriptionHelper({ getDeptsByCode: e, getUsersByUsername: n, get
|
|
|
478
479
|
sortable: !0
|
|
479
480
|
} }
|
|
480
481
|
}),
|
|
481
|
-
email: () => (e) =>
|
|
482
|
-
url: () => (e) =>
|
|
483
|
-
color: () => (e) =>
|
|
482
|
+
email: () => (e) => c("a", { href: `mailto:${e}` }, [e]),
|
|
483
|
+
url: () => (e) => c("a", { href: e }, [e]),
|
|
484
|
+
color: () => (e) => c(S, {
|
|
484
485
|
value: e,
|
|
485
486
|
disabled: !0,
|
|
486
487
|
size: "small"
|
|
487
488
|
}, null),
|
|
488
489
|
image: () => (e, t, { params: n = {} }) => {
|
|
489
490
|
let r;
|
|
490
|
-
return e ?
|
|
491
|
+
return e ? c(E, {
|
|
491
492
|
gap: "8",
|
|
492
493
|
wrap: !0
|
|
493
|
-
},
|
|
494
|
+
}, U(r = (Array.isArray(e) ? e : n?.multiple ? e.split(",") : [e]).map((e) => a(e)).map((e) => c("img", {
|
|
494
495
|
key: e,
|
|
495
496
|
src: e,
|
|
496
497
|
style: "max-height: 32px; max-width: 100px; object-fit: contain"
|
|
497
498
|
}, null))) ? r : { default: () => [r] }) : void 0;
|
|
498
499
|
},
|
|
499
500
|
file: () => {
|
|
500
|
-
let e =
|
|
501
|
+
let e = I();
|
|
501
502
|
return (t, n, { params: i = {} }) => {
|
|
502
503
|
let a;
|
|
503
504
|
return t ? (n.__file_urls ??= {}, n.__file_urls[e] || r(Array.isArray(t) ? t : i?.multiple ? t.split(",") : [t]).then((t) => {
|
|
504
505
|
n.__file_urls[e] = t;
|
|
505
|
-
}),
|
|
506
|
+
}), c(E, {
|
|
506
507
|
gap: "8",
|
|
507
508
|
wrap: !0
|
|
508
|
-
},
|
|
509
|
+
}, U(a = (n.__file_urls[e] || []).map((e) => c("a", {
|
|
509
510
|
key: e.id,
|
|
510
511
|
href: e.url,
|
|
511
512
|
target: "_blank",
|
|
@@ -515,7 +516,7 @@ function createDescriptionHelper({ getDeptsByCode: e, getUsersByUsername: n, get
|
|
|
515
516
|
};
|
|
516
517
|
},
|
|
517
518
|
dept: () => (t, n, { params: r = {} }) => {
|
|
518
|
-
if (t) return
|
|
519
|
+
if (t) return c(i, {
|
|
519
520
|
value: t,
|
|
520
521
|
multiple: r?.multiple,
|
|
521
522
|
getDeptsByCode: e
|
|
@@ -525,7 +526,7 @@ function createDescriptionHelper({ getDeptsByCode: e, getUsersByUsername: n, get
|
|
|
525
526
|
let e = { style: "padding-block: 0" };
|
|
526
527
|
return {
|
|
527
528
|
renderer: (e, r, { params: i = {} }) => {
|
|
528
|
-
if (e) return
|
|
529
|
+
if (e) return c(t, {
|
|
529
530
|
value: e,
|
|
530
531
|
multiple: i?.multiple,
|
|
531
532
|
getUsersByUsername: n
|
|
@@ -541,102 +542,102 @@ function createDescriptionHelper({ getDeptsByCode: e, getUsersByUsername: n, get
|
|
|
541
542
|
}
|
|
542
543
|
};
|
|
543
544
|
}
|
|
544
|
-
function
|
|
545
|
-
return () => ({ items: e, model: t, handleSubmit: r, reset: i, validation: a, readonly: o, inModal: s, showFeedback:
|
|
545
|
+
function J() {
|
|
546
|
+
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
547
|
readonly: o,
|
|
547
548
|
model: t,
|
|
548
549
|
items: e,
|
|
549
550
|
validation: a,
|
|
550
|
-
showColon:
|
|
551
|
-
labelWidth:
|
|
552
|
-
labelAlign:
|
|
553
|
-
labelPlacement:
|
|
554
|
-
showRequireMark:
|
|
555
|
-
requireMarkPlacement:
|
|
556
|
-
showFeedback:
|
|
551
|
+
showColon: _(u) ?? !0,
|
|
552
|
+
labelWidth: _(d),
|
|
553
|
+
labelAlign: _(f),
|
|
554
|
+
labelPlacement: _(p),
|
|
555
|
+
showRequireMark: _(m),
|
|
556
|
+
requireMarkPlacement: _(h),
|
|
557
|
+
showFeedback: _(l) ?? !0,
|
|
557
558
|
showAction: !1,
|
|
558
559
|
onSubmit: r,
|
|
559
560
|
onReset: i,
|
|
560
561
|
style: s ? "padding-right: 2rem; padding-top: 1rem" : void 0
|
|
561
562
|
}, null);
|
|
562
563
|
}
|
|
563
|
-
function
|
|
564
|
+
function Y() {
|
|
564
565
|
let e = (e) => typeof e == "number" ? `${e}px` : e, t = {
|
|
565
566
|
maxHeight: "calc(100vh - 130px)",
|
|
566
567
|
display: "flex",
|
|
567
568
|
flexDirection: "column"
|
|
568
569
|
}, n = { content: !0 };
|
|
569
|
-
return () => ({ type: r = "dialog", visible: i, title: a, content: o, footer: s, placement:
|
|
570
|
-
let
|
|
570
|
+
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 }) => {
|
|
571
|
+
let z = s ? () => s : s === null ? null : () => c(E, {
|
|
571
572
|
justify: "end",
|
|
572
573
|
gap: "16"
|
|
573
|
-
}, { default: () => [
|
|
574
|
+
}, { default: () => [P === null ? void 0 : c(b, {
|
|
574
575
|
onClick: S,
|
|
575
|
-
disabled:
|
|
576
|
-
loading:
|
|
576
|
+
disabled: F,
|
|
577
|
+
loading: I,
|
|
577
578
|
style: "min-width: 60px"
|
|
578
|
-
},
|
|
579
|
+
}, U(P) ? P : { default: () => [P] }), k === null ? void 0 : c(b, {
|
|
579
580
|
type: "primary",
|
|
580
581
|
onClick: C,
|
|
581
|
-
disabled:
|
|
582
|
-
loading:
|
|
582
|
+
disabled: M,
|
|
583
|
+
loading: N,
|
|
583
584
|
style: "min-width: 60px"
|
|
584
|
-
},
|
|
585
|
+
}, U(k) ? k : { default: () => [k] })] });
|
|
585
586
|
if (r === "dialog") {
|
|
586
|
-
let { style: r } =
|
|
587
|
+
let { style: r } = f({ style: {
|
|
587
588
|
width: e(_ ?? 520),
|
|
588
589
|
height: e(v)
|
|
589
590
|
} }, { style: y });
|
|
590
|
-
return
|
|
591
|
+
return c(A, f({
|
|
591
592
|
show: i,
|
|
592
593
|
preset: "card",
|
|
593
594
|
title: () => a,
|
|
594
595
|
maskClosable: g ?? !1,
|
|
595
|
-
closeOnEsc:
|
|
596
|
-
closable:
|
|
596
|
+
closeOnEsc: p,
|
|
597
|
+
closable: m,
|
|
597
598
|
onClose: x,
|
|
598
599
|
segmented: n,
|
|
599
600
|
size: "small",
|
|
600
|
-
onAfterEnter:
|
|
601
|
-
onAfterLeave:
|
|
601
|
+
onAfterEnter: O,
|
|
602
|
+
onAfterLeave: D,
|
|
602
603
|
onUpdateShow: x,
|
|
603
|
-
draggable:
|
|
604
|
+
draggable: d ?? !0,
|
|
604
605
|
style: r,
|
|
605
606
|
contentStyle: t
|
|
606
|
-
},
|
|
607
|
-
default: () =>
|
|
607
|
+
}, R), {
|
|
608
|
+
default: () => c(j, {
|
|
608
609
|
abstract: !0,
|
|
609
610
|
style: "display: flex; flex-direction: column"
|
|
610
|
-
},
|
|
611
|
-
action:
|
|
611
|
+
}, U(o) ? o : { default: () => [o] }),
|
|
612
|
+
action: z
|
|
612
613
|
});
|
|
613
614
|
}
|
|
614
|
-
let { bodyContentClass:
|
|
615
|
-
return
|
|
615
|
+
let { bodyContentClass: B, bodyContentStyle: V, ...H } = R;
|
|
616
|
+
return c(w, f({
|
|
616
617
|
show: i,
|
|
617
618
|
trapFocus: !1,
|
|
618
|
-
closeOnEsc:
|
|
619
|
-
showMask:
|
|
619
|
+
closeOnEsc: p,
|
|
620
|
+
showMask: h,
|
|
620
621
|
maskClosable: g,
|
|
621
|
-
resizable:
|
|
622
|
-
placement:
|
|
623
|
-
width:
|
|
624
|
-
defaultWidth:
|
|
622
|
+
resizable: u,
|
|
623
|
+
placement: l,
|
|
624
|
+
width: u ? void 0 : _ ?? 440,
|
|
625
|
+
defaultWidth: u ? _ ?? 440 : void 0,
|
|
625
626
|
height: v,
|
|
626
627
|
onUpdateShow: x,
|
|
627
|
-
onAfterEnter:
|
|
628
|
-
onAfterLeave:
|
|
628
|
+
onAfterEnter: O,
|
|
629
|
+
onAfterLeave: D,
|
|
629
630
|
style: y
|
|
630
|
-
},
|
|
631
|
-
closable:
|
|
632
|
-
nativeScrollbar:
|
|
633
|
-
bodyContentClass:
|
|
634
|
-
bodyContentStyle:
|
|
631
|
+
}, H), { default: () => [c(T, {
|
|
632
|
+
closable: m,
|
|
633
|
+
nativeScrollbar: L ?? !1,
|
|
634
|
+
bodyContentClass: B,
|
|
635
|
+
bodyContentStyle: V
|
|
635
636
|
}, {
|
|
636
637
|
default: () => o,
|
|
637
638
|
header: () => a,
|
|
638
|
-
footer:
|
|
639
|
+
footer: z
|
|
639
640
|
})] });
|
|
640
641
|
};
|
|
641
642
|
}
|
|
642
|
-
export { createDescriptionHelper, createFormHelper, createModalHelper, createPageFormHelper };
|
|
643
|
+
export { q as createDescriptionHelper, J as createFormHelper, Y as createModalHelper, K as createPageFormHelper };
|