@form-create/component-elm-group 2.7.0 → 2.7.5

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/index.es.js CHANGED
@@ -1,118 +1,118 @@
1
1
  /*!
2
2
  * FormCreate 低代码表单渲染器
3
- * @form-create/component-elm-group v2.7.0
4
- * (c) 2018-2024 xaboy
3
+ * @form-create/component-elm-group v2.7.5
4
+ * (c) 2018-2025 xaboy
5
5
  * Github https://github.com/xaboy/form-create
6
6
  * Site https://form-create.com/
7
7
  * Released under the MIT License.
8
8
  */
9
9
  (function(){"use strict";try{if(typeof document!="undefined"){var o=document.createElement("style");o.appendChild(document.createTextNode('._fc-group{display:flex;min-height:42px;justify-content:center;flex-direction:column}._fc-group-disabled ._fc-group-btn,._fc-group-disabled ._fc-group-add{cursor:not-allowed}._fc-group-handle{display:flex;flex-direction:row;position:absolute;bottom:-15px;right:30px;border-radius:15px;border:1px dashed #d9d9d9;padding:3px 8px;background-color:#fff}._fc-group-btn{cursor:pointer}._fc-group-idx{position:absolute;bottom:-15px;left:10px;width:30px;height:30px;display:flex;align-items:center;justify-content:center;background:#eee;border-radius:15px;font-weight:700}._fc-group-handle ._fc-group-btn+._fc-group-btn{margin-left:7px}._fc-group-container{position:relative;display:flex;flex-direction:column;border:1px dashed #d9d9d9;padding:20px 20px 25px;margin:5px 5px 25px;border-radius:5px}._fc-group-arrow{position:relative;width:20px;height:20px}._fc-group-arrow:before{content:"";position:absolute;top:8px;left:5px;width:9px;height:9px;border-left:2px solid #999;border-top:2px solid #999}._fc-group-arrow:before{transform:rotate(45deg)}._fc-group-arrow._fc-group-down{transform:rotate(180deg)}._fc-group-plus-minus{width:20px;height:20px;position:relative;cursor:pointer}._fc-group-plus-minus:before,._fc-group-plus-minus:after{content:"";position:absolute;top:50%;left:50%;width:60%;height:2px;background-color:#409eff;transform:translate(-50%,-50%)}._fc-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-group-plus-minus._fc-group-minus:before{display:none}._fc-group-plus-minus._fc-group-minus:after{background-color:#f56c6c}._fc-group-add{cursor:pointer;width:25px;height:25px;border:1px solid rgb(64 158 255 / 50%);border-radius:15px}._fc-group-add._fc-group-plus-minus:before,._fc-group-add._fc-group-plus-minus:after{width:50%}')),document.head.appendChild(o)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
10
10
  var O = Object.defineProperty;
11
- var g = Object.getOwnPropertySymbols;
12
- var R = Object.prototype.hasOwnProperty, j = Object.prototype.propertyIsEnumerable;
13
- var _ = (e, t, r) => t in e ? O(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, d = (e, t) => {
14
- for (var r in t || (t = {}))
15
- R.call(t, r) && _(e, r, t[r]);
16
- if (g)
17
- for (var r of g(t))
18
- j.call(t, r) && _(e, r, t[r]);
19
- return e;
11
+ var v = Object.getOwnPropertySymbols;
12
+ var j = Object.prototype.hasOwnProperty, R = Object.prototype.propertyIsEnumerable;
13
+ var _ = (t, e, r) => e in t ? O(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, d = (t, e) => {
14
+ for (var r in e || (e = {}))
15
+ j.call(e, r) && _(t, r, e[r]);
16
+ if (v)
17
+ for (var r of v(e))
18
+ R.call(e, r) && _(t, r, e[r]);
19
+ return t;
20
20
  };
21
21
  import A from "vue";
22
- function V(e) {
23
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
22
+ function V(t) {
23
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
24
24
  }
25
- function p() {
26
- return p = Object.assign ? Object.assign.bind() : function(e) {
27
- for (var t, r = 1; r < arguments.length; r++) for (var s in t = arguments[r], t) Object.prototype.hasOwnProperty.call(t, s) && (e[s] = t[s]);
28
- return e;
29
- }, p.apply(this, arguments);
25
+ function m() {
26
+ return m = Object.assign ? Object.assign.bind() : function(t) {
27
+ for (var e, r = 1; r < arguments.length; r++) for (var s in e = arguments[r], e) Object.prototype.hasOwnProperty.call(e, s) && (t[s] = e[s]);
28
+ return t;
29
+ }, m.apply(this, arguments);
30
30
  }
31
- var S = ["attrs", "props", "domProps"], B = ["class", "style", "directives"], k = ["on", "nativeOn"], D = function(e) {
32
- return e.reduce(function(t, r) {
33
- for (var s in r) if (!t[s]) t[s] = r[s];
34
- else if (S.indexOf(s) !== -1) t[s] = p({}, t[s], r[s]);
31
+ var S = ["attrs", "props", "domProps"], B = ["class", "style", "directives"], k = ["on", "nativeOn"], D = function(t) {
32
+ return t.reduce(function(e, r) {
33
+ for (var s in r) if (!e[s]) e[s] = r[s];
34
+ else if (S.indexOf(s) !== -1) e[s] = m({}, e[s], r[s]);
35
35
  else if (B.indexOf(s) !== -1) {
36
- var i = t[s] instanceof Array ? t[s] : [t[s]], n = r[s] instanceof Array ? r[s] : [r[s]];
37
- t[s] = [].concat(i, n);
36
+ var n = e[s] instanceof Array ? e[s] : [e[s]], i = r[s] instanceof Array ? r[s] : [r[s]];
37
+ e[s] = [].concat(n, i);
38
38
  } else if (k.indexOf(s) !== -1)
39
- for (var o in r[s]) if (t[s][o]) {
40
- var l = t[s][o] instanceof Array ? t[s][o] : [t[s][o]], f = r[s][o] instanceof Array ? r[s][o] : [r[s][o]];
41
- t[s][o] = [].concat(l, f);
42
- } else t[s][o] = r[s][o];
43
- else if (s === "hook") for (var u in r[s]) t[s][u] = t[s][u] ? E(t[s][u], r[s][u]) : r[s][u];
44
- else t[s] = r[s];
45
- return t;
39
+ for (var o in r[s]) if (e[s][o]) {
40
+ var l = e[s][o] instanceof Array ? e[s][o] : [e[s][o]], f = r[s][o] instanceof Array ? r[s][o] : [r[s][o]];
41
+ e[s][o] = [].concat(l, f);
42
+ } else e[s][o] = r[s][o];
43
+ else if (s === "hook") for (var u in r[s]) e[s][u] = e[s][u] ? E(e[s][u], r[s][u]) : r[s][u];
44
+ else e[s] = r[s];
45
+ return e;
46
46
  }, {});
47
- }, E = function(e, t) {
47
+ }, E = function(t, e) {
48
48
  return function() {
49
- e && e.apply(this, arguments), t && t.apply(this, arguments);
49
+ t && t.apply(this, arguments), e && e.apply(this, arguments);
50
50
  };
51
51
  }, I = D;
52
- const b = /* @__PURE__ */ V(I), c = {
53
- type(e, t) {
54
- return Object.prototype.toString.call(e) === "[object " + t + "]";
52
+ const b = /* @__PURE__ */ V(I), a = {
53
+ type(t, e) {
54
+ return Object.prototype.toString.call(t) === "[object " + e + "]";
55
55
  },
56
- Undef(e) {
57
- return e == null;
56
+ Undef(t) {
57
+ return t == null;
58
58
  },
59
- Element(e) {
60
- return typeof e == "object" && e !== null && e.nodeType === 1 && !c.Object(e);
59
+ Element(t) {
60
+ return typeof t == "object" && t !== null && t.nodeType === 1 && !a.Object(t);
61
61
  },
62
- trueArray(e) {
63
- return Array.isArray(e) && e.length > 0;
62
+ trueArray(t) {
63
+ return Array.isArray(t) && t.length > 0;
64
64
  },
65
- Function(e) {
66
- const t = this.getType(e);
67
- return t === "Function" || t === "AsyncFunction";
65
+ Function(t) {
66
+ const e = this.getType(t);
67
+ return e === "Function" || e === "AsyncFunction";
68
68
  },
69
- getType(e) {
70
- const t = Object.prototype.toString.call(e);
71
- return /^\[object (.*)\]$/.exec(t)[1];
69
+ getType(t) {
70
+ const e = Object.prototype.toString.call(t);
71
+ return /^\[object (.*)\]$/.exec(e)[1];
72
72
  },
73
- empty(e) {
74
- return e == null || Array.isArray(e) && Array.isArray(e) && !e.length ? !0 : typeof e == "string" && !e;
73
+ empty(t) {
74
+ return t == null || Array.isArray(t) && Array.isArray(t) && !t.length ? !0 : typeof t == "string" && !t;
75
75
  }
76
76
  };
77
- ["Date", "Object", "String", "Boolean", "Array", "Number"].forEach((e) => {
78
- c[e] = function(t) {
79
- return c.type(t, e);
77
+ ["Date", "Object", "String", "Boolean", "Array", "Number"].forEach((t) => {
78
+ a[t] = function(e) {
79
+ return a.type(e, t);
80
80
  };
81
81
  });
82
- function w(e, t) {
83
- return {}.hasOwnProperty.call(e, t);
82
+ function w(t, e) {
83
+ return {}.hasOwnProperty.call(t, e);
84
84
  }
85
- function h(e, t, r) {
86
- A.set(e, t, r);
85
+ function h(t, e, r) {
86
+ A.set(t, e, r);
87
87
  }
88
- function m(e, t = {}, r) {
88
+ function y(t, e = {}, r) {
89
89
  let s = !1;
90
- for (let i in t)
91
- if (Object.prototype.hasOwnProperty.call(t, i)) {
92
- let n = t[i];
93
- if ((s = Array.isArray(n)) || c.Object(n)) {
94
- let o = e[i] === void 0;
90
+ for (let n in e)
91
+ if (Object.prototype.hasOwnProperty.call(e, n)) {
92
+ let i = e[n];
93
+ if ((s = Array.isArray(i)) || a.Object(i)) {
94
+ let o = t[n] === void 0;
95
95
  if (s)
96
- s = !1, o && h(e, i, []);
97
- else if (n._clone && r !== void 0) {
98
- h(e, i, n._clone());
96
+ s = !1, o && h(t, n, []);
97
+ else if (i._clone && r !== void 0) {
98
+ h(t, n, i._clone());
99
99
  continue;
100
100
  } else
101
- o && h(e, i, {});
102
- e[i] = m(e[i], n, r);
101
+ o && h(t, n, {});
102
+ t[n] = y(t[n], i, r);
103
103
  } else
104
- h(e, i, n), c.Undef(n) || (c.Undef(n.__json) || (e[i].__json = n.__json), c.Undef(n.__origin) || (e[i].__origin = n.__origin));
104
+ h(t, n, i), a.Undef(i) || (a.Undef(i.__json) || (t[n].__json = i.__json), a.Undef(i.__origin) || (t[n].__origin = i.__origin));
105
105
  }
106
- return e;
106
+ return t;
107
107
  }
108
- function v(e) {
109
- return m({}, { value: e }).value;
108
+ function p(t) {
109
+ return y({}, { value: t }).value;
110
110
  }
111
- const x = Object.assign || function(e) {
112
- for (let t, r = 1; r < arguments.length; r++)
113
- for (let s in t = arguments[r], t)
114
- Object.prototype.hasOwnProperty.call(t, s) && h(e, s, t[s]);
115
- return e;
111
+ const x = Object.assign || function(t) {
112
+ for (let e, r = 1; r < arguments.length; r++)
113
+ for (let s in e = arguments[r], e)
114
+ Object.prototype.hasOwnProperty.call(e, s) && h(t, s, e[s]);
115
+ return t;
116
116
  };
117
117
  function F() {
118
118
  return x.apply(this, arguments);
@@ -186,94 +186,94 @@ const P = "fcGroup", M = {
186
186
  },
187
187
  watch: {
188
188
  cacheRule: {
189
- handler(e) {
190
- this.sort = Object.keys(e);
189
+ handler(t) {
190
+ this.sort = Object.keys(t);
191
191
  },
192
192
  immediate: !0
193
193
  },
194
194
  formRule: {
195
- handler(e, t) {
195
+ handler(t, e) {
196
196
  Object.keys(this.cacheRule).forEach((r) => {
197
197
  const s = this.cacheRule[r];
198
198
  if (s.$f) {
199
- const i = s.$f.formData();
200
- if (e === t)
199
+ const n = s.$f.formData();
200
+ if (t === e)
201
201
  s.$f.deferSyncValue(() => {
202
- m(s.rule, e), s.$f.setValue(i);
202
+ y(s.rule, t), s.$f.setValue(n);
203
203
  }, !0);
204
204
  else {
205
- const n = s.$f.formData();
205
+ const i = s.$f.formData();
206
206
  s.$f.once("reloading", () => {
207
- s.$f.setValue(n);
208
- }), s.rule = v(e);
207
+ s.$f.setValue(i);
208
+ }), s.rule = p(t);
209
209
  }
210
210
  }
211
211
  });
212
212
  },
213
213
  deep: !0
214
214
  },
215
- expand(e) {
216
- let t = e - this.value.length;
217
- t > 0 && this.expandRule(t);
215
+ expand(t) {
216
+ let e = t - this.value.length;
217
+ e > 0 && this.expandRule(e);
218
218
  },
219
- value(e, t) {
220
- e = e || [];
221
- let r = this.sort, s = r.length, i = s - e.length;
222
- if (i < 0) {
223
- for (let n = i; n < 0; n++)
224
- this.addRule(e.length + n);
219
+ value(t, e) {
220
+ t = t || [];
221
+ let r = this.sort, s = r.length, n = s - t.length;
222
+ if (n < 0) {
223
+ for (let i = n; i < 0; i++)
224
+ this.addRule(t.length + i);
225
225
  this.sort = Object.keys(this.cacheRule);
226
- for (let n = 0; n < s; n++)
227
- this.setValue(r[n], e[n]);
226
+ for (let i = 0; i < s; i++)
227
+ this.setValue(r[i], t[i]);
228
228
  } else {
229
- if (i > 0) {
230
- for (let n = 0; n < i; n++)
231
- this.removeRule(r[s - n - 1]);
229
+ if (n > 0) {
230
+ for (let i = 0; i < n; i++)
231
+ this.removeRule(r[s - i - 1]);
232
232
  this.sort = Object.keys(this.cacheRule);
233
233
  }
234
- e.forEach((n, o) => {
235
- this.setValue(r[o], e[o]);
234
+ t.forEach((i, o) => {
235
+ this.setValue(r[o], t[o]);
236
236
  });
237
237
  }
238
238
  }
239
239
  },
240
240
  methods: {
241
- _value(e) {
242
- return e && w(e, this.field) ? e[this.field] : e;
241
+ _value(t) {
242
+ return t && w(t, this.field) ? t[this.field] : t;
243
243
  },
244
- cache(e, t) {
245
- this.cacheValue[e] = JSON.stringify(t);
244
+ cache(t, e) {
245
+ this.cacheValue[t] = JSON.stringify(e);
246
246
  },
247
- input(e) {
248
- this.$emit("input", e), this.$emit("change", e);
247
+ input(t) {
248
+ this.$emit("input", t), this.$emit("change", t);
249
249
  },
250
- formData(e, t) {
250
+ formData(t, e) {
251
251
  const r = this.cacheRule, s = this.sort;
252
- if (s.filter((n) => r[n].$f).length !== s.length)
252
+ if (s.filter((i) => r[i].$f).length !== s.length)
253
253
  return;
254
- const i = s.map((n) => {
255
- const o = e === n ? t : d({}, this.cacheRule[n].$f.form), l = this.field ? o[this.field] || null : o;
256
- return this.cache(n, l), l;
254
+ const n = s.map((i) => {
255
+ const o = t === i ? e : d({}, this.cacheRule[i].$f.form), l = this.field ? o[this.field] || null : o;
256
+ return this.cache(i, l), l;
257
257
  });
258
- this.input(i);
258
+ this.input(n);
259
259
  },
260
- setValue(e, t) {
261
- const r = this.field, s = this.cacheRule[e].$f;
262
- r && (t = {
263
- [r]: this._value(t)
264
- }), this.cacheValue[e] !== JSON.stringify(r ? t[r] : t) && (this.cache(e, t), s && s.coverValue(t || {}));
260
+ setValue(t, e) {
261
+ const r = this.field, s = this.cacheRule[t].$f;
262
+ r && (e = {
263
+ [r]: this._value(e)
264
+ }), this.cacheValue[t] !== JSON.stringify(r ? e[r] : e) && (this.cache(t, e), s && s.coverValue(e || {}));
265
265
  },
266
- addRule(e, t) {
266
+ addRule(t, e) {
267
267
  const r = this.formCreateInject.form.copyRules(this.formRule), s = this.options ? d({}, this.options) : {
268
268
  submitBtn: !1,
269
269
  resetBtn: !1
270
270
  };
271
271
  if (this.defaultValue) {
272
272
  s.formData || (s.formData = {});
273
- const i = v(this.defaultValue);
273
+ const n = p(this.defaultValue);
274
274
  F(s.formData, this.field ? {
275
- [this.field]: i
276
- } : i);
275
+ [this.field]: n
276
+ } : n);
277
277
  }
278
278
  this.parse && this.parse({
279
279
  rule: r,
@@ -282,124 +282,127 @@ const P = "fcGroup", M = {
282
282
  }), this.$set(this.cacheRule, ++this.len, {
283
283
  rule: r,
284
284
  options: s
285
- }), t && this.$nextTick(() => this.$emit("add", r, Object.keys(this.cacheRule).length - 1));
285
+ }), e && this.$nextTick(() => this.$emit("add", r, Object.keys(this.cacheRule).length - 1));
286
286
  },
287
- add$f(e, t, r) {
288
- this.cacheRule[t].$f = r, this.$nextTick(() => {
289
- this.$emit("itemMounted", r, Object.keys(this.cacheRule).indexOf(t));
287
+ add$f(t, e, r) {
288
+ this.cacheRule[e].$f = r, this.$nextTick(() => {
289
+ this.$emit("itemMounted", r, Object.keys(this.cacheRule).indexOf(e));
290
290
  });
291
291
  },
292
- removeRule(e, t) {
293
- const r = Object.keys(this.cacheRule).indexOf(e);
294
- this.$delete(this.cacheRule, e), this.$delete(this.cacheValue, e), t && this.$nextTick(() => this.$emit("remove", r));
292
+ removeRule(t, e) {
293
+ const r = Object.keys(this.cacheRule).indexOf(t);
294
+ this.$delete(this.cacheRule, t), this.$delete(this.cacheValue, t), e && this.$nextTick(() => this.$emit("remove", r));
295
295
  },
296
- add(e) {
297
- this.disabled || this.onBeforeAdd(this.value) === !1 || this.addRule(e, !0);
296
+ add(t) {
297
+ if (this.disabled || this.onBeforeAdd(this.value) === !1)
298
+ return;
299
+ const e = [...this.value];
300
+ e.push(this.defaultValue ? p(this.defaultValue) : this.field ? null : {}), this.input(e);
298
301
  },
299
- del(e, t) {
300
- if (this.disabled || this.onBeforeRemove(this.value, e) === !1)
302
+ del(t, e) {
303
+ if (this.disabled || this.onBeforeRemove(this.value, t) === !1)
301
304
  return;
302
- this.removeRule(t, !0);
305
+ this.removeRule(e, !0);
303
306
  const r = [...this.value];
304
- r.splice(e, 1), this.input(r);
307
+ r.splice(t, 1), this.input(r);
305
308
  },
306
- addIcon(e) {
307
- const t = this.$createElement;
308
- return t("div", {
309
+ addIcon(t) {
310
+ const e = this.$createElement;
311
+ return e("div", {
309
312
  class: "_fc-group-btn _fc-group-plus-minus",
310
313
  on: {
311
314
  click: this.add
312
315
  }
313
316
  });
314
317
  },
315
- delIcon(e, t) {
318
+ delIcon(t, e) {
316
319
  const r = this.$createElement;
317
320
  return r("div", {
318
321
  class: "_fc-group-btn _fc-group-plus-minus _fc-group-minus",
319
322
  on: {
320
- click: () => this.del(e, t)
323
+ click: () => this.del(t, e)
321
324
  }
322
325
  });
323
326
  },
324
- sortUpIcon(e) {
325
- const t = this.$createElement;
326
- return t("div", {
327
+ sortUpIcon(t) {
328
+ const e = this.$createElement;
329
+ return e("div", {
327
330
  class: "_fc-group-btn _fc-group-arrow _fc-group-up",
328
331
  on: {
329
- click: () => this.changeSort(e, -1)
332
+ click: () => this.changeSort(t, -1)
330
333
  }
331
334
  });
332
335
  },
333
- sortDownIcon(e) {
334
- const t = this.$createElement;
335
- return t("div", {
336
+ sortDownIcon(t) {
337
+ const e = this.$createElement;
338
+ return e("div", {
336
339
  class: "_fc-group-btn _fc-group-arrow _fc-group-down",
337
340
  on: {
338
- click: () => this.changeSort(e, 1)
341
+ click: () => this.changeSort(t, 1)
339
342
  }
340
343
  });
341
344
  },
342
- changeSort(e, t) {
343
- const r = this.sort[e];
344
- this.$set(this.sort, e, this.sort[e + t]), this.sort[e + t] = r, this.formData(0);
345
+ changeSort(t, e) {
346
+ const r = this.sort[t];
347
+ this.$set(this.sort, t, this.sort[t + e]), this.sort[t + e] = r, this.formData(0);
345
348
  },
346
- makeIcon(e, t, r) {
349
+ makeIcon(t, e, r) {
347
350
  if (this.$scopedSlots.button)
348
351
  return this.$scopedSlots.button({
349
- total: e,
350
- index: t,
352
+ total: t,
353
+ index: e,
351
354
  vm: this,
352
355
  key: r,
353
- del: () => this.del(t, r),
356
+ del: () => this.del(e, r),
354
357
  add: this.add
355
358
  });
356
359
  const s = [];
357
- return (!this.max || e < this.max) && e === t + 1 && s.push(this.addIcon(r)), e > this.min && s.push(this.delIcon(t, r)), this.sortBtn && t && s.push(this.sortUpIcon(t)), this.sortBtn && t !== e - 1 && s.push(this.sortDownIcon(t)), s;
360
+ return (!this.max || t < this.max) && t === e + 1 && s.push(this.addIcon(r)), t > this.min && s.push(this.delIcon(e, r)), this.sortBtn && e && s.push(this.sortUpIcon(e)), this.sortBtn && e !== t - 1 && s.push(this.sortDownIcon(e)), s;
358
361
  },
359
- emitEvent(e, t, r, s) {
360
- this.$emit(e, ...t, this.cacheRule[s].$f, r);
362
+ emitEvent(t, e, r, s) {
363
+ this.$emit(t, ...e, this.cacheRule[s].$f, r);
361
364
  },
362
- expandRule(e) {
363
- for (let t = 0; t < e; t++)
365
+ expandRule(t) {
366
+ for (let e = 0; e < t; e++)
364
367
  this.value.push(this.field ? null : {});
365
368
  }
366
369
  },
367
370
  created() {
368
371
  this.type = this.formCreateInject.form.$form();
369
- const e = (this.expand || 0) - this.value.length;
370
- e > 0 && this.expandRule(e);
371
- for (let t = 0; t < this.value.length; t++)
372
- this.addRule(t);
372
+ const t = (this.expand || 0) - this.value.length;
373
+ t > 0 && this.expandRule(t);
374
+ for (let e = 0; e < this.value.length; e++)
375
+ this.addRule(e);
373
376
  },
374
377
  render() {
375
- const e = arguments[0], t = this.sort, r = this.button, s = this.type, i = this.disabled, n = t.length === 0 ? this.$scopedSlots.default ? this.$scopedSlots.default({
378
+ const t = arguments[0], e = this.sort, r = this.button, s = this.type, n = this.disabled, i = e.length === 0 ? this.$scopedSlots.default ? this.$scopedSlots.default({
376
379
  vm: this,
377
380
  add: this.add
378
- }) : e("div", {
381
+ }) : t("div", {
379
382
  key: "a_def",
380
383
  class: "_fc-group-plus-minus _fc-group-add fc-clock",
381
384
  on: {
382
385
  click: this.add
383
386
  }
384
- }) : t.map((o, l) => {
387
+ }) : e.map((o, l) => {
385
388
  const {
386
389
  rule: f,
387
390
  options: u
388
- } = this.cacheRule[o], y = r && !i ? this.makeIcon(t.length, l, o) : [];
389
- return e("div", {
391
+ } = this.cacheRule[o], g = r && !n ? this.makeIcon(e.length, l, o) : [];
392
+ return t("div", {
390
393
  class: "_fc-group-container",
391
394
  key: o
392
- }, [e(s, b([{
395
+ }, [t(s, b([{
393
396
  key: o
394
397
  }, {
395
398
  on: {
396
- "update:value": (a) => this.formData(o, a),
397
- "emit-event": (a, ...$) => this.emitEvent(a, $, l, o),
398
- input: (a) => this.add$f(l, o, a)
399
+ "update:value": (c) => this.formData(o, c),
400
+ "emit-event": (c, ...$) => this.emitEvent(c, $, l, o),
401
+ input: (c) => this.add$f(l, o, c)
399
402
  }
400
403
  }, {}, {
401
404
  props: {
402
- disabled: i,
405
+ disabled: n,
403
406
  inFor: !0,
404
407
  value: this.field ? {
405
408
  [this.field]: this._value(this.value[l])
@@ -408,16 +411,16 @@ const P = "fcGroup", M = {
408
411
  option: u,
409
412
  extendOption: !0
410
413
  }
411
- }])), e("div", {
414
+ }])), t("div", {
412
415
  class: "_fc-group-idx"
413
- }, [l + 1]), y.length ? e("div", {
416
+ }, [l + 1]), g.length ? t("div", {
414
417
  class: "_fc-group-handle fc-clock"
415
- }, [y]) : null]);
418
+ }, [g]) : null]);
416
419
  });
417
- return e("div", {
420
+ return t("div", {
418
421
  key: "con",
419
- class: "_fc-group " + (i ? "_fc-group-disabled" : "")
420
- }, [n]);
422
+ class: "_fc-group " + (n ? "_fc-group-disabled" : "")
423
+ }, [i]);
421
424
  }
422
425
  };
423
426
  export {
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  /*!
2
2
  * FormCreate 低代码表单渲染器
3
- * @form-create/component-elm-group v2.7.0
4
- * (c) 2018-2024 xaboy
3
+ * @form-create/component-elm-group v2.7.5
4
+ * (c) 2018-2025 xaboy
5
5
  * Github https://github.com/xaboy/form-create
6
6
  * Site https://form-create.com/
7
7
  * Released under the MIT License.
8
8
  */
9
9
  (function(){"use strict";try{if(typeof document!="undefined"){var o=document.createElement("style");o.appendChild(document.createTextNode('._fc-group{display:flex;min-height:42px;justify-content:center;flex-direction:column}._fc-group-disabled ._fc-group-btn,._fc-group-disabled ._fc-group-add{cursor:not-allowed}._fc-group-handle{display:flex;flex-direction:row;position:absolute;bottom:-15px;right:30px;border-radius:15px;border:1px dashed #d9d9d9;padding:3px 8px;background-color:#fff}._fc-group-btn{cursor:pointer}._fc-group-idx{position:absolute;bottom:-15px;left:10px;width:30px;height:30px;display:flex;align-items:center;justify-content:center;background:#eee;border-radius:15px;font-weight:700}._fc-group-handle ._fc-group-btn+._fc-group-btn{margin-left:7px}._fc-group-container{position:relative;display:flex;flex-direction:column;border:1px dashed #d9d9d9;padding:20px 20px 25px;margin:5px 5px 25px;border-radius:5px}._fc-group-arrow{position:relative;width:20px;height:20px}._fc-group-arrow:before{content:"";position:absolute;top:8px;left:5px;width:9px;height:9px;border-left:2px solid #999;border-top:2px solid #999}._fc-group-arrow:before{transform:rotate(45deg)}._fc-group-arrow._fc-group-down{transform:rotate(180deg)}._fc-group-plus-minus{width:20px;height:20px;position:relative;cursor:pointer}._fc-group-plus-minus:before,._fc-group-plus-minus:after{content:"";position:absolute;top:50%;left:50%;width:60%;height:2px;background-color:#409eff;transform:translate(-50%,-50%)}._fc-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-group-plus-minus._fc-group-minus:before{display:none}._fc-group-plus-minus._fc-group-minus:after{background-color:#f56c6c}._fc-group-add{cursor:pointer;width:25px;height:25px;border:1px solid rgb(64 158 255 / 50%);border-radius:15px}._fc-group-add._fc-group-plus-minus:before,._fc-group-add._fc-group-plus-minus:after{width:50%}')),document.head.appendChild(o)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
10
- (function(l,u){typeof exports=="object"&&typeof module!="undefined"?module.exports=u(require("vue")):typeof define=="function"&&define.amd?define(["vue"],u):(l=typeof globalThis!="undefined"?globalThis:l||self,l.FcGroup=u(l.Vue))})(this,function(l){"use strict";var w=Object.defineProperty;var $=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable;var O=(l,u,c)=>u in l?w(l,u,{enumerable:!0,configurable:!0,writable:!0,value:c}):l[u]=c,g=(l,u)=>{for(var c in u||(u={}))x.call(u,c)&&O(l,c,u[c]);if($)for(var c of $(u))F.call(u,c)&&O(l,c,u[c]);return l};function u(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t,r=1;r<arguments.length;r++)for(var s in t=arguments[r],t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},c.apply(this,arguments)}var j=["attrs","props","domProps"],R=["class","style","directives"],A=["on","nativeOn"],V=function(e){return e.reduce(function(t,r){for(var s in r)if(!t[s])t[s]=r[s];else if(j.indexOf(s)!==-1)t[s]=c({},t[s],r[s]);else if(R.indexOf(s)!==-1){var i=t[s]instanceof Array?t[s]:[t[s]],n=r[s]instanceof Array?r[s]:[r[s]];t[s]=[].concat(i,n)}else if(A.indexOf(s)!==-1)for(var o in r[s])if(t[s][o]){var a=t[s][o]instanceof Array?t[s][o]:[t[s][o]],y=r[s][o]instanceof Array?r[s][o]:[r[s][o]];t[s][o]=[].concat(a,y)}else t[s][o]=r[s][o];else if(s==="hook")for(var f in r[s])t[s][f]=t[s][f]?S(t[s][f],r[s][f]):r[s][f];else t[s]=r[s];return t},{})},S=function(e,t){return function(){e&&e.apply(this,arguments),t&&t.apply(this,arguments)}},B=V;const E=u(B),h={type(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"},Undef(e){return e==null},Element(e){return typeof e=="object"&&e!==null&&e.nodeType===1&&!h.Object(e)},trueArray(e){return Array.isArray(e)&&e.length>0},Function(e){const t=this.getType(e);return t==="Function"||t==="AsyncFunction"},getType(e){const t=Object.prototype.toString.call(e);return/^\[object (.*)\]$/.exec(t)[1]},empty(e){return e==null||Array.isArray(e)&&Array.isArray(e)&&!e.length?!0:typeof e=="string"&&!e}};["Date","Object","String","Boolean","Array","Number"].forEach(e=>{h[e]=function(t){return h.type(t,e)}});function k(e,t){return{}.hasOwnProperty.call(e,t)}function d(e,t,r){l.set(e,t,r)}function m(e,t={},r){let s=!1;for(let i in t)if(Object.prototype.hasOwnProperty.call(t,i)){let n=t[i];if((s=Array.isArray(n))||h.Object(n)){let o=e[i]===void 0;if(s)s=!1,o&&d(e,i,[]);else if(n._clone&&r!==void 0){d(e,i,n._clone());continue}else o&&d(e,i,{});e[i]=m(e[i],n,r)}else d(e,i,n),h.Undef(n)||(h.Undef(n.__json)||(e[i].__json=n.__json),h.Undef(n.__origin)||(e[i].__origin=n.__origin))}return e}function v(e){return m({},{value:e}).value}const D=Object.assign||function(e){for(let t,r=1;r<arguments.length;r++)for(let s in t=arguments[r],t)Object.prototype.hasOwnProperty.call(t,s)&&d(e,s,t[s]);return e};function I(){return D.apply(this,arguments)}return{name:"fcGroup",props:{field:String,rule:[Array,Object],rules:Array,expand:Number,options:Object,formCreateInject:{type:Object,required:!0},button:{type:Boolean,default:!0},max:{type:Number,default:0},min:{type:Number,default:0},value:{type:Array,default:()=>[]},sortBtn:{type:Boolean,default:!0},defaultValue:Object,disabled:{type:Boolean,default:!1},syncDisabled:{type:Boolean,default:!0},onBeforeRemove:{type:Function,default:()=>{}},onBeforeAdd:{type:Function,default:()=>{}},parse:Function},data(){return{len:0,cacheRule:{},cacheValue:{},sort:[],type:void 0}},computed:{formRule(){return this.rules?this.rules:this.rule?Array.isArray(this.rule)?this.rule:[this.rule]:[]}},watch:{cacheRule:{handler(e){this.sort=Object.keys(e)},immediate:!0},formRule:{handler(e,t){Object.keys(this.cacheRule).forEach(r=>{const s=this.cacheRule[r];if(s.$f){const i=s.$f.formData();if(e===t)s.$f.deferSyncValue(()=>{m(s.rule,e),s.$f.setValue(i)},!0);else{const n=s.$f.formData();s.$f.once("reloading",()=>{s.$f.setValue(n)}),s.rule=v(e)}}})},deep:!0},expand(e){let t=e-this.value.length;t>0&&this.expandRule(t)},value(e,t){e=e||[];let r=this.sort,s=r.length,i=s-e.length;if(i<0){for(let n=i;n<0;n++)this.addRule(e.length+n);this.sort=Object.keys(this.cacheRule);for(let n=0;n<s;n++)this.setValue(r[n],e[n])}else{if(i>0){for(let n=0;n<i;n++)this.removeRule(r[s-n-1]);this.sort=Object.keys(this.cacheRule)}e.forEach((n,o)=>{this.setValue(r[o],e[o])})}}},methods:{_value(e){return e&&k(e,this.field)?e[this.field]:e},cache(e,t){this.cacheValue[e]=JSON.stringify(t)},input(e){this.$emit("input",e),this.$emit("change",e)},formData(e,t){const r=this.cacheRule,s=this.sort;if(s.filter(n=>r[n].$f).length!==s.length)return;const i=s.map(n=>{const o=e===n?t:g({},this.cacheRule[n].$f.form),a=this.field?o[this.field]||null:o;return this.cache(n,a),a});this.input(i)},setValue(e,t){const r=this.field,s=this.cacheRule[e].$f;r&&(t={[r]:this._value(t)}),this.cacheValue[e]!==JSON.stringify(r?t[r]:t)&&(this.cache(e,t),s&&s.coverValue(t||{}))},addRule(e,t){const r=this.formCreateInject.form.copyRules(this.formRule),s=this.options?g({},this.options):{submitBtn:!1,resetBtn:!1};if(this.defaultValue){s.formData||(s.formData={});const i=v(this.defaultValue);I(s.formData,this.field?{[this.field]:i}:i)}this.parse&&this.parse({rule:r,options:s,index:this.sort.length}),this.$set(this.cacheRule,++this.len,{rule:r,options:s}),t&&this.$nextTick(()=>this.$emit("add",r,Object.keys(this.cacheRule).length-1))},add$f(e,t,r){this.cacheRule[t].$f=r,this.$nextTick(()=>{this.$emit("itemMounted",r,Object.keys(this.cacheRule).indexOf(t))})},removeRule(e,t){const r=Object.keys(this.cacheRule).indexOf(e);this.$delete(this.cacheRule,e),this.$delete(this.cacheValue,e),t&&this.$nextTick(()=>this.$emit("remove",r))},add(e){this.disabled||this.onBeforeAdd(this.value)===!1||this.addRule(e,!0)},del(e,t){if(this.disabled||this.onBeforeRemove(this.value,e)===!1)return;this.removeRule(t,!0);const r=[...this.value];r.splice(e,1),this.input(r)},addIcon(e){const t=this.$createElement;return t("div",{class:"_fc-group-btn _fc-group-plus-minus",on:{click:this.add}})},delIcon(e,t){const r=this.$createElement;return r("div",{class:"_fc-group-btn _fc-group-plus-minus _fc-group-minus",on:{click:()=>this.del(e,t)}})},sortUpIcon(e){const t=this.$createElement;return t("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-up",on:{click:()=>this.changeSort(e,-1)}})},sortDownIcon(e){const t=this.$createElement;return t("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-down",on:{click:()=>this.changeSort(e,1)}})},changeSort(e,t){const r=this.sort[e];this.$set(this.sort,e,this.sort[e+t]),this.sort[e+t]=r,this.formData(0)},makeIcon(e,t,r){if(this.$scopedSlots.button)return this.$scopedSlots.button({total:e,index:t,vm:this,key:r,del:()=>this.del(t,r),add:this.add});const s=[];return(!this.max||e<this.max)&&e===t+1&&s.push(this.addIcon(r)),e>this.min&&s.push(this.delIcon(t,r)),this.sortBtn&&t&&s.push(this.sortUpIcon(t)),this.sortBtn&&t!==e-1&&s.push(this.sortDownIcon(t)),s},emitEvent(e,t,r,s){this.$emit(e,...t,this.cacheRule[s].$f,r)},expandRule(e){for(let t=0;t<e;t++)this.value.push(this.field?null:{})}},created(){this.type=this.formCreateInject.form.$form();const e=(this.expand||0)-this.value.length;e>0&&this.expandRule(e);for(let t=0;t<this.value.length;t++)this.addRule(t)},render(){const e=arguments[0],t=this.sort,r=this.button,s=this.type,i=this.disabled,n=t.length===0?this.$scopedSlots.default?this.$scopedSlots.default({vm:this,add:this.add}):e("div",{key:"a_def",class:"_fc-group-plus-minus _fc-group-add fc-clock",on:{click:this.add}}):t.map((o,a)=>{const{rule:y,options:f}=this.cacheRule[o],_=r&&!i?this.makeIcon(t.length,a,o):[];return e("div",{class:"_fc-group-container",key:o},[e(s,E([{key:o},{on:{"update:value":p=>this.formData(o,p),"emit-event":(p,...b)=>this.emitEvent(p,b,a,o),input:p=>this.add$f(a,o,p)}},{},{props:{disabled:i,inFor:!0,value:this.field?{[this.field]:this._value(this.value[a])}:this.value[a],rule:y,option:f,extendOption:!0}}])),e("div",{class:"_fc-group-idx"},[a+1]),_.length?e("div",{class:"_fc-group-handle fc-clock"},[_]):null])});return e("div",{key:"con",class:"_fc-group "+(i?"_fc-group-disabled":"")},[n])}}});
10
+ (function(l,u){typeof exports=="object"&&typeof module!="undefined"?module.exports=u(require("vue")):typeof define=="function"&&define.amd?define(["vue"],u):(l=typeof globalThis!="undefined"?globalThis:l||self,l.FcGroup=u(l.Vue))})(this,function(l){"use strict";var w=Object.defineProperty;var $=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable;var O=(l,u,c)=>u in l?w(l,u,{enumerable:!0,configurable:!0,writable:!0,value:c}):l[u]=c,v=(l,u)=>{for(var c in u||(u={}))x.call(u,c)&&O(l,c,u[c]);if($)for(var c of $(u))F.call(u,c)&&O(l,c,u[c]);return l};function u(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t,r=1;r<arguments.length;r++)for(var s in t=arguments[r],t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},c.apply(this,arguments)}var j=["attrs","props","domProps"],R=["class","style","directives"],A=["on","nativeOn"],V=function(e){return e.reduce(function(t,r){for(var s in r)if(!t[s])t[s]=r[s];else if(j.indexOf(s)!==-1)t[s]=c({},t[s],r[s]);else if(R.indexOf(s)!==-1){var i=t[s]instanceof Array?t[s]:[t[s]],n=r[s]instanceof Array?r[s]:[r[s]];t[s]=[].concat(i,n)}else if(A.indexOf(s)!==-1)for(var o in r[s])if(t[s][o]){var a=t[s][o]instanceof Array?t[s][o]:[t[s][o]],g=r[s][o]instanceof Array?r[s][o]:[r[s][o]];t[s][o]=[].concat(a,g)}else t[s][o]=r[s][o];else if(s==="hook")for(var f in r[s])t[s][f]=t[s][f]?S(t[s][f],r[s][f]):r[s][f];else t[s]=r[s];return t},{})},S=function(e,t){return function(){e&&e.apply(this,arguments),t&&t.apply(this,arguments)}},B=V;const E=u(B),h={type(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"},Undef(e){return e==null},Element(e){return typeof e=="object"&&e!==null&&e.nodeType===1&&!h.Object(e)},trueArray(e){return Array.isArray(e)&&e.length>0},Function(e){const t=this.getType(e);return t==="Function"||t==="AsyncFunction"},getType(e){const t=Object.prototype.toString.call(e);return/^\[object (.*)\]$/.exec(t)[1]},empty(e){return e==null||Array.isArray(e)&&Array.isArray(e)&&!e.length?!0:typeof e=="string"&&!e}};["Date","Object","String","Boolean","Array","Number"].forEach(e=>{h[e]=function(t){return h.type(t,e)}});function k(e,t){return{}.hasOwnProperty.call(e,t)}function d(e,t,r){l.set(e,t,r)}function m(e,t={},r){let s=!1;for(let i in t)if(Object.prototype.hasOwnProperty.call(t,i)){let n=t[i];if((s=Array.isArray(n))||h.Object(n)){let o=e[i]===void 0;if(s)s=!1,o&&d(e,i,[]);else if(n._clone&&r!==void 0){d(e,i,n._clone());continue}else o&&d(e,i,{});e[i]=m(e[i],n,r)}else d(e,i,n),h.Undef(n)||(h.Undef(n.__json)||(e[i].__json=n.__json),h.Undef(n.__origin)||(e[i].__origin=n.__origin))}return e}function y(e){return m({},{value:e}).value}const D=Object.assign||function(e){for(let t,r=1;r<arguments.length;r++)for(let s in t=arguments[r],t)Object.prototype.hasOwnProperty.call(t,s)&&d(e,s,t[s]);return e};function I(){return D.apply(this,arguments)}return{name:"fcGroup",props:{field:String,rule:[Array,Object],rules:Array,expand:Number,options:Object,formCreateInject:{type:Object,required:!0},button:{type:Boolean,default:!0},max:{type:Number,default:0},min:{type:Number,default:0},value:{type:Array,default:()=>[]},sortBtn:{type:Boolean,default:!0},defaultValue:Object,disabled:{type:Boolean,default:!1},syncDisabled:{type:Boolean,default:!0},onBeforeRemove:{type:Function,default:()=>{}},onBeforeAdd:{type:Function,default:()=>{}},parse:Function},data(){return{len:0,cacheRule:{},cacheValue:{},sort:[],type:void 0}},computed:{formRule(){return this.rules?this.rules:this.rule?Array.isArray(this.rule)?this.rule:[this.rule]:[]}},watch:{cacheRule:{handler(e){this.sort=Object.keys(e)},immediate:!0},formRule:{handler(e,t){Object.keys(this.cacheRule).forEach(r=>{const s=this.cacheRule[r];if(s.$f){const i=s.$f.formData();if(e===t)s.$f.deferSyncValue(()=>{m(s.rule,e),s.$f.setValue(i)},!0);else{const n=s.$f.formData();s.$f.once("reloading",()=>{s.$f.setValue(n)}),s.rule=y(e)}}})},deep:!0},expand(e){let t=e-this.value.length;t>0&&this.expandRule(t)},value(e,t){e=e||[];let r=this.sort,s=r.length,i=s-e.length;if(i<0){for(let n=i;n<0;n++)this.addRule(e.length+n);this.sort=Object.keys(this.cacheRule);for(let n=0;n<s;n++)this.setValue(r[n],e[n])}else{if(i>0){for(let n=0;n<i;n++)this.removeRule(r[s-n-1]);this.sort=Object.keys(this.cacheRule)}e.forEach((n,o)=>{this.setValue(r[o],e[o])})}}},methods:{_value(e){return e&&k(e,this.field)?e[this.field]:e},cache(e,t){this.cacheValue[e]=JSON.stringify(t)},input(e){this.$emit("input",e),this.$emit("change",e)},formData(e,t){const r=this.cacheRule,s=this.sort;if(s.filter(n=>r[n].$f).length!==s.length)return;const i=s.map(n=>{const o=e===n?t:v({},this.cacheRule[n].$f.form),a=this.field?o[this.field]||null:o;return this.cache(n,a),a});this.input(i)},setValue(e,t){const r=this.field,s=this.cacheRule[e].$f;r&&(t={[r]:this._value(t)}),this.cacheValue[e]!==JSON.stringify(r?t[r]:t)&&(this.cache(e,t),s&&s.coverValue(t||{}))},addRule(e,t){const r=this.formCreateInject.form.copyRules(this.formRule),s=this.options?v({},this.options):{submitBtn:!1,resetBtn:!1};if(this.defaultValue){s.formData||(s.formData={});const i=y(this.defaultValue);I(s.formData,this.field?{[this.field]:i}:i)}this.parse&&this.parse({rule:r,options:s,index:this.sort.length}),this.$set(this.cacheRule,++this.len,{rule:r,options:s}),t&&this.$nextTick(()=>this.$emit("add",r,Object.keys(this.cacheRule).length-1))},add$f(e,t,r){this.cacheRule[t].$f=r,this.$nextTick(()=>{this.$emit("itemMounted",r,Object.keys(this.cacheRule).indexOf(t))})},removeRule(e,t){const r=Object.keys(this.cacheRule).indexOf(e);this.$delete(this.cacheRule,e),this.$delete(this.cacheValue,e),t&&this.$nextTick(()=>this.$emit("remove",r))},add(e){if(this.disabled||this.onBeforeAdd(this.value)===!1)return;const t=[...this.value];t.push(this.defaultValue?y(this.defaultValue):this.field?null:{}),this.input(t)},del(e,t){if(this.disabled||this.onBeforeRemove(this.value,e)===!1)return;this.removeRule(t,!0);const r=[...this.value];r.splice(e,1),this.input(r)},addIcon(e){const t=this.$createElement;return t("div",{class:"_fc-group-btn _fc-group-plus-minus",on:{click:this.add}})},delIcon(e,t){const r=this.$createElement;return r("div",{class:"_fc-group-btn _fc-group-plus-minus _fc-group-minus",on:{click:()=>this.del(e,t)}})},sortUpIcon(e){const t=this.$createElement;return t("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-up",on:{click:()=>this.changeSort(e,-1)}})},sortDownIcon(e){const t=this.$createElement;return t("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-down",on:{click:()=>this.changeSort(e,1)}})},changeSort(e,t){const r=this.sort[e];this.$set(this.sort,e,this.sort[e+t]),this.sort[e+t]=r,this.formData(0)},makeIcon(e,t,r){if(this.$scopedSlots.button)return this.$scopedSlots.button({total:e,index:t,vm:this,key:r,del:()=>this.del(t,r),add:this.add});const s=[];return(!this.max||e<this.max)&&e===t+1&&s.push(this.addIcon(r)),e>this.min&&s.push(this.delIcon(t,r)),this.sortBtn&&t&&s.push(this.sortUpIcon(t)),this.sortBtn&&t!==e-1&&s.push(this.sortDownIcon(t)),s},emitEvent(e,t,r,s){this.$emit(e,...t,this.cacheRule[s].$f,r)},expandRule(e){for(let t=0;t<e;t++)this.value.push(this.field?null:{})}},created(){this.type=this.formCreateInject.form.$form();const e=(this.expand||0)-this.value.length;e>0&&this.expandRule(e);for(let t=0;t<this.value.length;t++)this.addRule(t)},render(){const e=arguments[0],t=this.sort,r=this.button,s=this.type,i=this.disabled,n=t.length===0?this.$scopedSlots.default?this.$scopedSlots.default({vm:this,add:this.add}):e("div",{key:"a_def",class:"_fc-group-plus-minus _fc-group-add fc-clock",on:{click:this.add}}):t.map((o,a)=>{const{rule:g,options:f}=this.cacheRule[o],_=r&&!i?this.makeIcon(t.length,a,o):[];return e("div",{class:"_fc-group-container",key:o},[e(s,E([{key:o},{on:{"update:value":p=>this.formData(o,p),"emit-event":(p,...b)=>this.emitEvent(p,b,a,o),input:p=>this.add$f(a,o,p)}},{},{props:{disabled:i,inFor:!0,value:this.field?{[this.field]:this._value(this.value[a])}:this.value[a],rule:g,option:f,extendOption:!0}}])),e("div",{class:"_fc-group-idx"},[a+1]),_.length?e("div",{class:"_fc-group-handle fc-clock"},[_]):null])});return e("div",{key:"con",class:"_fc-group "+(i?"_fc-group-disabled":"")},[n])}}});
package/package.json CHANGED
@@ -1,14 +1,11 @@
1
1
  {
2
2
  "name": "@form-create/component-elm-group",
3
- "version": "2.7.0",
3
+ "version": "2.7.5",
4
4
  "description": "@form-create/element-ui 内置组件",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.es.js",
7
7
  "unpkg": "./dist/index.js",
8
8
  "jsdelivr": "./dist/index.js",
9
- "exports": {
10
- "./*": "./*"
11
- },
12
9
  "scripts": {
13
10
  "clean": "rimraf dist/",
14
11
  "vite:build": "vite build",
@@ -42,5 +39,5 @@
42
39
  "publishConfig": {
43
40
  "access": "public"
44
41
  },
45
- "gitHead": "8f8c60295578719d0a903e6ac00f4f3641f0424e"
42
+ "gitHead": "63b1bb5c4d88b65bdd48517d6b3b3090792d6c1a"
46
43
  }
package/src/component.jsx CHANGED
@@ -209,7 +209,9 @@ export default {
209
209
  if (this.disabled || false === this.onBeforeAdd(this.value)) {
210
210
  return;
211
211
  }
212
- this.addRule(i, true);
212
+ const value = [...this.value];
213
+ value.push(this.defaultValue ? deepCopy(this.defaultValue) : (this.field ? null : {}));
214
+ this.input(value);
213
215
  },
214
216
  del(index, key) {
215
217
  if (this.disabled || false === this.onBeforeRemove(this.value, index)) {