@aplus-frontend/ui 0.3.10 → 0.3.12

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