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/README.md +173 -2
- package/dist/elementPlus/EleZealCard.d.ts +9 -0
- package/dist/elementPlus/EleZealTableTool.d.ts +99 -8
- package/dist/elementPlus/hooks/useZealTool.d.ts +7 -0
- package/dist/elementPlus/index.cjs +1 -1
- package/dist/elementPlus/index.d.ts +6 -4
- package/dist/elementPlus/index.mjs +599 -485
- package/dist/hooks/useTool.d.ts +1 -1
- package/dist/index-BAqRAwDC.cjs +1 -0
- package/dist/index-Bsj3F9SM.js +213 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +495 -191
- package/dist/naiveUi/NaiZealCard.d.ts +9 -0
- package/dist/naiveUi/NaiZealTableTool.d.ts +54 -1
- package/dist/naiveUi/hooks/useZealTool.d.ts +7 -0
- package/dist/naiveUi/index.cjs +1 -1
- package/dist/naiveUi/index.d.ts +6 -4
- package/dist/naiveUi/index.mjs +469 -368
- package/dist/origin/LoadedScroll.d.ts +189 -0
- package/dist/types/index.d.ts +21 -1
- package/dist/types/slots.d.ts +8 -5
- package/dist/utils/tools.d.ts +5 -2
- package/dist/vite-env.d.ts +6 -0
- package/package.json +2 -1
- package/dist/index-BRJXkpNJ.cjs +0 -1
- package/dist/index-a2ON2stt.js +0 -180
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { t as
|
|
3
|
-
import { D as
|
|
4
|
-
const
|
|
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,
|
|
37
|
+
onMerge: (e, o) => !0
|
|
38
38
|
},
|
|
39
39
|
slots: Object,
|
|
40
40
|
setup(e, {
|
|
41
|
-
emit:
|
|
42
|
-
expose:
|
|
41
|
+
emit: o,
|
|
42
|
+
expose: h,
|
|
43
43
|
slots: u
|
|
44
44
|
}) {
|
|
45
|
-
const
|
|
45
|
+
const d = {
|
|
46
46
|
resetTxt: "重置",
|
|
47
47
|
newTxt: "添加项",
|
|
48
48
|
mergeTxt: "合并",
|
|
49
49
|
...e.btnConfigs
|
|
50
|
-
},
|
|
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
|
-
},
|
|
62
|
-
|
|
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
|
|
65
|
-
|
|
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
|
-
}),
|
|
69
|
-
onSet: (
|
|
70
|
-
r.value =
|
|
68
|
+
}), h({
|
|
69
|
+
onSet: (l) => {
|
|
70
|
+
r.value = D(l ?? e.modelValue, e.randomFun, m.arraySplitSymbol);
|
|
71
71
|
},
|
|
72
|
-
getResult: (
|
|
72
|
+
getResult: (l = "res") => l === "ori" ? L(r.value) : R(r.value, m.arraySplitSymbol)
|
|
73
73
|
});
|
|
74
|
-
const
|
|
74
|
+
const f = () => r.value.push({
|
|
75
75
|
rId: e.randomFun(),
|
|
76
76
|
key: "",
|
|
77
77
|
value: ""
|
|
78
|
-
}),
|
|
79
|
-
r.value =
|
|
80
|
-
},
|
|
81
|
-
r.value.sort((
|
|
82
|
-
const
|
|
83
|
-
|
|
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 ${
|
|
86
|
+
class: `dynamicForm ${g} ${e.dyCls}`
|
|
87
87
|
}, [n("div", {
|
|
88
88
|
class: `dyFormList ${r.value.length ? "" : "noList"}`,
|
|
89
|
-
ref:
|
|
89
|
+
ref: b,
|
|
90
90
|
style: {
|
|
91
|
-
maxHeight:
|
|
91
|
+
maxHeight: i.maxHeight
|
|
92
92
|
}
|
|
93
|
-
}, [r.value.map((
|
|
94
|
-
const
|
|
95
|
-
row:
|
|
96
|
-
index:
|
|
97
|
-
isLast:
|
|
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
|
-
}),
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
top:
|
|
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((
|
|
112
|
+
r.value = r.value.filter((v) => v.rId !== l.rId);
|
|
113
113
|
},
|
|
114
|
-
toggleArray: () =>
|
|
115
|
-
toggleNumber: () =>
|
|
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:
|
|
119
|
+
key: l.rId
|
|
120
120
|
}, [n("div", {
|
|
121
121
|
class: "input"
|
|
122
122
|
}, [n("input", {
|
|
123
|
-
size:
|
|
124
|
-
value:
|
|
123
|
+
size: g,
|
|
124
|
+
value: l.key,
|
|
125
125
|
class: "key nativeInput",
|
|
126
|
-
onInput: (
|
|
127
|
-
|
|
126
|
+
onInput: (v) => {
|
|
127
|
+
l.key = v.target.value;
|
|
128
128
|
}
|
|
129
|
-
}, null),
|
|
129
|
+
}, null), k(":"), n("div", {
|
|
130
130
|
class: "vInput"
|
|
131
131
|
}, [n("div", {
|
|
132
132
|
class: "slot"
|
|
133
|
-
}, [u.typeTools ? u.typeTools(
|
|
134
|
-
class: [
|
|
135
|
-
onClick:
|
|
136
|
-
}, [
|
|
137
|
-
class: [
|
|
138
|
-
onClick:
|
|
139
|
-
}, [
|
|
140
|
-
size:
|
|
141
|
-
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: (
|
|
144
|
-
const t =
|
|
145
|
-
|
|
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(
|
|
150
|
-
class: [
|
|
151
|
-
disabled: !
|
|
152
|
-
onClick:
|
|
153
|
-
}, [
|
|
154
|
-
class: ["danger",
|
|
155
|
-
onClick:
|
|
156
|
-
}, [
|
|
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:
|
|
160
|
+
newItem: f
|
|
161
161
|
}) : n("button", {
|
|
162
|
-
class: ["success",
|
|
163
|
-
onClick:
|
|
164
|
-
}, [
|
|
165
|
-
reset:
|
|
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",
|
|
168
|
-
onClick:
|
|
169
|
-
}, [
|
|
170
|
-
merge:
|
|
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",
|
|
173
|
-
onClick:
|
|
174
|
-
}, [
|
|
172
|
+
class: ["info", g, "bt"],
|
|
173
|
+
onClick: y
|
|
174
|
+
}, [d.mergeTxt])])])]);
|
|
175
175
|
}
|
|
176
|
-
}),
|
|
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,
|
|
215
|
+
onMerge: (e, o) => !0
|
|
216
216
|
},
|
|
217
217
|
slots: Object,
|
|
218
218
|
setup(e, {
|
|
219
|
-
emit:
|
|
220
|
-
expose:
|
|
219
|
+
emit: o,
|
|
220
|
+
expose: h,
|
|
221
221
|
slots: u
|
|
222
222
|
}) {
|
|
223
|
-
const
|
|
223
|
+
const d = {
|
|
224
224
|
resetTxt: "重置",
|
|
225
225
|
newTxt: "添加项",
|
|
226
226
|
mergeTxt: "合并",
|
|
227
227
|
...e.btnConfigs
|
|
228
|
-
},
|
|
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
|
-
},
|
|
243
|
-
let t = s
|
|
244
|
-
const
|
|
245
|
-
return
|
|
246
|
-
rId: e.randomFun(
|
|
247
|
-
key:
|
|
248
|
-
value: Object.prototype.toString.call(t) === "[object Object]" ? r(s
|
|
249
|
-
isArray:
|
|
250
|
-
isNumber:
|
|
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
|
-
}),
|
|
253
|
-
const t =
|
|
254
|
-
return
|
|
255
|
-
}, {}),
|
|
256
|
-
class: [`depth-${
|
|
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":
|
|
259
|
-
["--c" + [
|
|
258
|
+
"--depth": s,
|
|
259
|
+
["--c" + [s]]: Y(i.borderColors, s)
|
|
260
260
|
}
|
|
261
|
-
}, [
|
|
262
|
-
const
|
|
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:
|
|
265
|
-
isLast:
|
|
264
|
+
index: C,
|
|
265
|
+
isLast: C === a.length - 1,
|
|
266
266
|
addItem: () => {
|
|
267
|
-
|
|
267
|
+
c.push({
|
|
268
268
|
rId: e.randomFun(),
|
|
269
269
|
key: "",
|
|
270
270
|
value: ""
|
|
271
271
|
});
|
|
272
272
|
},
|
|
273
273
|
addChild: () => {
|
|
274
|
-
|
|
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 (
|
|
282
|
-
if (
|
|
283
|
-
const
|
|
284
|
-
|
|
285
|
-
...
|
|
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
|
-
}) :
|
|
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:
|
|
297
|
+
marginLeft: s > 1 ? `${s * i.retractLen}px` : "0"
|
|
298
298
|
}
|
|
299
299
|
}, [n("div", {
|
|
300
300
|
class: "input"
|
|
301
|
-
}, [!
|
|
301
|
+
}, [!S && n(B, null, [n("input", {
|
|
302
302
|
value: t.key,
|
|
303
303
|
class: "key nativeInput",
|
|
304
|
-
onInput: (
|
|
305
|
-
}, null),
|
|
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(
|
|
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:
|
|
312
|
-
}, [
|
|
311
|
+
onClick: w.toggleArray
|
|
312
|
+
}, [k("Array")]), !i.hideNumberBtn && n("button", {
|
|
313
313
|
class: [t.isNumber ? "success" : "default", "small", "bt"],
|
|
314
|
-
onClick:
|
|
315
|
-
}, [
|
|
316
|
-
class: `value nativeV ${
|
|
317
|
-
value:
|
|
318
|
-
onInput: (
|
|
319
|
-
const
|
|
320
|
-
if (
|
|
321
|
-
t.key =
|
|
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
|
-
|
|
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
|
-
}, [
|
|
328
|
+
}, [s < e.depth ? !S && (u.newChild ? u.newChild(w) : n("button", {
|
|
329
329
|
class: ["success", "bt"],
|
|
330
|
-
onClick:
|
|
330
|
+
onClick: w.addChild
|
|
331
331
|
}, [e.newChildTxt(t)])) : null])])]), n("div", {
|
|
332
332
|
class: "btn"
|
|
333
|
-
}, [u.rowActions ? u.rowActions(
|
|
333
|
+
}, [u.rowActions ? u.rowActions(w) : n(B, null, [n("button", {
|
|
334
334
|
class: ["success", "bt"],
|
|
335
|
-
disabled: !
|
|
336
|
-
onClick:
|
|
337
|
-
}, [
|
|
335
|
+
disabled: !w.isLast,
|
|
336
|
+
onClick: w.addItem
|
|
337
|
+
}, [k("+")]), n("button", {
|
|
338
338
|
class: ["danger", "bt"],
|
|
339
|
-
onClick:
|
|
340
|
-
}, [
|
|
339
|
+
onClick: w.removeItem
|
|
340
|
+
}, [k("-")])])]), Array.isArray(t.value) && T(t.value, s + 1, t)]);
|
|
341
341
|
})]);
|
|
342
|
-
|
|
342
|
+
j(f, (c) => {
|
|
343
343
|
if (!e.isController) return;
|
|
344
|
-
const
|
|
345
|
-
|
|
344
|
+
const s = b(c);
|
|
345
|
+
o("update:modelValue", s), o("onMerge", s, L(f.value));
|
|
346
346
|
}, {
|
|
347
347
|
deep: !0
|
|
348
|
-
}),
|
|
349
|
-
onSet: (
|
|
350
|
-
|
|
348
|
+
}), h({
|
|
349
|
+
onSet: (c) => {
|
|
350
|
+
f.value = r(c ?? e.modelValue);
|
|
351
351
|
},
|
|
352
|
-
getResult: (
|
|
352
|
+
getResult: (c = "res") => c === "ori" ? L(f.value) : b(f.value)
|
|
353
353
|
});
|
|
354
|
-
const
|
|
354
|
+
const y = () => f.value.push({
|
|
355
355
|
rId: e.randomFun(),
|
|
356
356
|
key: "",
|
|
357
357
|
value: ""
|
|
358
|
-
}),
|
|
359
|
-
|
|
360
|
-
},
|
|
361
|
-
const
|
|
362
|
-
|
|
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 ${
|
|
367
|
+
class: `dyFormList ${f.value.length ? "" : "noObj"}`,
|
|
368
368
|
style: {
|
|
369
|
-
maxHeight:
|
|
369
|
+
maxHeight: i.maxHeight
|
|
370
370
|
}
|
|
371
|
-
}, [
|
|
372
|
-
class: `control ${
|
|
373
|
-
}, [!
|
|
374
|
-
newItem:
|
|
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:
|
|
378
|
-
}, [
|
|
379
|
-
reset:
|
|
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:
|
|
383
|
-
}, [
|
|
384
|
-
merge:
|
|
382
|
+
onClick: l
|
|
383
|
+
}, [d.resetTxt])), u.mergeBtn ? u.mergeBtn({
|
|
384
|
+
merge: x
|
|
385
385
|
}) : n("button", {
|
|
386
386
|
class: ["info", "bt"],
|
|
387
|
-
onClick:
|
|
388
|
-
}, [
|
|
387
|
+
onClick: x
|
|
388
|
+
}, [d.mergeTxt])])])]);
|
|
389
389
|
}
|
|
390
|
-
}),
|
|
391
|
-
|
|
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
|
|
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:
|
|
705
|
+
onChange: h,
|
|
406
706
|
onPageSizeChange: u,
|
|
407
|
-
setTotalSize(
|
|
408
|
-
|
|
707
|
+
setTotalSize(i) {
|
|
708
|
+
d.total = i;
|
|
409
709
|
},
|
|
410
|
-
...
|
|
710
|
+
...o
|
|
411
711
|
});
|
|
412
|
-
return
|
|
413
|
-
},
|
|
712
|
+
return d;
|
|
713
|
+
}, te = {
|
|
414
714
|
install(e) {
|
|
415
|
-
e.component("DynamicInput",
|
|
715
|
+
e.component("DynamicInput", _), e.component("DynamicCascadeInput", K);
|
|
416
716
|
}
|
|
417
717
|
};
|
|
418
718
|
export {
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
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
|
};
|