@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.
Files changed (79) hide show
  1. package/es/index.mjs +173 -169
  2. package/es/src/ap-field/radio/style/index.js +1 -0
  3. package/es/src/ap-form/ap-form.vue.d.ts +12 -31
  4. package/es/src/ap-form/ap-form.vue2.mjs +135 -118
  5. package/es/src/ap-form/drawer-form/index.vue.d.ts +22 -40
  6. package/es/src/ap-form/drawer-form/index.vue.mjs +3 -3
  7. package/es/src/ap-form/index.d.ts +3 -1
  8. package/es/src/ap-form/index.mjs +26 -22
  9. package/es/src/ap-form/interface.d.ts +3 -1
  10. package/es/src/ap-form/modal-form/index.vue.d.ts +23 -41
  11. package/es/src/ap-form/modal-form/index.vue.mjs +60 -59
  12. package/es/src/ap-form/provider/context.d.ts +3 -0
  13. package/es/src/ap-form/provider/context.mjs +17 -0
  14. package/es/src/ap-form/provider/index.vue.d.ts +19 -0
  15. package/es/src/ap-form/provider/index.vue.mjs +39 -0
  16. package/es/src/ap-form/provider/index.vue2.mjs +4 -0
  17. package/es/src/ap-form/provider/interface.d.ts +22 -0
  18. package/es/src/ap-form/search-form/index.vue.d.ts +22 -40
  19. package/es/src/business/ap-ladder/style/index.js +1 -0
  20. package/es/src/business/ap-table-modal/interface.d.ts +2 -0
  21. package/es/src/business/ap-table-modal/table-modal.vue2.mjs +50 -48
  22. package/es/src/business/batch-input-group/form-item.vue.d.ts +6 -0
  23. package/es/src/business/batch-input-group/form-item.vue.mjs +101 -0
  24. package/es/src/business/batch-input-group/form-item.vue2.mjs +4 -0
  25. package/es/src/business/batch-input-group/index.d.ts +2 -1
  26. package/es/src/business/batch-input-group/index.mjs +1 -0
  27. package/es/src/business/batch-input-group/index.vue.mjs +46 -44
  28. package/es/src/business/batch-input-group/interface.d.ts +8 -0
  29. package/es/src/business/batch-input-group/popover-input/index.vue2.mjs +43 -38
  30. package/es/src/config-provider/config-provider.d.ts +1 -0
  31. package/es/src/config-provider/css-var.d.ts +1 -0
  32. package/es/src/config-provider/css-var.mjs +14 -12
  33. package/es/src/config-provider/index.d.ts +5 -0
  34. package/es/src/index.mjs +154 -150
  35. package/es/src/utils/slot.mjs +6 -8
  36. package/lib/index.js +1 -1
  37. package/lib/src/ap-field/radio/style/index.js +1 -0
  38. package/lib/src/ap-form/ap-form.vue.d.ts +12 -31
  39. package/lib/src/ap-form/ap-form.vue2.js +1 -1
  40. package/lib/src/ap-form/drawer-form/index.vue.d.ts +22 -40
  41. package/lib/src/ap-form/drawer-form/index.vue.js +1 -1
  42. package/lib/src/ap-form/index.d.ts +3 -1
  43. package/lib/src/ap-form/index.js +1 -1
  44. package/lib/src/ap-form/interface.d.ts +3 -1
  45. package/lib/src/ap-form/modal-form/index.vue.d.ts +23 -41
  46. package/lib/src/ap-form/modal-form/index.vue.js +1 -1
  47. package/lib/src/ap-form/provider/context.d.ts +3 -0
  48. package/lib/src/ap-form/provider/context.js +1 -0
  49. package/lib/src/ap-form/provider/index.vue.d.ts +19 -0
  50. package/lib/src/ap-form/provider/index.vue.js +1 -0
  51. package/lib/src/ap-form/provider/index.vue2.js +1 -0
  52. package/lib/src/ap-form/provider/interface.d.ts +22 -0
  53. package/lib/src/ap-form/render/style/index.d.ts +1 -0
  54. package/lib/src/ap-form/render/style/index.js +1 -0
  55. package/lib/src/ap-form/search-form/index.vue.d.ts +22 -40
  56. package/lib/src/business/ap-ladder/style/index.js +1 -0
  57. package/lib/src/business/ap-table-modal/interface.d.ts +2 -0
  58. package/lib/src/business/ap-table-modal/table-modal.vue2.js +1 -1
  59. package/lib/src/business/batch-input-group/form-item.vue.d.ts +6 -0
  60. package/lib/src/business/batch-input-group/form-item.vue.js +1 -0
  61. package/lib/src/business/batch-input-group/form-item.vue2.js +1 -0
  62. package/lib/src/business/batch-input-group/index.d.ts +2 -1
  63. package/lib/src/business/batch-input-group/index.js +1 -1
  64. package/lib/src/business/batch-input-group/index.vue.js +2 -2
  65. package/lib/src/business/batch-input-group/interface.d.ts +8 -0
  66. package/lib/src/business/batch-input-group/popover-input/index.vue2.js +2 -2
  67. package/lib/src/config-provider/config-provider.d.ts +1 -0
  68. package/lib/src/config-provider/css-var.d.ts +1 -0
  69. package/lib/src/config-provider/css-var.js +1 -1
  70. package/lib/src/config-provider/index.d.ts +5 -0
  71. package/lib/src/index.js +1 -1
  72. package/lib/src/utils/slot.js +1 -1
  73. package/package.json +2 -2
  74. /package/es/src/ap-field/radio/style/{style.d.ts → index.d.ts} +0 -0
  75. /package/es/src/ap-form/render/style/{style.d.ts → index.d.ts} +0 -0
  76. /package/{lib/src/ap-form/render/style/style.d.ts → es/src/ap-form/render/style/index.js} +0 -0
  77. /package/es/src/business/ap-ladder/style/{style.d.ts → index.d.ts} +0 -0
  78. /package/lib/src/ap-field/radio/style/{style.d.ts → index.d.ts} +0 -0
  79. /package/lib/src/business/ap-ladder/style/{style.d.ts → index.d.ts} +0 -0
@@ -1,13 +1,14 @@
1
- import { defineComponent as G, ref as b, reactive as H, unref as g, nextTick as J, toRaw as O, computed as Q, openBlock as X, createBlock as Y, mergeProps as Z, withCtx as ee, renderSlot as te } from "vue";
2
- import { Form as le } from "@aplus-frontend/antdv";
3
- import { useProvideForm as re } from "./context.mjs";
4
- import { isArray as f, cloneDeep as oe, isFunction as P, isPlainObject as R, omit as se } from "lodash-unified";
5
- import { useUrlSearchParams as ie } from "@vueuse/core";
6
- import { INTERNAL_FORM_INSTANCE_MARK as ne } from "./constant.mjs";
7
- import { getRouteType as ae, isDef as T } from "../utils/index.mjs";
8
- import ue from "./utils/set.mjs";
9
- import { genParams as _, setToParams as w } from "./utils/params.mjs";
10
- const Ve = /* @__PURE__ */ G({
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: j }) {
41
- function x(e, t) {
42
- return f(t) ? t.reduce((l, s) => l == null ? void 0 : l[s], e) : e == null ? void 0 : e[t];
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, l = !0) {
46
- var i;
46
+ function V(e, t, r = !0) {
47
+ var n;
47
48
  if (f(e)) {
48
- let r = n;
49
+ let l = s;
49
50
  for (let u = 0; u < e.length - 1; u++)
50
- e[u] in r || (r[e[u]] = {}), r = r[e[u]];
51
- 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;
52
53
  } else
53
- n[e] = t;
54
- let s = f(e) ? e[0] : e;
55
- l && ((i = o.onValuesChange) == null || i.call(o, { [s]: n[s] }, n, e)), y();
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 = b(), m = ie(ae()), v = b(
58
- o.syncToUrl ? _(o.syncToUrl, m, "get") : {}
62
+ const a = O(), v = ce(de()), p = ge(), I = O(
63
+ o.syncToUrl ? B(o.syncToUrl, v, "get") : {}
59
64
  );
60
- let p = oe(B()), d = {};
61
- const n = H(B());
65
+ let m = ae(M()), d = {};
66
+ const s = Q(M());
62
67
  let F = [];
63
- function B() {
68
+ function M() {
64
69
  const e = o.initialValues || {};
65
70
  return o.syncToUrlPriority ? {
66
71
  ...e,
67
- ...g(v)
72
+ ...h(I)
68
73
  } : {
69
- ...g(v),
74
+ ...h(I),
70
75
  ...e
71
76
  };
72
77
  }
73
- function A(e) {
74
- var l;
75
- const t = h(e, d);
76
- o.syncToUrl && w(m, _(o.syncToUrl, t, "set")), (l = o.onFinish) == null || l.call(o, 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);
77
82
  }
78
- const N = async () => {
83
+ const S = async () => {
79
84
  var e;
80
- (e = a.value) == null || e.resetFields(), await J(() => {
81
- Object.keys(n).forEach((t) => delete n[t]), Object.assign(n, p), y(), o.syncToUrl && w(
82
- m,
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
- h(p, d),
90
+ g(m, d),
86
91
  "set"
87
92
  )
88
93
  );
89
94
  });
90
- }, S = (e) => {
95
+ }, W = (e) => {
91
96
  var t;
92
97
  (t = a.value) == null || t.clearValidate(e);
93
- }, W = (e, t) => {
94
- var l;
95
- return (l = a.value) == null ? void 0 : l.validateFields(e, t);
96
- }, q = async (e, t) => {
97
- var s;
98
- const l = await ((s = a.value) == null ? void 0 : s.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(
99
104
  e,
100
105
  t
101
106
  ));
102
- return h(l, d);
103
- }, z = (e) => {
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
- }, C = (e) => {
107
- var l;
108
- const t = (l = a.value) == null ? void 0 : l.getFieldsValue(e);
109
- return h(t, d);
110
- }, D = (e, t) => {
111
- var l;
112
- return (l = a.value) == null ? void 0 : l.validate(e, t);
113
- }, L = (e, t = {}) => {
114
- var l;
115
- (l = a.value) == null || l.scrollToField(e, t);
116
- }, k = (e) => {
117
- Object.assign(n, e), y();
118
- }, I = (e, t, l = !0) => {
119
- V(e, t, l), y();
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(O(n)), F.push(e), () => {
123
- F = F.filter((l) => l !== e);
127
+ return t || e(j(s)), F.push(e), () => {
128
+ F = F.filter((r) => r !== e);
124
129
  };
125
130
  }
126
- function M({ initialValue: e, name: t, transform: l }) {
131
+ function b({ initialValue: e, name: t, transform: r }) {
127
132
  if (T(e) && T(t)) {
128
- const s = x(g(v), t);
129
- if (!T(s) || !o.syncToUrlPriority)
133
+ const i = C(h(I), t);
134
+ if (!T(i) || !o.syncToUrlPriority)
130
135
  if (V(t, e, !1), f(t)) {
131
- let i = p;
132
- for (let r = 0; r < t.length - 1; r++)
133
- T(i[t[r]]) || (i[t[r]] = {}), i = i[t[r]];
134
- i[t[t.length - 1]] = e;
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
- p[t] = e;
141
+ m[t] = e;
137
142
  }
138
- l && (d = ue(
143
+ r && (d = Fe(
139
144
  d,
140
145
  [t].flat(1),
141
- l,
146
+ r,
142
147
  !0
143
148
  ));
144
149
  }
145
- function K(e) {
146
- if (e !== ne) {
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: M,
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 = O(n);
163
+ const e = j(s);
158
164
  F.forEach((t) => {
159
165
  t(e);
160
166
  });
161
167
  }
162
168
  }
163
- function h(e, t) {
169
+ function g(e, t) {
164
170
  if (e == null)
165
171
  return;
166
- let l = f(e) ? [] : {};
167
- return Object.keys(e).forEach((s) => {
168
- const i = e[s], r = t == null ? void 0 : t[s], u = P(r) ? r : r == null ? void 0 : r.transformer, $ = P(r) ? !0 : r == null ? void 0 : r.flat;
169
- if (P(u)) {
170
- const c = u(i);
171
- $ ? f(c) && f(l) ? l = [...l, ...c] : R(c) && R(l) ? l = {
172
- ...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,
173
179
  ...c
174
- } : l[s] = c : l[s] = c;
175
- } else if (R(i) || f(i)) {
176
- const c = h(
177
- i,
178
- r
180
+ } : r[i] = c : r[i] = c;
181
+ } else if (_(n) || f(n)) {
182
+ const c = g(
183
+ n,
184
+ l
179
185
  );
180
- l[s] = c;
186
+ r[i] = c;
181
187
  } else
182
- l[s] = i;
183
- }), l;
188
+ r[i] = n;
189
+ }), r;
184
190
  }
185
- return re({
186
- model: Q(() => n),
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: M,
191
- setFieldValue: I
220
+ registerField: b,
221
+ setFieldValue: P
192
222
  }
193
- }), j({
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
- }, g(se)(o, ["initialValues", "onValuesChange", "onFinish"]), {
210
- model: n,
211
- onFinish: A
226
+ }, h(ue)(o, ["initialValues", "onValuesChange", "onFinish"]), {
227
+ model: s,
228
+ onFinish: N
212
229
  }), {
213
- default: ee(() => [
214
- te(e.$slots, "default")
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
- Ve as default
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, 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
  * 被注册的表单项