dynamicformdjx 0.5.0 → 0.6.0

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.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { defineComponent as O, ref as V, watch as L, toRaw as A, createVNode as n, createTextVNode as g, Fragment as p, nextTick as $, reactive as z } from "vue";
2
- import { t as B, r as j, f as R, p as D, s as M } from "./index-a2ON2stt.js";
3
- import { D as G, O as J, e as Q, g as U, d as X, h as Z, a as ee, c as te, u as ne, b as ae } from "./index-a2ON2stt.js";
4
- const H = /* @__PURE__ */ O({
1
+ import { defineComponent as R, ref as I, watch as j, toRaw as L, createVNode as t, createTextVNode as w, Fragment as B, nextTick as D, onMounted as $, onBeforeUnmount as M, computed as O, reactive as P } from "vue";
2
+ import { t as F, r as H, f as V, p as z, s as Y, g as q, a as E, b as _ } from "./index-BQKYL550.js";
3
+ import { D as re, O as ue, i as oe, h as ie, j as se, k as ce, c as de, e as fe, u as ve, d as me } from "./index-BQKYL550.js";
4
+ const K = /* @__PURE__ */ R({
5
5
  name: "DynamicInput",
6
6
  props: {
7
7
  size: {
@@ -34,13 +34,13 @@ const H = /* @__PURE__ */ O({
34
34
  emits: {
35
35
  "update:modelValue": (e) => !0,
36
36
  onReset: () => !0,
37
- onMerge: (e, d) => !0
37
+ onMerge: (e, o) => !0
38
38
  },
39
39
  slots: Object,
40
40
  setup(e, {
41
- emit: d,
42
- expose: k,
43
- slots: u
41
+ emit: o,
42
+ expose: y,
43
+ slots: l
44
44
  }) {
45
45
  const v = {
46
46
  resetTxt: "重置",
@@ -58,122 +58,122 @@ const H = /* @__PURE__ */ O({
58
58
  }, m = {
59
59
  arraySplitSymbol: ",",
60
60
  ...e.dyListConfigs
61
- }, y = e.size, r = V(B(e.modelValue, e.randomFun, m.arraySplitSymbol)), C = V(null);
62
- L(r, (a) => {
61
+ }, h = e.size, a = I(F(e.modelValue, e.randomFun, m.arraySplitSymbol)), g = I(null);
62
+ j(a, (r) => {
63
63
  if (!e.isController) return;
64
- const b = j(a, m.arraySplitSymbol);
65
- d("update:modelValue", b), d("onMerge", b, A(r.value));
64
+ const S = H(r, m.arraySplitSymbol);
65
+ o("update:modelValue", S), o("onMerge", S, L(a.value));
66
66
  }, {
67
67
  deep: !0
68
- }), k({
69
- onSet: (a) => {
70
- r.value = B(a ?? e.modelValue, e.randomFun, m.arraySplitSymbol);
68
+ }), y({
69
+ onSet: (r) => {
70
+ a.value = F(r ?? e.modelValue, e.randomFun, m.arraySplitSymbol);
71
71
  },
72
- getResult: (a = "res") => a === "ori" ? A(r.value) : j(r.value, m.arraySplitSymbol)
72
+ getResult: (r = "res") => r === "ori" ? L(a.value) : H(a.value, m.arraySplitSymbol)
73
73
  });
74
- const i = () => r.value.push({
74
+ const f = () => a.value.push({
75
75
  rId: e.randomFun(),
76
76
  key: "",
77
77
  value: ""
78
- }), w = () => {
79
- r.value = B(e.modelValue, e.randomFun, m.arraySplitSymbol), d("onReset");
80
- }, x = () => {
81
- r.value.sort((b, s) => +b.rId - +s.rId);
82
- const a = j(r.value, m.arraySplitSymbol);
83
- d("update:modelValue", a), d("onMerge", a, A(r.value)), r.value = B(a, e.randomFun, m.arraySplitSymbol);
78
+ }), T = () => {
79
+ a.value = F(e.modelValue, e.randomFun, m.arraySplitSymbol), o("onReset");
80
+ }, A = () => {
81
+ a.value.sort((S, i) => +S.rId - +i.rId);
82
+ const r = H(a.value, m.arraySplitSymbol);
83
+ o("update:modelValue", r), o("onMerge", r, L(a.value)), a.value = F(r, e.randomFun, m.arraySplitSymbol);
84
84
  };
85
- return () => n("div", {
86
- class: `dynamicForm ${y} ${e.dyCls}`
87
- }, [n("div", {
88
- class: `dyFormList ${r.value.length ? "" : "noList"}`,
89
- ref: C,
85
+ return () => t("div", {
86
+ class: `dynamicForm ${h} ${e.dyCls}`
87
+ }, [t("div", {
88
+ class: `dyFormList ${a.value.length ? "" : "noList"}`,
89
+ ref: g,
90
90
  style: {
91
91
  maxHeight: c.maxHeight
92
92
  }
93
- }, [r.value.map((a, b, s) => {
94
- const l = {
95
- row: a,
96
- index: b,
97
- isLast: b === s.length - 1,
93
+ }, [a.value.map((r, S, i) => {
94
+ const u = {
95
+ row: r,
96
+ index: S,
97
+ isLast: S === i.length - 1,
98
98
  addItem: () => {
99
- r.value.push({
99
+ a.value.push({
100
100
  rId: e.randomFun(),
101
101
  key: "",
102
102
  value: ""
103
- }), c.autoScroll && $(() => {
104
- const o = C.value;
105
- o?.scrollTo({
106
- top: o.scrollHeight,
103
+ }), c.autoScroll && D(() => {
104
+ const d = g.value;
105
+ d?.scrollTo({
106
+ top: d.scrollHeight,
107
107
  behavior: "smooth"
108
108
  });
109
109
  });
110
110
  },
111
111
  removeItem: () => {
112
- r.value = r.value.filter((o) => o.rId !== a.rId);
112
+ a.value = a.value.filter((d) => d.rId !== r.rId);
113
113
  },
114
- toggleArray: () => a.isArray = !a.isArray,
115
- toggleNumber: () => a.isNumber = !a.isNumber
114
+ toggleArray: () => r.isArray = !r.isArray,
115
+ toggleNumber: () => r.isNumber = !r.isNumber
116
116
  };
117
- return n("div", {
117
+ return t("div", {
118
118
  class: "dItem",
119
- key: a.rId
120
- }, [n("div", {
119
+ key: r.rId
120
+ }, [t("div", {
121
121
  class: "input"
122
- }, [n("input", {
123
- size: y,
124
- value: a.key,
122
+ }, [t("input", {
123
+ size: h,
124
+ value: r.key,
125
125
  class: "key nativeInput",
126
- onInput: (o) => {
127
- a.key = o.target.value;
126
+ onInput: (d) => {
127
+ r.key = d.target.value;
128
128
  }
129
- }, null), g(":"), n("div", {
129
+ }, null), w(":"), t("div", {
130
130
  class: "vInput"
131
- }, [n("div", {
131
+ }, [t("div", {
132
132
  class: "slot"
133
- }, [u.typeTools ? u.typeTools(l) : n(p, null, [!c.hideArrayBtn && n("button", {
134
- class: [a.isArray ? "success" : "default", "small", "bt"],
135
- onClick: l.toggleArray
136
- }, [g("Array")]), !c.hideNumberBtn && n("button", {
137
- class: [a.isNumber ? "success" : "default", "small", "bt"],
138
- onClick: l.toggleNumber
139
- }, [g("Number")])])]), n("input", {
140
- size: y,
141
- value: a.value,
133
+ }, [l.typeTools ? l.typeTools(u) : t(B, null, [!c.hideArrayBtn && t("button", {
134
+ class: [r.isArray ? "success" : "default", "small", "bt"],
135
+ onClick: u.toggleArray
136
+ }, [w("Array")]), !c.hideNumberBtn && t("button", {
137
+ class: [r.isNumber ? "success" : "default", "small", "bt"],
138
+ onClick: u.toggleNumber
139
+ }, [w("Number")])])]), t("input", {
140
+ size: h,
141
+ value: r.value,
142
142
  class: "value nativeV",
143
- onInput: (o) => {
144
- const t = o.target.value;
145
- c.allowFilter && a.isNumber ? a.value = R(t, a.isArray, m.arraySplitSymbol) : a.value = t;
143
+ onInput: (d) => {
144
+ const n = d.target.value;
145
+ c.allowFilter && r.isNumber ? r.value = V(n, r.isArray, m.arraySplitSymbol) : r.value = n;
146
146
  }
147
- }, null)])]), n("div", {
147
+ }, null)])]), t("div", {
148
148
  class: "btn"
149
- }, [u.rowActions ? u.rowActions(l) : n(p, null, [n("button", {
150
- class: [y, "success", "bt"],
151
- disabled: !l.isLast,
152
- onClick: l.addItem
153
- }, [g("+")]), n("button", {
154
- class: ["danger", y, "bt"],
155
- onClick: l.removeItem
156
- }, [g("-")])])])]);
157
- })]), n("div", {
158
- class: `control ${r.value.length ? "" : "noList"}`
159
- }, [!r.value.length && (u.newBtn ? u.newBtn({
160
- newItem: i
161
- }) : n("button", {
162
- class: ["success", y, "bt"],
163
- onClick: i
164
- }, [v.newTxt])), !e.isController && n(p, null, [!c.hideReset && (u.resetBtn ? u.resetBtn({
165
- reset: w
166
- }) : n("button", {
167
- class: ["default", y, "bt"],
168
- onClick: w
169
- }, [v.resetTxt])), u.mergeBtn ? u.mergeBtn({
170
- merge: x
171
- }) : n("button", {
172
- class: ["info", y, "bt"],
173
- onClick: x
149
+ }, [l.rowActions ? l.rowActions(u) : t(B, null, [t("button", {
150
+ class: [h, "success", "bt"],
151
+ disabled: !u.isLast,
152
+ onClick: u.addItem
153
+ }, [w("+")]), t("button", {
154
+ class: ["danger", h, "bt"],
155
+ onClick: u.removeItem
156
+ }, [w("-")])])])]);
157
+ })]), t("div", {
158
+ class: `control ${a.value.length ? "" : "noList"}`
159
+ }, [!a.value.length && (l.newBtn ? l.newBtn({
160
+ newItem: f
161
+ }) : t("button", {
162
+ class: ["success", h, "bt"],
163
+ onClick: f
164
+ }, [v.newTxt])), !e.isController && t(B, null, [!c.hideReset && (l.resetBtn ? l.resetBtn({
165
+ reset: T
166
+ }) : t("button", {
167
+ class: ["default", h, "bt"],
168
+ onClick: T
169
+ }, [v.resetTxt])), l.mergeBtn ? l.mergeBtn({
170
+ merge: A
171
+ }) : t("button", {
172
+ class: ["info", h, "bt"],
173
+ onClick: A
174
174
  }, [v.mergeTxt])])])]);
175
175
  }
176
- }), P = /* @__PURE__ */ O({
176
+ }), U = /* @__PURE__ */ R({
177
177
  name: "DynamicCascadeInput",
178
178
  props: {
179
179
  modelValue: {
@@ -212,13 +212,13 @@ const H = /* @__PURE__ */ O({
212
212
  emits: {
213
213
  "update:modelValue": (e) => !0,
214
214
  onReset: () => !0,
215
- onMerge: (e, d) => !0
215
+ onMerge: (e, o) => !0
216
216
  },
217
217
  slots: Object,
218
218
  setup(e, {
219
- emit: d,
220
- expose: k,
221
- slots: u
219
+ emit: o,
220
+ expose: y,
221
+ slots: l
222
222
  }) {
223
223
  const v = {
224
224
  resetTxt: "重置",
@@ -239,162 +239,435 @@ const H = /* @__PURE__ */ O({
239
239
  }, m = {
240
240
  arraySplitSymbol: ",",
241
241
  ...e.dyListConfigs
242
- }, y = (s) => ["string", "number"].includes(s), r = (s) => Object.keys(s).map((l, o) => {
243
- let t = s[l];
244
- const h = Array.isArray(t), T = h ? t.every((N) => typeof N == "number") : typeof t == "number", I = t === null;
245
- return y(typeof t) && (t = s[l]), I && (t = ""), {
246
- rId: e.randomFun(o),
247
- key: l,
248
- value: Object.prototype.toString.call(t) === "[object Object]" ? r(s[l]) : h ? t.join(m.arraySplitSymbol) : t,
249
- isArray: h || void 0,
250
- isNumber: T || void 0
242
+ }, h = (i) => ["string", "number"].includes(i), a = (i) => Object.keys(i).map((u, d) => {
243
+ let n = i[u];
244
+ const C = Array.isArray(n), s = C ? n.every((b) => typeof b == "number") : typeof n == "number", p = n === null;
245
+ return h(typeof n) && (n = i[u]), p && (n = ""), {
246
+ rId: e.randomFun(d),
247
+ key: u,
248
+ value: Object.prototype.toString.call(n) === "[object Object]" ? a(i[u]) : C ? n.join(m.arraySplitSymbol) : n,
249
+ isArray: C || void 0,
250
+ isNumber: s || void 0
251
251
  };
252
- }), C = (s) => s.reduce((l, o) => {
253
- const t = o.value;
254
- return o.key.trim().length && (l[o.key] = Array.isArray(t) ? C(t) : D(o.value, o.isArray, o.isNumber, m.arraySplitSymbol)), l;
255
- }, {}), i = V(r(e.modelValue)), w = (s, l = 1, o) => n("div", {
256
- class: [`depth-${l}`, c.showBorder ? "" : "no-border", c.showPad ? "" : "no-pad"],
252
+ }), g = (i) => i.reduce((u, d) => {
253
+ const n = d.value;
254
+ return d.key.trim().length && (u[d.key] = Array.isArray(n) ? g(n) : z(d.value, d.isArray, d.isNumber, m.arraySplitSymbol)), u;
255
+ }, {}), f = I(a(e.modelValue)), T = (i, u = 1, d) => t("div", {
256
+ class: [`depth-${u}`, c.showBorder ? "" : "no-border", c.showPad ? "" : "no-pad"],
257
257
  style: {
258
- "--depth": l,
259
- ["--c" + [l]]: M(c.borderColors, l)
258
+ "--depth": u,
259
+ ["--c" + [u]]: Y(c.borderColors, u)
260
260
  }
261
- }, [s.map((t, h, T) => {
262
- const I = Array.isArray(t.value), N = y(typeof t.value), f = {
263
- row: t,
264
- index: h,
265
- isLast: h === T.length - 1,
261
+ }, [i.map((n, C, s) => {
262
+ const p = Array.isArray(n.value), b = h(typeof n.value), x = {
263
+ row: n,
264
+ index: C,
265
+ isLast: C === s.length - 1,
266
266
  addItem: () => {
267
- s.push({
267
+ i.push({
268
268
  rId: e.randomFun(),
269
269
  key: "",
270
270
  value: ""
271
271
  });
272
272
  },
273
273
  addChild: () => {
274
- N && (t.value = [], t.isArray = void 0), t.value.push({
274
+ b && (n.value = [], n.isArray = void 0), n.value.push({
275
275
  rId: e.randomFun(),
276
276
  key: "",
277
277
  value: ""
278
278
  });
279
279
  },
280
280
  removeItem: () => {
281
- if (s.splice(h, 1), s.length < 1) {
282
- if (o === void 0) return C([]);
283
- const F = i.value.findIndex((S) => S.rId === o?.rId);
284
- l < 1 ? i.value.splice(F, 1, {
285
- ...o,
281
+ if (i.splice(C, 1), i.length < 1) {
282
+ if (d === void 0) return g([]);
283
+ const k = f.value.findIndex((N) => N.rId === d?.rId);
284
+ u < 1 ? f.value.splice(k, 1, {
285
+ ...d,
286
286
  value: ""
287
- }) : o.value = "";
287
+ }) : d.value = "";
288
288
  }
289
289
  },
290
- toggleArray: () => t.isArray = !t.isArray,
291
- toggleNumber: () => t.isNumber = !t.isNumber
290
+ toggleArray: () => n.isArray = !n.isArray,
291
+ toggleNumber: () => n.isNumber = !n.isNumber
292
292
  };
293
- return n("div", {
293
+ return t("div", {
294
294
  class: "dItem",
295
- key: t.rId,
295
+ key: n.rId,
296
296
  style: {
297
- marginLeft: l > 1 ? `${l * c.retractLen}px` : "0"
297
+ marginLeft: u > 1 ? `${u * c.retractLen}px` : "0"
298
298
  }
299
- }, [n("div", {
299
+ }, [t("div", {
300
300
  class: "input"
301
- }, [!I && n(p, null, [n("input", {
302
- value: t.key,
301
+ }, [!p && t(B, null, [t("input", {
302
+ value: n.key,
303
303
  class: "key nativeInput",
304
- onInput: (F) => t.key = F.target.value
305
- }, null), g(":")]), n("div", {
304
+ onInput: (k) => n.key = k.target.value
305
+ }, null), w(":")]), t("div", {
306
306
  class: "vInput"
307
- }, [n("div", {
307
+ }, [t("div", {
308
308
  class: "slot"
309
- }, [Array.isArray(t.value) ? void 0 : u.typeTools ? u.typeTools(f) : n(p, null, [!c.hideArrayBtn && n("button", {
310
- class: [t.isArray ? "success" : "default", "small", "bt"],
311
- onClick: f.toggleArray
312
- }, [g("Array")]), !c.hideNumberBtn && n("button", {
313
- class: [t.isNumber ? "success" : "default", "small", "bt"],
314
- onClick: f.toggleNumber
315
- }, [g("Number")])])]), n("input", {
316
- class: `value nativeV ${I ? "isKey" : ""}`,
317
- value: N ? t.value : t.key,
318
- onInput: (F) => {
319
- const S = F.target.value;
320
- if (I) {
321
- t.key = S;
309
+ }, [Array.isArray(n.value) ? void 0 : l.typeTools ? l.typeTools(x) : t(B, null, [!c.hideArrayBtn && t("button", {
310
+ class: [n.isArray ? "success" : "default", "small", "bt"],
311
+ onClick: x.toggleArray
312
+ }, [w("Array")]), !c.hideNumberBtn && t("button", {
313
+ class: [n.isNumber ? "success" : "default", "small", "bt"],
314
+ onClick: x.toggleNumber
315
+ }, [w("Number")])])]), t("input", {
316
+ class: `value nativeV ${p ? "isKey" : ""}`,
317
+ value: b ? n.value : n.key,
318
+ onInput: (k) => {
319
+ const N = k.target.value;
320
+ if (p) {
321
+ n.key = N;
322
322
  return;
323
323
  }
324
- c.allowFilter && t.isNumber ? t.value = R(S, t.isArray, m.arraySplitSymbol) : t.value = S;
324
+ c.allowFilter && n.isNumber ? n.value = V(N, n.isArray, m.arraySplitSymbol) : n.value = N;
325
325
  }
326
- }, null), n("div", {
326
+ }, null), t("div", {
327
327
  class: "surSlot"
328
- }, [l < e.depth ? !I && (u.newChild ? u.newChild(f) : n("button", {
328
+ }, [u < e.depth ? !p && (l.newChild ? l.newChild(x) : t("button", {
329
329
  class: ["success", "bt"],
330
- onClick: f.addChild
331
- }, [e.newChildTxt(t)])) : null])])]), n("div", {
330
+ onClick: x.addChild
331
+ }, [e.newChildTxt(n)])) : null])])]), t("div", {
332
332
  class: "btn"
333
- }, [u.rowActions ? u.rowActions(f) : n(p, null, [n("button", {
333
+ }, [l.rowActions ? l.rowActions(x) : t(B, null, [t("button", {
334
334
  class: ["success", "bt"],
335
- disabled: !f.isLast,
336
- onClick: f.addItem
337
- }, [g("+")]), n("button", {
335
+ disabled: !x.isLast,
336
+ onClick: x.addItem
337
+ }, [w("+")]), t("button", {
338
338
  class: ["danger", "bt"],
339
- onClick: f.removeItem
340
- }, [g("-")])])]), Array.isArray(t.value) && w(t.value, l + 1, t)]);
339
+ onClick: x.removeItem
340
+ }, [w("-")])])]), Array.isArray(n.value) && T(n.value, u + 1, n)]);
341
341
  })]);
342
- L(i, (s) => {
342
+ j(f, (i) => {
343
343
  if (!e.isController) return;
344
- const l = C(s);
345
- d("update:modelValue", l), d("onMerge", l, A(i.value));
344
+ const u = g(i);
345
+ o("update:modelValue", u), o("onMerge", u, L(f.value));
346
346
  }, {
347
347
  deep: !0
348
- }), k({
349
- onSet: (s) => {
350
- i.value = r(s ?? e.modelValue);
348
+ }), y({
349
+ onSet: (i) => {
350
+ f.value = a(i ?? e.modelValue);
351
351
  },
352
- getResult: (s = "res") => s === "ori" ? A(i.value) : C(i.value)
352
+ getResult: (i = "res") => i === "ori" ? L(f.value) : g(f.value)
353
353
  });
354
- const x = () => i.value.push({
354
+ const A = () => f.value.push({
355
355
  rId: e.randomFun(),
356
356
  key: "",
357
357
  value: ""
358
- }), a = () => {
359
- i.value = r(e.modelValue), d("onReset");
360
- }, b = () => {
361
- const s = C(i.value);
362
- d("update:modelValue", s), d("onMerge", s, A(i.value)), i.value = r(s);
358
+ }), r = () => {
359
+ f.value = a(e.modelValue), o("onReset");
360
+ }, S = () => {
361
+ const i = g(f.value);
362
+ o("update:modelValue", i), o("onMerge", i, L(f.value)), f.value = a(i);
363
363
  };
364
- return () => n("div", {
364
+ return () => t("div", {
365
365
  class: `dynamicCascadeForm ${e.dyCls}`
366
- }, [n("div", {
367
- class: `dyFormList ${i.value.length ? "" : "noObj"}`,
366
+ }, [t("div", {
367
+ class: `dyFormList ${f.value.length ? "" : "noObj"}`,
368
368
  style: {
369
369
  maxHeight: c.maxHeight
370
370
  }
371
- }, [w(i.value)]), n("div", {
372
- class: `control ${i.value.length ? "" : "noObj"}`
373
- }, [!i.value.length && (u.newBtn ? u.newBtn({
374
- newItem: x
375
- }) : n("button", {
371
+ }, [T(f.value)]), t("div", {
372
+ class: `control ${f.value.length ? "" : "noObj"}`
373
+ }, [!f.value.length && (l.newBtn ? l.newBtn({
374
+ newItem: A
375
+ }) : t("button", {
376
376
  class: ["success", "bt"],
377
- onClick: x
378
- }, [v.newTxt])), !e.isController && n(p, null, [!c.hideReset && (u.resetBtn ? u.resetBtn({
379
- reset: a
380
- }) : n("button", {
377
+ onClick: A
378
+ }, [v.newTxt])), !e.isController && t(B, null, [!c.hideReset && (l.resetBtn ? l.resetBtn({
379
+ reset: r
380
+ }) : t("button", {
381
381
  class: ["default", "bt"],
382
- onClick: a
383
- }, [v.resetTxt])), u.mergeBtn ? u.mergeBtn({
384
- merge: b
385
- }) : n("button", {
382
+ onClick: r
383
+ }, [v.resetTxt])), l.mergeBtn ? l.mergeBtn({
384
+ merge: S
385
+ }) : t("button", {
386
386
  class: ["info", "bt"],
387
- onClick: b
387
+ onClick: S
388
388
  }, [v.mergeTxt])])])]);
389
389
  }
390
- }), K = function(e, d) {
391
- function k() {
390
+ }), W = {
391
+ loading: {
392
+ type: Boolean,
393
+ default: !1
394
+ },
395
+ isError: {
396
+ type: Boolean,
397
+ default: !1
398
+ },
399
+ loadData: {
400
+ type: Function,
401
+ required: !0
402
+ },
403
+ scrollNode: {
404
+ type: String,
405
+ required: !0
406
+ },
407
+ loadingTxt: {
408
+ type: String,
409
+ default: "loading..."
410
+ },
411
+ finishedTxt: {
412
+ type: String,
413
+ default: "no more data"
414
+ },
415
+ errorTxt: {
416
+ type: String,
417
+ default: "fetch error , click again"
418
+ },
419
+ finished: {
420
+ type: Boolean,
421
+ default: !1
422
+ },
423
+ offset: {
424
+ type: Number,
425
+ default: 20
426
+ },
427
+ memoryScroll: {
428
+ type: Boolean,
429
+ default: !1
430
+ },
431
+ pullRefresh: {
432
+ type: Boolean,
433
+ default: !1
434
+ },
435
+ refreshData: {
436
+ type: Function
437
+ },
438
+ pullDistance: {
439
+ type: Number,
440
+ default: 70
441
+ },
442
+ pullTxt: {
443
+ type: String,
444
+ default: "pull to refresh"
445
+ },
446
+ releaseTxt: {
447
+ type: String,
448
+ default: "release to refresh"
449
+ },
450
+ refreshingTxt: {
451
+ type: String,
452
+ default: "refreshing..."
453
+ },
454
+ supportMode: {
455
+ type: String,
456
+ default: "mobile"
457
+ },
458
+ refreshLoading: {
459
+ type: Boolean,
460
+ default: !0
461
+ }
462
+ }, G = {
463
+ "update:loading": (e) => !0,
464
+ "update:isError": (e) => !0
465
+ }, ee = /* @__PURE__ */ R({
466
+ name: "LoadedScroll",
467
+ props: W,
468
+ emits: G,
469
+ slots: Object,
470
+ setup(e, {
471
+ slots: o,
472
+ emit: y
473
+ }) {
474
+ const l = I(null);
475
+ let v = null;
476
+ const {
477
+ ignoreScroll: c,
478
+ botHintRef: m,
479
+ hintHeight: h,
480
+ handleScroll: a,
481
+ bindHintHeight: g,
482
+ fetchData: f
483
+ } = J(e, y), {
484
+ pullY: T,
485
+ pullText: A,
486
+ touching: r,
487
+ bindLoaded: S,
488
+ unbindLoaded: i
489
+ } = Q(e, y, l, u);
490
+ async function u() {
491
+ c.value = !0, await D();
492
+ const d = l.value?.querySelector(e.scrollNode);
493
+ v?.removeEventListener("scroll", a), v = d, v && (e.memoryScroll || (v.scrollTop = 0), v.addEventListener("scroll", a)), setTimeout(() => {
494
+ c.value = !1;
495
+ });
496
+ }
497
+ return $(async () => {
498
+ await g(), await f(), await u(), S();
499
+ }), M(() => {
500
+ v && v.removeEventListener("scroll", a), i();
501
+ }), () => t("div", {
502
+ ref: l,
503
+ class: "loadedScroll"
504
+ }, [e.pullRefresh && t("div", {
505
+ class: "pullRefreshHint",
506
+ style: {
507
+ height: `${T.value}px`,
508
+ lineHeight: `${T.value}px`,
509
+ transition: r.value ? "none" : "height .25s",
510
+ overflow: "hidden",
511
+ textAlign: "center"
512
+ }
513
+ }, [A.value]), o.default?.({
514
+ hintHeight: h.value
515
+ }), t("div", {
516
+ ref: m
517
+ }, [o.bottomHint ? o.bottomHint?.() : e.finished ? t("div", {
518
+ class: "hintText"
519
+ }, [o.finishedTxt?.() ?? e.finishedTxt]) : t(B, null, [e.loading && t("div", {
520
+ class: "hintText"
521
+ }, [o.loadingTxt?.() ?? e.loadingTxt]), e.isError && !e.loading && t("div", {
522
+ class: "hintText errorTxt",
523
+ "data-no-pull": !0,
524
+ onPointerDown: (d) => d.stopPropagation(),
525
+ onTouchStart: (d) => d.stopPropagation(),
526
+ onClick: () => {
527
+ y("update:loading", !0), y("update:isError", !1), f();
528
+ }
529
+ }, [o.errorTxt?.() ?? e.errorTxt])])])]);
530
+ }
531
+ });
532
+ function J(e, o) {
533
+ const y = I(!0), l = I(0), v = I(null), c = O(() => e.loading || e.finished || e.isError ? l.value : 0);
534
+ function m(g) {
535
+ if (y.value || e.loading || e.finished || e.isError) return;
536
+ const f = g.target;
537
+ f.scrollTop + f.clientHeight >= f.scrollHeight - e.offset && (o("update:loading", !0), a());
538
+ }
539
+ async function h() {
540
+ const g = v.value?.getElementsByTagName("div")[0];
541
+ l.value = (g?.clientHeight ?? 0) + q(g);
542
+ }
543
+ async function a() {
544
+ return e.loadData?.().then((g) => {
545
+ o("update:loading", !1);
546
+ }).catch((g) => {
547
+ o("update:loading", !1), o("update:isError", !0);
548
+ });
549
+ }
550
+ return {
551
+ ignoreScroll: y,
552
+ hintHeight: c,
553
+ botHeight: l,
554
+ botHintRef: v,
555
+ handleScroll: m,
556
+ bindHintHeight: h,
557
+ fetchData: a
558
+ };
559
+ }
560
+ function Q(e, o, y, l) {
561
+ const v = I(null), c = I(!1), m = I(!1), h = I(0), a = I(0), g = O(() => m.value ? e.refreshingTxt : a.value >= e.pullDistance ? e.releaseTxt : e.pullTxt);
562
+ function f() {
563
+ return !y.value || y.value.scrollTop <= 2;
564
+ }
565
+ function T() {
566
+ return e.pullRefresh && f() && !m.value;
567
+ }
568
+ function A(s) {
569
+ d(s) || (c.value = !1, e.pullRefresh && f() && (m.value || (c.value = !0, h.value = E(s), v.value = _(s), "pointerId" in s && s.currentTarget.setPointerCapture?.(s.pointerId))));
570
+ }
571
+ function r(s) {
572
+ if (!c.value || "pointerId" in s && v.value !== s.pointerId || !T()) return;
573
+ const b = E(s) - h.value;
574
+ b <= 0 || (s.preventDefault(), a.value = Math.min(b * 0.45, e.pullDistance + 30));
575
+ }
576
+ function S(s) {
577
+ c.value && ("pointerId" in s && v.value !== s.pointerId || (c.value = !1, "pointerId" in s && s.currentTarget.releasePointerCapture?.(s.pointerId), v.value = null, a.value >= e.pullDistance ? i() : a.value = 0));
578
+ }
579
+ async function i() {
580
+ if (!m.value) {
581
+ m.value = !0, e.refreshLoading && o("update:loading", !0), a.value = e.pullDistance;
582
+ try {
583
+ o("update:isError", !1), await e.refreshData?.();
584
+ } catch {
585
+ o("update:isError", !0);
586
+ } finally {
587
+ m.value = !1, await D(), await l(), e.refreshLoading && o("update:loading", !1), setTimeout(() => {
588
+ a.value = 0;
589
+ });
590
+ }
591
+ }
592
+ }
593
+ async function u() {
594
+ await D(), n(), !(!y.value || !e.pullRefresh) && C().forEach(({
595
+ name: s,
596
+ handler: p,
597
+ options: b
598
+ }) => {
599
+ y.value?.addEventListener(s, p, b);
600
+ });
601
+ }
602
+ function d(s) {
603
+ return !!s.target?.closest("[data-no-pull]");
604
+ }
605
+ function n() {
606
+ C().forEach(({
607
+ name: s,
608
+ handler: p,
609
+ options: b
610
+ }) => {
611
+ y.value?.removeEventListener(s, p, b);
612
+ });
613
+ }
614
+ function C() {
615
+ const s = A, p = r, b = S, x = [{
616
+ name: "pointerdown",
617
+ handler: s
618
+ }, {
619
+ name: "pointermove",
620
+ handler: p
621
+ }, {
622
+ name: "pointerup",
623
+ handler: b
624
+ }, {
625
+ name: "pointercancel",
626
+ handler: b
627
+ }], k = [{
628
+ name: "touchstart",
629
+ handler: s,
630
+ options: {
631
+ passive: !0
632
+ }
633
+ }, {
634
+ name: "touchmove",
635
+ handler: p,
636
+ options: {
637
+ passive: !1
638
+ }
639
+ }, {
640
+ name: "touchend",
641
+ handler: b
642
+ }, {
643
+ name: "touchcancel",
644
+ handler: b
645
+ }];
646
+ switch (e.supportMode) {
647
+ case "pc":
648
+ return x;
649
+ case "mobile":
650
+ return k;
651
+ default:
652
+ return [...x, ...k];
653
+ }
654
+ }
655
+ return {
656
+ pullY: a,
657
+ touching: c,
658
+ pullText: g,
659
+ bindLoaded: u,
660
+ unbindLoaded: n
661
+ };
662
+ }
663
+ const te = function(e, o) {
664
+ function y() {
392
665
  e?.();
393
666
  }
394
- function u() {
667
+ function l() {
395
668
  e?.();
396
669
  }
397
- const v = z({
670
+ const v = P({
398
671
  pageNo: 1,
399
672
  pageSize: 25,
400
673
  showSizePicker: !0,
@@ -402,37 +675,41 @@ const H = /* @__PURE__ */ O({
402
675
  pageSlot: 5,
403
676
  total: 0,
404
677
  layout: "total, prev, pager, next, sizes, jumper",
405
- onChange: k,
406
- onPageSizeChange: u,
678
+ onChange: y,
679
+ onPageSizeChange: l,
407
680
  setTotalSize(c) {
408
681
  v.total = c;
409
682
  },
410
- ...d
683
+ ...o
411
684
  });
412
685
  return v;
413
- }, W = {
686
+ }, ne = {
414
687
  install(e) {
415
- e.component("DynamicInput", H), e.component("DynamicCascadeInput", P);
688
+ e.component("DynamicInput", K), e.component("DynamicCascadeInput", U);
416
689
  }
417
690
  };
418
691
  export {
419
- G as Debounce,
420
- P as DynamicCascadeInput,
421
- H as DynamicInput,
422
- W as DynamicInputPlugin,
423
- J as OmitValue,
424
- Q as ensureRef,
425
- R as formatNumberInput,
426
- U as getDepthColor,
427
- X as getPadY,
428
- D as parseValue,
429
- j as resetObj,
430
- M as saferRepairColor,
431
- B as tranArr,
432
- Z as unwrapObj,
433
- ee as useDyForm,
434
- te as useObserverSize,
435
- K as usePagination,
436
- ne as useReactiveForm,
437
- ae as useWindowSize
692
+ re as Debounce,
693
+ U as DynamicCascadeInput,
694
+ K as DynamicInput,
695
+ ne as DynamicInputPlugin,
696
+ ee as LoadedScroll,
697
+ ue as OmitValue,
698
+ oe as ensureRef,
699
+ V as formatNumberInput,
700
+ E as getClientY,
701
+ ie as getDepthColor,
702
+ _ as getEventId,
703
+ q as getMarginY,
704
+ se as getPadY,
705
+ z as parseValue,
706
+ H as resetObj,
707
+ Y as saferRepairColor,
708
+ F as tranArr,
709
+ ce as unwrapObj,
710
+ de as useDyForm,
711
+ fe as useObserverSize,
712
+ te as usePagination,
713
+ ve as useReactiveForm,
714
+ me as useWindowSize
438
715
  };