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