@aplus-frontend/ui 6.13.2 → 6.13.4
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/src/ap-form/ap-form.vue2.mjs +123 -120
- package/es/src/ap-form/dependency/index.vue.mjs +26 -28
- package/es/src/ap-form/hooks/use-watch.mjs +28 -31
- package/es/src/ap-form/interface.d.ts +5 -0
- package/es/src/ap-form/search-form/hooks/use-collapse-input-count.mjs +22 -24
- package/es/src/ap-form/utils/get.d.ts +2 -0
- package/es/src/ap-form/utils/get.mjs +12 -7
- package/es/src/ap-grid/editable/form-item.vue.mjs +84 -87
- package/es/src/ap-grid/index.vue.mjs +137 -134
- package/es/src/ap-grid/interface.d.ts +6 -0
- package/es/src/ap-table/ap-table.vue.d.ts +1 -0
- package/es/src/ap-table/ap-table.vue2.mjs +189 -186
- package/es/src/ap-table/context.d.ts +1 -0
- package/es/src/ap-table/hooks/use-table-paging-ng.d.ts +1 -0
- package/es/src/ap-table/hooks/use-table-paging-ng.mjs +89 -89
- package/es/src/business/ap-table-modal/index.d.ts +1 -0
- package/es/src/business/ap-table-modal/table-modal.vue.d.ts +1 -0
- package/es/src/business/ap-view/ap-view.vue2.mjs +68 -68
- package/es/src/business/ap-view/interface.d.ts +1 -1
- package/es/src/business/batch-input-group/form-item.vue.mjs +34 -28
- package/es/src/business/batch-input-group/popover-input/index.vue2.mjs +9 -7
- package/es/src/editable-table/form-item.vue.mjs +78 -81
- package/es/src/locale/lang/en.mjs +1 -1
- package/es/src/locale/lang/zh-cn.mjs +1 -1
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/lib/src/ap-form/ap-form.vue2.js +1 -1
- package/lib/src/ap-form/dependency/index.vue.js +1 -1
- package/lib/src/ap-form/hooks/use-watch.js +1 -1
- package/lib/src/ap-form/interface.d.ts +5 -0
- package/lib/src/ap-form/search-form/hooks/use-collapse-input-count.js +1 -1
- package/lib/src/ap-form/utils/get.d.ts +2 -0
- package/lib/src/ap-form/utils/get.js +1 -1
- package/lib/src/ap-grid/editable/form-item.vue.js +1 -1
- package/lib/src/ap-grid/index.vue.js +1 -1
- package/lib/src/ap-grid/interface.d.ts +6 -0
- package/lib/src/ap-table/ap-table.vue.d.ts +1 -0
- package/lib/src/ap-table/ap-table.vue2.js +1 -1
- package/lib/src/ap-table/context.d.ts +1 -0
- package/lib/src/ap-table/hooks/use-table-paging-ng.d.ts +1 -0
- package/lib/src/ap-table/hooks/use-table-paging-ng.js +1 -1
- package/lib/src/business/ap-table-modal/index.d.ts +1 -0
- package/lib/src/business/ap-table-modal/table-modal.vue.d.ts +1 -0
- package/lib/src/business/ap-view/ap-view.vue2.js +1 -1
- package/lib/src/business/ap-view/interface.d.ts +1 -1
- package/lib/src/business/batch-input-group/form-item.vue.js +1 -1
- package/lib/src/business/batch-input-group/popover-input/index.vue2.js +2 -2
- package/lib/src/editable-table/form-item.vue.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/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +3 -3
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Form as
|
|
3
|
-
import { useProvideForm as
|
|
4
|
-
import { isArray as
|
|
1
|
+
import { defineComponent as z, reactive as ee, ref as x, unref as p, nextTick as te, toRaw as R, watch as re, onWatcherCleanup as le, computed as oe, createBlock as ie, openBlock as ne, mergeProps as se, withCtx as ae, renderSlot as ue } from "vue";
|
|
2
|
+
import { Form as ce } from "@aplus-frontend/antdv";
|
|
3
|
+
import { useProvideForm as fe } from "./context.mjs";
|
|
4
|
+
import { isArray as d, cloneDeep as de, isEqual as ge, isFunction as B, isPlainObject as _, omit as me } from "lodash-unified";
|
|
5
5
|
import { useUrlSearchParams as Fe } from "@vueuse/core";
|
|
6
6
|
import { INTERNAL_FORM_INSTANCE_MARK as he } from "./constant.mjs";
|
|
7
7
|
import { getRouteType as pe, isDef as V } from "../utils/index.mjs";
|
|
8
|
-
import
|
|
8
|
+
import ye from "./utils/set.mjs";
|
|
9
9
|
import { genParams as b, setToParams as C } from "./utils/params.mjs";
|
|
10
|
-
import { useInjectFormProvider as
|
|
11
|
-
|
|
10
|
+
import { useInjectFormProvider as Te } from "./provider/context.mjs";
|
|
11
|
+
import { getModelValue as N } from "./utils/get.mjs";
|
|
12
|
+
const Ee = /* @__PURE__ */ z({
|
|
12
13
|
name: "ApForm",
|
|
13
14
|
__name: "ap-form",
|
|
14
15
|
props: {
|
|
@@ -39,203 +40,205 @@ const be = /* @__PURE__ */ Z({
|
|
|
39
40
|
syncToUrl: { type: [Boolean, Function], default: !1 },
|
|
40
41
|
syncToUrlPriority: { type: Boolean }
|
|
41
42
|
},
|
|
42
|
-
setup(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
for (let d = 0; d < e.length - 1; d++)
|
|
52
|
-
e[d] in s || (s[e[d]] = {}), s = s[e[d]];
|
|
53
|
-
i ? i(s, e[e.length - 1]) : s[e[e.length - 1]] = t;
|
|
43
|
+
setup(S, { expose: W }) {
|
|
44
|
+
const o = S;
|
|
45
|
+
function v(e, t, r = !0, l) {
|
|
46
|
+
var n;
|
|
47
|
+
if (d(e)) {
|
|
48
|
+
let s = i;
|
|
49
|
+
for (let f = 0; f < e.length - 1; f++)
|
|
50
|
+
e[f] in s || (s[e[f]] = {}), s = s[e[f]];
|
|
51
|
+
l ? l(s, e[e.length - 1]) : s[e[e.length - 1]] = t;
|
|
54
52
|
} else
|
|
55
|
-
|
|
56
|
-
let u =
|
|
53
|
+
l ? l(i, e) : i[e] = t;
|
|
54
|
+
let u = d(e) ? e[0] : e;
|
|
57
55
|
if (r) {
|
|
58
|
-
const s = { [u]:
|
|
59
|
-
y.triggerFormChange(
|
|
56
|
+
const s = { [u]: i[u] };
|
|
57
|
+
y.triggerFormChange(o.name, s), (n = o.onValuesChange) == null || n.call(o, s, i, e);
|
|
60
58
|
}
|
|
61
59
|
T();
|
|
62
60
|
}
|
|
63
|
-
const a = x(),
|
|
64
|
-
|
|
61
|
+
const a = x(), I = Fe(pe()), y = Te(), U = x(
|
|
62
|
+
o.syncToUrl ? b(o.syncToUrl, I, "get") : {}
|
|
65
63
|
);
|
|
66
|
-
let
|
|
67
|
-
const
|
|
68
|
-
let
|
|
69
|
-
function
|
|
70
|
-
const e =
|
|
71
|
-
return
|
|
64
|
+
let g = de(w()), m = {};
|
|
65
|
+
const i = ee(w());
|
|
66
|
+
let F = [];
|
|
67
|
+
function w() {
|
|
68
|
+
const e = o.initialValues || {};
|
|
69
|
+
return o.syncToUrlPriority ? {
|
|
72
70
|
...e,
|
|
73
|
-
...
|
|
71
|
+
...p(U)
|
|
74
72
|
} : {
|
|
75
|
-
...
|
|
73
|
+
...p(U),
|
|
76
74
|
...e
|
|
77
75
|
};
|
|
78
76
|
}
|
|
79
|
-
function
|
|
77
|
+
function q(e) {
|
|
80
78
|
var r;
|
|
81
|
-
const t =
|
|
82
|
-
y.triggerFormFinish(
|
|
79
|
+
const t = h(e, m);
|
|
80
|
+
y.triggerFormFinish(o.name, e), o.syncToUrl && C(I, b(o.syncToUrl, t, "set")), (r = o.onFinish) == null || r.call(o, t);
|
|
83
81
|
}
|
|
84
|
-
const
|
|
82
|
+
const D = async () => {
|
|
85
83
|
var e;
|
|
86
|
-
(e = a.value) == null || e.resetFields(), await
|
|
87
|
-
Object.keys(
|
|
88
|
-
|
|
84
|
+
(e = a.value) == null || e.resetFields(), await te(() => {
|
|
85
|
+
Object.keys(i).forEach((t) => delete i[t]), Object.assign(i, g), T(), o.syncToUrl && C(
|
|
86
|
+
I,
|
|
89
87
|
b(
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
o.syncToUrl,
|
|
89
|
+
h(g, m),
|
|
92
90
|
"set"
|
|
93
91
|
)
|
|
94
92
|
);
|
|
95
93
|
});
|
|
96
|
-
},
|
|
94
|
+
}, k = (e) => {
|
|
97
95
|
var t;
|
|
98
96
|
(t = a.value) == null || t.clearValidate(e);
|
|
99
|
-
},
|
|
97
|
+
}, K = (e, t) => {
|
|
100
98
|
var r;
|
|
101
99
|
return (r = a.value) == null ? void 0 : r.validateFields(e, t);
|
|
102
|
-
},
|
|
103
|
-
var
|
|
104
|
-
const r = await ((
|
|
100
|
+
}, L = async (e, t) => {
|
|
101
|
+
var l;
|
|
102
|
+
const r = await ((l = a.value) == null ? void 0 : l.validateFields(
|
|
105
103
|
e,
|
|
106
104
|
t
|
|
107
105
|
));
|
|
108
|
-
return
|
|
109
|
-
},
|
|
106
|
+
return h(r, m);
|
|
107
|
+
}, E = (e) => {
|
|
110
108
|
var t;
|
|
111
|
-
return e === !0 ? R(
|
|
112
|
-
},
|
|
113
|
-
const t =
|
|
114
|
-
return
|
|
115
|
-
},
|
|
109
|
+
return e === !0 ? R(i) : (t = a.value) == null ? void 0 : t.getFieldsValue(e);
|
|
110
|
+
}, $ = (e) => {
|
|
111
|
+
const t = E(e);
|
|
112
|
+
return h(t, m);
|
|
113
|
+
}, G = (e, t) => {
|
|
116
114
|
var r;
|
|
117
115
|
return (r = a.value) == null ? void 0 : r.validate(e, t);
|
|
118
|
-
},
|
|
116
|
+
}, H = (e, t = {}) => {
|
|
119
117
|
var r;
|
|
120
118
|
(r = a.value) == null || r.scrollToField(e, t);
|
|
121
|
-
},
|
|
122
|
-
Object.assign(
|
|
123
|
-
}, P = (e, t, r = !0,
|
|
124
|
-
|
|
119
|
+
}, J = (e) => {
|
|
120
|
+
Object.assign(i, e), T();
|
|
121
|
+
}, P = (e, t, r = !0, l) => {
|
|
122
|
+
v(e, t, r, l), T();
|
|
125
123
|
};
|
|
126
124
|
function M(e, t) {
|
|
127
|
-
return t || e(R(
|
|
128
|
-
|
|
125
|
+
return t || e(R(i)), F.push(e), () => {
|
|
126
|
+
F = F.filter((r) => r !== e);
|
|
129
127
|
};
|
|
130
128
|
}
|
|
131
|
-
function
|
|
132
|
-
if (
|
|
133
|
-
let r =
|
|
134
|
-
for (let
|
|
135
|
-
V(r[e[
|
|
129
|
+
function Q(e, t) {
|
|
130
|
+
if (d(e)) {
|
|
131
|
+
let r = g;
|
|
132
|
+
for (let l = 0; l < e.length - 1; l++)
|
|
133
|
+
V(r[e[l]]) || (r[e[l]] = {}), r = r[e[l]];
|
|
136
134
|
r[e[e.length - 1]] = t;
|
|
137
135
|
} else
|
|
138
|
-
|
|
136
|
+
g[e] = t;
|
|
139
137
|
}
|
|
140
|
-
function
|
|
138
|
+
function X(e, t) {
|
|
141
139
|
if (!V(e) || !V(t))
|
|
142
140
|
return;
|
|
143
|
-
const r =
|
|
144
|
-
if (
|
|
141
|
+
const r = N(g, t);
|
|
142
|
+
if (ge(r, e))
|
|
145
143
|
return;
|
|
146
|
-
const
|
|
147
|
-
V(
|
|
144
|
+
const l = N(p(U), t);
|
|
145
|
+
V(l) && o.syncToUrlPriority || (v(t, e, !1), Q(t, e));
|
|
148
146
|
}
|
|
149
|
-
function
|
|
150
|
-
t && (
|
|
151
|
-
|
|
147
|
+
function Y(e, t) {
|
|
148
|
+
t && (m = ye(
|
|
149
|
+
m,
|
|
152
150
|
[e].flat(1),
|
|
153
151
|
t,
|
|
154
152
|
!0
|
|
155
153
|
));
|
|
156
154
|
}
|
|
157
|
-
function
|
|
158
|
-
|
|
155
|
+
function O({ initialValue: e, name: t, transform: r }) {
|
|
156
|
+
X(e, t), Y(t, r);
|
|
157
|
+
}
|
|
158
|
+
function j() {
|
|
159
|
+
return g;
|
|
159
160
|
}
|
|
160
|
-
function
|
|
161
|
+
function Z(e) {
|
|
161
162
|
if (e !== he) {
|
|
162
163
|
console.warn("getInternalInstance should only used at internal");
|
|
163
164
|
return;
|
|
164
165
|
}
|
|
165
166
|
return {
|
|
166
|
-
registerField:
|
|
167
|
+
registerField: O,
|
|
167
168
|
registerWatch: M,
|
|
168
|
-
setFieldValue: P
|
|
169
|
+
setFieldValue: P,
|
|
170
|
+
getInitialValues: j
|
|
169
171
|
};
|
|
170
172
|
}
|
|
171
173
|
function T() {
|
|
172
|
-
if (
|
|
173
|
-
const e = R(
|
|
174
|
-
|
|
174
|
+
if (F.length) {
|
|
175
|
+
const e = R(i);
|
|
176
|
+
F.forEach((t) => {
|
|
175
177
|
t(e);
|
|
176
178
|
});
|
|
177
179
|
}
|
|
178
180
|
}
|
|
179
|
-
function
|
|
181
|
+
function h(e, t) {
|
|
180
182
|
if (e == null)
|
|
181
183
|
return;
|
|
182
|
-
let r =
|
|
183
|
-
return Object.keys(e).forEach((
|
|
184
|
-
const u = e[
|
|
184
|
+
let r = d(e) ? [] : {};
|
|
185
|
+
return Object.keys(e).forEach((l) => {
|
|
186
|
+
const u = e[l], n = t == null ? void 0 : t[l], s = B(n) ? n : n == null ? void 0 : n.transformer, f = B(n) ? !0 : n == null ? void 0 : n.flat;
|
|
185
187
|
if (B(s)) {
|
|
186
188
|
const c = s(u);
|
|
187
|
-
|
|
189
|
+
f ? d(c) && d(r) ? r = [...r, ...c] : _(c) && _(r) ? r = {
|
|
188
190
|
...r,
|
|
189
191
|
...c
|
|
190
|
-
} : r[
|
|
191
|
-
} else if (_(u) ||
|
|
192
|
-
const c =
|
|
192
|
+
} : r[l] = c : r[l] = c;
|
|
193
|
+
} else if (_(u) || d(u)) {
|
|
194
|
+
const c = h(
|
|
193
195
|
u,
|
|
194
|
-
|
|
196
|
+
n
|
|
195
197
|
);
|
|
196
|
-
r[
|
|
198
|
+
r[l] = c;
|
|
197
199
|
} else
|
|
198
|
-
r[
|
|
200
|
+
r[l] = u;
|
|
199
201
|
}), r;
|
|
200
202
|
}
|
|
201
203
|
const A = {
|
|
202
|
-
resetFields:
|
|
203
|
-
clearValidate:
|
|
204
|
-
validateFields:
|
|
205
|
-
getFieldsValue:
|
|
206
|
-
validate:
|
|
207
|
-
scrollToField:
|
|
208
|
-
setFieldsValue:
|
|
204
|
+
resetFields: D,
|
|
205
|
+
clearValidate: k,
|
|
206
|
+
validateFields: K,
|
|
207
|
+
getFieldsValue: E,
|
|
208
|
+
validate: G,
|
|
209
|
+
scrollToField: H,
|
|
210
|
+
setFieldsValue: J,
|
|
209
211
|
setFieldValue: P,
|
|
210
212
|
registerWatch: M,
|
|
211
|
-
validateFieldsReturnTransformed:
|
|
212
|
-
getFieldsValueTransformed:
|
|
213
|
-
getInternalInstance:
|
|
213
|
+
validateFieldsReturnTransformed: L,
|
|
214
|
+
getFieldsValueTransformed: $,
|
|
215
|
+
getInternalInstance: Z
|
|
214
216
|
};
|
|
215
|
-
return
|
|
216
|
-
() =>
|
|
217
|
+
return re(
|
|
218
|
+
() => o.name,
|
|
217
219
|
(e) => {
|
|
218
|
-
e && (y.registerForm(e, A),
|
|
219
|
-
y.unregisterForm(
|
|
220
|
+
e && (y.registerForm(e, A), le(() => {
|
|
221
|
+
y.unregisterForm(o.name);
|
|
220
222
|
}));
|
|
221
223
|
},
|
|
222
224
|
{
|
|
223
225
|
immediate: !0
|
|
224
226
|
}
|
|
225
|
-
),
|
|
226
|
-
model:
|
|
227
|
-
updateModel:
|
|
227
|
+
), fe({
|
|
228
|
+
model: oe(() => i),
|
|
229
|
+
updateModel: v,
|
|
228
230
|
internalInstance: {
|
|
229
231
|
registerWatch: M,
|
|
230
|
-
registerField:
|
|
231
|
-
setFieldValue: P
|
|
232
|
+
registerField: O,
|
|
233
|
+
setFieldValue: P,
|
|
234
|
+
getInitialValues: j
|
|
232
235
|
}
|
|
233
|
-
}),
|
|
236
|
+
}), W(A), (e, t) => (ne(), ie(p(ce), se(
|
|
234
237
|
{
|
|
235
238
|
ref_key: "formRef",
|
|
236
239
|
ref: a
|
|
237
240
|
},
|
|
238
|
-
|
|
241
|
+
p(me)(o, [
|
|
239
242
|
"initialValues",
|
|
240
243
|
"onValuesChange",
|
|
241
244
|
"onFinish",
|
|
@@ -243,18 +246,18 @@ const be = /* @__PURE__ */ Z({
|
|
|
243
246
|
"syncToUrlPriority"
|
|
244
247
|
]),
|
|
245
248
|
{
|
|
246
|
-
model:
|
|
249
|
+
model: i,
|
|
247
250
|
"data-form-name": e.name,
|
|
248
|
-
onFinish:
|
|
251
|
+
onFinish: q
|
|
249
252
|
}
|
|
250
253
|
), {
|
|
251
|
-
default:
|
|
252
|
-
|
|
254
|
+
default: ae(() => [
|
|
255
|
+
ue(e.$slots, "default")
|
|
253
256
|
]),
|
|
254
257
|
_: 3
|
|
255
258
|
}, 16, ["model", "data-form-name"]));
|
|
256
259
|
}
|
|
257
260
|
});
|
|
258
261
|
export {
|
|
259
|
-
|
|
262
|
+
Ee as default
|
|
260
263
|
};
|
|
@@ -1,43 +1,41 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useInjectForm as
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { defineComponent as p, ref as i, watchEffect as d, unref as v, renderSlot as _ } from "vue";
|
|
2
|
+
import { useInjectForm as g } from "../context.mjs";
|
|
3
|
+
import { isNumber as h, cloneDeep as y } from "lodash-unified";
|
|
4
|
+
import { getModelValue as V } from "../utils/get.mjs";
|
|
5
|
+
const D = /* @__PURE__ */ p({
|
|
5
6
|
name: "ApFormDependency",
|
|
6
7
|
__name: "index",
|
|
7
8
|
props: {
|
|
8
9
|
nameList: {}
|
|
9
10
|
},
|
|
10
|
-
setup(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const r = e[s];
|
|
21
|
-
if (s === e.length - 1)
|
|
22
|
-
t[r] = o;
|
|
11
|
+
setup(a) {
|
|
12
|
+
const c = a, {
|
|
13
|
+
model: f
|
|
14
|
+
} = g(), r = i({});
|
|
15
|
+
function u(e, s, l) {
|
|
16
|
+
let t = s;
|
|
17
|
+
for (let o = 0; o < e.length; o++) {
|
|
18
|
+
const n = e[o];
|
|
19
|
+
if (o === e.length - 1)
|
|
20
|
+
t[n] = l;
|
|
23
21
|
else {
|
|
24
|
-
const
|
|
25
|
-
(typeof t[
|
|
22
|
+
const m = e[o + 1];
|
|
23
|
+
(typeof t[n] != "object" || t[n] === null) && (t[n] = h(m) ? [] : {}), t = t[n];
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
26
|
}
|
|
29
|
-
return
|
|
30
|
-
const e =
|
|
31
|
-
for (const
|
|
32
|
-
const
|
|
33
|
-
|
|
27
|
+
return d(() => {
|
|
28
|
+
const e = y(r.value);
|
|
29
|
+
for (const s of c.nameList) {
|
|
30
|
+
const l = [s].flat(1), t = V(v(f), l);
|
|
31
|
+
u(l, e, t);
|
|
34
32
|
}
|
|
35
|
-
|
|
36
|
-
}), (e,
|
|
37
|
-
values:
|
|
33
|
+
r.value = e;
|
|
34
|
+
}), (e, s) => _(e.$slots, "default", {
|
|
35
|
+
values: r.value
|
|
38
36
|
});
|
|
39
37
|
}
|
|
40
38
|
});
|
|
41
39
|
export {
|
|
42
|
-
|
|
40
|
+
D as default
|
|
43
41
|
};
|
|
@@ -1,42 +1,39 @@
|
|
|
1
|
-
import { useInjectForm as
|
|
2
|
-
import { ref as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
function
|
|
6
|
-
return E(t) ? t.reduce((n, l) => n == null ? void 0 : n[l], e) : e == null ? void 0 : e[t];
|
|
7
|
-
}
|
|
8
|
-
function V(e) {
|
|
1
|
+
import { useInjectForm as N } from "../context.mjs";
|
|
2
|
+
import { ref as M, watchEffect as R, unref as f, watch as A } from "vue";
|
|
3
|
+
import { INTERNAL_FORM_INSTANCE_MARK as E } from "../constant.mjs";
|
|
4
|
+
import { getModelValue as w } from "../utils/get.mjs";
|
|
5
|
+
function V(a) {
|
|
9
6
|
try {
|
|
10
|
-
return JSON.stringify(
|
|
7
|
+
return JSON.stringify(a);
|
|
11
8
|
} catch {
|
|
12
9
|
return Math.random();
|
|
13
10
|
}
|
|
14
11
|
}
|
|
15
|
-
function
|
|
16
|
-
const { internalInstance:
|
|
17
|
-
let
|
|
18
|
-
const
|
|
19
|
-
return
|
|
20
|
-
var
|
|
21
|
-
const
|
|
22
|
-
if (!
|
|
23
|
-
|
|
12
|
+
function C(a, e, c) {
|
|
13
|
+
const { internalInstance: I, model: S } = N(), s = (c == null ? void 0 : c.initialValue) || (e == null ? void 0 : e.initialValue) || void 0, u = M(s);
|
|
14
|
+
let n = V(s), v = !0;
|
|
15
|
+
const r = e && "value" in e ? e : void 0;
|
|
16
|
+
return R((i) => {
|
|
17
|
+
var d;
|
|
18
|
+
const t = ((d = r == null ? void 0 : r.value) == null ? void 0 : d.getInternalInstance(E)) || I;
|
|
19
|
+
if (!t) {
|
|
20
|
+
v = !1;
|
|
24
21
|
return;
|
|
25
22
|
}
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
}),
|
|
32
|
-
() =>
|
|
33
|
-
(
|
|
34
|
-
const
|
|
35
|
-
|
|
23
|
+
const l = t.registerWatch((o) => {
|
|
24
|
+
const g = w(o, f(a)), h = V(g);
|
|
25
|
+
h !== n && (u.value = g, n = h);
|
|
26
|
+
}, v);
|
|
27
|
+
i(l);
|
|
28
|
+
}), A(
|
|
29
|
+
() => f(a),
|
|
30
|
+
(i) => {
|
|
31
|
+
const t = w(f(S), i), l = V(t);
|
|
32
|
+
l !== n && (u.value = t, n = l);
|
|
36
33
|
}
|
|
37
|
-
),
|
|
34
|
+
), u;
|
|
38
35
|
}
|
|
39
36
|
export {
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
C as default,
|
|
38
|
+
C as useWatch
|
|
42
39
|
};
|
|
@@ -129,6 +129,11 @@ export type ApFormInternalInstance = {
|
|
|
129
129
|
* @returns
|
|
130
130
|
*/
|
|
131
131
|
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
132
|
+
/**
|
|
133
|
+
* 获取表单的初始值(随着表单项组件的注册,initialValues可能会发生改变)
|
|
134
|
+
* @returns
|
|
135
|
+
*/
|
|
136
|
+
getInitialValues: () => Recordable;
|
|
132
137
|
};
|
|
133
138
|
export type ApFormItemExpose = FormItemExpose & {
|
|
134
139
|
/**
|
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
import { computed as
|
|
1
|
+
import { computed as a } from "vue";
|
|
2
2
|
import { useInjectForm as d } from "../../context.mjs";
|
|
3
|
-
import { isArray as
|
|
3
|
+
import { isArray as F, isObject as g, isFunction as h } from "lodash-unified";
|
|
4
4
|
import "../../../config-provider/index.mjs";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
function c(t) {
|
|
5
|
+
import { getModelValue as y } from "../../utils/get.mjs";
|
|
6
|
+
import { useGlobalConfig as C } from "../../../config-provider/hooks/use-global-config.mjs";
|
|
7
|
+
function s(t) {
|
|
10
8
|
if (t == null)
|
|
11
9
|
return !1;
|
|
12
10
|
if (typeof t == "string")
|
|
13
11
|
return t.trim() !== "";
|
|
14
|
-
if (
|
|
15
|
-
return t.some((
|
|
12
|
+
if (F(t))
|
|
13
|
+
return t.some((e) => s(e));
|
|
16
14
|
if (g(t)) {
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
15
|
+
const o = Object.keys(t);
|
|
16
|
+
if (o.length === 0)
|
|
19
17
|
return !1;
|
|
20
|
-
for (const
|
|
21
|
-
if (
|
|
18
|
+
for (const e of o)
|
|
19
|
+
if (s(t[e]))
|
|
22
20
|
return !0;
|
|
23
21
|
return !1;
|
|
24
22
|
}
|
|
@@ -27,21 +25,21 @@ function c(t) {
|
|
|
27
25
|
function b(t) {
|
|
28
26
|
return h(t.type) ? t.type() : t;
|
|
29
27
|
}
|
|
30
|
-
const
|
|
31
|
-
const { model:
|
|
28
|
+
const E = (t) => {
|
|
29
|
+
const { model: o } = d(), e = C("searchForm");
|
|
32
30
|
return {
|
|
33
|
-
count:
|
|
34
|
-
let
|
|
35
|
-
return t.value.forEach((
|
|
36
|
-
var
|
|
37
|
-
const
|
|
38
|
-
!
|
|
39
|
-
}),
|
|
31
|
+
count: a(() => {
|
|
32
|
+
let i = 0;
|
|
33
|
+
return t.value.forEach((m) => {
|
|
34
|
+
var f;
|
|
35
|
+
const r = b(m.node), p = [r.props.name].flat(1), l = y(o == null ? void 0 : o.value, p), c = r.props.customFilled || r.props["custom-filled"], n = (f = e.value) == null ? void 0 : f.customFilled;
|
|
36
|
+
!c && n ? n != null && n(r, l) && (i += 1) : (c || s)(l) && (i += 1);
|
|
37
|
+
}), i;
|
|
40
38
|
})
|
|
41
39
|
};
|
|
42
40
|
};
|
|
43
41
|
export {
|
|
44
|
-
|
|
42
|
+
s as defaultFilled,
|
|
45
43
|
b as getTargetNode,
|
|
46
|
-
|
|
44
|
+
E as useCollapseInputCount
|
|
47
45
|
};
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { isArray as n } from "lodash-unified";
|
|
2
|
+
function e(r, u) {
|
|
3
|
+
let t = r;
|
|
4
|
+
for (let i = 0; i < u.length; i += 1) {
|
|
5
|
+
if (t == null)
|
|
5
6
|
return;
|
|
6
|
-
|
|
7
|
+
t = t[u[i]];
|
|
7
8
|
}
|
|
8
|
-
return
|
|
9
|
+
return t;
|
|
10
|
+
}
|
|
11
|
+
function c(r, u) {
|
|
12
|
+
return n(u) ? u.reduce((t, i) => t == null ? void 0 : t[i], r) : r == null ? void 0 : r[u];
|
|
9
13
|
}
|
|
10
14
|
export {
|
|
11
|
-
|
|
15
|
+
e as default,
|
|
16
|
+
c as getModelValue
|
|
12
17
|
};
|