@aplus-frontend/ui 7.13.11 → 7.14.0

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 (115) hide show
  1. package/es/index.mjs +58 -56
  2. package/es/src/ap-field/select/index.vue.d.ts +8 -18
  3. package/es/src/ap-field/text/index.vue2.mjs +2 -2
  4. package/es/src/ap-field/text/password.vue.mjs +8 -8
  5. package/es/src/ap-form/ap-form.vue.d.ts +1 -0
  6. package/es/src/ap-form/ap-form.vue2.mjs +122 -106
  7. package/es/src/ap-form/drawer-form/index.vue.d.ts +4 -0
  8. package/es/src/ap-form/drawer-form/index.vue.mjs +13 -10
  9. package/es/src/ap-form/interface.d.ts +5 -0
  10. package/es/src/ap-form/item/index.vue.d.ts +1 -0
  11. package/es/src/ap-form/item/index.vue.mjs +84 -70
  12. package/es/src/ap-form/items/checkbox/index.vue.mjs +9 -8
  13. package/es/src/ap-form/items/date/index.vue.mjs +10 -9
  14. package/es/src/ap-form/items/date-range/index.vue.mjs +10 -9
  15. package/es/src/ap-form/items/number/index.vue.mjs +7 -6
  16. package/es/src/ap-form/items/radio/index.vue.mjs +9 -8
  17. package/es/src/ap-form/items/select/index.vue.d.ts +6 -6
  18. package/es/src/ap-form/items/select/index.vue.mjs +3 -2
  19. package/es/src/ap-form/items/switch/index.vue.mjs +10 -9
  20. package/es/src/ap-form/items/text/index.vue2.mjs +6 -5
  21. package/es/src/ap-form/items/text/password.vue.mjs +10 -9
  22. package/es/src/ap-form/items/text-area/index.vue.mjs +4 -3
  23. package/es/src/ap-form/items/tree-select/index.vue.mjs +1 -0
  24. package/es/src/ap-form/modal-form/index.vue.d.ts +4 -0
  25. package/es/src/ap-form/modal-form/index.vue.mjs +3 -0
  26. package/es/src/ap-form/render/item.vue.mjs +6 -5
  27. package/es/src/ap-form/search-form/index.vue.d.ts +4 -0
  28. package/es/src/ap-form/search-form/index.vue.mjs +26 -23
  29. package/es/src/ap-table/ap-table.vue2.mjs +2 -2
  30. package/es/src/ap-table/components/setting/index.d.ts +2 -0
  31. package/es/src/ap-table/components/setting/index.mjs +5 -0
  32. package/es/src/ap-table/components/setting/modal/index.vue.mjs +277 -2
  33. package/es/src/ap-table/components/setting/modal/index.vue2.mjs +2 -273
  34. package/es/src/ap-table/components/setting/select-group/index.vue2.mjs +11 -8
  35. package/es/src/ap-table/components/setting/template/edit-form.vue.d.ts +2 -0
  36. package/es/src/ap-table/components/setting/template/item.vue2.mjs +35 -35
  37. package/es/src/ap-table/constants.d.ts +3 -3
  38. package/es/src/ap-table/hooks/use-table-template-storage.mjs +55 -54
  39. package/es/src/ap-table/index.d.ts +2 -2
  40. package/es/src/ap-table/index.mjs +7 -6
  41. package/es/src/ap-table/interface.d.ts +16 -0
  42. package/es/src/business/ap-size-input/form-item.vue.mjs +6 -5
  43. package/es/src/business/ap-view/components/main-button-content.vue.d.ts +2 -0
  44. package/es/src/business/ap-view/components/menu-list-content.vue.d.ts +2 -0
  45. package/es/src/business/batch-input-group/form-item.vue.mjs +8 -7
  46. package/es/src/business/hooks/usePageListAgGrid.mjs +2 -2
  47. package/es/src/index.mjs +54 -52
  48. package/es/src/locale/lang/en.mjs +1 -0
  49. package/es/src/locale/lang/zh-cn.mjs +1 -0
  50. package/es/src/render/render.d.ts +7 -4
  51. package/es/src/render/render.mjs +17 -7
  52. package/es/src/splitter/SplitBar.vue2.mjs +7 -7
  53. package/es/src/splitter/hooks/sizeUtil.d.ts +3 -0
  54. package/es/src/splitter/hooks/sizeUtil.mjs +44 -0
  55. package/es/src/splitter/hooks/useSizes.mjs +38 -41
  56. package/es/src/version.d.ts +1 -1
  57. package/es/src/version.mjs +1 -1
  58. package/lib/index.js +1 -1
  59. package/lib/src/ap-field/select/index.vue.d.ts +8 -18
  60. package/lib/src/ap-field/text/index.vue2.js +1 -1
  61. package/lib/src/ap-field/text/password.vue.js +1 -1
  62. package/lib/src/ap-form/ap-form.vue.d.ts +1 -0
  63. package/lib/src/ap-form/ap-form.vue2.js +1 -1
  64. package/lib/src/ap-form/drawer-form/index.vue.d.ts +4 -0
  65. package/lib/src/ap-form/drawer-form/index.vue.js +1 -1
  66. package/lib/src/ap-form/interface.d.ts +5 -0
  67. package/lib/src/ap-form/item/index.vue.d.ts +1 -0
  68. package/lib/src/ap-form/item/index.vue.js +1 -1
  69. package/lib/src/ap-form/items/checkbox/index.vue.js +1 -1
  70. package/lib/src/ap-form/items/date/index.vue.js +1 -1
  71. package/lib/src/ap-form/items/date-range/index.vue.js +1 -1
  72. package/lib/src/ap-form/items/number/index.vue.js +1 -1
  73. package/lib/src/ap-form/items/radio/index.vue.js +1 -1
  74. package/lib/src/ap-form/items/select/index.vue.d.ts +6 -6
  75. package/lib/src/ap-form/items/select/index.vue.js +1 -1
  76. package/lib/src/ap-form/items/switch/index.vue.js +1 -1
  77. package/lib/src/ap-form/items/text/index.vue2.js +1 -1
  78. package/lib/src/ap-form/items/text/password.vue.js +1 -1
  79. package/lib/src/ap-form/items/text-area/index.vue.js +1 -1
  80. package/lib/src/ap-form/items/tree-select/index.vue.js +1 -1
  81. package/lib/src/ap-form/modal-form/index.vue.d.ts +4 -0
  82. package/lib/src/ap-form/modal-form/index.vue.js +1 -1
  83. package/lib/src/ap-form/render/item.vue.js +1 -1
  84. package/lib/src/ap-form/search-form/index.vue.d.ts +4 -0
  85. package/lib/src/ap-form/search-form/index.vue.js +1 -1
  86. package/lib/src/ap-table/ap-table.vue2.js +1 -1
  87. package/lib/src/ap-table/components/setting/index.d.ts +2 -0
  88. package/lib/src/ap-table/components/setting/index.js +1 -0
  89. package/lib/src/ap-table/components/setting/modal/index.vue.js +1 -1
  90. package/lib/src/ap-table/components/setting/modal/index.vue2.js +1 -1
  91. package/lib/src/ap-table/components/setting/select-group/index.vue2.js +1 -1
  92. package/lib/src/ap-table/components/setting/template/edit-form.vue.d.ts +2 -0
  93. package/lib/src/ap-table/components/setting/template/item.vue2.js +1 -1
  94. package/lib/src/ap-table/constants.d.ts +3 -3
  95. package/lib/src/ap-table/hooks/use-table-template-storage.js +1 -1
  96. package/lib/src/ap-table/index.d.ts +2 -2
  97. package/lib/src/ap-table/index.js +1 -1
  98. package/lib/src/ap-table/interface.d.ts +16 -0
  99. package/lib/src/business/ap-size-input/form-item.vue.js +1 -1
  100. package/lib/src/business/ap-view/components/main-button-content.vue.d.ts +2 -0
  101. package/lib/src/business/ap-view/components/menu-list-content.vue.d.ts +2 -0
  102. package/lib/src/business/batch-input-group/form-item.vue.js +1 -1
  103. package/lib/src/business/hooks/usePageListAgGrid.js +1 -1
  104. package/lib/src/index.js +1 -1
  105. package/lib/src/locale/lang/en.js +1 -1
  106. package/lib/src/locale/lang/zh-cn.js +1 -1
  107. package/lib/src/render/render.d.ts +7 -4
  108. package/lib/src/render/render.js +1 -1
  109. package/lib/src/splitter/SplitBar.vue2.js +1 -1
  110. package/lib/src/splitter/hooks/sizeUtil.d.ts +3 -0
  111. package/lib/src/splitter/hooks/sizeUtil.js +1 -0
  112. package/lib/src/splitter/hooks/useSizes.js +1 -1
  113. package/lib/src/version.d.ts +1 -1
  114. package/lib/src/version.js +1 -1
  115. package/package.json +3 -3
@@ -1,18 +1,20 @@
1
- import { defineComponent as Y, reactive as Z, shallowRef as z, ref as ee, unref as g, nextTick as te, toRaw as U, watch as re, onWatcherCleanup as oe, computed as ne, createBlock as ie, openBlock as le, mergeProps as ae, withCtx as se, renderSlot as ue } from "vue";
2
- import { Form as fe } from "@aplus-frontend/antdv";
3
- import { useUrlSearchParams as ce } from "@vueuse/core";
4
- import { isArray as P, cloneDeep as b, isEqual as de, omit as ge } from "lodash-unified";
5
- import { useDevWarning as pe } from "../utils/warning.mjs";
6
- import { getRouteType as me } from "../utils/index.mjs";
7
- import { INTERNAL_FORM_INSTANCE_MARK as E } from "./constant.mjs";
8
- import { useProvideForm as he } from "./context.mjs";
9
- import { useInjectFormProvider as Fe } from "./provider/context.mjs";
10
- import { getModelValue as x } from "./utils/get.mjs";
11
- import { genParams as R, setToParams as O } from "./utils/params.mjs";
12
- import ye from "./utils/set.mjs";
13
- import { transformValues as h } from "./utils/transform.mjs";
14
- import { isDef as F } from "../utils/is.mjs";
15
- const Ee = /* @__PURE__ */ Y({
1
+ import { defineComponent as re, reactive as oe, shallowRef as ne, ref as ie, unref as f, nextTick as le, toRaw as U, watch as ae, onWatcherCleanup as se, isVNode as ue, cloneVNode as ce, computed as fe, createBlock as b, openBlock as k, mergeProps as de, withCtx as E, renderSlot as N } from "vue";
2
+ import { Form as pe } from "@aplus-frontend/antdv";
3
+ import { useUrlSearchParams as ge } from "@vueuse/core";
4
+ import { isArray as R, cloneDeep as O, isEqual as me, omit as Fe } from "lodash-unified";
5
+ import "../render/index.mjs";
6
+ import { useDevWarning as he } from "../utils/warning.mjs";
7
+ import { getRouteType as ye } from "../utils/index.mjs";
8
+ import { INTERNAL_FORM_INSTANCE_MARK as W } from "./constant.mjs";
9
+ import { useProvideForm as Ve } from "./context.mjs";
10
+ import { useInjectFormProvider as Te } from "./provider/context.mjs";
11
+ import { getModelValue as j } from "./utils/get.mjs";
12
+ import { genParams as P, setToParams as S } from "./utils/params.mjs";
13
+ import ve from "./utils/set.mjs";
14
+ import { transformValues as F } from "./utils/transform.mjs";
15
+ import { isDef as h } from "../utils/is.mjs";
16
+ import Ie from "../render/render.mjs";
17
+ const Se = /* @__PURE__ */ re({
16
18
  name: "ApForm",
17
19
  __name: "ap-form",
18
20
  props: {
@@ -42,204 +44,218 @@ const Ee = /* @__PURE__ */ Y({
42
44
  initialValues: {},
43
45
  onValuesChange: {},
44
46
  syncToUrl: { type: [Boolean, Function], default: !1 },
45
- syncToUrlPriority: { type: Boolean }
47
+ syncToUrlPriority: { type: Boolean },
48
+ autoFocusFirstInput: { type: Boolean }
46
49
  },
47
- setup(W, { expose: j }) {
48
- const r = W;
50
+ setup(q, { expose: x }) {
51
+ const r = q;
49
52
  function y(e, t, o = !0, i) {
50
- if (P(e)) {
53
+ if (R(e)) {
51
54
  let l = n;
52
- for (let d = 0; d < e.length - 1; d++)
53
- e[d] in l || (l[e[d]] = {}), l = l[e[d]];
55
+ for (let p = 0; p < e.length - 1; p++)
56
+ e[p] in l || (l[e[p]] = {}), l = l[e[p]];
54
57
  i ? i(l, e[e.length - 1]) : l[e[e.length - 1]] = t;
55
58
  } else
56
59
  i ? i(n, e) : n[e] = t;
57
- let A = P(e) ? e[0] : e;
60
+ let A = R(e) ? e[0] : e;
58
61
  if (o) {
59
62
  const l = { [A]: n[A] };
60
- p.triggerFormChange(r.name, l), r.onValuesChange?.(l, n, e);
63
+ g.triggerFormChange(r.name, l), r.onValuesChange?.(l, n, e);
61
64
  }
62
65
  m();
63
66
  }
64
- const a = z(), T = ce(me()), p = Fe(), k = pe("ApForm"), V = ee(
65
- r.syncToUrl ? R(r.syncToUrl, T, "get") : {}
67
+ const a = ne(), V = ge(ye()), g = Te(), D = he("ApForm"), T = ie(
68
+ r.syncToUrl ? P(r.syncToUrl, V, "get") : {}
66
69
  );
67
- let s = b(M()), u = {};
68
- const n = Z(M());
69
- let c = [];
70
- function M() {
70
+ let s = O(B()), u = {};
71
+ const n = oe(B());
72
+ let d = [];
73
+ function B() {
71
74
  const e = r.initialValues || {};
72
75
  return r.syncToUrlPriority ? {
73
76
  ...e,
74
- ...g(V)
77
+ ...f(T)
75
78
  } : {
76
- ...g(V),
79
+ ...f(T),
77
80
  ...e
78
81
  };
79
82
  }
80
- function N(e) {
81
- const t = h(
83
+ function $(e) {
84
+ const t = F(
82
85
  e,
83
86
  u,
84
- f
87
+ c
85
88
  );
86
- p.triggerFormFinish(r.name, e), r.syncToUrl && O(T, R(r.syncToUrl, t, "set")), r.onFinish?.(t);
89
+ g.triggerFormFinish(r.name, e), r.syncToUrl && S(V, P(r.syncToUrl, t, "set")), r.onFinish?.(t);
87
90
  }
88
- const S = async () => {
89
- a.value?.resetFields(), await te(() => {
90
- Object.keys(n).forEach((e) => delete n[e]), Object.assign(n, b(s)), m(), r.syncToUrl && O(
91
- T,
92
- R(
91
+ const K = async () => {
92
+ a.value?.resetFields(), await le(() => {
93
+ Object.keys(n).forEach((e) => delete n[e]), Object.assign(n, O(s)), m(), r.syncToUrl && S(
94
+ V,
95
+ P(
93
96
  r.syncToUrl,
94
- h(
97
+ F(
95
98
  s,
96
99
  u,
97
- f
100
+ c
98
101
  ),
99
102
  "set"
100
103
  )
101
104
  );
102
105
  });
103
- }, q = (e) => {
106
+ }, L = (e) => {
104
107
  a.value?.clearValidate(e);
105
- }, D = (e, t) => a.value?.validateFields(e, t), K = async (e, t) => {
108
+ }, G = (e, t) => a.value?.validateFields(e, t), H = async (e, t) => {
106
109
  const o = await a.value?.validateFields(
107
110
  e,
108
111
  t
109
112
  );
110
- return h(
113
+ return F(
111
114
  o,
112
115
  u,
113
- f
116
+ c
114
117
  );
115
- }, f = (e) => e === !0 ? U(n) : a.value?.getFieldsValue(e), L = (e) => {
116
- const t = f(e);
117
- return h(t, u, f);
118
- }, $ = (e, t) => a.value?.validate(e, t), G = (e, t = {}) => {
118
+ }, c = (e) => e === !0 ? U(n) : a.value?.getFieldsValue(e), J = (e) => {
119
+ const t = c(e);
120
+ return F(t, u, c);
121
+ }, Q = (e, t) => a.value?.validate(e, t), X = (e, t = {}) => {
119
122
  a.value?.scrollToField(e, t);
120
- }, H = (e) => {
123
+ }, Y = (e) => {
121
124
  Object.assign(n, e), m();
122
125
  }, v = (e, t, o = !0, i) => {
123
126
  y(e, t, o, i), m();
124
127
  };
125
- function C(e) {
126
- return e(U(n)), c.push(e), () => {
127
- c = c.filter((t) => t !== e);
128
+ function I(e) {
129
+ return e(U(n)), d.push(e), () => {
130
+ d = d.filter((t) => t !== e);
128
131
  };
129
132
  }
130
- function I(e, t) {
131
- if (P(e)) {
133
+ function C(e, t) {
134
+ if (R(e)) {
132
135
  let o = s;
133
136
  for (let i = 0; i < e.length - 1; i++)
134
- F(o[e[i]]) || (o[e[i]] = {}), o = o[e[i]];
137
+ h(o[e[i]]) || (o[e[i]] = {}), o = o[e[i]];
135
138
  o[e[e.length - 1]] = t;
136
139
  } else
137
140
  s[e] = t;
138
141
  }
139
- function J(e, t) {
140
- if (!F(e) || !F(t))
142
+ function Z(e, t) {
143
+ if (!h(e) || !h(t))
141
144
  return;
142
- const o = x(s, t);
143
- if (de(o, e))
145
+ const o = j(s, t);
146
+ if (me(o, e))
144
147
  return;
145
- const i = x(g(V), t);
146
- F(i) && r.syncToUrlPriority || (y(t, e, !1), I(t, e));
148
+ const i = j(f(T), t);
149
+ h(i) && r.syncToUrlPriority || (y(t, e, !1), C(t, e));
147
150
  }
148
- function Q(e, t) {
149
- t && (u = ye(
151
+ function z(e, t) {
152
+ t && (u = ve(
150
153
  u,
151
154
  [e].flat(1),
152
155
  t,
153
156
  !0
154
157
  ));
155
158
  }
156
- function B({ initialValue: e, name: t, transform: o }) {
157
- J(e, t), Q(t, o);
159
+ function M({ initialValue: e, name: t, transform: o }) {
160
+ Z(e, t), z(t, o);
158
161
  }
159
- function _() {
162
+ function w() {
160
163
  return s;
161
164
  }
162
- function X(e) {
163
- if (k(
164
- e === E,
165
+ function ee(e) {
166
+ if (D(
167
+ e === W,
165
168
  "usage",
166
169
  "getInternalInstance should only used at internal"
167
- ), e === E)
170
+ ), e === W)
168
171
  return {
169
- registerField: B,
170
- registerWatch: C,
172
+ registerField: M,
173
+ registerWatch: I,
171
174
  setFieldValue: v,
172
- getInitialValues: _,
173
- updateInitialModel: I
175
+ getInitialValues: w,
176
+ updateInitialModel: C
174
177
  };
175
178
  }
176
179
  function m() {
177
- if (c.length) {
180
+ if (d.length) {
178
181
  const e = U(n);
179
- c.forEach((t) => {
182
+ d.forEach((t) => {
180
183
  t(e);
181
184
  });
182
185
  }
183
186
  }
184
- const w = {
185
- resetFields: S,
186
- clearValidate: q,
187
- validateFields: D,
188
- getFieldsValue: f,
189
- validate: $,
190
- scrollToField: G,
191
- setFieldsValue: H,
187
+ const _ = {
188
+ resetFields: K,
189
+ clearValidate: L,
190
+ validateFields: G,
191
+ getFieldsValue: c,
192
+ validate: Q,
193
+ scrollToField: X,
194
+ setFieldsValue: Y,
192
195
  setFieldValue: v,
193
- registerWatch: C,
194
- validateFieldsReturnTransformed: K,
195
- getFieldsValueTransformed: L,
196
- getInternalInstance: X
196
+ registerWatch: I,
197
+ validateFieldsReturnTransformed: H,
198
+ getFieldsValueTransformed: J,
199
+ getInternalInstance: ee
197
200
  };
198
- return re(
201
+ ae(
199
202
  () => r.name,
200
203
  (e) => {
201
- e && (p.registerForm(e, w), oe(() => {
202
- p.unregisterForm(r.name);
204
+ e && (g.registerForm(e, _), se(() => {
205
+ g.unregisterForm(r.name);
203
206
  }));
204
207
  },
205
208
  {
206
209
  immediate: !0
207
210
  }
208
- ), he({
209
- model: ne(() => n),
211
+ );
212
+ function te(e) {
213
+ return e.map((t, o) => o === 0 && ue(t) && r.autoFocusFirstInput ? ce(t, { autoFocus: r.autoFocusFirstInput }) : t);
214
+ }
215
+ return Ve({
216
+ model: fe(() => n),
210
217
  updateModel: y,
211
218
  internalInstance: {
212
- registerWatch: C,
213
- registerField: B,
219
+ registerWatch: I,
220
+ registerField: M,
214
221
  setFieldValue: v,
215
- getInitialValues: _,
216
- updateInitialModel: I
222
+ getInitialValues: w,
223
+ updateInitialModel: C
217
224
  }
218
- }), j(w), (e, t) => (le(), ie(g(fe), ae(
225
+ }), x(_), (e, t) => (k(), b(f(pe), de(
219
226
  {
220
227
  ref_key: "formRef",
221
228
  ref: a
222
229
  },
223
- g(ge)(r, [
230
+ f(Fe)(r, [
224
231
  "initialValues",
225
232
  "onValuesChange",
226
233
  "onFinish",
227
234
  "syncToUrl",
228
- "syncToUrlPriority"
235
+ "syncToUrlPriority",
236
+ "autoFocusFirstInput"
229
237
  ]),
230
238
  {
231
239
  model: n,
232
240
  "data-form-name": e.name,
233
- onFinish: N
241
+ onFinish: $
234
242
  }
235
243
  ), {
236
- default: se(() => [
237
- ue(e.$slots, "default")
244
+ default: E(() => [
245
+ e.autoFocusFirstInput ? (k(), b(f(Ie), {
246
+ key: 1,
247
+ renderer: te
248
+ }, {
249
+ default: E(() => [
250
+ N(e.$slots, "default")
251
+ ]),
252
+ _: 3
253
+ })) : N(e.$slots, "default", { key: 0 })
238
254
  ]),
239
255
  _: 3
240
256
  }, 16, ["model", "data-form-name"]));
241
257
  }
242
258
  });
243
259
  export {
244
- Ee as default
260
+ Se as default
245
261
  };
@@ -120,6 +120,7 @@ declare function __VLS_template(): {
120
120
  readonly onValuesChange?: ((changedValues: Recordable, allValues: Recordable, fieldName: NamePath) => void) | undefined;
121
121
  readonly syncToUrl?: boolean | ((values: Recordable, type: "get" | "set") => Recordable) | undefined;
122
122
  readonly syncToUrlPriority?: boolean | undefined;
123
+ readonly autoFocusFirstInput?: boolean | undefined;
123
124
  } & VNodeProps & AllowedComponentProps & ComponentCustomProps;
124
125
  $attrs: {
125
126
  [x: string]: unknown;
@@ -845,6 +846,7 @@ declare function __VLS_template(): {
845
846
  }> & {} & ComponentCustomProperties & {} & {
846
847
  $slots: {
847
848
  default?(_: {}): any;
849
+ default?(_: {}): any;
848
850
  };
849
851
  }) | null;
850
852
  };
@@ -1088,6 +1090,7 @@ declare const __VLS_component: DefineComponent<ApFormDrawerFormProps, {
1088
1090
  readonly onValuesChange?: ((changedValues: Recordable, allValues: Recordable, fieldName: NamePath) => void) | undefined;
1089
1091
  readonly syncToUrl?: boolean | ((values: Recordable, type: "get" | "set") => Recordable) | undefined;
1090
1092
  readonly syncToUrlPriority?: boolean | undefined;
1093
+ readonly autoFocusFirstInput?: boolean | undefined;
1091
1094
  } & VNodeProps & AllowedComponentProps & ComponentCustomProps;
1092
1095
  $attrs: {
1093
1096
  [x: string]: unknown;
@@ -1813,6 +1816,7 @@ declare const __VLS_component: DefineComponent<ApFormDrawerFormProps, {
1813
1816
  }> & {} & ComponentCustomProperties & {} & {
1814
1817
  $slots: {
1815
1818
  default?(_: {}): any;
1819
+ default?(_: {}): any;
1816
1820
  };
1817
1821
  }) | null;
1818
1822
  }, any>;
@@ -9,8 +9,8 @@ import "../ap-form.vue.mjs";
9
9
  import he from "../style/drawer-form.mjs";
10
10
  import { useControllableValue as ve } from "../../hooks/useControllableValue.mjs";
11
11
  import { useLocale as be } from "../../config-provider/hooks/use-locale.mjs";
12
- import { useNamespace as ge } from "../../config-provider/hooks/use-namespace.mjs";
13
- import Fe from "../ap-form.vue2.mjs";
12
+ import { useNamespace as Fe } from "../../config-provider/hooks/use-namespace.mjs";
13
+ import ge from "../ap-form.vue2.mjs";
14
14
  function L(r) {
15
15
  return typeof r == "function" || Object.prototype.toString.call(r) === "[object Object]" && !Q(r);
16
16
  }
@@ -67,6 +67,9 @@ const De = /* @__PURE__ */ Y({
67
67
  syncToUrlPriority: {
68
68
  type: Boolean
69
69
  },
70
+ autoFocusFirstInput: {
71
+ type: Boolean
72
+ },
70
73
  open: {
71
74
  type: Boolean,
72
75
  default: void 0
@@ -122,12 +125,12 @@ const De = /* @__PURE__ */ Y({
122
125
  resizeOnOpen: me(t.resize?.resizeOnOpen) ? e.onResize : t.resize.resizeOnOpen
123
126
  };
124
127
  }), u = y(T()), {
125
- t: g
128
+ t: F
126
129
  } = be(), D = he("ap-form-drawer-form"), {
127
130
  b: $,
128
131
  e: q,
129
132
  em: V
130
- } = ge("ap-form-drawer-form"), A = w(() => [q("resize-bar"), {
133
+ } = Fe("ap-form-drawer-form"), A = w(() => [q("resize-bar"), {
131
134
  [V("resize-bar", "min-disabled")]: n(u) === n(l).minWidth
132
135
  }, {
133
136
  [V("resize-bar", "max-disabled")]: n(u) === n(l).maxWidth
@@ -154,7 +157,7 @@ const De = /* @__PURE__ */ Y({
154
157
  e.push(s(z, {
155
158
  onClick: k,
156
159
  disabled: a.value
157
- }, L(i = g("ap.common.cancelText")) ? i : {
160
+ }, L(i = F("ap.common.cancelText")) ? i : {
158
161
  default: () => [i]
159
162
  }));
160
163
  }
@@ -163,7 +166,7 @@ const De = /* @__PURE__ */ Y({
163
166
  disabled: a.value,
164
167
  onClick: H
165
168
  }), {
166
- default: () => [t.submitter?.resetText || g("ap.common.resetText")]
169
+ default: () => [t.submitter?.resetText || F("ap.common.resetText")]
167
170
  })), t.submitter?.submitButtonProps !== !1 && e.push(s(z, p({
168
171
  type: "primary",
169
172
  key: "submit"
@@ -171,7 +174,7 @@ const De = /* @__PURE__ */ Y({
171
174
  loading: a.value,
172
175
  onClick: J
173
176
  }), {
174
- default: () => [t.submitter?.submitText || g("ap.common.okText")]
177
+ default: () => [t.submitter?.submitText || F("ap.common.okText")]
175
178
  })), s(le, {
176
179
  justify: "flex-end"
177
180
  }, {
@@ -185,8 +188,8 @@ const De = /* @__PURE__ */ Y({
185
188
  }
186
189
  function B(e) {
187
190
  const i = n(l), c = (document.body.offsetWidth || 1e3) - (e.clientX - document.body.offsetLeft), f = i?.minWidth ?? (t.width || 800), O = i?.maxWidth ?? window.innerWidth * 0.8;
188
- let F = c;
189
- c < f && (F = f), c > O && (F = O), u.value = F;
191
+ let g = c;
192
+ c < f && (g = f), c > O && (g = O), u.value = g;
190
193
  }
191
194
  function x() {
192
195
  document.removeEventListener("mousemove", B), document.removeEventListener("mouseup", x);
@@ -252,7 +255,7 @@ const De = /* @__PURE__ */ Y({
252
255
  }), {
253
256
  title: v(() => [_(e.$slots, "title", {}, () => [ae(se(t.title), 1)])]),
254
257
  footer: v(() => [(h(), S(I(X.value)))]),
255
- default: v(() => [s(Fe, p({
258
+ default: v(() => [s(ge, p({
256
259
  ref_key: "formRef",
257
260
  ref: o
258
261
  }, n(ce)(t, ["drawerProps", "open", "onUpdate:open", "title", "width", "onFinish", "submitter"])), {
@@ -50,6 +50,7 @@ export type ApFormItemProps = FormItemProps & Partial<ApFormColProps> & {
50
50
  * 是否禁用,禁用时将会有特殊样式,配合bordered=true使用生效
51
51
  */
52
52
  disabled?: boolean;
53
+ autoFocus?: boolean;
53
54
  };
54
55
  export type ApFormItemGroupProps = RowProps & {
55
56
  countPerRow?: number;
@@ -72,6 +73,10 @@ export type ApFormProps = Omit<FormProps, 'model' | 'onValuesChange'> & {
72
73
  * syncToUrl和initialValues合并是否优先,默认为false
73
74
  */
74
75
  syncToUrlPriority?: boolean;
76
+ /**
77
+ * 是否自动聚焦第一个控件(仅支持聚焦的控件)
78
+ */
79
+ autoFocusFirstInput?: boolean;
75
80
  };
76
81
  export type WatchFunc = (values?: Recordable) => void;
77
82
  export type UpdateModelOptimizeFn = (currentModelValue: any, name: string | number) => void;
@@ -802,6 +802,7 @@ declare const __VLS_component: DefineComponent<ApFormItemProps, {
802
802
  hasFeedback: boolean;
803
803
  autoLink: boolean;
804
804
  validateFirst: boolean;
805
+ autoFocus: boolean;
805
806
  valuePropName: string;
806
807
  }, {}, {}, {}, string, ComponentProvideOptions, false, {
807
808
  formItemRef: ({