@maxtan/ez-ui 0.24.0 → 1.0.1
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/README.md +108 -7
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +1161 -778
- package/dist/types/index.d.ts +871 -247
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,36 +1,44 @@
|
|
|
1
|
-
import { useAttrs as
|
|
2
|
-
import { useLocale as
|
|
3
|
-
const
|
|
4
|
-
for (const
|
|
5
|
-
|
|
6
|
-
}, e)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import { useAttrs as Ze, computed as U, defineComponent as x, mergeModels as _, useModel as ee, createBlock as g, openBlock as r, unref as l, mergeProps as S, withCtx as k, createElementBlock as C, Fragment as X, renderList as ie, resolveDynamicComponent as De, createTextVNode as he, toDisplayString as de, resolveDirective as Je, renderSlot as R, createCommentVNode as O, withDirectives as _e, createElementVNode as Y, ref as G, createVNode as W, withModifiers as Be, normalizeStyle as we, createSlots as Se, useSlots as ct, shallowRef as Ue, watch as ye, onMounted as Me, normalizeClass as Ae, nextTick as Pe, onUnmounted as ft, normalizeProps as ze, guardReactiveProps as Fe } from "vue";
|
|
2
|
+
import { useLocale as mt, ElCheckbox as et, ElCheckboxButton as pt, ElCheckboxGroup as vt, ElLoading as Re, ElDialog as gt, ElButton as be, ElSelect as yt, ElOptionGroup as bt, ElOption as Ne, ElRadio as ht, ElRadioButton as Et, ElRadioGroup as Vt, ElUpload as Le, ElImage as qe, ElImageViewer as $t, ElMessage as ge, ElFormItem as wt, ElInput as xe, ElInputNumber as St, ElDatePicker as Ce, ElTimePicker as He, ElSwitch as kt, ElTreeSelect as zt, ElCascader as Ct, ElSlider as At, ElRate as Dt, ElForm as xt, ElRow as Ut, ElCol as Pt, ElTable as Tt, ElTableColumn as Ge, ElPagination as Mt, ElDrawer as Rt, ElInfiniteScroll as It, ElMessageBox as Ot, ElNotification as Bt, ElPopoverDirective as Ft } from "element-plus";
|
|
3
|
+
const te = (e, s) => (e.install = (t) => {
|
|
4
|
+
for (const a of [e, ...Object.values({})])
|
|
5
|
+
a.name ? t.component(a.name, a) : process.env.NODE_ENV !== "production" && console.warn("[withInstall] Component is missing name property:", a);
|
|
6
|
+
}, e), Ke = (e) => e.replace(/\B([A-Z])/g, "-$1").toLowerCase(), je = (e) => e.replace(/-([a-z])/g, (s, t) => t.toUpperCase()), Nt = (e) => {
|
|
7
|
+
const s = e.startsWith("onUpdate:") ? e.slice(9) : e, t = /* @__PURE__ */ new Set([e, s, Ke(s), je(s)]);
|
|
8
|
+
return e.startsWith("onUpdate:") || (t.add(`onUpdate:${s}`), t.add(`onUpdate:${Ke(s)}`), t.add(`onUpdate:${je(s)}`)), t;
|
|
9
|
+
}, Lt = (e, s) => {
|
|
10
|
+
for (const t of e)
|
|
11
|
+
if (Nt(t).has(s))
|
|
12
|
+
return !0;
|
|
13
|
+
return !1;
|
|
14
|
+
};
|
|
15
|
+
function Ee(e = []) {
|
|
16
|
+
const s = Ze(), t = U(() => {
|
|
17
|
+
const o = {};
|
|
18
|
+
for (const c in s)
|
|
19
|
+
Lt(e, c) || (o[c] = s[c]);
|
|
20
|
+
return o;
|
|
21
|
+
}), a = U(() => {
|
|
22
|
+
const o = {};
|
|
23
|
+
for (const c in t.value)
|
|
24
|
+
c.startsWith("on") || (o[c] = t.value[c]);
|
|
25
|
+
return o;
|
|
26
|
+
}), i = U(() => {
|
|
27
|
+
const o = {};
|
|
28
|
+
for (const c in t.value)
|
|
29
|
+
c.startsWith("on") && (o[c] = t.value[c]);
|
|
30
|
+
return o;
|
|
23
31
|
});
|
|
24
32
|
return {
|
|
25
33
|
/** 所有过滤后的属性(包括事件) */
|
|
26
|
-
attrs:
|
|
34
|
+
attrs: t,
|
|
27
35
|
/** 只包含普通属性 */
|
|
28
|
-
props:
|
|
36
|
+
props: a,
|
|
29
37
|
/** 只包含事件监听器 */
|
|
30
|
-
listeners:
|
|
38
|
+
listeners: i
|
|
31
39
|
};
|
|
32
40
|
}
|
|
33
|
-
var
|
|
41
|
+
var qt = {
|
|
34
42
|
s: {
|
|
35
43
|
label: {
|
|
36
44
|
name: "姓名",
|
|
@@ -110,39 +118,51 @@ var hl = {
|
|
|
110
118
|
}
|
|
111
119
|
}
|
|
112
120
|
};
|
|
113
|
-
const { s:
|
|
114
|
-
function
|
|
115
|
-
return
|
|
121
|
+
const { s: Ht } = qt;
|
|
122
|
+
function Gt(e, s) {
|
|
123
|
+
return s.split(".").reduce((t, a) => t && typeof t == "object" ? t[a] : void 0, e);
|
|
116
124
|
}
|
|
117
|
-
function
|
|
118
|
-
return e.replace(/\{\s*(\w+)\s*\}/g, (
|
|
119
|
-
const
|
|
120
|
-
return
|
|
125
|
+
function Kt(e, s = {}) {
|
|
126
|
+
return e.replace(/\{\s*(\w+)\s*\}/g, (t, a) => {
|
|
127
|
+
const i = s[a];
|
|
128
|
+
return i !== void 0 ? String(i) : `{${a}}`;
|
|
121
129
|
});
|
|
122
130
|
}
|
|
123
|
-
function
|
|
124
|
-
const { t: e, lang:
|
|
131
|
+
function ke() {
|
|
132
|
+
const { t: e, lang: s } = mt();
|
|
125
133
|
return {
|
|
126
|
-
t: (
|
|
127
|
-
const
|
|
128
|
-
if (
|
|
129
|
-
const
|
|
130
|
-
return typeof
|
|
134
|
+
t: (a, i = {}) => {
|
|
135
|
+
const o = e(a, i);
|
|
136
|
+
if (o !== a) return o;
|
|
137
|
+
const c = Gt({ s: Ht }, a);
|
|
138
|
+
return typeof c == "string" ? Kt(c, i) : a;
|
|
131
139
|
},
|
|
132
|
-
lang:
|
|
140
|
+
lang: s
|
|
133
141
|
};
|
|
134
142
|
}
|
|
135
|
-
function
|
|
136
|
-
|
|
137
|
-
return
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
143
|
+
function j(e) {
|
|
144
|
+
if (e === null || typeof e != "object") return e;
|
|
145
|
+
if (e instanceof Date) return new Date(e.getTime());
|
|
146
|
+
if (e instanceof Array) return e.map((t) => j(t));
|
|
147
|
+
if (e instanceof Set) return new Set(Array.from(e).map((t) => j(t)));
|
|
148
|
+
if (e instanceof Map)
|
|
149
|
+
return new Map(Array.from(e.entries()).map(([t, a]) => [j(t), j(a)]));
|
|
150
|
+
const s = Object.create(Object.getPrototypeOf(e));
|
|
151
|
+
for (const t in e)
|
|
152
|
+
e.hasOwnProperty(t) && (s[t] = j(e[t]));
|
|
153
|
+
return s;
|
|
154
|
+
}
|
|
155
|
+
function jt(e, s = 200) {
|
|
156
|
+
let t = null;
|
|
157
|
+
return function(...a) {
|
|
158
|
+
t || (t = setTimeout(() => {
|
|
159
|
+
e.apply(this, a), t = null;
|
|
160
|
+
}, s));
|
|
141
161
|
};
|
|
142
162
|
}
|
|
143
|
-
const
|
|
144
|
-
...
|
|
145
|
-
props: /* @__PURE__ */
|
|
163
|
+
const Wt = x({ name: "EzCheckbox", inheritAttrs: !1 }), Yt = /* @__PURE__ */ x({
|
|
164
|
+
...Wt,
|
|
165
|
+
props: /* @__PURE__ */ _({
|
|
146
166
|
type: { default: "default" },
|
|
147
167
|
options: { default: () => [] }
|
|
148
168
|
}, {
|
|
@@ -151,22 +171,22 @@ const kl = V({ name: "EzCheckbox", inheritAttrs: !1 }), zl = /* @__PURE__ */ V({
|
|
|
151
171
|
}),
|
|
152
172
|
emits: ["update:modelValue"],
|
|
153
173
|
setup(e) {
|
|
154
|
-
const
|
|
155
|
-
() => ["default", "border"].includes(
|
|
174
|
+
const s = e, t = ee(e, "modelValue"), { attrs: a } = Ee(["options", "type", "modelValue"]), i = U(
|
|
175
|
+
() => ["default", "border"].includes(s.type) ? et : pt
|
|
156
176
|
);
|
|
157
|
-
return (
|
|
158
|
-
modelValue:
|
|
159
|
-
"onUpdate:modelValue":
|
|
160
|
-
},
|
|
161
|
-
default:
|
|
162
|
-
(
|
|
163
|
-
key: String(
|
|
177
|
+
return (o, c) => (r(), g(l(vt), S({
|
|
178
|
+
modelValue: t.value,
|
|
179
|
+
"onUpdate:modelValue": c[0] || (c[0] = (h) => t.value = h)
|
|
180
|
+
}, l(a)), {
|
|
181
|
+
default: k(() => [
|
|
182
|
+
(r(!0), C(X, null, ie(e.options, (h) => (r(), g(De(i.value), S({
|
|
183
|
+
key: String(h.value),
|
|
164
184
|
ref_for: !0
|
|
165
|
-
},
|
|
185
|
+
}, h, {
|
|
166
186
|
border: e.type === "border"
|
|
167
187
|
}), {
|
|
168
|
-
default:
|
|
169
|
-
|
|
188
|
+
default: k(() => [
|
|
189
|
+
he(de(h.label), 1)
|
|
170
190
|
]),
|
|
171
191
|
_: 2
|
|
172
192
|
}, 1040, ["border"]))), 128))
|
|
@@ -174,122 +194,121 @@ const kl = V({ name: "EzCheckbox", inheritAttrs: !1 }), zl = /* @__PURE__ */ V({
|
|
|
174
194
|
_: 1
|
|
175
195
|
}, 16, ["modelValue"]));
|
|
176
196
|
}
|
|
177
|
-
}),
|
|
178
|
-
var
|
|
179
|
-
const
|
|
197
|
+
}), tt = te(Yt);
|
|
198
|
+
var $e = /* @__PURE__ */ ((e) => (e.CANCEL = "取消", e.CONFIRM = "确定", e))($e || {});
|
|
199
|
+
const Qt = { key: 1 }, Xt = {
|
|
180
200
|
key: 0,
|
|
181
201
|
class: "ez-dialog__body"
|
|
182
|
-
},
|
|
183
|
-
...
|
|
184
|
-
props: /* @__PURE__ */
|
|
202
|
+
}, Zt = { key: 1 }, Jt = x({ name: "EzDialog", inheritAttrs: !1, directives: { loading: Re.directive } }), _t = /* @__PURE__ */ x({
|
|
203
|
+
...Jt,
|
|
204
|
+
props: /* @__PURE__ */ _({
|
|
185
205
|
title: { default: "" },
|
|
186
206
|
loading: { type: Boolean, default: !1 },
|
|
187
|
-
cancelText: { default:
|
|
188
|
-
confirmText: { default:
|
|
207
|
+
cancelText: { default: $e.CANCEL },
|
|
208
|
+
confirmText: { default: $e.CONFIRM }
|
|
189
209
|
}, {
|
|
190
|
-
modelValue: { type: Boolean },
|
|
210
|
+
modelValue: { type: Boolean, default: !1 },
|
|
191
211
|
modelModifiers: {}
|
|
192
212
|
}),
|
|
193
|
-
emits: /* @__PURE__ */
|
|
194
|
-
setup(e, { emit:
|
|
195
|
-
const { t
|
|
196
|
-
|
|
197
|
-
},
|
|
198
|
-
|
|
213
|
+
emits: /* @__PURE__ */ _(["cancel", "confirm"], ["update:modelValue"]),
|
|
214
|
+
setup(e, { emit: s }) {
|
|
215
|
+
const { t } = ke(), a = e, i = s, o = ee(e, "modelValue"), { attrs: c } = Ee(["title", "loading", "cancelText", "confirmText", "modelValue"]), h = () => {
|
|
216
|
+
o.value = !1, i("cancel");
|
|
217
|
+
}, V = () => {
|
|
218
|
+
i("confirm");
|
|
199
219
|
};
|
|
200
|
-
return (
|
|
201
|
-
const
|
|
202
|
-
return
|
|
203
|
-
modelValue:
|
|
204
|
-
"onUpdate:modelValue":
|
|
220
|
+
return (y, E) => {
|
|
221
|
+
const D = Je("loading");
|
|
222
|
+
return r(), g(l(gt), S({
|
|
223
|
+
modelValue: o.value,
|
|
224
|
+
"onUpdate:modelValue": E[0] || (E[0] = (H) => o.value = H),
|
|
205
225
|
class: "ez-dialog",
|
|
206
226
|
width: 800,
|
|
207
227
|
"append-to-body": !1,
|
|
208
228
|
"close-on-click-modal": !1,
|
|
209
229
|
"destroy-on-close": !0,
|
|
210
230
|
"close-on-press-escape": !1
|
|
211
|
-
},
|
|
212
|
-
header:
|
|
213
|
-
|
|
231
|
+
}, l(c)), {
|
|
232
|
+
header: k(() => [
|
|
233
|
+
y.$slots.header ? R(y.$slots, "header", { key: 0 }) : (r(), C("p", Qt, de(a.title), 1))
|
|
214
234
|
]),
|
|
215
|
-
default:
|
|
216
|
-
|
|
217
|
-
|
|
235
|
+
default: k(() => [
|
|
236
|
+
y.$slots.default ? _e((r(), C("div", Xt, [
|
|
237
|
+
R(y.$slots, "default")
|
|
218
238
|
])), [
|
|
219
|
-
[
|
|
220
|
-
]) :
|
|
239
|
+
[D, a.loading]
|
|
240
|
+
]) : O("", !0)
|
|
221
241
|
]),
|
|
222
|
-
footer:
|
|
223
|
-
|
|
224
|
-
|
|
242
|
+
footer: k(() => [
|
|
243
|
+
y.$slots.footer ? R(y.$slots, "footer", { key: 0 }) : (r(), C("div", Zt, [
|
|
244
|
+
a.cancelText ? (r(), g(l(be), {
|
|
225
245
|
key: 0,
|
|
226
246
|
type: "default",
|
|
227
|
-
onClick:
|
|
247
|
+
onClick: h
|
|
228
248
|
}, {
|
|
229
|
-
default:
|
|
230
|
-
|
|
249
|
+
default: k(() => [
|
|
250
|
+
he(de(a.cancelText === l($e).CANCEL ? l(t)("s.button.cancel") : a.cancelText), 1)
|
|
231
251
|
]),
|
|
232
252
|
_: 1
|
|
233
|
-
})) :
|
|
234
|
-
|
|
253
|
+
})) : O("", !0),
|
|
254
|
+
a.confirmText ? (r(), g(l(be), {
|
|
235
255
|
key: 1,
|
|
236
256
|
type: "primary",
|
|
237
|
-
loading:
|
|
238
|
-
onClick:
|
|
257
|
+
loading: a.loading,
|
|
258
|
+
onClick: V
|
|
239
259
|
}, {
|
|
240
|
-
default:
|
|
241
|
-
|
|
260
|
+
default: k(() => [
|
|
261
|
+
he(de(a.confirmText === l($e).CONFIRM ? l(t)("s.button.confirm") : a.confirmText), 1)
|
|
242
262
|
]),
|
|
243
263
|
_: 1
|
|
244
|
-
}, 8, ["loading"])) :
|
|
264
|
+
}, 8, ["loading"])) : O("", !0)
|
|
245
265
|
]))
|
|
246
266
|
]),
|
|
247
267
|
_: 3
|
|
248
268
|
}, 16, ["modelValue"]);
|
|
249
269
|
};
|
|
250
270
|
}
|
|
251
|
-
}),
|
|
252
|
-
...
|
|
253
|
-
props: /* @__PURE__ */
|
|
271
|
+
}), ea = te(_t), ta = x({ name: "EzSelect", inheritAttrs: !1 }), aa = /* @__PURE__ */ x({
|
|
272
|
+
...ta,
|
|
273
|
+
props: /* @__PURE__ */ _({
|
|
254
274
|
options: { default: () => [] }
|
|
255
275
|
}, {
|
|
256
|
-
modelValue: {},
|
|
276
|
+
modelValue: { type: [String, Number, Boolean, Object, Array] },
|
|
257
277
|
modelModifiers: {}
|
|
258
278
|
}),
|
|
259
279
|
emits: ["update:modelValue"],
|
|
260
280
|
setup(e) {
|
|
261
|
-
const
|
|
262
|
-
return (
|
|
263
|
-
modelValue:
|
|
264
|
-
"onUpdate:modelValue":
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
key: f(u, r)
|
|
281
|
+
const s = ee(e, "modelValue"), { attrs: t } = Ee(["options", "modelValue"]), a = (c) => typeof c > "u", i = (c) => !a(c.options), o = (c, h) => i(c) ? `group-${c.label}-${h}` : c.value != null && typeof c.value != "object" ? String(c.value) : `option-${h}`;
|
|
282
|
+
return (c, h) => (r(), g(l(yt), S({
|
|
283
|
+
modelValue: s.value,
|
|
284
|
+
"onUpdate:modelValue": h[0] || (h[0] = (V) => s.value = V)
|
|
285
|
+
}, l(t)), {
|
|
286
|
+
default: k(() => [
|
|
287
|
+
(r(!0), C(X, null, ie(e.options, (V, y) => (r(), C(X, {
|
|
288
|
+
key: o(V, y)
|
|
270
289
|
}, [
|
|
271
|
-
|
|
290
|
+
i(V) ? (r(), g(l(bt), S({
|
|
272
291
|
key: 0,
|
|
273
292
|
ref_for: !0
|
|
274
|
-
},
|
|
275
|
-
default:
|
|
276
|
-
(
|
|
277
|
-
key:
|
|
278
|
-
}, { ref_for: !0 },
|
|
293
|
+
}, V), {
|
|
294
|
+
default: k(() => [
|
|
295
|
+
(r(!0), C(X, null, ie(V.options, (E, D) => (r(), g(l(Ne), S({
|
|
296
|
+
key: o(E, D)
|
|
297
|
+
}, { ref_for: !0 }, E), null, 16))), 128))
|
|
279
298
|
]),
|
|
280
299
|
_: 2
|
|
281
|
-
}, 1040)) : (
|
|
300
|
+
}, 1040)) : (r(), g(l(Ne), S({
|
|
282
301
|
key: 1,
|
|
283
302
|
ref_for: !0
|
|
284
|
-
},
|
|
303
|
+
}, V), null, 16))
|
|
285
304
|
], 64))), 128))
|
|
286
305
|
]),
|
|
287
306
|
_: 1
|
|
288
307
|
}, 16, ["modelValue"]));
|
|
289
308
|
}
|
|
290
|
-
}),
|
|
291
|
-
...
|
|
292
|
-
props: /* @__PURE__ */
|
|
309
|
+
}), at = te(aa), la = x({ name: "EzRadio", inheritAttrs: !1 }), oa = /* @__PURE__ */ x({
|
|
310
|
+
...la,
|
|
311
|
+
props: /* @__PURE__ */ _({
|
|
293
312
|
type: { default: "default" },
|
|
294
313
|
options: { default: () => [] }
|
|
295
314
|
}, {
|
|
@@ -298,20 +317,20 @@ const Cl = { key: 1 }, Sl = {
|
|
|
298
317
|
}),
|
|
299
318
|
emits: ["update:modelValue"],
|
|
300
319
|
setup(e) {
|
|
301
|
-
const
|
|
302
|
-
return (
|
|
303
|
-
modelValue:
|
|
304
|
-
"onUpdate:modelValue":
|
|
305
|
-
},
|
|
306
|
-
default:
|
|
307
|
-
(
|
|
308
|
-
key: String(
|
|
320
|
+
const s = e, t = ee(e, "modelValue"), { attrs: a } = Ee(["options", "type", "modelValue"]), i = U(() => ["default", "border"].includes(s.type) ? ht : Et);
|
|
321
|
+
return (o, c) => (r(), g(l(Vt), S({
|
|
322
|
+
modelValue: t.value,
|
|
323
|
+
"onUpdate:modelValue": c[0] || (c[0] = (h) => t.value = h)
|
|
324
|
+
}, l(a)), {
|
|
325
|
+
default: k(() => [
|
|
326
|
+
(r(!0), C(X, null, ie(e.options, (h) => (r(), g(De(i.value), S({
|
|
327
|
+
key: String(h.value),
|
|
309
328
|
ref_for: !0
|
|
310
|
-
},
|
|
329
|
+
}, h, {
|
|
311
330
|
border: e.type === "border"
|
|
312
331
|
}), {
|
|
313
|
-
default:
|
|
314
|
-
|
|
332
|
+
default: k(() => [
|
|
333
|
+
he(de(h.label), 1)
|
|
315
334
|
]),
|
|
316
335
|
_: 2
|
|
317
336
|
}, 1040, ["border"]))), 128))
|
|
@@ -319,136 +338,139 @@ const Cl = { key: 1 }, Sl = {
|
|
|
319
338
|
_: 1
|
|
320
339
|
}, 16, ["modelValue"]));
|
|
321
340
|
}
|
|
322
|
-
}),
|
|
323
|
-
...
|
|
341
|
+
}), lt = te(oa), na = x({ name: "EzIcon", inheritAttrs: !1 }), ra = /* @__PURE__ */ x({
|
|
342
|
+
...na,
|
|
324
343
|
props: {
|
|
325
344
|
size: { default: 20 },
|
|
326
345
|
color: { default: "inherit" }
|
|
327
346
|
},
|
|
328
347
|
setup(e) {
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
348
|
+
const s = e, t = (i) => {
|
|
349
|
+
if (!(i == null || i === ""))
|
|
350
|
+
return typeof i == "number" ? `${i}px` : i;
|
|
351
|
+
}, a = U(() => {
|
|
352
|
+
const { size: i, color: o } = s;
|
|
353
|
+
return !i && !o ? {} : {
|
|
354
|
+
fontSize: t(i),
|
|
355
|
+
color: o
|
|
334
356
|
};
|
|
335
357
|
});
|
|
336
|
-
return (
|
|
358
|
+
return (i, o) => (r(), C("i", S({
|
|
337
359
|
class: "ez-icon",
|
|
338
|
-
style:
|
|
339
|
-
},
|
|
340
|
-
|
|
360
|
+
style: a.value
|
|
361
|
+
}, i.$attrs), [
|
|
362
|
+
R(i.$slots, "default", { class: "w-[1em] h-[1em]" })
|
|
341
363
|
], 16));
|
|
342
364
|
}
|
|
343
|
-
}),
|
|
365
|
+
}), me = te(ra), sa = {
|
|
344
366
|
xmlns: "http://www.w3.org/2000/svg",
|
|
345
367
|
width: "200",
|
|
346
368
|
height: "200",
|
|
347
369
|
viewBox: "0 0 1024 1024"
|
|
348
|
-
},
|
|
370
|
+
}, ia = /* @__PURE__ */ x({
|
|
349
371
|
name: "ArrowDown",
|
|
350
372
|
__name: "ArrowDown",
|
|
351
373
|
setup(e) {
|
|
352
|
-
return (
|
|
353
|
-
|
|
374
|
+
return (s, t) => (r(), C("svg", sa, [...t[0] || (t[0] = [
|
|
375
|
+
Y("path", {
|
|
354
376
|
fill: "currentColor",
|
|
355
377
|
d: "m832 340.992-320 312-320-312a28.8 28.8 0 0 0-20.992-8.96 28.8 28.8 0 0 0-20.992 8.96 28.8 28.8 0 0 0-8.96 20.992c0 8 2.624 14.72 8 19.968l340.992 332.032c5.952 6.016 13.312 8.96 22.016 8.96 8.64 0 16-2.944 22.016-8.96l340.992-331.008a31.23 31.23 0 0 0 8-21.504c0-8.32-3.008-15.36-8.96-20.992a29.76 29.76 0 0 0-42.048.448v.064z"
|
|
356
378
|
}, null, -1)
|
|
357
379
|
])]));
|
|
358
380
|
}
|
|
359
|
-
}),
|
|
381
|
+
}), ua = {
|
|
360
382
|
xmlns: "http://www.w3.org/2000/svg",
|
|
361
383
|
width: "200",
|
|
362
384
|
height: "200",
|
|
363
385
|
viewBox: "0 0 1024 1024"
|
|
364
|
-
},
|
|
386
|
+
}, da = /* @__PURE__ */ x({
|
|
365
387
|
name: "ArrowUp",
|
|
366
388
|
__name: "ArrowUp",
|
|
367
389
|
setup(e) {
|
|
368
|
-
return (
|
|
369
|
-
|
|
390
|
+
return (s, t) => (r(), C("svg", ua, [...t[0] || (t[0] = [
|
|
391
|
+
Y("path", {
|
|
370
392
|
fill: "currentColor",
|
|
371
393
|
d: "M488.96 344 148.992 700.992a32.26 32.26 0 0 0-8.96 22.016c0 8 2.944 15.36 8.96 22.016v1.024c6.016 5.952 13.184 8.96 21.504 8.96S185.984 752 192 746.048l320-336 320 336c6.016 5.952 13.184 8.96 21.504 8.96s15.488-3.008 21.504-8.96v-1.024a32.26 32.26 0 0 0 8.96-22.016 32.26 32.26 0 0 0-8.96-22.016L534.976 344A31.17 31.17 0 0 0 512 335.04a31.17 31.17 0 0 0-23.04 8.96"
|
|
372
394
|
}, null, -1)
|
|
373
395
|
])]));
|
|
374
396
|
}
|
|
375
|
-
}),
|
|
397
|
+
}), ca = {
|
|
376
398
|
xmlns: "http://www.w3.org/2000/svg",
|
|
377
399
|
width: "200",
|
|
378
400
|
height: "200",
|
|
379
401
|
viewBox: "0 0 1024 1024"
|
|
380
|
-
},
|
|
402
|
+
}, We = /* @__PURE__ */ x({
|
|
381
403
|
name: "Delete",
|
|
382
404
|
__name: "delete",
|
|
383
405
|
setup(e) {
|
|
384
|
-
return (
|
|
385
|
-
|
|
406
|
+
return (s, t) => (r(), C("svg", ca, [...t[0] || (t[0] = [
|
|
407
|
+
Y("path", {
|
|
386
408
|
fill: "currentColor",
|
|
387
409
|
d: "M218.88 118.592C208 139.968 208 168 208 245.376V272H96a32 32 0 1 0 0 64h832a32 32 0 0 0 0-64H816v-26.624c0-77.44 0-105.408-10.88-126.72a100.03 100.03 0 0 0-43.712-43.776C740.032 64 712 64 634.624 64H389.376c-77.44 0-105.408 0-126.72 10.88-18.88 9.6-34.176 24.96-43.776 43.712M752 272H272v-64c0-28.032 0-42.304 5.568-52.992a50.24 50.24 0 0 1 21.44-21.44C309.76 128.064 323.968 128 352 128h320c28.032 0 42.304 0 52.992 5.568 9.152 4.736 16.64 12.288 21.44 21.44C751.936 165.696 752 179.968 752 208zM192 416a32 32 0 0 0-32 32v358.4c0 53.76.128 81.28 10.688 101.76a96.54 96.54 0 0 0 41.216 41.152C232.384 959.872 259.84 960 313.6 960h396.8c53.76 0 81.28-.128 101.76-10.688a96.54 96.54 0 0 0 41.152-41.216C863.872 887.616 864 860.16 864 806.4V448a32 32 0 0 0-64 0v371.2c0 26.88 0 40.64-5.376 50.88a48.2 48.2 0 0 1-20.544 20.544c-10.24 5.312-24 5.376-50.88 5.376H300.8c-26.88 0-40.64 0-50.88-5.376a48.2 48.2 0 0 1-20.544-20.544c-5.312-10.24-5.376-24-5.376-50.88V448a32 32 0 0 0-32-32m216 0a32 32 0 0 0-32 32v320a32 32 0 0 0 64 0V448a32 32 0 0 0-32-32m208 0a32 32 0 0 0-32 32v320a32 32 0 0 0 64 0V448a32 32 0 0 0-32-32"
|
|
388
410
|
}, null, -1)
|
|
389
411
|
])]));
|
|
390
412
|
}
|
|
391
|
-
}),
|
|
413
|
+
}), fa = {
|
|
392
414
|
xmlns: "http://www.w3.org/2000/svg",
|
|
393
415
|
width: "200",
|
|
394
416
|
height: "200",
|
|
395
417
|
viewBox: "0 0 1024 1024"
|
|
396
|
-
},
|
|
418
|
+
}, Ye = /* @__PURE__ */ x({
|
|
397
419
|
name: "Plus",
|
|
398
420
|
__name: "plus",
|
|
399
421
|
setup(e) {
|
|
400
|
-
return (
|
|
401
|
-
|
|
422
|
+
return (s, t) => (r(), C("svg", fa, [...t[0] || (t[0] = [
|
|
423
|
+
Y("path", {
|
|
402
424
|
fill: "currentColor",
|
|
403
425
|
d: "M512 96a32 32 0 0 0-32 32v352H128a32 32 0 1 0 0 64h352v352a32 32 0 0 0 64 0V544h352a32 32 0 0 0 0-64H544V128a32 32 0 0 0-32-32"
|
|
404
426
|
}, null, -1)
|
|
405
427
|
])]));
|
|
406
428
|
}
|
|
407
|
-
}),
|
|
429
|
+
}), ma = {
|
|
408
430
|
xmlns: "http://www.w3.org/2000/svg",
|
|
409
431
|
width: "200",
|
|
410
432
|
height: "200",
|
|
411
433
|
viewBox: "0 0 1024 1024"
|
|
412
|
-
},
|
|
434
|
+
}, pa = /* @__PURE__ */ x({
|
|
413
435
|
name: "Setting",
|
|
414
436
|
__name: "setting",
|
|
415
437
|
setup(e) {
|
|
416
|
-
return (
|
|
417
|
-
|
|
438
|
+
return (s, t) => (r(), C("svg", ma, [...t[0] || (t[0] = [
|
|
439
|
+
Y("path", {
|
|
418
440
|
fill: "currentColor",
|
|
419
441
|
d: "M218.688 848q27.712 48 83.2 48h374.08q55.424 0 83.136-48l187.008-323.968q27.776-48 0-96L759.104 104.064q-27.712-48-83.2-48H301.952q-55.488 0-83.2 48L31.68 428.032q-27.712 48 0 96zm55.424-32L87.104 492.032q-9.216-16 0-32l187.008-323.968q9.28-16 27.776-16h374.08q18.432 0 27.712 16l187.008 323.968q9.28 16 0 32L703.68 816q-9.28 16-27.712 16h-374.08q-18.56 0-27.776-16m54.784-339.968a160 160 0 1 0 320 0 160 160 0 0 0-320 0m64 0a96 96 0 1 1 192 0 96 96 0 0 1-192 0"
|
|
420
442
|
}, null, -1)
|
|
421
443
|
])]));
|
|
422
444
|
}
|
|
423
|
-
}),
|
|
445
|
+
}), va = {
|
|
424
446
|
xmlns: "http://www.w3.org/2000/svg",
|
|
425
447
|
width: "200",
|
|
426
448
|
height: "200",
|
|
427
449
|
viewBox: "0 0 1024 1024"
|
|
428
|
-
},
|
|
450
|
+
}, Qe = /* @__PURE__ */ x({
|
|
429
451
|
name: "ZoomIn",
|
|
430
452
|
__name: "ZoomIn",
|
|
431
453
|
setup(e) {
|
|
432
|
-
return (
|
|
433
|
-
|
|
454
|
+
return (s, t) => (r(), C("svg", va, [...t[0] || (t[0] = [
|
|
455
|
+
Y("path", {
|
|
434
456
|
fill: "currentColor",
|
|
435
457
|
d: "M764.352 809.6a424 424 0 1 1 45.184-45.184l139.456 139.392a31.936 31.936 0 1 1-45.184 45.184L764.352 809.536zM848 488a360 360 0 1 0-720 0 360 360 0 0 0 720 0"
|
|
436
458
|
}, null, -1),
|
|
437
|
-
|
|
459
|
+
Y("path", {
|
|
438
460
|
fill: "currentColor",
|
|
439
461
|
d: "M294.4 486.4a32 32 0 0 0 32 32h128v128a32 32 0 0 0 64 0v-128h128a32 32 0 0 0 0-64h-128v-128a32 32 0 0 0-64 0v128h-128a32 32 0 0 0-32 32"
|
|
440
462
|
}, null, -1)
|
|
441
463
|
])]));
|
|
442
464
|
}
|
|
443
|
-
}),
|
|
465
|
+
}), ga = { class: "ez-image-upload" }, ya = {
|
|
444
466
|
key: 0,
|
|
445
467
|
class: "ez-image-upload__image"
|
|
446
|
-
},
|
|
468
|
+
}, ba = {
|
|
447
469
|
key: 1,
|
|
448
470
|
class: "ez-image-upload__list"
|
|
449
|
-
},
|
|
450
|
-
...
|
|
451
|
-
props: /* @__PURE__ */
|
|
471
|
+
}, ha = { class: "flex items-center justify-center h-full" }, Ea = x({ name: "EzImageUpload", inheritAttrs: !1 }), Va = /* @__PURE__ */ x({
|
|
472
|
+
...Ea,
|
|
473
|
+
props: /* @__PURE__ */ _({
|
|
452
474
|
api: { type: Function, default: () => Promise.resolve({ url: "" }) },
|
|
453
475
|
imageTypes: { default: () => ["image/webp", "image/png", "image/jpg", "image/gif", "image/bmp", "image/jpeg"] },
|
|
454
476
|
limitSize: { default: 10 },
|
|
@@ -461,9 +483,9 @@ const Cl = { key: 1 }, Sl = {
|
|
|
461
483
|
modelValue: {},
|
|
462
484
|
modelModifiers: {}
|
|
463
485
|
}),
|
|
464
|
-
emits: ["update:modelValue"],
|
|
465
|
-
setup(e, { expose:
|
|
466
|
-
const
|
|
486
|
+
emits: /* @__PURE__ */ _(["update:modelValue", "success", "error", "delete"], ["update:modelValue"]),
|
|
487
|
+
setup(e, { expose: s, emit: t }) {
|
|
488
|
+
const a = e, { attrs: i } = Ee([
|
|
467
489
|
"api",
|
|
468
490
|
"imageTypes",
|
|
469
491
|
"limitSize",
|
|
@@ -473,172 +495,185 @@ const Cl = { key: 1 }, Sl = {
|
|
|
473
495
|
"limit",
|
|
474
496
|
"disabled",
|
|
475
497
|
"modelValue"
|
|
476
|
-
]), { t:
|
|
477
|
-
function
|
|
478
|
-
if (!
|
|
479
|
-
const
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
498
|
+
]), o = t, { t: c } = ke(), h = G(!1), V = G(0), y = ee(e, "modelValue"), E = U(() => a.multiple), D = U(() => a.imageTypes.join(",")), H = /^(https?:\/\/|data:|blob:)/i, f = U(() => y.value ? A(y.value) : []);
|
|
499
|
+
function A(P) {
|
|
500
|
+
if (!P) return [];
|
|
501
|
+
const $ = P.trim().replace(/^[,\s]+|[,\s]+$/g, "");
|
|
502
|
+
if (!$) return [];
|
|
503
|
+
const I = /(blob:https?:\/\/|https?:\/\/|data:)/gi, J = Array.from($.matchAll(I));
|
|
504
|
+
if (J.length === 0) return [];
|
|
505
|
+
const ae = [];
|
|
506
|
+
for (let le = 0; le < J.length; le++) {
|
|
507
|
+
const oe = J[le].index ?? -1;
|
|
508
|
+
if (oe < 0) continue;
|
|
509
|
+
const ne = J[le + 1]?.index, se = $.slice(oe, ne).trim().replace(/^[,\s]+|[,\s]+$/g, "");
|
|
510
|
+
se && H.test(se) && ae.push(se);
|
|
486
511
|
}
|
|
487
|
-
return
|
|
512
|
+
return ae;
|
|
488
513
|
}
|
|
489
|
-
function
|
|
490
|
-
return !
|
|
514
|
+
function v(P) {
|
|
515
|
+
return !P || P.length === 0 ? "" : P.filter(($) => $.trim()).map(($) => $.trim()).join(",");
|
|
491
516
|
}
|
|
492
|
-
const
|
|
493
|
-
if (!
|
|
517
|
+
const d = (P) => a.disabled ? (ge.warning(c("s.message.disabled")), !1) : E.value && f.value.length >= a.limit ? (ge.warning(c("s.validate.upload.limit", { max: a.limit })), !1) : a.imageTypes.includes(P.type.toLocaleLowerCase()) ? P.size > a.limitSize * 1024 * 1024 ? (ge.error(c("s.validate.upload.limit", { max: a.limitSize })), !1) : !0 : (ge.error(c("s.validate.upload.image")), !1), m = async ({ file: P }) => {
|
|
518
|
+
if (!a.disabled)
|
|
494
519
|
try {
|
|
495
|
-
const { url:
|
|
496
|
-
if (
|
|
497
|
-
if (
|
|
498
|
-
const
|
|
499
|
-
|
|
520
|
+
const { url: $ } = await a.api(P);
|
|
521
|
+
if (!$) throw new Error(c("s.message.uploadFail"));
|
|
522
|
+
if (E.value) {
|
|
523
|
+
const I = y.value ? A(y.value) : [];
|
|
524
|
+
$ && H.test($) && (I.push($), y.value = v(I));
|
|
500
525
|
} else
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
526
|
+
y.value = $;
|
|
527
|
+
o("success", P, $);
|
|
528
|
+
} catch ($) {
|
|
529
|
+
const I = $ instanceof Error ? $ : new Error(String($));
|
|
530
|
+
ge.error(I.message), o("error", P, I);
|
|
504
531
|
}
|
|
505
|
-
},
|
|
506
|
-
|
|
507
|
-
},
|
|
508
|
-
if (!
|
|
509
|
-
if (
|
|
510
|
-
const
|
|
511
|
-
|
|
532
|
+
}, Z = (P, $ = 0) => {
|
|
533
|
+
P && (V.value = $, h.value = !0);
|
|
534
|
+
}, F = (P) => {
|
|
535
|
+
if (!a.disabled && !(!P || !y.value))
|
|
536
|
+
if (E.value) {
|
|
537
|
+
const $ = A(y.value), I = $.findIndex((J) => J === P);
|
|
538
|
+
I !== -1 && ($.splice(I, 1), y.value = v($), o("delete", P));
|
|
512
539
|
} else
|
|
513
|
-
|
|
514
|
-
},
|
|
515
|
-
return
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
540
|
+
y.value = "", o("delete", P);
|
|
541
|
+
}, q = G();
|
|
542
|
+
return s({
|
|
543
|
+
clearFiles: () => {
|
|
544
|
+
q.value?.clearFiles?.(), y.value = "";
|
|
545
|
+
},
|
|
546
|
+
submit: () => {
|
|
547
|
+
q.value?.submit?.();
|
|
548
|
+
},
|
|
549
|
+
getUploadRef: () => q.value,
|
|
550
|
+
getUrlList: () => f.value
|
|
551
|
+
}), (P, $) => (r(), C("div", ga, [
|
|
552
|
+
E.value ? (r(), C("div", ba, [
|
|
553
|
+
(r(!0), C(X, null, ie(f.value, (I, J) => (r(), C("div", {
|
|
554
|
+
key: J,
|
|
522
555
|
class: "ez-image-upload__item",
|
|
523
|
-
style:
|
|
556
|
+
style: we(a.style)
|
|
524
557
|
}, [
|
|
525
|
-
|
|
526
|
-
src:
|
|
527
|
-
fit:
|
|
558
|
+
W(l(qe), {
|
|
559
|
+
src: I,
|
|
560
|
+
fit: a.fit
|
|
528
561
|
}, null, 8, ["src", "fit"]),
|
|
529
|
-
|
|
562
|
+
Y("div", {
|
|
530
563
|
class: "ez-image-upload__handler",
|
|
531
|
-
onClick:
|
|
564
|
+
onClick: $[3] || ($[3] = Be(() => {
|
|
532
565
|
}, ["stop"]))
|
|
533
566
|
}, [
|
|
534
|
-
|
|
567
|
+
W(l(me), {
|
|
535
568
|
size: 18,
|
|
536
|
-
onClick: (
|
|
569
|
+
onClick: (ae) => Z(I, J)
|
|
537
570
|
}, {
|
|
538
|
-
default:
|
|
539
|
-
|
|
571
|
+
default: k(() => [
|
|
572
|
+
W(l(Qe))
|
|
540
573
|
]),
|
|
541
574
|
_: 1
|
|
542
575
|
}, 8, ["onClick"]),
|
|
543
|
-
|
|
576
|
+
a.disabled ? O("", !0) : (r(), g(l(me), {
|
|
544
577
|
key: 0,
|
|
545
578
|
size: 18,
|
|
546
|
-
onClick: (
|
|
579
|
+
onClick: (ae) => F(I)
|
|
547
580
|
}, {
|
|
548
|
-
default:
|
|
549
|
-
|
|
581
|
+
default: k(() => [
|
|
582
|
+
W(l(We))
|
|
550
583
|
]),
|
|
551
584
|
_: 1
|
|
552
585
|
}, 8, ["onClick"]))
|
|
553
586
|
])
|
|
554
587
|
], 4))), 128)),
|
|
555
|
-
|
|
588
|
+
(f.value.length < a.limit || f.value.length === 0) && !a.disabled ? (r(), g(l(Le), S({ key: 0 }, l(i), {
|
|
556
589
|
ref_key: "uploadRef",
|
|
557
|
-
ref:
|
|
590
|
+
ref: q,
|
|
558
591
|
action: "",
|
|
559
|
-
accept:
|
|
592
|
+
accept: D.value,
|
|
593
|
+
multiple: a.multiple,
|
|
560
594
|
"show-file-list": !1,
|
|
561
|
-
"before-upload":
|
|
562
|
-
"http-request":
|
|
563
|
-
style:
|
|
564
|
-
disabled:
|
|
565
|
-
class: [{ "is-disabled":
|
|
595
|
+
"before-upload": d,
|
|
596
|
+
"http-request": m,
|
|
597
|
+
style: a.style,
|
|
598
|
+
disabled: a.disabled,
|
|
599
|
+
class: [{ "is-disabled": a.disabled }, "ez-image-upload__item ez-image-upload__button"]
|
|
566
600
|
}), {
|
|
567
|
-
default:
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
default:
|
|
571
|
-
|
|
601
|
+
default: k(() => [
|
|
602
|
+
Y("div", ha, [
|
|
603
|
+
W(l(me), null, {
|
|
604
|
+
default: k(() => [
|
|
605
|
+
W(l(Ye))
|
|
572
606
|
]),
|
|
573
607
|
_: 1
|
|
574
608
|
})
|
|
575
609
|
])
|
|
576
610
|
]),
|
|
577
611
|
_: 1
|
|
578
|
-
}, 16, ["style", "disabled", "class"])) :
|
|
579
|
-
])) : (
|
|
612
|
+
}, 16, ["accept", "multiple", "style", "disabled", "class"])) : O("", !0)
|
|
613
|
+
])) : (r(), g(l(Le), S({ key: 0 }, l(i), {
|
|
580
614
|
ref_key: "uploadRef",
|
|
581
|
-
ref:
|
|
615
|
+
ref: q,
|
|
582
616
|
action: "",
|
|
583
|
-
accept:
|
|
617
|
+
accept: D.value,
|
|
618
|
+
multiple: a.multiple,
|
|
584
619
|
"show-file-list": !1,
|
|
585
|
-
"before-upload":
|
|
586
|
-
"http-request":
|
|
587
|
-
style:
|
|
588
|
-
disabled:
|
|
589
|
-
class: ["ez-image-upload__wrapper", { "is-disabled":
|
|
620
|
+
"before-upload": d,
|
|
621
|
+
"http-request": m,
|
|
622
|
+
style: a.style,
|
|
623
|
+
disabled: a.disabled,
|
|
624
|
+
class: ["ez-image-upload__wrapper", { "is-disabled": a.disabled }]
|
|
590
625
|
}), {
|
|
591
|
-
default:
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
src:
|
|
595
|
-
fit:
|
|
626
|
+
default: k(() => [
|
|
627
|
+
y.value ? (r(), C("div", ya, [
|
|
628
|
+
W(l(qe), {
|
|
629
|
+
src: y.value,
|
|
630
|
+
fit: a.fit
|
|
596
631
|
}, null, 8, ["src", "fit"]),
|
|
597
|
-
|
|
632
|
+
Y("div", {
|
|
598
633
|
class: "ez-image-upload__handler",
|
|
599
|
-
onClick:
|
|
634
|
+
onClick: $[2] || ($[2] = Be(() => {
|
|
600
635
|
}, ["stop"]))
|
|
601
636
|
}, [
|
|
602
|
-
|
|
637
|
+
W(l(me), {
|
|
603
638
|
size: 18,
|
|
604
|
-
onClick:
|
|
639
|
+
onClick: $[0] || ($[0] = (I) => Z(y.value, 0))
|
|
605
640
|
}, {
|
|
606
|
-
default:
|
|
607
|
-
|
|
641
|
+
default: k(() => [
|
|
642
|
+
W(l(Qe))
|
|
608
643
|
]),
|
|
609
644
|
_: 1
|
|
610
645
|
}),
|
|
611
|
-
|
|
646
|
+
a.disabled ? O("", !0) : (r(), g(l(me), {
|
|
612
647
|
key: 0,
|
|
613
648
|
size: 18,
|
|
614
|
-
onClick:
|
|
649
|
+
onClick: $[1] || ($[1] = (I) => F(y.value))
|
|
615
650
|
}, {
|
|
616
|
-
default:
|
|
617
|
-
|
|
651
|
+
default: k(() => [
|
|
652
|
+
W(l(We))
|
|
618
653
|
]),
|
|
619
654
|
_: 1
|
|
620
655
|
}))
|
|
621
656
|
])
|
|
622
|
-
])) : (
|
|
623
|
-
default:
|
|
624
|
-
|
|
657
|
+
])) : (r(), g(l(me), { key: 1 }, {
|
|
658
|
+
default: k(() => [
|
|
659
|
+
W(l(Ye))
|
|
625
660
|
]),
|
|
626
661
|
_: 1
|
|
627
662
|
}))
|
|
628
663
|
]),
|
|
629
664
|
_: 1
|
|
630
|
-
}, 16, ["style", "disabled", "class"])),
|
|
631
|
-
|
|
665
|
+
}, 16, ["accept", "multiple", "style", "disabled", "class"])),
|
|
666
|
+
h.value ? (r(), g(l($t), {
|
|
632
667
|
key: 2,
|
|
633
|
-
"url-list":
|
|
634
|
-
"initial-index":
|
|
635
|
-
onClose:
|
|
636
|
-
}, null, 8, ["url-list", "initial-index"])) :
|
|
668
|
+
"url-list": E.value ? f.value : [y.value],
|
|
669
|
+
"initial-index": V.value,
|
|
670
|
+
onClose: $[4] || ($[4] = (I) => h.value = !1)
|
|
671
|
+
}, null, 8, ["url-list", "initial-index"])) : O("", !0)
|
|
637
672
|
]));
|
|
638
673
|
}
|
|
639
|
-
}),
|
|
640
|
-
var
|
|
641
|
-
const
|
|
674
|
+
}), ot = te(Va);
|
|
675
|
+
var B = /* @__PURE__ */ ((e) => (e.INPUT = "input", e.TEXTAREA = "textarea", e.NUMBER = "number", e.PASSWORD = "password", e.SELECT = "select", e.RADIO = "radio", e.CHECKBOX = "checkbox", e.DATE = "date", e.DATETIME = "datetime", e.DATERANGE = "daterange", e.DATETIMERANGE = "datetimerange", e.TIME = "time", e.TIMERANGE = "timerange", e.UPLOAD_IMAGES = "upload-images", e.SWITCH = "switch", e.TREE_SELECT = "tree-select", e.CASCADER = "cascader", e.SLIDER = "slider", e.RATE = "rate", e))(B || {});
|
|
676
|
+
const $a = /* @__PURE__ */ new Set([
|
|
642
677
|
"select",
|
|
643
678
|
"radio",
|
|
644
679
|
"checkbox",
|
|
@@ -650,10 +685,9 @@ const _l = /* @__PURE__ */ new Set([
|
|
|
650
685
|
"timerange",
|
|
651
686
|
"switch",
|
|
652
687
|
"cascader",
|
|
653
|
-
"tree",
|
|
654
688
|
"tree-select"
|
|
655
689
|
/* TREE_SELECT */
|
|
656
|
-
]),
|
|
690
|
+
]), wa = /* @__PURE__ */ new Set([
|
|
657
691
|
"select",
|
|
658
692
|
"radio",
|
|
659
693
|
"checkbox",
|
|
@@ -665,21 +699,20 @@ const _l = /* @__PURE__ */ new Set([
|
|
|
665
699
|
"timerange",
|
|
666
700
|
"switch",
|
|
667
701
|
"cascader",
|
|
668
|
-
"tree",
|
|
669
702
|
"tree-select",
|
|
670
703
|
"slider",
|
|
671
704
|
"rate"
|
|
672
705
|
/* RATE */
|
|
673
706
|
]);
|
|
674
|
-
function
|
|
675
|
-
return e &&
|
|
707
|
+
function Sa(e) {
|
|
708
|
+
return e && $a.has(e) ? "选择" : "输入";
|
|
676
709
|
}
|
|
677
|
-
function
|
|
678
|
-
return e &&
|
|
710
|
+
function ka(e) {
|
|
711
|
+
return e && wa.has(e) ? "change" : "blur";
|
|
679
712
|
}
|
|
680
|
-
const
|
|
681
|
-
...
|
|
682
|
-
props: /* @__PURE__ */
|
|
713
|
+
const za = x({ name: "EzFormItem" }), nt = /* @__PURE__ */ x({
|
|
714
|
+
...za,
|
|
715
|
+
props: /* @__PURE__ */ _({
|
|
683
716
|
config: {},
|
|
684
717
|
formData: { default: () => ({}) }
|
|
685
718
|
}, {
|
|
@@ -688,188 +721,208 @@ const at = V({ name: "EzFormItem" }), Ue = /* @__PURE__ */ V({
|
|
|
688
721
|
}),
|
|
689
722
|
emits: ["update:modelValue"],
|
|
690
723
|
setup(e) {
|
|
691
|
-
const
|
|
692
|
-
const
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
724
|
+
const s = e, t = ee(e, "modelValue"), a = U(() => s.config?.itemAttrs && typeof s.config.itemAttrs == "object" ? s.config.itemAttrs : {}), i = U(() => s.config?.attrs && typeof s.config.attrs == "object" ? s.config.attrs : {}), o = U(() => {
|
|
725
|
+
const v = i.value, {
|
|
726
|
+
disabled: d,
|
|
727
|
+
modelValue: m,
|
|
728
|
+
"onUpdate:modelValue": Z,
|
|
729
|
+
...F
|
|
730
|
+
} = v;
|
|
731
|
+
return F;
|
|
732
|
+
}), c = U(() => {
|
|
733
|
+
const v = i.value, {
|
|
734
|
+
api: d,
|
|
735
|
+
disabled: m,
|
|
736
|
+
modelValue: Z,
|
|
737
|
+
"onUpdate:modelValue": F,
|
|
738
|
+
...q
|
|
739
|
+
} = v;
|
|
740
|
+
return q;
|
|
741
|
+
}), h = U(() => {
|
|
742
|
+
if (s.config?.type === B.UPLOAD_IMAGES)
|
|
743
|
+
return typeof i.value.api == "function" ? i.value.api : (() => {
|
|
744
|
+
throw new Error('[EzFormItem] "upload-images" requires attrs.api to be a function: (file: File) => Promise<{ url: string }>.');
|
|
745
|
+
})();
|
|
746
|
+
}), V = U(() => s.config?.options && Array.isArray(s.config.options) ? s.config.options : []), y = () => V.value, E = () => V.value, D = () => V.value, H = () => V.value, f = () => V.value, A = () => {
|
|
747
|
+
const { config: v } = s;
|
|
748
|
+
if (!v || typeof v != "object") return;
|
|
749
|
+
let d;
|
|
750
|
+
return v.rules ? d = v.rules : v.required && (d = [{ required: !0, message: v.requiredMessage || `请${Sa(v.type)}${v.label || ""}`, trigger: ka(v.type) }]), d;
|
|
698
751
|
};
|
|
699
|
-
return (
|
|
752
|
+
return (v, d) => e.config && e.config.prop ? (r(), g(l(wt), S({
|
|
700
753
|
key: 0,
|
|
701
754
|
prop: e.config.prop,
|
|
702
755
|
label: e.config.label,
|
|
703
|
-
rules:
|
|
704
|
-
},
|
|
705
|
-
default:
|
|
706
|
-
|
|
756
|
+
rules: A()
|
|
757
|
+
}, a.value), Se({
|
|
758
|
+
default: k(() => [
|
|
759
|
+
v.$slots.default ? R(v.$slots, "default", {
|
|
707
760
|
key: 0,
|
|
708
761
|
config: e.config,
|
|
709
|
-
value:
|
|
762
|
+
value: t.value,
|
|
710
763
|
formData: e.formData
|
|
711
|
-
}) : e.config.component ? (
|
|
764
|
+
}) : e.config.component ? (r(), g(De(e.config.component), S({
|
|
712
765
|
key: 1,
|
|
713
|
-
modelValue:
|
|
714
|
-
"onUpdate:modelValue":
|
|
766
|
+
modelValue: t.value,
|
|
767
|
+
"onUpdate:modelValue": d[0] || (d[0] = (m) => t.value = m),
|
|
715
768
|
disabled: e.config.disabled
|
|
716
|
-
},
|
|
717
|
-
e.config.type ===
|
|
769
|
+
}, o.value), null, 16, ["modelValue", "disabled"])) : (r(), C(X, { key: 2 }, [
|
|
770
|
+
e.config.type === l(B).INPUT || !e.config.type ? (r(), g(l(xe), S({
|
|
718
771
|
key: 0,
|
|
719
|
-
modelValue:
|
|
720
|
-
"onUpdate:modelValue":
|
|
772
|
+
modelValue: t.value,
|
|
773
|
+
"onUpdate:modelValue": d[1] || (d[1] = (m) => t.value = m),
|
|
721
774
|
placeholder: e.config.placeholder || `请输入${e.config.label || ""}`,
|
|
722
775
|
disabled: e.config.disabled,
|
|
723
776
|
clearable: ""
|
|
724
|
-
},
|
|
777
|
+
}, o.value), null, 16, ["modelValue", "placeholder", "disabled"])) : e.config.type === l(B).TEXTAREA ? (r(), g(l(xe), S({
|
|
725
778
|
key: 1,
|
|
726
|
-
modelValue:
|
|
727
|
-
"onUpdate:modelValue":
|
|
779
|
+
modelValue: t.value,
|
|
780
|
+
"onUpdate:modelValue": d[2] || (d[2] = (m) => t.value = m),
|
|
728
781
|
type: "textarea",
|
|
729
782
|
placeholder: e.config.placeholder || `请输入${e.config.label || ""}`,
|
|
730
783
|
disabled: e.config.disabled
|
|
731
|
-
},
|
|
784
|
+
}, o.value), null, 16, ["modelValue", "placeholder", "disabled"])) : e.config.type === l(B).NUMBER ? (r(), g(l(St), S({
|
|
732
785
|
key: 2,
|
|
733
|
-
modelValue:
|
|
734
|
-
"onUpdate:modelValue":
|
|
786
|
+
modelValue: t.value,
|
|
787
|
+
"onUpdate:modelValue": d[3] || (d[3] = (m) => t.value = m),
|
|
735
788
|
placeholder: e.config.placeholder,
|
|
736
789
|
disabled: e.config.disabled
|
|
737
|
-
},
|
|
790
|
+
}, o.value), null, 16, ["modelValue", "placeholder", "disabled"])) : e.config.type === l(B).PASSWORD ? (r(), g(l(xe), S({
|
|
738
791
|
key: 3,
|
|
739
|
-
modelValue:
|
|
740
|
-
"onUpdate:modelValue":
|
|
792
|
+
modelValue: t.value,
|
|
793
|
+
"onUpdate:modelValue": d[4] || (d[4] = (m) => t.value = m),
|
|
741
794
|
type: "password",
|
|
742
795
|
placeholder: e.config.placeholder || `请输入${e.config.label || ""}`,
|
|
743
796
|
disabled: e.config.disabled,
|
|
744
797
|
"show-password": "",
|
|
745
798
|
clearable: ""
|
|
746
|
-
},
|
|
799
|
+
}, o.value), null, 16, ["modelValue", "placeholder", "disabled"])) : e.config.type === l(B).SELECT ? (r(), g(l(at), S({
|
|
747
800
|
key: 4,
|
|
748
|
-
modelValue:
|
|
749
|
-
"onUpdate:modelValue":
|
|
750
|
-
options:
|
|
801
|
+
modelValue: t.value,
|
|
802
|
+
"onUpdate:modelValue": d[5] || (d[5] = (m) => t.value = m),
|
|
803
|
+
options: y(),
|
|
751
804
|
placeholder: e.config.placeholder || `请选择${e.config.label || ""}`,
|
|
752
805
|
disabled: e.config.disabled
|
|
753
|
-
},
|
|
806
|
+
}, o.value), null, 16, ["modelValue", "options", "placeholder", "disabled"])) : e.config.type === l(B).RADIO ? (r(), g(l(lt), S({
|
|
754
807
|
key: 5,
|
|
755
|
-
modelValue:
|
|
756
|
-
"onUpdate:modelValue":
|
|
757
|
-
options:
|
|
808
|
+
modelValue: t.value,
|
|
809
|
+
"onUpdate:modelValue": d[6] || (d[6] = (m) => t.value = m),
|
|
810
|
+
options: E(),
|
|
758
811
|
disabled: e.config.disabled
|
|
759
|
-
},
|
|
812
|
+
}, o.value), null, 16, ["modelValue", "options", "disabled"])) : e.config.type === l(B).CHECKBOX ? (r(), g(l(tt), S({
|
|
760
813
|
key: 6,
|
|
761
|
-
modelValue:
|
|
762
|
-
"onUpdate:modelValue":
|
|
763
|
-
options:
|
|
814
|
+
modelValue: t.value,
|
|
815
|
+
"onUpdate:modelValue": d[7] || (d[7] = (m) => t.value = m),
|
|
816
|
+
options: D(),
|
|
764
817
|
disabled: e.config.disabled
|
|
765
|
-
},
|
|
818
|
+
}, o.value), null, 16, ["modelValue", "options", "disabled"])) : e.config.type === l(B).DATE ? (r(), g(l(Ce), S({
|
|
766
819
|
key: 7,
|
|
767
|
-
modelValue:
|
|
768
|
-
"onUpdate:modelValue":
|
|
820
|
+
modelValue: t.value,
|
|
821
|
+
"onUpdate:modelValue": d[8] || (d[8] = (m) => t.value = m),
|
|
769
822
|
type: "date",
|
|
770
823
|
placeholder: e.config.placeholder || `请选择${e.config.label || ""}`,
|
|
771
824
|
disabled: e.config.disabled
|
|
772
|
-
},
|
|
825
|
+
}, o.value), null, 16, ["modelValue", "placeholder", "disabled"])) : e.config.type === l(B).DATETIME ? (r(), g(l(Ce), S({
|
|
773
826
|
key: 8,
|
|
774
|
-
modelValue:
|
|
775
|
-
"onUpdate:modelValue":
|
|
827
|
+
modelValue: t.value,
|
|
828
|
+
"onUpdate:modelValue": d[9] || (d[9] = (m) => t.value = m),
|
|
776
829
|
type: "datetime",
|
|
777
830
|
placeholder: e.config.placeholder || `请选择${e.config.label || ""}`,
|
|
778
831
|
disabled: e.config.disabled
|
|
779
|
-
},
|
|
832
|
+
}, o.value), null, 16, ["modelValue", "placeholder", "disabled"])) : e.config.type === l(B).DATERANGE ? (r(), g(l(Ce), S({
|
|
780
833
|
key: 9,
|
|
781
|
-
modelValue:
|
|
782
|
-
"onUpdate:modelValue":
|
|
834
|
+
modelValue: t.value,
|
|
835
|
+
"onUpdate:modelValue": d[10] || (d[10] = (m) => t.value = m),
|
|
783
836
|
type: "daterange",
|
|
784
837
|
"range-separator": "至",
|
|
785
838
|
"start-placeholder": "开始日期",
|
|
786
839
|
"end-placeholder": "结束日期",
|
|
787
840
|
disabled: e.config.disabled
|
|
788
|
-
},
|
|
841
|
+
}, o.value), null, 16, ["modelValue", "disabled"])) : e.config.type === l(B).DATETIMERANGE ? (r(), g(l(Ce), S({
|
|
789
842
|
key: 10,
|
|
790
|
-
modelValue:
|
|
791
|
-
"onUpdate:modelValue":
|
|
843
|
+
modelValue: t.value,
|
|
844
|
+
"onUpdate:modelValue": d[11] || (d[11] = (m) => t.value = m),
|
|
792
845
|
type: "datetimerange",
|
|
793
846
|
"range-separator": "至",
|
|
794
847
|
"start-placeholder": "开始时间",
|
|
795
848
|
"end-placeholder": "结束时间",
|
|
796
849
|
disabled: e.config.disabled
|
|
797
|
-
},
|
|
850
|
+
}, o.value), null, 16, ["modelValue", "disabled"])) : e.config.type === l(B).TIME ? (r(), g(l(He), S({
|
|
798
851
|
key: 11,
|
|
799
|
-
modelValue:
|
|
800
|
-
"onUpdate:modelValue":
|
|
852
|
+
modelValue: t.value,
|
|
853
|
+
"onUpdate:modelValue": d[12] || (d[12] = (m) => t.value = m),
|
|
801
854
|
placeholder: e.config.placeholder || `请选择${e.config.label || ""}`,
|
|
802
855
|
disabled: e.config.disabled
|
|
803
|
-
},
|
|
856
|
+
}, o.value), null, 16, ["modelValue", "placeholder", "disabled"])) : e.config.type === l(B).TIMERANGE ? (r(), g(l(He), S({
|
|
804
857
|
key: 12,
|
|
805
|
-
modelValue:
|
|
806
|
-
"onUpdate:modelValue":
|
|
858
|
+
modelValue: t.value,
|
|
859
|
+
"onUpdate:modelValue": d[13] || (d[13] = (m) => t.value = m),
|
|
807
860
|
"is-range": "",
|
|
808
861
|
"range-separator": "至",
|
|
809
862
|
"start-placeholder": "开始时间",
|
|
810
863
|
"end-placeholder": "结束时间",
|
|
811
864
|
disabled: e.config.disabled
|
|
812
|
-
},
|
|
865
|
+
}, o.value), null, 16, ["modelValue", "disabled"])) : e.config.type === l(B).SWITCH ? (r(), g(l(kt), S({
|
|
813
866
|
key: 13,
|
|
814
|
-
modelValue:
|
|
815
|
-
"onUpdate:modelValue":
|
|
867
|
+
modelValue: t.value,
|
|
868
|
+
"onUpdate:modelValue": d[14] || (d[14] = (m) => t.value = m),
|
|
816
869
|
disabled: e.config.disabled
|
|
817
|
-
},
|
|
870
|
+
}, o.value), null, 16, ["modelValue", "disabled"])) : e.config.type === l(B).TREE_SELECT ? (r(), g(l(zt), S({
|
|
818
871
|
key: 14,
|
|
819
|
-
modelValue:
|
|
820
|
-
"onUpdate:modelValue":
|
|
821
|
-
data:
|
|
872
|
+
modelValue: t.value,
|
|
873
|
+
"onUpdate:modelValue": d[15] || (d[15] = (m) => t.value = m),
|
|
874
|
+
data: H(),
|
|
822
875
|
placeholder: e.config.placeholder || `请选择${e.config.label || ""}`,
|
|
823
876
|
disabled: e.config.disabled
|
|
824
|
-
},
|
|
877
|
+
}, o.value), null, 16, ["modelValue", "data", "placeholder", "disabled"])) : e.config.type === l(B).CASCADER ? (r(), g(l(Ct), S({
|
|
825
878
|
key: 15,
|
|
826
|
-
modelValue:
|
|
827
|
-
"onUpdate:modelValue":
|
|
828
|
-
options: f
|
|
879
|
+
modelValue: t.value,
|
|
880
|
+
"onUpdate:modelValue": d[16] || (d[16] = (m) => t.value = m),
|
|
881
|
+
options: f(),
|
|
829
882
|
placeholder: e.config.placeholder || `请选择${e.config.label || ""}`,
|
|
830
883
|
disabled: e.config.disabled,
|
|
831
884
|
clearable: ""
|
|
832
|
-
},
|
|
885
|
+
}, o.value), null, 16, ["modelValue", "options", "placeholder", "disabled"])) : e.config.type === l(B).SLIDER ? (r(), g(l(At), S({
|
|
833
886
|
key: 16,
|
|
834
|
-
modelValue:
|
|
835
|
-
"onUpdate:modelValue":
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
"node-key": "id"
|
|
839
|
-
}, s.value), null, 16, ["modelValue", "data"])) : e.config.type === t(k).SLIDER ? (n(), m(t(rl), v({
|
|
887
|
+
modelValue: t.value,
|
|
888
|
+
"onUpdate:modelValue": d[17] || (d[17] = (m) => t.value = m),
|
|
889
|
+
disabled: e.config.disabled
|
|
890
|
+
}, o.value), null, 16, ["modelValue", "disabled"])) : e.config.type === l(B).RATE ? (r(), g(l(Dt), S({
|
|
840
891
|
key: 17,
|
|
841
|
-
modelValue:
|
|
842
|
-
"onUpdate:modelValue":
|
|
892
|
+
modelValue: t.value,
|
|
893
|
+
"onUpdate:modelValue": d[18] || (d[18] = (m) => t.value = m),
|
|
843
894
|
disabled: e.config.disabled
|
|
844
|
-
},
|
|
895
|
+
}, o.value), null, 16, ["modelValue", "disabled"])) : e.config.type === l(B).UPLOAD_IMAGES ? (r(), g(l(ot), S({
|
|
845
896
|
key: 18,
|
|
846
|
-
modelValue:
|
|
847
|
-
"onUpdate:modelValue":
|
|
897
|
+
modelValue: t.value,
|
|
898
|
+
"onUpdate:modelValue": d[19] || (d[19] = (m) => t.value = m),
|
|
899
|
+
api: h.value,
|
|
848
900
|
disabled: e.config.disabled
|
|
849
|
-
},
|
|
850
|
-
key: 19,
|
|
851
|
-
modelValue: l.value,
|
|
852
|
-
"onUpdate:modelValue": r[20] || (r[20] = (i) => l.value = i),
|
|
853
|
-
api: s.value.api,
|
|
854
|
-
disabled: e.config.disabled
|
|
855
|
-
}, s.value), null, 16, ["modelValue", "api", "disabled"])) : S("", !0)
|
|
901
|
+
}, c.value), null, 16, ["modelValue", "api", "disabled"])) : O("", !0)
|
|
856
902
|
], 64))
|
|
857
903
|
]),
|
|
858
904
|
_: 2
|
|
859
905
|
}, [
|
|
860
|
-
|
|
906
|
+
v.$slots.label ? {
|
|
861
907
|
name: "label",
|
|
862
|
-
fn:
|
|
863
|
-
|
|
908
|
+
fn: k(() => [
|
|
909
|
+
R(v.$slots, "label", { config: e.config })
|
|
864
910
|
]),
|
|
865
911
|
key: "0"
|
|
866
912
|
} : void 0
|
|
867
|
-
]), 1040, ["prop", "label", "rules"])) :
|
|
913
|
+
]), 1040, ["prop", "label", "rules"])) : O("", !0);
|
|
868
914
|
}
|
|
869
|
-
}),
|
|
870
|
-
|
|
871
|
-
|
|
915
|
+
}), Ca = {
|
|
916
|
+
key: 0,
|
|
917
|
+
class: "ez-dynamic-form-group__title"
|
|
918
|
+
}, Aa = {
|
|
919
|
+
key: 1,
|
|
920
|
+
class: "ez-dynamic-form-group__description"
|
|
921
|
+
}, Da = x({ name: "EzDynamicForm", inheritAttrs: !1 }), xa = /* @__PURE__ */ x({
|
|
922
|
+
...Da,
|
|
923
|
+
props: /* @__PURE__ */ _({
|
|
872
924
|
items: { default: () => [] },
|
|
925
|
+
groups: { default: () => [] },
|
|
873
926
|
modelValue: {},
|
|
874
927
|
cols: { default: 1 },
|
|
875
928
|
gutter: { default: 20 },
|
|
@@ -891,292 +944,494 @@ const at = V({ name: "EzFormItem" }), Ue = /* @__PURE__ */ V({
|
|
|
891
944
|
modelModifiers: {}
|
|
892
945
|
}),
|
|
893
946
|
emits: ["update:modelValue"],
|
|
894
|
-
setup(e, { expose:
|
|
895
|
-
const
|
|
896
|
-
|
|
897
|
-
|
|
947
|
+
setup(e, { expose: s }) {
|
|
948
|
+
const t = e, a = ct(), i = ee(e, "modelValue"), o = Ue(), c = Ue({}), h = (u) => Object.prototype.toString.call(u) === "[object Object]", V = (u) => {
|
|
949
|
+
const b = /* @__PURE__ */ new WeakMap(), n = (w) => {
|
|
950
|
+
if (w instanceof Date)
|
|
951
|
+
return new Date(w.getTime());
|
|
952
|
+
if (Array.isArray(w)) {
|
|
953
|
+
const T = w;
|
|
954
|
+
if (b.has(T))
|
|
955
|
+
return b.get(T);
|
|
956
|
+
const Q = [];
|
|
957
|
+
return b.set(T, Q), T.forEach((ce, fe) => {
|
|
958
|
+
Q[fe] = n(ce);
|
|
959
|
+
}), Q;
|
|
960
|
+
}
|
|
961
|
+
if (h(w)) {
|
|
962
|
+
const T = w;
|
|
963
|
+
if (b.has(T))
|
|
964
|
+
return b.get(T);
|
|
965
|
+
const Q = {};
|
|
966
|
+
return b.set(T, Q), Object.entries(T).forEach(([ce, fe]) => {
|
|
967
|
+
Q[ce] = n(fe);
|
|
968
|
+
}), Q;
|
|
969
|
+
}
|
|
970
|
+
return w;
|
|
971
|
+
};
|
|
972
|
+
return n(u);
|
|
973
|
+
}, y = (u) => h(u) && ("value" in u || "fields" in u || "omit" in u), E = () => {
|
|
974
|
+
h(i.value) || (i.value = {});
|
|
975
|
+
}, D = () => {
|
|
976
|
+
E(), i.value && A.value.forEach((u) => {
|
|
977
|
+
u.prop in i.value || (i.value[u.prop] = u.defaultValue !== void 0 ? u.defaultValue : void 0);
|
|
898
978
|
});
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
979
|
+
}, H = U(() => {
|
|
980
|
+
const { items: u, groups: b, cols: n, gutter: w, modelValue: T, ...Q } = t;
|
|
981
|
+
return Q;
|
|
982
|
+
}), f = U(() => Math.floor(24 / t.cols)), A = U(() => t.groups?.length ? t.groups.flatMap((u) => u.items || []) : t.items || []), v = U(() => Array.isArray(t.groups) && t.groups.length > 0), d = () => {
|
|
983
|
+
const u = (t.items?.length || 0) > 0, b = (t.groups?.length || 0) > 0;
|
|
984
|
+
if (u && b)
|
|
985
|
+
throw new Error('[EzDynamicForm] "items" and "groups" cannot be used at the same time. Choose exactly one configuration mode.');
|
|
986
|
+
}, m = (u) => {
|
|
987
|
+
const b = {};
|
|
988
|
+
return A.value.forEach((n) => {
|
|
989
|
+
Object.prototype.hasOwnProperty.call(u, n.prop) && (b[n.prop] = V(u[n.prop]));
|
|
990
|
+
}), b;
|
|
991
|
+
}, Z = (u, b, n) => {
|
|
992
|
+
console.error(`[EzDynamicForm] ${u} error for field "${b.prop}":`, n);
|
|
993
|
+
}, F = (u, b) => ({
|
|
994
|
+
item: V(u),
|
|
995
|
+
formData: V(b)
|
|
996
|
+
}), q = (u) => {
|
|
997
|
+
const b = V(u);
|
|
998
|
+
return A.value.forEach((n) => {
|
|
999
|
+
if (n.deserialize)
|
|
1000
|
+
try {
|
|
1001
|
+
const w = F(n, b);
|
|
1002
|
+
b[n.prop] = n.deserialize(b[n.prop], w.formData, w.item);
|
|
1003
|
+
} catch (w) {
|
|
1004
|
+
Z("deserialize", n, w);
|
|
1005
|
+
}
|
|
1006
|
+
}), b;
|
|
1007
|
+
}, N = (u) => {
|
|
1008
|
+
const b = V(u);
|
|
1009
|
+
return A.value.forEach((n) => {
|
|
1010
|
+
if (!n.serialize) return;
|
|
1011
|
+
let w;
|
|
904
1012
|
try {
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
1013
|
+
const T = F(n, b);
|
|
1014
|
+
w = n.serialize(b[n.prop], T.formData, T.item);
|
|
1015
|
+
} catch (T) {
|
|
1016
|
+
Z("serialize", n, T);
|
|
1017
|
+
return;
|
|
908
1018
|
}
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
} catch (z) {
|
|
916
|
-
console.error(`[EzDynamicForm] Disabled check error for "${p.prop}":`, z);
|
|
1019
|
+
if (w !== void 0) {
|
|
1020
|
+
if (y(w)) {
|
|
1021
|
+
Object.prototype.hasOwnProperty.call(w, "value") && (b[n.prop] = V(w.value)), w.fields && h(w.fields) && Object.assign(b, V(w.fields)), w.omit && delete b[n.prop];
|
|
1022
|
+
return;
|
|
1023
|
+
}
|
|
1024
|
+
b[n.prop] = V(w);
|
|
917
1025
|
}
|
|
918
|
-
|
|
1026
|
+
}), b;
|
|
919
1027
|
};
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
1028
|
+
ye(() => [t.items, t.groups], d, { deep: !0, immediate: !0 }), ye(() => [t.items, t.groups], D, { deep: !0, immediate: !0 }), ye(i, D, { immediate: !0 }), Me(() => {
|
|
1029
|
+
D(), pe();
|
|
1030
|
+
});
|
|
1031
|
+
const re = (u, b, n) => {
|
|
1032
|
+
if (!u) return !0;
|
|
1033
|
+
try {
|
|
1034
|
+
return u(i.value);
|
|
1035
|
+
} catch (w) {
|
|
1036
|
+
return console.error(`[EzDynamicForm] ${b} visibility error for "${n}":`, w), !1;
|
|
1037
|
+
}
|
|
1038
|
+
}, P = U(() => {
|
|
1039
|
+
const u = v.value ? t.groups : [{ items: t.items || [], cols: t.cols, gutter: t.gutter }], b = [];
|
|
1040
|
+
return u.forEach((n, w) => {
|
|
1041
|
+
if (!n || n.hidden) return;
|
|
1042
|
+
const T = n.name || `group-${w}`;
|
|
1043
|
+
if (!re(n.show, "group", T)) return;
|
|
1044
|
+
const Q = (n.items || []).filter((L) => L.hidden ? !1 : re(L.show, "item", L.prop)), ce = Math.max(1, n.cols || t.cols), fe = n.gutter ?? t.gutter, p = n.headerSlot || (n.name ? `group-header-${n.name}` : void 0), z = n.slot || (n.name ? `group-${n.name}` : void 0);
|
|
1045
|
+
b.push({
|
|
1046
|
+
key: `${T}-${w}`,
|
|
1047
|
+
index: w,
|
|
1048
|
+
group: n,
|
|
1049
|
+
items: Q,
|
|
1050
|
+
cols: ce,
|
|
1051
|
+
gutter: fe,
|
|
1052
|
+
headerSlotName: p,
|
|
1053
|
+
bodySlotName: z
|
|
1054
|
+
});
|
|
1055
|
+
}), b;
|
|
1056
|
+
}), $ = (u, b) => {
|
|
1057
|
+
if (u.span !== void 0)
|
|
1058
|
+
return Math.max(1, Math.min(24, u.span));
|
|
1059
|
+
const n = Math.max(1, b);
|
|
1060
|
+
return Math.max(1, Math.floor(24 / n)) || f.value;
|
|
1061
|
+
}, I = (u) => v.value ? u.group.title || u.group.description || u.headerSlotName && a[u.headerSlotName] ? !0 : !!a["group-header"] : !1, J = (u) => {
|
|
1062
|
+
let b = u.disabled || t.disabled;
|
|
1063
|
+
if (!b && u.disabledWhen)
|
|
933
1064
|
try {
|
|
934
|
-
|
|
935
|
-
} catch {
|
|
936
|
-
|
|
1065
|
+
b = u.disabledWhen(i.value);
|
|
1066
|
+
} catch (n) {
|
|
1067
|
+
console.error(`[EzDynamicForm] Disabled check error for "${u.prop}":`, n);
|
|
937
1068
|
}
|
|
1069
|
+
return { ...u, disabled: b };
|
|
1070
|
+
}, ae = async () => {
|
|
1071
|
+
if (!o.value)
|
|
1072
|
+
return console.warn("[EzDynamicForm] Form ref is not available"), !1;
|
|
1073
|
+
try {
|
|
1074
|
+
return await o.value.validate(), !0;
|
|
1075
|
+
} catch {
|
|
1076
|
+
return !1;
|
|
1077
|
+
}
|
|
1078
|
+
}, le = async (u) => {
|
|
1079
|
+
if (!o.value)
|
|
1080
|
+
return console.warn("[EzDynamicForm] Form ref is not available"), !1;
|
|
1081
|
+
try {
|
|
1082
|
+
return await o.value.validateField(u), !0;
|
|
1083
|
+
} catch {
|
|
1084
|
+
return !1;
|
|
1085
|
+
}
|
|
1086
|
+
}, oe = (u) => {
|
|
1087
|
+
if (!o.value) {
|
|
1088
|
+
console.warn("[EzDynamicForm] Form ref is not available");
|
|
1089
|
+
return;
|
|
1090
|
+
}
|
|
1091
|
+
o.value.clearValidate(u);
|
|
1092
|
+
}, ne = () => V(i.value), se = () => N(ne()), pe = () => {
|
|
1093
|
+
c.value = ne();
|
|
1094
|
+
}, Ve = (u, b = !0) => {
|
|
1095
|
+
if (!u) return;
|
|
1096
|
+
E();
|
|
1097
|
+
const n = V(u);
|
|
1098
|
+
b ? Object.assign(i.value, n) : i.value = n, D(), Pe(() => {
|
|
1099
|
+
o.value?.clearValidate();
|
|
1100
|
+
});
|
|
1101
|
+
};
|
|
1102
|
+
return s({
|
|
1103
|
+
validate: ae,
|
|
1104
|
+
validateField: le,
|
|
1105
|
+
clearValidate: oe,
|
|
1106
|
+
getFormData: ne,
|
|
1107
|
+
getSubmitData: se,
|
|
1108
|
+
setFormData: Ve,
|
|
1109
|
+
setSubmitData: (u, b = !0) => {
|
|
1110
|
+
u && Ve(m(q(u)), b);
|
|
938
1111
|
},
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
}
|
|
944
|
-
s.value.clearValidate(p);
|
|
945
|
-
},
|
|
946
|
-
getFormData: () => ({ ...o.value }),
|
|
947
|
-
setFormData: (p, R = !0) => {
|
|
948
|
-
p && (R ? Object.assign(o.value, p) : o.value = { ...p });
|
|
1112
|
+
resetForm: () => {
|
|
1113
|
+
i.value = V(c.value), D(), Pe(() => {
|
|
1114
|
+
o.value?.clearValidate();
|
|
1115
|
+
});
|
|
949
1116
|
},
|
|
950
|
-
|
|
951
|
-
|
|
1117
|
+
captureInitialData: pe,
|
|
1118
|
+
formRef: o
|
|
1119
|
+
}), (u, b) => (r(), g(l(xt), S({
|
|
952
1120
|
ref_key: "formRef",
|
|
953
|
-
ref:
|
|
1121
|
+
ref: o,
|
|
954
1122
|
class: "ez-dynamic-form",
|
|
955
|
-
"label-width": "auto"
|
|
956
|
-
},
|
|
957
|
-
default:
|
|
958
|
-
|
|
959
|
-
|
|
1123
|
+
"label-width": t.labelWidth ?? "auto"
|
|
1124
|
+
}, H.value, { model: i.value }), {
|
|
1125
|
+
default: k(() => [
|
|
1126
|
+
(r(!0), C(X, null, ie(P.value, (n) => (r(), g(De(v.value ? "section" : "div"), {
|
|
1127
|
+
key: n.key,
|
|
1128
|
+
class: Ae(v.value ? ["ez-dynamic-form-group", n.group.className] : void 0),
|
|
1129
|
+
style: we(v.value ? n.group.style : void 0)
|
|
960
1130
|
}, {
|
|
961
|
-
default:
|
|
962
|
-
(n
|
|
963
|
-
key:
|
|
964
|
-
|
|
1131
|
+
default: k(() => [
|
|
1132
|
+
I(n) ? (r(), C("div", {
|
|
1133
|
+
key: 0,
|
|
1134
|
+
class: Ae(["ez-dynamic-form-group__header", n.group.headerClassName]),
|
|
1135
|
+
style: we(n.group.headerStyle)
|
|
1136
|
+
}, [
|
|
1137
|
+
n.headerSlotName && u.$slots[n.headerSlotName] ? R(u.$slots, n.headerSlotName, {
|
|
1138
|
+
key: 0,
|
|
1139
|
+
group: n.group,
|
|
1140
|
+
index: n.index,
|
|
1141
|
+
items: n.items,
|
|
1142
|
+
formData: i.value
|
|
1143
|
+
}) : u.$slots["group-header"] ? R(u.$slots, "group-header", {
|
|
1144
|
+
key: 1,
|
|
1145
|
+
group: n.group,
|
|
1146
|
+
index: n.index,
|
|
1147
|
+
items: n.items,
|
|
1148
|
+
formData: i.value
|
|
1149
|
+
}) : (r(), C(X, { key: 2 }, [
|
|
1150
|
+
n.group.title ? (r(), C("div", Ca, de(n.group.title), 1)) : O("", !0),
|
|
1151
|
+
n.group.description ? (r(), C("div", Aa, de(n.group.description), 1)) : O("", !0)
|
|
1152
|
+
], 64))
|
|
1153
|
+
], 6)) : O("", !0),
|
|
1154
|
+
v.value && n.bodySlotName && u.$slots[n.bodySlotName] ? R(u.$slots, n.bodySlotName, {
|
|
1155
|
+
key: 1,
|
|
1156
|
+
group: n.group,
|
|
1157
|
+
index: n.index,
|
|
1158
|
+
items: n.items,
|
|
1159
|
+
formData: i.value
|
|
1160
|
+
}) : v.value && u.$slots.group ? R(u.$slots, "group", {
|
|
1161
|
+
key: 2,
|
|
1162
|
+
group: n.group,
|
|
1163
|
+
index: n.index,
|
|
1164
|
+
items: n.items,
|
|
1165
|
+
formData: i.value
|
|
1166
|
+
}) : (r(), g(l(Ut), {
|
|
1167
|
+
key: 3,
|
|
1168
|
+
gutter: n.gutter,
|
|
1169
|
+
class: Ae(v.value ? ["ez-dynamic-form-group__body", n.group.bodyClassName] : void 0),
|
|
1170
|
+
style: we(v.value ? n.group.bodyStyle : void 0)
|
|
965
1171
|
}, {
|
|
966
|
-
default:
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
1172
|
+
default: k(() => [
|
|
1173
|
+
(r(!0), C(X, null, ie(n.items, (w) => (r(), g(l(Pt), {
|
|
1174
|
+
key: `${n.key}-${w.prop}`,
|
|
1175
|
+
span: $(w, n.cols)
|
|
1176
|
+
}, {
|
|
1177
|
+
default: k(() => [
|
|
1178
|
+
W(nt, {
|
|
1179
|
+
modelValue: i.value[w.prop],
|
|
1180
|
+
"onUpdate:modelValue": (T) => i.value[w.prop] = T,
|
|
1181
|
+
config: J(w),
|
|
1182
|
+
formData: i.value
|
|
1183
|
+
}, Se({ _: 2 }, [
|
|
1184
|
+
u.$slots[`label-${w.prop}`] ? {
|
|
1185
|
+
name: "label",
|
|
1186
|
+
fn: k(() => [
|
|
1187
|
+
R(u.$slots, `label-${w.prop}`, { item: w })
|
|
1188
|
+
]),
|
|
1189
|
+
key: "0"
|
|
1190
|
+
} : void 0,
|
|
1191
|
+
u.$slots[w.prop] ? {
|
|
1192
|
+
name: "default",
|
|
1193
|
+
fn: k(({ config: T, value: Q }) => [
|
|
1194
|
+
R(u.$slots, w.prop, {
|
|
1195
|
+
item: T,
|
|
1196
|
+
value: Q,
|
|
1197
|
+
formData: i.value
|
|
1198
|
+
})
|
|
1199
|
+
]),
|
|
1200
|
+
key: "1"
|
|
1201
|
+
} : void 0
|
|
1202
|
+
]), 1032, ["modelValue", "onUpdate:modelValue", "config", "formData"])
|
|
1203
|
+
]),
|
|
1204
|
+
_: 2
|
|
1205
|
+
}, 1032, ["span"]))), 128))
|
|
992
1206
|
]),
|
|
993
1207
|
_: 2
|
|
994
|
-
}, 1032, ["
|
|
1208
|
+
}, 1032, ["gutter", "class", "style"]))
|
|
995
1209
|
]),
|
|
996
|
-
_:
|
|
997
|
-
},
|
|
1210
|
+
_: 2
|
|
1211
|
+
}, 1032, ["class", "style"]))), 128))
|
|
998
1212
|
]),
|
|
999
1213
|
_: 3
|
|
1000
|
-
}, 16, ["model"]));
|
|
1214
|
+
}, 16, ["label-width", "model"]));
|
|
1001
1215
|
}
|
|
1002
|
-
}),
|
|
1003
|
-
...
|
|
1216
|
+
}), Ua = te(xa), Pa = te(nt), Ta = x({ name: "EzTable", inheritAttrs: !1 }), rt = /* @__PURE__ */ x({
|
|
1217
|
+
...Ta,
|
|
1004
1218
|
props: {
|
|
1005
1219
|
data: { default: () => [] },
|
|
1006
1220
|
columns: { default: () => [] },
|
|
1007
|
-
|
|
1221
|
+
border: { type: Boolean, default: !0 },
|
|
1222
|
+
rowKey: { type: [String, Function], default: "id" }
|
|
1008
1223
|
},
|
|
1009
|
-
setup(e, { expose:
|
|
1010
|
-
const
|
|
1011
|
-
const
|
|
1012
|
-
return
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1224
|
+
setup(e, { expose: s }) {
|
|
1225
|
+
const t = e, a = G(), i = /* @__PURE__ */ new Set(["hidden", "emptyValue", "sortMode", "sortField"]), o = (f) => f === !0, c = (f) => f == null || f === "", h = () => t.columns.filter((f) => ["selection", "index", "expand"].includes(f.type || "") ? !1 : !o(f.hidden)), V = U(() => {
|
|
1226
|
+
const f = h(), A = f[f.length - 1];
|
|
1227
|
+
return A?.columnKey || A?.prop || null;
|
|
1228
|
+
}), y = (f) => f.type ? !1 : (f.columnKey || f.prop) !== V.value, E = (f) => {
|
|
1229
|
+
const A = f.formatter, v = f.emptyValue !== void 0;
|
|
1230
|
+
if (!(!A && !v))
|
|
1231
|
+
return (d, m, Z, F) => {
|
|
1232
|
+
const q = A ? A(d, m, Z, F) : Z;
|
|
1233
|
+
return v && c(q) ? f.emptyValue : q;
|
|
1234
|
+
};
|
|
1235
|
+
}, D = (f) => {
|
|
1236
|
+
const v = {
|
|
1237
|
+
...{
|
|
1238
|
+
align: "center",
|
|
1239
|
+
resizable: !0,
|
|
1240
|
+
reserveSelection: f.type === "selection",
|
|
1241
|
+
showOverflowTooltip: y(f)
|
|
1242
|
+
},
|
|
1243
|
+
...f,
|
|
1244
|
+
formatter: E(f)
|
|
1245
|
+
}, d = Object.fromEntries(
|
|
1246
|
+
Object.entries(v).filter(([m]) => !i.has(m))
|
|
1247
|
+
);
|
|
1248
|
+
return f.sortMode === "remote" && (d.sortable = "custom"), d;
|
|
1020
1249
|
};
|
|
1021
|
-
return
|
|
1022
|
-
getTableRef: () =>
|
|
1023
|
-
clearSelection: () =>
|
|
1024
|
-
toggleRowSelection: (
|
|
1025
|
-
toggleAllSelection: () =>
|
|
1026
|
-
toggleRowExpansion: (
|
|
1027
|
-
setCurrentRow: (
|
|
1028
|
-
clearSort: () =>
|
|
1029
|
-
clearFilter: (
|
|
1030
|
-
doLayout: () =>
|
|
1031
|
-
sort: (
|
|
1032
|
-
}), (
|
|
1250
|
+
return s({
|
|
1251
|
+
getTableRef: () => a.value,
|
|
1252
|
+
clearSelection: () => a.value?.clearSelection(),
|
|
1253
|
+
toggleRowSelection: (f, A) => a.value?.toggleRowSelection(f, A),
|
|
1254
|
+
toggleAllSelection: () => a.value?.toggleAllSelection(),
|
|
1255
|
+
toggleRowExpansion: (f, A) => a.value?.toggleRowExpansion(f, A),
|
|
1256
|
+
setCurrentRow: (f) => a.value?.setCurrentRow(f),
|
|
1257
|
+
clearSort: () => a.value?.clearSort(),
|
|
1258
|
+
clearFilter: (f) => a.value?.clearFilter(f),
|
|
1259
|
+
doLayout: () => a.value?.doLayout(),
|
|
1260
|
+
sort: (f, A) => a.value?.sort(f, A)
|
|
1261
|
+
}), (f, A) => (r(), g(l(Tt), S({
|
|
1033
1262
|
ref_key: "tableRef",
|
|
1034
|
-
ref:
|
|
1035
|
-
data:
|
|
1036
|
-
border:
|
|
1037
|
-
"row-key":
|
|
1038
|
-
},
|
|
1039
|
-
default:
|
|
1040
|
-
(
|
|
1041
|
-
key:
|
|
1263
|
+
ref: a,
|
|
1264
|
+
data: t.data,
|
|
1265
|
+
border: t.border,
|
|
1266
|
+
"row-key": t.rowKey
|
|
1267
|
+
}, f.$attrs), Se({
|
|
1268
|
+
default: k(() => [
|
|
1269
|
+
(r(!0), C(X, null, ie(t.columns, (v, d) => (r(), C(X, {
|
|
1270
|
+
key: v.columnKey || v.prop || `${v.type || "column"}-${d}`
|
|
1042
1271
|
}, [
|
|
1043
|
-
["selection", "index"].includes(
|
|
1272
|
+
["selection", "index"].includes(v.type) ? (r(), g(l(Ge), S({
|
|
1044
1273
|
key: 0,
|
|
1045
1274
|
ref_for: !0
|
|
1046
|
-
},
|
|
1275
|
+
}, D(v)), null, 16)) : o(v.hidden) ? O("", !0) : (r(), g(l(Ge), S({
|
|
1047
1276
|
key: 1,
|
|
1048
1277
|
ref_for: !0
|
|
1049
|
-
},
|
|
1050
|
-
|
|
1278
|
+
}, D(v)), Se({ _: 2 }, [
|
|
1279
|
+
f.$slots[v.prop] ? {
|
|
1051
1280
|
name: "default",
|
|
1052
|
-
fn:
|
|
1053
|
-
|
|
1281
|
+
fn: k((m) => [
|
|
1282
|
+
R(f.$slots, v.prop, S({ ref_for: !0 }, m))
|
|
1054
1283
|
]),
|
|
1055
1284
|
key: "0"
|
|
1056
|
-
} : u.transform ? {
|
|
1057
|
-
name: "default",
|
|
1058
|
-
fn: b((r) => [
|
|
1059
|
-
Z(Y(u.transform(r.row)), 1)
|
|
1060
|
-
]),
|
|
1061
|
-
key: "1"
|
|
1062
1285
|
} : void 0,
|
|
1063
|
-
|
|
1286
|
+
f.$slots[`header-${v.prop}`] ? {
|
|
1064
1287
|
name: "header",
|
|
1065
|
-
fn:
|
|
1066
|
-
|
|
1288
|
+
fn: k((m) => [
|
|
1289
|
+
R(f.$slots, `header-${v.prop}`, S({ ref_for: !0 }, m))
|
|
1067
1290
|
]),
|
|
1068
|
-
key: "
|
|
1291
|
+
key: "1"
|
|
1069
1292
|
} : void 0
|
|
1070
1293
|
]), 1040))
|
|
1071
1294
|
], 64))), 128))
|
|
1072
1295
|
]),
|
|
1073
1296
|
_: 2
|
|
1074
1297
|
}, [
|
|
1075
|
-
|
|
1298
|
+
f.$slots?.append ? {
|
|
1076
1299
|
name: "append",
|
|
1077
|
-
fn:
|
|
1078
|
-
|
|
1300
|
+
fn: k(() => [
|
|
1301
|
+
R(f.$slots, "append")
|
|
1079
1302
|
]),
|
|
1080
1303
|
key: "0"
|
|
1081
1304
|
} : void 0,
|
|
1082
|
-
|
|
1305
|
+
f.$slots?.empty ? {
|
|
1083
1306
|
name: "empty",
|
|
1084
|
-
fn:
|
|
1085
|
-
|
|
1307
|
+
fn: k(() => [
|
|
1308
|
+
R(f.$slots, "empty")
|
|
1086
1309
|
]),
|
|
1087
1310
|
key: "1"
|
|
1088
1311
|
} : void 0
|
|
1089
|
-
]), 1040, ["data"]));
|
|
1312
|
+
]), 1040, ["data", "border", "row-key"]));
|
|
1090
1313
|
}
|
|
1091
|
-
}),
|
|
1092
|
-
...
|
|
1093
|
-
props: /* @__PURE__ */
|
|
1094
|
-
|
|
1095
|
-
|
|
1314
|
+
}), Ma = { class: "ez-query-panel" }, Ra = { class: "ez-query-panel__operate" }, Ia = x({ name: "EzQueryPanel", inheritAttrs: !1 }), Oa = /* @__PURE__ */ x({
|
|
1315
|
+
...Ia,
|
|
1316
|
+
props: /* @__PURE__ */ _({
|
|
1317
|
+
expanded: { type: Boolean },
|
|
1318
|
+
collapsedHeight: { default: 50 }
|
|
1096
1319
|
}, {
|
|
1097
|
-
expanded: { default: !1 },
|
|
1320
|
+
expanded: { type: Boolean, default: !1 },
|
|
1098
1321
|
expandedModifiers: {}
|
|
1099
1322
|
}),
|
|
1100
1323
|
emits: ["update:expanded"],
|
|
1101
|
-
setup(e, { expose:
|
|
1102
|
-
const
|
|
1103
|
-
let
|
|
1104
|
-
const
|
|
1105
|
-
|
|
1106
|
-
}, 100),
|
|
1107
|
-
|
|
1324
|
+
setup(e, { expose: s }) {
|
|
1325
|
+
const t = e, { t: a } = ke(), i = G(), o = G(), c = G(0), h = ee(e, "expanded"), V = U(() => c.value > t.collapsedHeight), y = U(() => h.value ? da : ia), E = U(() => h.value ? a("s.button.collapse") : a("s.button.expand"));
|
|
1326
|
+
let D = null;
|
|
1327
|
+
const H = jt(() => {
|
|
1328
|
+
i.value && (c.value = i.value.scrollHeight);
|
|
1329
|
+
}, 100), f = () => {
|
|
1330
|
+
h.value = !h.value;
|
|
1108
1331
|
};
|
|
1109
|
-
return
|
|
1332
|
+
return Me(() => {
|
|
1110
1333
|
setTimeout(() => {
|
|
1111
|
-
|
|
1334
|
+
i.value && (H(), D = new ResizeObserver(H), D.observe(i.value));
|
|
1112
1335
|
}, 50);
|
|
1113
|
-
}),
|
|
1114
|
-
|
|
1115
|
-
}),
|
|
1116
|
-
countViewHeight:
|
|
1117
|
-
}), (
|
|
1118
|
-
|
|
1119
|
-
class: "ez-
|
|
1120
|
-
style:
|
|
1121
|
-
height:
|
|
1336
|
+
}), ft(() => {
|
|
1337
|
+
D && (D.disconnect(), D = null);
|
|
1338
|
+
}), s({
|
|
1339
|
+
countViewHeight: H
|
|
1340
|
+
}), (A, v) => (r(), C("div", Ma, [
|
|
1341
|
+
Y("div", {
|
|
1342
|
+
class: "ez-query-panel__wrapper",
|
|
1343
|
+
style: we({
|
|
1344
|
+
height: c.value ? h.value ? `${c.value}px` : `${t.collapsedHeight}px` : "auto"
|
|
1122
1345
|
})
|
|
1123
1346
|
}, [
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
icon: u.value,
|
|
1129
|
-
size: "small",
|
|
1130
|
-
title: r.value,
|
|
1131
|
-
circle: "",
|
|
1132
|
-
onClick: W[0] || (W[0] = (p) => G())
|
|
1133
|
-
}, null, 8, ["icon", "title"])) : S("", !0)
|
|
1134
|
-
]),
|
|
1135
|
-
P("div", {
|
|
1136
|
-
ref_key: "wrapRef",
|
|
1137
|
-
ref: s
|
|
1347
|
+
Y("div", {
|
|
1348
|
+
ref_key: "layoutRef",
|
|
1349
|
+
ref: i,
|
|
1350
|
+
class: "ez-query-panel__layout"
|
|
1138
1351
|
}, [
|
|
1139
|
-
|
|
1352
|
+
Y("div", Ra, [
|
|
1353
|
+
R(A.$slots, "operate"),
|
|
1354
|
+
V.value ? (r(), g(l(be), {
|
|
1355
|
+
key: 0,
|
|
1356
|
+
icon: y.value,
|
|
1357
|
+
size: "small",
|
|
1358
|
+
title: E.value,
|
|
1359
|
+
circle: "",
|
|
1360
|
+
onClick: v[0] || (v[0] = (d) => f())
|
|
1361
|
+
}, null, 8, ["icon", "title"])) : O("", !0)
|
|
1362
|
+
]),
|
|
1363
|
+
Y("div", {
|
|
1364
|
+
ref_key: "wrapRef",
|
|
1365
|
+
ref: o,
|
|
1366
|
+
class: "ez-query-panel__content"
|
|
1367
|
+
}, [
|
|
1368
|
+
R(A.$slots, "default")
|
|
1369
|
+
], 512)
|
|
1140
1370
|
], 512)
|
|
1141
1371
|
], 4)
|
|
1142
1372
|
]));
|
|
1143
1373
|
}
|
|
1144
|
-
}),
|
|
1145
|
-
...
|
|
1146
|
-
props: {
|
|
1374
|
+
}), st = te(Oa), Ba = x({ name: "EzPagination", inheritAttrs: !1 }), Fa = /* @__PURE__ */ x({
|
|
1375
|
+
...Ba,
|
|
1376
|
+
props: /* @__PURE__ */ _({
|
|
1147
1377
|
currentPage: {},
|
|
1148
|
-
currentPageModifiers: {},
|
|
1149
1378
|
pageSize: {},
|
|
1379
|
+
total: {},
|
|
1380
|
+
pageSizes: { default: () => [10, 20, 50, 100] },
|
|
1381
|
+
layout: { default: "total, sizes, prev, pager, next, jumper" },
|
|
1382
|
+
background: { type: Boolean, default: !1 },
|
|
1383
|
+
disabled: { type: Boolean, default: !1 }
|
|
1384
|
+
}, {
|
|
1385
|
+
currentPage: { default: 1 },
|
|
1386
|
+
currentPageModifiers: {},
|
|
1387
|
+
pageSize: { default: 10 },
|
|
1150
1388
|
pageSizeModifiers: {}
|
|
1151
|
-
},
|
|
1152
|
-
emits: ["update:currentPage", "update:pageSize"],
|
|
1153
|
-
setup(e) {
|
|
1154
|
-
const
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
"
|
|
1158
|
-
|
|
1159
|
-
"
|
|
1160
|
-
"
|
|
1161
|
-
|
|
1162
|
-
|
|
1389
|
+
}),
|
|
1390
|
+
emits: /* @__PURE__ */ _(["update:currentPage", "update:pageSize", "current-change", "size-change", "change"], ["update:currentPage", "update:pageSize"]),
|
|
1391
|
+
setup(e, { emit: s }) {
|
|
1392
|
+
const t = e, a = ee(e, "currentPage"), i = ee(e, "pageSize"), o = s, c = (y) => {
|
|
1393
|
+
o("current-change", y), o("change", y, i.value);
|
|
1394
|
+
}, h = (y) => {
|
|
1395
|
+
o("size-change", y), o("change", a.value, y);
|
|
1396
|
+
}, { attrs: V } = Ee([
|
|
1397
|
+
"currentPage",
|
|
1398
|
+
"pageSize",
|
|
1399
|
+
"total",
|
|
1400
|
+
"pageSizes",
|
|
1401
|
+
"layout",
|
|
1402
|
+
"background",
|
|
1403
|
+
"disabled"
|
|
1404
|
+
]);
|
|
1405
|
+
return (y, E) => (r(), g(l(Mt), S({
|
|
1406
|
+
"current-page": a.value,
|
|
1407
|
+
"onUpdate:currentPage": E[0] || (E[0] = (D) => a.value = D),
|
|
1408
|
+
"page-size": i.value,
|
|
1409
|
+
"onUpdate:pageSize": E[1] || (E[1] = (D) => i.value = D),
|
|
1410
|
+
total: t.total,
|
|
1411
|
+
"page-sizes": t.pageSizes,
|
|
1412
|
+
layout: t.layout,
|
|
1413
|
+
background: t.background,
|
|
1414
|
+
disabled: t.disabled,
|
|
1415
|
+
onCurrentChange: c,
|
|
1416
|
+
onSizeChange: h
|
|
1417
|
+
}, l(V)), null, 16, ["current-page", "page-size", "total", "page-sizes", "layout", "background", "disabled"]));
|
|
1163
1418
|
}
|
|
1164
|
-
}),
|
|
1165
|
-
var
|
|
1166
|
-
const
|
|
1167
|
-
const
|
|
1419
|
+
}), it = te(Fa);
|
|
1420
|
+
var Te = /* @__PURE__ */ ((e) => (e.ASC = "ascending", e.DESC = "descending", e[e.EMPTY = null] = "EMPTY", e))(Te || {});
|
|
1421
|
+
const Na = (e, s) => typeof s == "function" ? s(e) : e[s], La = (e) => {
|
|
1422
|
+
const s = Ue([]), t = U(() => s.value), a = U(() => s.value.map((c) => Na(c, e)));
|
|
1168
1423
|
return {
|
|
1169
|
-
selectionChange: (
|
|
1170
|
-
|
|
1424
|
+
selectionChange: (c) => {
|
|
1425
|
+
s.value = c;
|
|
1171
1426
|
},
|
|
1172
|
-
getSelectedList:
|
|
1173
|
-
getSelectedIds:
|
|
1174
|
-
getSortParams: ({ prop:
|
|
1175
|
-
const
|
|
1176
|
-
return
|
|
1427
|
+
getSelectedList: t,
|
|
1428
|
+
getSelectedIds: a,
|
|
1429
|
+
getSortParams: ({ prop: c, order: h }, V) => {
|
|
1430
|
+
const y = V || c, E = { asc: null, desc: null };
|
|
1431
|
+
return h === Te.ASC ? (E.asc = y, E.desc = null) : h === Te.DESC && (E.asc = null, E.desc = y), E;
|
|
1177
1432
|
}
|
|
1178
1433
|
};
|
|
1179
|
-
},
|
|
1434
|
+
}, qa = /* @__PURE__ */ x({
|
|
1180
1435
|
__name: "column-config",
|
|
1181
1436
|
props: {
|
|
1182
1437
|
modelValue: { type: Boolean, default: !1 },
|
|
@@ -1184,242 +1439,370 @@ const gt = (e) => {
|
|
|
1184
1439
|
columns: { default: () => [] },
|
|
1185
1440
|
columnsModifiers: {}
|
|
1186
1441
|
},
|
|
1187
|
-
emits: /* @__PURE__ */
|
|
1188
|
-
setup(e, { emit:
|
|
1189
|
-
const { t
|
|
1190
|
-
return (
|
|
1191
|
-
modelValue:
|
|
1192
|
-
"onUpdate:modelValue":
|
|
1442
|
+
emits: /* @__PURE__ */ _(["change"], ["update:modelValue", "update:columns"]),
|
|
1443
|
+
setup(e, { emit: s }) {
|
|
1444
|
+
const { t } = ke(), a = ["selection", "index", "expand"], i = s, o = ee(e, "modelValue"), c = ee(e, "columns"), h = (V) => c.value.filter((E) => !E.hidden).length < 2 && !V.hidden;
|
|
1445
|
+
return (V, y) => (r(), g(l(Rt), {
|
|
1446
|
+
modelValue: o.value,
|
|
1447
|
+
"onUpdate:modelValue": y[1] || (y[1] = (E) => o.value = E),
|
|
1193
1448
|
class: "ez-column-wrapper",
|
|
1194
|
-
title: t
|
|
1449
|
+
title: l(t)("s.label.column"),
|
|
1195
1450
|
size: "15%"
|
|
1196
1451
|
}, {
|
|
1197
|
-
default:
|
|
1198
|
-
(
|
|
1199
|
-
key:
|
|
1452
|
+
default: k(() => [
|
|
1453
|
+
(r(!0), C(X, null, ie(c.value, (E, D) => (r(), C(X, {
|
|
1454
|
+
key: E.columnKey || E.prop || `${E.type || "column"}-${D}`
|
|
1200
1455
|
}, [
|
|
1201
|
-
|
|
1456
|
+
a.includes(E.type) ? O("", !0) : (r(), g(l(et), {
|
|
1202
1457
|
key: 0,
|
|
1203
|
-
|
|
1204
|
-
"onUpdate:modelValue": (U) => i.hidden = U,
|
|
1458
|
+
"model-value": !E.hidden,
|
|
1205
1459
|
class: "flex",
|
|
1206
|
-
|
|
1207
|
-
"
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
onChange: r[0] || (r[0] = (U) => s("change"))
|
|
1212
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue", "label", "disabled"]))
|
|
1460
|
+
label: E.label,
|
|
1461
|
+
"onUpdate:modelValue": (H) => E.hidden = !H,
|
|
1462
|
+
disabled: h(E),
|
|
1463
|
+
onChange: y[0] || (y[0] = (H) => i("change"))
|
|
1464
|
+
}, null, 8, ["model-value", "label", "onUpdate:modelValue", "disabled"]))
|
|
1213
1465
|
], 64))), 128))
|
|
1214
1466
|
]),
|
|
1215
1467
|
_: 1
|
|
1216
1468
|
}, 8, ["modelValue", "title"]));
|
|
1217
1469
|
}
|
|
1218
|
-
}),
|
|
1470
|
+
}), Ha = { class: "ez-fast-table" }, Ga = { class: "ez-fast-table_wrapper" }, Ka = {
|
|
1219
1471
|
key: 0,
|
|
1220
1472
|
class: "ez-fast-table_wrapper_header_operation"
|
|
1221
|
-
},
|
|
1473
|
+
}, ja = {
|
|
1474
|
+
key: 1,
|
|
1475
|
+
class: "ez-fast-table_error"
|
|
1476
|
+
}, Wa = { class: "ez-fast-table_pagination" }, Ya = x({
|
|
1222
1477
|
name: "EzFastTable",
|
|
1223
|
-
directives: { loading:
|
|
1478
|
+
directives: { loading: Re.directive },
|
|
1224
1479
|
inheritAttrs: !1
|
|
1225
|
-
}),
|
|
1226
|
-
...
|
|
1227
|
-
props:
|
|
1228
|
-
|
|
1480
|
+
}), Qa = /* @__PURE__ */ x({
|
|
1481
|
+
...Ya,
|
|
1482
|
+
props: {
|
|
1483
|
+
params: {},
|
|
1484
|
+
loading: { type: Boolean },
|
|
1485
|
+
columns: { default: () => [] },
|
|
1486
|
+
api: { type: Function, default: () => Promise.resolve({}) },
|
|
1229
1487
|
beforeSearch: { type: Function, default: () => Promise.resolve() },
|
|
1488
|
+
transformParams: { type: Function, default: (e) => e },
|
|
1489
|
+
responseAdapter: { type: Function, default: (e) => {
|
|
1490
|
+
const { code: s, data: t } = e || {};
|
|
1491
|
+
return s === 200 && t?.records ? {
|
|
1492
|
+
records: t.records || [],
|
|
1493
|
+
total: t.total || 0,
|
|
1494
|
+
current: t.current || 1,
|
|
1495
|
+
size: t.size || 10
|
|
1496
|
+
} : {
|
|
1497
|
+
records: [],
|
|
1498
|
+
total: 0,
|
|
1499
|
+
current: 1,
|
|
1500
|
+
size: 10
|
|
1501
|
+
};
|
|
1502
|
+
} },
|
|
1503
|
+
onError: { type: Function, default: async () => {
|
|
1504
|
+
} },
|
|
1230
1505
|
columnTool: { type: Boolean, default: !0 },
|
|
1231
1506
|
expanded: { type: Boolean, default: !1 },
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
columnsModifiers: {},
|
|
1240
|
-
loading: { type: Boolean },
|
|
1241
|
-
loadingModifiers: {}
|
|
1242
|
-
}),
|
|
1243
|
-
emits: /* @__PURE__ */ O(["changePage", "reset", "query"], ["update:params", "update:columns", "update:loading"]),
|
|
1244
|
-
setup(e, { expose: d, emit: l }) {
|
|
1245
|
-
const { t: o } = ae(), s = e, f = $e(), a = C(() => {
|
|
1246
|
-
const { api: h, beforeSearch: w, columnTool: H, expanded: T, ...oe } = s;
|
|
1507
|
+
border: { type: Boolean, default: !0 },
|
|
1508
|
+
rowKey: { type: [String, Function], default: "id" }
|
|
1509
|
+
},
|
|
1510
|
+
emits: ["update:params", "update:loading", "changePage", "reset", "query", "update:columns"],
|
|
1511
|
+
setup(e, { expose: s, emit: t }) {
|
|
1512
|
+
const { t: a } = ke(), i = () => ({ current: 1, size: 10 }), o = e, c = Ze(), h = U(() => {
|
|
1513
|
+
const { api: p, beforeSearch: z, transformParams: L, responseAdapter: M, onError: K, columnTool: ue, expanded: Oe, columns: tl, border: al, ...dt } = o;
|
|
1247
1514
|
return {
|
|
1248
|
-
...
|
|
1249
|
-
...
|
|
1515
|
+
...c,
|
|
1516
|
+
...dt
|
|
1250
1517
|
};
|
|
1251
|
-
}),
|
|
1518
|
+
}), V = G(o.expanded), { selectionChange: y, getSelectedList: E, getSortParams: D, getSelectedIds: H } = La(o.rowKey), f = G(null), A = G(!1), v = G(null), d = G(0), m = G([]), Z = G(0), F = G(null), q = t, N = G(j(o.params ?? i())), re = G(j(o.columns ?? [])), P = G(o.loading ?? !1), $ = U({
|
|
1519
|
+
get: () => P.value,
|
|
1520
|
+
set: (p) => {
|
|
1521
|
+
P.value = p, q("update:loading", p);
|
|
1522
|
+
}
|
|
1523
|
+
}), I = U(() => ({
|
|
1524
|
+
params: N.value,
|
|
1525
|
+
loading: $.value,
|
|
1526
|
+
expanded: V.value,
|
|
1527
|
+
search: ne,
|
|
1528
|
+
query: oe,
|
|
1529
|
+
reset: u,
|
|
1530
|
+
captureInitialParams: ve,
|
|
1531
|
+
patchParams: se,
|
|
1532
|
+
replaceParams: pe
|
|
1533
|
+
}));
|
|
1534
|
+
ye(
|
|
1535
|
+
() => o.params,
|
|
1536
|
+
(p) => {
|
|
1537
|
+
N.value = j(p ?? i());
|
|
1538
|
+
},
|
|
1539
|
+
{ deep: !0 }
|
|
1540
|
+
), ye(
|
|
1541
|
+
() => o.columns,
|
|
1542
|
+
(p) => {
|
|
1543
|
+
re.value = j(p ?? []);
|
|
1544
|
+
},
|
|
1545
|
+
{ deep: !0 }
|
|
1546
|
+
), ye(
|
|
1547
|
+
() => o.loading,
|
|
1548
|
+
(p) => {
|
|
1549
|
+
P.value = p ?? !1;
|
|
1550
|
+
}
|
|
1551
|
+
);
|
|
1552
|
+
const J = (p) => p, ae = () => {
|
|
1553
|
+
const p = j(N.value);
|
|
1554
|
+
N.value = p, q("update:params", p);
|
|
1555
|
+
}, le = async (p, z, L) => {
|
|
1556
|
+
p === d.value && (console.error(`[EzFastTable] Query pipeline failed at stage "${L.stage}".`, z), F.value = {
|
|
1557
|
+
error: z,
|
|
1558
|
+
stage: L.stage,
|
|
1559
|
+
params: j(L.params)
|
|
1560
|
+
}, await o.onError?.(z, L));
|
|
1561
|
+
}, oe = async () => {
|
|
1562
|
+
const p = d.value + 1;
|
|
1563
|
+
d.value = p, F.value = null;
|
|
1252
1564
|
try {
|
|
1253
|
-
$.value = !0
|
|
1254
|
-
const
|
|
1255
|
-
|
|
1565
|
+
$.value = !0;
|
|
1566
|
+
const z = j(N.value);
|
|
1567
|
+
try {
|
|
1568
|
+
await o.beforeSearch(z);
|
|
1569
|
+
} catch (ue) {
|
|
1570
|
+
await le(p, ue, { stage: "beforeSearch", params: z });
|
|
1571
|
+
return;
|
|
1572
|
+
}
|
|
1573
|
+
let L;
|
|
1574
|
+
try {
|
|
1575
|
+
L = await o.transformParams(z);
|
|
1576
|
+
} catch (ue) {
|
|
1577
|
+
await le(p, ue, { stage: "transformParams", params: z });
|
|
1578
|
+
return;
|
|
1579
|
+
}
|
|
1580
|
+
let M;
|
|
1581
|
+
try {
|
|
1582
|
+
M = await o.api(L);
|
|
1583
|
+
} catch (ue) {
|
|
1584
|
+
await le(p, ue, { stage: "api", params: z });
|
|
1585
|
+
return;
|
|
1586
|
+
}
|
|
1587
|
+
let K;
|
|
1588
|
+
try {
|
|
1589
|
+
K = await o.responseAdapter(M);
|
|
1590
|
+
} catch (ue) {
|
|
1591
|
+
await le(p, ue, { stage: "responseAdapter", params: z });
|
|
1592
|
+
return;
|
|
1593
|
+
}
|
|
1594
|
+
if (p !== d.value)
|
|
1595
|
+
return;
|
|
1596
|
+
m.value = K.records || [], Z.value = K.total || 0, q("query");
|
|
1256
1597
|
} finally {
|
|
1257
|
-
$.value = !1;
|
|
1598
|
+
p === d.value && ($.value = !1);
|
|
1258
1599
|
}
|
|
1259
|
-
},
|
|
1260
|
-
|
|
1261
|
-
},
|
|
1262
|
-
const
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
if (
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1600
|
+
}, ne = () => {
|
|
1601
|
+
N.value.current = 1, ae(), oe();
|
|
1602
|
+
}, se = (p, z = {}) => {
|
|
1603
|
+
const { resetPage: L = !1, captureInitial: M = !1 } = z, K = { ...N.value, ...j(p) };
|
|
1604
|
+
L && (K.current = 1), N.value = K, ae(), M && ve();
|
|
1605
|
+
}, pe = (p, z = {}) => {
|
|
1606
|
+
const { resetPage: L = !1, captureInitial: M = !1 } = z, K = j(p);
|
|
1607
|
+
L && (K.current = 1), N.value = K, ae(), M && ve();
|
|
1608
|
+
}, Ve = () => f.value?.getTableRef(), Ie = (p) => {
|
|
1609
|
+
const { column: z, prop: L } = p;
|
|
1610
|
+
if ((z?.sortMode || "local") === "remote") {
|
|
1611
|
+
const K = D(p, z?.sortField || L);
|
|
1612
|
+
se(K), ne();
|
|
1613
|
+
return;
|
|
1614
|
+
}
|
|
1615
|
+
(N.value.asc || N.value.desc) && se({ asc: null, desc: null });
|
|
1616
|
+
}, ve = () => {
|
|
1617
|
+
v.value = j(N.value);
|
|
1618
|
+
}, u = () => {
|
|
1619
|
+
pe(j(v.value ?? { current: 1, size: 10 })), q("reset"), Pe(() => oe());
|
|
1620
|
+
}, b = (p) => {
|
|
1621
|
+
if (q("changePage", p), p.size) {
|
|
1622
|
+
ne();
|
|
1623
|
+
return;
|
|
1624
|
+
}
|
|
1625
|
+
ae(), oe();
|
|
1626
|
+
}, n = () => {
|
|
1627
|
+
Ve()?.doLayout();
|
|
1628
|
+
}, w = () => {
|
|
1629
|
+
const p = j(re.value);
|
|
1630
|
+
re.value = p, q("update:columns", p), n();
|
|
1631
|
+
}, T = () => {
|
|
1632
|
+
F.value = null;
|
|
1633
|
+
}, Q = () => F.value, ce = () => {
|
|
1634
|
+
T(), oe();
|
|
1635
|
+
}, fe = U(() => ({
|
|
1636
|
+
error: F.value?.error,
|
|
1637
|
+
stage: F.value?.stage || "api",
|
|
1638
|
+
params: F.value?.params ?? N.value,
|
|
1639
|
+
retry: ce
|
|
1640
|
+
}));
|
|
1641
|
+
return Me(() => {
|
|
1642
|
+
ve();
|
|
1643
|
+
}), s({
|
|
1644
|
+
search: ne,
|
|
1645
|
+
query: oe,
|
|
1646
|
+
patchParams: se,
|
|
1647
|
+
replaceParams: pe,
|
|
1648
|
+
reset: u,
|
|
1649
|
+
captureInitialParams: ve,
|
|
1650
|
+
getTableRef: Ve,
|
|
1651
|
+
doLayout: n,
|
|
1652
|
+
clearError: T,
|
|
1653
|
+
getErrorState: Q
|
|
1654
|
+
}), (p, z) => {
|
|
1655
|
+
const L = Je("loading");
|
|
1656
|
+
return r(), C("div", Ha, [
|
|
1657
|
+
p.$slots.form ? (r(), g(l(st), {
|
|
1287
1658
|
key: 0,
|
|
1288
|
-
|
|
1289
|
-
expanded:
|
|
1659
|
+
expanded: V.value,
|
|
1660
|
+
"onUpdate:expanded": z[0] || (z[0] = (M) => V.value = M)
|
|
1290
1661
|
}, {
|
|
1291
|
-
default:
|
|
1292
|
-
|
|
1662
|
+
default: k(() => [
|
|
1663
|
+
R(p.$slots, "form", ze(Fe(I.value)))
|
|
1293
1664
|
]),
|
|
1294
|
-
operate:
|
|
1295
|
-
|
|
1665
|
+
operate: k(() => [
|
|
1666
|
+
W(l(be), {
|
|
1296
1667
|
type: "primary",
|
|
1297
1668
|
loading: $.value,
|
|
1298
|
-
onClick:
|
|
1669
|
+
onClick: ne
|
|
1299
1670
|
}, {
|
|
1300
|
-
default:
|
|
1301
|
-
|
|
1671
|
+
default: k(() => [
|
|
1672
|
+
he(de(l(a)("s.button.query")), 1)
|
|
1302
1673
|
]),
|
|
1303
1674
|
_: 1
|
|
1304
1675
|
}, 8, ["loading"]),
|
|
1305
|
-
|
|
1306
|
-
default:
|
|
1307
|
-
|
|
1676
|
+
W(l(be), { onClick: u }, {
|
|
1677
|
+
default: k(() => [
|
|
1678
|
+
he(de(l(a)("s.button.reset")), 1)
|
|
1308
1679
|
]),
|
|
1309
1680
|
_: 1
|
|
1310
1681
|
})
|
|
1311
1682
|
]),
|
|
1312
1683
|
_: 3
|
|
1313
|
-
}, 8, ["
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1684
|
+
}, 8, ["expanded"])) : O("", !0),
|
|
1685
|
+
p.$slots.freeArea ? R(p.$slots, "freeArea", ze(S({ key: 1 }, I.value))) : O("", !0),
|
|
1686
|
+
Y("div", Ga, [
|
|
1687
|
+
p.$slots.header || o.columnTool ? (r(), C("div", {
|
|
1317
1688
|
key: 0,
|
|
1318
|
-
class:
|
|
1689
|
+
class: Ae(["ez-fast-table_wrapper_header", p.$slots.header ? "justify-between" : "justify-end"])
|
|
1319
1690
|
}, [
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
selectList:
|
|
1323
|
-
selectIds:
|
|
1691
|
+
p.$slots.header ? (r(), C("div", Ka, [
|
|
1692
|
+
R(p.$slots, "header", {
|
|
1693
|
+
selectList: l(E),
|
|
1694
|
+
selectIds: l(H)
|
|
1324
1695
|
})
|
|
1325
|
-
])) :
|
|
1326
|
-
|
|
1696
|
+
])) : O("", !0),
|
|
1697
|
+
o.columnTool ? (r(), g(l(be), {
|
|
1327
1698
|
key: 1,
|
|
1328
|
-
icon:
|
|
1699
|
+
icon: l(pa),
|
|
1329
1700
|
circle: "",
|
|
1330
|
-
onClick:
|
|
1331
|
-
}, null, 8, ["icon"])) :
|
|
1332
|
-
], 2)) :
|
|
1333
|
-
|
|
1701
|
+
onClick: z[1] || (z[1] = (M) => A.value = !0)
|
|
1702
|
+
}, null, 8, ["icon"])) : O("", !0)
|
|
1703
|
+
], 2)) : O("", !0),
|
|
1704
|
+
_e((r(), g(rt, S(h.value, {
|
|
1334
1705
|
ref_key: "fastTableRef",
|
|
1335
|
-
ref:
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1706
|
+
ref: f,
|
|
1707
|
+
border: o.border,
|
|
1708
|
+
columns: re.value,
|
|
1709
|
+
data: m.value,
|
|
1710
|
+
onSelectionChange: l(y),
|
|
1711
|
+
onSortChange: Ie
|
|
1712
|
+
}), Se({ _: 2 }, [
|
|
1713
|
+
ie(p.$slots, (M, K, ue) => ({
|
|
1714
|
+
name: K,
|
|
1715
|
+
fn: k((Oe) => [
|
|
1716
|
+
!["form", "empty", "error", "header"].includes(String(K)) && !String(K).startsWith("header-") ? R(p.$slots, K, ze(S({ key: 0 }, J(Oe)))) : O("", !0)
|
|
1345
1717
|
])
|
|
1346
|
-
}))
|
|
1347
|
-
|
|
1348
|
-
|
|
1718
|
+
})),
|
|
1719
|
+
p.$slots.empty && !F.value ? {
|
|
1720
|
+
name: "empty",
|
|
1721
|
+
fn: k(() => [
|
|
1722
|
+
R(p.$slots, "empty")
|
|
1723
|
+
]),
|
|
1724
|
+
key: "0"
|
|
1725
|
+
} : void 0
|
|
1726
|
+
]), 1040, ["border", "columns", "data", "onSelectionChange"])), [
|
|
1727
|
+
[L, $.value]
|
|
1349
1728
|
]),
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1729
|
+
F.value && p.$slots.error ? (r(), C("div", ja, [
|
|
1730
|
+
R(p.$slots, "error", ze(Fe(fe.value)))
|
|
1731
|
+
])) : O("", !0),
|
|
1732
|
+
Y("div", Wa, [
|
|
1733
|
+
W(l(it), {
|
|
1734
|
+
"current-page": N.value.current,
|
|
1353
1735
|
"onUpdate:currentPage": [
|
|
1354
|
-
|
|
1355
|
-
|
|
1736
|
+
z[2] || (z[2] = (M) => N.value.current = M),
|
|
1737
|
+
z[4] || (z[4] = (M) => b({ current: M }))
|
|
1356
1738
|
],
|
|
1357
|
-
"page-size":
|
|
1739
|
+
"page-size": N.value.size,
|
|
1358
1740
|
"onUpdate:pageSize": [
|
|
1359
|
-
|
|
1360
|
-
|
|
1741
|
+
z[3] || (z[3] = (M) => N.value.size = M),
|
|
1742
|
+
z[5] || (z[5] = (M) => b({ size: M }))
|
|
1361
1743
|
],
|
|
1362
|
-
total:
|
|
1744
|
+
total: Z.value
|
|
1363
1745
|
}, null, 8, ["current-page", "page-size", "total"])
|
|
1364
1746
|
])
|
|
1365
1747
|
]),
|
|
1366
|
-
|
|
1367
|
-
modelValue:
|
|
1368
|
-
"onUpdate:modelValue":
|
|
1369
|
-
columns:
|
|
1370
|
-
"onUpdate:columns":
|
|
1371
|
-
onChange:
|
|
1748
|
+
W(qa, {
|
|
1749
|
+
modelValue: A.value,
|
|
1750
|
+
"onUpdate:modelValue": z[6] || (z[6] = (M) => A.value = M),
|
|
1751
|
+
columns: re.value,
|
|
1752
|
+
"onUpdate:columns": z[7] || (z[7] = (M) => re.value = M),
|
|
1753
|
+
onChange: w
|
|
1372
1754
|
}, null, 8, ["modelValue", "columns"])
|
|
1373
1755
|
]);
|
|
1374
1756
|
};
|
|
1375
1757
|
}
|
|
1376
|
-
}),
|
|
1377
|
-
function
|
|
1758
|
+
}), ut = te(Qa), nl = () => ut, Xa = te(rt), Xe = /* @__PURE__ */ Symbol("INSTALLED_KEY");
|
|
1759
|
+
function Za(e = []) {
|
|
1378
1760
|
return {
|
|
1379
|
-
install: (
|
|
1380
|
-
|
|
1761
|
+
install: (t) => {
|
|
1762
|
+
t[Xe] || (t[Xe] = !0, e.forEach((a) => t.use(a)));
|
|
1381
1763
|
}
|
|
1382
1764
|
};
|
|
1383
1765
|
}
|
|
1384
|
-
const
|
|
1385
|
-
|
|
1386
|
-
|
|
1766
|
+
const Ja = [
|
|
1767
|
+
tt,
|
|
1768
|
+
ea,
|
|
1769
|
+
Ua,
|
|
1770
|
+
Pa,
|
|
1771
|
+
ut,
|
|
1772
|
+
me,
|
|
1773
|
+
ot,
|
|
1774
|
+
it,
|
|
1387
1775
|
st,
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1776
|
+
lt,
|
|
1777
|
+
at,
|
|
1778
|
+
Xa
|
|
1779
|
+
], _a = [
|
|
1780
|
+
It,
|
|
1391
1781
|
Re,
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
], St = [
|
|
1398
|
-
pl,
|
|
1399
|
-
de,
|
|
1400
|
-
ee,
|
|
1401
|
-
gl,
|
|
1402
|
-
bl,
|
|
1403
|
-
yl
|
|
1404
|
-
], At = zt([...Ct, ...St]), Ut = At.install;
|
|
1782
|
+
ge,
|
|
1783
|
+
Ot,
|
|
1784
|
+
Bt,
|
|
1785
|
+
Ft
|
|
1786
|
+
], el = Za([...Ja, ..._a]), rl = el.install;
|
|
1405
1787
|
export {
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1788
|
+
wa as CHANGE_TRIGGER_TYPES,
|
|
1789
|
+
tt as EzCheckbox,
|
|
1790
|
+
ea as EzDialog,
|
|
1791
|
+
Ua as EzDynamicForm,
|
|
1792
|
+
ut as EzFastTable,
|
|
1793
|
+
Pa as EzFormItem,
|
|
1794
|
+
me as EzIcon,
|
|
1795
|
+
ot as EzImageUpload,
|
|
1796
|
+
it as EzPagination,
|
|
1797
|
+
st as EzQueryPanel,
|
|
1798
|
+
lt as EzRadio,
|
|
1799
|
+
at as EzSelect,
|
|
1800
|
+
Xa as EzTable,
|
|
1801
|
+
B as FormItemType,
|
|
1802
|
+
$a as SELECT_FORM_TYPES,
|
|
1803
|
+
nl as createTypedFastTable,
|
|
1804
|
+
el as default,
|
|
1805
|
+
Sa as getInputVerb,
|
|
1806
|
+
ka as getTrigger,
|
|
1807
|
+
rl as install
|
|
1425
1808
|
};
|