@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.
@@ -1,15 +1,15 @@
1
- import { defineComponent as j, provide as A, ref as f, computed as q, onMounted as J, resolveComponent as K, createBlock as L, openBlock as F, withCtx as g, withDirectives as W, createElementVNode as r, createElementBlock as y, Fragment as Q, renderList as U, toDisplayString as E, createVNode as u, unref as a, vShow as N, createCommentVNode as X, createTextVNode as Y, nextTick as R } from "vue";
2
- import { traverseFieldWidgetsOfContainer as Z, generateId as S, deepClone as ee } from "../../../utils/util.js";
3
- import oe from "./container-wrapper.vue.js";
4
- import te from "../RenderWigetList.vue.js";
5
- import { TpfConfirm as ne } from "../../../hooks/TpfConfirm.js";
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 ie, ContainerTypeEnum as se } from "../../../constants/WidgetTypeEnum.js";
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 de } from "../../form-designer/form-widget/field-widget/useField.js";
10
- const le = { class: "sub-form-container" }, ce = { class: "row-no-column" }, re = { class: "row-number-span" }, ue = { class: "grid-sub-form-data-row" }, me = { class: "sub-form-action-column hide-label" }, we = { class: "action-button-column" }, pe = { class: "header-row" }, De = /* @__PURE__ */ j({
11
- name: se.GridSubFormWidget,
12
- componentName: ie.ContainerWidget,
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(T, { expose: V }) {
25
- A("isSubFormField", !0), A("getSubFormName", () => t.widget.options.name);
26
- const { i18nt: d } = ae(), t = T, c = f([]), m = f([]), b = f(!1), v = f(!1), w = f(!1), { field: x, formModel: l, isReadMode: D, handleHidden: B, defineExposed: p } = de(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
- Z(t.widget, e);
34
- }, I = (e = !1) => {
35
- c.value = [];
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
- c.value.push("id" + S());
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 && new Function("subFormData", t.widget.options.onSubFormRowChange).call(p, e);
44
- }, M = (e, o) => {
45
- t.widget.options.onSubFormRowAdd && new Function(
46
- "subFormData",
47
- "newRowId",
48
- t.widget.options.onSubFormRowAdd
49
- ).call(p, e, o);
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
- t.widget.options.onSubFormRowInsert && new Function(
52
- "subFormData",
53
- "newRowId",
54
- t.widget.options.onSubFormRowInsert
55
- ).call(p, e, o);
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
- t.widget.options.onSubFormRowDelete && new Function(
58
- "subFormData",
59
- "deletedDataRow",
60
- t.widget.options.onSubFormRowDelete
61
- ).call(p, e, o);
62
- }, k = () => {
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
- c.value.push(n), R(() => {
71
- M(o, n), h(o);
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((s) => {
76
- s != null && s.formItemFlag && (o[s.options.name] = s.options.defaultValue);
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
- c.value.splice(e, 0, i), R(() => {
92
+ r.value.splice(e, 0, i), R(() => {
82
93
  $(n, i), h(n);
83
94
  });
84
- }, P = (e) => {
85
- ne({
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 = ee(o[e]);
93
- o.splice(e, 1), c.value.splice(e, 1), R(() => {
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
- }, z = () => {
99
- t.widget.options.showBlankRow && c.value.length === 0 && (m.value.length === 0 && C(), k());
109
+ }, G = () => {
110
+ t.widget.options.showBlankRow && r.value.length === 0 && (m.value.length === 0 && k(), C());
100
111
  };
101
- return J(() => {
102
- C(), I(!0), z();
103
- }), V({
104
- ...p,
105
- insertDisabled: b,
106
- deleteDisabled: v,
107
- actionDisabled: w,
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
- b.value = e;
120
+ g.value = e;
110
121
  },
111
122
  setDeleteDisabled: (e) => {
112
- v.value = e;
123
+ F.value = e;
113
124
  },
114
125
  setActionDisabled: (e) => {
115
- w.value = e;
126
+ p.value = e;
116
127
  }
117
128
  }), (e, o) => {
118
- const n = K("a-button");
119
- return F(), L(oe, { widget: e.widget }, {
120
- default: g(() => [
121
- W(r("div", le, [
122
- (F(!0), y(Q, null, U(c.value, (i, s) => (F(), y("div", {
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
- r("div", ce, [
127
- r("span", re, "#" + E(s + 1), 1)
137
+ c("div", le, [
138
+ c("span", re, "#" + B(a + 1), 1)
128
139
  ]),
129
- r("div", ue, [
130
- u(te, {
140
+ c("div", ce, [
141
+ u(oe, {
131
142
  widgetList: e.widget.widgetList || [],
132
143
  parentWidget: e.widget,
133
- subFormRowIndex: s,
144
+ subFormRowIndex: a,
134
145
  subFormRowId: i
135
146
  }, null, 8, ["widgetList", "parentWidget", "subFormRowIndex", "subFormRowId"])
136
147
  ]),
137
- r("div", me, [
138
- W(r("div", we, [
148
+ c("div", ue, [
149
+ L(c("div", me, [
139
150
  u(n, {
140
151
  type: "link",
141
- title: a(d)("render.hint.insertSubFormRow"),
142
- disabled: w.value || b.value,
143
- onClick: (G) => O(s)
152
+ title: s(d)("render.hint.insertSubFormRow"),
153
+ disabled: p.value || g.value,
154
+ onClick: (P) => O(a)
144
155
  }, {
145
- icon: g(() => [
146
- u(a(_), { "icon-class": "icon-el-plus" })
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: a(d)("render.hint.deleteSubFormRow"),
153
- disabled: w.value || v.value,
154
- onClick: (G) => P(s)
163
+ title: s(d)("render.hint.deleteSubFormRow"),
164
+ disabled: p.value || F.value,
165
+ onClick: (P) => z(a)
155
166
  }, {
156
- icon: g(() => [
157
- u(a(_), { "icon-class": "icon-el-delete" })
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
- [N, !a(D)]
173
+ [E, !s(D)]
163
174
  ])
164
175
  ])
165
176
  ]))), 128)),
166
- r("div", pe, [
167
- a(D) ? X("", !0) : (F(), L(n, {
177
+ c("div", pe, [
178
+ s(D) ? U("", !0) : (v(), A(n, {
168
179
  key: 0,
169
180
  block: "",
170
- disabled: w.value || b.value,
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: k,
176
- title: a(d)("render.hint.subFormAddActionHint")
186
+ onClick: C,
187
+ title: s(d)("render.hint.subFormAddActionHint")
177
188
  }, {
178
- icon: g(() => [
179
- u(a(_), { "icon-class": "icon-el-plus" })
189
+ icon: f(() => [
190
+ u(s(_), { "icon-class": "icon-el-plus" })
180
191
  ]),
181
- default: g(() => [
182
- Y(" " + E(a(d)("render.hint.subFormAddAction")), 1)
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
- [N, !a(B)]
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
- De as default
208
+ _e as default
198
209
  };