@aplus-frontend/ui 0.2.10 → 0.2.11

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 (65) hide show
  1. package/es/src/ap-form/ap-form.vue.d.ts +4 -0
  2. package/es/src/ap-form/ap-form.vue2.mjs +131 -108
  3. package/es/src/ap-form/drawer-form/index.vue.d.ts +27 -2
  4. package/es/src/ap-form/drawer-form/index.vue.mjs +43 -37
  5. package/es/src/ap-form/interface.d.ts +8 -0
  6. package/es/src/ap-form/modal-form/index.vue.d.ts +27 -2
  7. package/es/src/ap-form/modal-form/index.vue.mjs +26 -20
  8. package/es/src/ap-form/search-form/index.vue.d.ts +27 -2
  9. package/es/src/ap-form/search-form/index.vue.mjs +37 -31
  10. package/es/src/ap-form/utils/params.d.ts +17 -0
  11. package/es/src/ap-form/utils/params.mjs +19 -0
  12. package/es/src/ap-table/interface.d.ts +1 -0
  13. package/es/src/business/ap-group-search/ap-group-search.vue.d.ts +3 -1
  14. package/es/src/business/ap-group-search/ap-group-search.vue2.mjs +80 -70
  15. package/es/src/business/ap-group-search/extension-select/index.vue.d.ts +6 -2
  16. package/es/src/business/ap-group-search/extension-select/index.vue2.mjs +44 -34
  17. package/es/src/business/ap-group-search/extension-select/style/css.d.ts +0 -0
  18. package/es/src/business/ap-group-search/extension-select/style/css.js +1 -0
  19. package/es/src/business/ap-group-search/extension-select/style/index.d.ts +0 -0
  20. package/es/src/business/ap-group-search/extension-select/style/index.js +1 -0
  21. package/es/src/business/ap-group-search/images/icon-line-select.vue.mjs +9 -9
  22. package/es/src/business/ap-group-search/index.d.ts +28 -0
  23. package/es/src/business/ap-group-search/popover-select/index.vue.d.ts +6 -2
  24. package/es/src/business/ap-group-search/popover-select/index.vue2.mjs +50 -50
  25. package/es/src/business/ap-group-search/popover-select/style/css.js +1 -1
  26. package/es/src/business/ap-group-search/popover-select/style/index.js +1 -1
  27. package/es/src/business/ap-summary/ap-summary.vue2.mjs +58 -38
  28. package/es/src/locale/lang/en.mjs +1 -1
  29. package/es/src/locale/lang/zh-cn.mjs +1 -1
  30. package/es/src/path-map.mjs +2 -1
  31. package/es/src/utils/index.d.ts +12 -0
  32. package/es/src/utils/index.mjs +27 -18
  33. package/lib/src/ap-form/ap-form.vue.d.ts +4 -0
  34. package/lib/src/ap-form/ap-form.vue2.js +1 -1
  35. package/lib/src/ap-form/drawer-form/index.vue.d.ts +27 -2
  36. package/lib/src/ap-form/drawer-form/index.vue.js +1 -1
  37. package/lib/src/ap-form/interface.d.ts +8 -0
  38. package/lib/src/ap-form/modal-form/index.vue.d.ts +27 -2
  39. package/lib/src/ap-form/modal-form/index.vue.js +1 -1
  40. package/lib/src/ap-form/search-form/index.vue.d.ts +27 -2
  41. package/lib/src/ap-form/search-form/index.vue.js +1 -1
  42. package/lib/src/ap-form/utils/params.d.ts +17 -0
  43. package/lib/src/ap-form/utils/params.js +1 -0
  44. package/lib/src/ap-table/interface.d.ts +1 -0
  45. package/lib/src/business/ap-group-search/ap-group-search.vue.d.ts +3 -1
  46. package/lib/src/business/ap-group-search/ap-group-search.vue2.js +1 -1
  47. package/lib/src/business/ap-group-search/extension-select/index.vue.d.ts +6 -2
  48. package/lib/src/business/ap-group-search/extension-select/index.vue2.js +1 -1
  49. package/lib/src/business/ap-group-search/extension-select/style/css.d.ts +0 -0
  50. package/lib/src/business/ap-group-search/extension-select/style/css.js +1 -0
  51. package/lib/src/business/ap-group-search/extension-select/style/index.d.ts +0 -0
  52. package/lib/src/business/ap-group-search/extension-select/style/index.js +1 -0
  53. package/lib/src/business/ap-group-search/images/icon-line-select.vue.js +1 -1
  54. package/lib/src/business/ap-group-search/index.d.ts +28 -0
  55. package/lib/src/business/ap-group-search/popover-select/index.vue.d.ts +6 -2
  56. package/lib/src/business/ap-group-search/popover-select/index.vue2.js +2 -2
  57. package/lib/src/business/ap-group-search/popover-select/style/css.js +1 -1
  58. package/lib/src/business/ap-group-search/popover-select/style/index.js +1 -1
  59. package/lib/src/business/ap-summary/ap-summary.vue2.js +1 -1
  60. package/lib/src/locale/lang/en.js +1 -1
  61. package/lib/src/locale/lang/zh-cn.js +1 -1
  62. package/lib/src/path-map.js +1 -1
  63. package/lib/src/utils/index.d.ts +12 -0
  64. package/lib/src/utils/index.js +1 -1
  65. package/package.json +4 -4
@@ -1,5 +1,6 @@
1
1
  import { ApFormProps, RegistedFieldType, WatchFunc } from './interface';
2
2
  import { InternalNamePath, NamePath, ValidateOptions, FormLabelAlign, RuleObject, ValidateMessages, FieldData, ValidateErrorEntity } from '@aplus-frontend/antdv/es/form/interface';
3
+ import { Recordable } from '../type';
3
4
  import { CreateComponentPublicInstance, ExtractPropTypes, PropType, HTMLAttributes, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, DefineComponent, PublicProps } from 'vue';
4
5
  import { VueTypeDef, VueTypeValidableDef } from '../../node_modules/vue-types';
5
6
  import { ColSize } from '@aplus-frontend/antdv/es/grid';
@@ -895,6 +896,7 @@ declare const __VLS_component: DefineComponent<__VLS_WithDefaults<__VLS_TypeProp
895
896
  labelAlign: string;
896
897
  validateOnRuleChange: boolean;
897
898
  validateTrigger: string;
899
+ syncToUrl: boolean;
898
900
  }>, {
899
901
  resetFields: () => Promise<void>;
900
902
  clearValidate: (name?: NamePath | NamePath[]) => void;
@@ -921,6 +923,7 @@ declare const __VLS_component: DefineComponent<__VLS_WithDefaults<__VLS_TypeProp
921
923
  labelAlign: string;
922
924
  validateOnRuleChange: boolean;
923
925
  validateTrigger: string;
926
+ syncToUrl: boolean;
924
927
  }>>>, {
925
928
  layout: string;
926
929
  colon: boolean;
@@ -928,6 +931,7 @@ declare const __VLS_component: DefineComponent<__VLS_WithDefaults<__VLS_TypeProp
928
931
  validateTrigger: string | string[];
929
932
  hideRequiredMark: boolean;
930
933
  validateOnRuleChange: boolean;
934
+ syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
931
935
  }, {}>;
932
936
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
933
937
  export default _default;
@@ -1,11 +1,13 @@
1
- import { defineComponent as D, ref as L, reactive as k, nextTick as K, toRaw as b, computed as $, openBlock as G, createBlock as H, unref as B, mergeProps as J, withCtx as Q, renderSlot as U } from "vue";
2
- import { Form as X } from "@aplus-frontend/antdv";
3
- import { useProvideForm as Y } from "./context.mjs";
4
- import { isArray as f, cloneDeep as I, isFunction as m, isPlainObject as _, omit as Z } from "lodash-unified";
5
- import { INTERNAL_FORM_INSTANCE_MARK as ee } from "./constant.mjs";
6
- import { isDef as y } from "../utils/index.mjs";
7
- import te from "./utils/set.mjs";
8
- const ue = /* @__PURE__ */ D({
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__ */ $({
9
11
  __name: "ap-form",
10
12
  props: {
11
13
  layout: { default: "horizontal" },
@@ -31,101 +33,122 @@ const ue = /* @__PURE__ */ D({
31
33
  onFinish: {},
32
34
  onFinishFailed: {},
33
35
  onValidate: {},
34
- initialValues: {}
36
+ initialValues: {},
37
+ syncToUrl: { type: [Boolean, Function], default: !1 },
38
+ syncToUrlPriority: { type: Boolean }
35
39
  },
36
- setup(M, { expose: O }) {
37
- const a = M;
38
- function g(e, t, l = !0) {
39
- var s;
40
+ setup(E, { expose: j }) {
41
+ const s = E;
42
+ function y(e, t, l = !0) {
43
+ var i;
40
44
  if (f(e)) {
41
- let o = r;
45
+ let r = n;
42
46
  for (let u = 0; u < e.length - 1; u++)
43
- e[u] in o || (o[e[u]] = {}), o = o[e[u]];
44
- o[e[e.length - 1]] = t;
47
+ e[u] in r || (r[e[u]] = {}), r = r[e[u]];
48
+ r[e[e.length - 1]] = t;
45
49
  } else
46
- r[e] = t;
47
- let i = f(e) ? e[0] : e;
48
- l && ((s = a.onValuesChange) == null || s.call(a, { [i]: r[i] }, r)), h();
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)), g();
53
+ }
54
+ const a = M(), v = se(ne()), B = M(
55
+ s.syncToUrl ? _(s.syncToUrl, v, "get") : {}
56
+ );
57
+ let h = oe(I()), d = {};
58
+ const n = G(I());
59
+ let F = [];
60
+ function I() {
61
+ const e = s.initialValues || {};
62
+ return s.syncToUrlPriority ? {
63
+ ...e,
64
+ ...m(B)
65
+ } : {
66
+ ...m(B),
67
+ ...e
68
+ };
49
69
  }
50
- function w(e) {
70
+ function x(e) {
51
71
  var l;
52
- const t = p(e, c);
53
- (l = a.onFinish) == null || l.call(a, t);
72
+ const t = p(e, d);
73
+ s.syncToUrl && w(v, _(s.syncToUrl, t, "set")), (l = s.onFinish) == null || l.call(s, t);
54
74
  }
55
- const n = L();
56
- let v = a.initialValues ? I(a.initialValues) : {}, c = {};
57
- const r = k(a.initialValues || {});
58
- let F = [];
59
- const E = async () => {
75
+ const A = async () => {
60
76
  var e;
61
- (e = n.value) == null || e.resetFields(), await K(() => {
62
- Object.keys(r).forEach((t) => delete r[t]), Object.assign(r, I(v)), h();
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(
79
+ v,
80
+ _(
81
+ s.syncToUrl,
82
+ p(h, d),
83
+ "set"
84
+ )
85
+ );
63
86
  });
64
- }, j = (e) => {
87
+ }, N = (e) => {
65
88
  var t;
66
- (t = n.value) == null || t.clearValidate(e);
67
- }, x = (e, t) => {
89
+ (t = a.value) == null || t.clearValidate(e);
90
+ }, S = (e, t) => {
68
91
  var l;
69
- return (l = n.value) == null ? void 0 : l.validateFields(e, t);
70
- }, A = async (e, t) => {
71
- var i;
72
- const l = await ((i = n.value) == null ? void 0 : i.validateFields(
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(
73
96
  e,
74
97
  t
75
98
  ));
76
- return p(l, c);
77
- }, N = (e) => {
99
+ return p(l, d);
100
+ }, q = (e) => {
78
101
  var t;
79
- return (t = n.value) == null ? void 0 : t.getFieldsValue(e);
80
- }, P = (e) => {
102
+ return (t = a.value) == null ? void 0 : t.getFieldsValue(e);
103
+ }, z = (e) => {
81
104
  var l;
82
- const t = (l = n.value) == null ? void 0 : l.getFieldsValue(e);
83
- return p(t, c);
84
- }, S = (e, t) => {
105
+ const t = (l = a.value) == null ? void 0 : l.getFieldsValue(e);
106
+ return p(t, d);
107
+ }, C = (e, t) => {
85
108
  var l;
86
- return (l = n.value) == null ? void 0 : l.validate(e, t);
87
- }, W = (e, t = {}) => {
109
+ return (l = a.value) == null ? void 0 : l.validate(e, t);
110
+ }, D = (e, t = {}) => {
88
111
  var l;
89
- (l = n.value) == null || l.scrollToField(e, t);
90
- }, q = (e) => {
91
- Object.assign(r, e), h();
92
- }, R = (e, t) => {
93
- g(e, t), h();
112
+ (l = a.value) == null || l.scrollToField(e, t);
113
+ }, L = (e) => {
114
+ Object.assign(n, e), g();
115
+ }, P = (e, t) => {
116
+ y(e, t), g();
94
117
  };
95
- function V(e, t) {
96
- return t || e(b(r)), F.push(e), () => {
118
+ function T(e, t) {
119
+ return t || e(O(n)), F.push(e), () => {
97
120
  F = F.filter((l) => l !== e);
98
121
  };
99
122
  }
100
- function T({ initialValue: e, name: t, transform: l }) {
101
- if (y(e) && y(t))
102
- if (g(t, e, !1), f(t)) {
103
- let i = v;
104
- for (let s = 0; s < t.length - 1; s++)
105
- y(i[t[s]]) || (i[t[s]] = {}), i = i[t[s]];
106
- i[t[t.length - 1]] = e;
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;
107
130
  } else
108
- v[t] = e;
109
- l && (c = te(
110
- c,
131
+ h[t] = e;
132
+ l && (d = ae(
133
+ d,
111
134
  [t].flat(1),
112
135
  l,
113
136
  !0
114
137
  ));
115
138
  }
116
- function z(e) {
117
- if (e !== ee) {
139
+ function k(e) {
140
+ if (e !== ie) {
118
141
  console.warn("getInternalInstance should only used at internal");
119
142
  return;
120
143
  }
121
144
  return {
122
- registerField: T,
123
- registerWatch: V
145
+ registerField: b,
146
+ registerWatch: T
124
147
  };
125
148
  }
126
- function h() {
149
+ function g() {
127
150
  if (F.length) {
128
- const e = b(r);
151
+ const e = O(n);
129
152
  F.forEach((t) => {
130
153
  t(e);
131
154
  });
@@ -135,59 +158,59 @@ const ue = /* @__PURE__ */ D({
135
158
  if (e == null)
136
159
  return;
137
160
  let l = f(e) ? [] : {};
138
- return Object.keys(e).forEach((i) => {
139
- const s = e[i], o = t == null ? void 0 : t[i], u = m(o) ? o : o == null ? void 0 : o.transformer, C = m(o) ? !0 : o == null ? void 0 : o.flat;
140
- if (m(u)) {
141
- const d = u(s);
142
- C ? f(d) && f(l) ? l = [...l, ...d] : _(d) && _(l) ? l = {
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 = {
143
166
  ...l,
144
- ...d
145
- } : l[i] = d : l[i] = d;
146
- } else if (_(s) || f(s)) {
147
- const d = p(
148
- s,
149
- o
167
+ ...c
168
+ } : l[o] = c : l[o] = c;
169
+ } else if (R(i) || f(i)) {
170
+ const c = p(
171
+ i,
172
+ r
150
173
  );
151
- l[i] = d;
174
+ l[o] = c;
152
175
  } else
153
- l[i] = s;
176
+ l[o] = i;
154
177
  }), l;
155
178
  }
156
- return Y({
157
- model: $(() => r),
158
- updateModel: g,
179
+ return le({
180
+ model: J(() => n),
181
+ updateModel: y,
159
182
  internalInstance: {
160
- registerWatch: V,
161
- registerField: T,
162
- setFieldValue: R
183
+ registerWatch: T,
184
+ registerField: b,
185
+ setFieldValue: P
163
186
  }
164
- }), O({
165
- resetFields: E,
166
- clearValidate: j,
167
- validateFields: x,
168
- getFieldsValue: N,
169
- validate: S,
170
- scrollToField: W,
171
- setFieldsValue: q,
172
- setFieldValue: R,
173
- registerWatch: V,
174
- validateFieldsReturnTransformed: A,
175
- getFieldsValueTransformed: P,
176
- getInternalInstance: z
177
- }), (e, t) => (G(), H(B(X), J({
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({
178
201
  ref_key: "formRef",
179
- ref: n
180
- }, B(Z)(a, ["initialValues", "onValuesChange", "onFinish"]), {
181
- onFinish: w,
182
- model: r
202
+ ref: a
203
+ }, m(re)(s, ["initialValues", "onValuesChange", "onFinish"]), {
204
+ onFinish: x,
205
+ model: n
183
206
  }), {
184
- default: Q(() => [
185
- U(e.$slots, "default")
207
+ default: Z(() => [
208
+ ee(e.$slots, "default")
186
209
  ]),
187
210
  _: 3
188
211
  }, 16, ["model"]));
189
212
  }
190
213
  });
191
214
  export {
192
- ue as default
215
+ ye as default
193
216
  };
@@ -1,11 +1,11 @@
1
1
  import { ApFormDrawerFormProps, CustomizeResizeType } from '../interface';
2
2
  import { VNode, ComponentInternalInstance, ExtractPropTypes, PropType, HTMLAttributes, VNodeProps, AllowedComponentProps, ComponentCustomProps, Slot, ComponentPublicInstance, ComponentOptionsBase, ComponentOptionsMixin, DebuggerEvent, nextTick, WatchOptions, WatchStopHandle, ShallowUnwrapRef, ComponentCustomProperties, DefineComponent, PublicProps, CSSProperties } from 'vue';
3
3
  import { InternalNamePath, NamePath, ValidateOptions, FormLabelAlign, ValidateMessages, FieldData, ValidateErrorEntity } from '@aplus-frontend/antdv/es/form/interface';
4
+ import { Recordable } from '../../type';
4
5
  import { RequiredMark } from '@aplus-frontend/antdv/es/form/Form';
5
6
  import { ColSize } from '@aplus-frontend/antdv/es/grid';
6
7
  import { RuleObject } from '@aplus-frontend/antdv/es/form';
7
8
  import { Options } from '../../../node_modules/scroll-into-view-if-needed';
8
- import { Recordable } from '../../type';
9
9
  import { WatchFunc, RegistedFieldType, ApFormInternalInstance, ApFormSubmitterConfig } from '..';
10
10
  import { VueTypeValidableDef, VueTypeDef } from '../../../node_modules/vue-types';
11
11
  import { PushState } from '@aplus-frontend/antdv/es/drawer';
@@ -29,6 +29,7 @@ declare function __VLS_template(): {
29
29
  validateTrigger: string | string[];
30
30
  hideRequiredMark: boolean;
31
31
  validateOnRuleChange: boolean;
32
+ syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
32
33
  }> & Omit<{
33
34
  readonly layout: string;
34
35
  readonly colon: boolean;
@@ -36,6 +37,7 @@ declare function __VLS_template(): {
36
37
  readonly validateTrigger: string | string[];
37
38
  readonly hideRequiredMark: boolean;
38
39
  readonly validateOnRuleChange: boolean;
40
+ readonly syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
39
41
  readonly size?: "small" | "large" | "middle" | undefined;
40
42
  readonly onSubmit?: ((e: Event) => void) | undefined;
41
43
  readonly disabled?: boolean | undefined;
@@ -120,6 +122,7 @@ declare function __VLS_template(): {
120
122
  readonly onFinishFailed?: ((errorInfo: ValidateErrorEntity<any>) => void) | undefined;
121
123
  readonly onValidate?: ((name: string | number | string[] | number[], status: boolean, errors: string[]) => void) | undefined;
122
124
  readonly initialValues?: Recordable | undefined;
125
+ readonly syncToUrlPriority?: boolean | undefined;
123
126
  } & VNodeProps & AllowedComponentProps & ComponentCustomProps & Readonly< ExtractPropTypes<{
124
127
  size: {
125
128
  type: PropType<"small" | "large" | "middle">;
@@ -265,7 +268,14 @@ declare function __VLS_template(): {
265
268
  initialValues: {
266
269
  type: PropType<Recordable>;
267
270
  };
268
- }>>, "layout" | "colon" | "labelAlign" | "validateTrigger" | "hideRequiredMark" | "validateOnRuleChange">;
271
+ syncToUrl: {
272
+ type: PropType<boolean | ((values: Recordable, type: "get" | "set") => Recordable)>;
273
+ default: boolean;
274
+ };
275
+ syncToUrlPriority: {
276
+ type: PropType<boolean>;
277
+ };
278
+ }>>, "layout" | "colon" | "labelAlign" | "validateTrigger" | "hideRequiredMark" | "validateOnRuleChange" | "syncToUrl">;
269
279
  $attrs: {
270
280
  [x: string]: unknown;
271
281
  };
@@ -424,6 +434,13 @@ declare function __VLS_template(): {
424
434
  initialValues: {
425
435
  type: PropType<Recordable>;
426
436
  };
437
+ syncToUrl: {
438
+ type: PropType<boolean | ((values: Recordable, type: "get" | "set") => Recordable)>;
439
+ default: boolean;
440
+ };
441
+ syncToUrlPriority: {
442
+ type: PropType<boolean>;
443
+ };
427
444
  }>>, {
428
445
  resetFields: () => Promise<void>;
429
446
  clearValidate: (name?: NamePath | NamePath[]) => void;
@@ -453,6 +470,7 @@ declare function __VLS_template(): {
453
470
  validateTrigger: string | string[];
454
471
  hideRequiredMark: boolean;
455
472
  validateOnRuleChange: boolean;
473
+ syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
456
474
  }, {}, string, {}> & {
457
475
  beforeCreate?: (() => void) | (() => void)[];
458
476
  created?: (() => void) | (() => void)[];
@@ -618,6 +636,13 @@ declare function __VLS_template(): {
618
636
  initialValues: {
619
637
  type: PropType<Recordable>;
620
638
  };
639
+ syncToUrl: {
640
+ type: PropType<boolean | ((values: Recordable, type: "get" | "set") => Recordable)>;
641
+ default: boolean;
642
+ };
643
+ syncToUrlPriority: {
644
+ type: PropType<boolean>;
645
+ };
621
646
  }>>, "validate" | "setFieldValue" | "setFieldsValue" | "resetFields" | "clearValidate" | "validateFields" | "getFieldsValue" | "scrollToField" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed" | "registerWatch"> & ShallowUnwrapRef<{
622
647
  resetFields: () => Promise<void>;
623
648
  clearValidate: (name?: NamePath | NamePath[]) => void;
@@ -1,19 +1,19 @@
1
- import { isVNode as K, defineComponent as Q, useSlots as Y, ref as v, computed as w, unref as l, watch as N, cloneVNode as Z, createVNode as d, mergeProps as b, openBlock as g, createElementBlock as P, Fragment as ee, withCtx as F, renderSlot as M, createTextVNode as te, toDisplayString as ie, createBlock as S, resolveDynamicComponent as _, normalizeClass as ne, withModifiers as oe, createCommentVNode as L } from "vue";
1
+ import { isVNode as K, defineComponent as Q, useSlots as Y, ref as v, computed as w, unref as l, watch as P, cloneVNode as Z, createVNode as d, mergeProps as b, openBlock as y, createElementBlock as N, Fragment as ee, withCtx as g, renderSlot as M, createTextVNode as te, toDisplayString as ie, createBlock as S, resolveDynamicComponent as _, normalizeClass as ne, withModifiers as oe, createCommentVNode as L } from "vue";
2
2
  import { Button as V, Flex as le, Space as ae, Drawer as se } from "@aplus-frontend/antdv";
3
3
  import "../ap-form.vue.mjs";
4
4
  import "../../hooks/index.mjs";
5
5
  import { getSingleVNode as re } from "../../utils/slot.mjs";
6
6
  import "../../config-provider/index.mjs";
7
- import { isBoolean as ue, isUndefined as de, omit as me } from "lodash-unified";
8
- import { convertReactiveToRaw as ce } from "../../utils/index.mjs";
7
+ import { isBoolean as ue, isUndefined as de, omit as ce } from "lodash-unified";
8
+ import { convertReactiveToRaw as me } from "../../utils/index.mjs";
9
9
  import { useControllableValue as fe } from "../../hooks/useControllableValue.mjs";
10
10
  import { useLocale as pe } from "../../config-provider/hooks/use-locale.mjs";
11
11
  import { useNamespace as he } from "../../config-provider/hooks/use-namespace.mjs";
12
12
  import ve from "../ap-form.vue2.mjs";
13
- function j(c) {
14
- return typeof c == "function" || Object.prototype.toString.call(c) === "[object Object]" && !K(c);
13
+ function U(m) {
14
+ return typeof m == "function" || Object.prototype.toString.call(m) === "[object Object]" && !K(m);
15
15
  }
16
- const Ee = /* @__PURE__ */ Q({
16
+ const je = /* @__PURE__ */ Q({
17
17
  __name: "index",
18
18
  props: {
19
19
  layout: {
@@ -58,6 +58,12 @@ const Ee = /* @__PURE__ */ Q({
58
58
  onFinishFailed: {},
59
59
  onValidate: {},
60
60
  initialValues: {},
61
+ syncToUrl: {
62
+ type: [Boolean, Function]
63
+ },
64
+ syncToUrlPriority: {
65
+ type: Boolean
66
+ },
61
67
  open: {
62
68
  type: Boolean,
63
69
  default: void 0
@@ -88,17 +94,17 @@ const Ee = /* @__PURE__ */ Q({
88
94
  }
89
95
  },
90
96
  emits: ["update:open"],
91
- setup(c, {
92
- expose: E,
93
- emit: U
97
+ setup(m, {
98
+ expose: j,
99
+ emit: E
94
100
  }) {
95
- const n = c, y = Y(), D = U, a = v(), p = v(), u = v(!1), {
101
+ const n = m, F = Y(), D = E, a = v(), p = v(), u = v(!1), {
96
102
  value: C,
97
103
  updateValue: h
98
104
  } = fe(n, D, {
99
105
  valuePropName: "open",
100
106
  defaultValue: !1
101
- }), m = w(() => {
107
+ }), c = w(() => {
102
108
  var t, i, s, r;
103
109
  const e = {
104
110
  onResize: () => {
@@ -113,29 +119,29 @@ const Ee = /* @__PURE__ */ Q({
113
119
  onResize: ((s = n.resize) == null ? void 0 : s.onResize) ?? e.onResize,
114
120
  resizeOnOpen: de((r = n.resize) == null ? void 0 : r.resizeOnOpen) ? e.onResize : n.resize.resizeOnOpen
115
121
  };
116
- }), f = v(x()), {
122
+ }), f = v(B()), {
117
123
  t: z
118
124
  } = pe(), {
119
125
  e: $,
120
126
  em: W
121
127
  } = he("ap-form-drawer-form"), q = w(() => [$("resize-bar"), {
122
- [W("resize-bar", "min-disabled")]: l(f) === l(m).minWidth
128
+ [W("resize-bar", "min-disabled")]: l(f) === l(c).minWidth
123
129
  }, {
124
- [W("resize-bar", "max-disabled")]: l(f) === l(m).maxWidth
130
+ [W("resize-bar", "max-disabled")]: l(f) === l(c).maxWidth
125
131
  }]);
126
- N(() => a.value, (e) => {
132
+ P(() => a.value, (e) => {
127
133
  var t;
128
134
  e && p.value && ((t = e.setFieldsValue) == null || t.call(e, p.value), p.value = void 0);
129
- }), N(() => l(C), (e) => {
135
+ }), P(() => l(C), (e) => {
130
136
  var t;
131
- e && (t = l(m)) != null && t.resizeOnOpen && (f.value = x());
137
+ e && (t = l(c)) != null && t.resizeOnOpen && (f.value = B());
132
138
  });
133
- function x() {
139
+ function B() {
134
140
  var t;
135
- const e = (t = l(m)) == null ? void 0 : t.minWidth;
141
+ const e = (t = l(c)) == null ? void 0 : t.minWidth;
136
142
  return !e || e && e < n.width ? n.width : e;
137
143
  }
138
- const B = re(y.trigger), k = B ? Z(B, {
144
+ const x = re(F.trigger), T = x ? Z(x, {
139
145
  onClick: () => {
140
146
  h(!0);
141
147
  }
@@ -149,7 +155,7 @@ const Ee = /* @__PURE__ */ Q({
149
155
  e.push(d(V, {
150
156
  onClick: R,
151
157
  disabled: u.value
152
- }, j(o = z("ap.common.cancelText")) ? o : {
158
+ }, U(o = z("ap.common.cancelText")) ? o : {
153
159
  default: () => [o]
154
160
  }));
155
161
  }
@@ -176,22 +182,22 @@ const Ee = /* @__PURE__ */ Q({
176
182
  })), d(le, {
177
183
  justify: "flex-end"
178
184
  }, {
179
- default: () => [y.submitter ? y.submitter(e) : d(ae, null, j(e) ? e : {
185
+ default: () => [F.submitter ? F.submitter(e) : d(ae, null, U(e) ? e : {
180
186
  default: () => [e]
181
187
  })]
182
188
  });
183
189
  });
184
190
  function A() {
185
191
  var e, t;
186
- (t = (e = m.value) == null ? void 0 : e.onResize) == null || t.call(e), document.addEventListener("mousemove", T), document.addEventListener("mouseup", O);
192
+ (t = (e = c.value) == null ? void 0 : e.onResize) == null || t.call(e), document.addEventListener("mousemove", k), document.addEventListener("mouseup", O);
187
193
  }
188
- function T(e) {
189
- const t = l(m), i = (document.body.offsetWidth || 1e3) - (e.clientX - document.body.offsetLeft), s = (t == null ? void 0 : t.minWidth) ?? (n.width || 800), r = (t == null ? void 0 : t.maxWidth) ?? window.innerWidth * 0.8;
194
+ function k(e) {
195
+ const t = l(c), i = (document.body.offsetWidth || 1e3) - (e.clientX - document.body.offsetLeft), s = (t == null ? void 0 : t.minWidth) ?? (n.width || 800), r = (t == null ? void 0 : t.maxWidth) ?? window.innerWidth * 0.8;
190
196
  let o = i;
191
197
  i < s && (o = s), i > r && (o = r), f.value = o;
192
198
  }
193
199
  function O() {
194
- document.removeEventListener("mousemove", T), document.removeEventListener("mouseup", O);
200
+ document.removeEventListener("mousemove", k), document.removeEventListener("mouseup", O);
195
201
  }
196
202
  function X() {
197
203
  var e, t, i;
@@ -203,7 +209,7 @@ const Ee = /* @__PURE__ */ Q({
203
209
  try {
204
210
  const r = await ((e = a.value) == null ? void 0 : e.validateFields());
205
211
  (i = (t = n.submitter) == null ? void 0 : t.onSubmit) == null || i.call(t), u.value = !0;
206
- const o = (s = n.onFinish) == null ? void 0 : s.call(n, ce(r));
212
+ const o = (s = n.onFinish) == null ? void 0 : s.call(n, me(r));
207
213
  if (n.submitTimeout && o instanceof Promise) {
208
214
  const J = setTimeout(() => u.value = !1, n.submitTimeout);
209
215
  o.finally(() => {
@@ -221,7 +227,7 @@ const Ee = /* @__PURE__ */ Q({
221
227
  function H(e) {
222
228
  !e && l(u) || h(e);
223
229
  }
224
- return E({
230
+ return j({
225
231
  resetFields: () => {
226
232
  var e;
227
233
  (e = a.value) == null || e.resetFields();
@@ -262,31 +268,31 @@ const Ee = /* @__PURE__ */ Q({
262
268
  var t;
263
269
  return (t = a.value) == null ? void 0 : t.getInternalInstance(e);
264
270
  }
265
- }), (e, t) => (g(), P(ee, null, [d(l(se), b(e.drawerProps, {
271
+ }), (e, t) => (y(), N(ee, null, [d(l(se), b(e.drawerProps, {
266
272
  open: l(C),
267
273
  "onUpdate:open": H,
268
274
  onCancel: R,
269
275
  width: f.value
270
276
  }), {
271
- title: F(() => [M(e.$slots, "title", {}, () => [te(ie(n.title), 1)])]),
272
- footer: F(() => [(g(), S(_(I.value)))]),
273
- default: F(() => [d(ve, b({
277
+ title: g(() => [M(e.$slots, "title", {}, () => [te(ie(n.title), 1)])]),
278
+ footer: g(() => [(y(), S(_(I.value)))]),
279
+ default: g(() => [d(ve, b({
274
280
  ref_key: "formRef",
275
281
  ref: a
276
- }, l(me)(n, ["drawerProps", "open", "onUpdate:open", "title", "width", "onFinish", "submitter"])), {
277
- default: F(() => [M(e.$slots, "default")]),
282
+ }, l(ce)(n, ["drawerProps", "open", "onUpdate:open", "title", "width", "onFinish", "submitter"])), {
283
+ default: g(() => [M(e.$slots, "default")]),
278
284
  _: 3
279
- }, 16), e.resize ? (g(), P("div", {
285
+ }, 16), e.resize ? (y(), N("div", {
280
286
  key: 0,
281
287
  class: ne(q.value),
282
288
  onMousedown: oe(A, ["stop", "prevent"])
283
289
  }, null, 34)) : L("", !0)]),
284
290
  _: 3
285
- }, 16, ["open", "width"]), l(k) ? (g(), S(_(l(k)), {
291
+ }, 16, ["open", "width"]), l(T) ? (y(), S(_(l(T)), {
286
292
  key: 0
287
293
  })) : L("", !0)], 64));
288
294
  }
289
295
  });
290
296
  export {
291
- Ee as default
297
+ je as default
292
298
  };
@@ -46,6 +46,14 @@ export type ApFormProps = Omit<FormProps, 'model'> & {
46
46
  * @returns
47
47
  */
48
48
  onValuesChange?: (changedValues: Recordable, allValues: Recordable) => void;
49
+ /**
50
+ * 同步表单数据到url中
51
+ */
52
+ syncToUrl?: boolean | ((values: Recordable, type: 'get' | 'set') => Recordable);
53
+ /**
54
+ * syncToUrl和initialValues合并是否优先,默认为false
55
+ */
56
+ syncToUrlPriority?: boolean;
49
57
  };
50
58
  export type WatchFunc = (values?: Recordable) => void;
51
59
  export type ApFormExpose<ModelType = any> = {