@maxtan/ez-ui 0.25.0 → 1.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/README.md +108 -7
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +1135 -878
- package/dist/types/index.d.ts +803 -246
- package/package.json +2 -2
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 _e, computed as P, 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 re, resolveDynamicComponent as xe, createTextVNode as he, toDisplayString as ue, resolveDirective as et, renderSlot as R, createCommentVNode as O, withDirectives as tt, createElementVNode as Q, ref as G, createVNode as W, withModifiers as Ne, normalizeStyle as $e, createSlots as Se, useSlots as mt, shallowRef as Me, watch as ye, onMounted as Oe, normalizeClass as De, nextTick as Re, onUnmounted as pt, normalizeProps as Ce, guardReactiveProps as Le } from "vue";
|
|
2
|
+
import { useLocale as vt, ElCheckbox as at, ElCheckboxButton as gt, ElCheckboxGroup as yt, ElLoading as Be, ElDialog as bt, ElButton as be, ElSelect as ht, ElOptionGroup as Et, ElOption as qe, ElRadio as Vt, ElRadioButton as wt, ElRadioGroup as $t, ElUpload as He, ElImage as Ge, ElImageViewer as St, ElMessage as ge, ElFormItem as kt, ElInput as Te, ElInputNumber as zt, ElDatePicker as Ae, ElTimePicker as Ke, ElSwitch as Ct, ElTreeSelect as At, ElCascader as Dt, ElSlider as xt, ElRate as Pt, ElForm as Ut, ElRow as Tt, ElCol as Mt, ElTable as Rt, ElTableColumn as je, ElPagination as It, ElDrawer as Ot, ElInfiniteScroll as Bt, ElMessageBox as Ft, ElNotification as Nt, ElPopoverDirective as Lt } 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), We = (e) => e.replace(/\B([A-Z])/g, "-$1").toLowerCase(), Qe = (e) => e.replace(/-([a-z])/g, (s, t) => t.toUpperCase()), qt = (e) => {
|
|
7
|
+
const s = e.startsWith("onUpdate:") ? e.slice(9) : e, t = /* @__PURE__ */ new Set([e, s, We(s), Qe(s)]);
|
|
8
|
+
return e.startsWith("onUpdate:") || (t.add(`onUpdate:${s}`), t.add(`onUpdate:${We(s)}`), t.add(`onUpdate:${Qe(s)}`)), t;
|
|
9
|
+
}, Ht = (e, s) => {
|
|
10
|
+
for (const t of e)
|
|
11
|
+
if (qt(t).has(s))
|
|
12
|
+
return !0;
|
|
13
|
+
return !1;
|
|
14
|
+
};
|
|
15
|
+
function Ee(e = []) {
|
|
16
|
+
const s = _e(), t = P(() => {
|
|
17
|
+
const o = {};
|
|
18
|
+
for (const c in s)
|
|
19
|
+
Ht(e, c) || (o[c] = s[c]);
|
|
20
|
+
return o;
|
|
21
|
+
}), a = P(() => {
|
|
22
|
+
const o = {};
|
|
23
|
+
for (const c in t.value)
|
|
24
|
+
c.startsWith("on") || (o[c] = t.value[c]);
|
|
25
|
+
return o;
|
|
26
|
+
}), i = P(() => {
|
|
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 Gt = {
|
|
34
42
|
s: {
|
|
35
43
|
label: {
|
|
36
44
|
name: "姓名",
|
|
@@ -110,39 +118,51 @@ var El = {
|
|
|
110
118
|
}
|
|
111
119
|
}
|
|
112
120
|
};
|
|
113
|
-
const { s:
|
|
114
|
-
function
|
|
115
|
-
return
|
|
121
|
+
const { s: Kt } = Gt;
|
|
122
|
+
function jt(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 Wt(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 } = vt();
|
|
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 = jt({ s: Kt }, a);
|
|
138
|
+
return typeof c == "string" ? Wt(c, i) : a;
|
|
131
139
|
},
|
|
132
|
-
lang:
|
|
140
|
+
lang: s
|
|
133
141
|
};
|
|
134
142
|
}
|
|
135
|
-
function
|
|
136
|
-
|
|
137
|
-
return
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
143
|
+
function H(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) => H(t));
|
|
147
|
+
if (e instanceof Set) return new Set(Array.from(e).map((t) => H(t)));
|
|
148
|
+
if (e instanceof Map)
|
|
149
|
+
return new Map(Array.from(e.entries()).map(([t, a]) => [H(t), H(a)]));
|
|
150
|
+
const s = Object.create(Object.getPrototypeOf(e));
|
|
151
|
+
for (const t in e)
|
|
152
|
+
e.hasOwnProperty(t) && (s[t] = H(e[t]));
|
|
153
|
+
return s;
|
|
154
|
+
}
|
|
155
|
+
function Qt(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 Yt = x({ name: "EzCheckbox", inheritAttrs: !1 }), Xt = /* @__PURE__ */ x({
|
|
164
|
+
...Yt,
|
|
165
|
+
props: /* @__PURE__ */ _({
|
|
146
166
|
type: { default: "default" },
|
|
147
167
|
options: { default: () => [] }
|
|
148
168
|
}, {
|
|
@@ -151,22 +171,22 @@ const zl = w({ name: "EzCheckbox", inheritAttrs: !1 }), Cl = /* @__PURE__ */ w({
|
|
|
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 = P(
|
|
175
|
+
() => ["default", "border"].includes(s.type) ? at : gt
|
|
156
176
|
);
|
|
157
|
-
return (
|
|
158
|
-
modelValue:
|
|
159
|
-
"onUpdate:modelValue":
|
|
160
|
-
},
|
|
161
|
-
default:
|
|
162
|
-
(
|
|
163
|
-
key: String(
|
|
177
|
+
return (o, c) => (r(), g(l(yt), 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, re(e.options, (h) => (r(), g(xe(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(ue(h.label), 1)
|
|
170
190
|
]),
|
|
171
191
|
_: 2
|
|
172
192
|
}, 1040, ["border"]))), 128))
|
|
@@ -174,122 +194,121 @@ const zl = w({ name: "EzCheckbox", inheritAttrs: !1 }), Cl = /* @__PURE__ */ w({
|
|
|
174
194
|
_: 1
|
|
175
195
|
}, 16, ["modelValue"]));
|
|
176
196
|
}
|
|
177
|
-
}),
|
|
178
|
-
var
|
|
179
|
-
const
|
|
197
|
+
}), lt = te(Xt);
|
|
198
|
+
var we = /* @__PURE__ */ ((e) => (e.CANCEL = "取消", e.CONFIRM = "确定", e))(we || {});
|
|
199
|
+
const Zt = { key: 1 }, Jt = {
|
|
180
200
|
key: 0,
|
|
181
201
|
class: "ez-dialog__body"
|
|
182
|
-
},
|
|
183
|
-
...
|
|
184
|
-
props: /* @__PURE__ */
|
|
202
|
+
}, _t = { key: 1 }, ea = x({ name: "EzDialog", inheritAttrs: !1, directives: { loading: Be.directive } }), ta = /* @__PURE__ */ x({
|
|
203
|
+
...ea,
|
|
204
|
+
props: /* @__PURE__ */ _({
|
|
185
205
|
title: { default: "" },
|
|
186
206
|
loading: { type: Boolean, default: !1 },
|
|
187
|
-
cancelText: { default:
|
|
188
|
-
confirmText: { default:
|
|
207
|
+
cancelText: { default: we.CANCEL },
|
|
208
|
+
confirmText: { default: we.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 = et("loading");
|
|
222
|
+
return r(), g(l(bt), S({
|
|
223
|
+
modelValue: o.value,
|
|
224
|
+
"onUpdate:modelValue": E[0] || (E[0] = (q) => o.value = q),
|
|
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", Zt, ue(a.title), 1))
|
|
214
234
|
]),
|
|
215
|
-
default:
|
|
216
|
-
|
|
217
|
-
|
|
235
|
+
default: k(() => [
|
|
236
|
+
y.$slots.default ? tt((r(), C("div", Jt, [
|
|
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", _t, [
|
|
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(ue(a.cancelText === l(we).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(ue(a.confirmText === l(we).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
|
+
}), aa = te(ta), la = x({ name: "EzSelect", inheritAttrs: !1 }), oa = /* @__PURE__ */ x({
|
|
272
|
+
...la,
|
|
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(d, s)
|
|
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(ht), 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, re(e.options, (V, y) => (r(), C(X, {
|
|
288
|
+
key: o(V, y)
|
|
270
289
|
}, [
|
|
271
|
-
|
|
290
|
+
i(V) ? (r(), g(l(Et), 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, re(V.options, (E, D) => (r(), g(l(qe), 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(qe), 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
|
+
}), ot = te(oa), na = x({ name: "EzRadio", inheritAttrs: !1 }), ra = /* @__PURE__ */ x({
|
|
310
|
+
...na,
|
|
311
|
+
props: /* @__PURE__ */ _({
|
|
293
312
|
type: { default: "default" },
|
|
294
313
|
options: { default: () => [] }
|
|
295
314
|
}, {
|
|
@@ -298,20 +317,20 @@ const Al = { key: 1 }, Dl = {
|
|
|
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 = P(() => ["default", "border"].includes(s.type) ? Vt : wt);
|
|
321
|
+
return (o, c) => (r(), g(l($t), 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, re(e.options, (h) => (r(), g(xe(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(ue(h.label), 1)
|
|
315
334
|
]),
|
|
316
335
|
_: 2
|
|
317
336
|
}, 1040, ["border"]))), 128))
|
|
@@ -319,136 +338,139 @@ const Al = { key: 1 }, Dl = {
|
|
|
319
338
|
_: 1
|
|
320
339
|
}, 16, ["modelValue"]));
|
|
321
340
|
}
|
|
322
|
-
}),
|
|
323
|
-
...
|
|
341
|
+
}), nt = te(ra), sa = x({ name: "EzIcon", inheritAttrs: !1 }), ia = /* @__PURE__ */ x({
|
|
342
|
+
...sa,
|
|
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 = P(() => {
|
|
352
|
+
const { size: i, color: o } = s;
|
|
353
|
+
return !i && !o ? {} : {
|
|
354
|
+
fontSize: t(i),
|
|
355
|
+
color: o
|
|
334
356
|
};
|
|
335
357
|
});
|
|
336
|
-
return (i,
|
|
358
|
+
return (i, o) => (r(), C("i", S({
|
|
337
359
|
class: "ez-icon",
|
|
338
|
-
style:
|
|
360
|
+
style: a.value
|
|
339
361
|
}, i.$attrs), [
|
|
340
|
-
|
|
362
|
+
R(i.$slots, "default", { class: "w-[1em] h-[1em]" })
|
|
341
363
|
], 16));
|
|
342
364
|
}
|
|
343
|
-
}),
|
|
365
|
+
}), ve = te(ia), ua = {
|
|
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
|
+
}, da = /* @__PURE__ */ x({
|
|
349
371
|
name: "ArrowDown",
|
|
350
372
|
__name: "ArrowDown",
|
|
351
373
|
setup(e) {
|
|
352
|
-
return (
|
|
353
|
-
|
|
374
|
+
return (s, t) => (r(), C("svg", ua, [...t[0] || (t[0] = [
|
|
375
|
+
Q("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
|
+
}), ca = {
|
|
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
|
+
}, fa = /* @__PURE__ */ x({
|
|
365
387
|
name: "ArrowUp",
|
|
366
388
|
__name: "ArrowUp",
|
|
367
389
|
setup(e) {
|
|
368
|
-
return (
|
|
369
|
-
|
|
390
|
+
return (s, t) => (r(), C("svg", ca, [...t[0] || (t[0] = [
|
|
391
|
+
Q("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
|
+
}), ma = {
|
|
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
|
+
}, Ye = /* @__PURE__ */ x({
|
|
381
403
|
name: "Delete",
|
|
382
404
|
__name: "delete",
|
|
383
405
|
setup(e) {
|
|
384
|
-
return (
|
|
385
|
-
|
|
406
|
+
return (s, t) => (r(), C("svg", ma, [...t[0] || (t[0] = [
|
|
407
|
+
Q("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
|
+
}), pa = {
|
|
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
|
+
}, Xe = /* @__PURE__ */ x({
|
|
397
419
|
name: "Plus",
|
|
398
420
|
__name: "plus",
|
|
399
421
|
setup(e) {
|
|
400
|
-
return (
|
|
401
|
-
|
|
422
|
+
return (s, t) => (r(), C("svg", pa, [...t[0] || (t[0] = [
|
|
423
|
+
Q("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
|
+
}), va = {
|
|
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
|
+
}, ga = /* @__PURE__ */ x({
|
|
413
435
|
name: "Setting",
|
|
414
436
|
__name: "setting",
|
|
415
437
|
setup(e) {
|
|
416
|
-
return (
|
|
417
|
-
|
|
438
|
+
return (s, t) => (r(), C("svg", va, [...t[0] || (t[0] = [
|
|
439
|
+
Q("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
|
+
}), ya = {
|
|
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
|
+
}, Ze = /* @__PURE__ */ x({
|
|
429
451
|
name: "ZoomIn",
|
|
430
452
|
__name: "ZoomIn",
|
|
431
453
|
setup(e) {
|
|
432
|
-
return (
|
|
433
|
-
|
|
454
|
+
return (s, t) => (r(), C("svg", ya, [...t[0] || (t[0] = [
|
|
455
|
+
Q("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
|
+
Q("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
|
+
}), ba = { class: "ez-image-upload" }, ha = {
|
|
444
466
|
key: 0,
|
|
445
467
|
class: "ez-image-upload__image"
|
|
446
|
-
},
|
|
468
|
+
}, Ea = {
|
|
447
469
|
key: 1,
|
|
448
470
|
class: "ez-image-upload__list"
|
|
449
|
-
},
|
|
450
|
-
...
|
|
451
|
-
props: /* @__PURE__ */
|
|
471
|
+
}, Va = { class: "flex items-center justify-center h-full" }, wa = x({ name: "EzImageUpload", inheritAttrs: !1 }), $a = /* @__PURE__ */ x({
|
|
472
|
+
...wa,
|
|
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 Al = { key: 1 }, Dl = {
|
|
|
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 Al = { key: 1 }, Dl = {
|
|
|
473
495
|
"limit",
|
|
474
496
|
"disabled",
|
|
475
497
|
"modelValue"
|
|
476
|
-
]), { t:
|
|
477
|
-
function
|
|
498
|
+
]), o = t, { t: c } = ke(), h = G(!1), V = G(0), y = ee(e, "modelValue"), E = P(() => a.multiple), D = P(() => a.imageTypes.join(",")), q = /^(https?:\/\/|data:|blob:)/i, m = P(() => y.value ? A(y.value) : []);
|
|
499
|
+
function A(U) {
|
|
500
|
+
if (!U) return [];
|
|
501
|
+
const $ = U.trim().replace(/^[,\s]+|[,\s]+$/g, "");
|
|
478
502
|
if (!$) return [];
|
|
479
|
-
const
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
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 se = 0; se < J.length; se++) {
|
|
507
|
+
const oe = J[se].index ?? -1;
|
|
508
|
+
if (oe < 0) continue;
|
|
509
|
+
const ne = J[se + 1]?.index, de = $.slice(oe, ne).trim().replace(/^[,\s]+|[,\s]+$/g, "");
|
|
510
|
+
de && q.test(de) && ae.push(de);
|
|
486
511
|
}
|
|
487
|
-
return
|
|
512
|
+
return ae;
|
|
488
513
|
}
|
|
489
|
-
function
|
|
490
|
-
return
|
|
514
|
+
function v(U) {
|
|
515
|
+
return !U || U.length === 0 ? "" : U.filter(($) => $.trim()).map(($) => $.trim()).join(",");
|
|
491
516
|
}
|
|
492
|
-
const
|
|
493
|
-
if (!
|
|
517
|
+
const d = (U) => a.disabled ? (ge.warning(c("s.message.disabled")), !1) : E.value && m.value.length >= a.limit ? (ge.warning(c("s.validate.upload.limit", { max: a.limit })), !1) : a.imageTypes.includes(U.type.toLocaleLowerCase()) ? U.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), p = async ({ file: U }) => {
|
|
518
|
+
if (!a.disabled)
|
|
494
519
|
try {
|
|
495
|
-
const { url:
|
|
496
|
-
if (
|
|
497
|
-
if (
|
|
498
|
-
const
|
|
499
|
-
|
|
520
|
+
const { url: $ } = await a.api(U);
|
|
521
|
+
if (!$) throw new Error(c("s.message.uploadFail"));
|
|
522
|
+
if (E.value) {
|
|
523
|
+
const I = y.value ? A(y.value) : [];
|
|
524
|
+
$ && q.test($) && (I.push($), y.value = v(I));
|
|
500
525
|
} else
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
526
|
+
y.value = $;
|
|
527
|
+
o("success", U, $);
|
|
528
|
+
} catch ($) {
|
|
529
|
+
const I = $ instanceof Error ? $ : new Error(String($));
|
|
530
|
+
ge.error(I.message), o("error", U, I);
|
|
504
531
|
}
|
|
505
|
-
},
|
|
506
|
-
|
|
507
|
-
},
|
|
508
|
-
if (!
|
|
509
|
-
if (
|
|
510
|
-
const
|
|
511
|
-
|
|
532
|
+
}, Z = (U, $ = 0) => {
|
|
533
|
+
U && (V.value = $, h.value = !0);
|
|
534
|
+
}, N = (U) => {
|
|
535
|
+
if (!a.disabled && !(!U || !y.value))
|
|
536
|
+
if (E.value) {
|
|
537
|
+
const $ = A(y.value), I = $.findIndex((J) => J === U);
|
|
538
|
+
I !== -1 && ($.splice(I, 1), y.value = v($), o("delete", U));
|
|
512
539
|
} else
|
|
513
|
-
|
|
514
|
-
},
|
|
515
|
-
return
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
540
|
+
y.value = "", o("delete", U);
|
|
541
|
+
}, L = G();
|
|
542
|
+
return s({
|
|
543
|
+
clearFiles: () => {
|
|
544
|
+
L.value?.clearFiles?.(), y.value = "";
|
|
545
|
+
},
|
|
546
|
+
submit: () => {
|
|
547
|
+
L.value?.submit?.();
|
|
548
|
+
},
|
|
549
|
+
getUploadRef: () => L.value,
|
|
550
|
+
getUrlList: () => m.value
|
|
551
|
+
}), (U, $) => (r(), C("div", ba, [
|
|
552
|
+
E.value ? (r(), C("div", Ea, [
|
|
553
|
+
(r(!0), C(X, null, re(m.value, (I, J) => (r(), C("div", {
|
|
554
|
+
key: J,
|
|
522
555
|
class: "ez-image-upload__item",
|
|
523
|
-
style:
|
|
556
|
+
style: $e(a.style)
|
|
524
557
|
}, [
|
|
525
|
-
|
|
526
|
-
src:
|
|
527
|
-
fit:
|
|
558
|
+
W(l(Ge), {
|
|
559
|
+
src: I,
|
|
560
|
+
fit: a.fit
|
|
528
561
|
}, null, 8, ["src", "fit"]),
|
|
529
|
-
|
|
562
|
+
Q("div", {
|
|
530
563
|
class: "ez-image-upload__handler",
|
|
531
|
-
onClick:
|
|
564
|
+
onClick: $[3] || ($[3] = Ne(() => {
|
|
532
565
|
}, ["stop"]))
|
|
533
566
|
}, [
|
|
534
|
-
|
|
567
|
+
W(l(ve), {
|
|
535
568
|
size: 18,
|
|
536
|
-
onClick: (
|
|
569
|
+
onClick: (ae) => Z(I, J)
|
|
537
570
|
}, {
|
|
538
|
-
default:
|
|
539
|
-
|
|
571
|
+
default: k(() => [
|
|
572
|
+
W(l(Ze))
|
|
540
573
|
]),
|
|
541
574
|
_: 1
|
|
542
575
|
}, 8, ["onClick"]),
|
|
543
|
-
|
|
576
|
+
a.disabled ? O("", !0) : (r(), g(l(ve), {
|
|
544
577
|
key: 0,
|
|
545
578
|
size: 18,
|
|
546
|
-
onClick: (
|
|
579
|
+
onClick: (ae) => N(I)
|
|
547
580
|
}, {
|
|
548
|
-
default:
|
|
549
|
-
|
|
581
|
+
default: k(() => [
|
|
582
|
+
W(l(Ye))
|
|
550
583
|
]),
|
|
551
584
|
_: 1
|
|
552
585
|
}, 8, ["onClick"]))
|
|
553
586
|
])
|
|
554
587
|
], 4))), 128)),
|
|
555
|
-
|
|
588
|
+
(m.value.length < a.limit || m.value.length === 0) && !a.disabled ? (r(), g(l(He), S({ key: 0 }, l(i), {
|
|
556
589
|
ref_key: "uploadRef",
|
|
557
|
-
ref:
|
|
590
|
+
ref: L,
|
|
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": p,
|
|
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
|
+
Q("div", Va, [
|
|
603
|
+
W(l(ve), null, {
|
|
604
|
+
default: k(() => [
|
|
605
|
+
W(l(Xe))
|
|
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(He), S({ key: 0 }, l(i), {
|
|
580
614
|
ref_key: "uploadRef",
|
|
581
|
-
ref:
|
|
615
|
+
ref: L,
|
|
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": p,
|
|
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", ha, [
|
|
628
|
+
W(l(Ge), {
|
|
629
|
+
src: y.value,
|
|
630
|
+
fit: a.fit
|
|
596
631
|
}, null, 8, ["src", "fit"]),
|
|
597
|
-
|
|
632
|
+
Q("div", {
|
|
598
633
|
class: "ez-image-upload__handler",
|
|
599
|
-
onClick:
|
|
634
|
+
onClick: $[2] || ($[2] = Ne(() => {
|
|
600
635
|
}, ["stop"]))
|
|
601
636
|
}, [
|
|
602
|
-
|
|
637
|
+
W(l(ve), {
|
|
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(Ze))
|
|
608
643
|
]),
|
|
609
644
|
_: 1
|
|
610
645
|
}),
|
|
611
|
-
|
|
646
|
+
a.disabled ? O("", !0) : (r(), g(l(ve), {
|
|
612
647
|
key: 0,
|
|
613
648
|
size: 18,
|
|
614
|
-
onClick:
|
|
649
|
+
onClick: $[1] || ($[1] = (I) => N(y.value))
|
|
615
650
|
}, {
|
|
616
|
-
default:
|
|
617
|
-
|
|
651
|
+
default: k(() => [
|
|
652
|
+
W(l(Ye))
|
|
618
653
|
]),
|
|
619
654
|
_: 1
|
|
620
655
|
}))
|
|
621
656
|
])
|
|
622
|
-
])) : (
|
|
623
|
-
default:
|
|
624
|
-
|
|
657
|
+
])) : (r(), g(l(ve), { key: 1 }, {
|
|
658
|
+
default: k(() => [
|
|
659
|
+
W(l(Xe))
|
|
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(St), {
|
|
632
667
|
key: 2,
|
|
633
|
-
"url-list":
|
|
634
|
-
"initial-index":
|
|
635
|
-
onClose:
|
|
636
|
-
}, null, 8, ["url-list", "initial-index"])) :
|
|
668
|
+
"url-list": E.value ? m.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
|
+
}), rt = te($a);
|
|
675
|
+
var F = /* @__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))(F || {});
|
|
676
|
+
const Sa = /* @__PURE__ */ new Set([
|
|
642
677
|
"select",
|
|
643
678
|
"radio",
|
|
644
679
|
"checkbox",
|
|
@@ -650,10 +685,9 @@ const lt = /* @__PURE__ */ new Set([
|
|
|
650
685
|
"timerange",
|
|
651
686
|
"switch",
|
|
652
687
|
"cascader",
|
|
653
|
-
"tree",
|
|
654
688
|
"tree-select"
|
|
655
689
|
/* TREE_SELECT */
|
|
656
|
-
]),
|
|
690
|
+
]), ka = /* @__PURE__ */ new Set([
|
|
657
691
|
"select",
|
|
658
692
|
"radio",
|
|
659
693
|
"checkbox",
|
|
@@ -665,21 +699,20 @@ const lt = /* @__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 za(e) {
|
|
708
|
+
return e && Sa.has(e) ? "选择" : "输入";
|
|
676
709
|
}
|
|
677
|
-
function
|
|
678
|
-
return e &&
|
|
710
|
+
function Ca(e) {
|
|
711
|
+
return e && ka.has(e) ? "change" : "blur";
|
|
679
712
|
}
|
|
680
|
-
const
|
|
681
|
-
...
|
|
682
|
-
props: /* @__PURE__ */
|
|
713
|
+
const Aa = x({ name: "EzFormItem" }), st = /* @__PURE__ */ x({
|
|
714
|
+
...Aa,
|
|
715
|
+
props: /* @__PURE__ */ _({
|
|
683
716
|
config: {},
|
|
684
717
|
formData: { default: () => ({}) }
|
|
685
718
|
}, {
|
|
@@ -688,193 +721,206 @@ const nt = w({ name: "EzFormItem" }), pe = /* @__PURE__ */ w({
|
|
|
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 = P(() => s.config?.itemAttrs && typeof s.config.itemAttrs == "object" ? s.config.itemAttrs : {}), i = P(() => s.config?.attrs && typeof s.config.attrs == "object" ? s.config.attrs : {}), o = P(() => {
|
|
725
|
+
const v = i.value, {
|
|
726
|
+
disabled: d,
|
|
727
|
+
modelValue: p,
|
|
728
|
+
"onUpdate:modelValue": Z,
|
|
729
|
+
...N
|
|
730
|
+
} = v;
|
|
731
|
+
return N;
|
|
732
|
+
}), c = P(() => {
|
|
733
|
+
const v = i.value, {
|
|
734
|
+
api: d,
|
|
735
|
+
disabled: p,
|
|
736
|
+
modelValue: Z,
|
|
737
|
+
"onUpdate:modelValue": N,
|
|
738
|
+
...L
|
|
739
|
+
} = v;
|
|
740
|
+
return L;
|
|
741
|
+
}), h = P(() => {
|
|
742
|
+
if (s.config?.type === F.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 = P(() => s.config?.options && Array.isArray(s.config.options) ? s.config.options : []), y = () => V.value, E = () => V.value, D = () => V.value, q = () => V.value, m = () => 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 || `请${za(v.type)}${v.label || ""}`, trigger: Ca(v.type) }]), d;
|
|
698
751
|
};
|
|
699
|
-
return (
|
|
752
|
+
return (v, d) => e.config && e.config.prop ? (r(), g(l(kt), 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(xe(e.config.component), S({
|
|
712
765
|
key: 1,
|
|
713
|
-
modelValue:
|
|
714
|
-
"onUpdate:modelValue":
|
|
766
|
+
modelValue: t.value,
|
|
767
|
+
"onUpdate:modelValue": d[0] || (d[0] = (p) => t.value = p),
|
|
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(F).INPUT || !e.config.type ? (r(), g(l(Te), S({
|
|
718
771
|
key: 0,
|
|
719
|
-
modelValue:
|
|
720
|
-
"onUpdate:modelValue":
|
|
772
|
+
modelValue: t.value,
|
|
773
|
+
"onUpdate:modelValue": d[1] || (d[1] = (p) => t.value = p),
|
|
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(F).TEXTAREA ? (r(), g(l(Te), S({
|
|
725
778
|
key: 1,
|
|
726
|
-
modelValue:
|
|
727
|
-
"onUpdate:modelValue":
|
|
779
|
+
modelValue: t.value,
|
|
780
|
+
"onUpdate:modelValue": d[2] || (d[2] = (p) => t.value = p),
|
|
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(F).NUMBER ? (r(), g(l(zt), S({
|
|
732
785
|
key: 2,
|
|
733
|
-
modelValue:
|
|
734
|
-
"onUpdate:modelValue":
|
|
786
|
+
modelValue: t.value,
|
|
787
|
+
"onUpdate:modelValue": d[3] || (d[3] = (p) => t.value = p),
|
|
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(F).PASSWORD ? (r(), g(l(Te), S({
|
|
738
791
|
key: 3,
|
|
739
|
-
modelValue:
|
|
740
|
-
"onUpdate:modelValue":
|
|
792
|
+
modelValue: t.value,
|
|
793
|
+
"onUpdate:modelValue": d[4] || (d[4] = (p) => t.value = p),
|
|
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(F).SELECT ? (r(), g(l(ot), S({
|
|
747
800
|
key: 4,
|
|
748
|
-
modelValue:
|
|
749
|
-
"onUpdate:modelValue":
|
|
750
|
-
options:
|
|
801
|
+
modelValue: t.value,
|
|
802
|
+
"onUpdate:modelValue": d[5] || (d[5] = (p) => t.value = p),
|
|
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(F).RADIO ? (r(), g(l(nt), S({
|
|
754
807
|
key: 5,
|
|
755
|
-
modelValue:
|
|
756
|
-
"onUpdate:modelValue":
|
|
757
|
-
options:
|
|
808
|
+
modelValue: t.value,
|
|
809
|
+
"onUpdate:modelValue": d[6] || (d[6] = (p) => t.value = p),
|
|
810
|
+
options: E(),
|
|
758
811
|
disabled: e.config.disabled
|
|
759
|
-
},
|
|
812
|
+
}, o.value), null, 16, ["modelValue", "options", "disabled"])) : e.config.type === l(F).CHECKBOX ? (r(), g(l(lt), S({
|
|
760
813
|
key: 6,
|
|
761
|
-
modelValue:
|
|
762
|
-
"onUpdate:modelValue":
|
|
763
|
-
options:
|
|
814
|
+
modelValue: t.value,
|
|
815
|
+
"onUpdate:modelValue": d[7] || (d[7] = (p) => t.value = p),
|
|
816
|
+
options: D(),
|
|
764
817
|
disabled: e.config.disabled
|
|
765
|
-
},
|
|
818
|
+
}, o.value), null, 16, ["modelValue", "options", "disabled"])) : e.config.type === l(F).DATE ? (r(), g(l(Ae), S({
|
|
766
819
|
key: 7,
|
|
767
|
-
modelValue:
|
|
768
|
-
"onUpdate:modelValue":
|
|
820
|
+
modelValue: t.value,
|
|
821
|
+
"onUpdate:modelValue": d[8] || (d[8] = (p) => t.value = p),
|
|
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(F).DATETIME ? (r(), g(l(Ae), S({
|
|
773
826
|
key: 8,
|
|
774
|
-
modelValue:
|
|
775
|
-
"onUpdate:modelValue":
|
|
827
|
+
modelValue: t.value,
|
|
828
|
+
"onUpdate:modelValue": d[9] || (d[9] = (p) => t.value = p),
|
|
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(F).DATERANGE ? (r(), g(l(Ae), S({
|
|
780
833
|
key: 9,
|
|
781
|
-
modelValue:
|
|
782
|
-
"onUpdate:modelValue":
|
|
834
|
+
modelValue: t.value,
|
|
835
|
+
"onUpdate:modelValue": d[10] || (d[10] = (p) => t.value = p),
|
|
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(F).DATETIMERANGE ? (r(), g(l(Ae), S({
|
|
789
842
|
key: 10,
|
|
790
|
-
modelValue:
|
|
791
|
-
"onUpdate:modelValue":
|
|
843
|
+
modelValue: t.value,
|
|
844
|
+
"onUpdate:modelValue": d[11] || (d[11] = (p) => t.value = p),
|
|
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(F).TIME ? (r(), g(l(Ke), S({
|
|
798
851
|
key: 11,
|
|
799
|
-
modelValue:
|
|
800
|
-
"onUpdate:modelValue":
|
|
852
|
+
modelValue: t.value,
|
|
853
|
+
"onUpdate:modelValue": d[12] || (d[12] = (p) => t.value = p),
|
|
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(F).TIMERANGE ? (r(), g(l(Ke), S({
|
|
804
857
|
key: 12,
|
|
805
|
-
modelValue:
|
|
806
|
-
"onUpdate:modelValue":
|
|
858
|
+
modelValue: t.value,
|
|
859
|
+
"onUpdate:modelValue": d[13] || (d[13] = (p) => t.value = p),
|
|
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(F).SWITCH ? (r(), g(l(Ct), S({
|
|
813
866
|
key: 13,
|
|
814
|
-
modelValue:
|
|
815
|
-
"onUpdate:modelValue":
|
|
867
|
+
modelValue: t.value,
|
|
868
|
+
"onUpdate:modelValue": d[14] || (d[14] = (p) => t.value = p),
|
|
816
869
|
disabled: e.config.disabled
|
|
817
|
-
},
|
|
870
|
+
}, o.value), null, 16, ["modelValue", "disabled"])) : e.config.type === l(F).TREE_SELECT ? (r(), g(l(At), S({
|
|
818
871
|
key: 14,
|
|
819
|
-
modelValue:
|
|
820
|
-
"onUpdate:modelValue":
|
|
821
|
-
data:
|
|
872
|
+
modelValue: t.value,
|
|
873
|
+
"onUpdate:modelValue": d[15] || (d[15] = (p) => t.value = p),
|
|
874
|
+
data: q(),
|
|
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(F).CASCADER ? (r(), g(l(Dt), S({
|
|
825
878
|
key: 15,
|
|
826
|
-
modelValue:
|
|
827
|
-
"onUpdate:modelValue":
|
|
828
|
-
options:
|
|
879
|
+
modelValue: t.value,
|
|
880
|
+
"onUpdate:modelValue": d[16] || (d[16] = (p) => t.value = p),
|
|
881
|
+
options: m(),
|
|
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(F).SLIDER ? (r(), g(l(xt), S({
|
|
833
886
|
key: 16,
|
|
834
|
-
modelValue:
|
|
835
|
-
"onUpdate:modelValue":
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
"node-key": "id"
|
|
839
|
-
}, a.value), null, 16, ["modelValue", "data"])) : e.config.type === t(A).SLIDER ? (o(), v(t(cl), g({
|
|
887
|
+
modelValue: t.value,
|
|
888
|
+
"onUpdate:modelValue": d[17] || (d[17] = (p) => t.value = p),
|
|
889
|
+
disabled: e.config.disabled
|
|
890
|
+
}, o.value), null, 16, ["modelValue", "disabled"])) : e.config.type === l(F).RATE ? (r(), g(l(Pt), S({
|
|
840
891
|
key: 17,
|
|
841
|
-
modelValue:
|
|
842
|
-
"onUpdate:modelValue":
|
|
892
|
+
modelValue: t.value,
|
|
893
|
+
"onUpdate:modelValue": d[18] || (d[18] = (p) => t.value = p),
|
|
843
894
|
disabled: e.config.disabled
|
|
844
|
-
},
|
|
895
|
+
}, o.value), null, 16, ["modelValue", "disabled"])) : e.config.type === l(F).UPLOAD_IMAGES ? (r(), g(l(rt), S({
|
|
845
896
|
key: 18,
|
|
846
|
-
modelValue:
|
|
847
|
-
"onUpdate:modelValue":
|
|
848
|
-
|
|
849
|
-
}, a.value), null, 16, ["modelValue", "disabled"])) : e.config.type === t(A).UPLOAD_IMAGES && a.value.api ? (o(), v(t(qe), g({
|
|
850
|
-
key: 19,
|
|
851
|
-
modelValue: l.value,
|
|
852
|
-
"onUpdate:modelValue": s[20] || (s[20] = (r) => l.value = r),
|
|
853
|
-
api: a.value.api,
|
|
897
|
+
modelValue: t.value,
|
|
898
|
+
"onUpdate:modelValue": d[19] || (d[19] = (p) => t.value = p),
|
|
899
|
+
api: h.value,
|
|
854
900
|
disabled: e.config.disabled
|
|
855
|
-
},
|
|
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
|
-
}),
|
|
915
|
+
}), Da = {
|
|
870
916
|
key: 0,
|
|
871
917
|
class: "ez-dynamic-form-group__title"
|
|
872
|
-
},
|
|
918
|
+
}, xa = {
|
|
873
919
|
key: 1,
|
|
874
920
|
class: "ez-dynamic-form-group__description"
|
|
875
|
-
},
|
|
876
|
-
...
|
|
877
|
-
props: /* @__PURE__ */
|
|
921
|
+
}, Pa = x({ name: "EzDynamicForm", inheritAttrs: !1 }), Ua = /* @__PURE__ */ x({
|
|
922
|
+
...Pa,
|
|
923
|
+
props: /* @__PURE__ */ _({
|
|
878
924
|
items: { default: () => [] },
|
|
879
925
|
groups: { default: () => [] },
|
|
880
926
|
modelValue: {},
|
|
@@ -898,221 +944,257 @@ const nt = w({ name: "EzFormItem" }), pe = /* @__PURE__ */ w({
|
|
|
898
944
|
modelModifiers: {}
|
|
899
945
|
}),
|
|
900
946
|
emits: ["update:modelValue"],
|
|
901
|
-
setup(e, { expose:
|
|
902
|
-
const
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
947
|
+
setup(e, { expose: s }) {
|
|
948
|
+
const t = e, a = mt(), i = ee(e, "modelValue"), o = Me(), c = Me({}), 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 Y = [];
|
|
957
|
+
return b.set(T, Y), T.forEach((me, pe) => {
|
|
958
|
+
Y[pe] = n(me);
|
|
959
|
+
}), Y;
|
|
960
|
+
}
|
|
961
|
+
if (h(w)) {
|
|
962
|
+
const T = w;
|
|
963
|
+
if (b.has(T))
|
|
964
|
+
return b.get(T);
|
|
965
|
+
const Y = {};
|
|
966
|
+
return b.set(T, Y), Object.entries(T).forEach(([me, pe]) => {
|
|
967
|
+
Y[me] = n(pe);
|
|
968
|
+
}), Y;
|
|
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);
|
|
909
978
|
});
|
|
910
|
-
},
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
979
|
+
}, q = P(() => {
|
|
980
|
+
const { items: u, groups: b, cols: n, gutter: w, modelValue: T, ...Y } = t;
|
|
981
|
+
return Y;
|
|
982
|
+
}), m = P(() => Math.floor(24 / t.cols)), A = P(() => t.groups?.length ? t.groups.flatMap((u) => u.items || []) : t.items || []), v = P(() => 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
|
+
}, p = (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
|
+
}, N = (u, b) => ({
|
|
994
|
+
item: V(u),
|
|
995
|
+
formData: V(b)
|
|
996
|
+
}), L = (u) => {
|
|
997
|
+
const b = V(u);
|
|
998
|
+
return A.value.forEach((n) => {
|
|
999
|
+
if (n.deserialize)
|
|
1000
|
+
try {
|
|
1001
|
+
const w = N(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
|
+
}, B = (u) => {
|
|
1008
|
+
const b = V(u);
|
|
1009
|
+
return A.value.forEach((n) => {
|
|
1010
|
+
if (!n.serialize) return;
|
|
1011
|
+
let w;
|
|
1012
|
+
try {
|
|
1013
|
+
const T = N(n, b);
|
|
1014
|
+
w = n.serialize(b[n.prop], T.formData, T.item);
|
|
1015
|
+
} catch (T) {
|
|
1016
|
+
Z("serialize", n, T);
|
|
1017
|
+
return;
|
|
1018
|
+
}
|
|
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);
|
|
1025
|
+
}
|
|
1026
|
+
}), b;
|
|
1027
|
+
};
|
|
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 }), Oe(() => {
|
|
1029
|
+
D(), ce();
|
|
1030
|
+
});
|
|
1031
|
+
const le = (u, b, n) => {
|
|
919
1032
|
if (!u) return !0;
|
|
920
1033
|
try {
|
|
921
|
-
return u(
|
|
922
|
-
} catch (
|
|
923
|
-
return console.error(`[EzDynamicForm] ${
|
|
1034
|
+
return u(i.value);
|
|
1035
|
+
} catch (w) {
|
|
1036
|
+
return console.error(`[EzDynamicForm] ${b} visibility error for "${n}":`, w), !1;
|
|
924
1037
|
}
|
|
925
|
-
},
|
|
926
|
-
const u =
|
|
927
|
-
return
|
|
928
|
-
if (!
|
|
929
|
-
const
|
|
930
|
-
if (!
|
|
931
|
-
const
|
|
932
|
-
|
|
933
|
-
key: `${
|
|
934
|
-
index:
|
|
935
|
-
group:
|
|
936
|
-
items:
|
|
937
|
-
cols:
|
|
938
|
-
gutter:
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
bodySlotName: he
|
|
1038
|
+
}, U = P(() => {
|
|
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 (!le(n.show, "group", T)) return;
|
|
1044
|
+
const Y = (n.items || []).filter((f) => f.hidden ? !1 : le(f.show, "item", f.prop)), me = Math.max(1, n.cols || t.cols), pe = n.gutter ?? t.gutter, Pe = n.headerSlot || (n.name ? `group-header-${n.name}` : void 0), Ue = n.slot || (n.name ? `group-${n.name}` : void 0);
|
|
1045
|
+
b.push({
|
|
1046
|
+
key: `${T}-${w}`,
|
|
1047
|
+
index: w,
|
|
1048
|
+
group: n,
|
|
1049
|
+
items: Y,
|
|
1050
|
+
cols: me,
|
|
1051
|
+
gutter: pe,
|
|
1052
|
+
headerSlotName: Pe,
|
|
1053
|
+
bodySlotName: Ue
|
|
942
1054
|
});
|
|
943
|
-
}),
|
|
944
|
-
}),
|
|
1055
|
+
}), b;
|
|
1056
|
+
}), $ = (u, b) => {
|
|
945
1057
|
if (u.span !== void 0)
|
|
946
1058
|
return Math.max(1, Math.min(24, u.span));
|
|
947
|
-
const
|
|
948
|
-
return Math.max(1, Math.floor(24 /
|
|
949
|
-
},
|
|
950
|
-
let
|
|
951
|
-
if (!
|
|
1059
|
+
const n = Math.max(1, b);
|
|
1060
|
+
return Math.max(1, Math.floor(24 / n)) || m.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)
|
|
952
1064
|
try {
|
|
953
|
-
|
|
954
|
-
} catch (
|
|
955
|
-
console.error(`[EzDynamicForm] Disabled check error for "${u.prop}":`,
|
|
1065
|
+
b = u.disabledWhen(i.value);
|
|
1066
|
+
} catch (n) {
|
|
1067
|
+
console.error(`[EzDynamicForm] Disabled check error for "${u.prop}":`, n);
|
|
956
1068
|
}
|
|
957
|
-
return { ...u, disabled:
|
|
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
|
+
}, se = 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), de = () => B(ne()), ce = () => {
|
|
1093
|
+
c.value = ne();
|
|
1094
|
+
}, fe = (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(), Re(() => {
|
|
1099
|
+
o.value?.clearValidate();
|
|
1100
|
+
});
|
|
958
1101
|
};
|
|
959
|
-
return
|
|
960
|
-
validate:
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
},
|
|
969
|
-
validateField: async (u) => {
|
|
970
|
-
if (!f.value)
|
|
971
|
-
return console.warn("[EzDynamicForm] Form ref is not available"), !1;
|
|
972
|
-
try {
|
|
973
|
-
return await f.value.validateField(u), !0;
|
|
974
|
-
} catch {
|
|
975
|
-
return !1;
|
|
976
|
-
}
|
|
977
|
-
},
|
|
978
|
-
clearValidate: (u) => {
|
|
979
|
-
if (!f.value) {
|
|
980
|
-
console.warn("[EzDynamicForm] Form ref is not available");
|
|
981
|
-
return;
|
|
982
|
-
}
|
|
983
|
-
f.value.clearValidate(u);
|
|
1102
|
+
return s({
|
|
1103
|
+
validate: ae,
|
|
1104
|
+
validateField: se,
|
|
1105
|
+
clearValidate: oe,
|
|
1106
|
+
getFormData: ne,
|
|
1107
|
+
getSubmitData: de,
|
|
1108
|
+
setFormData: fe,
|
|
1109
|
+
setSubmitData: (u, b = !0) => {
|
|
1110
|
+
u && fe(p(L(u)), b);
|
|
984
1111
|
},
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
r();
|
|
989
|
-
const p = s(u);
|
|
990
|
-
k ? Object.assign(a.value, p) : a.value = p, R(), Le(() => {
|
|
991
|
-
f.value?.clearValidate();
|
|
1112
|
+
resetForm: () => {
|
|
1113
|
+
i.value = V(c.value), D(), Re(() => {
|
|
1114
|
+
o.value?.clearValidate();
|
|
992
1115
|
});
|
|
993
1116
|
},
|
|
994
|
-
|
|
995
|
-
|
|
1117
|
+
captureInitialData: ce,
|
|
1118
|
+
formRef: o
|
|
1119
|
+
}), (u, b) => (r(), g(l(Ut), S({
|
|
996
1120
|
ref_key: "formRef",
|
|
997
|
-
ref:
|
|
1121
|
+
ref: o,
|
|
998
1122
|
class: "ez-dynamic-form",
|
|
999
|
-
"label-width": "auto"
|
|
1000
|
-
},
|
|
1001
|
-
default:
|
|
1002
|
-
(
|
|
1003
|
-
key:
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
default: y(() => [
|
|
1010
|
-
(o(!0), V(P, null, W(p.items, (b) => (o(), v(t(Ce), {
|
|
1011
|
-
key: b.prop,
|
|
1012
|
-
span: Z(b, p.cols)
|
|
1013
|
-
}, {
|
|
1014
|
-
default: y(() => [
|
|
1015
|
-
M(pe, {
|
|
1016
|
-
modelValue: a.value[b.prop],
|
|
1017
|
-
"onUpdate:modelValue": (I) => a.value[b.prop] = I,
|
|
1018
|
-
config: $(b),
|
|
1019
|
-
formData: a.value
|
|
1020
|
-
}, ae({ _: 2 }, [
|
|
1021
|
-
u.$slots[`label-${b.prop}`] ? {
|
|
1022
|
-
name: "label",
|
|
1023
|
-
fn: y(() => [
|
|
1024
|
-
C(u.$slots, `label-${b.prop}`, { item: b })
|
|
1025
|
-
]),
|
|
1026
|
-
key: "0"
|
|
1027
|
-
} : void 0,
|
|
1028
|
-
u.$slots[b.prop] ? {
|
|
1029
|
-
name: "default",
|
|
1030
|
-
fn: y(({ config: I, value: h }) => [
|
|
1031
|
-
C(u.$slots, b.prop, {
|
|
1032
|
-
item: I,
|
|
1033
|
-
value: h,
|
|
1034
|
-
formData: a.value
|
|
1035
|
-
})
|
|
1036
|
-
]),
|
|
1037
|
-
key: "1"
|
|
1038
|
-
} : void 0
|
|
1039
|
-
]), 1032, ["modelValue", "onUpdate:modelValue", "config", "formData"])
|
|
1040
|
-
]),
|
|
1041
|
-
_: 2
|
|
1042
|
-
}, 1032, ["span"]))), 128))
|
|
1043
|
-
]),
|
|
1044
|
-
_: 2
|
|
1045
|
-
}, 1032, ["gutter"])) : (o(), V("section", {
|
|
1046
|
-
key: 1,
|
|
1047
|
-
class: ce(["ez-dynamic-form-group", p.group.className]),
|
|
1048
|
-
style: ie(p.group.style)
|
|
1049
|
-
}, [
|
|
1050
|
-
J(p) ? (o(), V("div", {
|
|
1123
|
+
"label-width": t.labelWidth ?? "auto"
|
|
1124
|
+
}, q.value, { model: i.value }), {
|
|
1125
|
+
default: k(() => [
|
|
1126
|
+
(r(!0), C(X, null, re(U.value, (n) => (r(), g(xe(v.value ? "section" : "div"), {
|
|
1127
|
+
key: n.key,
|
|
1128
|
+
class: De(v.value ? ["ez-dynamic-form-group", n.group.className] : void 0),
|
|
1129
|
+
style: $e(v.value ? n.group.style : void 0)
|
|
1130
|
+
}, {
|
|
1131
|
+
default: k(() => [
|
|
1132
|
+
I(n) ? (r(), C("div", {
|
|
1051
1133
|
key: 0,
|
|
1052
|
-
class:
|
|
1053
|
-
style:
|
|
1134
|
+
class: De(["ez-dynamic-form-group__header", n.group.headerClassName]),
|
|
1135
|
+
style: $e(n.group.headerStyle)
|
|
1054
1136
|
}, [
|
|
1055
|
-
|
|
1137
|
+
n.headerSlotName && u.$slots[n.headerSlotName] ? R(u.$slots, n.headerSlotName, {
|
|
1056
1138
|
key: 0,
|
|
1057
|
-
group:
|
|
1058
|
-
index:
|
|
1059
|
-
items:
|
|
1060
|
-
formData:
|
|
1061
|
-
}) : u.$slots["group-header"] ?
|
|
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", {
|
|
1062
1144
|
key: 1,
|
|
1063
|
-
group:
|
|
1064
|
-
index:
|
|
1065
|
-
items:
|
|
1066
|
-
formData:
|
|
1067
|
-
}) : (
|
|
1068
|
-
|
|
1069
|
-
|
|
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", Da, ue(n.group.title), 1)) : O("", !0),
|
|
1151
|
+
n.group.description ? (r(), C("div", xa, ue(n.group.description), 1)) : O("", !0)
|
|
1070
1152
|
], 64))
|
|
1071
|
-
], 6)) :
|
|
1072
|
-
|
|
1153
|
+
], 6)) : O("", !0),
|
|
1154
|
+
v.value && n.bodySlotName && u.$slots[n.bodySlotName] ? R(u.$slots, n.bodySlotName, {
|
|
1073
1155
|
key: 1,
|
|
1074
|
-
group:
|
|
1075
|
-
index:
|
|
1076
|
-
items:
|
|
1077
|
-
formData:
|
|
1078
|
-
}) : u.$slots.group ?
|
|
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", {
|
|
1079
1161
|
key: 2,
|
|
1080
|
-
group:
|
|
1081
|
-
index:
|
|
1082
|
-
items:
|
|
1083
|
-
formData:
|
|
1084
|
-
}) : (
|
|
1162
|
+
group: n.group,
|
|
1163
|
+
index: n.index,
|
|
1164
|
+
items: n.items,
|
|
1165
|
+
formData: i.value
|
|
1166
|
+
}) : (r(), g(l(Tt), {
|
|
1085
1167
|
key: 3,
|
|
1086
|
-
gutter:
|
|
1087
|
-
class:
|
|
1088
|
-
style:
|
|
1168
|
+
gutter: n.gutter,
|
|
1169
|
+
class: De(v.value ? ["ez-dynamic-form-group__body", n.group.bodyClassName] : void 0),
|
|
1170
|
+
style: $e(v.value ? n.group.bodyStyle : void 0)
|
|
1089
1171
|
}, {
|
|
1090
|
-
default:
|
|
1091
|
-
(
|
|
1092
|
-
key: `${
|
|
1093
|
-
span:
|
|
1172
|
+
default: k(() => [
|
|
1173
|
+
(r(!0), C(X, null, re(n.items, (w) => (r(), g(l(Mt), {
|
|
1174
|
+
key: `${n.key}-${w.prop}`,
|
|
1175
|
+
span: $(w, n.cols)
|
|
1094
1176
|
}, {
|
|
1095
|
-
default:
|
|
1096
|
-
|
|
1097
|
-
modelValue:
|
|
1098
|
-
"onUpdate:modelValue": (
|
|
1099
|
-
config:
|
|
1100
|
-
formData:
|
|
1101
|
-
},
|
|
1102
|
-
u.$slots[`label-${
|
|
1177
|
+
default: k(() => [
|
|
1178
|
+
W(st, {
|
|
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}`] ? {
|
|
1103
1185
|
name: "label",
|
|
1104
|
-
fn:
|
|
1105
|
-
|
|
1186
|
+
fn: k(() => [
|
|
1187
|
+
R(u.$slots, `label-${w.prop}`, { item: w })
|
|
1106
1188
|
]),
|
|
1107
1189
|
key: "0"
|
|
1108
1190
|
} : void 0,
|
|
1109
|
-
u.$slots[
|
|
1191
|
+
u.$slots[w.prop] ? {
|
|
1110
1192
|
name: "default",
|
|
1111
|
-
fn:
|
|
1112
|
-
|
|
1113
|
-
item:
|
|
1114
|
-
value:
|
|
1115
|
-
formData:
|
|
1193
|
+
fn: k(({ config: T, value: Y }) => [
|
|
1194
|
+
R(u.$slots, w.prop, {
|
|
1195
|
+
item: T,
|
|
1196
|
+
value: Y,
|
|
1197
|
+
formData: i.value
|
|
1116
1198
|
})
|
|
1117
1199
|
]),
|
|
1118
1200
|
key: "1"
|
|
@@ -1124,190 +1206,232 @@ const nt = w({ name: "EzFormItem" }), pe = /* @__PURE__ */ w({
|
|
|
1124
1206
|
]),
|
|
1125
1207
|
_: 2
|
|
1126
1208
|
}, 1032, ["gutter", "class", "style"]))
|
|
1127
|
-
],
|
|
1128
|
-
|
|
1209
|
+
]),
|
|
1210
|
+
_: 2
|
|
1211
|
+
}, 1032, ["class", "style"]))), 128))
|
|
1129
1212
|
]),
|
|
1130
1213
|
_: 3
|
|
1131
|
-
}, 16, ["model"]));
|
|
1214
|
+
}, 16, ["label-width", "model"]));
|
|
1132
1215
|
}
|
|
1133
|
-
}),
|
|
1134
|
-
...
|
|
1216
|
+
}), Ta = te(Ua), Ma = te(st), Ra = x({ name: "EzTable", inheritAttrs: !1 }), it = /* @__PURE__ */ x({
|
|
1217
|
+
...Ra,
|
|
1135
1218
|
props: {
|
|
1136
1219
|
data: { default: () => [] },
|
|
1137
1220
|
columns: { default: () => [] },
|
|
1138
|
-
|
|
1221
|
+
border: { type: Boolean, default: !0 },
|
|
1222
|
+
rowKey: { type: [String, Function], default: "id" }
|
|
1139
1223
|
},
|
|
1140
|
-
setup(e, { expose:
|
|
1141
|
-
const
|
|
1142
|
-
const m =
|
|
1143
|
-
return
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1224
|
+
setup(e, { expose: s }) {
|
|
1225
|
+
const t = e, a = G(), i = /* @__PURE__ */ new Set(["hidden", "emptyValue", "sortMode", "sortField"]), o = (m) => m === !0, c = (m) => m == null || m === "", h = () => t.columns.filter((m) => ["selection", "index", "expand"].includes(m.type || "") ? !1 : !o(m.hidden)), V = P(() => {
|
|
1226
|
+
const m = h(), A = m[m.length - 1];
|
|
1227
|
+
return A?.columnKey || A?.prop || null;
|
|
1228
|
+
}), y = (m) => m.type ? !1 : (m.columnKey || m.prop) !== V.value, E = (m) => {
|
|
1229
|
+
const A = m.formatter, v = m.emptyValue !== void 0;
|
|
1230
|
+
if (!(!A && !v))
|
|
1231
|
+
return (d, p, Z, N) => {
|
|
1232
|
+
const L = A ? A(d, p, Z, N) : Z;
|
|
1233
|
+
return v && c(L) ? m.emptyValue : L;
|
|
1234
|
+
};
|
|
1235
|
+
}, D = (m) => {
|
|
1236
|
+
const v = {
|
|
1237
|
+
...{
|
|
1238
|
+
align: "center",
|
|
1239
|
+
resizable: !0,
|
|
1240
|
+
reserveSelection: m.type === "selection",
|
|
1241
|
+
showOverflowTooltip: y(m)
|
|
1242
|
+
},
|
|
1243
|
+
...m,
|
|
1244
|
+
formatter: E(m)
|
|
1245
|
+
}, d = Object.fromEntries(
|
|
1246
|
+
Object.entries(v).filter(([p]) => !i.has(p))
|
|
1247
|
+
);
|
|
1248
|
+
return m.sortMode === "remote" && (d.sortable = "custom"), d;
|
|
1151
1249
|
};
|
|
1152
|
-
return
|
|
1153
|
-
getTableRef: () =>
|
|
1154
|
-
clearSelection: () =>
|
|
1155
|
-
toggleRowSelection: (
|
|
1156
|
-
toggleAllSelection: () =>
|
|
1157
|
-
toggleRowExpansion: (
|
|
1158
|
-
setCurrentRow: (
|
|
1159
|
-
clearSort: () =>
|
|
1160
|
-
clearFilter: (
|
|
1161
|
-
doLayout: () =>
|
|
1162
|
-
sort: (
|
|
1163
|
-
}), (
|
|
1250
|
+
return s({
|
|
1251
|
+
getTableRef: () => a.value,
|
|
1252
|
+
clearSelection: () => a.value?.clearSelection(),
|
|
1253
|
+
toggleRowSelection: (m, A) => a.value?.toggleRowSelection(m, A),
|
|
1254
|
+
toggleAllSelection: () => a.value?.toggleAllSelection(),
|
|
1255
|
+
toggleRowExpansion: (m, A) => a.value?.toggleRowExpansion(m, A),
|
|
1256
|
+
setCurrentRow: (m) => a.value?.setCurrentRow(m),
|
|
1257
|
+
clearSort: () => a.value?.clearSort(),
|
|
1258
|
+
clearFilter: (m) => a.value?.clearFilter(m),
|
|
1259
|
+
doLayout: () => a.value?.doLayout(),
|
|
1260
|
+
sort: (m, A) => a.value?.sort(m, A)
|
|
1261
|
+
}), (m, A) => (r(), g(l(Rt), S({
|
|
1164
1262
|
ref_key: "tableRef",
|
|
1165
|
-
ref:
|
|
1166
|
-
data:
|
|
1167
|
-
border:
|
|
1168
|
-
"row-key":
|
|
1169
|
-
},
|
|
1170
|
-
default:
|
|
1171
|
-
(
|
|
1172
|
-
key:
|
|
1263
|
+
ref: a,
|
|
1264
|
+
data: t.data,
|
|
1265
|
+
border: t.border,
|
|
1266
|
+
"row-key": t.rowKey
|
|
1267
|
+
}, m.$attrs), Se({
|
|
1268
|
+
default: k(() => [
|
|
1269
|
+
(r(!0), C(X, null, re(t.columns, (v, d) => (r(), C(X, {
|
|
1270
|
+
key: v.columnKey || v.prop || `${v.type || "column"}-${d}`
|
|
1173
1271
|
}, [
|
|
1174
|
-
["selection", "index"].includes(
|
|
1272
|
+
["selection", "index"].includes(v.type) ? (r(), g(l(je), S({
|
|
1175
1273
|
key: 0,
|
|
1176
1274
|
ref_for: !0
|
|
1177
|
-
},
|
|
1275
|
+
}, D(v)), null, 16)) : o(v.hidden) ? O("", !0) : (r(), g(l(je), S({
|
|
1178
1276
|
key: 1,
|
|
1179
1277
|
ref_for: !0
|
|
1180
|
-
},
|
|
1181
|
-
|
|
1278
|
+
}, D(v)), Se({ _: 2 }, [
|
|
1279
|
+
m.$slots[v.prop] ? {
|
|
1182
1280
|
name: "default",
|
|
1183
|
-
fn:
|
|
1184
|
-
|
|
1281
|
+
fn: k((p) => [
|
|
1282
|
+
R(m.$slots, v.prop, S({ ref_for: !0 }, p))
|
|
1185
1283
|
]),
|
|
1186
1284
|
key: "0"
|
|
1187
|
-
} : d.transform ? {
|
|
1188
|
-
name: "default",
|
|
1189
|
-
fn: y((s) => [
|
|
1190
|
-
_(Y(d.transform(s.row)), 1)
|
|
1191
|
-
]),
|
|
1192
|
-
key: "1"
|
|
1193
1285
|
} : void 0,
|
|
1194
|
-
|
|
1286
|
+
m.$slots[`header-${v.prop}`] ? {
|
|
1195
1287
|
name: "header",
|
|
1196
|
-
fn:
|
|
1197
|
-
|
|
1288
|
+
fn: k((p) => [
|
|
1289
|
+
R(m.$slots, `header-${v.prop}`, S({ ref_for: !0 }, p))
|
|
1198
1290
|
]),
|
|
1199
|
-
key: "
|
|
1291
|
+
key: "1"
|
|
1200
1292
|
} : void 0
|
|
1201
1293
|
]), 1040))
|
|
1202
1294
|
], 64))), 128))
|
|
1203
1295
|
]),
|
|
1204
1296
|
_: 2
|
|
1205
1297
|
}, [
|
|
1206
|
-
|
|
1298
|
+
m.$slots?.append ? {
|
|
1207
1299
|
name: "append",
|
|
1208
|
-
fn:
|
|
1209
|
-
|
|
1300
|
+
fn: k(() => [
|
|
1301
|
+
R(m.$slots, "append")
|
|
1210
1302
|
]),
|
|
1211
1303
|
key: "0"
|
|
1212
1304
|
} : void 0,
|
|
1213
|
-
|
|
1305
|
+
m.$slots?.empty ? {
|
|
1214
1306
|
name: "empty",
|
|
1215
|
-
fn:
|
|
1216
|
-
|
|
1307
|
+
fn: k(() => [
|
|
1308
|
+
R(m.$slots, "empty")
|
|
1217
1309
|
]),
|
|
1218
1310
|
key: "1"
|
|
1219
1311
|
} : void 0
|
|
1220
|
-
]), 1040, ["data"]));
|
|
1312
|
+
]), 1040, ["data", "border", "row-key"]));
|
|
1221
1313
|
}
|
|
1222
|
-
}),
|
|
1223
|
-
...
|
|
1224
|
-
props: /* @__PURE__ */
|
|
1225
|
-
|
|
1226
|
-
|
|
1314
|
+
}), Ia = { class: "ez-query-panel" }, Oa = { class: "ez-query-panel__operate" }, Ba = x({ name: "EzQueryPanel", inheritAttrs: !1 }), Fa = /* @__PURE__ */ x({
|
|
1315
|
+
...Ba,
|
|
1316
|
+
props: /* @__PURE__ */ _({
|
|
1317
|
+
expanded: { type: Boolean },
|
|
1318
|
+
collapsedHeight: { default: 50 }
|
|
1227
1319
|
}, {
|
|
1228
|
-
expanded: { default: !1 },
|
|
1320
|
+
expanded: { type: Boolean, default: !1 },
|
|
1229
1321
|
expandedModifiers: {}
|
|
1230
1322
|
}),
|
|
1231
1323
|
emits: ["update:expanded"],
|
|
1232
|
-
setup(e, { expose:
|
|
1233
|
-
const
|
|
1234
|
-
let
|
|
1235
|
-
const
|
|
1236
|
-
|
|
1237
|
-
}, 100),
|
|
1238
|
-
|
|
1324
|
+
setup(e, { expose: s }) {
|
|
1325
|
+
const t = e, { t: a } = ke(), i = G(), o = G(), c = G(0), h = ee(e, "expanded"), V = P(() => c.value > t.collapsedHeight), y = P(() => h.value ? fa : da), E = P(() => h.value ? a("s.button.collapse") : a("s.button.expand"));
|
|
1326
|
+
let D = null;
|
|
1327
|
+
const q = Qt(() => {
|
|
1328
|
+
i.value && (c.value = i.value.scrollHeight);
|
|
1329
|
+
}, 100), m = () => {
|
|
1330
|
+
h.value = !h.value;
|
|
1239
1331
|
};
|
|
1240
|
-
return
|
|
1332
|
+
return Oe(() => {
|
|
1241
1333
|
setTimeout(() => {
|
|
1242
|
-
|
|
1334
|
+
i.value && (q(), D = new ResizeObserver(q), D.observe(i.value));
|
|
1243
1335
|
}, 50);
|
|
1244
|
-
}),
|
|
1245
|
-
|
|
1246
|
-
}),
|
|
1247
|
-
countViewHeight:
|
|
1248
|
-
}), (
|
|
1249
|
-
|
|
1250
|
-
class: "ez-
|
|
1251
|
-
style:
|
|
1252
|
-
height:
|
|
1336
|
+
}), pt(() => {
|
|
1337
|
+
D && (D.disconnect(), D = null);
|
|
1338
|
+
}), s({
|
|
1339
|
+
countViewHeight: q
|
|
1340
|
+
}), (A, v) => (r(), C("div", Ia, [
|
|
1341
|
+
Q("div", {
|
|
1342
|
+
class: "ez-query-panel__wrapper",
|
|
1343
|
+
style: $e({
|
|
1344
|
+
height: c.value ? h.value ? `${c.value}px` : `${t.collapsedHeight}px` : "auto"
|
|
1253
1345
|
})
|
|
1254
1346
|
}, [
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
icon: d.value,
|
|
1260
|
-
size: "small",
|
|
1261
|
-
title: s.value,
|
|
1262
|
-
circle: "",
|
|
1263
|
-
onClick: j[0] || (j[0] = (X) => K())
|
|
1264
|
-
}, null, 8, ["icon", "title"])) : D("", !0)
|
|
1265
|
-
]),
|
|
1266
|
-
N("div", {
|
|
1267
|
-
ref_key: "wrapRef",
|
|
1268
|
-
ref: a
|
|
1347
|
+
Q("div", {
|
|
1348
|
+
ref_key: "layoutRef",
|
|
1349
|
+
ref: i,
|
|
1350
|
+
class: "ez-query-panel__layout"
|
|
1269
1351
|
}, [
|
|
1270
|
-
|
|
1352
|
+
Q("div", Oa, [
|
|
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) => m())
|
|
1361
|
+
}, null, 8, ["icon", "title"])) : O("", !0)
|
|
1362
|
+
]),
|
|
1363
|
+
Q("div", {
|
|
1364
|
+
ref_key: "wrapRef",
|
|
1365
|
+
ref: o,
|
|
1366
|
+
class: "ez-query-panel__content"
|
|
1367
|
+
}, [
|
|
1368
|
+
R(A.$slots, "default")
|
|
1369
|
+
], 512)
|
|
1271
1370
|
], 512)
|
|
1272
1371
|
], 4)
|
|
1273
1372
|
]));
|
|
1274
1373
|
}
|
|
1275
|
-
}),
|
|
1276
|
-
...
|
|
1277
|
-
props: {
|
|
1374
|
+
}), ut = te(Fa), Na = x({ name: "EzPagination", inheritAttrs: !1 }), La = /* @__PURE__ */ x({
|
|
1375
|
+
...Na,
|
|
1376
|
+
props: /* @__PURE__ */ _({
|
|
1278
1377
|
currentPage: {},
|
|
1279
|
-
currentPageModifiers: {},
|
|
1280
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 },
|
|
1281
1388
|
pageSizeModifiers: {}
|
|
1282
|
-
},
|
|
1283
|
-
emits: ["update:currentPage", "update:pageSize"],
|
|
1284
|
-
setup(e) {
|
|
1285
|
-
const
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
"
|
|
1289
|
-
|
|
1290
|
-
"
|
|
1291
|
-
"
|
|
1292
|
-
|
|
1293
|
-
|
|
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(It), 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"]));
|
|
1294
1418
|
}
|
|
1295
|
-
}),
|
|
1296
|
-
var
|
|
1297
|
-
const
|
|
1298
|
-
const
|
|
1419
|
+
}), dt = te(La);
|
|
1420
|
+
var Ie = /* @__PURE__ */ ((e) => (e.ASC = "ascending", e.DESC = "descending", e[e.EMPTY = null] = "EMPTY", e))(Ie || {});
|
|
1421
|
+
const qa = (e, s) => typeof s == "function" ? s(e) : e[s], Ha = (e) => {
|
|
1422
|
+
const s = Me([]), t = P(() => s.value), a = P(() => s.value.map((c) => qa(c, e)));
|
|
1299
1423
|
return {
|
|
1300
|
-
selectionChange: (
|
|
1301
|
-
|
|
1424
|
+
selectionChange: (c) => {
|
|
1425
|
+
s.value = c;
|
|
1302
1426
|
},
|
|
1303
|
-
getSelectedList:
|
|
1304
|
-
getSelectedIds:
|
|
1305
|
-
getSortParams: ({ prop:
|
|
1306
|
-
const
|
|
1307
|
-
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 === Ie.ASC ? (E.asc = y, E.desc = null) : h === Ie.DESC && (E.asc = null, E.desc = y), E;
|
|
1308
1432
|
}
|
|
1309
1433
|
};
|
|
1310
|
-
},
|
|
1434
|
+
}, Ga = /* @__PURE__ */ x({
|
|
1311
1435
|
__name: "column-config",
|
|
1312
1436
|
props: {
|
|
1313
1437
|
modelValue: { type: Boolean, default: !1 },
|
|
@@ -1315,242 +1439,375 @@ const Vt = (e) => {
|
|
|
1315
1439
|
columns: { default: () => [] },
|
|
1316
1440
|
columnsModifiers: {}
|
|
1317
1441
|
},
|
|
1318
|
-
emits: /* @__PURE__ */
|
|
1319
|
-
setup(e, { emit:
|
|
1320
|
-
const { t
|
|
1321
|
-
return (
|
|
1322
|
-
modelValue:
|
|
1323
|
-
"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(Ot), {
|
|
1446
|
+
modelValue: o.value,
|
|
1447
|
+
"onUpdate:modelValue": y[1] || (y[1] = (E) => o.value = E),
|
|
1324
1448
|
class: "ez-column-wrapper",
|
|
1325
|
-
title: t
|
|
1449
|
+
title: l(t)("s.label.column"),
|
|
1326
1450
|
size: "15%"
|
|
1327
1451
|
}, {
|
|
1328
|
-
default:
|
|
1329
|
-
(
|
|
1330
|
-
key:
|
|
1452
|
+
default: k(() => [
|
|
1453
|
+
(r(!0), C(X, null, re(c.value, (E, D) => (r(), C(X, {
|
|
1454
|
+
key: E.columnKey || E.prop || `${E.type || "column"}-${D}`
|
|
1331
1455
|
}, [
|
|
1332
|
-
|
|
1456
|
+
a.includes(E.type) ? O("", !0) : (r(), g(l(at), {
|
|
1333
1457
|
key: 0,
|
|
1334
|
-
|
|
1335
|
-
"onUpdate:modelValue": (R) => r.hidden = R,
|
|
1458
|
+
"model-value": !E.hidden,
|
|
1336
1459
|
class: "flex",
|
|
1337
|
-
|
|
1338
|
-
"
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
onChange: s[0] || (s[0] = (R) => a("change"))
|
|
1343
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue", "label", "disabled"]))
|
|
1460
|
+
label: E.label,
|
|
1461
|
+
"onUpdate:modelValue": (q) => E.hidden = !q,
|
|
1462
|
+
disabled: h(E),
|
|
1463
|
+
onChange: y[0] || (y[0] = (q) => i("change"))
|
|
1464
|
+
}, null, 8, ["model-value", "label", "onUpdate:modelValue", "disabled"]))
|
|
1344
1465
|
], 64))), 128))
|
|
1345
1466
|
]),
|
|
1346
1467
|
_: 1
|
|
1347
1468
|
}, 8, ["modelValue", "title"]));
|
|
1348
1469
|
}
|
|
1349
|
-
}),
|
|
1470
|
+
}), Ka = { class: "ez-fast-table" }, ja = { class: "ez-fast-table_wrapper" }, Wa = {
|
|
1350
1471
|
key: 0,
|
|
1351
1472
|
class: "ez-fast-table_wrapper_header_operation"
|
|
1352
|
-
},
|
|
1473
|
+
}, Qa = {
|
|
1474
|
+
key: 1,
|
|
1475
|
+
class: "ez-fast-table_error"
|
|
1476
|
+
}, Ya = { class: "ez-fast-table_pagination" }, Xa = x({
|
|
1353
1477
|
name: "EzFastTable",
|
|
1354
|
-
directives: { loading:
|
|
1478
|
+
directives: { loading: Be.directive },
|
|
1355
1479
|
inheritAttrs: !1
|
|
1356
|
-
}),
|
|
1357
|
-
...
|
|
1358
|
-
props:
|
|
1359
|
-
|
|
1480
|
+
}), Za = /* @__PURE__ */ x({
|
|
1481
|
+
...Xa,
|
|
1482
|
+
props: {
|
|
1483
|
+
params: {},
|
|
1484
|
+
loading: { type: Boolean },
|
|
1485
|
+
columns: { default: () => [] },
|
|
1486
|
+
api: { type: Function, default: () => Promise.resolve({}) },
|
|
1360
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
|
+
} },
|
|
1361
1505
|
columnTool: { type: Boolean, default: !0 },
|
|
1362
1506
|
expanded: { type: Boolean, default: !1 },
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
columnsModifiers: {},
|
|
1371
|
-
loading: { type: Boolean },
|
|
1372
|
-
loadingModifiers: {}
|
|
1373
|
-
}),
|
|
1374
|
-
emits: /* @__PURE__ */ F(["changePage", "reset", "query"], ["update:params", "update:columns", "update:loading"]),
|
|
1375
|
-
setup(e, { expose: c, emit: l }) {
|
|
1376
|
-
const { t: i } = ue(), a = e, f = Me(), n = T(() => {
|
|
1377
|
-
const { api: h, beforeSearch: S, columnTool: q, expanded: x, ...le } = a;
|
|
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 = _e(), h = P(() => {
|
|
1513
|
+
const { api: f, beforeSearch: z, transformParams: j, responseAdapter: M, onError: K, columnTool: ie, expanded: Fe, columns: ll, border: ol, ...ft } = o;
|
|
1378
1514
|
return {
|
|
1379
|
-
...
|
|
1380
|
-
...
|
|
1515
|
+
...c,
|
|
1516
|
+
...ft
|
|
1381
1517
|
};
|
|
1382
|
-
}),
|
|
1518
|
+
}), V = G(o.expanded), { selectionChange: y, getSelectedList: E, getSortParams: D, getSelectedIds: q } = Ha(o.rowKey), m = G(null), A = G(!1), v = G(null), d = G(0), p = G([]), Z = G(0), N = G(null), L = t, B = G(H(o.params ?? i())), le = G(H(o.columns ?? [])), U = G(o.loading ?? !1), $ = P({
|
|
1519
|
+
get: () => U.value,
|
|
1520
|
+
set: (f) => {
|
|
1521
|
+
U.value = f, L("update:loading", f);
|
|
1522
|
+
}
|
|
1523
|
+
}), I = P(() => ({
|
|
1524
|
+
params: B.value,
|
|
1525
|
+
loading: $.value,
|
|
1526
|
+
expanded: V.value,
|
|
1527
|
+
search: fe,
|
|
1528
|
+
query: ce,
|
|
1529
|
+
reset: n,
|
|
1530
|
+
captureInitialParams: oe,
|
|
1531
|
+
patchParams: Ve,
|
|
1532
|
+
replaceParams: ze
|
|
1533
|
+
}));
|
|
1534
|
+
ye(
|
|
1535
|
+
() => o.params,
|
|
1536
|
+
(f) => {
|
|
1537
|
+
B.value = H(f ?? i());
|
|
1538
|
+
},
|
|
1539
|
+
{ deep: !0 }
|
|
1540
|
+
), ye(
|
|
1541
|
+
() => o.columns,
|
|
1542
|
+
(f) => {
|
|
1543
|
+
le.value = H(f ?? []);
|
|
1544
|
+
},
|
|
1545
|
+
{ deep: !0 }
|
|
1546
|
+
), ye(
|
|
1547
|
+
() => o.loading,
|
|
1548
|
+
(f) => {
|
|
1549
|
+
U.value = f ?? !1;
|
|
1550
|
+
}
|
|
1551
|
+
);
|
|
1552
|
+
const J = (f) => f, ae = () => {
|
|
1553
|
+
const f = H(B.value);
|
|
1554
|
+
B.value = f, L("update:params", f);
|
|
1555
|
+
}, se = async () => (await Re(), H(B.value)), oe = (f) => {
|
|
1556
|
+
v.value = H(f ?? B.value);
|
|
1557
|
+
}, ne = async (f, z, j) => {
|
|
1558
|
+
f === d.value && (console.error(`[EzFastTable] Query pipeline failed at stage "${j.stage}".`, z), N.value = {
|
|
1559
|
+
error: z,
|
|
1560
|
+
stage: j.stage,
|
|
1561
|
+
params: H(j.params)
|
|
1562
|
+
}, await o.onError?.(z, j));
|
|
1563
|
+
}, de = async (f) => {
|
|
1564
|
+
const z = d.value + 1;
|
|
1565
|
+
d.value = z, N.value = null;
|
|
1383
1566
|
try {
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1567
|
+
$.value = !0;
|
|
1568
|
+
try {
|
|
1569
|
+
await o.beforeSearch(f);
|
|
1570
|
+
} catch (ie) {
|
|
1571
|
+
await ne(z, ie, { stage: "beforeSearch", params: f });
|
|
1572
|
+
return;
|
|
1573
|
+
}
|
|
1574
|
+
let j;
|
|
1575
|
+
try {
|
|
1576
|
+
j = await o.transformParams(f);
|
|
1577
|
+
} catch (ie) {
|
|
1578
|
+
await ne(z, ie, { stage: "transformParams", params: f });
|
|
1579
|
+
return;
|
|
1580
|
+
}
|
|
1581
|
+
let M;
|
|
1582
|
+
try {
|
|
1583
|
+
M = await o.api(j);
|
|
1584
|
+
} catch (ie) {
|
|
1585
|
+
await ne(z, ie, { stage: "api", params: f });
|
|
1586
|
+
return;
|
|
1587
|
+
}
|
|
1588
|
+
let K;
|
|
1589
|
+
try {
|
|
1590
|
+
K = await o.responseAdapter(M);
|
|
1591
|
+
} catch (ie) {
|
|
1592
|
+
await ne(z, ie, { stage: "responseAdapter", params: f });
|
|
1593
|
+
return;
|
|
1594
|
+
}
|
|
1595
|
+
if (z !== d.value)
|
|
1596
|
+
return;
|
|
1597
|
+
p.value = K.records || [], Z.value = K.total || 0, L("query");
|
|
1387
1598
|
} finally {
|
|
1388
|
-
z.value = !1;
|
|
1599
|
+
z === d.value && ($.value = !1);
|
|
1389
1600
|
}
|
|
1390
|
-
},
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
}
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1601
|
+
}, ce = async () => {
|
|
1602
|
+
const f = await se();
|
|
1603
|
+
await de(f);
|
|
1604
|
+
}, fe = () => {
|
|
1605
|
+
(async () => {
|
|
1606
|
+
const f = await se();
|
|
1607
|
+
f.current = 1, B.value = f, ae(), await de(H(B.value));
|
|
1608
|
+
})();
|
|
1609
|
+
}, Ve = (f, z = {}) => {
|
|
1610
|
+
const { resetPage: j = !1, captureInitial: M = !1 } = z, K = { ...B.value, ...H(f) };
|
|
1611
|
+
j && (K.current = 1), B.value = K, ae(), M && oe();
|
|
1612
|
+
}, ze = (f, z = {}) => {
|
|
1613
|
+
const { resetPage: j = !1, captureInitial: M = !1 } = z, K = H(f);
|
|
1614
|
+
j && (K.current = 1), B.value = K, ae(), M && oe();
|
|
1615
|
+
}, u = () => m.value?.getTableRef(), b = (f) => {
|
|
1616
|
+
const { column: z, prop: j } = f;
|
|
1617
|
+
if ((z?.sortMode || "local") === "remote") {
|
|
1618
|
+
const K = D(f, z?.sortField || j);
|
|
1619
|
+
Ve(K), fe();
|
|
1620
|
+
return;
|
|
1621
|
+
}
|
|
1622
|
+
(B.value.asc || B.value.desc) && Ve({ asc: null, desc: null });
|
|
1623
|
+
}, n = () => {
|
|
1624
|
+
ze(H(v.value ?? { current: 1, size: 10 })), L("reset"), ce();
|
|
1625
|
+
}, w = (f) => {
|
|
1626
|
+
if (L("changePage", f), f.size) {
|
|
1627
|
+
fe();
|
|
1628
|
+
return;
|
|
1629
|
+
}
|
|
1630
|
+
ae(), ce();
|
|
1631
|
+
}, T = () => {
|
|
1632
|
+
u()?.doLayout();
|
|
1633
|
+
}, Y = () => {
|
|
1634
|
+
const f = H(le.value);
|
|
1635
|
+
le.value = f, L("update:columns", f), T();
|
|
1636
|
+
}, me = () => {
|
|
1637
|
+
N.value = null;
|
|
1638
|
+
}, pe = () => N.value, Pe = () => {
|
|
1639
|
+
me(), ce();
|
|
1640
|
+
}, Ue = P(() => ({
|
|
1641
|
+
error: N.value?.error,
|
|
1642
|
+
stage: N.value?.stage || "api",
|
|
1643
|
+
params: N.value?.params ?? B.value,
|
|
1644
|
+
retry: Pe
|
|
1645
|
+
}));
|
|
1646
|
+
return Oe(() => {
|
|
1647
|
+
oe();
|
|
1648
|
+
}), s({
|
|
1649
|
+
search: fe,
|
|
1650
|
+
query: ce,
|
|
1651
|
+
patchParams: Ve,
|
|
1652
|
+
replaceParams: ze,
|
|
1653
|
+
reset: n,
|
|
1654
|
+
captureInitialParams: oe,
|
|
1655
|
+
getTableRef: u,
|
|
1656
|
+
doLayout: T,
|
|
1657
|
+
clearError: me,
|
|
1658
|
+
getErrorState: pe
|
|
1659
|
+
}), (f, z) => {
|
|
1660
|
+
const j = et("loading");
|
|
1661
|
+
return r(), C("div", Ka, [
|
|
1662
|
+
f.$slots.form ? (r(), g(l(ut), {
|
|
1418
1663
|
key: 0,
|
|
1419
|
-
|
|
1420
|
-
expanded:
|
|
1664
|
+
expanded: V.value,
|
|
1665
|
+
"onUpdate:expanded": z[0] || (z[0] = (M) => V.value = M)
|
|
1421
1666
|
}, {
|
|
1422
|
-
default:
|
|
1423
|
-
|
|
1667
|
+
default: k(() => [
|
|
1668
|
+
R(f.$slots, "form", Ce(Le(I.value)))
|
|
1424
1669
|
]),
|
|
1425
|
-
operate:
|
|
1426
|
-
|
|
1670
|
+
operate: k(() => [
|
|
1671
|
+
W(l(be), {
|
|
1427
1672
|
type: "primary",
|
|
1428
|
-
loading:
|
|
1429
|
-
onClick:
|
|
1673
|
+
loading: $.value,
|
|
1674
|
+
onClick: fe
|
|
1430
1675
|
}, {
|
|
1431
|
-
default:
|
|
1432
|
-
|
|
1676
|
+
default: k(() => [
|
|
1677
|
+
he(ue(l(a)("s.button.query")), 1)
|
|
1433
1678
|
]),
|
|
1434
1679
|
_: 1
|
|
1435
1680
|
}, 8, ["loading"]),
|
|
1436
|
-
|
|
1437
|
-
default:
|
|
1438
|
-
|
|
1681
|
+
W(l(be), { onClick: n }, {
|
|
1682
|
+
default: k(() => [
|
|
1683
|
+
he(ue(l(a)("s.button.reset")), 1)
|
|
1439
1684
|
]),
|
|
1440
1685
|
_: 1
|
|
1441
1686
|
})
|
|
1442
1687
|
]),
|
|
1443
1688
|
_: 3
|
|
1444
|
-
}, 8, ["
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1689
|
+
}, 8, ["expanded"])) : O("", !0),
|
|
1690
|
+
f.$slots.freeArea ? R(f.$slots, "freeArea", Ce(S({ key: 1 }, I.value))) : O("", !0),
|
|
1691
|
+
Q("div", ja, [
|
|
1692
|
+
f.$slots.header || o.columnTool ? (r(), C("div", {
|
|
1448
1693
|
key: 0,
|
|
1449
|
-
class:
|
|
1694
|
+
class: De(["ez-fast-table_wrapper_header", f.$slots.header ? "justify-between" : "justify-end"])
|
|
1450
1695
|
}, [
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
selectList:
|
|
1454
|
-
selectIds:
|
|
1696
|
+
f.$slots.header ? (r(), C("div", Wa, [
|
|
1697
|
+
R(f.$slots, "header", {
|
|
1698
|
+
selectList: l(E),
|
|
1699
|
+
selectIds: l(q)
|
|
1455
1700
|
})
|
|
1456
|
-
])) :
|
|
1457
|
-
|
|
1701
|
+
])) : O("", !0),
|
|
1702
|
+
o.columnTool ? (r(), g(l(be), {
|
|
1458
1703
|
key: 1,
|
|
1459
|
-
icon:
|
|
1704
|
+
icon: l(ga),
|
|
1460
1705
|
circle: "",
|
|
1461
|
-
onClick:
|
|
1462
|
-
}, null, 8, ["icon"])) :
|
|
1463
|
-
], 2)) :
|
|
1464
|
-
|
|
1706
|
+
onClick: z[1] || (z[1] = (M) => A.value = !0)
|
|
1707
|
+
}, null, 8, ["icon"])) : O("", !0)
|
|
1708
|
+
], 2)) : O("", !0),
|
|
1709
|
+
tt((r(), g(it, S(h.value, {
|
|
1465
1710
|
ref_key: "fastTableRef",
|
|
1466
|
-
ref:
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1711
|
+
ref: m,
|
|
1712
|
+
border: o.border,
|
|
1713
|
+
columns: le.value,
|
|
1714
|
+
data: p.value,
|
|
1715
|
+
onSelectionChange: l(y),
|
|
1716
|
+
onSortChange: b
|
|
1717
|
+
}), Se({ _: 2 }, [
|
|
1718
|
+
re(f.$slots, (M, K, ie) => ({
|
|
1719
|
+
name: K,
|
|
1720
|
+
fn: k((Fe) => [
|
|
1721
|
+
!["form", "empty", "error", "header"].includes(String(K)) && !String(K).startsWith("header-") ? R(f.$slots, K, Ce(S({ key: 0 }, J(Fe)))) : O("", !0)
|
|
1476
1722
|
])
|
|
1477
|
-
}))
|
|
1478
|
-
|
|
1479
|
-
|
|
1723
|
+
})),
|
|
1724
|
+
f.$slots.empty && !N.value ? {
|
|
1725
|
+
name: "empty",
|
|
1726
|
+
fn: k(() => [
|
|
1727
|
+
R(f.$slots, "empty")
|
|
1728
|
+
]),
|
|
1729
|
+
key: "0"
|
|
1730
|
+
} : void 0
|
|
1731
|
+
]), 1040, ["border", "columns", "data", "onSelectionChange"])), [
|
|
1732
|
+
[j, $.value]
|
|
1480
1733
|
]),
|
|
1481
|
-
N("div",
|
|
1482
|
-
|
|
1483
|
-
|
|
1734
|
+
N.value && f.$slots.error ? (r(), C("div", Qa, [
|
|
1735
|
+
R(f.$slots, "error", Ce(Le(Ue.value)))
|
|
1736
|
+
])) : O("", !0),
|
|
1737
|
+
Q("div", Ya, [
|
|
1738
|
+
W(l(dt), {
|
|
1739
|
+
"current-page": B.value.current,
|
|
1484
1740
|
"onUpdate:currentPage": [
|
|
1485
|
-
|
|
1486
|
-
|
|
1741
|
+
z[2] || (z[2] = (M) => B.value.current = M),
|
|
1742
|
+
z[4] || (z[4] = (M) => w({ current: M }))
|
|
1487
1743
|
],
|
|
1488
|
-
"page-size":
|
|
1744
|
+
"page-size": B.value.size,
|
|
1489
1745
|
"onUpdate:pageSize": [
|
|
1490
|
-
|
|
1491
|
-
|
|
1746
|
+
z[3] || (z[3] = (M) => B.value.size = M),
|
|
1747
|
+
z[5] || (z[5] = (M) => w({ size: M }))
|
|
1492
1748
|
],
|
|
1493
1749
|
total: Z.value
|
|
1494
1750
|
}, null, 8, ["current-page", "page-size", "total"])
|
|
1495
1751
|
])
|
|
1496
1752
|
]),
|
|
1497
|
-
|
|
1498
|
-
modelValue:
|
|
1499
|
-
"onUpdate:modelValue":
|
|
1500
|
-
columns:
|
|
1501
|
-
"onUpdate:columns":
|
|
1502
|
-
onChange:
|
|
1753
|
+
W(Ga, {
|
|
1754
|
+
modelValue: A.value,
|
|
1755
|
+
"onUpdate:modelValue": z[6] || (z[6] = (M) => A.value = M),
|
|
1756
|
+
columns: le.value,
|
|
1757
|
+
"onUpdate:columns": z[7] || (z[7] = (M) => le.value = M),
|
|
1758
|
+
onChange: Y
|
|
1503
1759
|
}, null, 8, ["modelValue", "columns"])
|
|
1504
1760
|
]);
|
|
1505
1761
|
};
|
|
1506
1762
|
}
|
|
1507
|
-
}),
|
|
1508
|
-
function
|
|
1763
|
+
}), ct = te(Za), sl = () => ct, Ja = te(it), Je = /* @__PURE__ */ Symbol("INSTALLED_KEY");
|
|
1764
|
+
function _a(e = []) {
|
|
1509
1765
|
return {
|
|
1510
|
-
install: (
|
|
1511
|
-
|
|
1766
|
+
install: (t) => {
|
|
1767
|
+
t[Je] || (t[Je] = !0, e.forEach((a) => t.use(a)));
|
|
1512
1768
|
}
|
|
1513
1769
|
};
|
|
1514
1770
|
}
|
|
1515
|
-
const
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1771
|
+
const el = [
|
|
1772
|
+
lt,
|
|
1773
|
+
aa,
|
|
1774
|
+
Ta,
|
|
1775
|
+
Ma,
|
|
1519
1776
|
ct,
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
], xt = Dt([...Tt, ...Rt]), Pt = xt.install;
|
|
1777
|
+
ve,
|
|
1778
|
+
rt,
|
|
1779
|
+
dt,
|
|
1780
|
+
ut,
|
|
1781
|
+
nt,
|
|
1782
|
+
ot,
|
|
1783
|
+
Ja
|
|
1784
|
+
], tl = [
|
|
1785
|
+
Bt,
|
|
1786
|
+
Be,
|
|
1787
|
+
ge,
|
|
1788
|
+
Ft,
|
|
1789
|
+
Nt,
|
|
1790
|
+
Lt
|
|
1791
|
+
], al = _a([...el, ...tl]), il = al.install;
|
|
1536
1792
|
export {
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1793
|
+
ka as CHANGE_TRIGGER_TYPES,
|
|
1794
|
+
lt as EzCheckbox,
|
|
1795
|
+
aa as EzDialog,
|
|
1796
|
+
Ta as EzDynamicForm,
|
|
1797
|
+
ct as EzFastTable,
|
|
1798
|
+
Ma as EzFormItem,
|
|
1799
|
+
ve as EzIcon,
|
|
1800
|
+
rt as EzImageUpload,
|
|
1801
|
+
dt as EzPagination,
|
|
1802
|
+
ut as EzQueryPanel,
|
|
1803
|
+
nt as EzRadio,
|
|
1804
|
+
ot as EzSelect,
|
|
1805
|
+
Ja as EzTable,
|
|
1806
|
+
F as FormItemType,
|
|
1807
|
+
Sa as SELECT_FORM_TYPES,
|
|
1808
|
+
sl as createTypedFastTable,
|
|
1809
|
+
al as default,
|
|
1810
|
+
za as getInputVerb,
|
|
1811
|
+
Ca as getTrigger,
|
|
1812
|
+
il as install
|
|
1556
1813
|
};
|