@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/dist/index.js CHANGED
@@ -1,36 +1,44 @@
1
- import { useAttrs as Me, computed as T, defineComponent as w, mergeModels as F, useModel as L, createBlock as v, openBlock as o, unref as t, mergeProps as g, withCtx as y, createElementBlock as V, Fragment as P, renderList as W, resolveDynamicComponent as ge, createTextVNode as _, toDisplayString as Y, resolveDirective as Ue, renderSlot as C, createCommentVNode as D, withDirectives as Pe, createElementVNode as N, ref as O, createVNode as M, withModifiers as Ve, normalizeStyle as ie, createSlots as ae, useSlots as je, shallowRef as We, watch as fe, onMounted as ye, normalizeClass as ce, nextTick as Le, onUnmounted as Ke, normalizeProps as Ee, guardReactiveProps as Ye } from "vue";
2
- import { useLocale as Xe, ElCheckbox as Ne, ElCheckboxButton as Ze, ElCheckboxGroup as Je, ElLoading as be, ElDialog as Qe, ElButton as te, ElSelect as _e, ElOptionGroup as el, ElOption as $e, ElRadio as ll, ElRadioButton as tl, ElRadioGroup as al, ElUpload as ke, ElImage as we, ElImageViewer as ol, ElMessage as se, ElFormItem as nl, ElInput as me, ElInputNumber as sl, ElDatePicker as de, ElTimePicker as Se, ElSwitch as rl, ElTreeSelect as il, ElCascader as ul, ElTree as dl, ElSlider as cl, ElRate as fl, ElForm as ml, ElRow as ze, ElCol as Ce, ElTable as pl, ElTableColumn as Ae, ElPagination as vl, ElDrawer as gl, ElInfiniteScroll as yl, ElMessageBox as bl, ElNotification as hl, ElPopoverDirective as Vl } from "element-plus";
3
- const G = (e, c) => (e.install = (l) => {
4
- for (const i of [e, ...Object.values({})])
5
- i.name ? l.component(i.name, i) : process.env.NODE_ENV !== "production" && console.warn("[withInstall] Component is missing name property:", i);
6
- }, e);
7
- function oe(e = []) {
8
- const c = Me(), l = T(() => {
9
- const f = {};
10
- for (const n in c)
11
- e.includes(n) || (f[n] = c[n]);
12
- return f;
13
- }), i = T(() => {
14
- const f = {};
15
- for (const n in l.value)
16
- n.startsWith("on") || (f[n] = l.value[n]);
17
- return f;
18
- }), a = T(() => {
19
- const f = {};
20
- for (const n in l.value)
21
- n.startsWith("on") && (f[n] = l.value[n]);
22
- return f;
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: l,
34
+ attrs: t,
27
35
  /** 只包含普通属性 */
28
- props: i,
36
+ props: a,
29
37
  /** 只包含事件监听器 */
30
- listeners: a
38
+ listeners: i
31
39
  };
32
40
  }
33
- var El = {
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: $l } = El;
114
- function kl(e, c) {
115
- return c.split(".").reduce((l, i) => l && typeof l == "object" ? l[i] : void 0, e);
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 wl(e, c = {}) {
118
- return e.replace(/\{\s*(\w+)\s*\}/g, (l, i) => {
119
- const a = c[i];
120
- return a !== void 0 ? String(a) : `{${i}}`;
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 ue() {
124
- const { t: e, lang: c } = Xe();
131
+ function ke() {
132
+ const { t: e, lang: s } = vt();
125
133
  return {
126
- t: (i, a = {}) => {
127
- const f = e(i, a);
128
- if (f !== i) return f;
129
- const n = kl({ s: $l }, i);
130
- return typeof n == "string" ? wl(n, a) : i;
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: c
140
+ lang: s
133
141
  };
134
142
  }
135
- function Sl(e, c = 200) {
136
- let l = null;
137
- return function(...i) {
138
- l || (l = setTimeout(() => {
139
- e.apply(this, i), l = null;
140
- }, c));
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 zl = w({ name: "EzCheckbox", inheritAttrs: !1 }), Cl = /* @__PURE__ */ w({
144
- ...zl,
145
- props: /* @__PURE__ */ F({
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 c = e, l = L(e, "modelValue"), { attrs: i } = oe(["options", "type", "modelValue"]), a = T(
155
- () => ["default", "border"].includes(c.type) ? Ne : Ze
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 (f, n) => (o(), v(t(Je), g({
158
- modelValue: l.value,
159
- "onUpdate:modelValue": n[0] || (n[0] = (m) => l.value = m)
160
- }, t(i)), {
161
- default: y(() => [
162
- (o(!0), V(P, null, W(e.options, (m) => (o(), v(ge(a.value), g({
163
- key: String(m.value),
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
- }, m, {
185
+ }, h, {
166
186
  border: e.type === "border"
167
187
  }), {
168
- default: y(() => [
169
- _(Y(m.label), 1)
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
- }), Be = G(Cl);
178
- var re = /* @__PURE__ */ ((e) => (e.CANCEL = "取消", e.CONFIRM = "确定", e))(re || {});
179
- const Al = { key: 1 }, Dl = {
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
- }, Tl = { key: 1 }, Rl = w({ name: "EzDialog", inheritAttrs: !1, directives: { loading: be.directive } }), xl = /* @__PURE__ */ w({
183
- ...Rl,
184
- props: /* @__PURE__ */ F({
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: re.CANCEL },
188
- confirmText: { default: re.CONFIRM }
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__ */ F(["cancel", "confirm"], ["update:modelValue"]),
194
- setup(e, { emit: c }) {
195
- const { t: l } = ue(), i = e, a = c, f = L(e, "modelValue"), { attrs: n } = oe(["title", "loading", "cancelText", "confirmText", "modelValue"]), m = () => {
196
- f.value = !1, a("cancel");
197
- }, d = () => {
198
- a("confirm");
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 (s, r) => {
201
- const R = Ue("loading");
202
- return o(), v(t(Qe), g({
203
- modelValue: f.value,
204
- "onUpdate:modelValue": r[0] || (r[0] = (K) => f.value = K),
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
- }, t(n)), {
212
- header: y(() => [
213
- s.$slots.header ? C(s.$slots, "header", { key: 0 }) : (o(), V("p", Al, Y(i.title), 1))
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: y(() => [
216
- s.$slots.default ? Pe((o(), V("div", Dl, [
217
- C(s.$slots, "default")
235
+ default: k(() => [
236
+ y.$slots.default ? tt((r(), C("div", Jt, [
237
+ R(y.$slots, "default")
218
238
  ])), [
219
- [R, i.loading]
220
- ]) : D("", !0)
239
+ [D, a.loading]
240
+ ]) : O("", !0)
221
241
  ]),
222
- footer: y(() => [
223
- s.$slots.footer ? C(s.$slots, "footer", { key: 0 }) : (o(), V("div", Tl, [
224
- i.cancelText ? (o(), v(t(te), {
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: m
247
+ onClick: h
228
248
  }, {
229
- default: y(() => [
230
- _(Y(i.cancelText === t(re).CANCEL ? t(l)("s.button.cancel") : i.cancelText), 1)
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
- })) : D("", !0),
234
- i.confirmText ? (o(), v(t(te), {
253
+ })) : O("", !0),
254
+ a.confirmText ? (r(), g(l(be), {
235
255
  key: 1,
236
256
  type: "primary",
237
- loading: i.loading,
238
- onClick: d
257
+ loading: a.loading,
258
+ onClick: V
239
259
  }, {
240
- default: y(() => [
241
- _(Y(i.confirmText === t(re).CONFIRM ? t(l)("s.button.confirm") : i.confirmText), 1)
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"])) : D("", !0)
264
+ }, 8, ["loading"])) : O("", !0)
245
265
  ]))
246
266
  ]),
247
267
  _: 3
248
268
  }, 16, ["modelValue"]);
249
269
  };
250
270
  }
251
- }), Ml = G(xl), Ul = w({ name: "EzSelect", inheritAttrs: !1 }), Pl = /* @__PURE__ */ w({
252
- ...Ul,
253
- props: /* @__PURE__ */ F({
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 c = L(e, "modelValue"), { attrs: l } = oe(["options", "modelValue"]), i = (n) => typeof n > "u", a = (n) => !i(n.options), f = (n, m) => n.value != null && typeof n.value != "object" ? String(n.value) : m;
262
- return (n, m) => (o(), v(t(_e), g({
263
- modelValue: c.value,
264
- "onUpdate:modelValue": m[0] || (m[0] = (d) => c.value = d),
265
- clearable: ""
266
- }, t(l)), {
267
- default: y(() => [
268
- (o(!0), V(P, null, W(e.options, (d, s) => (o(), V(P, {
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
- a(d) ? (o(), v(t(el), g({
290
+ i(V) ? (r(), g(l(Et), S({
272
291
  key: 0,
273
292
  ref_for: !0
274
- }, d), {
275
- default: y(() => [
276
- (o(!0), V(P, null, W(d.options, (r) => (o(), v(t($e), g({
277
- key: f(r, r.value)
278
- }, { ref_for: !0 }, r), null, 16))), 128))
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)) : (o(), v(t($e), g({
300
+ }, 1040)) : (r(), g(l(qe), S({
282
301
  key: 1,
283
302
  ref_for: !0
284
- }, d), null, 16))
303
+ }, V), null, 16))
285
304
  ], 64))), 128))
286
305
  ]),
287
306
  _: 1
288
307
  }, 16, ["modelValue"]));
289
308
  }
290
- }), Ie = G(Pl), Ll = w({ name: "EzRadio", inheritAttrs: !1 }), Nl = /* @__PURE__ */ w({
291
- ...Ll,
292
- props: /* @__PURE__ */ F({
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 c = e, l = L(e, "modelValue"), { attrs: i } = oe(["options", "type", "modelValue"]), a = T(() => ["default", "border"].includes(c.type) ? ll : tl);
302
- return (f, n) => (o(), v(t(al), g({
303
- modelValue: l.value,
304
- "onUpdate:modelValue": n[0] || (n[0] = (m) => l.value = m)
305
- }, t(i)), {
306
- default: y(() => [
307
- (o(!0), V(P, null, W(e.options, (m) => (o(), v(ge(a.value), g({
308
- key: String(m.value),
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
- }, m, {
329
+ }, h, {
311
330
  border: e.type === "border"
312
331
  }), {
313
- default: y(() => [
314
- _(Y(m.label), 1)
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
- }), Oe = G(Nl), Bl = w({ name: "EzIcon", inheritAttrs: !1 }), Il = /* @__PURE__ */ w({
323
- ...Bl,
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 c = e, l = T(() => {
330
- const { size: i, color: a } = c;
331
- return !i && !a ? {} : {
332
- fontSize: i ? `${i}px` : void 0,
333
- color: a
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, a) => (o(), V("i", g({
358
+ return (i, o) => (r(), C("i", S({
337
359
  class: "ez-icon",
338
- style: l.value
360
+ style: a.value
339
361
  }, i.$attrs), [
340
- C(i.$slots, "default", { class: "w-[1em] h-[1em]" })
362
+ R(i.$slots, "default", { class: "w-[1em] h-[1em]" })
341
363
  ], 16));
342
364
  }
343
- }), Q = G(Il), Ol = {
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
- }, ql = /* @__PURE__ */ w({
370
+ }, da = /* @__PURE__ */ x({
349
371
  name: "ArrowDown",
350
372
  __name: "ArrowDown",
351
373
  setup(e) {
352
- return (c, l) => (o(), V("svg", Ol, [...l[0] || (l[0] = [
353
- N("path", {
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
- }), Fl = {
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
- }, Gl = /* @__PURE__ */ w({
386
+ }, fa = /* @__PURE__ */ x({
365
387
  name: "ArrowUp",
366
388
  __name: "ArrowUp",
367
389
  setup(e) {
368
- return (c, l) => (o(), V("svg", Fl, [...l[0] || (l[0] = [
369
- N("path", {
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
- }), Hl = {
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
- }, De = /* @__PURE__ */ w({
402
+ }, Ye = /* @__PURE__ */ x({
381
403
  name: "Delete",
382
404
  __name: "delete",
383
405
  setup(e) {
384
- return (c, l) => (o(), V("svg", Hl, [...l[0] || (l[0] = [
385
- N("path", {
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
- }), jl = {
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
- }, Te = /* @__PURE__ */ w({
418
+ }, Xe = /* @__PURE__ */ x({
397
419
  name: "Plus",
398
420
  __name: "plus",
399
421
  setup(e) {
400
- return (c, l) => (o(), V("svg", jl, [...l[0] || (l[0] = [
401
- N("path", {
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
- }), Wl = {
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
- }, Kl = /* @__PURE__ */ w({
434
+ }, ga = /* @__PURE__ */ x({
413
435
  name: "Setting",
414
436
  __name: "setting",
415
437
  setup(e) {
416
- return (c, l) => (o(), V("svg", Wl, [...l[0] || (l[0] = [
417
- N("path", {
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
- }), Yl = {
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
- }, Re = /* @__PURE__ */ w({
450
+ }, Ze = /* @__PURE__ */ x({
429
451
  name: "ZoomIn",
430
452
  __name: "ZoomIn",
431
453
  setup(e) {
432
- return (c, l) => (o(), V("svg", Yl, [...l[0] || (l[0] = [
433
- N("path", {
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
- N("path", {
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
- }), Xl = { class: "ez-image-upload" }, Zl = {
465
+ }), ba = { class: "ez-image-upload" }, ha = {
444
466
  key: 0,
445
467
  class: "ez-image-upload__image"
446
- }, Jl = {
468
+ }, Ea = {
447
469
  key: 1,
448
470
  class: "ez-image-upload__list"
449
- }, Ql = { class: "flex items-center justify-center h-full" }, _l = w({ name: "EzImageUpload", inheritAttrs: !1 }), et = /* @__PURE__ */ w({
450
- ..._l,
451
- props: /* @__PURE__ */ F({
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: c }) {
466
- const l = e, { attrs: i } = oe([
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: a } = ue(), f = O(!1), n = O(0), m = L(e, "modelValue"), d = T(() => l.multiple), s = /^(https?:\/\/|data:|blob:)/i, r = T(() => m.value ? R(m.value) : []);
477
- function R($) {
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 E = /^(https?:\/\/|data:|blob:)/i;
480
- let z = [], U = "", B = !1;
481
- $ = $.trim().replace(/,$/, "");
482
- const ee = $.split(",");
483
- for (let u = 0; u < ee.length; u++) {
484
- const k = ee[u].trim();
485
- k && (E.test(k) ? (B && U && z.push(U.trim()), U = k, B = !0) : B ? U += "," + k : E.test(k.trim()) && z.push(k.trim()));
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 B && U && z.push(U.trim()), z.filter((u) => u && E.test(u));
512
+ return ae;
488
513
  }
489
- function K($) {
490
- return !$ || $.length === 0 ? "" : $.filter((E) => E.trim()).map((E) => E.trim()).join(",");
514
+ function v(U) {
515
+ return !U || U.length === 0 ? "" : U.filter(($) => $.trim()).map(($) => $.trim()).join(",");
491
516
  }
492
- const H = ($) => l.disabled ? (se.warning(a("s.message.disabled")), !1) : l.imageTypes.includes($.type.toLocaleLowerCase()) ? $.size > l.limitSize * 1024 * 1024 ? (se.error(a("s.validate.upload.limit", { max: l.limitSize })), !1) : !0 : (se.error(a("s.validate.upload.image")), !1), j = async ({ file: $ }) => {
493
- if (!l.disabled)
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: E } = await l.api($);
496
- if (!E) throw new Error(a("s.message.uploadFail"));
497
- if (d.value) {
498
- const z = m.value ? R(m.value) : [];
499
- E && s.test(E) && (z.push(E), m.value = K(z));
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
- m.value = E;
502
- } catch (E) {
503
- se.error(E.message);
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
- }, X = ($, E = 0) => {
506
- $ && (n.value = E, f.value = !0);
507
- }, Z = ($) => {
508
- if (!l.disabled && !(!$ || !m.value))
509
- if (d.value) {
510
- const E = R(m.value), z = E.findIndex((U) => U === $);
511
- z !== -1 && (E.splice(z, 1), m.value = E.join(","));
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
- m.value = null;
514
- }, J = O();
515
- return c({
516
- getUploadRef: () => J.value,
517
- getUrlList: () => r.value
518
- }), ($, E) => (o(), V("div", Xl, [
519
- d.value ? (o(), V("div", Jl, [
520
- (o(!0), V(P, null, W(r.value, (z, U) => (o(), V("div", {
521
- key: U,
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: ie(l.style)
556
+ style: $e(a.style)
524
557
  }, [
525
- M(t(we), {
526
- src: z,
527
- fit: l.fit
558
+ W(l(Ge), {
559
+ src: I,
560
+ fit: a.fit
528
561
  }, null, 8, ["src", "fit"]),
529
- N("div", {
562
+ Q("div", {
530
563
  class: "ez-image-upload__handler",
531
- onClick: E[3] || (E[3] = Ve(() => {
564
+ onClick: $[3] || ($[3] = Ne(() => {
532
565
  }, ["stop"]))
533
566
  }, [
534
- M(t(Q), {
567
+ W(l(ve), {
535
568
  size: 18,
536
- onClick: (B) => X(z, U)
569
+ onClick: (ae) => Z(I, J)
537
570
  }, {
538
- default: y(() => [
539
- M(t(Re))
571
+ default: k(() => [
572
+ W(l(Ze))
540
573
  ]),
541
574
  _: 1
542
575
  }, 8, ["onClick"]),
543
- l.disabled ? D("", !0) : (o(), v(t(Q), {
576
+ a.disabled ? O("", !0) : (r(), g(l(ve), {
544
577
  key: 0,
545
578
  size: 18,
546
- onClick: (B) => Z(z)
579
+ onClick: (ae) => N(I)
547
580
  }, {
548
- default: y(() => [
549
- M(t(De))
581
+ default: k(() => [
582
+ W(l(Ye))
550
583
  ]),
551
584
  _: 1
552
585
  }, 8, ["onClick"]))
553
586
  ])
554
587
  ], 4))), 128)),
555
- r.value.length < l.limit && !l.disabled || r.value.length === 0 ? (o(), v(t(ke), g({ key: 0 }, t(i), {
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: J,
590
+ ref: L,
558
591
  action: "",
559
- accept: "image/*",
592
+ accept: D.value,
593
+ multiple: a.multiple,
560
594
  "show-file-list": !1,
561
- "before-upload": H,
562
- "http-request": j,
563
- style: l.style,
564
- disabled: l.disabled,
565
- class: [{ "is-disabled": l.disabled }, "ez-image-upload__item ez-image-upload__button"]
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: y(() => [
568
- N("div", Ql, [
569
- M(t(Q), null, {
570
- default: y(() => [
571
- M(t(Te))
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"])) : D("", !0)
579
- ])) : (o(), v(t(ke), g({ key: 0 }, t(i), {
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: J,
615
+ ref: L,
582
616
  action: "",
583
- accept: "image/*",
617
+ accept: D.value,
618
+ multiple: a.multiple,
584
619
  "show-file-list": !1,
585
- "before-upload": H,
586
- "http-request": j,
587
- style: l.style,
588
- disabled: l.disabled,
589
- class: ["ez-image-upload__wrapper", { "is-disabled": l.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: y(() => [
592
- m.value ? (o(), V("div", Zl, [
593
- M(t(we), {
594
- src: m.value,
595
- fit: l.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
- N("div", {
632
+ Q("div", {
598
633
  class: "ez-image-upload__handler",
599
- onClick: E[2] || (E[2] = Ve(() => {
634
+ onClick: $[2] || ($[2] = Ne(() => {
600
635
  }, ["stop"]))
601
636
  }, [
602
- M(t(Q), {
637
+ W(l(ve), {
603
638
  size: 18,
604
- onClick: E[0] || (E[0] = (z) => X(m.value, 0))
639
+ onClick: $[0] || ($[0] = (I) => Z(y.value, 0))
605
640
  }, {
606
- default: y(() => [
607
- M(t(Re))
641
+ default: k(() => [
642
+ W(l(Ze))
608
643
  ]),
609
644
  _: 1
610
645
  }),
611
- l.disabled ? D("", !0) : (o(), v(t(Q), {
646
+ a.disabled ? O("", !0) : (r(), g(l(ve), {
612
647
  key: 0,
613
648
  size: 18,
614
- onClick: E[1] || (E[1] = (z) => Z(m.value))
649
+ onClick: $[1] || ($[1] = (I) => N(y.value))
615
650
  }, {
616
- default: y(() => [
617
- M(t(De))
651
+ default: k(() => [
652
+ W(l(Ye))
618
653
  ]),
619
654
  _: 1
620
655
  }))
621
656
  ])
622
- ])) : (o(), v(t(Q), { key: 1 }, {
623
- default: y(() => [
624
- M(t(Te))
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
- f.value ? (o(), v(t(ol), {
665
+ }, 16, ["accept", "multiple", "style", "disabled", "class"])),
666
+ h.value ? (r(), g(l(St), {
632
667
  key: 2,
633
- "url-list": d.value ? r.value : [m.value],
634
- "initial-index": n.value,
635
- onClose: E[4] || (E[4] = (z) => f.value = !1)
636
- }, null, 8, ["url-list", "initial-index"])) : D("", !0)
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
- }), qe = G(et);
640
- var A = /* @__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.TREE = "tree", e.SLIDER = "slider", e.RATE = "rate", e))(A || {});
641
- const lt = /* @__PURE__ */ new Set([
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
- ]), tt = /* @__PURE__ */ new Set([
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 at(e) {
675
- return e && lt.has(e) ? "选择" : "输入";
707
+ function za(e) {
708
+ return e && Sa.has(e) ? "选择" : "输入";
676
709
  }
677
- function ot(e) {
678
- return e && tt.has(e) ? "change" : "blur";
710
+ function Ca(e) {
711
+ return e && ka.has(e) ? "change" : "blur";
679
712
  }
680
- const nt = w({ name: "EzFormItem" }), pe = /* @__PURE__ */ w({
681
- ...nt,
682
- props: /* @__PURE__ */ F({
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 c = e, l = L(e, "modelValue"), i = T(() => c.config?.itemAttrs && typeof c.config.itemAttrs == "object" ? c.config.itemAttrs : {}), a = T(() => c.config?.attrs && typeof c.config.attrs == "object" ? c.config.attrs : {}), f = T(() => c.config?.options && Array.isArray(c.config.options) ? c.config.options : []), n = /* @__PURE__ */ new WeakMap(), m = () => {
692
- const { config: d } = c;
693
- if (!d || typeof d != "object") return;
694
- if (n.has(d))
695
- return n.get(d);
696
- let s;
697
- return d.rules ? s = d.rules : d.required && (s = [{ required: !0, message: d.requiredMessage || `请${at(d.type)}${d.label || ""}`, trigger: ot(d.type) }]), s !== void 0 && n.set(d, s), s;
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 (d, s) => e.config && e.config.prop ? (o(), v(t(nl), g({
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: m()
704
- }, i.value), ae({
705
- default: y(() => [
706
- d.$slots.default ? C(d.$slots, "default", {
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: l.value,
762
+ value: t.value,
710
763
  formData: e.formData
711
- }) : e.config.component ? (o(), v(ge(e.config.component), g({
764
+ }) : e.config.component ? (r(), g(xe(e.config.component), S({
712
765
  key: 1,
713
- modelValue: l.value,
714
- "onUpdate:modelValue": s[0] || (s[0] = (r) => l.value = r),
766
+ modelValue: t.value,
767
+ "onUpdate:modelValue": d[0] || (d[0] = (p) => t.value = p),
715
768
  disabled: e.config.disabled
716
- }, a.value), null, 16, ["modelValue", "disabled"])) : (o(), V(P, { key: 2 }, [
717
- e.config.type === t(A).INPUT || !e.config.type ? (o(), v(t(me), g({
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: l.value,
720
- "onUpdate:modelValue": s[1] || (s[1] = (r) => l.value = r),
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
- }, a.value), null, 16, ["modelValue", "placeholder", "disabled"])) : e.config.type === t(A).TEXTAREA ? (o(), v(t(me), g({
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: l.value,
727
- "onUpdate:modelValue": s[2] || (s[2] = (r) => l.value = r),
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
- }, a.value), null, 16, ["modelValue", "placeholder", "disabled"])) : e.config.type === t(A).NUMBER ? (o(), v(t(sl), g({
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: l.value,
734
- "onUpdate:modelValue": s[3] || (s[3] = (r) => l.value = r),
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
- }, a.value), null, 16, ["modelValue", "placeholder", "disabled"])) : e.config.type === t(A).PASSWORD ? (o(), v(t(me), g({
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: l.value,
740
- "onUpdate:modelValue": s[4] || (s[4] = (r) => l.value = r),
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
- }, a.value), null, 16, ["modelValue", "placeholder", "disabled"])) : e.config.type === t(A).SELECT ? (o(), v(t(Ie), g({
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: l.value,
749
- "onUpdate:modelValue": s[5] || (s[5] = (r) => l.value = r),
750
- options: f.value,
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
- }, a.value), null, 16, ["modelValue", "options", "placeholder", "disabled"])) : e.config.type === t(A).RADIO ? (o(), v(t(Oe), g({
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: l.value,
756
- "onUpdate:modelValue": s[6] || (s[6] = (r) => l.value = r),
757
- options: f.value,
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
- }, a.value), null, 16, ["modelValue", "options", "disabled"])) : e.config.type === t(A).CHECKBOX ? (o(), v(t(Be), g({
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: l.value,
762
- "onUpdate:modelValue": s[7] || (s[7] = (r) => l.value = r),
763
- options: f.value,
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
- }, a.value), null, 16, ["modelValue", "options", "disabled"])) : e.config.type === t(A).DATE ? (o(), v(t(de), g({
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: l.value,
768
- "onUpdate:modelValue": s[8] || (s[8] = (r) => l.value = r),
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
- }, a.value), null, 16, ["modelValue", "placeholder", "disabled"])) : e.config.type === t(A).DATETIME ? (o(), v(t(de), g({
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: l.value,
775
- "onUpdate:modelValue": s[9] || (s[9] = (r) => l.value = r),
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
- }, a.value), null, 16, ["modelValue", "placeholder", "disabled"])) : e.config.type === t(A).DATERANGE ? (o(), v(t(de), g({
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: l.value,
782
- "onUpdate:modelValue": s[10] || (s[10] = (r) => l.value = r),
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
- }, a.value), null, 16, ["modelValue", "disabled"])) : e.config.type === t(A).DATETIMERANGE ? (o(), v(t(de), g({
841
+ }, o.value), null, 16, ["modelValue", "disabled"])) : e.config.type === l(F).DATETIMERANGE ? (r(), g(l(Ae), S({
789
842
  key: 10,
790
- modelValue: l.value,
791
- "onUpdate:modelValue": s[11] || (s[11] = (r) => l.value = r),
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
- }, a.value), null, 16, ["modelValue", "disabled"])) : e.config.type === t(A).TIME ? (o(), v(t(Se), g({
850
+ }, o.value), null, 16, ["modelValue", "disabled"])) : e.config.type === l(F).TIME ? (r(), g(l(Ke), S({
798
851
  key: 11,
799
- modelValue: l.value,
800
- "onUpdate:modelValue": s[12] || (s[12] = (r) => l.value = r),
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
- }, a.value), null, 16, ["modelValue", "placeholder", "disabled"])) : e.config.type === t(A).TIMERANGE ? (o(), v(t(Se), g({
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: l.value,
806
- "onUpdate:modelValue": s[13] || (s[13] = (r) => l.value = r),
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
- }, a.value), null, 16, ["modelValue", "disabled"])) : e.config.type === t(A).SWITCH ? (o(), v(t(rl), g({
865
+ }, o.value), null, 16, ["modelValue", "disabled"])) : e.config.type === l(F).SWITCH ? (r(), g(l(Ct), S({
813
866
  key: 13,
814
- modelValue: l.value,
815
- "onUpdate:modelValue": s[14] || (s[14] = (r) => l.value = r),
867
+ modelValue: t.value,
868
+ "onUpdate:modelValue": d[14] || (d[14] = (p) => t.value = p),
816
869
  disabled: e.config.disabled
817
- }, a.value), null, 16, ["modelValue", "disabled"])) : e.config.type === t(A).TREE_SELECT ? (o(), v(t(il), g({
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: l.value,
820
- "onUpdate:modelValue": s[15] || (s[15] = (r) => l.value = r),
821
- data: f.value,
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
- }, a.value), null, 16, ["modelValue", "data", "placeholder", "disabled"])) : e.config.type === t(A).CASCADER ? (o(), v(t(ul), g({
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: l.value,
827
- "onUpdate:modelValue": s[16] || (s[16] = (r) => l.value = r),
828
- options: f.value,
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
- }, a.value), null, 16, ["modelValue", "options", "placeholder", "disabled"])) : e.config.type === t(A).TREE ? (o(), v(t(dl), g({
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: l.value,
835
- "onUpdate:modelValue": s[17] || (s[17] = (r) => l.value = r),
836
- data: f.value,
837
- "show-checkbox": "",
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: l.value,
842
- "onUpdate:modelValue": s[18] || (s[18] = (r) => l.value = r),
892
+ modelValue: t.value,
893
+ "onUpdate:modelValue": d[18] || (d[18] = (p) => t.value = p),
843
894
  disabled: e.config.disabled
844
- }, a.value), null, 16, ["modelValue", "disabled"])) : e.config.type === t(A).RATE ? (o(), v(t(fl), g({
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: l.value,
847
- "onUpdate:modelValue": s[19] || (s[19] = (r) => l.value = r),
848
- disabled: e.config.disabled
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
- }, a.value), null, 16, ["modelValue", "api", "disabled"])) : D("", !0)
901
+ }, c.value), null, 16, ["modelValue", "api", "disabled"])) : O("", !0)
856
902
  ], 64))
857
903
  ]),
858
904
  _: 2
859
905
  }, [
860
- d.$slots.label ? {
906
+ v.$slots.label ? {
861
907
  name: "label",
862
- fn: y(() => [
863
- C(d.$slots, "label", { config: e.config })
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"])) : D("", !0);
913
+ ]), 1040, ["prop", "label", "rules"])) : O("", !0);
868
914
  }
869
- }), st = {
915
+ }), Da = {
870
916
  key: 0,
871
917
  class: "ez-dynamic-form-group__title"
872
- }, rt = {
918
+ }, xa = {
873
919
  key: 1,
874
920
  class: "ez-dynamic-form-group__description"
875
- }, it = w({ name: "EzDynamicForm", inheritAttrs: !1 }), ut = /* @__PURE__ */ w({
876
- ...it,
877
- props: /* @__PURE__ */ F({
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: c }) {
902
- const l = e, i = je(), a = L(e, "modelValue"), f = We(), n = "__legacy__";
903
- let m = !1;
904
- const d = (u) => Object.prototype.toString.call(u) === "[object Object]", s = (u) => u instanceof Date ? new Date(u.getTime()) : Array.isArray(u) ? u.map((k) => s(k)) : d(u) ? Object.fromEntries(Object.entries(u).map(([k, p]) => [k, s(p)])) : u, r = () => {
905
- d(a.value) || (a.value = {});
906
- }, R = () => {
907
- r(), a.value && H.value.forEach((u) => {
908
- u.prop in a.value || (a.value[u.prop] = u.defaultValue !== void 0 ? u.defaultValue : void 0);
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
- }, K = T(() => Math.floor(24 / l.cols)), H = T(() => l.groups?.length ? l.groups.flatMap((u) => u.items || []) : l.items || []);
911
- fe(
912
- () => [l.items?.length || 0, l.groups?.length || 0],
913
- ([u, k]) => {
914
- m || u === 0 || k === 0 || (m = !0, console.warn('[EzDynamicForm] Both "items" and "groups" were provided. "groups" takes precedence and "items" will be ignored.'));
915
- },
916
- { immediate: !0 }
917
- ), fe(() => [l.items, l.groups], R, { deep: !0, immediate: !0 }), fe(a, R, { immediate: !0 }), ye(R);
918
- const j = (u, k, p) => {
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(a.value);
922
- } catch (b) {
923
- return console.error(`[EzDynamicForm] ${k} visibility error for "${p}":`, b), !1;
1034
+ return u(i.value);
1035
+ } catch (w) {
1036
+ return console.error(`[EzDynamicForm] ${b} visibility error for "${n}":`, w), !1;
924
1037
  }
925
- }, X = T(() => {
926
- const u = Array.isArray(l.groups) && l.groups.length > 0, k = u ? l.groups : [{ name: n, items: l.items || [], cols: l.cols, gutter: l.gutter }], p = [];
927
- return k.forEach((b, I) => {
928
- if (!b || b.hidden) return;
929
- const h = b.name || `group-${I}`;
930
- if (!j(b.show, "group", h)) return;
931
- const S = (b.items || []).filter((ne) => ne.hidden ? !1 : j(ne.show, "item", ne.prop)), q = Math.max(1, b.cols || l.cols), x = b.gutter ?? l.gutter, le = b.headerSlot || (b.name ? `group-header-${b.name}` : void 0), he = b.slot || (b.name ? `group-${b.name}` : void 0);
932
- p.push({
933
- key: `${h}-${I}`,
934
- index: I,
935
- group: b,
936
- items: S,
937
- cols: q,
938
- gutter: x,
939
- isLegacy: !u,
940
- headerSlotName: le,
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
- }), p;
944
- }), Z = (u, k) => {
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 p = Math.max(1, k);
948
- return Math.max(1, Math.floor(24 / p)) || K.value;
949
- }, J = (u) => u.isLegacy ? !1 : u.group.title || u.group.description || u.headerSlotName && i[u.headerSlotName] ? !0 : !!i["group-header"], $ = (u) => {
950
- let k = u.disabled || l.disabled;
951
- if (!k && u.disabledWhen)
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
- k = u.disabledWhen(a.value);
954
- } catch (p) {
955
- console.error(`[EzDynamicForm] Disabled check error for "${u.prop}":`, p);
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: k };
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 c({
960
- validate: async () => {
961
- if (!f.value)
962
- return console.warn("[EzDynamicForm] Form ref is not available"), !1;
963
- try {
964
- return await f.value.validate(), !0;
965
- } catch {
966
- return !1;
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
- getFormData: () => s(a.value),
986
- setFormData: (u, k = !0) => {
987
- if (!u) return;
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
- formRef: f
995
- }), (u, k) => (o(), v(t(ml), g({
1117
+ captureInitialData: ce,
1118
+ formRef: o
1119
+ }), (u, b) => (r(), g(l(Ut), S({
996
1120
  ref_key: "formRef",
997
- ref: f,
1121
+ ref: o,
998
1122
  class: "ez-dynamic-form",
999
- "label-width": "auto"
1000
- }, u.$attrs, { model: a.value }), {
1001
- default: y(() => [
1002
- (o(!0), V(P, null, W(X.value, (p) => (o(), V(P, {
1003
- key: p.key
1004
- }, [
1005
- p.isLegacy ? (o(), v(t(ze), {
1006
- key: 0,
1007
- gutter: p.gutter
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: ce(["ez-dynamic-form-group__header", p.group.headerClassName]),
1053
- style: ie(p.group.headerStyle)
1134
+ class: De(["ez-dynamic-form-group__header", n.group.headerClassName]),
1135
+ style: $e(n.group.headerStyle)
1054
1136
  }, [
1055
- p.headerSlotName && u.$slots[p.headerSlotName] ? C(u.$slots, p.headerSlotName, {
1137
+ n.headerSlotName && u.$slots[n.headerSlotName] ? R(u.$slots, n.headerSlotName, {
1056
1138
  key: 0,
1057
- group: p.group,
1058
- index: p.index,
1059
- items: p.items,
1060
- formData: a.value
1061
- }) : u.$slots["group-header"] ? C(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: p.group,
1064
- index: p.index,
1065
- items: p.items,
1066
- formData: a.value
1067
- }) : (o(), V(P, { key: 2 }, [
1068
- p.group.title ? (o(), V("div", st, Y(p.group.title), 1)) : D("", !0),
1069
- p.group.description ? (o(), V("div", rt, Y(p.group.description), 1)) : D("", !0)
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)) : D("", !0),
1072
- p.bodySlotName && u.$slots[p.bodySlotName] ? C(u.$slots, p.bodySlotName, {
1153
+ ], 6)) : O("", !0),
1154
+ v.value && n.bodySlotName && u.$slots[n.bodySlotName] ? R(u.$slots, n.bodySlotName, {
1073
1155
  key: 1,
1074
- group: p.group,
1075
- index: p.index,
1076
- items: p.items,
1077
- formData: a.value
1078
- }) : u.$slots.group ? C(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: p.group,
1081
- index: p.index,
1082
- items: p.items,
1083
- formData: a.value
1084
- }) : (o(), v(t(ze), {
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: p.gutter,
1087
- class: ce(["ez-dynamic-form-group__body", p.group.bodyClassName]),
1088
- style: ie(p.group.bodyStyle)
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: y(() => [
1091
- (o(!0), V(P, null, W(p.items, (b) => (o(), v(t(Ce), {
1092
- key: `${p.key}-${b.prop}`,
1093
- span: Z(b, p.cols)
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: y(() => [
1096
- M(pe, {
1097
- modelValue: a.value[b.prop],
1098
- "onUpdate:modelValue": (I) => a.value[b.prop] = I,
1099
- config: $(b),
1100
- formData: a.value
1101
- }, ae({ _: 2 }, [
1102
- u.$slots[`label-${b.prop}`] ? {
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: y(() => [
1105
- C(u.$slots, `label-${b.prop}`, { item: b })
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[b.prop] ? {
1191
+ u.$slots[w.prop] ? {
1110
1192
  name: "default",
1111
- fn: y(({ config: I, value: h }) => [
1112
- C(u.$slots, b.prop, {
1113
- item: I,
1114
- value: h,
1115
- formData: a.value
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
- ], 6))
1128
- ], 64))), 128))
1209
+ ]),
1210
+ _: 2
1211
+ }, 1032, ["class", "style"]))), 128))
1129
1212
  ]),
1130
1213
  _: 3
1131
- }, 16, ["model"]));
1214
+ }, 16, ["label-width", "model"]));
1132
1215
  }
1133
- }), dt = G(ut), ct = G(pe), ft = w({ name: "EzTable" }), mt = /* @__PURE__ */ w({
1134
- ...ft,
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
- rowKey: {}
1221
+ border: { type: Boolean, default: !0 },
1222
+ rowKey: { type: [String, Function], default: "id" }
1139
1223
  },
1140
- setup(e, { expose: c }) {
1141
- const l = e, i = O(), a = (n) => {
1142
- const m = l.columns[l.columns.length - 1], d = () => n.type ? !1 : n.prop !== m.prop;
1143
- return { ...{
1144
- align: "center",
1145
- hidden: 1,
1146
- resizable: !0,
1147
- reserveSelection: n.type === "selection",
1148
- /** 默认最后一个 */
1149
- showOverflowTooltip: d()
1150
- }, ...n };
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 c({
1153
- getTableRef: () => i.value,
1154
- clearSelection: () => i.value?.clearSelection(),
1155
- toggleRowSelection: (n, m) => i.value?.toggleRowSelection(n, m),
1156
- toggleAllSelection: () => i.value?.toggleAllSelection(),
1157
- toggleRowExpansion: (n, m) => i.value?.toggleRowExpansion(n, m),
1158
- setCurrentRow: (n) => i.value?.setCurrentRow(n),
1159
- clearSort: () => i.value?.clearSort(),
1160
- clearFilter: (n) => i.value?.clearFilter(n),
1161
- doLayout: () => i.value?.doLayout(),
1162
- sort: (n, m) => i.value?.sort(n, m)
1163
- }), (n, m) => (o(), v(t(pl), g({
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: i,
1166
- data: l.data,
1167
- border: "",
1168
- "row-key": "id"
1169
- }, n.$attrs), ae({
1170
- default: y(() => [
1171
- (o(!0), V(P, null, W(l.columns, (d) => (o(), V(P, {
1172
- key: d.prop
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(d.type) ? (o(), v(t(Ae), g({
1272
+ ["selection", "index"].includes(v.type) ? (r(), g(l(je), S({
1175
1273
  key: 0,
1176
1274
  ref_for: !0
1177
- }, a(d)), null, 16)) : d.hidden ? D("", !0) : (o(), v(t(Ae), g({
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
- }, a(d)), ae({ _: 2 }, [
1181
- n.$slots[d.prop] ? {
1278
+ }, D(v)), Se({ _: 2 }, [
1279
+ m.$slots[v.prop] ? {
1182
1280
  name: "default",
1183
- fn: y((s) => [
1184
- C(n.$slots, d.prop, g({ ref_for: !0 }, s))
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
- n.$slots[`header-${d.prop}`] ? {
1286
+ m.$slots[`header-${v.prop}`] ? {
1195
1287
  name: "header",
1196
- fn: y((s) => [
1197
- C(n.$slots, `header-${d.prop}`, g({ ref_for: !0 }, s))
1288
+ fn: k((p) => [
1289
+ R(m.$slots, `header-${v.prop}`, S({ ref_for: !0 }, p))
1198
1290
  ]),
1199
- key: "2"
1291
+ key: "1"
1200
1292
  } : void 0
1201
1293
  ]), 1040))
1202
1294
  ], 64))), 128))
1203
1295
  ]),
1204
1296
  _: 2
1205
1297
  }, [
1206
- n.$slots?.append ? {
1298
+ m.$slots?.append ? {
1207
1299
  name: "append",
1208
- fn: y(() => [
1209
- C(n.$slots, "append")
1300
+ fn: k(() => [
1301
+ R(m.$slots, "append")
1210
1302
  ]),
1211
1303
  key: "0"
1212
1304
  } : void 0,
1213
- n.$slots?.empty ? {
1305
+ m.$slots?.empty ? {
1214
1306
  name: "empty",
1215
- fn: y(() => [
1216
- C(n.$slots, "empty")
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
- }), Fe = G(mt), pt = { class: "ez-search-form" }, vt = { class: "ez-search-form__operate" }, gt = w({ name: "EzSearchForm", inheritAttrs: !1 }), yt = /* @__PURE__ */ w({
1223
- ...gt,
1224
- props: /* @__PURE__ */ F({
1225
- collapsedHeight: { default: 50 },
1226
- reset: { type: Boolean }
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: c }) {
1233
- const l = e, { t: i } = ue(), a = O(), f = O(0), n = L(e, "expanded"), m = T(() => f.value > l.collapsedHeight), d = T(() => n.value ? Gl : ql), s = T(() => n.value ? i("s.button.collapse") : i("s.button.expand"));
1234
- let r = null;
1235
- const R = Sl(() => {
1236
- a.value && (f.value = a.value.scrollHeight);
1237
- }, 100), K = () => {
1238
- n.value = !n.value;
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 ye(() => {
1332
+ return Oe(() => {
1241
1333
  setTimeout(() => {
1242
- a.value && (R(), r = new ResizeObserver(R), r.observe(a.value));
1334
+ i.value && (q(), D = new ResizeObserver(q), D.observe(i.value));
1243
1335
  }, 50);
1244
- }), Ke(() => {
1245
- r && (r.disconnect(), r = null);
1246
- }), c({
1247
- countViewHeight: R
1248
- }), (H, j) => (o(), V("div", pt, [
1249
- N("div", {
1250
- class: "ez-search-form__wrapper",
1251
- style: ie({
1252
- height: f.value ? n.value ? `${f.value}px` : `${l.collapsedHeight}px` : "auto"
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
- N("div", vt, [
1256
- C(H.$slots, "operate"),
1257
- m.value ? (o(), v(t(te), {
1258
- key: 0,
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
- C(H.$slots, "default")
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
- }), Ge = G(yt), bt = w({ name: "EzPagination", inheritAttrs: !1 }), ht = /* @__PURE__ */ w({
1276
- ...bt,
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 c = L(e, "currentPage"), l = L(e, "pageSize"), { attrs: i } = oe(["currentPage", "pageSize"]);
1286
- return (a, f) => (o(), v(t(vl), g({
1287
- "current-page": c.value,
1288
- "onUpdate:currentPage": f[0] || (f[0] = (n) => c.value = n),
1289
- "page-size": l.value,
1290
- "onUpdate:pageSize": f[1] || (f[1] = (n) => l.value = n),
1291
- "page-sizes": [10, 20, 50, 100],
1292
- layout: "total, sizes, prev, pager, next, jumper"
1293
- }, t(i)), null, 16, ["current-page", "page-size"]));
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
- }), He = G(ht);
1296
- var ve = /* @__PURE__ */ ((e) => (e.ASC = "ascending", e.DESC = "descending", e[e.EMPTY = null] = "EMPTY", e))(ve || {});
1297
- const Vt = (e) => {
1298
- const c = O([]), l = T(() => c.value), i = T(() => c.value.map((n) => n[e]));
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: (n) => {
1301
- c.value = n;
1424
+ selectionChange: (c) => {
1425
+ s.value = c;
1302
1426
  },
1303
- getSelectedList: l,
1304
- getSelectedIds: i,
1305
- getSortParams: ({ prop: n, order: m }) => {
1306
- const d = { asc: null, desc: null };
1307
- return m === ve.ASC ? (d.asc = n, d.desc = null) : m === ve.DESC && (d.asc = null, d.desc = n), d;
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
- }, Et = /* @__PURE__ */ w({
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__ */ F(["change"], ["update:modelValue", "update:columns"]),
1319
- setup(e, { emit: c }) {
1320
- const { t: l } = ue(), i = ["selection", "index", "expand"], a = c, f = L(e, "modelValue"), n = L(e, "columns"), m = (d) => n.value.filter((r) => r.hidden === 0).length < 2 && d.hidden === 0;
1321
- return (d, s) => (o(), v(t(gl), {
1322
- modelValue: f.value,
1323
- "onUpdate:modelValue": s[1] || (s[1] = (r) => f.value = r),
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(l)("s.label.column"),
1449
+ title: l(t)("s.label.column"),
1326
1450
  size: "15%"
1327
1451
  }, {
1328
- default: y(() => [
1329
- (o(!0), V(P, null, W(n.value, (r) => (o(), V(P, {
1330
- key: r.prop
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
- i.includes(r.type) ? D("", !0) : (o(), v(t(Ne), {
1456
+ a.includes(E.type) ? O("", !0) : (r(), g(l(at), {
1333
1457
  key: 0,
1334
- modelValue: r.hidden,
1335
- "onUpdate:modelValue": (R) => r.hidden = R,
1458
+ "model-value": !E.hidden,
1336
1459
  class: "flex",
1337
- "true-value": 0,
1338
- "false-value": 1,
1339
- label: r.label,
1340
- checked: "",
1341
- disabled: m(r),
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
- }), $t = { class: "ez-fast-table" }, kt = { class: "ez-fast-table_wrapper" }, wt = {
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
- }, St = { class: "ez-fast-table_pagination" }, zt = w({
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: be.directive },
1478
+ directives: { loading: Be.directive },
1355
1479
  inheritAttrs: !1
1356
- }), Ct = /* @__PURE__ */ w({
1357
- ...zt,
1358
- props: /* @__PURE__ */ F({
1359
- api: { type: Function, default: () => Promise.resolve() },
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
- data: {},
1364
- columns: {},
1365
- rowKey: {}
1366
- }, {
1367
- params: {},
1368
- paramsModifiers: {},
1369
- columns: {},
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
- ...f,
1380
- ...le
1515
+ ...c,
1516
+ ...ft
1381
1517
  };
1382
- }), m = O(a.expanded), { selectionChange: d, getSelectedList: s, getSortParams: r, getSelectedIds: R } = Vt(a.rowKey), K = O(null), H = O(!1), j = O(null), X = O([]), Z = O(0), J = l, $ = L(e, "params"), E = L(e, "columns"), z = L(e, "loading"), U = async () => {
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
- z.value = !0, await a.beforeSearch($.value);
1385
- const { code: h, data: S } = await a.api($.value);
1386
- h === 200 && S.records ? (X.value = S.records || [], Z.value = S.total) : (X.value = [], Z.value = 0), J("query");
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
- }, B = () => {
1391
- $.value.current = 1, U();
1392
- }, ee = () => K.value?.getTableRef(), u = (h) => {
1393
- const S = r(h);
1394
- $.value = { ...$.value, ...S };
1395
- const { column: q } = h;
1396
- q.sortable === "custom" && B();
1397
- }, k = (h) => {
1398
- if (h === null || typeof h != "object") return h;
1399
- if (h instanceof Date) return new Date(h.getTime());
1400
- if (h instanceof Array) return h.map((q) => k(q));
1401
- const S = Object.create(Object.getPrototypeOf(h));
1402
- for (const q in h)
1403
- h.hasOwnProperty(q) && (S[q] = k(h[q]));
1404
- return S;
1405
- }, p = () => {
1406
- $.value = k(j.value), J("reset"), Le(() => B());
1407
- }, b = (h) => {
1408
- J("changePage", h), h.size ? B() : U();
1409
- }, I = () => {
1410
- ee().doLayout();
1411
- };
1412
- return ye(() => {
1413
- j.value = k($.value);
1414
- }), c({ search: B, query: U, getTableRef: ee }), (h, S) => {
1415
- const q = Ue("loading");
1416
- return o(), V("div", $t, [
1417
- h.$slots.form ? (o(), v(t(Ge), {
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
- loading: z.value,
1420
- expanded: m.value
1664
+ expanded: V.value,
1665
+ "onUpdate:expanded": z[0] || (z[0] = (M) => V.value = M)
1421
1666
  }, {
1422
- default: y((x) => [
1423
- C(h.$slots, "form", Ee(Ye(x)))
1667
+ default: k(() => [
1668
+ R(f.$slots, "form", Ce(Le(I.value)))
1424
1669
  ]),
1425
- operate: y(() => [
1426
- M(t(te), {
1670
+ operate: k(() => [
1671
+ W(l(be), {
1427
1672
  type: "primary",
1428
- loading: z.value,
1429
- onClick: B
1673
+ loading: $.value,
1674
+ onClick: fe
1430
1675
  }, {
1431
- default: y(() => [
1432
- _(Y(t(i)("s.button.query")), 1)
1676
+ default: k(() => [
1677
+ he(ue(l(a)("s.button.query")), 1)
1433
1678
  ]),
1434
1679
  _: 1
1435
1680
  }, 8, ["loading"]),
1436
- M(t(te), { onClick: p }, {
1437
- default: y(() => [
1438
- _(Y(t(i)("s.button.reset")), 1)
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, ["loading", "expanded"])) : D("", !0),
1445
- h.$slots.freeArea ? C(h.$slots, "freeArea", { key: 1 }) : D("", !0),
1446
- N("div", kt, [
1447
- h.$slots.header || a.columnTool ? (o(), V("div", {
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: ce(["ez-fast-table_wrapper_header", h.$slots.header ? "justify-between" : "justify-end"])
1694
+ class: De(["ez-fast-table_wrapper_header", f.$slots.header ? "justify-between" : "justify-end"])
1450
1695
  }, [
1451
- h.$slots.header ? (o(), V("div", wt, [
1452
- C(h.$slots, "header", {
1453
- selectList: t(s),
1454
- selectIds: t(R)
1696
+ f.$slots.header ? (r(), C("div", Wa, [
1697
+ R(f.$slots, "header", {
1698
+ selectList: l(E),
1699
+ selectIds: l(q)
1455
1700
  })
1456
- ])) : D("", !0),
1457
- a.columnTool ? (o(), v(t(te), {
1701
+ ])) : O("", !0),
1702
+ o.columnTool ? (r(), g(l(be), {
1458
1703
  key: 1,
1459
- icon: t(Kl),
1704
+ icon: l(ga),
1460
1705
  circle: "",
1461
- onClick: S[0] || (S[0] = (x) => H.value = !0)
1462
- }, null, 8, ["icon"])) : D("", !0)
1463
- ], 2)) : D("", !0),
1464
- Pe((o(), v(t(Fe), g(n.value, {
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: K,
1467
- columns: E.value,
1468
- data: X.value,
1469
- onSelectionChange: t(d),
1470
- onSortChange: u
1471
- }), ae({ _: 2 }, [
1472
- W(h.$slots, (x, le, he) => ({
1473
- name: le,
1474
- fn: y((ne) => [
1475
- ["form"].includes(x.name) ? D("", !0) : C(h.$slots, le, Ee(g({ key: 0 }, ne)))
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
- ]), 1040, ["columns", "data", "onSelectionChange"])), [
1479
- [q, z.value]
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", St, [
1482
- M(t(He), {
1483
- "current-page": $.value.current,
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
- S[1] || (S[1] = (x) => $.value.current = x),
1486
- S[3] || (S[3] = (x) => b({ current: x }))
1741
+ z[2] || (z[2] = (M) => B.value.current = M),
1742
+ z[4] || (z[4] = (M) => w({ current: M }))
1487
1743
  ],
1488
- "page-size": $.value.size,
1744
+ "page-size": B.value.size,
1489
1745
  "onUpdate:pageSize": [
1490
- S[2] || (S[2] = (x) => $.value.size = x),
1491
- S[4] || (S[4] = (x) => b({ size: x }))
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
- M(Et, {
1498
- modelValue: H.value,
1499
- "onUpdate:modelValue": S[5] || (S[5] = (x) => H.value = x),
1500
- columns: E.value,
1501
- "onUpdate:columns": S[6] || (S[6] = (x) => E.value = x),
1502
- onChange: I
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
- }), At = G(Ct), xe = /* @__PURE__ */ Symbol("INSTALLED_KEY");
1508
- function Dt(e = []) {
1763
+ }), ct = te(Za), sl = () => ct, Ja = te(it), Je = /* @__PURE__ */ Symbol("INSTALLED_KEY");
1764
+ function _a(e = []) {
1509
1765
  return {
1510
- install: (l) => {
1511
- l[xe] || (l[xe] = !0, e.forEach((i) => l.use(i)));
1766
+ install: (t) => {
1767
+ t[Je] || (t[Je] = !0, e.forEach((a) => t.use(a)));
1512
1768
  }
1513
1769
  };
1514
1770
  }
1515
- const Tt = [
1516
- Be,
1517
- Ml,
1518
- dt,
1771
+ const el = [
1772
+ lt,
1773
+ aa,
1774
+ Ta,
1775
+ Ma,
1519
1776
  ct,
1520
- At,
1521
- Q,
1522
- qe,
1523
- He,
1524
- Oe,
1525
- Ge,
1526
- Ie,
1527
- Fe
1528
- ], Rt = [
1529
- yl,
1530
- be,
1531
- se,
1532
- bl,
1533
- hl,
1534
- Vl
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
- tt as CHANGE_TRIGGER_TYPES,
1538
- Be as EzCheckbox,
1539
- Ml as EzDialog,
1540
- dt as EzDynamicForm,
1541
- At as EzFastTable,
1542
- ct as EzFormItem,
1543
- Q as EzIcon,
1544
- qe as EzImageUpload,
1545
- He as EzPagination,
1546
- Oe as EzRadio,
1547
- Ge as EzSearchForm,
1548
- Ie as EzSelect,
1549
- Fe as EzTable,
1550
- A as FormItemType,
1551
- lt as SELECT_FORM_TYPES,
1552
- xt as default,
1553
- at as getInputVerb,
1554
- ot as getTrigger,
1555
- Pt as install
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
  };