@aplus-frontend/ui 0.3.11 → 0.3.13
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/index.mjs +173 -169
- package/es/src/ap-field/radio/style/index.js +1 -0
- package/es/src/ap-form/ap-form.vue.d.ts +12 -31
- package/es/src/ap-form/ap-form.vue2.mjs +135 -118
- package/es/src/ap-form/drawer-form/index.vue.d.ts +22 -40
- package/es/src/ap-form/drawer-form/index.vue.mjs +3 -3
- package/es/src/ap-form/index.d.ts +3 -1
- package/es/src/ap-form/index.mjs +26 -22
- package/es/src/ap-form/interface.d.ts +3 -1
- package/es/src/ap-form/modal-form/index.vue.d.ts +23 -41
- package/es/src/ap-form/modal-form/index.vue.mjs +60 -59
- package/es/src/ap-form/provider/context.d.ts +3 -0
- package/es/src/ap-form/provider/context.mjs +17 -0
- package/es/src/ap-form/provider/index.vue.d.ts +19 -0
- package/es/src/ap-form/provider/index.vue.mjs +39 -0
- package/es/src/ap-form/provider/index.vue2.mjs +4 -0
- package/es/src/ap-form/provider/interface.d.ts +22 -0
- package/es/src/ap-form/search-form/index.vue.d.ts +22 -40
- package/es/src/business/ap-ladder/style/index.js +1 -0
- package/es/src/business/ap-table-modal/interface.d.ts +2 -0
- package/es/src/business/ap-table-modal/table-modal.vue2.mjs +50 -48
- package/es/src/business/batch-input-group/form-item.vue.d.ts +6 -0
- package/es/src/business/batch-input-group/form-item.vue.mjs +101 -0
- package/es/src/business/batch-input-group/form-item.vue2.mjs +4 -0
- package/es/src/business/batch-input-group/index.d.ts +2 -1
- package/es/src/business/batch-input-group/index.mjs +1 -0
- package/es/src/business/batch-input-group/index.vue.mjs +46 -44
- package/es/src/business/batch-input-group/interface.d.ts +8 -0
- package/es/src/business/batch-input-group/popover-input/index.vue2.mjs +43 -38
- package/es/src/config-provider/config-provider.d.ts +1 -0
- package/es/src/config-provider/css-var.d.ts +1 -0
- package/es/src/config-provider/css-var.mjs +14 -12
- package/es/src/config-provider/index.d.ts +5 -0
- package/es/src/index.mjs +154 -150
- package/es/src/utils/slot.mjs +6 -8
- package/lib/index.js +1 -1
- package/lib/src/ap-field/radio/style/index.js +1 -0
- package/lib/src/ap-form/ap-form.vue.d.ts +12 -31
- package/lib/src/ap-form/ap-form.vue2.js +1 -1
- package/lib/src/ap-form/drawer-form/index.vue.d.ts +22 -40
- package/lib/src/ap-form/drawer-form/index.vue.js +1 -1
- package/lib/src/ap-form/index.d.ts +3 -1
- package/lib/src/ap-form/index.js +1 -1
- package/lib/src/ap-form/interface.d.ts +3 -1
- package/lib/src/ap-form/modal-form/index.vue.d.ts +23 -41
- package/lib/src/ap-form/modal-form/index.vue.js +1 -1
- package/lib/src/ap-form/provider/context.d.ts +3 -0
- package/lib/src/ap-form/provider/context.js +1 -0
- package/lib/src/ap-form/provider/index.vue.d.ts +19 -0
- package/lib/src/ap-form/provider/index.vue.js +1 -0
- package/lib/src/ap-form/provider/index.vue2.js +1 -0
- package/lib/src/ap-form/provider/interface.d.ts +22 -0
- package/lib/src/ap-form/render/style/index.d.ts +1 -0
- package/lib/src/ap-form/render/style/index.js +1 -0
- package/lib/src/ap-form/search-form/index.vue.d.ts +22 -40
- package/lib/src/business/ap-ladder/style/index.js +1 -0
- package/lib/src/business/ap-table-modal/interface.d.ts +2 -0
- package/lib/src/business/ap-table-modal/table-modal.vue2.js +1 -1
- package/lib/src/business/batch-input-group/form-item.vue.d.ts +6 -0
- package/lib/src/business/batch-input-group/form-item.vue.js +1 -0
- package/lib/src/business/batch-input-group/form-item.vue2.js +1 -0
- package/lib/src/business/batch-input-group/index.d.ts +2 -1
- package/lib/src/business/batch-input-group/index.js +1 -1
- package/lib/src/business/batch-input-group/index.vue.js +2 -2
- package/lib/src/business/batch-input-group/interface.d.ts +8 -0
- package/lib/src/business/batch-input-group/popover-input/index.vue2.js +2 -2
- package/lib/src/config-provider/config-provider.d.ts +1 -0
- package/lib/src/config-provider/css-var.d.ts +1 -0
- package/lib/src/config-provider/css-var.js +1 -1
- package/lib/src/config-provider/index.d.ts +5 -0
- package/lib/src/index.js +1 -1
- package/lib/src/utils/slot.js +1 -1
- package/package.json +2 -2
- /package/es/src/ap-field/radio/style/{style.d.ts → index.d.ts} +0 -0
- /package/es/src/ap-form/render/style/{style.d.ts → index.d.ts} +0 -0
- /package/{lib/src/ap-form/render/style/style.d.ts → es/src/ap-form/render/style/index.js} +0 -0
- /package/es/src/business/ap-ladder/style/{style.d.ts → index.d.ts} +0 -0
- /package/lib/src/ap-field/radio/style/{style.d.ts → index.d.ts} +0 -0
- /package/lib/src/business/ap-ladder/style/{style.d.ts → index.d.ts} +0 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Form as
|
|
3
|
-
import { useProvideForm as
|
|
4
|
-
import { isArray as f, cloneDeep as
|
|
5
|
-
import { useUrlSearchParams as
|
|
6
|
-
import { INTERNAL_FORM_INSTANCE_MARK as
|
|
7
|
-
import { getRouteType as
|
|
8
|
-
import
|
|
9
|
-
import { genParams as
|
|
10
|
-
|
|
1
|
+
import { defineComponent as J, ref as O, reactive as Q, unref as h, nextTick as X, toRaw as j, watch as Y, onWatcherCleanup as Z, computed as ee, openBlock as te, createBlock as re, mergeProps as le, withCtx as oe, renderSlot as ie } from "vue";
|
|
2
|
+
import { Form as ne } from "@aplus-frontend/antdv";
|
|
3
|
+
import { useProvideForm as se } from "./context.mjs";
|
|
4
|
+
import { isArray as f, cloneDeep as ae, isFunction as R, isPlainObject as _, omit as ue } from "lodash-unified";
|
|
5
|
+
import { useUrlSearchParams as ce } from "@vueuse/core";
|
|
6
|
+
import { INTERNAL_FORM_INSTANCE_MARK as fe } from "./constant.mjs";
|
|
7
|
+
import { getRouteType as de, isDef as T } from "../utils/index.mjs";
|
|
8
|
+
import Fe from "./utils/set.mjs";
|
|
9
|
+
import { genParams as B, setToParams as x } from "./utils/params.mjs";
|
|
10
|
+
import { useInjectFormProvider as ge } from "./provider/context.mjs";
|
|
11
|
+
const Re = /* @__PURE__ */ J({
|
|
11
12
|
__name: "ap-form",
|
|
12
13
|
props: {
|
|
13
14
|
layout: { default: "horizontal" },
|
|
@@ -37,186 +38,202 @@ const Ve = /* @__PURE__ */ G({
|
|
|
37
38
|
syncToUrl: { type: [Boolean, Function], default: !1 },
|
|
38
39
|
syncToUrlPriority: { type: Boolean }
|
|
39
40
|
},
|
|
40
|
-
setup(E, { expose:
|
|
41
|
-
function
|
|
42
|
-
return f(t) ? t.reduce((
|
|
41
|
+
setup(E, { expose: A }) {
|
|
42
|
+
function C(e, t) {
|
|
43
|
+
return f(t) ? t.reduce((r, i) => r == null ? void 0 : r[i], e) : e == null ? void 0 : e[t];
|
|
43
44
|
}
|
|
44
45
|
const o = E;
|
|
45
|
-
function V(e, t,
|
|
46
|
-
var
|
|
46
|
+
function V(e, t, r = !0) {
|
|
47
|
+
var n;
|
|
47
48
|
if (f(e)) {
|
|
48
|
-
let
|
|
49
|
+
let l = s;
|
|
49
50
|
for (let u = 0; u < e.length - 1; u++)
|
|
50
|
-
e[u] in
|
|
51
|
-
|
|
51
|
+
e[u] in l || (l[e[u]] = {}), l = l[e[u]];
|
|
52
|
+
l[e[e.length - 1]] = t;
|
|
52
53
|
} else
|
|
53
|
-
|
|
54
|
-
let
|
|
55
|
-
|
|
54
|
+
s[e] = t;
|
|
55
|
+
let i = f(e) ? e[0] : e;
|
|
56
|
+
if (r) {
|
|
57
|
+
const l = { [i]: s[i] };
|
|
58
|
+
p.triggerFormChange(o.name, l), (n = o.onValuesChange) == null || n.call(o, l, s, e);
|
|
59
|
+
}
|
|
60
|
+
y();
|
|
56
61
|
}
|
|
57
|
-
const a =
|
|
58
|
-
o.syncToUrl ?
|
|
62
|
+
const a = O(), v = ce(de()), p = ge(), I = O(
|
|
63
|
+
o.syncToUrl ? B(o.syncToUrl, v, "get") : {}
|
|
59
64
|
);
|
|
60
|
-
let
|
|
61
|
-
const
|
|
65
|
+
let m = ae(M()), d = {};
|
|
66
|
+
const s = Q(M());
|
|
62
67
|
let F = [];
|
|
63
|
-
function
|
|
68
|
+
function M() {
|
|
64
69
|
const e = o.initialValues || {};
|
|
65
70
|
return o.syncToUrlPriority ? {
|
|
66
71
|
...e,
|
|
67
|
-
...
|
|
72
|
+
...h(I)
|
|
68
73
|
} : {
|
|
69
|
-
...
|
|
74
|
+
...h(I),
|
|
70
75
|
...e
|
|
71
76
|
};
|
|
72
77
|
}
|
|
73
|
-
function
|
|
74
|
-
var
|
|
75
|
-
const t =
|
|
76
|
-
o.syncToUrl &&
|
|
78
|
+
function N(e) {
|
|
79
|
+
var r;
|
|
80
|
+
const t = g(e, d);
|
|
81
|
+
p.triggerFormFinish(o.name, e), o.syncToUrl && x(v, B(o.syncToUrl, t, "set")), (r = o.onFinish) == null || r.call(o, t);
|
|
77
82
|
}
|
|
78
|
-
const
|
|
83
|
+
const S = async () => {
|
|
79
84
|
var e;
|
|
80
|
-
(e = a.value) == null || e.resetFields(), await
|
|
81
|
-
Object.keys(
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
(e = a.value) == null || e.resetFields(), await X(() => {
|
|
86
|
+
Object.keys(s).forEach((t) => delete s[t]), Object.assign(s, m), y(), o.syncToUrl && x(
|
|
87
|
+
v,
|
|
88
|
+
B(
|
|
84
89
|
o.syncToUrl,
|
|
85
|
-
|
|
90
|
+
g(m, d),
|
|
86
91
|
"set"
|
|
87
92
|
)
|
|
88
93
|
);
|
|
89
94
|
});
|
|
90
|
-
},
|
|
95
|
+
}, W = (e) => {
|
|
91
96
|
var t;
|
|
92
97
|
(t = a.value) == null || t.clearValidate(e);
|
|
93
|
-
},
|
|
94
|
-
var
|
|
95
|
-
return (
|
|
96
|
-
},
|
|
97
|
-
var
|
|
98
|
-
const
|
|
98
|
+
}, q = (e, t) => {
|
|
99
|
+
var r;
|
|
100
|
+
return (r = a.value) == null ? void 0 : r.validateFields(e, t);
|
|
101
|
+
}, z = async (e, t) => {
|
|
102
|
+
var i;
|
|
103
|
+
const r = await ((i = a.value) == null ? void 0 : i.validateFields(
|
|
99
104
|
e,
|
|
100
105
|
t
|
|
101
106
|
));
|
|
102
|
-
return
|
|
103
|
-
},
|
|
107
|
+
return g(r, d);
|
|
108
|
+
}, D = (e) => {
|
|
104
109
|
var t;
|
|
105
110
|
return (t = a.value) == null ? void 0 : t.getFieldsValue(e);
|
|
106
|
-
},
|
|
107
|
-
var
|
|
108
|
-
const t = (
|
|
109
|
-
return
|
|
110
|
-
},
|
|
111
|
-
var
|
|
112
|
-
return (
|
|
113
|
-
},
|
|
114
|
-
var
|
|
115
|
-
(
|
|
116
|
-
},
|
|
117
|
-
Object.assign(
|
|
118
|
-
},
|
|
119
|
-
V(e, t,
|
|
111
|
+
}, L = (e) => {
|
|
112
|
+
var r;
|
|
113
|
+
const t = (r = a.value) == null ? void 0 : r.getFieldsValue(e);
|
|
114
|
+
return g(t, d);
|
|
115
|
+
}, k = (e, t) => {
|
|
116
|
+
var r;
|
|
117
|
+
return (r = a.value) == null ? void 0 : r.validate(e, t);
|
|
118
|
+
}, K = (e, t = {}) => {
|
|
119
|
+
var r;
|
|
120
|
+
(r = a.value) == null || r.scrollToField(e, t);
|
|
121
|
+
}, $ = (e) => {
|
|
122
|
+
Object.assign(s, e), y();
|
|
123
|
+
}, P = (e, t, r = !0) => {
|
|
124
|
+
V(e, t, r), y();
|
|
120
125
|
};
|
|
121
126
|
function U(e, t) {
|
|
122
|
-
return t || e(
|
|
123
|
-
F = F.filter((
|
|
127
|
+
return t || e(j(s)), F.push(e), () => {
|
|
128
|
+
F = F.filter((r) => r !== e);
|
|
124
129
|
};
|
|
125
130
|
}
|
|
126
|
-
function
|
|
131
|
+
function b({ initialValue: e, name: t, transform: r }) {
|
|
127
132
|
if (T(e) && T(t)) {
|
|
128
|
-
const
|
|
129
|
-
if (!T(
|
|
133
|
+
const i = C(h(I), t);
|
|
134
|
+
if (!T(i) || !o.syncToUrlPriority)
|
|
130
135
|
if (V(t, e, !1), f(t)) {
|
|
131
|
-
let
|
|
132
|
-
for (let
|
|
133
|
-
T(
|
|
134
|
-
|
|
136
|
+
let n = m;
|
|
137
|
+
for (let l = 0; l < t.length - 1; l++)
|
|
138
|
+
T(n[t[l]]) || (n[t[l]] = {}), n = n[t[l]];
|
|
139
|
+
n[t[t.length - 1]] = e;
|
|
135
140
|
} else
|
|
136
|
-
|
|
141
|
+
m[t] = e;
|
|
137
142
|
}
|
|
138
|
-
|
|
143
|
+
r && (d = Fe(
|
|
139
144
|
d,
|
|
140
145
|
[t].flat(1),
|
|
141
|
-
|
|
146
|
+
r,
|
|
142
147
|
!0
|
|
143
148
|
));
|
|
144
149
|
}
|
|
145
|
-
function
|
|
146
|
-
if (e !==
|
|
150
|
+
function G(e) {
|
|
151
|
+
if (e !== fe) {
|
|
147
152
|
console.warn("getInternalInstance should only used at internal");
|
|
148
153
|
return;
|
|
149
154
|
}
|
|
150
155
|
return {
|
|
151
|
-
registerField:
|
|
152
|
-
registerWatch: U
|
|
156
|
+
registerField: b,
|
|
157
|
+
registerWatch: U,
|
|
158
|
+
setFieldValue: P
|
|
153
159
|
};
|
|
154
160
|
}
|
|
155
161
|
function y() {
|
|
156
162
|
if (F.length) {
|
|
157
|
-
const e =
|
|
163
|
+
const e = j(s);
|
|
158
164
|
F.forEach((t) => {
|
|
159
165
|
t(e);
|
|
160
166
|
});
|
|
161
167
|
}
|
|
162
168
|
}
|
|
163
|
-
function
|
|
169
|
+
function g(e, t) {
|
|
164
170
|
if (e == null)
|
|
165
171
|
return;
|
|
166
|
-
let
|
|
167
|
-
return Object.keys(e).forEach((
|
|
168
|
-
const
|
|
169
|
-
if (
|
|
170
|
-
const c = u(
|
|
171
|
-
|
|
172
|
-
...
|
|
172
|
+
let r = f(e) ? [] : {};
|
|
173
|
+
return Object.keys(e).forEach((i) => {
|
|
174
|
+
const n = e[i], l = t == null ? void 0 : t[i], u = R(l) ? l : l == null ? void 0 : l.transformer, H = R(l) ? !0 : l == null ? void 0 : l.flat;
|
|
175
|
+
if (R(u)) {
|
|
176
|
+
const c = u(n);
|
|
177
|
+
H ? f(c) && f(r) ? r = [...r, ...c] : _(c) && _(r) ? r = {
|
|
178
|
+
...r,
|
|
173
179
|
...c
|
|
174
|
-
} :
|
|
175
|
-
} else if (
|
|
176
|
-
const c =
|
|
177
|
-
|
|
178
|
-
|
|
180
|
+
} : r[i] = c : r[i] = c;
|
|
181
|
+
} else if (_(n) || f(n)) {
|
|
182
|
+
const c = g(
|
|
183
|
+
n,
|
|
184
|
+
l
|
|
179
185
|
);
|
|
180
|
-
|
|
186
|
+
r[i] = c;
|
|
181
187
|
} else
|
|
182
|
-
|
|
183
|
-
}),
|
|
188
|
+
r[i] = n;
|
|
189
|
+
}), r;
|
|
184
190
|
}
|
|
185
|
-
|
|
186
|
-
|
|
191
|
+
const w = {
|
|
192
|
+
resetFields: S,
|
|
193
|
+
clearValidate: W,
|
|
194
|
+
validateFields: q,
|
|
195
|
+
getFieldsValue: D,
|
|
196
|
+
validate: k,
|
|
197
|
+
scrollToField: K,
|
|
198
|
+
setFieldsValue: $,
|
|
199
|
+
setFieldValue: P,
|
|
200
|
+
registerWatch: U,
|
|
201
|
+
validateFieldsReturnTransformed: z,
|
|
202
|
+
getFieldsValueTransformed: L,
|
|
203
|
+
getInternalInstance: G
|
|
204
|
+
};
|
|
205
|
+
return Y(
|
|
206
|
+
() => o.name,
|
|
207
|
+
(e) => {
|
|
208
|
+
e && (p.registerForm(e, w), Z(() => {
|
|
209
|
+
p.unregisterForm(o.name);
|
|
210
|
+
}));
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
immediate: !0
|
|
214
|
+
}
|
|
215
|
+
), se({
|
|
216
|
+
model: ee(() => s),
|
|
187
217
|
updateModel: V,
|
|
188
218
|
internalInstance: {
|
|
189
219
|
registerWatch: U,
|
|
190
|
-
registerField:
|
|
191
|
-
setFieldValue:
|
|
220
|
+
registerField: b,
|
|
221
|
+
setFieldValue: P
|
|
192
222
|
}
|
|
193
|
-
}),
|
|
194
|
-
resetFields: N,
|
|
195
|
-
clearValidate: S,
|
|
196
|
-
validateFields: W,
|
|
197
|
-
getFieldsValue: z,
|
|
198
|
-
validate: D,
|
|
199
|
-
scrollToField: L,
|
|
200
|
-
setFieldsValue: k,
|
|
201
|
-
setFieldValue: I,
|
|
202
|
-
registerWatch: U,
|
|
203
|
-
validateFieldsReturnTransformed: q,
|
|
204
|
-
getFieldsValueTransformed: C,
|
|
205
|
-
getInternalInstance: K
|
|
206
|
-
}), (e, t) => (X(), Y(g(le), Z({
|
|
223
|
+
}), A(w), (e, t) => (te(), re(h(ne), le({
|
|
207
224
|
ref_key: "formRef",
|
|
208
225
|
ref: a
|
|
209
|
-
},
|
|
210
|
-
model:
|
|
211
|
-
onFinish:
|
|
226
|
+
}, h(ue)(o, ["initialValues", "onValuesChange", "onFinish"]), {
|
|
227
|
+
model: s,
|
|
228
|
+
onFinish: N
|
|
212
229
|
}), {
|
|
213
|
-
default:
|
|
214
|
-
|
|
230
|
+
default: oe(() => [
|
|
231
|
+
ie(e.$slots, "default")
|
|
215
232
|
]),
|
|
216
233
|
_: 3
|
|
217
234
|
}, 16, ["model"]));
|
|
218
235
|
}
|
|
219
236
|
});
|
|
220
237
|
export {
|
|
221
|
-
|
|
238
|
+
Re as default
|
|
222
239
|
};
|
|
@@ -7,7 +7,7 @@ import { ColSize } from '@aplus-frontend/antdv/es/grid';
|
|
|
7
7
|
import { RuleObject } from '@aplus-frontend/antdv/es/form';
|
|
8
8
|
import { Options } from '../../../node_modules/scroll-into-view-if-needed';
|
|
9
9
|
import { Recordable } from '../../type';
|
|
10
|
-
import { ApFormProps,
|
|
10
|
+
import { ApFormProps, ApFormInternalInstance, WatchFunc, ApFormSubmitterConfig } from '..';
|
|
11
11
|
import { OnCleanup } from '@vue/reactivity';
|
|
12
12
|
import { VueTypeValidableDef, VueTypeDef } from '../../../node_modules/vue-types';
|
|
13
13
|
import { PushState } from '@aplus-frontend/antdv/es/drawer';
|
|
@@ -134,27 +134,18 @@ declare function __VLS_template(): {
|
|
|
134
134
|
$emit: (event: string, ...args: any[]) => void;
|
|
135
135
|
$el: any;
|
|
136
136
|
$options: ComponentOptionsBase<Readonly< ApFormProps> & Readonly<{}>, {
|
|
137
|
+
setFieldsValue: (fields: Partial<any>) => void;
|
|
138
|
+
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean) => void;
|
|
137
139
|
resetFields: () => Promise<void>;
|
|
138
|
-
clearValidate: (name?: NamePath
|
|
139
|
-
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
[key: string]: any;
|
|
147
|
-
}> | undefined;
|
|
148
|
-
scrollToField: (name: NamePath, options?: {}) => void;
|
|
149
|
-
setFieldsValue: (values: Record<string, any>) => void;
|
|
150
|
-
setFieldValue: (name: NamePath, newValue: any, triggerChange?: boolean) => void;
|
|
140
|
+
clearValidate: (name?: NamePath) => void;
|
|
141
|
+
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
142
|
+
getFieldsValue: (nameList?: true | InternalNamePath[]) => Partial<any> | undefined;
|
|
143
|
+
validate: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
144
|
+
scrollToField: (name: NamePath, options?: any) => void;
|
|
145
|
+
getInternalInstance: (mark: string) => ApFormInternalInstance | undefined;
|
|
146
|
+
validateFieldsReturnTransformed: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
147
|
+
getFieldsValueTransformed: (nameList?: true | InternalNamePath[]) => Partial<any> | undefined;
|
|
151
148
|
registerWatch: (callback: WatchFunc, inner: boolean) => () => void;
|
|
152
|
-
validateFieldsReturnTransformed: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<any>;
|
|
153
|
-
getFieldsValueTransformed: (nameList?: InternalNamePath[] | true) => any;
|
|
154
|
-
getInternalInstance: (mark: string) => {
|
|
155
|
-
registerField: ({ initialValue, name, transform }: RegistedFieldType) => void;
|
|
156
|
-
registerWatch: (callback: WatchFunc, inner: boolean) => () => void;
|
|
157
|
-
} | undefined;
|
|
158
149
|
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {
|
|
159
150
|
layout: string;
|
|
160
151
|
colon: boolean;
|
|
@@ -191,28 +182,19 @@ declare function __VLS_template(): {
|
|
|
191
182
|
hideRequiredMark: boolean;
|
|
192
183
|
validateOnRuleChange: boolean;
|
|
193
184
|
syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
|
|
194
|
-
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "validate" | "resetFields" | "clearValidate" | "validateFields" | "getFieldsValue" | "scrollToField" | "registerWatch" | "setFieldValue" | "
|
|
185
|
+
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "validate" | "resetFields" | "clearValidate" | "validateFields" | "getFieldsValue" | "scrollToField" | "registerWatch" | "setFieldValue" | ("layout" | "colon" | "labelAlign" | "validateTrigger" | "hideRequiredMark" | "validateOnRuleChange" | "syncToUrl") | "setFieldsValue" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed"> & ShallowUnwrapRef<{
|
|
186
|
+
setFieldsValue: (fields: Partial<any>) => void;
|
|
187
|
+
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean) => void;
|
|
195
188
|
resetFields: () => Promise<void>;
|
|
196
|
-
clearValidate: (name?: NamePath
|
|
197
|
-
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
[key: string]: any;
|
|
205
|
-
}> | undefined;
|
|
206
|
-
scrollToField: (name: NamePath, options?: {}) => void;
|
|
207
|
-
setFieldsValue: (values: Record<string, any>) => void;
|
|
208
|
-
setFieldValue: (name: NamePath, newValue: any, triggerChange?: boolean) => void;
|
|
189
|
+
clearValidate: (name?: NamePath) => void;
|
|
190
|
+
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
191
|
+
getFieldsValue: (nameList?: true | InternalNamePath[]) => Partial<any> | undefined;
|
|
192
|
+
validate: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
193
|
+
scrollToField: (name: NamePath, options?: any) => void;
|
|
194
|
+
getInternalInstance: (mark: string) => ApFormInternalInstance | undefined;
|
|
195
|
+
validateFieldsReturnTransformed: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
196
|
+
getFieldsValueTransformed: (nameList?: true | InternalNamePath[]) => Partial<any> | undefined;
|
|
209
197
|
registerWatch: (callback: WatchFunc, inner: boolean) => () => void;
|
|
210
|
-
validateFieldsReturnTransformed: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<any>;
|
|
211
|
-
getFieldsValueTransformed: (nameList?: InternalNamePath[] | true) => any;
|
|
212
|
-
getInternalInstance: (mark: string) => {
|
|
213
|
-
registerField: ({ initialValue, name, transform }: RegistedFieldType) => void;
|
|
214
|
-
registerWatch: (callback: WatchFunc, inner: boolean) => () => void;
|
|
215
|
-
} | undefined;
|
|
216
198
|
}> & {} & ComponentCustomProperties & {} & {
|
|
217
199
|
$slots: {
|
|
218
200
|
default?(_: {}): any;
|
|
@@ -141,7 +141,7 @@ const je = /* @__PURE__ */ Q({
|
|
|
141
141
|
const e = (t = l(c)) == null ? void 0 : t.minWidth;
|
|
142
142
|
return !e || e && e < n.width ? n.width : e;
|
|
143
143
|
}
|
|
144
|
-
const
|
|
144
|
+
const T = re(F.trigger), x = T ? Z(T, {
|
|
145
145
|
onClick: () => {
|
|
146
146
|
h(!0);
|
|
147
147
|
}
|
|
@@ -207,7 +207,7 @@ const je = /* @__PURE__ */ Q({
|
|
|
207
207
|
var e, t, i, s;
|
|
208
208
|
if (n.submitter !== !1)
|
|
209
209
|
try {
|
|
210
|
-
const r = await ((e = a.value) == null ? void 0 : e.
|
|
210
|
+
const r = await ((e = a.value) == null ? void 0 : e.validateFieldsReturnTransformed());
|
|
211
211
|
(i = (t = n.submitter) == null ? void 0 : t.onSubmit) == null || i.call(t), u.value = !0;
|
|
212
212
|
const o = (s = n.onFinish) == null ? void 0 : s.call(n, me(r));
|
|
213
213
|
if (n.submitTimeout && o instanceof Promise) {
|
|
@@ -288,7 +288,7 @@ const je = /* @__PURE__ */ Q({
|
|
|
288
288
|
onMousedown: oe(A, ["stop", "prevent"])
|
|
289
289
|
}, null, 34)) : L("", !0)]),
|
|
290
290
|
_: 3
|
|
291
|
-
}, 16, ["open", "width"]), l(
|
|
291
|
+
}, 16, ["open", "width"]), l(x) ? (y(), S(_(l(x)), {
|
|
292
292
|
key: 0
|
|
293
293
|
})) : L("", !0)], 64));
|
|
294
294
|
}
|
|
@@ -10,6 +10,7 @@ import { default as ApFormSet } from './set/index.vue';
|
|
|
10
10
|
import { default as ApFormDrawerForm } from './drawer-form/index.vue';
|
|
11
11
|
import { default as ApFormControlRender } from './render/control.vue';
|
|
12
12
|
import { default as ApFormItemRender } from './render/item.vue';
|
|
13
|
+
import { default as ApFormProvider } from './provider/index.vue';
|
|
13
14
|
type ApFormMixedProps = typeof _ApForm & {
|
|
14
15
|
FormItem: typeof ApFormItem;
|
|
15
16
|
FormItemGroup: typeof ApFormItemGroup;
|
|
@@ -22,8 +23,9 @@ type ApFormMixedProps = typeof _ApForm & {
|
|
|
22
23
|
DrawerForm: typeof ApFormDrawerForm;
|
|
23
24
|
ControlRender: typeof ApFormControlRender;
|
|
24
25
|
ItemRender: typeof ApFormItemRender;
|
|
26
|
+
Provider: typeof ApFormProvider;
|
|
25
27
|
};
|
|
26
28
|
declare const ApForm: ApFormMixedProps;
|
|
27
29
|
export * from './items';
|
|
28
30
|
export * from './interface';
|
|
29
|
-
export { ApForm, ApFormItem, ApFormItemGroup, ApFormList, ApFormSearchForm, ApFormModalForm, ApFormDependency, ApFormSet, ApFormDrawerForm, ApFormControlRender, ApFormItemRender };
|
|
31
|
+
export { ApForm, ApFormItem, ApFormItemGroup, ApFormList, ApFormSearchForm, ApFormModalForm, ApFormDependency, ApFormSet, ApFormDrawerForm, ApFormControlRender, ApFormItemRender, ApFormProvider };
|
package/es/src/ap-form/index.mjs
CHANGED
|
@@ -4,47 +4,51 @@ import "./item-group/index.vue2.mjs";
|
|
|
4
4
|
import "./list/index.vue2.mjs";
|
|
5
5
|
import "./search-form/index.vue2.mjs";
|
|
6
6
|
import "./modal-form/index.vue2.mjs";
|
|
7
|
-
import
|
|
7
|
+
import m from "./hooks/use-watch.mjs";
|
|
8
8
|
import "./dependency/index.vue2.mjs";
|
|
9
9
|
import "./set/index.vue2.mjs";
|
|
10
10
|
import "./drawer-form/index.vue2.mjs";
|
|
11
11
|
import "./render/control.vue2.mjs";
|
|
12
12
|
import "./render/item.vue2.mjs";
|
|
13
|
+
import "./provider/index.vue2.mjs";
|
|
13
14
|
import "./items/index.mjs";
|
|
14
15
|
import "./interface.mjs";
|
|
15
16
|
import o from "./ap-form.vue2.mjs";
|
|
16
17
|
import p from "./item/index.vue.mjs";
|
|
17
|
-
import
|
|
18
|
-
import
|
|
18
|
+
import i from "./item-group/index.vue.mjs";
|
|
19
|
+
import t from "./list/index.vue.mjs";
|
|
19
20
|
import a from "./search-form/index.vue.mjs";
|
|
20
21
|
import e from "./modal-form/index.vue.mjs";
|
|
21
22
|
import s from "./dependency/index.vue.mjs";
|
|
22
23
|
import f from "./set/index.vue.mjs";
|
|
23
|
-
import
|
|
24
|
-
import
|
|
24
|
+
import _ from "./drawer-form/index.vue.mjs";
|
|
25
|
+
import n from "./render/control.vue.mjs";
|
|
25
26
|
import F from "./render/item.vue.mjs";
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
import c from "./provider/index.vue.mjs";
|
|
28
|
+
const r = o;
|
|
29
|
+
r.FormItem = p;
|
|
30
|
+
r.FormItemGroup = i;
|
|
31
|
+
r.FormList = t;
|
|
32
|
+
r.SearchForm = a;
|
|
33
|
+
r.ModalForm = e;
|
|
34
|
+
r.useWatch = m;
|
|
35
|
+
r.Dependency = s;
|
|
36
|
+
r.Set = f;
|
|
37
|
+
r.DrawerForm = _;
|
|
38
|
+
r.ControlRender = n;
|
|
39
|
+
r.ItemRender = F;
|
|
40
|
+
r.Provider = c;
|
|
38
41
|
export {
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
r as ApForm,
|
|
43
|
+
n as ApFormControlRender,
|
|
41
44
|
s as ApFormDependency,
|
|
42
|
-
|
|
45
|
+
_ as ApFormDrawerForm,
|
|
43
46
|
p as ApFormItem,
|
|
44
|
-
|
|
47
|
+
i as ApFormItemGroup,
|
|
45
48
|
F as ApFormItemRender,
|
|
46
|
-
|
|
49
|
+
t as ApFormList,
|
|
47
50
|
e as ApFormModalForm,
|
|
51
|
+
c as ApFormProvider,
|
|
48
52
|
a as ApFormSearchForm,
|
|
49
53
|
f as ApFormSet
|
|
50
54
|
};
|
|
@@ -3,6 +3,7 @@ import { FormItemExpose } from '@aplus-frontend/antdv/es/form/FormItem';
|
|
|
3
3
|
import { InternalNamePath, NamePath, ValidateOptions } from '@aplus-frontend/antdv/es/form/interface';
|
|
4
4
|
import { Recordable } from '../type';
|
|
5
5
|
import { VNode } from 'vue';
|
|
6
|
+
export type { ApFormChangeInfo, ApFormFinishInfo } from './provider/interface';
|
|
6
7
|
export type ApFormColProps = Omit<ColProps, 'prefixCls'>;
|
|
7
8
|
export type ApFormItemTransformFn = (value: any) => any;
|
|
8
9
|
export type ApFormItemTransformType = ApFormItemTransformFn | {
|
|
@@ -71,7 +72,7 @@ export type ApFormExpose<ModelType = any> = {
|
|
|
71
72
|
* @param mark 内部使用的标记
|
|
72
73
|
* @returns
|
|
73
74
|
*/
|
|
74
|
-
getInternalInstance: (mark: string) => ApFormInternalInstance;
|
|
75
|
+
getInternalInstance: (mark: string) => ApFormInternalInstance | undefined;
|
|
75
76
|
/**
|
|
76
77
|
* 校验表单并返回转换后的数据
|
|
77
78
|
* @param nameList
|
|
@@ -85,6 +86,7 @@ export type ApFormExpose<ModelType = any> = {
|
|
|
85
86
|
* @returns
|
|
86
87
|
*/
|
|
87
88
|
getFieldsValueTransformed: (nameList?: true | InternalNamePath[]) => Partial<ModelType> | undefined;
|
|
89
|
+
registerWatch: (callback: WatchFunc, inner: boolean) => () => void;
|
|
88
90
|
};
|
|
89
91
|
/**
|
|
90
92
|
* 被注册的表单项
|