@aplus-frontend/ui 0.5.22 → 0.5.24
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.vue.d.ts +2 -2
- package/es/src/ap-form/ap-form.vue2.mjs +124 -124
- package/es/src/ap-form/drawer-form/index.vue.d.ts +5 -5
- package/es/src/ap-form/interface.d.ts +3 -2
- package/es/src/ap-form/modal-form/index.vue.d.ts +5 -5
- package/es/src/ap-form/search-form/index.vue.d.ts +5 -5
- package/es/src/ap-grid/editable/form-item.vue.mjs +65 -61
- package/es/src/ap-grid/editable/index.vue.mjs +86 -81
- package/es/src/ap-grid/editable/interface.d.ts +1 -1
- package/es/src/ap-grid/index.vue.mjs +22 -22
- package/es/src/ap-grid/interface.d.ts +4 -0
- package/es/src/ap-grid/utils/table.d.ts +1 -1
- package/es/src/ap-grid/utils/table.mjs +42 -41
- package/es/src/ap-table/hooks/use-table-paging-ng.mjs +108 -102
- package/es/src/work-order-modal/work-order-modal.vue.d.ts +3 -3
- package/lib/src/ap-form/ap-form.vue.d.ts +2 -2
- package/lib/src/ap-form/ap-form.vue2.js +1 -1
- package/lib/src/ap-form/drawer-form/index.vue.d.ts +5 -5
- package/lib/src/ap-form/interface.d.ts +3 -2
- package/lib/src/ap-form/modal-form/index.vue.d.ts +5 -5
- package/lib/src/ap-form/search-form/index.vue.d.ts +5 -5
- package/lib/src/ap-grid/editable/form-item.vue.js +1 -1
- package/lib/src/ap-grid/editable/index.vue.js +1 -1
- package/lib/src/ap-grid/editable/interface.d.ts +1 -1
- package/lib/src/ap-grid/index.vue.js +1 -1
- package/lib/src/ap-grid/interface.d.ts +4 -0
- package/lib/src/ap-grid/utils/table.d.ts +1 -1
- package/lib/src/ap-grid/utils/table.js +1 -1
- package/lib/src/ap-table/hooks/use-table-paging-ng.js +1 -1
- package/lib/src/work-order-modal/work-order-modal.vue.d.ts +3 -3
- package/package.json +6 -6
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { omit as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
var
|
|
1
|
+
import { omit as l, isUndefined as u, isFunction as h, isNumber as b } from "lodash-unified";
|
|
2
|
+
const w = 20, x = 50;
|
|
3
|
+
function m(e) {
|
|
4
|
+
var i;
|
|
5
5
|
const t = {
|
|
6
|
-
...
|
|
6
|
+
...l(e, [
|
|
7
7
|
"columns",
|
|
8
8
|
"request",
|
|
9
9
|
"searchForm",
|
|
@@ -15,62 +15,63 @@ function y(e) {
|
|
|
15
15
|
if (e.adaptive && (t.autoResize = !0, t.height = "100%"), e.columnResizable && (t.columnConfig ? t.columnConfig.resizable = !0 : t.columnConfig = {
|
|
16
16
|
resizable: !0
|
|
17
17
|
}), e.rowSelection) {
|
|
18
|
-
const
|
|
19
|
-
|
|
18
|
+
const o = e.rowSelection === !0 ? {} : e.rowSelection;
|
|
19
|
+
o.type === "radio" ? t.radioConfig = {
|
|
20
20
|
highlight: !0,
|
|
21
|
-
checkMethod({ row:
|
|
22
|
-
return
|
|
21
|
+
checkMethod({ row: r }) {
|
|
22
|
+
return o.disabled ? !o.disabled(r) : !0;
|
|
23
23
|
},
|
|
24
|
-
visibleMethod({ row:
|
|
25
|
-
return
|
|
24
|
+
visibleMethod({ row: r }) {
|
|
25
|
+
return o.shown ? o.shown(r) : !0;
|
|
26
26
|
},
|
|
27
|
-
checkRowKey: (
|
|
28
|
-
reserve:
|
|
27
|
+
checkRowKey: (i = o.defaultSelectedRowKeys) == null ? void 0 : i[0],
|
|
28
|
+
reserve: u(o.preserveSelectedRowKeys) ? !0 : o.preserveSelectedRowKeys
|
|
29
29
|
} : t.checkboxConfig = {
|
|
30
30
|
highlight: !0,
|
|
31
|
-
checkMethod({ row:
|
|
32
|
-
return
|
|
31
|
+
checkMethod({ row: r }) {
|
|
32
|
+
return o.disabled ? !o.disabled(r) : !0;
|
|
33
33
|
},
|
|
34
|
-
visibleMethod({ row:
|
|
35
|
-
return
|
|
34
|
+
visibleMethod({ row: r }) {
|
|
35
|
+
return o.shown ? o.shown(r) : !0;
|
|
36
36
|
},
|
|
37
|
-
checkRowKeys:
|
|
38
|
-
reserve:
|
|
39
|
-
range:
|
|
37
|
+
checkRowKeys: o.defaultSelectedRowKeys,
|
|
38
|
+
reserve: u(o.preserveSelectedRowKeys) ? !0 : o.preserveSelectedRowKeys,
|
|
39
|
+
range: o.range || !1
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
return t.border = e.bordered, e.expandable && (t.expandConfig =
|
|
42
|
+
return t.border = e.bordered, e.expandable && (t.expandConfig = l(e.expandable, [
|
|
43
43
|
"renderContent",
|
|
44
44
|
"width",
|
|
45
45
|
"title"
|
|
46
|
-
])), e.footer && (t.showFooter = !0,
|
|
46
|
+
])), e.footer && (t.showFooter = !0, h(e.footer) ? t.footerMethod = e.footer : t.footerData = e.footer), e.virtual === !1 ? (t.virtualXConfig = {
|
|
47
47
|
enabled: !1
|
|
48
48
|
}, t.virtualYConfig = {
|
|
49
49
|
enabled: !1
|
|
50
|
-
}) : (
|
|
50
|
+
}) : (a(t, "X", e.virtual), a(t, "Y", e.virtual)), t;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
const
|
|
54
|
-
e[
|
|
55
|
-
enabled:
|
|
56
|
-
gt:
|
|
52
|
+
function a(e, t, i) {
|
|
53
|
+
const o = t === "X", r = o ? "x" : "y", n = o ? "virtualXConfig" : "virtualYConfig", s = i == null ? void 0 : i[r], f = s !== !1, d = o ? w : x, c = b(s) && s >= 0 ? s : d;
|
|
54
|
+
e[n] = {
|
|
55
|
+
enabled: f,
|
|
56
|
+
gt: c,
|
|
57
|
+
oSize: (i == null ? void 0 : i.oSize) || 0
|
|
57
58
|
};
|
|
58
59
|
}
|
|
59
|
-
function
|
|
60
|
+
function y(e) {
|
|
60
61
|
return e === !0 ? "left" : e;
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
-
const
|
|
64
|
-
let
|
|
65
|
-
return
|
|
66
|
-
(
|
|
63
|
+
function C(e, t) {
|
|
64
|
+
const i = e === !0 || !e.type ? "checkbox" : e.type, o = e === !0 ? 60 : e.columnWidth || 60;
|
|
65
|
+
let r = e === !0 ? void 0 : y(e.fixed);
|
|
66
|
+
return r || (r === !1 ? r = void 0 : r = t.some(
|
|
67
|
+
(n) => n.fixed === "left" || n.fixed === !0
|
|
67
68
|
) ? "left" : void 0), {
|
|
68
|
-
type:
|
|
69
|
-
width:
|
|
70
|
-
fixed:
|
|
69
|
+
type: i,
|
|
70
|
+
width: o,
|
|
71
|
+
fixed: r
|
|
71
72
|
};
|
|
72
73
|
}
|
|
73
|
-
function
|
|
74
|
+
function g(e) {
|
|
74
75
|
const t = (e == null ? void 0 : e.width) || "auto";
|
|
75
76
|
return {
|
|
76
77
|
type: "expand",
|
|
@@ -79,7 +80,7 @@ function x(e) {
|
|
|
79
80
|
};
|
|
80
81
|
}
|
|
81
82
|
export {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
g as getRowExpandProps,
|
|
84
|
+
C as getRowSelectionProps,
|
|
85
|
+
m as toVxeProps
|
|
85
86
|
};
|
|
@@ -1,46 +1,52 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { useTableSortedAndFiltered as
|
|
1
|
+
import { ref as ae, reactive as j, unref as h, nextTick as se, onMounted as ie, watch as ce, computed as A, createVNode as x } from "vue";
|
|
2
|
+
import { useTableSortedAndFiltered as ue } from "./use-sorted-filtered.mjs";
|
|
3
3
|
import "../../config-provider/index.mjs";
|
|
4
|
-
import { parseFieldValue as le, dataIndexToStr as
|
|
5
|
-
import { isArray as q, isEqualWith as
|
|
4
|
+
import { parseFieldValue as le, dataIndexToStr as fe, isEqualCustom as ge } from "../utils.mjs";
|
|
5
|
+
import { isArray as q, isEqualWith as de, isUndefined as pe } from "lodash-unified";
|
|
6
6
|
import { isDef as N } from "../../utils/index.mjs";
|
|
7
|
-
import { useLocale as
|
|
8
|
-
import { useNamespace as
|
|
9
|
-
const S = 1, D = 10
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
import { useLocale as me } from "../../config-provider/hooks/use-locale.mjs";
|
|
8
|
+
import { useNamespace as he } from "../../config-provider/hooks/use-namespace.mjs";
|
|
9
|
+
const S = 1, D = 10, B = {
|
|
10
|
+
defaultCurrent: S,
|
|
11
|
+
defaultPageSize: D,
|
|
12
|
+
showLessItems: !1,
|
|
13
|
+
showTotal: !0
|
|
14
|
+
};
|
|
15
|
+
function Se(s) {
|
|
16
|
+
return s === !1 ? {} : s == null || s === !0 ? B : {
|
|
17
|
+
...B,
|
|
18
|
+
...s
|
|
19
|
+
};
|
|
13
20
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
21
|
+
function ze(s) {
|
|
22
|
+
const f = {};
|
|
23
|
+
return s === !1 || (s === !0 || s == null ? (f.current = S, f.pageSize = D) : (f.current = s.defaultCurrent || S, f.pageSize = s.defaultPageSize || D)), f;
|
|
24
|
+
}
|
|
25
|
+
const Ae = ({
|
|
26
|
+
manual: s = !1,
|
|
27
|
+
request: f,
|
|
17
28
|
defaultParams: L = {},
|
|
18
29
|
defaultData: v = [],
|
|
19
30
|
formatParams: y,
|
|
20
31
|
paramsValueTypeMap: O,
|
|
21
32
|
resetFieldsIgnores: R,
|
|
22
|
-
filterFields:
|
|
23
|
-
sortFields:
|
|
24
|
-
namespace:
|
|
25
|
-
pagination:
|
|
26
|
-
defaultCurrent: S,
|
|
27
|
-
defaultPageSize: D,
|
|
28
|
-
showLessItems: !1,
|
|
29
|
-
showTotal: !0
|
|
30
|
-
}
|
|
33
|
+
filterFields: J,
|
|
34
|
+
sortFields: K,
|
|
35
|
+
namespace: M = "ap-table",
|
|
36
|
+
pagination: d
|
|
31
37
|
}) => {
|
|
32
|
-
let b = 0,
|
|
33
|
-
const
|
|
34
|
-
getColumnSFConfig:
|
|
35
|
-
setSF:
|
|
36
|
-
clearAll:
|
|
37
|
-
sortedInfo:
|
|
38
|
-
filteredInfo:
|
|
39
|
-
} =
|
|
38
|
+
let b = 0, i = {};
|
|
39
|
+
const Q = Se(d), $ = (e) => y ? y(e) : e, z = ae(), c = j(ze(d)), {
|
|
40
|
+
getColumnSFConfig: G,
|
|
41
|
+
setSF: W,
|
|
42
|
+
clearAll: Z,
|
|
43
|
+
sortedInfo: H,
|
|
44
|
+
filteredInfo: X
|
|
45
|
+
} = ue(), {
|
|
40
46
|
t: T
|
|
41
|
-
} =
|
|
47
|
+
} = me(), {
|
|
42
48
|
b: P
|
|
43
|
-
} =
|
|
49
|
+
} = he(M), a = j({
|
|
44
50
|
total: v.length,
|
|
45
51
|
records: v,
|
|
46
52
|
loading: !1
|
|
@@ -48,15 +54,15 @@ const be = ({
|
|
|
48
54
|
var e, t;
|
|
49
55
|
return ((t = (e = z.value) == null ? void 0 : e.apForm) == null ? void 0 : t.getFieldsValueTransformed(!0)) || {};
|
|
50
56
|
}, I = async (e) => {
|
|
51
|
-
var
|
|
52
|
-
const t =
|
|
57
|
+
var n;
|
|
58
|
+
const t = $(e), r = Date.now();
|
|
53
59
|
b = r, a.loading = !0;
|
|
54
60
|
try {
|
|
55
|
-
const
|
|
61
|
+
const o = await f({
|
|
56
62
|
...h(L),
|
|
57
63
|
...t
|
|
58
64
|
});
|
|
59
|
-
b === r && (a.total =
|
|
65
|
+
b === r && (a.total = o.total || ((n = o.data) == null ? void 0 : n.length) || 0, a.records = [...o.data || []]);
|
|
60
66
|
} catch {
|
|
61
67
|
b === r && (a.records = [], a.total = 0);
|
|
62
68
|
} finally {
|
|
@@ -64,103 +70,103 @@ const be = ({
|
|
|
64
70
|
}
|
|
65
71
|
}, V = (e) => {
|
|
66
72
|
const t = {};
|
|
67
|
-
return Object.entries(e).forEach(([r,
|
|
68
|
-
if (t[r] =
|
|
69
|
-
const
|
|
70
|
-
|
|
73
|
+
return Object.entries(e).forEach(([r, n]) => {
|
|
74
|
+
if (t[r] = n, O && n) {
|
|
75
|
+
const o = O[r];
|
|
76
|
+
o && (t[r] = le(o, n));
|
|
71
77
|
}
|
|
72
78
|
}), t;
|
|
73
|
-
},
|
|
74
|
-
var
|
|
79
|
+
}, Y = async (e) => {
|
|
80
|
+
var n, o, l, g, p;
|
|
75
81
|
const t = w(), r = {};
|
|
76
|
-
Object.entries(t).forEach(([m,
|
|
77
|
-
R && R.indexOf(m) > -1 && (r[m] =
|
|
78
|
-
}), await ((
|
|
82
|
+
Object.entries(t).forEach(([m, F]) => {
|
|
83
|
+
R && R.indexOf(m) > -1 && (r[m] = F);
|
|
84
|
+
}), await ((o = (n = z.value) == null ? void 0 : n.apForm) == null ? void 0 : o.resetFields()), (p = (g = (l = z.value) == null ? void 0 : l.apForm) == null ? void 0 : g.setFieldsValue) == null || p.call(g, r), se(() => {
|
|
79
85
|
e == null || e();
|
|
80
86
|
});
|
|
81
|
-
},
|
|
82
|
-
|
|
87
|
+
}, C = (e) => {
|
|
88
|
+
i = e;
|
|
83
89
|
const t = V(e);
|
|
84
90
|
I(t);
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
...
|
|
91
|
+
}, k = (e) => {
|
|
92
|
+
C({
|
|
93
|
+
...i,
|
|
88
94
|
...e
|
|
89
95
|
});
|
|
90
96
|
}, E = () => {
|
|
91
97
|
const e = w();
|
|
92
|
-
|
|
98
|
+
d && (c.current = S), C({
|
|
93
99
|
...e,
|
|
94
|
-
filter:
|
|
95
|
-
sort:
|
|
96
|
-
current:
|
|
97
|
-
pageSize:
|
|
100
|
+
filter: i.filter,
|
|
101
|
+
sort: i.sort,
|
|
102
|
+
current: d ? S : void 0,
|
|
103
|
+
pageSize: d ? i.pageSize || c.pageSize : void 0
|
|
98
104
|
});
|
|
99
|
-
},
|
|
100
|
-
|
|
105
|
+
}, ee = () => {
|
|
106
|
+
Z(), i.sort = {}, i.filter = {}, Y(E);
|
|
101
107
|
}, U = () => {
|
|
102
|
-
|
|
103
|
-
},
|
|
104
|
-
if (!
|
|
108
|
+
C(i);
|
|
109
|
+
}, te = (e) => {
|
|
110
|
+
if (!d)
|
|
105
111
|
U();
|
|
106
112
|
else {
|
|
107
113
|
const {
|
|
108
114
|
current: t,
|
|
109
115
|
pageSize: r
|
|
110
|
-
} =
|
|
111
|
-
|
|
116
|
+
} = c, n = a.total - e, o = Math.ceil(n / r), l = t > o ? o : t;
|
|
117
|
+
k({
|
|
112
118
|
current: l > 0 ? l : 1
|
|
113
119
|
});
|
|
114
120
|
}
|
|
115
121
|
}, _ = (e, t, r) => {
|
|
116
|
-
var m,
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
const
|
|
120
|
-
for (const
|
|
121
|
-
(m = h(
|
|
122
|
-
const
|
|
123
|
-
for (const
|
|
124
|
-
(
|
|
125
|
-
const
|
|
126
|
-
...
|
|
127
|
-
filter:
|
|
122
|
+
var m, F;
|
|
123
|
+
const n = w();
|
|
124
|
+
c.current = e.current, c.pageSize = e.pageSize, W(t, r);
|
|
125
|
+
const o = q(r) ? [...r] : [r], l = {};
|
|
126
|
+
for (const u of o)
|
|
127
|
+
(m = h(K)) != null && m.includes(u.columnKey || u.field) && u.order && (l[fe(u.columnKey || u.field)] = u.order);
|
|
128
|
+
const g = {};
|
|
129
|
+
for (const u of Object.keys(t))
|
|
130
|
+
(F = h(J)) != null && F.includes(u) && t[u] && (g[u] = t[u]);
|
|
131
|
+
const p = {
|
|
132
|
+
...n,
|
|
133
|
+
filter: g,
|
|
128
134
|
sort: l,
|
|
129
135
|
current: e.current,
|
|
130
136
|
pageSize: e.pageSize
|
|
131
137
|
};
|
|
132
|
-
|
|
138
|
+
de(i, p, ge) || C(p);
|
|
133
139
|
};
|
|
134
|
-
|
|
140
|
+
ie(() => {
|
|
135
141
|
const e = w(), {
|
|
136
142
|
current: t,
|
|
137
143
|
pageSize: r
|
|
138
|
-
} =
|
|
139
|
-
if (
|
|
144
|
+
} = c;
|
|
145
|
+
if (i = {
|
|
140
146
|
current: t,
|
|
141
147
|
pageSize: r,
|
|
142
148
|
filter: {},
|
|
143
149
|
sort: {},
|
|
144
150
|
...e
|
|
145
|
-
}, !
|
|
146
|
-
const
|
|
147
|
-
I(
|
|
151
|
+
}, !s) {
|
|
152
|
+
const n = V(i);
|
|
153
|
+
I(n);
|
|
148
154
|
}
|
|
149
|
-
}),
|
|
155
|
+
}), ce(() => h(L), () => {
|
|
150
156
|
E();
|
|
151
157
|
}, {
|
|
152
158
|
deep: !0
|
|
153
159
|
});
|
|
154
|
-
const
|
|
160
|
+
const re = A(() => {
|
|
155
161
|
if (a.total === 0)
|
|
156
162
|
return "-";
|
|
157
163
|
const {
|
|
158
164
|
current: e,
|
|
159
165
|
pageSize: t
|
|
160
|
-
} =
|
|
166
|
+
} = c;
|
|
161
167
|
return `${e}/${Math.ceil(a.total / t)}`;
|
|
162
168
|
});
|
|
163
|
-
function
|
|
169
|
+
function ne(e) {
|
|
164
170
|
q(e) && (a.records = e, a.total = e.length);
|
|
165
171
|
}
|
|
166
172
|
const oe = A(() => {
|
|
@@ -168,20 +174,20 @@ const be = ({
|
|
|
168
174
|
showLessItems: e,
|
|
169
175
|
showTotal: t,
|
|
170
176
|
showQuickJumper: r,
|
|
171
|
-
showSizeChanger:
|
|
172
|
-
pageSizeOptions:
|
|
173
|
-
} =
|
|
177
|
+
showSizeChanger: n,
|
|
178
|
+
pageSizeOptions: o
|
|
179
|
+
} = Q;
|
|
174
180
|
return {
|
|
175
181
|
loading: a.loading,
|
|
176
182
|
pagination: {
|
|
177
|
-
current:
|
|
178
|
-
pageSize:
|
|
183
|
+
current: c.current,
|
|
184
|
+
pageSize: c.pageSize,
|
|
179
185
|
total: a.total,
|
|
180
|
-
showSizeChanger: N(
|
|
186
|
+
showSizeChanger: N(n) ? n : !e,
|
|
181
187
|
showQuickJumper: N(r) ? r : !e,
|
|
182
188
|
showLessItems: e,
|
|
183
189
|
size: "default",
|
|
184
|
-
pageSizeOptions: pe(
|
|
190
|
+
pageSizeOptions: pe(o) ? ["10", "20", "50", "100"] : o,
|
|
185
191
|
showTotal: t ? (l) => x("span", {
|
|
186
192
|
class: P("pagination-total-wrapper")
|
|
187
193
|
}, [T("ap.apTable.pagination.totalLeftPrefix"), " ", x("span", {
|
|
@@ -190,7 +196,7 @@ const be = ({
|
|
|
190
196
|
class: P("pagination--total-right")
|
|
191
197
|
}, [T("ap.apTable.pagination.totalRightPrefix"), " ", x("span", {
|
|
192
198
|
class: P("pagination-count-text")
|
|
193
|
-
}, [h(
|
|
199
|
+
}, [h(re)]), " ", T("ap.apTable.pagination.totalRightSuffix")])]) : void 0
|
|
194
200
|
},
|
|
195
201
|
onChange: _,
|
|
196
202
|
dataSource: a.records
|
|
@@ -199,23 +205,23 @@ const be = ({
|
|
|
199
205
|
return {
|
|
200
206
|
formRef: z,
|
|
201
207
|
submit: E,
|
|
202
|
-
reset:
|
|
208
|
+
reset: ee,
|
|
203
209
|
refresh: U,
|
|
204
|
-
refreshByDelete:
|
|
210
|
+
refreshByDelete: te,
|
|
205
211
|
data: a,
|
|
206
|
-
current:
|
|
207
|
-
pageSize:
|
|
212
|
+
current: c.current,
|
|
213
|
+
pageSize: c.pageSize,
|
|
208
214
|
handleTableChange: _,
|
|
209
215
|
tableProps: oe,
|
|
210
216
|
dataSource: A(() => a.records),
|
|
211
|
-
setDataSource:
|
|
212
|
-
getColumnSFConfig:
|
|
213
|
-
sortedInfo:
|
|
214
|
-
filteredInfo:
|
|
217
|
+
setDataSource: ne,
|
|
218
|
+
getColumnSFConfig: G,
|
|
219
|
+
sortedInfo: H,
|
|
220
|
+
filteredInfo: X
|
|
215
221
|
};
|
|
216
222
|
};
|
|
217
223
|
export {
|
|
218
224
|
S as DEFAULT_CURRENT,
|
|
219
225
|
D as DEFAULT_PAGE_SIZE,
|
|
220
|
-
|
|
226
|
+
Ae as useTablePaging
|
|
221
227
|
};
|
|
@@ -9,7 +9,7 @@ import { Options } from '../../node_modules/scroll-into-view-if-needed';
|
|
|
9
9
|
import { Recordable } from '../type';
|
|
10
10
|
import { VueTypeDef, VueTypeValidableDef } from '../../node_modules/vue-types';
|
|
11
11
|
import { VueNode } from '@aplus-frontend/antdv/es/_util/type';
|
|
12
|
-
import { ApFormProps, ApFormInternalInstance, WatchFunc } from '..';
|
|
12
|
+
import { ApFormProps, UpdateModelOptimizeFn, ApFormInternalInstance, WatchFunc } from '..';
|
|
13
13
|
import { OnCleanup } from '@vue/reactivity';
|
|
14
14
|
declare const _default: DefineComponent<WorkOrderModalProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
15
15
|
"update:open": () => any;
|
|
@@ -766,7 +766,7 @@ declare const _default: DefineComponent<WorkOrderModalProps, {}, {}, {}, {}, Com
|
|
|
766
766
|
$el: any;
|
|
767
767
|
$options: ComponentOptionsBase<Readonly< ApFormProps> & Readonly<{}>, {
|
|
768
768
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
769
|
-
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean) => void;
|
|
769
|
+
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
770
770
|
resetFields: () => Promise<void>;
|
|
771
771
|
clearValidate: (name?: NamePath) => void;
|
|
772
772
|
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
@@ -815,7 +815,7 @@ declare const _default: DefineComponent<WorkOrderModalProps, {}, {}, {}, {}, Com
|
|
|
815
815
|
syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
|
|
816
816
|
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "validate" | "resetFields" | "clearValidate" | "validateFields" | "getFieldsValue" | "scrollToField" | "registerWatch" | "setFieldValue" | ("layout" | "colon" | "labelAlign" | "validateTrigger" | "hideRequiredMark" | "validateOnRuleChange" | "syncToUrl") | "setFieldsValue" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed"> & ShallowUnwrapRef<{
|
|
817
817
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
818
|
-
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean) => void;
|
|
818
|
+
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
819
819
|
resetFields: () => Promise<void>;
|
|
820
820
|
clearValidate: (name?: NamePath) => void;
|
|
821
821
|
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApFormProps, WatchFunc, ApFormInternalInstance } from './interface';
|
|
1
|
+
import { ApFormProps, UpdateModelOptimizeFn, WatchFunc, ApFormInternalInstance } from './interface';
|
|
2
2
|
import { InternalNamePath, NamePath, ValidateOptions, FormLabelAlign, ValidateMessages, FieldData, ValidateErrorEntity } from '@aplus-frontend/antdv/es/form/interface';
|
|
3
3
|
import { Recordable } from '../type';
|
|
4
4
|
import { CreateComponentPublicInstanceWithMixins, ExtractPropTypes, PropType, HTMLAttributes, ComponentOptionsMixin, PublicProps, GlobalComponents, GlobalDirectives, ComponentProvideOptions, DefineComponent } from 'vue';
|
|
@@ -655,7 +655,7 @@ declare function __VLS_template(): {
|
|
|
655
655
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
656
656
|
declare const __VLS_component: DefineComponent<ApFormProps, {
|
|
657
657
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
658
|
-
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean) => void;
|
|
658
|
+
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
659
659
|
resetFields: () => Promise<void>;
|
|
660
660
|
clearValidate: (name?: NamePath) => void;
|
|
661
661
|
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue"),k=require("@aplus-frontend/antdv"),K=require("./context.js"),o=require("lodash-unified"),G=require("@vueuse/core"),H=require("./constant.js"),T=require("../utils/index.js"),J=require("./utils/set.js"),v=require("./utils/params.js"),Q=require("./provider/context.js"),X=i.defineComponent({__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:{},initialValues:{},onValuesChange:{},syncToUrl:{type:[Boolean,Function],default:!1},syncToUrlPriority:{type:Boolean}},setup(O,{expose:j}){function B(e,t){return o.isArray(t)?t.reduce((r,n)=>r==null?void 0:r[n],e):e==null?void 0:e[t]}const s=O;function b(e,t,r=!0,n){var l;if(o.isArray(e)){let c=u;for(let g=0;g<e.length-1;g++)e[g]in c||(c[e[g]]={}),c=c[e[g]];n?n(c,e[e.length-1]):c[e[e.length-1]]=t}else n?n(u,e):u[e]=t;let a=o.isArray(e)?e[0]:e;if(r){const c={[a]:u[a]};V.triggerFormChange(s.name,c),(l=s.onValuesChange)==null||l.call(s,c,u,e)}P()}const f=i.ref(),q=G.useUrlSearchParams(T.getRouteType()),V=Q.useInjectFormProvider(),A=i.ref(s.syncToUrl?v.genParams(s.syncToUrl,q,"get"):{});let p=o.cloneDeep(I()),F={};const u=i.reactive(I());let h=[];function I(){const e=s.initialValues||{};return s.syncToUrlPriority?{...e,...i.unref(A)}:{...i.unref(A),...e}}function m(e){var r;const t=y(e,F);V.triggerFormFinish(s.name,e),s.syncToUrl&&v.setToParams(q,v.genParams(s.syncToUrl,t,"set")),(r=s.onFinish)==null||r.call(s,t)}const w=async()=>{var e;(e=f.value)==null||e.resetFields(),await i.nextTick(()=>{Object.keys(u).forEach(t=>delete u[t]),Object.assign(u,p),P(),s.syncToUrl&&v.setToParams(q,v.genParams(s.syncToUrl,y(p,F),"set"))})},x=e=>{var t;(t=f.value)==null||t.clearValidate(e)},E=(e,t)=>{var r;return(r=f.value)==null?void 0:r.validateFields(e,t)},S=async(e,t)=>{var n;const r=await((n=f.value)==null?void 0:n.validateFields(e,t));return y(r,F)},C=e=>{var t;return(t=f.value)==null?void 0:t.getFieldsValue(e)},D=e=>{var r;const t=(r=f.value)==null?void 0:r.getFieldsValue(e);return y(t,F)},N=(e,t)=>{var r;return(r=f.value)==null?void 0:r.validate(e,t)},W=(e,t={})=>{var r;(r=f.value)==null||r.scrollToField(e,t)},$=e=>{Object.assign(u,e),P()},U=(e,t,r=!0,n)=>{b(e,t,r,n),P()};function _(e,t){return t||e(i.toRaw(u)),h.push(e),()=>{h=h.filter(r=>r!==e)}}function M({initialValue:e,name:t,transform:r}){if(T.isDef(e)&&T.isDef(t)){const n=B(i.unref(A),t);if(!T.isDef(n)||!s.syncToUrlPriority)if(b(t,e,!1),o.isArray(t)){let a=p;for(let l=0;l<t.length-1;l++)T.isDef(a[t[l]])||(a[t[l]]={}),a=a[t[l]];a[t[t.length-1]]=e}else p[t]=e}r&&(F=J.default(F,[t].flat(1),r,!0))}function L(e){if(e!==H.INTERNAL_FORM_INSTANCE_MARK){console.warn("getInternalInstance should only used at internal");return}return{registerField:M,registerWatch:_,setFieldValue:U}}function P(){if(h.length){const e=i.toRaw(u);h.forEach(t=>{t(e)})}}function y(e,t){if(e==null)return;let r=o.isArray(e)?[]:{};return Object.keys(e).forEach(n=>{const a=e[n],l=t==null?void 0:t[n],c=o.isFunction(l)?l:l==null?void 0:l.transformer,g=o.isFunction(l)?!0:l==null?void 0:l.flat;if(o.isFunction(c)){const d=c(a);g?o.isArray(d)&&o.isArray(r)?r=[...r,...d]:o.isPlainObject(d)&&o.isPlainObject(r)?r={...r,...d}:r[n]=d:r[n]=d}else if(o.isPlainObject(a)||o.isArray(a)){const d=y(a,l);r[n]=d}else r[n]=a}),r}const R={resetFields:w,clearValidate:x,validateFields:E,getFieldsValue:C,validate:N,scrollToField:W,setFieldsValue:$,setFieldValue:U,registerWatch:_,validateFieldsReturnTransformed:S,getFieldsValueTransformed:D,getInternalInstance:L};return i.watch(()=>s.name,e=>{e&&(V.registerForm(e,R),i.onWatcherCleanup(()=>{V.unregisterForm(s.name)}))},{immediate:!0}),K.useProvideForm({model:i.computed(()=>u),updateModel:b,internalInstance:{registerWatch:_,registerField:M,setFieldValue:U}}),j(R),(e,t)=>(i.openBlock(),i.createBlock(i.unref(k.Form),i.mergeProps({ref_key:"formRef",ref:f},i.unref(o.omit)(s,["initialValues","onValuesChange","onFinish"]),{model:u,onFinish:m}),{default:i.withCtx(()=>[i.renderSlot(e.$slots,"default")]),_:3},16,["model"]))}});exports.default=X;
|
|
@@ -9,7 +9,7 @@ import { Options } from '../../../node_modules/scroll-into-view-if-needed';
|
|
|
9
9
|
import { Recordable } from '../../type';
|
|
10
10
|
import { VueTypeDef, VueTypeValidableDef } from '../../../node_modules/vue-types';
|
|
11
11
|
import { VueNode } from '@aplus-frontend/antdv/es/_util/type';
|
|
12
|
-
import { ApFormProps, ApFormInternalInstance, WatchFunc, ApFormSubmitterConfig } from '..';
|
|
12
|
+
import { ApFormProps, UpdateModelOptimizeFn, ApFormInternalInstance, WatchFunc, ApFormSubmitterConfig } from '..';
|
|
13
13
|
import { OnCleanup } from '@vue/reactivity';
|
|
14
14
|
import { PushState } from '@aplus-frontend/antdv/es/drawer';
|
|
15
15
|
import { MouseEventHandler, KeyboardEventHandler } from '@aplus-frontend/antdv/es/_util/EventInterface';
|
|
@@ -771,7 +771,7 @@ declare function __VLS_template(): {
|
|
|
771
771
|
$el: any;
|
|
772
772
|
$options: ComponentOptionsBase<Readonly< ApFormProps> & Readonly<{}>, {
|
|
773
773
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
774
|
-
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean) => void;
|
|
774
|
+
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
775
775
|
resetFields: () => Promise<void>;
|
|
776
776
|
clearValidate: (name?: NamePath) => void;
|
|
777
777
|
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
@@ -820,7 +820,7 @@ declare function __VLS_template(): {
|
|
|
820
820
|
syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
|
|
821
821
|
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "validate" | "resetFields" | "clearValidate" | "validateFields" | "getFieldsValue" | "scrollToField" | "registerWatch" | "setFieldValue" | ("layout" | "colon" | "labelAlign" | "validateTrigger" | "hideRequiredMark" | "validateOnRuleChange" | "syncToUrl") | "setFieldsValue" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed"> & ShallowUnwrapRef<{
|
|
822
822
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
823
|
-
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean) => void;
|
|
823
|
+
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
824
824
|
resetFields: () => Promise<void>;
|
|
825
825
|
clearValidate: (name?: NamePath) => void;
|
|
826
826
|
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
@@ -1713,7 +1713,7 @@ declare const __VLS_component: DefineComponent<ApFormDrawerFormProps, {
|
|
|
1713
1713
|
$el: any;
|
|
1714
1714
|
$options: ComponentOptionsBase<Readonly< ApFormProps> & Readonly<{}>, {
|
|
1715
1715
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
1716
|
-
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean) => void;
|
|
1716
|
+
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
1717
1717
|
resetFields: () => Promise<void>;
|
|
1718
1718
|
clearValidate: (name?: NamePath) => void;
|
|
1719
1719
|
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
@@ -1762,7 +1762,7 @@ declare const __VLS_component: DefineComponent<ApFormDrawerFormProps, {
|
|
|
1762
1762
|
syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
|
|
1763
1763
|
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "validate" | "resetFields" | "clearValidate" | "validateFields" | "getFieldsValue" | "scrollToField" | "registerWatch" | "setFieldValue" | ("layout" | "colon" | "labelAlign" | "validateTrigger" | "hideRequiredMark" | "validateOnRuleChange" | "syncToUrl") | "setFieldsValue" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed"> & ShallowUnwrapRef<{
|
|
1764
1764
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
1765
|
-
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean) => void;
|
|
1765
|
+
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
1766
1766
|
resetFields: () => Promise<void>;
|
|
1767
1767
|
clearValidate: (name?: NamePath) => void;
|
|
1768
1768
|
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
@@ -58,9 +58,10 @@ export type ApFormProps = Omit<FormProps, 'model' | 'onValuesChange'> & {
|
|
|
58
58
|
syncToUrlPriority?: boolean;
|
|
59
59
|
};
|
|
60
60
|
export type WatchFunc = (values?: Recordable) => void;
|
|
61
|
+
export type UpdateModelOptimizeFn = (currentModelValue: any, name: string | number) => void;
|
|
61
62
|
export type ApFormExpose<ModelType = any> = {
|
|
62
63
|
setFieldsValue: (fields: Partial<ModelType>) => void;
|
|
63
|
-
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean) => void;
|
|
64
|
+
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
64
65
|
resetFields: () => Promise<void>;
|
|
65
66
|
clearValidate: (name?: NamePath) => void;
|
|
66
67
|
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<ModelType>> | undefined;
|
|
@@ -117,7 +118,7 @@ export type ApFormInternalInstance = {
|
|
|
117
118
|
* @param triggerChange
|
|
118
119
|
* @returns
|
|
119
120
|
*/
|
|
120
|
-
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean) => void;
|
|
121
|
+
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
121
122
|
};
|
|
122
123
|
export type ApFormItemExpose = FormItemExpose & {
|
|
123
124
|
/**
|
|
@@ -9,7 +9,7 @@ import { RuleObject } from '@aplus-frontend/antdv/es/form';
|
|
|
9
9
|
import { Options } from '../../../node_modules/scroll-into-view-if-needed';
|
|
10
10
|
import { VueTypeDef, VueTypeValidableDef } from '../../../node_modules/vue-types';
|
|
11
11
|
import { VueNode } from '@aplus-frontend/antdv/es/_util/type';
|
|
12
|
-
import { ApFormProps, ApFormInternalInstance, WatchFunc, ApFormSubmitterConfig } from '..';
|
|
12
|
+
import { ApFormProps, UpdateModelOptimizeFn, ApFormInternalInstance, WatchFunc, ApFormSubmitterConfig } from '..';
|
|
13
13
|
import { OnCleanup } from '@vue/reactivity';
|
|
14
14
|
import { LegacyButtonType, ButtonHTMLType } from '@aplus-frontend/antdv/es/button/buttonTypes';
|
|
15
15
|
import { MouseEventHandler } from '@aplus-frontend/antdv/es/_util/EventInterface';
|
|
@@ -771,7 +771,7 @@ declare function __VLS_template(): {
|
|
|
771
771
|
$el: any;
|
|
772
772
|
$options: ComponentOptionsBase<Readonly< ApFormProps> & Readonly<{}>, {
|
|
773
773
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
774
|
-
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean) => void;
|
|
774
|
+
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
775
775
|
resetFields: () => Promise<void>;
|
|
776
776
|
clearValidate: (name?: NamePath) => void;
|
|
777
777
|
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
@@ -820,7 +820,7 @@ declare function __VLS_template(): {
|
|
|
820
820
|
syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
|
|
821
821
|
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "validate" | "resetFields" | "clearValidate" | "validateFields" | "getFieldsValue" | "scrollToField" | "registerWatch" | "setFieldValue" | ("layout" | "colon" | "labelAlign" | "validateTrigger" | "hideRequiredMark" | "validateOnRuleChange" | "syncToUrl") | "setFieldsValue" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed"> & ShallowUnwrapRef<{
|
|
822
822
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
823
|
-
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean) => void;
|
|
823
|
+
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
824
824
|
resetFields: () => Promise<void>;
|
|
825
825
|
clearValidate: (name?: NamePath) => void;
|
|
826
826
|
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
@@ -1901,7 +1901,7 @@ declare const __VLS_component: DefineComponent<ApFormModalFormProps, {
|
|
|
1901
1901
|
$el: any;
|
|
1902
1902
|
$options: ComponentOptionsBase<Readonly< ApFormProps> & Readonly<{}>, {
|
|
1903
1903
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
1904
|
-
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean) => void;
|
|
1904
|
+
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
1905
1905
|
resetFields: () => Promise<void>;
|
|
1906
1906
|
clearValidate: (name?: NamePath) => void;
|
|
1907
1907
|
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
@@ -1950,7 +1950,7 @@ declare const __VLS_component: DefineComponent<ApFormModalFormProps, {
|
|
|
1950
1950
|
syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
|
|
1951
1951
|
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "validate" | "resetFields" | "clearValidate" | "validateFields" | "getFieldsValue" | "scrollToField" | "registerWatch" | "setFieldValue" | ("layout" | "colon" | "labelAlign" | "validateTrigger" | "hideRequiredMark" | "validateOnRuleChange" | "syncToUrl") | "setFieldsValue" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed"> & ShallowUnwrapRef<{
|
|
1952
1952
|
setFieldsValue: (fields: Partial<any>) => void;
|
|
1953
|
-
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean) => void;
|
|
1953
|
+
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean, optimizeFn?: UpdateModelOptimizeFn) => void;
|
|
1954
1954
|
resetFields: () => Promise<void>;
|
|
1955
1955
|
clearValidate: (name?: NamePath) => void;
|
|
1956
1956
|
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|