@aplus-frontend/ui 7.7.9 → 7.7.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.
- package/es/src/ag-grid/editable/form-item.vue.mjs +67 -66
- package/es/src/ag-grid/hooks/use-editable-form-item-api.d.ts +1 -0
- package/es/src/ag-grid/hooks/use-editable-form-item-api.mjs +98 -94
- package/es/src/ap-form/ap-form.vue2.mjs +27 -27
- package/es/src/ap-form/drawer-form/index.vue.d.ts +4 -4
- package/es/src/ap-form/interface.d.ts +2 -1
- package/es/src/ap-form/modal-form/index.vue.d.ts +4 -4
- package/es/src/ap-form/search-form/index.vue.d.ts +2 -2
- package/es/src/business/ag-grid-modal/interface.d.ts +2 -2
- package/es/src/business/ag-grid-modal/utils.d.ts +2 -2
- package/es/src/business/ag-grid-modal/utils.mjs +2 -2
- package/es/src/business/ap-appendix/ap-appendix.vue2.mjs +1 -1
- package/es/src/business/ap-view/components/main-button-content.vue.d.ts +1 -1
- package/es/src/business/ap-view/components/menu-list-content.vue.d.ts +1 -1
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/lib/src/ag-grid/editable/form-item.vue.js +1 -1
- package/lib/src/ag-grid/hooks/use-editable-form-item-api.d.ts +1 -0
- package/lib/src/ag-grid/hooks/use-editable-form-item-api.js +1 -1
- package/lib/src/ap-form/ap-form.vue2.js +1 -1
- package/lib/src/ap-form/drawer-form/index.vue.d.ts +4 -4
- package/lib/src/ap-form/interface.d.ts +2 -1
- package/lib/src/ap-form/modal-form/index.vue.d.ts +4 -4
- package/lib/src/ap-form/search-form/index.vue.d.ts +2 -2
- package/lib/src/business/ag-grid-modal/interface.d.ts +2 -2
- package/lib/src/business/ag-grid-modal/utils.d.ts +2 -2
- package/lib/src/business/ag-grid-modal/utils.js +1 -1
- package/lib/src/business/ap-appendix/ap-appendix.vue2.js +1 -1
- package/lib/src/business/ap-view/components/main-button-content.vue.d.ts +1 -1
- package/lib/src/business/ap-view/components/menu-list-content.vue.d.ts +1 -1
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +1 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ApForm as
|
|
3
|
-
import { cloneDeep as
|
|
1
|
+
import { defineComponent as M, useSlots as O, ref as w, onMounted as P, unref as t, watch as G, createElementBlock as W, openBlock as U, Fragment as $, createVNode as d, mergeProps as y, withCtx as g, createSlots as q, renderList as J, renderSlot as Q, normalizeProps as X, guardReactiveProps as Y } from "vue";
|
|
2
|
+
import { ApForm as h } from "../../ap-form/index.mjs";
|
|
3
|
+
import { cloneDeep as Z, isEqual as ee, omit as b } from "lodash-unified";
|
|
4
4
|
import "../../config-provider/index.mjs";
|
|
5
|
-
import { useGetEditableColumns as
|
|
5
|
+
import { useGetEditableColumns as oe } from "../hooks/use-editable-columns.mjs";
|
|
6
6
|
import "../index.vue2.mjs";
|
|
7
|
-
import { useEditableFormItemApi as
|
|
8
|
-
import { useInjectForm as
|
|
9
|
-
import { getModelValue as
|
|
10
|
-
import { getShadowName as
|
|
11
|
-
import { useWatch as
|
|
12
|
-
import { arrayToObject as
|
|
13
|
-
import
|
|
14
|
-
import { useNamespace as
|
|
15
|
-
import { useGlobalConfig as
|
|
16
|
-
import
|
|
17
|
-
const
|
|
7
|
+
import { useEditableFormItemApi as ae } from "../hooks/use-editable-form-item-api.mjs";
|
|
8
|
+
import { useInjectForm as te } from "../../ap-form/context.mjs";
|
|
9
|
+
import { getModelValue as ne } from "../../ap-form/utils/get.mjs";
|
|
10
|
+
import { getShadowName as le } from "../utils.mjs";
|
|
11
|
+
import { useWatch as re } from "../../ap-form/hooks/use-watch.mjs";
|
|
12
|
+
import { arrayToObject as se } from "./utils.mjs";
|
|
13
|
+
import ie from "../style/editable.mjs";
|
|
14
|
+
import { useNamespace as me } from "../../config-provider/hooks/use-namespace.mjs";
|
|
15
|
+
import { useGlobalConfig as de } from "../../config-provider/hooks/use-global-config.mjs";
|
|
16
|
+
import pe from "../index.vue.mjs";
|
|
17
|
+
const Fe = /* @__PURE__ */ M({
|
|
18
18
|
name: "EditableGrid",
|
|
19
19
|
__name: "form-item",
|
|
20
20
|
props: {
|
|
@@ -130,38 +130,39 @@ const Ee = /* @__PURE__ */ K({
|
|
|
130
130
|
name: {},
|
|
131
131
|
formItem: {}
|
|
132
132
|
},
|
|
133
|
-
setup(
|
|
134
|
-
expose:
|
|
133
|
+
setup(C, {
|
|
134
|
+
expose: R
|
|
135
135
|
}) {
|
|
136
|
-
const
|
|
137
|
-
b:
|
|
138
|
-
} =
|
|
136
|
+
const B = O(), o = C, {
|
|
137
|
+
b: v
|
|
138
|
+
} = me("editable-aggrid"), x = ie("editable-aggrid"), r = w(), {
|
|
139
139
|
internalInstance: s,
|
|
140
|
-
model:
|
|
141
|
-
} =
|
|
140
|
+
model: S
|
|
141
|
+
} = te(), i = le(o.name);
|
|
142
142
|
let p;
|
|
143
143
|
P(() => {
|
|
144
|
-
const e = o.formItem?.initialValue ??
|
|
145
|
-
p =
|
|
144
|
+
const e = o.formItem?.initialValue ?? ne(t(S), o.name);
|
|
145
|
+
p = Z(e), N(e, "suffix", !0);
|
|
146
146
|
});
|
|
147
|
-
const l =
|
|
148
|
-
G(() =>
|
|
149
|
-
|
|
147
|
+
const l = w([]), I = re(o.name);
|
|
148
|
+
G(() => I.value, (e) => {
|
|
149
|
+
ee(e, l.value) || u(e ?? p);
|
|
150
150
|
}, {
|
|
151
151
|
deep: !0
|
|
152
152
|
});
|
|
153
|
-
const
|
|
154
|
-
add:
|
|
155
|
-
addMultiple:
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
153
|
+
const E = de("valueTypeMap"), F = oe(o, E, i), {
|
|
154
|
+
add: T,
|
|
155
|
+
addMultiple: _,
|
|
156
|
+
__addMultiple: N,
|
|
157
|
+
remove: V,
|
|
158
|
+
removeByKey: j,
|
|
159
|
+
getRowData: D,
|
|
160
|
+
getRowsData: k,
|
|
161
|
+
setRowData: H,
|
|
162
|
+
clear: L,
|
|
162
163
|
refreshRowIds: m
|
|
163
|
-
} =
|
|
164
|
-
function
|
|
164
|
+
} = ae(o, s, l, i);
|
|
165
|
+
function z() {
|
|
165
166
|
const e = r.value?._internalGridApi;
|
|
166
167
|
if (!m.value?.length || !e)
|
|
167
168
|
return;
|
|
@@ -171,56 +172,56 @@ const Ee = /* @__PURE__ */ K({
|
|
|
171
172
|
force: !0
|
|
172
173
|
}), m.value = [];
|
|
173
174
|
}
|
|
174
|
-
function
|
|
175
|
+
function u(e) {
|
|
175
176
|
l.value = e;
|
|
176
|
-
const a =
|
|
177
|
+
const a = se(e, o.rowKey);
|
|
177
178
|
s?.setFieldValue(o.name, e), s?.setFieldValue(i, a);
|
|
178
179
|
}
|
|
179
|
-
function
|
|
180
|
+
function c(e, a) {
|
|
180
181
|
const n = e === "end" ? l.value.length - 1 : e;
|
|
181
182
|
r.value?.scrollToRow(n, a);
|
|
182
183
|
}
|
|
183
|
-
function
|
|
184
|
+
function A(e, a) {
|
|
184
185
|
r.value?.scrollToColumn(e, a);
|
|
185
186
|
}
|
|
186
|
-
return
|
|
187
|
-
add:
|
|
188
|
-
addMultiple:
|
|
189
|
-
remove:
|
|
190
|
-
removeByKey:
|
|
191
|
-
getRowData:
|
|
192
|
-
getRowsData:
|
|
193
|
-
setRowData:
|
|
194
|
-
clear:
|
|
195
|
-
setTableData:
|
|
196
|
-
scrollTo:
|
|
197
|
-
scrollToRow:
|
|
198
|
-
scrollToColumn:
|
|
199
|
-
}), (e, a) => (
|
|
187
|
+
return R({
|
|
188
|
+
add: T,
|
|
189
|
+
addMultiple: _,
|
|
190
|
+
remove: V,
|
|
191
|
+
removeByKey: j,
|
|
192
|
+
getRowData: D,
|
|
193
|
+
getRowsData: k,
|
|
194
|
+
setRowData: H,
|
|
195
|
+
clear: L,
|
|
196
|
+
setTableData: u,
|
|
197
|
+
scrollTo: c,
|
|
198
|
+
scrollToRow: c,
|
|
199
|
+
scrollToColumn: A
|
|
200
|
+
}), (e, a) => (U(), W($, null, [d(t(h).FormItem, {
|
|
200
201
|
hidden: "",
|
|
201
202
|
name: e.name
|
|
202
|
-
}, null, 8, ["name"]), d(t(
|
|
203
|
+
}, null, 8, ["name"]), d(t(h).FormItem, y(t(b)(e.formItem, "initialValue"), {
|
|
203
204
|
label: e.label
|
|
204
205
|
}), {
|
|
205
|
-
default:
|
|
206
|
+
default: g(() => [d(pe, y(t(b)(o, ["name", "maxLength", "onChange", "defaultValue", "formItem"]), {
|
|
206
207
|
ref_key: "tableRef",
|
|
207
208
|
ref: r,
|
|
208
|
-
class: [t(
|
|
209
|
+
class: [t(v)(), t(x)],
|
|
209
210
|
size: "mini",
|
|
210
|
-
columns: t(
|
|
211
|
+
columns: t(F),
|
|
211
212
|
"data-source": l.value,
|
|
212
213
|
"search-form": !1,
|
|
213
|
-
onUpdate:
|
|
214
|
-
}),
|
|
214
|
+
onUpdate: z
|
|
215
|
+
}), q({
|
|
215
216
|
_: 2
|
|
216
|
-
}, [
|
|
217
|
-
name:
|
|
218
|
-
fn:
|
|
217
|
+
}, [J(B, (n, f) => ({
|
|
218
|
+
name: f,
|
|
219
|
+
fn: g((K) => [Q(e.$slots, f, X(Y(K || {})))])
|
|
219
220
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
220
221
|
_: 3
|
|
221
222
|
}, 16, ["label"])], 64));
|
|
222
223
|
}
|
|
223
224
|
});
|
|
224
225
|
export {
|
|
225
|
-
|
|
226
|
+
Fe as default
|
|
226
227
|
};
|
|
@@ -5,6 +5,7 @@ import { Key } from '@aplus-frontend/antdv/es/_util/type';
|
|
|
5
5
|
export declare const useEditableFormItemApi: <RecordType>(props: EditableAgGridProps<RecordType>, formApi: ApFormInternalInstance | undefined, tableData: Ref<RecordType[]>, shadowName: string) => {
|
|
6
6
|
add: (defaultValue?: Partial<RecordType>, insertIndex?: number) => void;
|
|
7
7
|
addMultiple: (list: number | Partial<RecordType>[], insetIn?: "prefix" | "suffix") => void;
|
|
8
|
+
__addMultiple: (list: number | Partial<RecordType>[], insetIn?: "prefix" | "suffix", overwriting?: boolean) => void;
|
|
8
9
|
remove: (data: RecordType | RecordType[]) => void;
|
|
9
10
|
removeByKey: (key: Key | Key[]) => void;
|
|
10
11
|
getRowData: (index: number) => RecordType;
|
|
@@ -1,177 +1,181 @@
|
|
|
1
|
-
import { shallowRef as
|
|
1
|
+
import { shallowRef as U, unref as h } from "vue";
|
|
2
2
|
import "../../utils/index.mjs";
|
|
3
|
-
import { isFunction as
|
|
4
|
-
import { getRowKey as y, arrayToObject as
|
|
5
|
-
import { isDef as
|
|
6
|
-
let
|
|
7
|
-
function
|
|
8
|
-
return `_ag_grid${
|
|
3
|
+
import { isFunction as V, isUndefined as R, isNumber as F, cloneDeep as $, isArray as I } from "lodash-unified";
|
|
4
|
+
import { getRowKey as y, arrayToObject as q } from "../editable/utils.mjs";
|
|
5
|
+
import { isDef as j } from "../../utils/is.mjs";
|
|
6
|
+
let C = 0;
|
|
7
|
+
function k() {
|
|
8
|
+
return `_ag_grid${C++}`;
|
|
9
9
|
}
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
function
|
|
13
|
-
const v =
|
|
14
|
-
if (
|
|
10
|
+
const W = (l, c, n, w) => {
|
|
11
|
+
const d = U([]);
|
|
12
|
+
function L(i, t) {
|
|
13
|
+
const v = h(n)?.length || 0;
|
|
14
|
+
if (j(l.maxLength) && v >= l.maxLength || !i && V(l.rowKey))
|
|
15
15
|
return;
|
|
16
|
-
const
|
|
17
|
-
...
|
|
16
|
+
const f = {
|
|
17
|
+
...i || { [l.rowKey]: k() }
|
|
18
18
|
};
|
|
19
19
|
c?.setFieldValue(
|
|
20
20
|
w,
|
|
21
|
-
|
|
21
|
+
f,
|
|
22
22
|
!1,
|
|
23
|
-
(
|
|
24
|
-
const e = y(
|
|
25
|
-
|
|
26
|
-
(u,
|
|
27
|
-
).filter(Boolean), n.value.splice(
|
|
23
|
+
(o, s) => {
|
|
24
|
+
const e = y(f, void 0, l.rowKey);
|
|
25
|
+
o[s] ? o[s][e] = f : o[s] = { [e]: f }, n.value ? R(t) ? n.value.push(f) : (d.value = n.value.map(
|
|
26
|
+
(u, r) => r < t ? null : y(u, r, l.rowKey)
|
|
27
|
+
).filter(Boolean), n.value.splice(t, 0, f)) : n.value = [f], c?.setFieldValue(
|
|
28
28
|
l.name,
|
|
29
|
-
|
|
29
|
+
f,
|
|
30
30
|
!0,
|
|
31
|
-
(u,
|
|
32
|
-
if (!u[
|
|
33
|
-
u[
|
|
31
|
+
(u, r) => {
|
|
32
|
+
if (!u[r]) {
|
|
33
|
+
u[r] = [f];
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
R(t) ? u[r].push(f) : u[r].splice(t, 0, f);
|
|
37
37
|
}
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
if (!
|
|
42
|
+
function x(i, t = "suffix", v = !1) {
|
|
43
|
+
if (!i)
|
|
44
44
|
return;
|
|
45
|
-
const
|
|
46
|
-
if (
|
|
45
|
+
const f = h(n)?.length || 0, o = F(i) ? i : i.length;
|
|
46
|
+
if (j(l.maxLength) && f + o > l.maxLength || F(i) && V(l.rowKey))
|
|
47
47
|
return;
|
|
48
|
-
const
|
|
48
|
+
const s = F(i) ? new Array(i).fill(0).map(() => ({ [l.rowKey]: k() })) : $(i), e = q(s, l.rowKey);
|
|
49
49
|
c?.setFieldValue(
|
|
50
50
|
w,
|
|
51
|
-
|
|
51
|
+
e,
|
|
52
52
|
!1,
|
|
53
|
-
(
|
|
54
|
-
|
|
55
|
-
(
|
|
56
|
-
), n.value.unshift(...
|
|
53
|
+
(u, r) => {
|
|
54
|
+
u[r] ? Object.assign(u[r], e) : u[r] = e, n.value ? t === "suffix" ? n.value.push(...s) : (d.value = n.value.map(
|
|
55
|
+
(g, K) => y(g, K, l.rowKey)
|
|
56
|
+
), n.value.unshift(...s)) : n.value = [...s], c?.setFieldValue(
|
|
57
57
|
l.name,
|
|
58
|
-
|
|
58
|
+
s,
|
|
59
59
|
!0,
|
|
60
|
-
(
|
|
61
|
-
if (!
|
|
62
|
-
|
|
60
|
+
(g, K) => {
|
|
61
|
+
if (!g[K] || v) {
|
|
62
|
+
g[K] = [...s];
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
t === "suffix" ? g[K].push(...s) : g[K].unshift(...s);
|
|
66
66
|
}
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
|
-
function
|
|
72
|
-
|
|
71
|
+
function O(i, t = "suffix") {
|
|
72
|
+
x(i, t, !1);
|
|
73
|
+
}
|
|
74
|
+
function T(i) {
|
|
75
|
+
const t = I(i) ? i : [i];
|
|
73
76
|
c?.setFieldValue(
|
|
74
77
|
w,
|
|
75
78
|
void 0,
|
|
76
79
|
!1,
|
|
77
|
-
(v,
|
|
78
|
-
for (const e of
|
|
80
|
+
(v, f) => {
|
|
81
|
+
for (const e of t) {
|
|
79
82
|
const u = y(e, void 0, l.rowKey);
|
|
80
|
-
delete v[
|
|
83
|
+
delete v[f][u];
|
|
81
84
|
}
|
|
82
|
-
const
|
|
83
|
-
(e) => !
|
|
84
|
-
),
|
|
85
|
-
(e) =>
|
|
85
|
+
const o = n.value.filter(
|
|
86
|
+
(e) => !t.includes(e)
|
|
87
|
+
), s = n.value.findIndex(
|
|
88
|
+
(e) => t.includes(e)
|
|
86
89
|
);
|
|
87
|
-
|
|
88
|
-
(e, u) => u <=
|
|
89
|
-
).filter(Boolean),
|
|
90
|
+
d.value = n.value.map(
|
|
91
|
+
(e, u) => u <= s ? null : y(e, u, l.rowKey)
|
|
92
|
+
).filter(Boolean), o.length ? n.value = o : n.value.splice(0, n.value.length), c.setFieldValue(
|
|
90
93
|
l.name,
|
|
91
94
|
void 0,
|
|
92
95
|
!0,
|
|
93
96
|
(e, u) => {
|
|
94
|
-
e[u] =
|
|
97
|
+
e[u] = o;
|
|
95
98
|
}
|
|
96
99
|
);
|
|
97
100
|
}
|
|
98
101
|
);
|
|
99
102
|
}
|
|
100
|
-
function
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
+
function _(i) {
|
|
104
|
+
const t = new Set(I(i) ? i : [i]);
|
|
105
|
+
t.size !== 0 && c?.setFieldValue(
|
|
103
106
|
w,
|
|
104
107
|
void 0,
|
|
105
108
|
!1,
|
|
106
|
-
(v,
|
|
107
|
-
for (const e of
|
|
108
|
-
delete v[
|
|
109
|
-
const
|
|
110
|
-
(e, u) => !
|
|
111
|
-
),
|
|
112
|
-
(e, u) =>
|
|
109
|
+
(v, f) => {
|
|
110
|
+
for (const e of t)
|
|
111
|
+
delete v[f][e];
|
|
112
|
+
const o = n.value.filter(
|
|
113
|
+
(e, u) => !t.has(y(e, u, l.rowKey))
|
|
114
|
+
), s = n.value.findIndex(
|
|
115
|
+
(e, u) => t.has(y(e, u, l.rowKey))
|
|
113
116
|
);
|
|
114
|
-
|
|
115
|
-
(e, u) => u <=
|
|
116
|
-
).filter(Boolean),
|
|
117
|
+
d.value = n.value.map(
|
|
118
|
+
(e, u) => u <= s ? null : y(e, u, l.rowKey)
|
|
119
|
+
).filter(Boolean), o.length ? n.value = o : n.value.splice(0, n.value.length), c.setFieldValue(
|
|
117
120
|
l.name,
|
|
118
121
|
void 0,
|
|
119
122
|
!0,
|
|
120
123
|
(e, u) => {
|
|
121
|
-
e[u] =
|
|
124
|
+
e[u] = o;
|
|
122
125
|
}
|
|
123
126
|
);
|
|
124
127
|
}
|
|
125
128
|
);
|
|
126
129
|
}
|
|
127
|
-
function
|
|
128
|
-
return
|
|
130
|
+
function B(i) {
|
|
131
|
+
return h(n)?.[i];
|
|
129
132
|
}
|
|
130
|
-
function
|
|
131
|
-
return
|
|
133
|
+
function z() {
|
|
134
|
+
return h(n);
|
|
132
135
|
}
|
|
133
|
-
function
|
|
136
|
+
function E(i, t, v = !0) {
|
|
134
137
|
c?.setFieldValue?.(
|
|
135
138
|
w,
|
|
136
139
|
void 0,
|
|
137
140
|
!1,
|
|
138
|
-
(
|
|
139
|
-
const
|
|
140
|
-
(u,
|
|
141
|
+
(f, o) => {
|
|
142
|
+
const s = n.value.findIndex(
|
|
143
|
+
(u, r) => i === r
|
|
141
144
|
);
|
|
142
|
-
if (!~
|
|
145
|
+
if (!~s)
|
|
143
146
|
return;
|
|
144
147
|
const e = y(
|
|
145
|
-
n.value[
|
|
146
|
-
|
|
148
|
+
n.value[s],
|
|
149
|
+
s,
|
|
147
150
|
l.rowKey
|
|
148
151
|
);
|
|
149
|
-
if (e && !(!
|
|
152
|
+
if (e && !(!f[o] || !f[o][e])) {
|
|
150
153
|
if (!v) {
|
|
151
|
-
const u = Object.keys(
|
|
152
|
-
for (const
|
|
153
|
-
|
|
154
|
+
const u = Object.keys(f[o][e]);
|
|
155
|
+
for (const r of u)
|
|
156
|
+
r !== l.rowKey && delete f[o][e][r];
|
|
154
157
|
}
|
|
155
|
-
Object.assign(
|
|
158
|
+
Object.assign(f[o][e], { ...t });
|
|
156
159
|
}
|
|
157
160
|
}
|
|
158
161
|
);
|
|
159
162
|
}
|
|
160
|
-
function
|
|
163
|
+
function S() {
|
|
161
164
|
c?.setFieldValue(w, {}), c?.setFieldValue(l.name, []);
|
|
162
165
|
}
|
|
163
166
|
return {
|
|
164
|
-
add:
|
|
165
|
-
addMultiple:
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
167
|
+
add: L,
|
|
168
|
+
addMultiple: O,
|
|
169
|
+
__addMultiple: x,
|
|
170
|
+
remove: T,
|
|
171
|
+
removeByKey: _,
|
|
172
|
+
getRowData: B,
|
|
173
|
+
getRowsData: z,
|
|
174
|
+
setRowData: E,
|
|
175
|
+
clear: S,
|
|
176
|
+
refreshRowIds: d
|
|
173
177
|
};
|
|
174
178
|
};
|
|
175
179
|
export {
|
|
176
|
-
|
|
180
|
+
W as useEditableFormItemApi
|
|
177
181
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { defineComponent as ee, reactive as te, shallowRef as re, ref as oe, unref as h, nextTick as ne, toRaw as
|
|
1
|
+
import { defineComponent as ee, reactive as te, shallowRef as re, ref as oe, unref as h, nextTick as ne, toRaw as R, watch as ie, onWatcherCleanup as le, computed as se, createBlock as ae, openBlock as ue, mergeProps as ce, withCtx as fe, renderSlot as de } from "vue";
|
|
2
2
|
import { Form as ge } from "@aplus-frontend/antdv";
|
|
3
3
|
import { useProvideForm as me } from "./context.mjs";
|
|
4
|
-
import { isArray as f, cloneDeep as pe, isEqual as he, isFunction as
|
|
4
|
+
import { isArray as f, cloneDeep as pe, isEqual as he, isFunction as M, isPlainObject as B, omit as Fe } from "lodash-unified";
|
|
5
5
|
import { useUrlSearchParams as ye } from "@vueuse/core";
|
|
6
6
|
import { INTERNAL_FORM_INSTANCE_MARK as O } from "./constant.mjs";
|
|
7
7
|
import { getRouteType as Te } from "../utils/index.mjs";
|
|
8
8
|
import Ve from "./utils/set.mjs";
|
|
9
|
-
import { genParams as
|
|
9
|
+
import { genParams as _, setToParams as j } from "./utils/params.mjs";
|
|
10
10
|
import { useInjectFormProvider as ve } from "./provider/context.mjs";
|
|
11
11
|
import { getModelValue as x } from "./utils/get.mjs";
|
|
12
12
|
import { useDevWarning as Ce } from "../utils/warning.mjs";
|
|
@@ -61,12 +61,12 @@ const xe = /* @__PURE__ */ ee({
|
|
|
61
61
|
y();
|
|
62
62
|
}
|
|
63
63
|
const s = re(), v = ye(Te()), F = ve(), S = Ce("ApForm"), C = oe(
|
|
64
|
-
n.syncToUrl ?
|
|
64
|
+
n.syncToUrl ? _(n.syncToUrl, v, "get") : {}
|
|
65
65
|
);
|
|
66
|
-
let d = pe(
|
|
67
|
-
const l = te(
|
|
66
|
+
let d = pe(b()), g = {};
|
|
67
|
+
const l = te(b());
|
|
68
68
|
let m = [];
|
|
69
|
-
function
|
|
69
|
+
function b() {
|
|
70
70
|
const e = n.initialValues || {};
|
|
71
71
|
return n.syncToUrlPriority ? {
|
|
72
72
|
...e,
|
|
@@ -78,13 +78,13 @@ const xe = /* @__PURE__ */ ee({
|
|
|
78
78
|
}
|
|
79
79
|
function q(e) {
|
|
80
80
|
const t = p(e, g);
|
|
81
|
-
F.triggerFormFinish(n.name, e), n.syncToUrl && j(v,
|
|
81
|
+
F.triggerFormFinish(n.name, e), n.syncToUrl && j(v, _(n.syncToUrl, t, "set")), n.onFinish?.(t);
|
|
82
82
|
}
|
|
83
83
|
const D = async () => {
|
|
84
84
|
s.value?.resetFields(), await ne(() => {
|
|
85
85
|
Object.keys(l).forEach((e) => delete l[e]), Object.assign(l, d), y(), n.syncToUrl && j(
|
|
86
86
|
v,
|
|
87
|
-
|
|
87
|
+
_(
|
|
88
88
|
n.syncToUrl,
|
|
89
89
|
p(d, g),
|
|
90
90
|
"set"
|
|
@@ -99,18 +99,18 @@ const xe = /* @__PURE__ */ ee({
|
|
|
99
99
|
t
|
|
100
100
|
);
|
|
101
101
|
return p(r, g);
|
|
102
|
-
},
|
|
103
|
-
const t =
|
|
102
|
+
}, I = (e) => e === !0 ? R(l) : s.value?.getFieldsValue(e), k = (e) => {
|
|
103
|
+
const t = I(e);
|
|
104
104
|
return p(t, g);
|
|
105
105
|
}, G = (e, t) => s.value?.validate(e, t), H = (e, t = {}) => {
|
|
106
106
|
s.value?.scrollToField(e, t);
|
|
107
107
|
}, J = (e) => {
|
|
108
108
|
Object.assign(l, e), y();
|
|
109
|
-
},
|
|
109
|
+
}, U = (e, t, r = !0, o) => {
|
|
110
110
|
V(e, t, r, o), y();
|
|
111
111
|
};
|
|
112
|
-
function
|
|
113
|
-
return e(
|
|
112
|
+
function P(e) {
|
|
113
|
+
return e(R(l)), m.push(e), () => {
|
|
114
114
|
m = m.filter((t) => t !== e);
|
|
115
115
|
};
|
|
116
116
|
}
|
|
@@ -154,14 +154,14 @@ const xe = /* @__PURE__ */ ee({
|
|
|
154
154
|
), e === O)
|
|
155
155
|
return {
|
|
156
156
|
registerField: w,
|
|
157
|
-
registerWatch:
|
|
158
|
-
setFieldValue:
|
|
157
|
+
registerWatch: P,
|
|
158
|
+
setFieldValue: U,
|
|
159
159
|
getInitialValues: A
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
162
|
function y() {
|
|
163
163
|
if (m.length) {
|
|
164
|
-
const e =
|
|
164
|
+
const e = R(l);
|
|
165
165
|
m.forEach((t) => {
|
|
166
166
|
t(e);
|
|
167
167
|
});
|
|
@@ -172,14 +172,14 @@ const xe = /* @__PURE__ */ ee({
|
|
|
172
172
|
return;
|
|
173
173
|
let r = f(e) ? [] : {};
|
|
174
174
|
return Object.keys(e).forEach((o) => {
|
|
175
|
-
const a = e[o], i = t?.[o], u =
|
|
176
|
-
if (
|
|
177
|
-
const c = u(a);
|
|
178
|
-
z ? f(c) && f(r) ? r = [...r, ...c] :
|
|
175
|
+
const a = e[o], i = t?.[o], u = M(i) ? i : i?.transformer, z = M(i) ? !0 : i?.flat;
|
|
176
|
+
if (M(u)) {
|
|
177
|
+
const c = u(a, { getFieldsValue: I });
|
|
178
|
+
z ? f(c) && f(r) ? r = [...r, ...c] : B(c) && B(r) ? r = {
|
|
179
179
|
...r,
|
|
180
180
|
...c
|
|
181
181
|
} : r[o] = c : r[o] = c;
|
|
182
|
-
} else if (
|
|
182
|
+
} else if (B(a) || f(a)) {
|
|
183
183
|
const c = p(
|
|
184
184
|
a,
|
|
185
185
|
i
|
|
@@ -193,12 +193,12 @@ const xe = /* @__PURE__ */ ee({
|
|
|
193
193
|
resetFields: D,
|
|
194
194
|
clearValidate: K,
|
|
195
195
|
validateFields: L,
|
|
196
|
-
getFieldsValue:
|
|
196
|
+
getFieldsValue: I,
|
|
197
197
|
validate: G,
|
|
198
198
|
scrollToField: H,
|
|
199
199
|
setFieldsValue: J,
|
|
200
|
-
setFieldValue:
|
|
201
|
-
registerWatch:
|
|
200
|
+
setFieldValue: U,
|
|
201
|
+
registerWatch: P,
|
|
202
202
|
validateFieldsReturnTransformed: $,
|
|
203
203
|
getFieldsValueTransformed: k,
|
|
204
204
|
getInternalInstance: Z
|
|
@@ -217,9 +217,9 @@ const xe = /* @__PURE__ */ ee({
|
|
|
217
217
|
model: se(() => l),
|
|
218
218
|
updateModel: V,
|
|
219
219
|
internalInstance: {
|
|
220
|
-
registerWatch:
|
|
220
|
+
registerWatch: P,
|
|
221
221
|
registerField: w,
|
|
222
|
-
setFieldValue:
|
|
222
|
+
setFieldValue: U,
|
|
223
223
|
getInitialValues: A
|
|
224
224
|
}
|
|
225
225
|
}), N(E), (e, t) => (ue(), ae(h(ge), ce(
|
|
@@ -829,7 +829,7 @@ declare function __VLS_template(): {
|
|
|
829
829
|
validateOnRuleChange: boolean;
|
|
830
830
|
validateTrigger: string | string[];
|
|
831
831
|
syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
|
|
832
|
-
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "
|
|
832
|
+
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "getFieldsValue" | "setFieldsValue" | "setFieldValue" | "resetFields" | "clearValidate" | "validateFields" | "validate" | "scrollToField" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed" | "registerWatch" | ("layout" | "colon" | "labelAlign" | "hideRequiredMark" | "validateOnRuleChange" | "validateTrigger" | "syncToUrl")> & ShallowUnwrapRef<{
|
|
833
833
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
834
834
|
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
835
835
|
resetFields: () => Promise<void>;
|
|
@@ -852,13 +852,13 @@ declare function __VLS_template(): {
|
|
|
852
852
|
};
|
|
853
853
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
854
854
|
declare const __VLS_component: DefineComponent<ApFormDrawerFormProps, {
|
|
855
|
-
|
|
855
|
+
getFieldsValue: (nameList?: true | InternalNamePath[]) => Partial<any> | undefined;
|
|
856
856
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
857
857
|
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
858
858
|
resetFields: () => Promise<void>;
|
|
859
859
|
clearValidate: (name?: NamePath) => void;
|
|
860
860
|
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
861
|
-
|
|
861
|
+
validate: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
862
862
|
scrollToField: (name: NamePath, options?: any) => void;
|
|
863
863
|
getInternalInstance: (mark: string) => ApFormInternalInstance | undefined;
|
|
864
864
|
validateFieldsReturnTransformed: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
@@ -1792,7 +1792,7 @@ declare const __VLS_component: DefineComponent<ApFormDrawerFormProps, {
|
|
|
1792
1792
|
validateOnRuleChange: boolean;
|
|
1793
1793
|
validateTrigger: string | string[];
|
|
1794
1794
|
syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
|
|
1795
|
-
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "
|
|
1795
|
+
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "getFieldsValue" | "setFieldsValue" | "setFieldValue" | "resetFields" | "clearValidate" | "validateFields" | "validate" | "scrollToField" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed" | "registerWatch" | ("layout" | "colon" | "labelAlign" | "hideRequiredMark" | "validateOnRuleChange" | "validateTrigger" | "syncToUrl")> & ShallowUnwrapRef<{
|
|
1796
1796
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
1797
1797
|
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
1798
1798
|
resetFields: () => Promise<void>;
|
|
@@ -4,9 +4,10 @@ import { InternalNamePath, NamePath, ValidateOptions } from '@aplus-frontend/ant
|
|
|
4
4
|
import { LiteralUnion, Recordable } from '../type';
|
|
5
5
|
import { VNode } from 'vue';
|
|
6
6
|
import { BreakPointType } from './search-form/hooks/use-count-per-row';
|
|
7
|
+
import { ApFormInstance } from './provider/interface';
|
|
7
8
|
export type { ApFormChangeInfo, ApFormFinishInfo } from './provider/interface';
|
|
8
9
|
export type ApFormColProps = Omit<ColProps, 'prefixCls'>;
|
|
9
|
-
export type ApFormItemTransformFn = (value: any) => any;
|
|
10
|
+
export type ApFormItemTransformFn = (value: any, api?: Pick<ApFormInstance, 'getFieldsValue'>) => any;
|
|
10
11
|
export type ApFormItemTransformType = ApFormItemTransformFn | {
|
|
11
12
|
transformer: ApFormItemTransformFn;
|
|
12
13
|
/**
|
|
@@ -830,7 +830,7 @@ declare function __VLS_template(): {
|
|
|
830
830
|
validateOnRuleChange: boolean;
|
|
831
831
|
validateTrigger: string | string[];
|
|
832
832
|
syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
|
|
833
|
-
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "
|
|
833
|
+
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "getFieldsValue" | "setFieldsValue" | "setFieldValue" | "resetFields" | "clearValidate" | "validateFields" | "validate" | "scrollToField" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed" | "registerWatch" | ("layout" | "colon" | "labelAlign" | "hideRequiredMark" | "validateOnRuleChange" | "validateTrigger" | "syncToUrl")> & ShallowUnwrapRef<{
|
|
834
834
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
835
835
|
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
836
836
|
resetFields: () => Promise<void>;
|
|
@@ -853,13 +853,13 @@ declare function __VLS_template(): {
|
|
|
853
853
|
};
|
|
854
854
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
855
855
|
declare const __VLS_component: DefineComponent<ApFormModalFormProps, {
|
|
856
|
-
|
|
856
|
+
getFieldsValue: (nameList?: true | InternalNamePath[]) => Partial<any> | undefined;
|
|
857
857
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
858
858
|
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
859
859
|
resetFields: () => Promise<void>;
|
|
860
860
|
clearValidate: (name?: NamePath) => void;
|
|
861
861
|
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
862
|
-
|
|
862
|
+
validate: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
863
863
|
scrollToField: (name: NamePath, options?: any) => void;
|
|
864
864
|
getInternalInstance: (mark: string) => ApFormInternalInstance | undefined;
|
|
865
865
|
validateFieldsReturnTransformed: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
@@ -2033,7 +2033,7 @@ declare const __VLS_component: DefineComponent<ApFormModalFormProps, {
|
|
|
2033
2033
|
validateOnRuleChange: boolean;
|
|
2034
2034
|
validateTrigger: string | string[];
|
|
2035
2035
|
syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
|
|
2036
|
-
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "
|
|
2036
|
+
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "getFieldsValue" | "setFieldsValue" | "setFieldValue" | "resetFields" | "clearValidate" | "validateFields" | "validate" | "scrollToField" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed" | "registerWatch" | ("layout" | "colon" | "labelAlign" | "hideRequiredMark" | "validateOnRuleChange" | "validateTrigger" | "syncToUrl")> & ShallowUnwrapRef<{
|
|
2037
2037
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
2038
2038
|
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
2039
2039
|
resetFields: () => Promise<void>;
|
|
@@ -829,7 +829,7 @@ declare function __VLS_template(): {
|
|
|
829
829
|
validateOnRuleChange: boolean;
|
|
830
830
|
validateTrigger: string | string[];
|
|
831
831
|
syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
|
|
832
|
-
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "
|
|
832
|
+
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "getFieldsValue" | "setFieldsValue" | "setFieldValue" | "resetFields" | "clearValidate" | "validateFields" | "validate" | "scrollToField" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed" | "registerWatch" | ("layout" | "colon" | "labelAlign" | "hideRequiredMark" | "validateOnRuleChange" | "validateTrigger" | "syncToUrl")> & ShallowUnwrapRef<{
|
|
833
833
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
834
834
|
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
835
835
|
resetFields: () => Promise<void>;
|
|
@@ -1817,7 +1817,7 @@ declare const __VLS_component: DefineComponent<ApFormSearchFormProps, {
|
|
|
1817
1817
|
validateOnRuleChange: boolean;
|
|
1818
1818
|
validateTrigger: string | string[];
|
|
1819
1819
|
syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
|
|
1820
|
-
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "
|
|
1820
|
+
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "getFieldsValue" | "setFieldsValue" | "setFieldValue" | "resetFields" | "clearValidate" | "validateFields" | "validate" | "scrollToField" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed" | "registerWatch" | ("layout" | "colon" | "labelAlign" | "hideRequiredMark" | "validateOnRuleChange" | "validateTrigger" | "syncToUrl")> & ShallowUnwrapRef<{
|
|
1821
1821
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
1822
1822
|
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
1823
1823
|
resetFields: () => Promise<void>;
|
|
@@ -97,8 +97,8 @@ export interface SelectModalReturnType<T = any> {
|
|
|
97
97
|
updateProps: UpdateSelectPropsFn<T>;
|
|
98
98
|
}
|
|
99
99
|
export interface RequestReturn<T = any> {
|
|
100
|
-
records
|
|
101
|
-
total
|
|
100
|
+
records?: T[];
|
|
101
|
+
total?: number;
|
|
102
102
|
}
|
|
103
103
|
/** open打开方法返回的值的类型 */
|
|
104
104
|
export interface OpenReturnType<RowType> {
|
|
@@ -3,8 +3,8 @@ import { GetRowKey, ModalLayoutConfig, RequestReturn } from './interface';
|
|
|
3
3
|
import { VNodeChild, StyleValue } from 'vue';
|
|
4
4
|
export declare function genRequest(api: ((params: any) => Promise<RequestReturn<any>>) | undefined, gerRowKey: GetRowKey<any>, callback?: (length: number) => void): {
|
|
5
5
|
request: (params: any) => Promise<{
|
|
6
|
-
data: any[];
|
|
7
|
-
total: number;
|
|
6
|
+
data: any[] | undefined;
|
|
7
|
+
total: number | undefined;
|
|
8
8
|
}>;
|
|
9
9
|
setExtraParams: (params?: Recordable) => void;
|
|
10
10
|
};
|
|
@@ -11,8 +11,8 @@ function m(e, t, r) {
|
|
|
11
11
|
};
|
|
12
12
|
n && (s = Object.assign(s, n));
|
|
13
13
|
const { records: l, total: u } = await i(Object.assign({}, s));
|
|
14
|
-
return r?.(l
|
|
15
|
-
data: l
|
|
14
|
+
return r?.(l?.length || 0), {
|
|
15
|
+
data: l?.map((c) => h(c, t)),
|
|
16
16
|
total: u
|
|
17
17
|
};
|
|
18
18
|
}, setExtraParams: (s) => {
|
|
@@ -16,7 +16,7 @@ const Y = ["onClick"], de = /* @__PURE__ */ O({
|
|
|
16
16
|
__name: "ap-appendix",
|
|
17
17
|
props: {
|
|
18
18
|
fileList: {},
|
|
19
|
-
needName: { type: [Boolean, Object], default:
|
|
19
|
+
needName: { type: [Boolean, Object], default: void 0 },
|
|
20
20
|
getOssAccess: {},
|
|
21
21
|
title: {},
|
|
22
22
|
tooltip: {},
|
|
@@ -820,7 +820,7 @@ declare const _default: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOp
|
|
|
820
820
|
validateOnRuleChange: boolean;
|
|
821
821
|
validateTrigger: string | string[];
|
|
822
822
|
syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
|
|
823
|
-
}> & Omit<Readonly<ApFormProps> & Readonly<{}>, "
|
|
823
|
+
}> & Omit<Readonly<ApFormProps> & Readonly<{}>, "getFieldsValue" | "setFieldsValue" | "setFieldValue" | "resetFields" | "clearValidate" | "validateFields" | "validate" | "scrollToField" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed" | "registerWatch" | ("layout" | "colon" | "labelAlign" | "hideRequiredMark" | "validateOnRuleChange" | "validateTrigger" | "syncToUrl")> & ShallowUnwrapRef<{
|
|
824
824
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
825
825
|
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
826
826
|
resetFields: () => Promise<void>;
|
|
@@ -821,7 +821,7 @@ declare const _default: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOp
|
|
|
821
821
|
validateOnRuleChange: boolean;
|
|
822
822
|
validateTrigger: string | string[];
|
|
823
823
|
syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
|
|
824
|
-
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "
|
|
824
|
+
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "getFieldsValue" | "setFieldsValue" | "setFieldValue" | "resetFields" | "clearValidate" | "validateFields" | "validate" | "scrollToField" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed" | "registerWatch" | ("layout" | "colon" | "labelAlign" | "hideRequiredMark" | "validateOnRuleChange" | "validateTrigger" | "syncToUrl")> & ShallowUnwrapRef<{
|
|
825
825
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
826
826
|
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
827
827
|
resetFields: () => Promise<void>;
|
package/es/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "7.7.
|
|
1
|
+
declare const _default: "7.7.11";
|
|
2
2
|
export default _default;
|
package/es/src/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),g=require("../../ap-form/index.js"),s=require("lodash-unified");require("../../config-provider/index.js");const M=require("../hooks/use-editable-columns.js");require("../index.vue2.js");const P=require("../hooks/use-editable-form-item-api.js"),k=require("../../ap-form/context.js"),H=require("../../ap-form/utils/get.js"),L=require("../utils.js"),O=require("../../ap-form/hooks/use-watch.js"),z=require("./utils.js"),G=require("../style/editable.js"),K=require("../../config-provider/hooks/use-namespace.js"),W=require("../../config-provider/hooks/use-global-config.js"),U=require("../index.vue.js"),$=e.defineComponent({name:"EditableGrid",__name:"form-item",props:{dropdownPrefixCls:{},bordered:{type:Boolean},locale:{},onResizeColumn:{},getPopupContainer:{},scroll:{},sortDirections:{},showSorterTooltip:{type:[Boolean,Object]},prefixCls:{},rowKey:{type:[String,Function],default:"key"},tableLayout:{},title:{},id:{},showHeader:{type:Boolean},components:{},customHeaderRow:{},direction:{},expandFixed:{type:[String,Boolean]},expandColumnWidth:{},expandedRowKeys:{},defaultExpandedRowKeys:{},expandedRowRender:{},expandRowByClick:{type:Boolean},expandIcon:{},onExpand:{},onExpandedRowsChange:{},defaultExpandAllRows:{type:Boolean},indentSize:{},expandIconColumnIndex:{},showExpandColumn:{type:Boolean},expandedRowClassName:{},childrenColumnName:{},rowExpandable:{},transformCellText:{},rowHoverable:{type:Boolean},rowSelection:{type:[Boolean,Object]},onLoadingChange:{},onShownColumnsChange:{},pagination:{type:[Boolean,Object],default:!1},searchFormWrapperStyle:{},tableWrapperStyle:{},wrapperStyle:{},tableStyle:{},adaptive:{type:Boolean},columnResizable:{type:Boolean,default:!1},loading:{type:Boolean,default:void 0},summary:{},rowHeight:{default:66},getRowHeight:{},advanceRenderer:{type:Boolean},browserTooltips:{type:Boolean},virtual:{type:[Boolean,Object],default:void 0},onRowClicked:{},onScrollEnd:{},rowClassName:{},rowClassRules:{},autoHeight:{type:Boolean},onUpdate:{},customRow:{},theme:{},columns:{},defaultValue:{},onChange:{},maxLength:{},onFieldChange:{},label:{},name:{},formItem:{}},setup(w,{expose:h}){const y=e.useSlots(),t=w,{b}=K.useNamespace("editable-aggrid"),C=G.default("editable-aggrid"),r=e.ref(),{internalInstance:u,model:R}=k.useInjectForm(),i=L.getShadowName(t.name);let c;e.onMounted(()=>{const o=t.formItem?.initialValue??H.getModelValue(e.unref(R),t.name);c=s.cloneDeep(o),S(o,"suffix",!0)});const l=e.ref([]),v=O.useWatch(t.name);e.watch(()=>v.value,o=>{s.isEqual(o,l.value)||m(o??c)},{deep:!0});const x=W.useGlobalConfig("valueTypeMap"),B=M.useGetEditableColumns(t,x,i),{add:_,addMultiple:q,__addMultiple:S,remove:I,removeByKey:E,getRowData:F,getRowsData:N,setRowData:T,clear:V,refreshRowIds:d}=P.useEditableFormItemApi(t,u,l,i);function j(){const o=r.value?._internalGridApi;if(!d.value?.length||!o)return;const a=d.value.map(n=>o.getRowNode(n)).filter(n=>!!n);o.refreshCells({rowNodes:a,force:!0}),d.value=[]}function m(o){l.value=o;const a=z.arrayToObject(o,t.rowKey);u?.setFieldValue(t.name,o),u?.setFieldValue(i,a)}function p(o,a){const n=o==="end"?l.value.length-1:o;r.value?.scrollToRow(n,a)}function A(o,a){r.value?.scrollToColumn(o,a)}return h({add:_,addMultiple:q,remove:I,removeByKey:E,getRowData:F,getRowsData:N,setRowData:T,clear:V,setTableData:m,scrollTo:p,scrollToRow:p,scrollToColumn:A}),(o,a)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(g.ApForm).FormItem,{hidden:"",name:o.name},null,8,["name"]),e.createVNode(e.unref(g.ApForm).FormItem,e.mergeProps(e.unref(s.omit)(o.formItem,"initialValue"),{label:o.label}),{default:e.withCtx(()=>[e.createVNode(U.default,e.mergeProps(e.unref(s.omit)(t,["name","maxLength","onChange","defaultValue","formItem"]),{ref_key:"tableRef",ref:r,class:[e.unref(b)(),e.unref(C)],size:"mini",columns:e.unref(B),"data-source":l.value,"search-form":!1,onUpdate:j}),e.createSlots({_:2},[e.renderList(y,(n,f)=>({name:f,fn:e.withCtx(D=>[e.renderSlot(o.$slots,f,e.normalizeProps(e.guardReactiveProps(D||{})))])}))]),1040,["class","columns","data-source"])]),_:3},16,["label"])],64))}});exports.default=$;
|
|
@@ -5,6 +5,7 @@ import { Key } from '@aplus-frontend/antdv/es/_util/type';
|
|
|
5
5
|
export declare const useEditableFormItemApi: <RecordType>(props: EditableAgGridProps<RecordType>, formApi: ApFormInternalInstance | undefined, tableData: Ref<RecordType[]>, shadowName: string) => {
|
|
6
6
|
add: (defaultValue?: Partial<RecordType>, insertIndex?: number) => void;
|
|
7
7
|
addMultiple: (list: number | Partial<RecordType>[], insetIn?: "prefix" | "suffix") => void;
|
|
8
|
+
__addMultiple: (list: number | Partial<RecordType>[], insetIn?: "prefix" | "suffix", overwriting?: boolean) => void;
|
|
8
9
|
remove: (data: RecordType | RecordType[]) => void;
|
|
9
10
|
removeByKey: (key: Key | Key[]) => void;
|
|
10
11
|
getRowData: (index: number) => RecordType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("vue");require("../../utils/index.js");const v=require("lodash-unified"),y=require("../editable/utils.js"),x=require("../../utils/is.js");let B=0;function V(){return`_ag_grid${B++}`}const S=(l,c,n,w)=>{const h=F.shallowRef([]);function I(i,f){const g=F.unref(n)?.length||0;if(x.isDef(l.maxLength)&&g>=l.maxLength||!i&&v.isFunction(l.rowKey))return;const t={...i||{[l.rowKey]:V()}};c?.setFieldValue(w,t,!1,(r,s)=>{const e=y.getRowKey(t,void 0,l.rowKey);r[s]?r[s][e]=t:r[s]={[e]:t},n.value?v.isUndefined(f)?n.value.push(t):(h.value=n.value.map((u,o)=>o<f?null:y.getRowKey(u,o,l.rowKey)).filter(Boolean),n.value.splice(f,0,t)):n.value=[t],c?.setFieldValue(l.name,t,!0,(u,o)=>{if(!u[o]){u[o]=[t];return}v.isUndefined(f)?u[o].push(t):u[o].splice(f,0,t)})})}function R(i,f="suffix",g=!1){if(!i)return;const t=F.unref(n)?.length||0,r=v.isNumber(i)?i:i.length;if(x.isDef(l.maxLength)&&t+r>l.maxLength||v.isNumber(i)&&v.isFunction(l.rowKey))return;const s=v.isNumber(i)?new Array(i).fill(0).map(()=>({[l.rowKey]:V()})):v.cloneDeep(i),e=y.arrayToObject(s,l.rowKey);c?.setFieldValue(w,e,!1,(u,o)=>{u[o]?Object.assign(u[o],e):u[o]=e,n.value?f==="suffix"?n.value.push(...s):(h.value=n.value.map((K,d)=>y.getRowKey(K,d,l.rowKey)),n.value.unshift(...s)):n.value=[...s],c?.setFieldValue(l.name,s,!0,(K,d)=>{if(!K[d]||g){K[d]=[...s];return}f==="suffix"?K[d].push(...s):K[d].unshift(...s)})})}function j(i,f="suffix"){R(i,f,!1)}function O(i){const f=v.isArray(i)?i:[i];c?.setFieldValue(w,void 0,!1,(g,t)=>{for(const e of f){const u=y.getRowKey(e,void 0,l.rowKey);delete g[t][u]}const r=n.value.filter(e=>!f.includes(e)),s=n.value.findIndex(e=>f.includes(e));h.value=n.value.map((e,u)=>u<=s?null:y.getRowKey(e,u,l.rowKey)).filter(Boolean),r.length?n.value=r:n.value.splice(0,n.value.length),c.setFieldValue(l.name,void 0,!0,(e,u)=>{e[u]=r})})}function T(i){const f=new Set(v.isArray(i)?i:[i]);f.size!==0&&c?.setFieldValue(w,void 0,!1,(g,t)=>{for(const e of f)delete g[t][e];const r=n.value.filter((e,u)=>!f.has(y.getRowKey(e,u,l.rowKey))),s=n.value.findIndex((e,u)=>f.has(y.getRowKey(e,u,l.rowKey)));h.value=n.value.map((e,u)=>u<=s?null:y.getRowKey(e,u,l.rowKey)).filter(Boolean),r.length?n.value=r:n.value.splice(0,n.value.length),c.setFieldValue(l.name,void 0,!0,(e,u)=>{e[u]=r})})}function k(i){return F.unref(n)?.[i]}function q(){return F.unref(n)}function L(i,f,g=!0){c?.setFieldValue?.(w,void 0,!1,(t,r)=>{const s=n.value.findIndex((u,o)=>i===o);if(!~s)return;const e=y.getRowKey(n.value[s],s,l.rowKey);if(e&&!(!t[r]||!t[r][e])){if(!g){const u=Object.keys(t[r][e]);for(const o of u)o!==l.rowKey&&delete t[r][e][o]}Object.assign(t[r][e],{...f})}})}function _(){c?.setFieldValue(w,{}),c?.setFieldValue(l.name,[])}return{add:I,addMultiple:j,__addMultiple:R,remove:O,removeByKey:T,getRowData:k,getRowsData:q,setRowData:L,clear:_,refreshRowIds:h}};exports.useEditableFormItemApi=S;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue"),X=require("@aplus-frontend/antdv"),Y=require("./context.js"),l=require("lodash-unified"),Z=require("@vueuse/core"),b=require("./constant.js"),z=require("../utils/index.js"),ee=require("./utils/set.js"),p=require("./utils/params.js"),te=require("./provider/context.js"),w=require("./utils/get.js"),re=require("../utils/warning.js"),V=require("../utils/is.js"),ne=i.defineComponent({name:"ApForm",__name:"ap-form",props:{layout:{default:"horizontal"},labelCol:{},wrapperCol:{},colon:{type:Boolean,default:!0},labelAlign:{default:"right"},labelWrap:{type:Boolean},prefixCls:{},requiredMark:{},hideRequiredMark:{type:Boolean,default:!1},rules:{},validateMessages:{},validateOnRuleChange:{type:Boolean,default:!0},scrollToFirstError:{},onSubmit:{},name:{},validateTrigger:{default:"change"},size:{},disabled:{type:Boolean},onFieldsChange:{},onFinish:{},onFinishFailed:{},onValidate:{},variant:{},initialValues:{},onValuesChange:{},syncToUrl:{type:[Boolean,Function],default:!1},syncToUrlPriority:{type:Boolean}},setup(O,{expose:j}){const s=O;function v(e,t,r=!0,n){if(l.isArray(e)){let o=a;for(let f=0;f<e.length-1;f++)e[f]in o||(o[e[f]]={}),o=o[e[f]];n?n(o,e[e.length-1]):o[e[e.length-1]]=t}else n?n(a,e):a[e]=t;let c=l.isArray(e)?e[0]:e;if(r){const o={[c]:a[c]};T.triggerFormChange(s.name,o),s.onValuesChange?.(o,a,e)}m()}const u=i.shallowRef(),C=Z.useUrlSearchParams(z.getRouteType()),T=te.useInjectFormProvider(),B=re.useDevWarning("ApForm"),P=i.ref(s.syncToUrl?p.genParams(s.syncToUrl,C,"get"):{});let g=l.cloneDeep(
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue"),X=require("@aplus-frontend/antdv"),Y=require("./context.js"),l=require("lodash-unified"),Z=require("@vueuse/core"),b=require("./constant.js"),z=require("../utils/index.js"),ee=require("./utils/set.js"),p=require("./utils/params.js"),te=require("./provider/context.js"),w=require("./utils/get.js"),re=require("../utils/warning.js"),V=require("../utils/is.js"),ne=i.defineComponent({name:"ApForm",__name:"ap-form",props:{layout:{default:"horizontal"},labelCol:{},wrapperCol:{},colon:{type:Boolean,default:!0},labelAlign:{default:"right"},labelWrap:{type:Boolean},prefixCls:{},requiredMark:{},hideRequiredMark:{type:Boolean,default:!1},rules:{},validateMessages:{},validateOnRuleChange:{type:Boolean,default:!0},scrollToFirstError:{},onSubmit:{},name:{},validateTrigger:{default:"change"},size:{},disabled:{type:Boolean},onFieldsChange:{},onFinish:{},onFinishFailed:{},onValidate:{},variant:{},initialValues:{},onValuesChange:{},syncToUrl:{type:[Boolean,Function],default:!1},syncToUrlPriority:{type:Boolean}},setup(O,{expose:j}){const s=O;function v(e,t,r=!0,n){if(l.isArray(e)){let o=a;for(let f=0;f<e.length-1;f++)e[f]in o||(o[e[f]]={}),o=o[e[f]];n?n(o,e[e.length-1]):o[e[e.length-1]]=t}else n?n(a,e):a[e]=t;let c=l.isArray(e)?e[0]:e;if(r){const o={[c]:a[c]};T.triggerFormChange(s.name,o),s.onValuesChange?.(o,a,e)}m()}const u=i.shallowRef(),C=Z.useUrlSearchParams(z.getRouteType()),T=te.useInjectFormProvider(),B=re.useDevWarning("ApForm"),P=i.ref(s.syncToUrl?p.genParams(s.syncToUrl,C,"get"):{});let g=l.cloneDeep(R()),F={};const a=i.reactive(R());let h=[];function R(){const e=s.initialValues||{};return s.syncToUrlPriority?{...e,...i.unref(P)}:{...i.unref(P),...e}}function E(e){const t=y(e,F);T.triggerFormFinish(s.name,e),s.syncToUrl&&p.setToParams(C,p.genParams(s.syncToUrl,t,"set")),s.onFinish?.(t)}const N=async()=>{u.value?.resetFields(),await i.nextTick(()=>{Object.keys(a).forEach(e=>delete a[e]),Object.assign(a,g),m(),s.syncToUrl&&p.setToParams(C,p.genParams(s.syncToUrl,y(g,F),"set"))})},x=e=>{u.value?.clearValidate(e)},S=(e,t)=>u.value?.validateFields(e,t),D=async(e,t)=>{const r=await u.value?.validateFields(e,t);return y(r,F)},I=e=>e===!0?i.toRaw(a):u.value?.getFieldsValue(e),W=e=>{const t=I(e);return y(t,F)},$=(e,t)=>u.value?.validate(e,t),K=(e,t={})=>{u.value?.scrollToField(e,t)},L=e=>{Object.assign(a,e),m()},q=(e,t,r=!0,n)=>{v(e,t,r,n),m()};function A(e){return e(i.toRaw(a)),h.push(e),()=>{h=h.filter(t=>t!==e)}}function k(e,t){if(l.isArray(e)){let r=g;for(let n=0;n<e.length-1;n++)V.isDef(r[e[n]])||(r[e[n]]={}),r=r[e[n]];r[e[e.length-1]]=t}else g[e]=t}function G(e,t){if(!V.isDef(e)||!V.isDef(t))return;const r=w.getModelValue(g,t);if(l.isEqual(r,e))return;const n=w.getModelValue(i.unref(P),t);V.isDef(n)&&s.syncToUrlPriority||(v(t,e,!1),k(t,e))}function H(e,t){t&&(F=ee.default(F,[e].flat(1),t,!0))}function M({initialValue:e,name:t,transform:r}){G(e,t),H(t,r)}function U(){return g}function J(e){if(B(e===b.INTERNAL_FORM_INSTANCE_MARK,"usage","getInternalInstance should only used at internal"),e===b.INTERNAL_FORM_INSTANCE_MARK)return{registerField:M,registerWatch:A,setFieldValue:q,getInitialValues:U}}function m(){if(h.length){const e=i.toRaw(a);h.forEach(t=>{t(e)})}}function y(e,t){if(e==null)return;let r=l.isArray(e)?[]:{};return Object.keys(e).forEach(n=>{const c=e[n],o=t?.[n],f=l.isFunction(o)?o:o?.transformer,Q=l.isFunction(o)?!0:o?.flat;if(l.isFunction(f)){const d=f(c,{getFieldsValue:I});Q?l.isArray(d)&&l.isArray(r)?r=[...r,...d]:l.isPlainObject(d)&&l.isPlainObject(r)?r={...r,...d}:r[n]=d:r[n]=d}else if(l.isPlainObject(c)||l.isArray(c)){const d=y(c,o);r[n]=d}else r[n]=c}),r}const _={resetFields:N,clearValidate:x,validateFields:S,getFieldsValue:I,validate:$,scrollToField:K,setFieldsValue:L,setFieldValue:q,registerWatch:A,validateFieldsReturnTransformed:D,getFieldsValueTransformed:W,getInternalInstance:J};return i.watch(()=>s.name,e=>{e&&(T.registerForm(e,_),i.onWatcherCleanup(()=>{T.unregisterForm(s.name)}))},{immediate:!0}),Y.useProvideForm({model:i.computed(()=>a),updateModel:v,internalInstance:{registerWatch:A,registerField:M,setFieldValue:q,getInitialValues:U}}),j(_),(e,t)=>(i.openBlock(),i.createBlock(i.unref(X.Form),i.mergeProps({ref_key:"formRef",ref:u},i.unref(l.omit)(s,["initialValues","onValuesChange","onFinish","syncToUrl","syncToUrlPriority"]),{model:a,"data-form-name":e.name,onFinish:E}),{default:i.withCtx(()=>[i.renderSlot(e.$slots,"default")]),_:3},16,["model","data-form-name"]))}});exports.default=ne;
|
|
@@ -829,7 +829,7 @@ declare function __VLS_template(): {
|
|
|
829
829
|
validateOnRuleChange: boolean;
|
|
830
830
|
validateTrigger: string | string[];
|
|
831
831
|
syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
|
|
832
|
-
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "
|
|
832
|
+
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "getFieldsValue" | "setFieldsValue" | "setFieldValue" | "resetFields" | "clearValidate" | "validateFields" | "validate" | "scrollToField" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed" | "registerWatch" | ("layout" | "colon" | "labelAlign" | "hideRequiredMark" | "validateOnRuleChange" | "validateTrigger" | "syncToUrl")> & ShallowUnwrapRef<{
|
|
833
833
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
834
834
|
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
835
835
|
resetFields: () => Promise<void>;
|
|
@@ -852,13 +852,13 @@ declare function __VLS_template(): {
|
|
|
852
852
|
};
|
|
853
853
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
854
854
|
declare const __VLS_component: DefineComponent<ApFormDrawerFormProps, {
|
|
855
|
-
|
|
855
|
+
getFieldsValue: (nameList?: true | InternalNamePath[]) => Partial<any> | undefined;
|
|
856
856
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
857
857
|
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
858
858
|
resetFields: () => Promise<void>;
|
|
859
859
|
clearValidate: (name?: NamePath) => void;
|
|
860
860
|
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
861
|
-
|
|
861
|
+
validate: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
862
862
|
scrollToField: (name: NamePath, options?: any) => void;
|
|
863
863
|
getInternalInstance: (mark: string) => ApFormInternalInstance | undefined;
|
|
864
864
|
validateFieldsReturnTransformed: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
@@ -1792,7 +1792,7 @@ declare const __VLS_component: DefineComponent<ApFormDrawerFormProps, {
|
|
|
1792
1792
|
validateOnRuleChange: boolean;
|
|
1793
1793
|
validateTrigger: string | string[];
|
|
1794
1794
|
syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
|
|
1795
|
-
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "
|
|
1795
|
+
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "getFieldsValue" | "setFieldsValue" | "setFieldValue" | "resetFields" | "clearValidate" | "validateFields" | "validate" | "scrollToField" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed" | "registerWatch" | ("layout" | "colon" | "labelAlign" | "hideRequiredMark" | "validateOnRuleChange" | "validateTrigger" | "syncToUrl")> & ShallowUnwrapRef<{
|
|
1796
1796
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
1797
1797
|
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
1798
1798
|
resetFields: () => Promise<void>;
|
|
@@ -4,9 +4,10 @@ import { InternalNamePath, NamePath, ValidateOptions } from '@aplus-frontend/ant
|
|
|
4
4
|
import { LiteralUnion, Recordable } from '../type';
|
|
5
5
|
import { VNode } from 'vue';
|
|
6
6
|
import { BreakPointType } from './search-form/hooks/use-count-per-row';
|
|
7
|
+
import { ApFormInstance } from './provider/interface';
|
|
7
8
|
export type { ApFormChangeInfo, ApFormFinishInfo } from './provider/interface';
|
|
8
9
|
export type ApFormColProps = Omit<ColProps, 'prefixCls'>;
|
|
9
|
-
export type ApFormItemTransformFn = (value: any) => any;
|
|
10
|
+
export type ApFormItemTransformFn = (value: any, api?: Pick<ApFormInstance, 'getFieldsValue'>) => any;
|
|
10
11
|
export type ApFormItemTransformType = ApFormItemTransformFn | {
|
|
11
12
|
transformer: ApFormItemTransformFn;
|
|
12
13
|
/**
|
|
@@ -830,7 +830,7 @@ declare function __VLS_template(): {
|
|
|
830
830
|
validateOnRuleChange: boolean;
|
|
831
831
|
validateTrigger: string | string[];
|
|
832
832
|
syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
|
|
833
|
-
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "
|
|
833
|
+
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "getFieldsValue" | "setFieldsValue" | "setFieldValue" | "resetFields" | "clearValidate" | "validateFields" | "validate" | "scrollToField" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed" | "registerWatch" | ("layout" | "colon" | "labelAlign" | "hideRequiredMark" | "validateOnRuleChange" | "validateTrigger" | "syncToUrl")> & ShallowUnwrapRef<{
|
|
834
834
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
835
835
|
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
836
836
|
resetFields: () => Promise<void>;
|
|
@@ -853,13 +853,13 @@ declare function __VLS_template(): {
|
|
|
853
853
|
};
|
|
854
854
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
855
855
|
declare const __VLS_component: DefineComponent<ApFormModalFormProps, {
|
|
856
|
-
|
|
856
|
+
getFieldsValue: (nameList?: true | InternalNamePath[]) => Partial<any> | undefined;
|
|
857
857
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
858
858
|
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
859
859
|
resetFields: () => Promise<void>;
|
|
860
860
|
clearValidate: (name?: NamePath) => void;
|
|
861
861
|
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
862
|
-
|
|
862
|
+
validate: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
863
863
|
scrollToField: (name: NamePath, options?: any) => void;
|
|
864
864
|
getInternalInstance: (mark: string) => ApFormInternalInstance | undefined;
|
|
865
865
|
validateFieldsReturnTransformed: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
@@ -2033,7 +2033,7 @@ declare const __VLS_component: DefineComponent<ApFormModalFormProps, {
|
|
|
2033
2033
|
validateOnRuleChange: boolean;
|
|
2034
2034
|
validateTrigger: string | string[];
|
|
2035
2035
|
syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
|
|
2036
|
-
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "
|
|
2036
|
+
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "getFieldsValue" | "setFieldsValue" | "setFieldValue" | "resetFields" | "clearValidate" | "validateFields" | "validate" | "scrollToField" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed" | "registerWatch" | ("layout" | "colon" | "labelAlign" | "hideRequiredMark" | "validateOnRuleChange" | "validateTrigger" | "syncToUrl")> & ShallowUnwrapRef<{
|
|
2037
2037
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
2038
2038
|
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
2039
2039
|
resetFields: () => Promise<void>;
|
|
@@ -829,7 +829,7 @@ declare function __VLS_template(): {
|
|
|
829
829
|
validateOnRuleChange: boolean;
|
|
830
830
|
validateTrigger: string | string[];
|
|
831
831
|
syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
|
|
832
|
-
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "
|
|
832
|
+
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "getFieldsValue" | "setFieldsValue" | "setFieldValue" | "resetFields" | "clearValidate" | "validateFields" | "validate" | "scrollToField" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed" | "registerWatch" | ("layout" | "colon" | "labelAlign" | "hideRequiredMark" | "validateOnRuleChange" | "validateTrigger" | "syncToUrl")> & ShallowUnwrapRef<{
|
|
833
833
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
834
834
|
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
835
835
|
resetFields: () => Promise<void>;
|
|
@@ -1817,7 +1817,7 @@ declare const __VLS_component: DefineComponent<ApFormSearchFormProps, {
|
|
|
1817
1817
|
validateOnRuleChange: boolean;
|
|
1818
1818
|
validateTrigger: string | string[];
|
|
1819
1819
|
syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
|
|
1820
|
-
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "
|
|
1820
|
+
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "getFieldsValue" | "setFieldsValue" | "setFieldValue" | "resetFields" | "clearValidate" | "validateFields" | "validate" | "scrollToField" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed" | "registerWatch" | ("layout" | "colon" | "labelAlign" | "hideRequiredMark" | "validateOnRuleChange" | "validateTrigger" | "syncToUrl")> & ShallowUnwrapRef<{
|
|
1821
1821
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
1822
1822
|
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
1823
1823
|
resetFields: () => Promise<void>;
|
|
@@ -97,8 +97,8 @@ export interface SelectModalReturnType<T = any> {
|
|
|
97
97
|
updateProps: UpdateSelectPropsFn<T>;
|
|
98
98
|
}
|
|
99
99
|
export interface RequestReturn<T = any> {
|
|
100
|
-
records
|
|
101
|
-
total
|
|
100
|
+
records?: T[];
|
|
101
|
+
total?: number;
|
|
102
102
|
}
|
|
103
103
|
/** open打开方法返回的值的类型 */
|
|
104
104
|
export interface OpenReturnType<RowType> {
|
|
@@ -3,8 +3,8 @@ import { GetRowKey, ModalLayoutConfig, RequestReturn } from './interface';
|
|
|
3
3
|
import { VNodeChild, StyleValue } from 'vue';
|
|
4
4
|
export declare function genRequest(api: ((params: any) => Promise<RequestReturn<any>>) | undefined, gerRowKey: GetRowKey<any>, callback?: (length: number) => void): {
|
|
5
5
|
request: (params: any) => Promise<{
|
|
6
|
-
data: any[];
|
|
7
|
-
total: number;
|
|
6
|
+
data: any[] | undefined;
|
|
7
|
+
total: number | undefined;
|
|
8
8
|
}>;
|
|
9
9
|
setExtraParams: (params?: Recordable) => void;
|
|
10
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./constants.js"),h=require("lodash-unified");function p(e,t,r){let n=null;return{request:async s=>{const i=e;if(!i)return r?.(0),{data:[],total:0};n&&(s=Object.assign(s,n));const{records:l,total:c}=await i(Object.assign({},s));return r?.(l
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./constants.js"),h=require("lodash-unified");function p(e,t,r){let n=null;return{request:async s=>{const i=e;if(!i)return r?.(0),{data:[],total:0};n&&(s=Object.assign(s,n));const{records:l,total:c}=await i(Object.assign({},s));return r?.(l?.length||0),{data:l?.map(d=>u(d,t)),total:c}},setExtraParams:s=>{n=s||null}}}function u(e,t){return h.isFunction(t)?{...e,[a.ROW_KEY]:t(e)}:e}function f(e){return Reflect.deleteProperty(e,a.ROW_KEY),e}function g(e){const{renderSelectedItem:t,rightTitle:r,rightBottom:n,...o}=e||{};return{props:{...o,layoutType:e&&"two-column"},slots:{renderSelectedItem:t,rightTitle:r,rightBottom:n}}}class F{constructor(){this.p=null,this.operateFn=null}buildPromise(){return this.operateFn&&this.operateFn.reject("Ignored Reject: reuse"),this.p=new Promise((t,r)=>{this.operateFn={reject:r,resolve:t}}),this.p}clear(){this.p=null,this.operateFn=null}resolve(t){this.operateFn&&(this.operateFn.resolve(t),this.clear())}reject(t){this.operateFn&&(this.operateFn.reject("Ignored Reject: "+t),this.clear())}}exports.AsyncCallback=F;exports.addRowKeyField=u;exports.delRowKeyField=f;exports.genRequest=p;exports.getModalLayoutConfig=g;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),s=require("@aplus-frontend/antdv"),g=require("@aplus-frontend/icon"),L=require("@ant-design/icons-vue");require("../ap-title/ApTitle.vue.js");require("../ap-download/ap-download.vue2.js");require("../../config-provider/index.js");const V=require("./utils/index.js"),B=require("./style/index.js"),h=require("../../config-provider/hooks/use-namespace.js"),q=require("../../config-provider/hooks/use-locale.js"),C=require("../../config-provider/hooks/use-global-config.js"),w=require("../ap-title/ApTitle.vue2.js"),x=require("../ap-download/ap-download.vue.js"),S=["onClick"],b=e.defineComponent({__name:"ap-appendix",props:{fileList:{},needName:{type:[Boolean,Object],default:void 0},getOssAccess:{},title:{},tooltip:{},column:{default:2},isFileAreaBorder:{type:Boolean,default:!1}},setup(N){const{b:y,e:l,em:p}=h.useNamespace("ap-appendix"),{t:c}=q.useLocale(),_=B.default("ap-appendix"),n=N,m=C.useGlobalConfig("apUpload"),v=C.useGlobalConfig("downloadCenterTriggerConfig"),r=e.computed(()=>V.getFileInfo(n?.needName??m?.value?.needName,n?.fileList??[])),k=e.computed(()=>n.getOssAccess||m.value?.getOssAccess),u=e.computed(()=>!(Array.isArray(r.value)&&r.value.length)),a=e.ref([]),A=e.computed(()=>n.title||c("ap.apAppendix.appendix"));async function E(o,i){if(!(a.value.findIndex(t=>t===i)>-1)){a.value=[...a.value,i];try{if(v.value?.trigger){let t=[o].map(f=>({objectName:f.path,fileName:f.fileName}));await v.value?.trigger(t)}}finally{a.value=a.value.filter(t=>t!==i)}}}return(o,i)=>(e.openBlock(),e.createElementBlock("div",e.mergeProps({class:[e.unref(y)(),e.unref(_)]},{...o.$attrs},{style:{"--ap-appendix-column":`repeat(${Number(n?.column||2)}, 1fr)`}}),[e.renderSlot(o.$slots,"title",{fileList:n.fileList},()=>[e.createVNode(w.default,{title:A.value,"help-message":n?.tooltip},{suffix:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass([e.unref(l)("suffix")])},[e.renderSlot(o.$slots,"titleSuffix",{fileList:n.fileList}),e.renderSlot(o.$slots,"titleDownloadAllBtn",{fileList:n.fileList},()=>[u.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(x.default,{key:0,class:e.normalizeClass([e.unref(l)("download-all")]),text:e.unref(c)("ap.apAppendix.downloadAll"),"get-oss-access":k.value,"file-name":r.value},{icon:e.withCtx(()=>[e.createVNode(e.unref(g.IconVariantDownload))]),_:1},8,["class","text","get-oss-access","file-name"]))])],2)]),_:3},8,["title","help-message"])]),u.value?e.createCommentVNode("",!0):e.renderSlot(o.$slots,"fileArea",{key:0,fileList:n.fileList},()=>[e.createElementVNode("div",{class:e.normalizeClass({[e.unref(l)("file-area")]:!0,[e.unref(p)("file-area","border")]:!!n.isFileAreaBorder})},[e.createElementVNode("div",{class:e.normalizeClass([e.unref(l)("file-area-content")])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(d,t)=>(e.openBlock(),e.createElementBlock("div",{key:t,class:e.normalizeClass({[e.unref(l)("file-area-content-item")]:!0,[e.unref(p)("file-area-content-item","loading")]:a.value.includes(t)})},[e.createVNode(e.unref(s.Tooltip),null,e.createSlots({default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass({[e.unref(l)("file-area-content-item-content")]:!0,[e.unref(l)("file-area-content-item--loading-content")]:a.value.includes(t)}),onClick:f=>E(d,t)},[e.createElementVNode("div",{class:e.normalizeClass([e.unref(l)("file-area-content-item-icon")])},[a.value.includes(t)?(e.openBlock(),e.createBlock(e.unref(L.LoadingOutlined),{key:0})):(e.openBlock(),e.createBlock(e.unref(g.IconApAdLineCloseAttachments),{key:1}))],2),e.createElementVNode("div",{class:e.normalizeClass([e.unref(l)("file-area-content-item-file-name")])},[e.createVNode(e.unref(s.TypographyText),{ellipsis:"",content:d.fileName},null,8,["content"])],2)],10,S)]),_:2},[a.value.includes(t)?void 0:{name:"title",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c)("ap.apAppendix.downloadFile")),1)]),key:"0"}]),1024)],2))),128))],2)],2)]),u.value?e.renderSlot(o.$slots,"empty",{key:1},()=>[e.createElementVNode("div",{class:e.normalizeClass([e.unref(l)("empty")])},[e.createElementVNode("div",{class:e.normalizeClass([e.unref(l)("empty-content")])},[e.createVNode(e.unref(s.Empty),{image:e.unref(s.Empty).PRESENTED_IMAGE_SIMPLE},null,8,["image"])],2)],2)]):e.createCommentVNode("",!0)],16))}});exports.default=b;
|
|
@@ -820,7 +820,7 @@ declare const _default: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOp
|
|
|
820
820
|
validateOnRuleChange: boolean;
|
|
821
821
|
validateTrigger: string | string[];
|
|
822
822
|
syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
|
|
823
|
-
}> & Omit<Readonly<ApFormProps> & Readonly<{}>, "
|
|
823
|
+
}> & Omit<Readonly<ApFormProps> & Readonly<{}>, "getFieldsValue" | "setFieldsValue" | "setFieldValue" | "resetFields" | "clearValidate" | "validateFields" | "validate" | "scrollToField" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed" | "registerWatch" | ("layout" | "colon" | "labelAlign" | "hideRequiredMark" | "validateOnRuleChange" | "validateTrigger" | "syncToUrl")> & ShallowUnwrapRef<{
|
|
824
824
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
825
825
|
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
826
826
|
resetFields: () => Promise<void>;
|
|
@@ -821,7 +821,7 @@ declare const _default: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOp
|
|
|
821
821
|
validateOnRuleChange: boolean;
|
|
822
822
|
validateTrigger: string | string[];
|
|
823
823
|
syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
|
|
824
|
-
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "
|
|
824
|
+
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "getFieldsValue" | "setFieldsValue" | "setFieldValue" | "resetFields" | "clearValidate" | "validateFields" | "validate" | "scrollToField" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed" | "registerWatch" | ("layout" | "colon" | "labelAlign" | "hideRequiredMark" | "validateOnRuleChange" | "validateTrigger" | "syncToUrl")> & ShallowUnwrapRef<{
|
|
825
825
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
826
826
|
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
827
827
|
resetFields: () => Promise<void>;
|
package/lib/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "7.7.
|
|
1
|
+
declare const _default: "7.7.11";
|
|
2
2
|
export default _default;
|
package/lib/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="7.7.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="7.7.11";exports.default=e;
|