dynamicformdjx 0.5.0 → 0.6.2

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