vft 0.0.342 → 0.0.343
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/es/components/button/index.d.ts +9 -9
- package/es/components/form/form-item.vue.d.ts +1 -1
- package/es/components/form/index.d.ts +30 -30
- package/es/components/popconfirm/index.d.ts +15 -15
- package/es/components/popconfirm/popconfirm.vue.d.ts +1 -1
- package/es/components/super-form/index.d.ts +3 -3
- package/es/components/super-form/super-form.vue.d.ts +1 -1
- package/es/components/super-form/use/use-form-events.d.ts +1 -1
- package/es/components/super-form/use/use-form-events.js +143 -137
- package/es/package.json.d.ts +1 -1
- package/es/package.json.js +1 -1
- package/lib/components/button/index.d.ts +9 -9
- package/lib/components/form/form-item.vue.d.ts +1 -1
- package/lib/components/form/index.d.ts +30 -30
- package/lib/components/popconfirm/index.d.ts +15 -15
- package/lib/components/popconfirm/popconfirm.vue.d.ts +1 -1
- package/lib/components/super-form/index.d.ts +3 -3
- package/lib/components/super-form/super-form.vue.d.ts +1 -1
- package/lib/components/super-form/use/use-form-events.cjs +1 -1
- package/lib/components/super-form/use/use-form-events.d.ts +1 -1
- package/lib/package.json.cjs +1 -1
- package/lib/package.json.d.ts +1 -1
- package/package.json +3 -3
- package/web-types.json +1 -1
|
@@ -1,231 +1,237 @@
|
|
|
1
|
-
import { isDef as
|
|
2
|
-
import { formatToDate as
|
|
3
|
-
import { get as
|
|
4
|
-
import { unref as n, toRaw as
|
|
5
|
-
import { isInput as
|
|
1
|
+
import { isDef as H, isFunction as m, isString as A, isObject as E, isArray as V, deepMerge as it, findDifferentValuesForObj as nt, isNullOrUndefined as J, isEmpty as lt, isEmptyObject as st } from "@vft/utils";
|
|
2
|
+
import { formatToDate as P } from "@vft/utils/date";
|
|
3
|
+
import { get as rt, cloneDeep as I, uniqBy as ot, isEqual as at, set as W } from "lodash-es";
|
|
4
|
+
import { unref as n, toRaw as x, nextTick as Q } from "vue";
|
|
5
|
+
import { isInput as ft, FormCompEnum as S, isDatePicker as ct } from "../component-map.js";
|
|
6
6
|
import { handleInputNumberValue as ut } from "./helper.js";
|
|
7
|
-
function
|
|
8
|
-
const { show:
|
|
9
|
-
let p = !0,
|
|
10
|
-
return typeof
|
|
7
|
+
function _(h, v) {
|
|
8
|
+
const { show: o, ifShow: f } = h;
|
|
9
|
+
let p = !0, c = !0;
|
|
10
|
+
return typeof o == "boolean" ? p = o : typeof o == "function" && (p = o({
|
|
11
11
|
field: h.field,
|
|
12
|
-
model:
|
|
12
|
+
model: v,
|
|
13
13
|
values: {
|
|
14
|
-
...
|
|
14
|
+
...v
|
|
15
15
|
},
|
|
16
16
|
schema: h
|
|
17
|
-
})), typeof f == "boolean" ?
|
|
17
|
+
})), typeof f == "boolean" ? c = f : typeof f == "function" && (c = f({
|
|
18
18
|
field: h.field,
|
|
19
|
-
model:
|
|
19
|
+
model: v,
|
|
20
20
|
values: {
|
|
21
|
-
...
|
|
21
|
+
...v
|
|
22
22
|
},
|
|
23
23
|
schema: h
|
|
24
|
-
})), p &&
|
|
24
|
+
})), p && c;
|
|
25
25
|
}
|
|
26
|
-
function dt(h,
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
-
const f = h.match(
|
|
26
|
+
function dt(h, v = {}) {
|
|
27
|
+
const o = /^\[(.+)\]$/;
|
|
28
|
+
if (o.test(h)) {
|
|
29
|
+
const f = h.match(o);
|
|
30
30
|
if (f && f[1]) {
|
|
31
31
|
const p = f[1].split(",");
|
|
32
32
|
if (!p.length)
|
|
33
33
|
return;
|
|
34
|
-
const
|
|
35
|
-
return p.forEach((
|
|
36
|
-
W(
|
|
37
|
-
}),
|
|
34
|
+
const c = [];
|
|
35
|
+
return p.forEach((y, B) => {
|
|
36
|
+
W(c, B, v[y.trim()]);
|
|
37
|
+
}), c.filter(Boolean).length ? c : void 0;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
function ht(h,
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
const f = h.match(
|
|
41
|
+
function ht(h, v = {}) {
|
|
42
|
+
const o = /^\{(.+)\}$/;
|
|
43
|
+
if (o.test(h)) {
|
|
44
|
+
const f = h.match(o);
|
|
45
45
|
if (f && f[1]) {
|
|
46
46
|
const p = f[1].split(",");
|
|
47
47
|
if (!p.length)
|
|
48
48
|
return;
|
|
49
|
-
const
|
|
50
|
-
return p.forEach((
|
|
51
|
-
W(
|
|
52
|
-
}), Object.values(
|
|
49
|
+
const c = {};
|
|
50
|
+
return p.forEach((y) => {
|
|
51
|
+
W(c, y.trim(), v[y.trim()]);
|
|
52
|
+
}), Object.values(c).filter(Boolean).length ? c : void 0;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function wt({
|
|
57
57
|
emit: h,
|
|
58
|
-
getProps:
|
|
59
|
-
formModel:
|
|
58
|
+
getProps: v,
|
|
59
|
+
formModel: o,
|
|
60
60
|
getSchema: f,
|
|
61
61
|
defaultValueRef: p,
|
|
62
|
-
formElRef:
|
|
63
|
-
schemaRef:
|
|
64
|
-
handleFormValues:
|
|
65
|
-
initValues:
|
|
62
|
+
formElRef: c,
|
|
63
|
+
schemaRef: y,
|
|
64
|
+
handleFormValues: B,
|
|
65
|
+
initValues: T
|
|
66
66
|
}) {
|
|
67
67
|
async function X(t) {
|
|
68
|
-
const { resetFunc: i, submitOnReset:
|
|
69
|
-
i &&
|
|
70
|
-
const
|
|
71
|
-
if (
|
|
68
|
+
const { resetFunc: i, submitOnReset: s } = n(v);
|
|
69
|
+
i && m(i) && await i();
|
|
70
|
+
const l = n(c);
|
|
71
|
+
if (l) {
|
|
72
72
|
if (t?.length)
|
|
73
|
-
return
|
|
74
|
-
Object.keys(
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
}),
|
|
73
|
+
return l.resetFields(t);
|
|
74
|
+
Object.keys(o).forEach((a) => {
|
|
75
|
+
const r = n(f).find((u) => u.field === a), e = I(p.value[a]);
|
|
76
|
+
o[a] = ft(r?.type) ? e || "" : e;
|
|
77
|
+
}), Q(() => C()), h("reset", x(o)), s && await U();
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
async function
|
|
81
|
-
const
|
|
82
|
-
(e) => String(e).indexOf(
|
|
83
|
-
),
|
|
84
|
-
|
|
80
|
+
async function q(t, i = !0) {
|
|
81
|
+
const s = n(f).map((e) => e.field).filter(Boolean), l = ".", a = s.filter(
|
|
82
|
+
(e) => String(e).indexOf(l) >= 0
|
|
83
|
+
), r = [];
|
|
84
|
+
s.forEach((e) => {
|
|
85
85
|
const u = n(f).find((d) => d.field === e);
|
|
86
|
-
let b =
|
|
87
|
-
const
|
|
86
|
+
let b = rt(t, e);
|
|
87
|
+
const j = Reflect.has(t, e);
|
|
88
88
|
b = ut(u?.type, b);
|
|
89
|
-
const { componentProps:
|
|
90
|
-
let
|
|
91
|
-
typeof
|
|
92
|
-
const
|
|
93
|
-
if (
|
|
94
|
-
const d =
|
|
89
|
+
const { componentProps: z } = u || {};
|
|
90
|
+
let D = z;
|
|
91
|
+
typeof z == "function" && (D = D({ formModel: n(o) }));
|
|
92
|
+
const G = dt(e, t) || ht(e, t);
|
|
93
|
+
if (j || G) {
|
|
94
|
+
const d = G || b;
|
|
95
95
|
if (M(e))
|
|
96
96
|
if (Array.isArray(d)) {
|
|
97
97
|
const F = [];
|
|
98
|
-
for (const
|
|
99
|
-
F.push(
|
|
100
|
-
n(
|
|
98
|
+
for (const w of d)
|
|
99
|
+
F.push(w ? P(w) : null);
|
|
100
|
+
n(o)[e] = F;
|
|
101
101
|
} else
|
|
102
|
-
n(
|
|
102
|
+
n(o)[e] = d ? D?.valueFormat ? d : P(d) : null;
|
|
103
103
|
else
|
|
104
|
-
n(
|
|
105
|
-
|
|
104
|
+
n(o)[e] = d;
|
|
105
|
+
D?.onChange && D?.onChange(d), r.push(e);
|
|
106
106
|
} else
|
|
107
|
-
|
|
107
|
+
a.forEach((d) => {
|
|
108
108
|
try {
|
|
109
|
-
const F = d.split(".").reduce((
|
|
110
|
-
|
|
109
|
+
const F = d.split(".").reduce((w, et) => w[et], t);
|
|
110
|
+
H(F) && (n(o)[d] = n(F), r.push(d));
|
|
111
111
|
} catch {
|
|
112
|
-
|
|
112
|
+
H(p.value[d]) && (n(o)[d] = I(
|
|
113
113
|
n(p.value[d])
|
|
114
114
|
));
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
|
-
}), i &&
|
|
118
|
-
await
|
|
117
|
+
}), i && Q(async () => {
|
|
118
|
+
await N(r).catch((e) => {
|
|
119
119
|
});
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
async function Y(t) {
|
|
123
|
-
const i =
|
|
123
|
+
const i = I(n(f));
|
|
124
124
|
if (!t)
|
|
125
125
|
return;
|
|
126
|
-
let
|
|
127
|
-
A(t) && (
|
|
128
|
-
for (const
|
|
129
|
-
Z(
|
|
130
|
-
|
|
126
|
+
let s = A(t) ? [t] : t;
|
|
127
|
+
A(t) && (s = [t]);
|
|
128
|
+
for (const l of s)
|
|
129
|
+
Z(l, i);
|
|
130
|
+
y.value = i;
|
|
131
131
|
}
|
|
132
132
|
function Z(t, i) {
|
|
133
133
|
if (A(t)) {
|
|
134
|
-
const
|
|
135
|
-
|
|
134
|
+
const s = i.findIndex((l) => l.field === t);
|
|
135
|
+
s !== -1 && (delete o[t], i.splice(s, 1));
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
async function L(t, i,
|
|
139
|
-
const
|
|
140
|
-
if (!i ||
|
|
141
|
-
|
|
138
|
+
async function L(t, i, s = !1) {
|
|
139
|
+
const l = I(n(f)), a = l.findIndex((e) => e.field === i), r = E(t) ? [t] : t;
|
|
140
|
+
if (!i || a === -1 || s) {
|
|
141
|
+
s ? l.unshift(...r) : l.push(...r), y.value = l, O(t);
|
|
142
142
|
return;
|
|
143
143
|
}
|
|
144
|
-
|
|
144
|
+
a !== -1 && l.splice(a + 1, 0, ...r), O(t), y.value = l;
|
|
145
145
|
}
|
|
146
146
|
async function K(t) {
|
|
147
147
|
let i = [];
|
|
148
|
-
if (
|
|
149
|
-
(
|
|
148
|
+
if (E(t) && i.push(t), V(t) && (i = [...t]), !i.every(
|
|
149
|
+
(l) => l.type === S.DIVIDER || Reflect.has(l, "field") && l.field
|
|
150
150
|
)) {
|
|
151
151
|
console.error(
|
|
152
152
|
"All children of the form Schema array that need to be updated must contain the `field` field"
|
|
153
153
|
);
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
|
-
|
|
156
|
+
y.value = i;
|
|
157
157
|
}
|
|
158
158
|
async function R(t) {
|
|
159
159
|
let i = [];
|
|
160
|
-
if (
|
|
161
|
-
(
|
|
160
|
+
if (E(t) && i.push(t), V(t) && (i = [...t]), !i.every(
|
|
161
|
+
(r) => r.type === S.DIVIDER || Reflect.has(r, "field") && r.field
|
|
162
162
|
)) {
|
|
163
163
|
console.error(
|
|
164
164
|
"All children of the form Schema array that need to be updated must contain the `field` field"
|
|
165
165
|
);
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
168
|
-
const
|
|
169
|
-
n(f).forEach((
|
|
168
|
+
const l = [], a = [];
|
|
169
|
+
n(f).forEach((r) => {
|
|
170
170
|
let e;
|
|
171
171
|
if (i.forEach((u) => {
|
|
172
|
-
|
|
173
|
-
}), e !== void 0 &&
|
|
174
|
-
const u = it(
|
|
175
|
-
|
|
172
|
+
r.field === u.field && (e = u), u.defaultValue && u.field && l.push(u.field);
|
|
173
|
+
}), e !== void 0 && r.field === e.field) {
|
|
174
|
+
const u = it(r, e);
|
|
175
|
+
a.push(u);
|
|
176
176
|
} else
|
|
177
|
-
|
|
178
|
-
}),
|
|
177
|
+
a.push(r);
|
|
178
|
+
}), O(a, l), y.value = ot(a, "field");
|
|
179
179
|
}
|
|
180
|
-
function
|
|
181
|
-
if (
|
|
180
|
+
function O(t, i, s = !0) {
|
|
181
|
+
if (V(i) && i?.length === 0)
|
|
182
182
|
return;
|
|
183
|
-
let
|
|
184
|
-
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
e.type !==
|
|
188
|
-
}),
|
|
183
|
+
let l = [];
|
|
184
|
+
E(t) && l.push(t), V(t) && (l = [...t]);
|
|
185
|
+
const a = {}, r = g();
|
|
186
|
+
l.forEach((e) => {
|
|
187
|
+
e.type !== S.DIVIDER && Reflect.has(e, "field") && e.field && !J(e.defaultValue) && (!(e.field in r) || J(r[e.field]) || lt(r[e.field])) && (a[e.field] = e.defaultValue);
|
|
188
|
+
}), st(a) || q(a, s);
|
|
189
189
|
}
|
|
190
|
-
function
|
|
191
|
-
|
|
190
|
+
function g(t = fasle) {
|
|
191
|
+
if (!n(c)) return {};
|
|
192
|
+
const s = B(x(n(o)));
|
|
193
|
+
if (t)
|
|
194
|
+
return s;
|
|
195
|
+
const l = n(f).filter((r) => _(r, n(o))).map((r) => r.field).filter(Boolean), a = {};
|
|
196
|
+
return l.forEach((r) => {
|
|
197
|
+
r in s && (a[r] = s[r]);
|
|
198
|
+
}), a;
|
|
192
199
|
}
|
|
193
200
|
function k(t) {
|
|
194
|
-
return n(
|
|
201
|
+
return n(c) ? x(n(o))[t] : {};
|
|
195
202
|
}
|
|
196
203
|
function M(t) {
|
|
197
|
-
return n(f).some((i) => i.field === t ?
|
|
198
|
-
}
|
|
199
|
-
async function q(t) {
|
|
200
|
-
return t || (t = n(f).filter((l) => Q(l, n(s))).map((l) => l.field).filter(Boolean)), n(a)?.validateField(t);
|
|
204
|
+
return n(f).some((i) => i.field === t ? ct(i.type) : !1);
|
|
201
205
|
}
|
|
202
206
|
async function N(t) {
|
|
203
|
-
return t || (t = n(f).filter((
|
|
207
|
+
return t || (t = n(f).filter((s) => _(s, n(o))).map((s) => s.field).filter(Boolean)), n(c)?.validateField(t);
|
|
208
|
+
}
|
|
209
|
+
async function $(t) {
|
|
210
|
+
return t || (t = n(f).filter((s) => _(s, n(o))).map((s) => s.field).filter(Boolean)), await n(c)?.validate(() => {
|
|
204
211
|
}, t);
|
|
205
212
|
}
|
|
206
|
-
async function
|
|
207
|
-
await n(
|
|
213
|
+
async function C(t) {
|
|
214
|
+
await n(c)?.clearValidate(t);
|
|
208
215
|
}
|
|
209
216
|
async function tt(t, i) {
|
|
210
|
-
await n(
|
|
217
|
+
await n(c)?.scrollToField(t, i);
|
|
211
218
|
}
|
|
212
|
-
async function
|
|
213
|
-
const { autoCleanErrorMessage: i, watchDataIsChange:
|
|
214
|
-
t && t.preventDefault(), i && await
|
|
215
|
-
const { submitFunc:
|
|
216
|
-
if (
|
|
217
|
-
await
|
|
219
|
+
async function U(t) {
|
|
220
|
+
const { autoCleanErrorMessage: i, watchDataIsChange: s } = n(v);
|
|
221
|
+
t && t.preventDefault(), i && await C();
|
|
222
|
+
const { submitFunc: l, beforeSubmitFunc: a } = n(v);
|
|
223
|
+
if (a && m(a) && await a(), l && m(l)) {
|
|
224
|
+
await l();
|
|
218
225
|
return;
|
|
219
226
|
}
|
|
220
|
-
if (n(
|
|
227
|
+
if (n(c))
|
|
221
228
|
try {
|
|
222
|
-
|
|
223
|
-
if (!e)
|
|
229
|
+
if (!await $())
|
|
224
230
|
return;
|
|
225
|
-
const u =
|
|
226
|
-
if (
|
|
227
|
-
const b =
|
|
228
|
-
h("submit", u, !b,
|
|
231
|
+
const u = g();
|
|
232
|
+
if (s) {
|
|
233
|
+
const b = at(T.value, u), j = nt(T.value, u);
|
|
234
|
+
h("submit", u, !b, j);
|
|
229
235
|
} else
|
|
230
236
|
h("submit", u);
|
|
231
237
|
} catch (e) {
|
|
@@ -235,21 +241,21 @@ function Dt({
|
|
|
235
241
|
}
|
|
236
242
|
}
|
|
237
243
|
return {
|
|
238
|
-
handleSubmit:
|
|
239
|
-
clearValidate:
|
|
240
|
-
validate:
|
|
241
|
-
validateField:
|
|
242
|
-
getFieldsValue:
|
|
244
|
+
handleSubmit: U,
|
|
245
|
+
clearValidate: C,
|
|
246
|
+
validate: $,
|
|
247
|
+
validateField: N,
|
|
248
|
+
getFieldsValue: g,
|
|
243
249
|
updateSchema: R,
|
|
244
250
|
resetSchema: K,
|
|
245
251
|
appendSchemaByField: L,
|
|
246
252
|
removeSchemaByField: Y,
|
|
247
253
|
resetFields: X,
|
|
248
|
-
setFieldsValue:
|
|
254
|
+
setFieldsValue: q,
|
|
249
255
|
scrollToField: tt,
|
|
250
256
|
getFieldValue: k
|
|
251
257
|
};
|
|
252
258
|
}
|
|
253
259
|
export {
|
|
254
|
-
|
|
260
|
+
wt as useFormEvents
|
|
255
261
|
};
|
package/es/package.json.d.ts
CHANGED
package/es/package.json.js
CHANGED
|
@@ -24,12 +24,12 @@ export declare const VftButton: import("vft/es/utils").SFCWithInstall<{
|
|
|
24
24
|
size: {
|
|
25
25
|
type: import("vue").PropType<import("../types").ComponentSize>;
|
|
26
26
|
};
|
|
27
|
-
icon: {
|
|
28
|
-
type: import("vue").PropType<string | import("vft/es/vft").IconProps>;
|
|
29
|
-
};
|
|
30
27
|
dark: {
|
|
31
28
|
type: import("vue").PropType<boolean>;
|
|
32
29
|
};
|
|
30
|
+
icon: {
|
|
31
|
+
type: import("vue").PropType<string | import("vft/es/vft").IconProps>;
|
|
32
|
+
};
|
|
33
33
|
loading: {
|
|
34
34
|
type: import("vue").PropType<boolean>;
|
|
35
35
|
};
|
|
@@ -114,12 +114,12 @@ export declare const VftButton: import("vft/es/utils").SFCWithInstall<{
|
|
|
114
114
|
size: {
|
|
115
115
|
type: import("vue").PropType<import("../types").ComponentSize>;
|
|
116
116
|
};
|
|
117
|
-
icon: {
|
|
118
|
-
type: import("vue").PropType<string | import("vft/es/vft").IconProps>;
|
|
119
|
-
};
|
|
120
117
|
dark: {
|
|
121
118
|
type: import("vue").PropType<boolean>;
|
|
122
119
|
};
|
|
120
|
+
icon: {
|
|
121
|
+
type: import("vue").PropType<string | import("vft/es/vft").IconProps>;
|
|
122
|
+
};
|
|
123
123
|
loading: {
|
|
124
124
|
type: import("vue").PropType<boolean>;
|
|
125
125
|
};
|
|
@@ -199,12 +199,12 @@ export declare const VftButton: import("vft/es/utils").SFCWithInstall<{
|
|
|
199
199
|
size: {
|
|
200
200
|
type: import("vue").PropType<import("../types").ComponentSize>;
|
|
201
201
|
};
|
|
202
|
-
icon: {
|
|
203
|
-
type: import("vue").PropType<string | import("vft/es/vft").IconProps>;
|
|
204
|
-
};
|
|
205
202
|
dark: {
|
|
206
203
|
type: import("vue").PropType<boolean>;
|
|
207
204
|
};
|
|
205
|
+
icon: {
|
|
206
|
+
type: import("vue").PropType<string | import("vft/es/vft").IconProps>;
|
|
207
|
+
};
|
|
208
208
|
loading: {
|
|
209
209
|
type: import("vue").PropType<boolean>;
|
|
210
210
|
};
|
|
@@ -32,10 +32,10 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
32
32
|
}>>> & Readonly<{
|
|
33
33
|
"onUpdate:error"?: ((val: string) => any) | undefined;
|
|
34
34
|
}>, {
|
|
35
|
-
required: boolean;
|
|
36
35
|
labelWidth: string | number;
|
|
37
36
|
inlineMessage: string | boolean;
|
|
38
37
|
showMessage: boolean;
|
|
38
|
+
required: boolean;
|
|
39
39
|
hideLabel: boolean;
|
|
40
40
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
41
41
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|