@king-one/antdv 2.8.13 → 2.9.1
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/dist/es/components/index.mjs +36 -35
- package/dist/es/components/pro-form-render/index.mjs +11 -8
- package/dist/es/components/pro-form-render/src/index.vue2.mjs +27 -29
- package/dist/es/components/pro-form-render/src/module/AioArraySubForm.css +1 -1
- package/dist/es/components/pro-form-render/src/module/AioArraySubForm.vue.mjs +2 -2
- package/dist/es/components/pro-form-render/src/module/AioArraySubForm.vue2.mjs +34 -32
- package/dist/es/components/pro-form-render/src/v-model-utils.mjs +39 -0
- package/dist/es/components/pro-form-render/src/v-model.vue.mjs +4 -0
- package/dist/es/components/pro-form-render/src/v-model.vue2.mjs +62 -0
- package/dist/es/index.mjs +36 -35
- package/dist/lib/components/index.js +1 -1
- package/dist/lib/components/pro-form-render/index.js +1 -1
- package/dist/lib/components/pro-form-render/src/index.vue2.js +1 -1
- package/dist/lib/components/pro-form-render/src/module/AioArraySubForm.css +1 -1
- package/dist/lib/components/pro-form-render/src/module/AioArraySubForm.vue.js +1 -1
- package/dist/lib/components/pro-form-render/src/module/AioArraySubForm.vue2.js +1 -1
- package/dist/lib/components/pro-form-render/src/v-model-utils.js +1 -0
- package/dist/lib/components/pro-form-render/src/v-model.vue.js +1 -0
- package/dist/lib/components/pro-form-render/src/v-model.vue2.js +1 -0
- package/dist/lib/index.js +1 -1
- package/dist/theme-chalk/icon.css +1 -1
- package/dist/theme-chalk/index.css +1 -1
- package/dist/types/components/pro-form-render/index.d.ts +724 -2
- package/dist/types/components/pro-form-render/src/__tests__/v-model.test.d.ts +1 -0
- package/dist/types/components/pro-form-render/src/v-model-utils.d.ts +21 -0
- package/dist/types/components/pro-form-render/src/v-model.vue.d.ts +733 -0
- package/package.json +6 -4
|
@@ -1,61 +1,62 @@
|
|
|
1
1
|
import { KCollapseTranstion as p } from "./collapse-transtion/index.mjs";
|
|
2
2
|
import { KProModal as K } from "./pro-modal/index.mjs";
|
|
3
|
-
import { KProTitle as
|
|
3
|
+
import { KProTitle as x } from "./pro-title/index.mjs";
|
|
4
4
|
import { KScrollBar as a } from "./scroll-bar/index.mjs";
|
|
5
5
|
import { KCoverScrollBar as c } from "./cover-scroll-bar/index.mjs";
|
|
6
6
|
import { KScaleVirtualList as S } from "./scale-virtual-list/index.mjs";
|
|
7
|
-
import { KProTag as
|
|
8
|
-
import { KProPicker as
|
|
9
|
-
import { KProArea as
|
|
10
|
-
import { KProSignature as
|
|
11
|
-
import { KProTable as
|
|
12
|
-
import { KIcon as
|
|
13
|
-
import { KProUpload as
|
|
14
|
-
import { KProContractView as
|
|
7
|
+
import { KProTag as s } from "./pro-tag/index.mjs";
|
|
8
|
+
import { KProPicker as u } from "./pro-picker/index.mjs";
|
|
9
|
+
import { KProArea as T } from "./pro-area/index.mjs";
|
|
10
|
+
import { KProSignature as g } from "./pro-signature/index.mjs";
|
|
11
|
+
import { KProTable as R } from "./pro-table/index.mjs";
|
|
12
|
+
import { KIcon as G } from "./icon/index.mjs";
|
|
13
|
+
import { KProUpload as b } from "./pro-upload/index.mjs";
|
|
14
|
+
import { KProContractView as y } from "./pro-contract-view/index.mjs";
|
|
15
15
|
import "./pro-loading/index.mjs";
|
|
16
|
-
import { KPlusUpload as
|
|
17
|
-
import { KProOverlay as
|
|
18
|
-
import { KProSign as
|
|
19
|
-
import { KUserSelector as
|
|
16
|
+
import { KPlusUpload as D } from "./plus-upload/index.mjs";
|
|
17
|
+
import { KProOverlay as M } from "./pro-overlay/index.mjs";
|
|
18
|
+
import { KProSign as w } from "./pro-sign/index.mjs";
|
|
19
|
+
import { KUserSelector as L, KUserSelectorCheckbox as O } from "./pro-selector/index.mjs";
|
|
20
20
|
import { KProUserAvatar as q, KUserAvatar as z } from "./pro-user-avatar/index.mjs";
|
|
21
21
|
import { KProRoleSelector as H, KRoleSelector as J } from "./role-selector/index.mjs";
|
|
22
22
|
import { KDeptSelector as Q } from "./dept-selector/index.mjs";
|
|
23
23
|
import { KProTagGroup as X } from "./pro-tag-group/index.mjs";
|
|
24
|
-
import { KFormRender as Z } from "./pro-form-render/index.mjs";
|
|
25
|
-
import { KProCell as
|
|
26
|
-
import { KProCellGroup as
|
|
27
|
-
import { KProSelectorGroup as
|
|
28
|
-
import { KProDynamicTags as
|
|
24
|
+
import { KFormRender as Z, KFormRenderVModel as _ } from "./pro-form-render/index.mjs";
|
|
25
|
+
import { KProCell as rr } from "./pro-cell/index.mjs";
|
|
26
|
+
import { KProCellGroup as er } from "./pro-cell-group/index.mjs";
|
|
27
|
+
import { KProSelectorGroup as pr } from "./pro-selector-group/index.mjs";
|
|
28
|
+
import { KProDynamicTags as Kr } from "./pro-dynamic-tags/index.mjs";
|
|
29
29
|
import "./hooks/index.mjs";
|
|
30
30
|
export {
|
|
31
31
|
p as KCollapseTranstion,
|
|
32
32
|
c as KCoverScrollBar,
|
|
33
33
|
Q as KDeptSelector,
|
|
34
34
|
Z as KFormRender,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
_ as KFormRenderVModel,
|
|
36
|
+
G as KIcon,
|
|
37
|
+
D as KPlusUpload,
|
|
38
|
+
T as KProArea,
|
|
39
|
+
rr as KProCell,
|
|
40
|
+
er as KProCellGroup,
|
|
41
|
+
y as KProContractView,
|
|
42
|
+
Kr as KProDynamicTags,
|
|
42
43
|
K as KProModal,
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
M as KProOverlay,
|
|
45
|
+
u as KProPicker,
|
|
45
46
|
H as KProRoleSelector,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
pr as KProSelectorGroup,
|
|
48
|
+
w as KProSign,
|
|
49
|
+
g as KProSignature,
|
|
50
|
+
R as KProTable,
|
|
51
|
+
s as KProTag,
|
|
51
52
|
X as KProTagGroup,
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
x as KProTitle,
|
|
54
|
+
b as KProUpload,
|
|
54
55
|
q as KProUserAvatar,
|
|
55
56
|
J as KRoleSelector,
|
|
56
57
|
S as KScaleVirtualList,
|
|
57
58
|
a as KScrollBar,
|
|
58
59
|
z as KUserAvatar,
|
|
59
|
-
|
|
60
|
+
L as KUserSelector,
|
|
60
61
|
O as KUserSelectorCheckbox
|
|
61
62
|
};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { withInstall as
|
|
1
|
+
import { withInstall as o } from "../utils/install.mjs";
|
|
2
2
|
import "./src/index.vue.mjs";
|
|
3
|
+
import "./src/v-model.vue.mjs";
|
|
3
4
|
import "./src/style/index.mjs";
|
|
4
|
-
import { FormItemProps as
|
|
5
|
-
import
|
|
6
|
-
|
|
5
|
+
import { FormItemProps as l, FormRenderProps as F } from "./src/types.mjs";
|
|
6
|
+
import r from "./src/index.vue2.mjs";
|
|
7
|
+
import m from "./src/v-model.vue2.mjs";
|
|
8
|
+
const f = o(r), a = o(m);
|
|
7
9
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
l as FormItemProps,
|
|
11
|
+
F as FormRenderProps,
|
|
12
|
+
f as KFormRender,
|
|
13
|
+
a as KFormRenderVModel,
|
|
14
|
+
f as default
|
|
12
15
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as S, ref as c, computed as E, watch as
|
|
2
|
-
import { Form as q, FormItem as
|
|
3
|
-
import { FormRenderProps as
|
|
1
|
+
import { defineComponent as S, ref as c, computed as E, watch as _, watchEffect as R, createBlock as m, openBlock as s, unref as i, mergeProps as P, withCtx as p, createElementBlock as C, Fragment as D, renderList as U, resolveDynamicComponent as A } from "vue";
|
|
2
|
+
import { Form as q, FormItem as w, Collapse as K, CollapsePanel as N } from "ant-design-vue";
|
|
3
|
+
import { FormRenderProps as O } from "./types.mjs";
|
|
4
4
|
import "./module/index.mjs";
|
|
5
|
-
import { formatFormItems as
|
|
5
|
+
import { formatFormItems as j, getMesg as B } from "./utils.mjs";
|
|
6
6
|
import J from "./module/AioArraySubForm.vue.mjs";
|
|
7
7
|
import L from "./module/AioKeyValue.vue.mjs";
|
|
8
8
|
import M from "./module/AioSubForm.vue.mjs";
|
|
@@ -14,13 +14,13 @@ import Q from "./module/AioSelect.vue.mjs";
|
|
|
14
14
|
import W from "./module/AioInputNumber.vue.mjs";
|
|
15
15
|
import X from "./module/AioSwitch.vue.mjs";
|
|
16
16
|
import Y from "./module/AioInput.vue.mjs";
|
|
17
|
-
const
|
|
17
|
+
const de = /* @__PURE__ */ S({
|
|
18
18
|
name: "ProFormRender",
|
|
19
19
|
__name: "index",
|
|
20
|
-
props:
|
|
20
|
+
props: O,
|
|
21
21
|
emits: ["change"],
|
|
22
|
-
setup(
|
|
23
|
-
const u =
|
|
22
|
+
setup(b, { expose: h, emit: F }) {
|
|
23
|
+
const u = b, V = F, d = {
|
|
24
24
|
AioInput: Y,
|
|
25
25
|
AioSwitch: X,
|
|
26
26
|
AioInputNumber: W,
|
|
@@ -32,17 +32,15 @@ const ye = /* @__PURE__ */ S({
|
|
|
32
32
|
AioSubForm: M,
|
|
33
33
|
AioKeyValue: L,
|
|
34
34
|
AioArraySubForm: J
|
|
35
|
-
}, l = c({}),
|
|
36
|
-
|
|
37
|
-
e &&
|
|
38
|
-
}, { deep: !0 }), y(() => u.modelValue, (e) => {
|
|
39
|
-
e !== void 0 && d.value.forEach((o) => {
|
|
35
|
+
}, l = c({}), k = c(), v = c({}), g = c([]), y = E(() => u.formItems ? Array.isArray(u.formItems) ? j(u.formItems) : [] : []);
|
|
36
|
+
_(() => u.modelValue, (e) => {
|
|
37
|
+
e !== void 0 && y.value.forEach((o) => {
|
|
40
38
|
o.key in e && (l.value[o.key] = e[o.key]);
|
|
41
39
|
});
|
|
42
|
-
}, { deep: !0, immediate: !0 }),
|
|
43
|
-
|
|
40
|
+
}, { deep: !0, immediate: !0 }), _(l, (e) => {
|
|
41
|
+
V("change", e);
|
|
44
42
|
}, { deep: !0 }), R(() => {
|
|
45
|
-
|
|
43
|
+
y.value.forEach((e) => {
|
|
46
44
|
if (u.modelValue !== void 0 && e.key in u.modelValue)
|
|
47
45
|
l.value[e.key] !== u.modelValue[e.key] && (l.value[e.key] = u.modelValue[e.key]);
|
|
48
46
|
else {
|
|
@@ -76,7 +74,7 @@ const ye = /* @__PURE__ */ S({
|
|
|
76
74
|
return r;
|
|
77
75
|
}
|
|
78
76
|
function x(e) {
|
|
79
|
-
|
|
77
|
+
k.value.validate().then(() => {
|
|
80
78
|
var f;
|
|
81
79
|
const o = JSON.parse(JSON.stringify(l.value)), r = u.formItems.filter((t) => t.type === "AioArrayInput").map((t) => t.key);
|
|
82
80
|
Object.keys(o).forEach((t) => {
|
|
@@ -84,7 +82,7 @@ const ye = /* @__PURE__ */ S({
|
|
|
84
82
|
});
|
|
85
83
|
const a = u.formItems.filter((t) => t.type === "AioSubForm");
|
|
86
84
|
a.length > 0 && a.forEach((t) => {
|
|
87
|
-
const n =
|
|
85
|
+
const n = v.value[t.key];
|
|
88
86
|
n && n.validate ? n.validate() : console.log(`${t.key} 的 validate 方法不存在或组件引用为空`);
|
|
89
87
|
}), (f = e.success) == null || f.call(e, o);
|
|
90
88
|
}).catch((o) => {
|
|
@@ -95,12 +93,12 @@ const ye = /* @__PURE__ */ S({
|
|
|
95
93
|
function I() {
|
|
96
94
|
return l.value;
|
|
97
95
|
}
|
|
98
|
-
return
|
|
96
|
+
return h({
|
|
99
97
|
submit: x,
|
|
100
98
|
getFormData: I
|
|
101
99
|
}), (e, o) => (s(), m(i(q), P({
|
|
102
100
|
ref_key: "formRef",
|
|
103
|
-
ref:
|
|
101
|
+
ref: k,
|
|
104
102
|
model: l.value,
|
|
105
103
|
"label-col": { span: 8 },
|
|
106
104
|
style: { width: "360px" }
|
|
@@ -109,30 +107,30 @@ const ye = /* @__PURE__ */ S({
|
|
|
109
107
|
(s(!0), C(
|
|
110
108
|
D,
|
|
111
109
|
null,
|
|
112
|
-
U(
|
|
110
|
+
U(y.value, (r) => (s(), m(i(w), {
|
|
113
111
|
key: r.key,
|
|
114
112
|
label: r.type === "AioSubForm" ? "" : r.label,
|
|
115
113
|
name: r.key,
|
|
116
114
|
rules: $(r)
|
|
117
115
|
}, {
|
|
118
116
|
default: p(() => [
|
|
119
|
-
r.type === "AioSubForm" ? (s(), m(i(
|
|
117
|
+
r.type === "AioSubForm" ? (s(), m(i(K), {
|
|
120
118
|
key: 0,
|
|
121
|
-
"active-key":
|
|
122
|
-
"onUpdate:activeKey": o[0] || (o[0] = (a) =>
|
|
119
|
+
"active-key": g.value,
|
|
120
|
+
"onUpdate:activeKey": o[0] || (o[0] = (a) => g.value = a),
|
|
123
121
|
bordered: !0
|
|
124
122
|
}, {
|
|
125
123
|
default: p(() => [
|
|
126
|
-
(s(), m(i(
|
|
124
|
+
(s(), m(i(N), {
|
|
127
125
|
key: r.key,
|
|
128
126
|
header: r.label,
|
|
129
127
|
forceRender: !0
|
|
130
128
|
}, {
|
|
131
129
|
default: p(() => [
|
|
132
|
-
(s(), m(
|
|
130
|
+
(s(), m(A(d[r.type]), {
|
|
133
131
|
ref_for: !0,
|
|
134
132
|
ref: r.type === "AioSubForm" ? (a) => {
|
|
135
|
-
a && (
|
|
133
|
+
a && (v.value[r.key] = a);
|
|
136
134
|
} : void 0,
|
|
137
135
|
modelValue: l.value[r.key],
|
|
138
136
|
"onUpdate:modelValue": (a) => l.value[r.key] = a,
|
|
@@ -145,7 +143,7 @@ const ye = /* @__PURE__ */ S({
|
|
|
145
143
|
]),
|
|
146
144
|
_: 2
|
|
147
145
|
/* DYNAMIC */
|
|
148
|
-
}, 1032, ["active-key"])) : (s(), m(
|
|
146
|
+
}, 1032, ["active-key"])) : (s(), m(A(d[r.type]), {
|
|
149
147
|
key: 1,
|
|
150
148
|
modelValue: l.value[r.key],
|
|
151
149
|
"onUpdate:modelValue": (a) => l.value[r.key] = a,
|
|
@@ -165,5 +163,5 @@ const ye = /* @__PURE__ */ S({
|
|
|
165
163
|
}
|
|
166
164
|
});
|
|
167
165
|
export {
|
|
168
|
-
|
|
166
|
+
de as default
|
|
169
167
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.aio-array-sub-form[data-v-
|
|
1
|
+
.aio-array-sub-form[data-v-b022d9c1]{width:100%}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./AioArraySubForm.vue2.mjs";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import r from "../../../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
-
const
|
|
4
|
+
const p = /* @__PURE__ */ r(o, [["__scopeId", "data-v-b022d9c1"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
p as default
|
|
7
7
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as C, useModel as
|
|
1
|
+
import { defineComponent as C, useModel as _, watch as b, computed as s, createElementBlock as v, openBlock as i, createVNode as m, Fragment as I, renderList as w, createBlock as E, unref as o, withCtx as u, createElementVNode as p, toDisplayString as y, mergeModels as x } from "vue";
|
|
2
2
|
import { Card as z, Button as B } from "ant-design-vue";
|
|
3
3
|
import { KIcon as F } from "../../../icon/index.mjs";
|
|
4
4
|
import "../../../index.mjs";
|
|
@@ -15,48 +15,50 @@ const D = { class: "aio-array-sub-form" }, K = { style: { "font-size": "14px", "
|
|
|
15
15
|
}),
|
|
16
16
|
emits: ["update:modelValue"],
|
|
17
17
|
setup(d) {
|
|
18
|
-
const h = d,
|
|
19
|
-
|
|
20
|
-
() =>
|
|
21
|
-
(
|
|
22
|
-
Array.isArray(
|
|
18
|
+
const h = d, e = _(d, "modelValue");
|
|
19
|
+
b(
|
|
20
|
+
() => e.value,
|
|
21
|
+
(r) => {
|
|
22
|
+
Array.isArray(r) || (e.value = []);
|
|
23
23
|
},
|
|
24
24
|
{ immediate: !0, deep: !0 }
|
|
25
25
|
);
|
|
26
26
|
const f = s(() => h.formItem.elements || []), n = s(() => {
|
|
27
|
-
const e = {};
|
|
28
|
-
return f.value.forEach((r) => {
|
|
29
|
-
r.key && r.defaultValue !== void 0 && r.defaultValue !== null && (e[r.key] = r.defaultValue);
|
|
30
|
-
}), e;
|
|
31
|
-
}), A = s(() => Array.isArray(t.value) ? t.value.map((e) => {
|
|
32
27
|
const r = {};
|
|
33
|
-
return
|
|
34
|
-
r[
|
|
35
|
-
}), Object.keys(e).forEach((a) => {
|
|
36
|
-
r[a] = e[a];
|
|
28
|
+
return f.value.forEach((t) => {
|
|
29
|
+
t.key && t.defaultValue !== void 0 && t.defaultValue !== null && (r[t.key] = t.defaultValue);
|
|
37
30
|
}), r;
|
|
31
|
+
}), A = s(() => Array.isArray(e.value) ? e.value.map((r) => {
|
|
32
|
+
const t = {};
|
|
33
|
+
return Object.keys(n.value).forEach((a) => {
|
|
34
|
+
t[a] = n.value[a];
|
|
35
|
+
}), Object.keys(r).forEach((a) => {
|
|
36
|
+
t[a] = r[a];
|
|
37
|
+
}), t;
|
|
38
38
|
}) : []);
|
|
39
39
|
function g() {
|
|
40
|
-
Array.isArray(
|
|
41
|
-
const
|
|
42
|
-
|
|
40
|
+
Array.isArray(e.value) || (e.value = []);
|
|
41
|
+
const r = { ...n.value };
|
|
42
|
+
e.value = [...e.value, r];
|
|
43
43
|
}
|
|
44
|
-
function V(
|
|
45
|
-
if (!Array.isArray(
|
|
46
|
-
|
|
44
|
+
function V(r) {
|
|
45
|
+
if (!Array.isArray(e.value)) {
|
|
46
|
+
e.value = [];
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
e.value = e.value.filter((t, a) => a !== r);
|
|
50
50
|
}
|
|
51
|
-
function k(
|
|
52
|
-
if (!Array.isArray(
|
|
53
|
-
|
|
51
|
+
function k(r, t) {
|
|
52
|
+
if (!Array.isArray(e.value)) {
|
|
53
|
+
e.value = [];
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
e.value = e.value.map(
|
|
57
|
+
(a, l) => l === r ? t : a
|
|
58
|
+
);
|
|
57
59
|
}
|
|
58
|
-
return (
|
|
59
|
-
(i(!0),
|
|
60
|
+
return (r, t) => (i(), v("div", D, [
|
|
61
|
+
(i(!0), v(
|
|
60
62
|
I,
|
|
61
63
|
null,
|
|
62
64
|
w(A.value, (a, l) => (i(), E(
|
|
@@ -68,10 +70,10 @@ const D = { class: "aio-array-sub-form" }, K = { style: { "font-size": "14px", "
|
|
|
68
70
|
},
|
|
69
71
|
{
|
|
70
72
|
title: u(() => [
|
|
71
|
-
|
|
73
|
+
p(
|
|
72
74
|
"span",
|
|
73
75
|
K,
|
|
74
|
-
y(
|
|
76
|
+
y(r.formItem.label || "表单项") + " " + y(l + 1),
|
|
75
77
|
1
|
|
76
78
|
/* TEXT */
|
|
77
79
|
)
|
|
@@ -108,8 +110,8 @@ const D = { class: "aio-array-sub-form" }, K = { style: { "font-size": "14px", "
|
|
|
108
110
|
block: "",
|
|
109
111
|
onClick: g
|
|
110
112
|
}, {
|
|
111
|
-
default: u(() => [...
|
|
112
|
-
|
|
113
|
+
default: u(() => [...t[0] || (t[0] = [
|
|
114
|
+
p(
|
|
113
115
|
"div",
|
|
114
116
|
{ style: { "font-size": "14px", "padding-left": "6px" } },
|
|
115
117
|
" +新增 ",
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
function p(r, l) {
|
|
2
|
+
return !r || r.length === 0 ? [] : !l || Object.keys(l).length === 0 ? JSON.parse(JSON.stringify(r)) : r.map((y) => {
|
|
3
|
+
const s = { ...y }, e = l[y.key];
|
|
4
|
+
return e != null && (y.type === "AioSubForm" && y.elements ? s.elements = y.elements.map((n) => {
|
|
5
|
+
const t = e == null ? void 0 : e[n.key];
|
|
6
|
+
return {
|
|
7
|
+
...n,
|
|
8
|
+
defaultValue: t !== void 0 ? t : n.defaultValue
|
|
9
|
+
};
|
|
10
|
+
}) : (y.type === "AioArraySubForm" && y.elements, s.defaultValue = e)), s;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function a(r) {
|
|
14
|
+
return !r || typeof r != "object" ? !1 : "type" in r && "key" in r;
|
|
15
|
+
}
|
|
16
|
+
function f(r) {
|
|
17
|
+
return !Array.isArray(r) || r.length === 0 ? !1 : a(r[0]);
|
|
18
|
+
}
|
|
19
|
+
function i(r, l, y) {
|
|
20
|
+
const s = {};
|
|
21
|
+
for (const e in r) {
|
|
22
|
+
const n = r[e], t = l.find((u) => u.key === e), o = y == null ? void 0 : y[e];
|
|
23
|
+
if (f(n)) {
|
|
24
|
+
o !== void 0 && !f(o) && (s[e] = o);
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
(t == null ? void 0 : t.type) === "AioSubForm" && t.elements ? n && typeof n == "object" && !Array.isArray(n) ? s[e] = i(n, t.elements, o) : o && typeof o == "object" && !Array.isArray(o) && (s[e] = o) : (t == null ? void 0 : t.type) === "AioArraySubForm" && t.elements ? Array.isArray(n) && !f(n) ? s[e] = n.map((u, c) => {
|
|
28
|
+
const A = Array.isArray(o) ? o[c] : void 0;
|
|
29
|
+
return typeof u == "object" ? i(u, t.elements, A) : u;
|
|
30
|
+
}) : Array.isArray(o) && !f(o) && (s[e] = o) : s[e] = n;
|
|
31
|
+
}
|
|
32
|
+
return s;
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
p as applyValueToFormItems,
|
|
36
|
+
i as cleanFormData,
|
|
37
|
+
a as isFormItemConfig,
|
|
38
|
+
f as isFormItemsArray
|
|
39
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { defineComponent as V, useModel as _, ref as f, nextTick as i, watch as c, createBlock as R, openBlock as C, mergeProps as D, mergeModels as d } from "vue";
|
|
2
|
+
import "./index.vue.mjs";
|
|
3
|
+
import { applyValueToFormItems as J, isFormItemsArray as M, cleanFormData as N } from "./v-model-utils.mjs";
|
|
4
|
+
import O from "./index.vue2.mjs";
|
|
5
|
+
const B = /* @__PURE__ */ V({
|
|
6
|
+
name: "ProFormRenderVModel",
|
|
7
|
+
__name: "v-model",
|
|
8
|
+
props: /* @__PURE__ */ d({
|
|
9
|
+
formItems: {}
|
|
10
|
+
}, {
|
|
11
|
+
modelValue: { default: () => ({}) },
|
|
12
|
+
modelModifiers: {}
|
|
13
|
+
}),
|
|
14
|
+
emits: /* @__PURE__ */ d(["change"], ["update:modelValue"]),
|
|
15
|
+
setup(s, { expose: p, emit: g }) {
|
|
16
|
+
const a = s, v = g, r = _(s, "modelValue"), o = f(), m = f([]);
|
|
17
|
+
let n = !1, l = !1;
|
|
18
|
+
async function u() {
|
|
19
|
+
var e;
|
|
20
|
+
(e = a.formItems) != null && e.length && (n = !0, m.value = J(a.formItems, r.value), await i(), n = !1);
|
|
21
|
+
}
|
|
22
|
+
async function h(e) {
|
|
23
|
+
if (n || M(e))
|
|
24
|
+
return;
|
|
25
|
+
const t = N(e, a.formItems ?? [], r.value), y = JSON.stringify(r.value), k = JSON.stringify(t);
|
|
26
|
+
y !== k && (l = !0, r.value = t, v("change", t), await i(), l = !1);
|
|
27
|
+
}
|
|
28
|
+
c(
|
|
29
|
+
() => a.formItems,
|
|
30
|
+
() => u(),
|
|
31
|
+
{ deep: !0, immediate: !0 }
|
|
32
|
+
), c(
|
|
33
|
+
r,
|
|
34
|
+
() => {
|
|
35
|
+
l || u();
|
|
36
|
+
},
|
|
37
|
+
{ deep: !0 }
|
|
38
|
+
);
|
|
39
|
+
function I(e) {
|
|
40
|
+
var t;
|
|
41
|
+
(t = o.value) == null || t.submit(e);
|
|
42
|
+
}
|
|
43
|
+
function F() {
|
|
44
|
+
var e;
|
|
45
|
+
return ((e = o.value) == null ? void 0 : e.getFormData()) ?? {};
|
|
46
|
+
}
|
|
47
|
+
return p({
|
|
48
|
+
submit: I,
|
|
49
|
+
getFormData: F,
|
|
50
|
+
// 暴露内部状态供测试使用
|
|
51
|
+
internalFormItems: m
|
|
52
|
+
}), (e, t) => (C(), R(O, D({
|
|
53
|
+
ref_key: "formRenderRef",
|
|
54
|
+
ref: o,
|
|
55
|
+
"form-items": m.value,
|
|
56
|
+
"model-value": r.value
|
|
57
|
+
}, e.$attrs, { onChange: h }), null, 16, ["form-items", "model-value"]));
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
export {
|
|
61
|
+
B as default
|
|
62
|
+
};
|
package/dist/es/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import "./hooks/index.mjs";
|
|
|
4
4
|
import { collapseProps as f } from "./components/collapse-transtion/src/types.mjs";
|
|
5
5
|
import { KCollapseTranstion as l } from "./components/collapse-transtion/index.mjs";
|
|
6
6
|
import { useProModal as P, useProModalInit as a } from "./components/pro-modal/hooks/useProModal.mjs";
|
|
7
|
-
import { KProModal as
|
|
7
|
+
import { KProModal as K } from "./components/pro-modal/index.mjs";
|
|
8
8
|
import { TitleProps as n } from "./components/pro-title/src/types.mjs";
|
|
9
9
|
import { KProTitle as S } from "./components/pro-title/index.mjs";
|
|
10
10
|
import { scrollbarProps as g } from "./components/scroll-bar/src/types.mjs";
|
|
@@ -12,9 +12,9 @@ import { KScrollBar as U } from "./components/scroll-bar/index.mjs";
|
|
|
12
12
|
import { CoverScrollbarProps as E } from "./components/cover-scroll-bar/src/types.mjs";
|
|
13
13
|
import { KCoverScrollBar as _ } from "./components/cover-scroll-bar/index.mjs";
|
|
14
14
|
import { KScaleVirtualList as A } from "./components/scale-virtual-list/index.mjs";
|
|
15
|
-
import { proTagProps as
|
|
16
|
-
import { KProTag as
|
|
17
|
-
import { PickerApiEnum as
|
|
15
|
+
import { proTagProps as F } from "./components/pro-tag/src/types.mjs";
|
|
16
|
+
import { KProTag as L } from "./components/pro-tag/index.mjs";
|
|
17
|
+
import { PickerApiEnum as k, ProPickerProps as v } from "./components/pro-picker/src/types.mjs";
|
|
18
18
|
import { KProPicker as M } from "./components/pro-picker/index.mjs";
|
|
19
19
|
import { ProAreaProps as B } from "./components/pro-area/src/types.mjs";
|
|
20
20
|
import { useProArea as h } from "./components/pro-area/hooks/use-pro-area.mjs";
|
|
@@ -31,14 +31,14 @@ import { useProContractView as fr } from "./components/pro-contract-view/hooks/u
|
|
|
31
31
|
import { KProContractView as lr } from "./components/pro-contract-view/index.mjs";
|
|
32
32
|
import { default as Pr } from "./components/pro-loading/src/pro-loading.mjs";
|
|
33
33
|
import { KPlusUpload as ir } from "./components/plus-upload/index.mjs";
|
|
34
|
-
import { KProOverlay as
|
|
34
|
+
import { KProOverlay as cr } from "./components/pro-overlay/index.mjs";
|
|
35
35
|
import { onSignConfirm as ur, onSignInit as Sr, onSignSuccess as dr } from "./components/pro-sign/src/effects/onEffects.mjs";
|
|
36
36
|
import { initProSign as Tr } from "./components/pro-sign/src/core/index.mjs";
|
|
37
37
|
import { useProSign as Cr } from "./components/pro-sign/src/hook/useProSign.mjs";
|
|
38
38
|
import { KProSign as Rr } from "./components/pro-sign/index.mjs";
|
|
39
|
-
import { GTE_ORGTREE_URL as Gr, UserSelectorProps as Ar, selectUserContextKey as br, userSelectorEmits as
|
|
40
|
-
import { useUserSelector as
|
|
41
|
-
import { KUserSelector as
|
|
39
|
+
import { GTE_ORGTREE_URL as Gr, UserSelectorProps as Ar, selectUserContextKey as br, userSelectorEmits as Fr } from "./components/pro-selector/src/types.mjs";
|
|
40
|
+
import { useUserSelector as Lr } from "./components/pro-selector/src/hooks/useUserSelector.mjs";
|
|
41
|
+
import { KUserSelector as kr, KUserSelectorCheckbox as vr } from "./components/pro-selector/index.mjs";
|
|
42
42
|
import { default as Mr } from "./components/pro-selector/src/pro-user.mjs";
|
|
43
43
|
import { default as Br } from "./components/pro-selector/src/components/user.mjs";
|
|
44
44
|
import { KProUserAvatar as hr, KUserAvatar as wr } from "./components/pro-user-avatar/index.mjs";
|
|
@@ -49,15 +49,15 @@ import { KDeptSelector as ro } from "./components/dept-selector/index.mjs";
|
|
|
49
49
|
import { ProTagGroupProps as eo } from "./components/pro-tag-group/src/types.mjs";
|
|
50
50
|
import { KProTagGroup as po } from "./components/pro-tag-group/index.mjs";
|
|
51
51
|
import { FormItemProps as fo, FormRenderProps as xo } from "./components/pro-form-render/src/types.mjs";
|
|
52
|
-
import { KFormRender as so } from "./components/pro-form-render/index.mjs";
|
|
53
|
-
import { KProCell as
|
|
52
|
+
import { KFormRender as so, KFormRenderVModel as Po } from "./components/pro-form-render/index.mjs";
|
|
53
|
+
import { KProCell as io } from "./components/pro-cell/index.mjs";
|
|
54
54
|
import { PRO_CELL_GROUP_KEY as co } from "./components/pro-cell-group/src/types.mjs";
|
|
55
|
-
import { KProCellGroup as
|
|
56
|
-
import { selectContextKey as
|
|
57
|
-
import { KProSelectorGroup as
|
|
58
|
-
import { KProDynamicTags as
|
|
59
|
-
import { setupAppConfig as
|
|
60
|
-
import { useProForm as
|
|
55
|
+
import { KProCellGroup as uo } from "./components/pro-cell-group/index.mjs";
|
|
56
|
+
import { selectContextKey as go } from "./components/pro-selector-group/src/types.mjs";
|
|
57
|
+
import { KProSelectorGroup as Uo } from "./components/pro-selector-group/index.mjs";
|
|
58
|
+
import { KProDynamicTags as Eo } from "./components/pro-dynamic-tags/index.mjs";
|
|
59
|
+
import { setupAppConfig as _o, useBasicAppConfig as Go } from "./components/hooks/use-basic-app-config.mjs";
|
|
60
|
+
import { useProForm as bo, useProFormInit as Fo } from "./hooks/useProForm.mjs";
|
|
61
61
|
import { useModelValue as Lo } from "./hooks/useModelValue.mjs";
|
|
62
62
|
export {
|
|
63
63
|
E as CoverScrollbarProps,
|
|
@@ -70,22 +70,23 @@ export {
|
|
|
70
70
|
_ as KCoverScrollBar,
|
|
71
71
|
ro as KDeptSelector,
|
|
72
72
|
so as KFormRender,
|
|
73
|
+
Po as KFormRenderVModel,
|
|
73
74
|
Z as KIcon,
|
|
74
75
|
ir as KPlusUpload,
|
|
75
76
|
N as KProArea,
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
io as KProCell,
|
|
78
|
+
uo as KProCellGroup,
|
|
78
79
|
lr as KProContractView,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
Eo as KProDynamicTags,
|
|
81
|
+
K as KProModal,
|
|
82
|
+
cr as KProOverlay,
|
|
82
83
|
M as KProPicker,
|
|
83
84
|
Hr as KProRoleSelector,
|
|
84
|
-
|
|
85
|
+
Uo as KProSelectorGroup,
|
|
85
86
|
Rr as KProSign,
|
|
86
87
|
z as KProSignature,
|
|
87
88
|
W as KProTable,
|
|
88
|
-
|
|
89
|
+
L as KProTag,
|
|
89
90
|
po as KProTagGroup,
|
|
90
91
|
S as KProTitle,
|
|
91
92
|
pr as KProUpload,
|
|
@@ -95,12 +96,12 @@ export {
|
|
|
95
96
|
A as KScaleVirtualList,
|
|
96
97
|
U as KScrollBar,
|
|
97
98
|
wr as KUserAvatar,
|
|
98
|
-
|
|
99
|
-
|
|
99
|
+
kr as KUserSelector,
|
|
100
|
+
vr as KUserSelectorCheckbox,
|
|
100
101
|
co as PRO_CELL_GROUP_KEY,
|
|
101
|
-
|
|
102
|
+
k as PickerApiEnum,
|
|
102
103
|
B as ProAreaProps,
|
|
103
|
-
|
|
104
|
+
v as ProPickerProps,
|
|
104
105
|
j as ProSignatureProps,
|
|
105
106
|
eo as ProTagGroupProps,
|
|
106
107
|
Mr as ProUserSelector,
|
|
@@ -116,24 +117,24 @@ export {
|
|
|
116
117
|
ur as onSignConfirm,
|
|
117
118
|
Sr as onSignInit,
|
|
118
119
|
dr as onSignSuccess,
|
|
119
|
-
|
|
120
|
+
F as proTagProps,
|
|
120
121
|
jr as roleSelectorEmits,
|
|
121
122
|
qr as roleSelectorProps,
|
|
122
123
|
g as scrollbarProps,
|
|
123
|
-
|
|
124
|
+
go as selectContextKey,
|
|
124
125
|
br as selectUserContextKey,
|
|
125
|
-
|
|
126
|
-
|
|
126
|
+
_o as setupAppConfig,
|
|
127
|
+
Go as useBasicAppConfig,
|
|
127
128
|
Lo as useModelValue,
|
|
128
129
|
h as useProArea,
|
|
129
130
|
fr as useProContractView,
|
|
130
|
-
|
|
131
|
-
|
|
131
|
+
bo as useProForm,
|
|
132
|
+
Fo as useProFormInit,
|
|
132
133
|
P as useProModal,
|
|
133
134
|
a as useProModalInit,
|
|
134
135
|
Cr as useProSign,
|
|
135
136
|
J as useProTable,
|
|
136
137
|
er as useUpload,
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
Lr as useUserSelector,
|
|
139
|
+
Fr as userSelectorEmits
|
|
139
140
|
};
|