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/README.md +173 -2
- package/dist/elementPlus/EleZealCard.d.ts +9 -0
- package/dist/elementPlus/EleZealTableTool.d.ts +90 -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 +473 -371
- package/dist/hooks/useTool.d.ts +1 -1
- package/dist/index-BAqRAwDC.cjs +1 -0
- package/dist/index-BQKYL550.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 +493 -216
- 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 +432 -337
- package/dist/origin/LoadedScroll.d.ts +180 -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 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,
|
|
37
|
+
onMerge: (e, o) => !0
|
|
38
38
|
},
|
|
39
39
|
slots: Object,
|
|
40
40
|
setup(e, {
|
|
41
|
-
emit:
|
|
42
|
-
expose:
|
|
43
|
-
slots:
|
|
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
|
-
},
|
|
62
|
-
|
|
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
|
|
65
|
-
|
|
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
|
-
}),
|
|
69
|
-
onSet: (
|
|
70
|
-
|
|
68
|
+
}), y({
|
|
69
|
+
onSet: (r) => {
|
|
70
|
+
a.value = F(r ?? e.modelValue, e.randomFun, m.arraySplitSymbol);
|
|
71
71
|
},
|
|
72
|
-
getResult: (
|
|
72
|
+
getResult: (r = "res") => r === "ori" ? L(a.value) : H(a.value, m.arraySplitSymbol)
|
|
73
73
|
});
|
|
74
|
-
const
|
|
74
|
+
const f = () => a.value.push({
|
|
75
75
|
rId: e.randomFun(),
|
|
76
76
|
key: "",
|
|
77
77
|
value: ""
|
|
78
|
-
}),
|
|
79
|
-
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
|
|
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 () =>
|
|
86
|
-
class: `dynamicForm ${
|
|
87
|
-
}, [
|
|
88
|
-
class: `dyFormList ${
|
|
89
|
-
ref:
|
|
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
|
-
}, [
|
|
94
|
-
const
|
|
95
|
-
row:
|
|
96
|
-
index:
|
|
97
|
-
isLast:
|
|
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
|
-
|
|
99
|
+
a.value.push({
|
|
100
100
|
rId: e.randomFun(),
|
|
101
101
|
key: "",
|
|
102
102
|
value: ""
|
|
103
|
-
}), c.autoScroll &&
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
top:
|
|
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
|
-
|
|
112
|
+
a.value = a.value.filter((d) => d.rId !== r.rId);
|
|
113
113
|
},
|
|
114
|
-
toggleArray: () =>
|
|
115
|
-
toggleNumber: () =>
|
|
114
|
+
toggleArray: () => r.isArray = !r.isArray,
|
|
115
|
+
toggleNumber: () => r.isNumber = !r.isNumber
|
|
116
116
|
};
|
|
117
|
-
return
|
|
117
|
+
return t("div", {
|
|
118
118
|
class: "dItem",
|
|
119
|
-
key:
|
|
120
|
-
}, [
|
|
119
|
+
key: r.rId
|
|
120
|
+
}, [t("div", {
|
|
121
121
|
class: "input"
|
|
122
|
-
}, [
|
|
123
|
-
size:
|
|
124
|
-
value:
|
|
122
|
+
}, [t("input", {
|
|
123
|
+
size: h,
|
|
124
|
+
value: r.key,
|
|
125
125
|
class: "key nativeInput",
|
|
126
|
-
onInput: (
|
|
127
|
-
|
|
126
|
+
onInput: (d) => {
|
|
127
|
+
r.key = d.target.value;
|
|
128
128
|
}
|
|
129
|
-
}, null),
|
|
129
|
+
}, null), w(":"), t("div", {
|
|
130
130
|
class: "vInput"
|
|
131
|
-
}, [
|
|
131
|
+
}, [t("div", {
|
|
132
132
|
class: "slot"
|
|
133
|
-
}, [
|
|
134
|
-
class: [
|
|
135
|
-
onClick:
|
|
136
|
-
}, [
|
|
137
|
-
class: [
|
|
138
|
-
onClick:
|
|
139
|
-
}, [
|
|
140
|
-
size:
|
|
141
|
-
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: (
|
|
144
|
-
const
|
|
145
|
-
c.allowFilter &&
|
|
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)])]),
|
|
147
|
+
}, null)])]), t("div", {
|
|
148
148
|
class: "btn"
|
|
149
|
-
}, [
|
|
150
|
-
class: [
|
|
151
|
-
disabled: !
|
|
152
|
-
onClick:
|
|
153
|
-
}, [
|
|
154
|
-
class: ["danger",
|
|
155
|
-
onClick:
|
|
156
|
-
}, [
|
|
157
|
-
})]),
|
|
158
|
-
class: `control ${
|
|
159
|
-
}, [!
|
|
160
|
-
newItem:
|
|
161
|
-
}) :
|
|
162
|
-
class: ["success",
|
|
163
|
-
onClick:
|
|
164
|
-
}, [v.newTxt])), !e.isController &&
|
|
165
|
-
reset:
|
|
166
|
-
}) :
|
|
167
|
-
class: ["default",
|
|
168
|
-
onClick:
|
|
169
|
-
}, [v.resetTxt])),
|
|
170
|
-
merge:
|
|
171
|
-
}) :
|
|
172
|
-
class: ["info",
|
|
173
|
-
onClick:
|
|
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
|
-
}),
|
|
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,
|
|
215
|
+
onMerge: (e, o) => !0
|
|
216
216
|
},
|
|
217
217
|
slots: Object,
|
|
218
218
|
setup(e, {
|
|
219
|
-
emit:
|
|
220
|
-
expose:
|
|
221
|
-
slots:
|
|
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
|
-
},
|
|
243
|
-
let
|
|
244
|
-
const
|
|
245
|
-
return
|
|
246
|
-
rId: e.randomFun(
|
|
247
|
-
key:
|
|
248
|
-
value: Object.prototype.toString.call(
|
|
249
|
-
isArray:
|
|
250
|
-
isNumber:
|
|
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
|
-
}),
|
|
253
|
-
const
|
|
254
|
-
return
|
|
255
|
-
}, {}),
|
|
256
|
-
class: [`depth-${
|
|
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":
|
|
259
|
-
["--c" + [
|
|
258
|
+
"--depth": u,
|
|
259
|
+
["--c" + [u]]: Y(c.borderColors, u)
|
|
260
260
|
}
|
|
261
|
-
}, [
|
|
262
|
-
const
|
|
263
|
-
row:
|
|
264
|
-
index:
|
|
265
|
-
isLast:
|
|
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
|
-
|
|
267
|
+
i.push({
|
|
268
268
|
rId: e.randomFun(),
|
|
269
269
|
key: "",
|
|
270
270
|
value: ""
|
|
271
271
|
});
|
|
272
272
|
},
|
|
273
273
|
addChild: () => {
|
|
274
|
-
|
|
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 (
|
|
282
|
-
if (
|
|
283
|
-
const
|
|
284
|
-
|
|
285
|
-
...
|
|
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
|
-
}) :
|
|
287
|
+
}) : d.value = "";
|
|
288
288
|
}
|
|
289
289
|
},
|
|
290
|
-
toggleArray: () =>
|
|
291
|
-
toggleNumber: () =>
|
|
290
|
+
toggleArray: () => n.isArray = !n.isArray,
|
|
291
|
+
toggleNumber: () => n.isNumber = !n.isNumber
|
|
292
292
|
};
|
|
293
|
-
return
|
|
293
|
+
return t("div", {
|
|
294
294
|
class: "dItem",
|
|
295
|
-
key:
|
|
295
|
+
key: n.rId,
|
|
296
296
|
style: {
|
|
297
|
-
marginLeft:
|
|
297
|
+
marginLeft: u > 1 ? `${u * c.retractLen}px` : "0"
|
|
298
298
|
}
|
|
299
|
-
}, [
|
|
299
|
+
}, [t("div", {
|
|
300
300
|
class: "input"
|
|
301
|
-
}, [!
|
|
302
|
-
value:
|
|
301
|
+
}, [!p && t(B, null, [t("input", {
|
|
302
|
+
value: n.key,
|
|
303
303
|
class: "key nativeInput",
|
|
304
|
-
onInput: (
|
|
305
|
-
}, null),
|
|
304
|
+
onInput: (k) => n.key = k.target.value
|
|
305
|
+
}, null), w(":")]), t("div", {
|
|
306
306
|
class: "vInput"
|
|
307
|
-
}, [
|
|
307
|
+
}, [t("div", {
|
|
308
308
|
class: "slot"
|
|
309
|
-
}, [Array.isArray(
|
|
310
|
-
class: [
|
|
311
|
-
onClick:
|
|
312
|
-
}, [
|
|
313
|
-
class: [
|
|
314
|
-
onClick:
|
|
315
|
-
}, [
|
|
316
|
-
class: `value nativeV ${
|
|
317
|
-
value:
|
|
318
|
-
onInput: (
|
|
319
|
-
const
|
|
320
|
-
if (
|
|
321
|
-
|
|
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 &&
|
|
324
|
+
c.allowFilter && n.isNumber ? n.value = V(N, n.isArray, m.arraySplitSymbol) : n.value = N;
|
|
325
325
|
}
|
|
326
|
-
}, null),
|
|
326
|
+
}, null), t("div", {
|
|
327
327
|
class: "surSlot"
|
|
328
|
-
}, [
|
|
328
|
+
}, [u < e.depth ? !p && (l.newChild ? l.newChild(x) : t("button", {
|
|
329
329
|
class: ["success", "bt"],
|
|
330
|
-
onClick:
|
|
331
|
-
}, [e.newChildTxt(
|
|
330
|
+
onClick: x.addChild
|
|
331
|
+
}, [e.newChildTxt(n)])) : null])])]), t("div", {
|
|
332
332
|
class: "btn"
|
|
333
|
-
}, [
|
|
333
|
+
}, [l.rowActions ? l.rowActions(x) : t(B, null, [t("button", {
|
|
334
334
|
class: ["success", "bt"],
|
|
335
|
-
disabled: !
|
|
336
|
-
onClick:
|
|
337
|
-
}, [
|
|
335
|
+
disabled: !x.isLast,
|
|
336
|
+
onClick: x.addItem
|
|
337
|
+
}, [w("+")]), t("button", {
|
|
338
338
|
class: ["danger", "bt"],
|
|
339
|
-
onClick:
|
|
340
|
-
}, [
|
|
339
|
+
onClick: x.removeItem
|
|
340
|
+
}, [w("-")])])]), Array.isArray(n.value) && T(n.value, u + 1, n)]);
|
|
341
341
|
})]);
|
|
342
|
-
|
|
342
|
+
j(f, (i) => {
|
|
343
343
|
if (!e.isController) return;
|
|
344
|
-
const
|
|
345
|
-
|
|
344
|
+
const u = g(i);
|
|
345
|
+
o("update:modelValue", u), o("onMerge", u, L(f.value));
|
|
346
346
|
}, {
|
|
347
347
|
deep: !0
|
|
348
|
-
}),
|
|
349
|
-
onSet: (
|
|
350
|
-
|
|
348
|
+
}), y({
|
|
349
|
+
onSet: (i) => {
|
|
350
|
+
f.value = a(i ?? e.modelValue);
|
|
351
351
|
},
|
|
352
|
-
getResult: (
|
|
352
|
+
getResult: (i = "res") => i === "ori" ? L(f.value) : g(f.value)
|
|
353
353
|
});
|
|
354
|
-
const
|
|
354
|
+
const A = () => f.value.push({
|
|
355
355
|
rId: e.randomFun(),
|
|
356
356
|
key: "",
|
|
357
357
|
value: ""
|
|
358
|
-
}),
|
|
359
|
-
|
|
360
|
-
},
|
|
361
|
-
const
|
|
362
|
-
|
|
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 () =>
|
|
364
|
+
return () => t("div", {
|
|
365
365
|
class: `dynamicCascadeForm ${e.dyCls}`
|
|
366
|
-
}, [
|
|
367
|
-
class: `dyFormList ${
|
|
366
|
+
}, [t("div", {
|
|
367
|
+
class: `dyFormList ${f.value.length ? "" : "noObj"}`,
|
|
368
368
|
style: {
|
|
369
369
|
maxHeight: c.maxHeight
|
|
370
370
|
}
|
|
371
|
-
}, [
|
|
372
|
-
class: `control ${
|
|
373
|
-
}, [!
|
|
374
|
-
newItem:
|
|
375
|
-
}) :
|
|
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:
|
|
378
|
-
}, [v.newTxt])), !e.isController &&
|
|
379
|
-
reset:
|
|
380
|
-
}) :
|
|
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:
|
|
383
|
-
}, [v.resetTxt])),
|
|
384
|
-
merge:
|
|
385
|
-
}) :
|
|
382
|
+
onClick: r
|
|
383
|
+
}, [v.resetTxt])), l.mergeBtn ? l.mergeBtn({
|
|
384
|
+
merge: S
|
|
385
|
+
}) : t("button", {
|
|
386
386
|
class: ["info", "bt"],
|
|
387
|
-
onClick:
|
|
387
|
+
onClick: S
|
|
388
388
|
}, [v.mergeTxt])])])]);
|
|
389
389
|
}
|
|
390
|
-
}),
|
|
391
|
-
|
|
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
|
|
667
|
+
function l() {
|
|
395
668
|
e?.();
|
|
396
669
|
}
|
|
397
|
-
const v =
|
|
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:
|
|
406
|
-
onPageSizeChange:
|
|
678
|
+
onChange: y,
|
|
679
|
+
onPageSizeChange: l,
|
|
407
680
|
setTotalSize(c) {
|
|
408
681
|
v.total = c;
|
|
409
682
|
},
|
|
410
|
-
...
|
|
683
|
+
...o
|
|
411
684
|
});
|
|
412
685
|
return v;
|
|
413
|
-
},
|
|
686
|
+
}, ne = {
|
|
414
687
|
install(e) {
|
|
415
|
-
e.component("DynamicInput",
|
|
688
|
+
e.component("DynamicInput", K), e.component("DynamicCascadeInput", U);
|
|
416
689
|
}
|
|
417
690
|
};
|
|
418
691
|
export {
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
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
|
};
|