@kp-ui/lowcode 2.15.0-alpha.16 → 2.15.0-alpha.17
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/package.json +1 -1
- package/src/components/FormRender/useFormContext.js +97 -86
- package/src/components/form-designer/form-widget/field-widget/button-list-widget.vue.js +2 -2
- package/src/components/form-designer/form-widget/field-widget/button-list-widget.vue2.js +21 -20
- package/src/components/form-designer/form-widget/field-widget/button-widget.vue.js +2 -2
- package/src/components/form-designer/form-widget/field-widget/button-widget.vue2.js +11 -11
- package/src/components/form-designer/form-widget/field-widget/useField.js +12 -11
- package/src/components/form-designer/setting-panel/property-editor/container-data-table/data-table-tableColumns-editor.vue.js +3 -3
- package/src/components/form-render/container-items/grid-sub-form-widget.vue.js +2 -2
- package/src/components/form-render/container-items/grid-sub-form-widget.vue2.js +103 -92
- package/stats.html +1 -1
- package/styles/style.css +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { defineComponent as j, provide as
|
|
2
|
-
import { traverseFieldWidgetsOfContainer as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { TpfConfirm as
|
|
1
|
+
import { defineComponent as j, provide as y, ref as w, onMounted as q, resolveComponent as J, createBlock as A, openBlock as v, withCtx as f, withDirectives as L, createElementVNode as c, createElementBlock as W, Fragment as K, renderList as Q, toDisplayString as B, createVNode as u, unref as s, vShow as E, createCommentVNode as U, createTextVNode as X, nextTick as R } from "vue";
|
|
2
|
+
import { traverseFieldWidgetsOfContainer as Y, generateId as S, deepClone as Z } from "../../../utils/util.js";
|
|
3
|
+
import ee from "./container-wrapper.vue.js";
|
|
4
|
+
import oe from "../RenderWigetList.vue.js";
|
|
5
|
+
import { TpfConfirm as te } from "../../../hooks/TpfConfirm.js";
|
|
6
6
|
import { SvgIcon as _ } from "tmgc2-share";
|
|
7
|
-
import { ComponentNameEnum as
|
|
7
|
+
import { ComponentNameEnum as ne, ContainerTypeEnum as ie } from "../../../constants/WidgetTypeEnum.js";
|
|
8
8
|
import { useI18n as ae } from "../../../utils/i18n.js";
|
|
9
|
-
import { useField as
|
|
10
|
-
const
|
|
11
|
-
name:
|
|
12
|
-
componentName:
|
|
9
|
+
import { useField as se } from "../../form-designer/form-widget/field-widget/useField.js";
|
|
10
|
+
const de = { class: "sub-form-container" }, le = { class: "row-no-column" }, re = { class: "row-number-span" }, ce = { class: "grid-sub-form-data-row" }, ue = { class: "sub-form-action-column hide-label" }, me = { class: "action-button-column" }, pe = { class: "header-row" }, _e = /* @__PURE__ */ j({
|
|
11
|
+
name: ie.GridSubFormWidget,
|
|
12
|
+
componentName: ne.ContainerWidget,
|
|
13
13
|
inheritAttrs: !1,
|
|
14
14
|
__name: "grid-sub-form-widget",
|
|
15
15
|
props: {
|
|
@@ -21,45 +21,56 @@ const le = { class: "sub-form-container" }, ce = { class: "row-no-column" }, re
|
|
|
21
21
|
subFormRowIndex: {},
|
|
22
22
|
subFormRowId: {}
|
|
23
23
|
},
|
|
24
|
-
setup(
|
|
25
|
-
|
|
26
|
-
const { i18nt: d } = ae(), t =
|
|
27
|
-
q(() => x.options.actionColumnPosition === "right" ? "right-action-column" : "left-action-column");
|
|
28
|
-
const C = () => {
|
|
24
|
+
setup(N, { expose: T }) {
|
|
25
|
+
y("isSubFormField", !0), y("getSubFormName", () => t.widget.options.name);
|
|
26
|
+
const { i18nt: d } = ae(), t = N, r = w([]), m = w([]), g = w(!1), F = w(!1), p = w(!1), { formModel: l, isReadMode: D, handleHidden: x, executeFunction: b, defineExposed: V } = se(t), k = () => {
|
|
29
27
|
m.value = [];
|
|
30
28
|
const e = (o) => {
|
|
31
29
|
m.value.push(o);
|
|
32
30
|
};
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
|
|
31
|
+
Y(t.widget, e);
|
|
32
|
+
}, M = (e = !1) => {
|
|
33
|
+
r.value = [];
|
|
36
34
|
const o = l.value[t.widget.options.name];
|
|
37
35
|
o && o.length > 0 && (o.forEach(() => {
|
|
38
|
-
|
|
36
|
+
r.value.push("id" + S());
|
|
39
37
|
}), e && setTimeout(() => {
|
|
40
38
|
h(o);
|
|
41
39
|
}, 800));
|
|
42
40
|
}, h = (e) => {
|
|
43
|
-
t.widget.options.onSubFormRowChange &&
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
t.widget.options.onSubFormRowChange && b({
|
|
42
|
+
functionBody: t.widget.options.onSubFormRowChange,
|
|
43
|
+
keys: ["subFormData"],
|
|
44
|
+
params: { subFormData: e }
|
|
45
|
+
});
|
|
46
|
+
}, I = (e, o) => {
|
|
47
|
+
b({
|
|
48
|
+
functionBody: t.widget.options.onSubFormRowAdd,
|
|
49
|
+
params: {
|
|
50
|
+
subFormData: e,
|
|
51
|
+
newRowId: o
|
|
52
|
+
},
|
|
53
|
+
keys: ["subFormData", "newRowId"]
|
|
54
|
+
});
|
|
50
55
|
}, $ = (e, o) => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
b({
|
|
57
|
+
functionBody: t.widget.options.onSubFormRowInsert,
|
|
58
|
+
params: {
|
|
59
|
+
subFormData: e,
|
|
60
|
+
newRowId: o
|
|
61
|
+
},
|
|
62
|
+
keys: ["subFormData", "newRowId"]
|
|
63
|
+
});
|
|
56
64
|
}, H = (e, o) => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
b({
|
|
66
|
+
functionBody: t.widget.options.onSubFormRowDelete,
|
|
67
|
+
params: {
|
|
68
|
+
subFormData: e,
|
|
69
|
+
deletedDataRow: o
|
|
70
|
+
},
|
|
71
|
+
keys: ["subFormData", "deletedDataRow"]
|
|
72
|
+
});
|
|
73
|
+
}, C = () => {
|
|
63
74
|
const e = {};
|
|
64
75
|
m.value.forEach((i) => {
|
|
65
76
|
i != null && i.formItemFlag && (e[i.options.name] = i.options.defaultValue);
|
|
@@ -67,125 +78,125 @@ const le = { class: "sub-form-container" }, ce = { class: "row-no-column" }, re
|
|
|
67
78
|
const o = l.value[t.widget.options.name] || [];
|
|
68
79
|
o.push(e), l.value[t.widget.options.name] || (l.value[t.widget.options.name] = o);
|
|
69
80
|
const n = "id" + S();
|
|
70
|
-
|
|
71
|
-
|
|
81
|
+
r.value.push(n), R(() => {
|
|
82
|
+
I(o, n), h(o);
|
|
72
83
|
});
|
|
73
84
|
}, O = (e) => {
|
|
74
85
|
const o = {};
|
|
75
|
-
m.value.forEach((
|
|
76
|
-
|
|
86
|
+
m.value.forEach((a) => {
|
|
87
|
+
a != null && a.formItemFlag && (o[a.options.name] = a.options.defaultValue);
|
|
77
88
|
});
|
|
78
89
|
const n = l.value[t.widget.options.name] || [];
|
|
79
90
|
n.splice(e, 0, o), l.value[t.widget.options.name] || (l.value[t.widget.options.name] = n);
|
|
80
91
|
const i = "id" + S();
|
|
81
|
-
|
|
92
|
+
r.value.splice(e, 0, i), R(() => {
|
|
82
93
|
$(n, i), h(n);
|
|
83
94
|
});
|
|
84
|
-
},
|
|
85
|
-
|
|
95
|
+
}, z = (e) => {
|
|
96
|
+
te({
|
|
86
97
|
type: "confirm",
|
|
87
98
|
content: d("render.hint.deleteSubFormRow") + "?",
|
|
88
99
|
title: d("render.hint.prompt"),
|
|
89
100
|
okText: d("render.hint.confirm"),
|
|
90
101
|
cancelText: d("render.hint.cancel")
|
|
91
102
|
}).then(() => {
|
|
92
|
-
const o = l.value[t.widget.options.name] || [], n =
|
|
93
|
-
o.splice(e, 1),
|
|
103
|
+
const o = l.value[t.widget.options.name] || [], n = Z(o[e]);
|
|
104
|
+
o.splice(e, 1), r.value.splice(e, 1), R(() => {
|
|
94
105
|
H(o, n), h(o);
|
|
95
106
|
});
|
|
96
107
|
}).catch(() => {
|
|
97
108
|
});
|
|
98
|
-
},
|
|
99
|
-
t.widget.options.showBlankRow &&
|
|
109
|
+
}, G = () => {
|
|
110
|
+
t.widget.options.showBlankRow && r.value.length === 0 && (m.value.length === 0 && k(), C());
|
|
100
111
|
};
|
|
101
|
-
return
|
|
102
|
-
|
|
103
|
-
}),
|
|
104
|
-
...
|
|
105
|
-
insertDisabled:
|
|
106
|
-
deleteDisabled:
|
|
107
|
-
actionDisabled:
|
|
112
|
+
return q(() => {
|
|
113
|
+
k(), M(!0), G();
|
|
114
|
+
}), T({
|
|
115
|
+
...V,
|
|
116
|
+
insertDisabled: g,
|
|
117
|
+
deleteDisabled: F,
|
|
118
|
+
actionDisabled: p,
|
|
108
119
|
setInsertDisabled: (e) => {
|
|
109
|
-
|
|
120
|
+
g.value = e;
|
|
110
121
|
},
|
|
111
122
|
setDeleteDisabled: (e) => {
|
|
112
|
-
|
|
123
|
+
F.value = e;
|
|
113
124
|
},
|
|
114
125
|
setActionDisabled: (e) => {
|
|
115
|
-
|
|
126
|
+
p.value = e;
|
|
116
127
|
}
|
|
117
128
|
}), (e, o) => {
|
|
118
|
-
const n =
|
|
119
|
-
return
|
|
120
|
-
default:
|
|
121
|
-
|
|
122
|
-
(
|
|
129
|
+
const n = J("a-button");
|
|
130
|
+
return v(), A(ee, { widget: e.widget }, {
|
|
131
|
+
default: f(() => [
|
|
132
|
+
L(c("div", de, [
|
|
133
|
+
(v(!0), W(K, null, Q(r.value, (i, a) => (v(), W("div", {
|
|
123
134
|
class: "sub-form-row",
|
|
124
135
|
key: i
|
|
125
136
|
}, [
|
|
126
|
-
|
|
127
|
-
|
|
137
|
+
c("div", le, [
|
|
138
|
+
c("span", re, "#" + B(a + 1), 1)
|
|
128
139
|
]),
|
|
129
|
-
|
|
130
|
-
u(
|
|
140
|
+
c("div", ce, [
|
|
141
|
+
u(oe, {
|
|
131
142
|
widgetList: e.widget.widgetList || [],
|
|
132
143
|
parentWidget: e.widget,
|
|
133
|
-
subFormRowIndex:
|
|
144
|
+
subFormRowIndex: a,
|
|
134
145
|
subFormRowId: i
|
|
135
146
|
}, null, 8, ["widgetList", "parentWidget", "subFormRowIndex", "subFormRowId"])
|
|
136
147
|
]),
|
|
137
|
-
|
|
138
|
-
|
|
148
|
+
c("div", ue, [
|
|
149
|
+
L(c("div", me, [
|
|
139
150
|
u(n, {
|
|
140
151
|
type: "link",
|
|
141
|
-
title:
|
|
142
|
-
disabled:
|
|
143
|
-
onClick: (
|
|
152
|
+
title: s(d)("render.hint.insertSubFormRow"),
|
|
153
|
+
disabled: p.value || g.value,
|
|
154
|
+
onClick: (P) => O(a)
|
|
144
155
|
}, {
|
|
145
|
-
icon:
|
|
146
|
-
u(
|
|
156
|
+
icon: f(() => [
|
|
157
|
+
u(s(_), { "icon-class": "icon-el-plus" })
|
|
147
158
|
]),
|
|
148
159
|
_: 2
|
|
149
160
|
}, 1032, ["title", "disabled", "onClick"]),
|
|
150
161
|
u(n, {
|
|
151
162
|
type: "link",
|
|
152
|
-
title:
|
|
153
|
-
disabled:
|
|
154
|
-
onClick: (
|
|
163
|
+
title: s(d)("render.hint.deleteSubFormRow"),
|
|
164
|
+
disabled: p.value || F.value,
|
|
165
|
+
onClick: (P) => z(a)
|
|
155
166
|
}, {
|
|
156
|
-
icon:
|
|
157
|
-
u(
|
|
167
|
+
icon: f(() => [
|
|
168
|
+
u(s(_), { "icon-class": "icon-el-delete" })
|
|
158
169
|
]),
|
|
159
170
|
_: 2
|
|
160
171
|
}, 1032, ["title", "disabled", "onClick"])
|
|
161
172
|
], 512), [
|
|
162
|
-
[
|
|
173
|
+
[E, !s(D)]
|
|
163
174
|
])
|
|
164
175
|
])
|
|
165
176
|
]))), 128)),
|
|
166
|
-
|
|
167
|
-
|
|
177
|
+
c("div", pe, [
|
|
178
|
+
s(D) ? U("", !0) : (v(), A(n, {
|
|
168
179
|
key: 0,
|
|
169
180
|
block: "",
|
|
170
|
-
disabled:
|
|
181
|
+
disabled: p.value || g.value,
|
|
171
182
|
shape: "round",
|
|
172
183
|
type: "dashed",
|
|
173
184
|
size: "small",
|
|
174
185
|
class: "action-button",
|
|
175
|
-
onClick:
|
|
176
|
-
title:
|
|
186
|
+
onClick: C,
|
|
187
|
+
title: s(d)("render.hint.subFormAddActionHint")
|
|
177
188
|
}, {
|
|
178
|
-
icon:
|
|
179
|
-
u(
|
|
189
|
+
icon: f(() => [
|
|
190
|
+
u(s(_), { "icon-class": "icon-el-plus" })
|
|
180
191
|
]),
|
|
181
|
-
default:
|
|
182
|
-
|
|
192
|
+
default: f(() => [
|
|
193
|
+
X(" " + B(s(d)("render.hint.subFormAddAction")), 1)
|
|
183
194
|
]),
|
|
184
195
|
_: 1
|
|
185
196
|
}, 8, ["disabled", "title"]))
|
|
186
197
|
])
|
|
187
198
|
], 512), [
|
|
188
|
-
[
|
|
199
|
+
[E, !s(x)]
|
|
189
200
|
])
|
|
190
201
|
]),
|
|
191
202
|
_: 1
|
|
@@ -194,5 +205,5 @@ const le = { class: "sub-form-container" }, ce = { class: "row-no-column" }, re
|
|
|
194
205
|
}
|
|
195
206
|
});
|
|
196
207
|
export {
|
|
197
|
-
|
|
208
|
+
_e as default
|
|
198
209
|
};
|