@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.
- package/es/index.mjs +58 -56
- package/es/src/ap-field/select/index.vue.d.ts +8 -18
- package/es/src/ap-field/text/index.vue2.mjs +2 -2
- package/es/src/ap-field/text/password.vue.mjs +8 -8
- package/es/src/ap-form/ap-form.vue.d.ts +1 -0
- package/es/src/ap-form/ap-form.vue2.mjs +122 -106
- package/es/src/ap-form/drawer-form/index.vue.d.ts +4 -0
- package/es/src/ap-form/drawer-form/index.vue.mjs +13 -10
- package/es/src/ap-form/interface.d.ts +5 -0
- package/es/src/ap-form/item/index.vue.d.ts +1 -0
- package/es/src/ap-form/item/index.vue.mjs +84 -70
- package/es/src/ap-form/items/checkbox/index.vue.mjs +9 -8
- package/es/src/ap-form/items/date/index.vue.mjs +10 -9
- package/es/src/ap-form/items/date-range/index.vue.mjs +10 -9
- package/es/src/ap-form/items/number/index.vue.mjs +7 -6
- package/es/src/ap-form/items/radio/index.vue.mjs +9 -8
- package/es/src/ap-form/items/select/index.vue.d.ts +6 -6
- package/es/src/ap-form/items/select/index.vue.mjs +3 -2
- package/es/src/ap-form/items/switch/index.vue.mjs +10 -9
- package/es/src/ap-form/items/text/index.vue2.mjs +6 -5
- package/es/src/ap-form/items/text/password.vue.mjs +10 -9
- package/es/src/ap-form/items/text-area/index.vue.mjs +4 -3
- package/es/src/ap-form/items/tree-select/index.vue.mjs +1 -0
- package/es/src/ap-form/modal-form/index.vue.d.ts +4 -0
- package/es/src/ap-form/modal-form/index.vue.mjs +3 -0
- package/es/src/ap-form/render/item.vue.mjs +6 -5
- package/es/src/ap-form/search-form/index.vue.d.ts +4 -0
- package/es/src/ap-form/search-form/index.vue.mjs +26 -23
- package/es/src/ap-table/ap-table.vue2.mjs +2 -2
- package/es/src/ap-table/components/setting/index.d.ts +2 -0
- package/es/src/ap-table/components/setting/index.mjs +5 -0
- package/es/src/ap-table/components/setting/modal/index.vue.mjs +277 -2
- package/es/src/ap-table/components/setting/modal/index.vue2.mjs +2 -273
- package/es/src/ap-table/components/setting/select-group/index.vue2.mjs +11 -8
- package/es/src/ap-table/components/setting/template/edit-form.vue.d.ts +2 -0
- package/es/src/ap-table/components/setting/template/item.vue2.mjs +35 -35
- package/es/src/ap-table/constants.d.ts +3 -3
- package/es/src/ap-table/hooks/use-table-template-storage.mjs +55 -54
- package/es/src/ap-table/index.d.ts +2 -2
- package/es/src/ap-table/index.mjs +7 -6
- package/es/src/ap-table/interface.d.ts +16 -0
- package/es/src/business/ap-size-input/form-item.vue.mjs +6 -5
- package/es/src/business/ap-view/components/main-button-content.vue.d.ts +2 -0
- package/es/src/business/ap-view/components/menu-list-content.vue.d.ts +2 -0
- package/es/src/business/batch-input-group/form-item.vue.mjs +8 -7
- package/es/src/business/hooks/usePageListAgGrid.mjs +2 -2
- package/es/src/index.mjs +54 -52
- package/es/src/locale/lang/en.mjs +1 -0
- package/es/src/locale/lang/zh-cn.mjs +1 -0
- package/es/src/render/render.d.ts +7 -4
- package/es/src/render/render.mjs +17 -7
- package/es/src/splitter/SplitBar.vue2.mjs +7 -7
- package/es/src/splitter/hooks/sizeUtil.d.ts +3 -0
- package/es/src/splitter/hooks/sizeUtil.mjs +44 -0
- package/es/src/splitter/hooks/useSizes.mjs +38 -41
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/lib/index.js +1 -1
- package/lib/src/ap-field/select/index.vue.d.ts +8 -18
- package/lib/src/ap-field/text/index.vue2.js +1 -1
- package/lib/src/ap-field/text/password.vue.js +1 -1
- package/lib/src/ap-form/ap-form.vue.d.ts +1 -0
- package/lib/src/ap-form/ap-form.vue2.js +1 -1
- package/lib/src/ap-form/drawer-form/index.vue.d.ts +4 -0
- package/lib/src/ap-form/drawer-form/index.vue.js +1 -1
- package/lib/src/ap-form/interface.d.ts +5 -0
- package/lib/src/ap-form/item/index.vue.d.ts +1 -0
- package/lib/src/ap-form/item/index.vue.js +1 -1
- package/lib/src/ap-form/items/checkbox/index.vue.js +1 -1
- package/lib/src/ap-form/items/date/index.vue.js +1 -1
- package/lib/src/ap-form/items/date-range/index.vue.js +1 -1
- package/lib/src/ap-form/items/number/index.vue.js +1 -1
- package/lib/src/ap-form/items/radio/index.vue.js +1 -1
- package/lib/src/ap-form/items/select/index.vue.d.ts +6 -6
- package/lib/src/ap-form/items/select/index.vue.js +1 -1
- package/lib/src/ap-form/items/switch/index.vue.js +1 -1
- package/lib/src/ap-form/items/text/index.vue2.js +1 -1
- package/lib/src/ap-form/items/text/password.vue.js +1 -1
- package/lib/src/ap-form/items/text-area/index.vue.js +1 -1
- package/lib/src/ap-form/items/tree-select/index.vue.js +1 -1
- package/lib/src/ap-form/modal-form/index.vue.d.ts +4 -0
- package/lib/src/ap-form/modal-form/index.vue.js +1 -1
- package/lib/src/ap-form/render/item.vue.js +1 -1
- package/lib/src/ap-form/search-form/index.vue.d.ts +4 -0
- package/lib/src/ap-form/search-form/index.vue.js +1 -1
- package/lib/src/ap-table/ap-table.vue2.js +1 -1
- package/lib/src/ap-table/components/setting/index.d.ts +2 -0
- package/lib/src/ap-table/components/setting/index.js +1 -0
- package/lib/src/ap-table/components/setting/modal/index.vue.js +1 -1
- package/lib/src/ap-table/components/setting/modal/index.vue2.js +1 -1
- package/lib/src/ap-table/components/setting/select-group/index.vue2.js +1 -1
- package/lib/src/ap-table/components/setting/template/edit-form.vue.d.ts +2 -0
- package/lib/src/ap-table/components/setting/template/item.vue2.js +1 -1
- package/lib/src/ap-table/constants.d.ts +3 -3
- package/lib/src/ap-table/hooks/use-table-template-storage.js +1 -1
- package/lib/src/ap-table/index.d.ts +2 -2
- package/lib/src/ap-table/index.js +1 -1
- package/lib/src/ap-table/interface.d.ts +16 -0
- package/lib/src/business/ap-size-input/form-item.vue.js +1 -1
- package/lib/src/business/ap-view/components/main-button-content.vue.d.ts +2 -0
- package/lib/src/business/ap-view/components/menu-list-content.vue.d.ts +2 -0
- package/lib/src/business/batch-input-group/form-item.vue.js +1 -1
- package/lib/src/business/hooks/usePageListAgGrid.js +1 -1
- package/lib/src/index.js +1 -1
- package/lib/src/locale/lang/en.js +1 -1
- package/lib/src/locale/lang/zh-cn.js +1 -1
- package/lib/src/render/render.d.ts +7 -4
- package/lib/src/render/render.js +1 -1
- package/lib/src/splitter/SplitBar.vue2.js +1 -1
- package/lib/src/splitter/hooks/sizeUtil.d.ts +3 -0
- package/lib/src/splitter/hooks/sizeUtil.js +1 -0
- package/lib/src/splitter/hooks/useSizes.js +1 -1
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +3 -3
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Form as
|
|
3
|
-
import { useUrlSearchParams as
|
|
4
|
-
import { isArray as
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
|
|
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(
|
|
48
|
-
const r =
|
|
50
|
+
setup(q, { expose: x }) {
|
|
51
|
+
const r = q;
|
|
49
52
|
function y(e, t, o = !0, i) {
|
|
50
|
-
if (
|
|
53
|
+
if (R(e)) {
|
|
51
54
|
let l = n;
|
|
52
|
-
for (let
|
|
53
|
-
e[
|
|
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 =
|
|
60
|
+
let A = R(e) ? e[0] : e;
|
|
58
61
|
if (o) {
|
|
59
62
|
const l = { [A]: n[A] };
|
|
60
|
-
|
|
63
|
+
g.triggerFormChange(r.name, l), r.onValuesChange?.(l, n, e);
|
|
61
64
|
}
|
|
62
65
|
m();
|
|
63
66
|
}
|
|
64
|
-
const a =
|
|
65
|
-
r.syncToUrl ?
|
|
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 =
|
|
68
|
-
const n =
|
|
69
|
-
let
|
|
70
|
-
function
|
|
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
|
-
...
|
|
77
|
+
...f(T)
|
|
75
78
|
} : {
|
|
76
|
-
...
|
|
79
|
+
...f(T),
|
|
77
80
|
...e
|
|
78
81
|
};
|
|
79
82
|
}
|
|
80
|
-
function
|
|
81
|
-
const t =
|
|
83
|
+
function $(e) {
|
|
84
|
+
const t = F(
|
|
82
85
|
e,
|
|
83
86
|
u,
|
|
84
|
-
|
|
87
|
+
c
|
|
85
88
|
);
|
|
86
|
-
|
|
89
|
+
g.triggerFormFinish(r.name, e), r.syncToUrl && S(V, P(r.syncToUrl, t, "set")), r.onFinish?.(t);
|
|
87
90
|
}
|
|
88
|
-
const
|
|
89
|
-
a.value?.resetFields(), await
|
|
90
|
-
Object.keys(n).forEach((e) => delete n[e]), Object.assign(n,
|
|
91
|
-
|
|
92
|
-
|
|
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
|
-
|
|
97
|
+
F(
|
|
95
98
|
s,
|
|
96
99
|
u,
|
|
97
|
-
|
|
100
|
+
c
|
|
98
101
|
),
|
|
99
102
|
"set"
|
|
100
103
|
)
|
|
101
104
|
);
|
|
102
105
|
});
|
|
103
|
-
},
|
|
106
|
+
}, L = (e) => {
|
|
104
107
|
a.value?.clearValidate(e);
|
|
105
|
-
},
|
|
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
|
|
113
|
+
return F(
|
|
111
114
|
o,
|
|
112
115
|
u,
|
|
113
|
-
|
|
116
|
+
c
|
|
114
117
|
);
|
|
115
|
-
},
|
|
116
|
-
const t =
|
|
117
|
-
return
|
|
118
|
-
},
|
|
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
|
-
},
|
|
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
|
|
126
|
-
return e(U(n)),
|
|
127
|
-
|
|
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
|
|
131
|
-
if (
|
|
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
|
-
|
|
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
|
|
140
|
-
if (!
|
|
142
|
+
function Z(e, t) {
|
|
143
|
+
if (!h(e) || !h(t))
|
|
141
144
|
return;
|
|
142
|
-
const o =
|
|
143
|
-
if (
|
|
145
|
+
const o = j(s, t);
|
|
146
|
+
if (me(o, e))
|
|
144
147
|
return;
|
|
145
|
-
const i =
|
|
146
|
-
|
|
148
|
+
const i = j(f(T), t);
|
|
149
|
+
h(i) && r.syncToUrlPriority || (y(t, e, !1), C(t, e));
|
|
147
150
|
}
|
|
148
|
-
function
|
|
149
|
-
t && (u =
|
|
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
|
|
157
|
-
|
|
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
|
|
163
|
-
if (
|
|
164
|
-
e ===
|
|
165
|
+
function ee(e) {
|
|
166
|
+
if (D(
|
|
167
|
+
e === W,
|
|
165
168
|
"usage",
|
|
166
169
|
"getInternalInstance should only used at internal"
|
|
167
|
-
), e ===
|
|
170
|
+
), e === W)
|
|
168
171
|
return {
|
|
169
|
-
registerField:
|
|
170
|
-
registerWatch:
|
|
172
|
+
registerField: M,
|
|
173
|
+
registerWatch: I,
|
|
171
174
|
setFieldValue: v,
|
|
172
|
-
getInitialValues:
|
|
173
|
-
updateInitialModel:
|
|
175
|
+
getInitialValues: w,
|
|
176
|
+
updateInitialModel: C
|
|
174
177
|
};
|
|
175
178
|
}
|
|
176
179
|
function m() {
|
|
177
|
-
if (
|
|
180
|
+
if (d.length) {
|
|
178
181
|
const e = U(n);
|
|
179
|
-
|
|
182
|
+
d.forEach((t) => {
|
|
180
183
|
t(e);
|
|
181
184
|
});
|
|
182
185
|
}
|
|
183
186
|
}
|
|
184
|
-
const
|
|
185
|
-
resetFields:
|
|
186
|
-
clearValidate:
|
|
187
|
-
validateFields:
|
|
188
|
-
getFieldsValue:
|
|
189
|
-
validate:
|
|
190
|
-
scrollToField:
|
|
191
|
-
setFieldsValue:
|
|
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:
|
|
194
|
-
validateFieldsReturnTransformed:
|
|
195
|
-
getFieldsValueTransformed:
|
|
196
|
-
getInternalInstance:
|
|
196
|
+
registerWatch: I,
|
|
197
|
+
validateFieldsReturnTransformed: H,
|
|
198
|
+
getFieldsValueTransformed: J,
|
|
199
|
+
getInternalInstance: ee
|
|
197
200
|
};
|
|
198
|
-
|
|
201
|
+
ae(
|
|
199
202
|
() => r.name,
|
|
200
203
|
(e) => {
|
|
201
|
-
e && (
|
|
202
|
-
|
|
204
|
+
e && (g.registerForm(e, _), se(() => {
|
|
205
|
+
g.unregisterForm(r.name);
|
|
203
206
|
}));
|
|
204
207
|
},
|
|
205
208
|
{
|
|
206
209
|
immediate: !0
|
|
207
210
|
}
|
|
208
|
-
)
|
|
209
|
-
|
|
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:
|
|
213
|
-
registerField:
|
|
219
|
+
registerWatch: I,
|
|
220
|
+
registerField: M,
|
|
214
221
|
setFieldValue: v,
|
|
215
|
-
getInitialValues:
|
|
216
|
-
updateInitialModel:
|
|
222
|
+
getInitialValues: w,
|
|
223
|
+
updateInitialModel: C
|
|
217
224
|
}
|
|
218
|
-
}),
|
|
225
|
+
}), x(_), (e, t) => (k(), b(f(pe), de(
|
|
219
226
|
{
|
|
220
227
|
ref_key: "formRef",
|
|
221
228
|
ref: a
|
|
222
229
|
},
|
|
223
|
-
|
|
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:
|
|
241
|
+
onFinish: $
|
|
234
242
|
}
|
|
235
243
|
), {
|
|
236
|
-
default:
|
|
237
|
-
|
|
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
|
-
|
|
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
|
|
13
|
-
import
|
|
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:
|
|
128
|
+
t: F
|
|
126
129
|
} = be(), D = he("ap-form-drawer-form"), {
|
|
127
130
|
b: $,
|
|
128
131
|
e: q,
|
|
129
132
|
em: V
|
|
130
|
-
} =
|
|
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 =
|
|
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 ||
|
|
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 ||
|
|
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
|
|
189
|
-
c < 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(
|
|
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: ({
|