@form-create/component-elm-group 3.1.19 → 3.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +156 -159
- package/dist/index.esm.min.js +2 -2
- package/dist/index.js +155 -158
- package/dist/index.min.js +2 -2
- package/package.json +3 -3
- package/src/component.jsx +75 -49
- package/src/style.css +125 -0
- package/src/IconCirclePlus.vue +0 -14
- package/src/IconRemove.vue +0 -13
package/dist/index.esm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/component-elm-group v3.1.
|
|
2
|
+
* @form-create/component-elm-group v3.1.24
|
|
3
3
|
* (c) 2018-2023 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create with group
|
|
5
5
|
* Released under the MIT License.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
7
|
+
import { defineComponent, markRaw, nextTick, createVNode, watch, mergeProps } from 'vue';
|
|
8
8
|
|
|
9
9
|
function ownKeys(object, enumerableOnly) {
|
|
10
10
|
var keys = Object.keys(object);
|
|
@@ -150,65 +150,6 @@ function hasProperty(rule, k) {
|
|
|
150
150
|
return {}.hasOwnProperty.call(rule, k);
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
var script$1 = {
|
|
154
|
-
name: 'IconCirclePlus'
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
var _hoisted_1$1 = {
|
|
158
|
-
"class": "icon",
|
|
159
|
-
viewBox: "0 0 1024 1024",
|
|
160
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
var _hoisted_2$1 = /*#__PURE__*/createElementVNode("path", {
|
|
164
|
-
fill: "currentColor",
|
|
165
|
-
d: "M352 480h320a32 32 0 110 64H352a32 32 0 010-64z"
|
|
166
|
-
}, null, -1);
|
|
167
|
-
|
|
168
|
-
var _hoisted_3$1 = /*#__PURE__*/createElementVNode("path", {
|
|
169
|
-
fill: "currentColor",
|
|
170
|
-
d: "M480 672V352a32 32 0 1164 0v320a32 32 0 01-64 0z"
|
|
171
|
-
}, null, -1);
|
|
172
|
-
|
|
173
|
-
var _hoisted_4$1 = /*#__PURE__*/createElementVNode("path", {
|
|
174
|
-
fill: "currentColor",
|
|
175
|
-
d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"
|
|
176
|
-
}, null, -1);
|
|
177
|
-
|
|
178
|
-
var _hoisted_5 = [_hoisted_2$1, _hoisted_3$1, _hoisted_4$1];
|
|
179
|
-
function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
180
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$1, _hoisted_5);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
script$1.render = render$1;
|
|
184
|
-
|
|
185
|
-
var script = {
|
|
186
|
-
name: 'IconRemove'
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
var _hoisted_1 = {
|
|
190
|
-
"class": "icon",
|
|
191
|
-
viewBox: "0 0 1024 1024",
|
|
192
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
var _hoisted_2 = /*#__PURE__*/createElementVNode("path", {
|
|
196
|
-
fill: "currentColor",
|
|
197
|
-
d: "M352 480h320a32 32 0 110 64H352a32 32 0 010-64z"
|
|
198
|
-
}, null, -1);
|
|
199
|
-
|
|
200
|
-
var _hoisted_3 = /*#__PURE__*/createElementVNode("path", {
|
|
201
|
-
fill: "currentColor",
|
|
202
|
-
d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"
|
|
203
|
-
}, null, -1);
|
|
204
|
-
|
|
205
|
-
var _hoisted_4 = [_hoisted_2, _hoisted_3];
|
|
206
|
-
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
207
|
-
return openBlock(), createElementBlock("svg", _hoisted_1, _hoisted_4);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
script.render = render;
|
|
211
|
-
|
|
212
153
|
function $set(target, field, value) {
|
|
213
154
|
target[field] = value;
|
|
214
155
|
}
|
|
@@ -281,10 +222,36 @@ function extend() {
|
|
|
281
222
|
return _extends.apply(this, arguments);
|
|
282
223
|
}
|
|
283
224
|
|
|
284
|
-
function
|
|
285
|
-
|
|
225
|
+
function styleInject(css, ref) {
|
|
226
|
+
if ( ref === void 0 ) ref = {};
|
|
227
|
+
var insertAt = ref.insertAt;
|
|
228
|
+
|
|
229
|
+
if (!css || typeof document === 'undefined') { return; }
|
|
230
|
+
|
|
231
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
232
|
+
var style = document.createElement('style');
|
|
233
|
+
style.type = 'text/css';
|
|
234
|
+
|
|
235
|
+
if (insertAt === 'top') {
|
|
236
|
+
if (head.firstChild) {
|
|
237
|
+
head.insertBefore(style, head.firstChild);
|
|
238
|
+
} else {
|
|
239
|
+
head.appendChild(style);
|
|
240
|
+
}
|
|
241
|
+
} else {
|
|
242
|
+
head.appendChild(style);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (style.styleSheet) {
|
|
246
|
+
style.styleSheet.cssText = css;
|
|
247
|
+
} else {
|
|
248
|
+
style.appendChild(document.createTextNode(css));
|
|
249
|
+
}
|
|
286
250
|
}
|
|
287
251
|
|
|
252
|
+
var css_248z = "._fc-group{display:flex;flex-direction:column;justify-content:center;min-height:38px;width:100%}._fc-group-disabled ._fc-group-add,._fc-group-disabled ._fc-group-btn{cursor:not-allowed}._fc-group-handle{background-color:#fff;border:1px dashed #d9d9d9;border-radius:15px;bottom:-15px;display:flex;flex-direction:row;padding:3px 8px;position:absolute;right:30px}._fc-group-btn{cursor:pointer}._fc-group-idx{align-items:center;background:#eee;border-radius:15px;bottom:-15px;display:flex;font-weight:700;height:30px;justify-content:center;left:10px;position:absolute;width:30px}._fc-group-handle ._fc-group-btn+._fc-group-btn{margin-left:7px}._fc-group-container{border:1px dashed #d9d9d9;border-radius:5px;display:flex;flex-direction:column;margin:5px 5px 25px;padding:20px 20px 25px;position:relative}._fc-group-arrow{height:20px;position:relative;width:20px}._fc-group-arrow:before{border-left:2px solid #999;border-top:2px solid #999;content:\"\";height:9px;left:5px;position:absolute;top:8px;transform:rotate(45deg);width:9px}._fc-group-arrow._fc-group-down{transform:rotate(180deg)}._fc-group-plus-minus{cursor:pointer;height:20px;position:relative;width:20px}._fc-group-plus-minus:after,._fc-group-plus-minus:before{background-color:#409eff;content:\"\";height:2px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:60%}._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{border:1px solid rgba(64,158,255,.5);border-radius:15px;cursor:pointer;height:25px;width:25px}._fc-group-add._fc-group-plus-minus:after,._fc-group-add._fc-group-plus-minus:before{width:50%}";
|
|
253
|
+
styleInject(css_248z);
|
|
254
|
+
|
|
288
255
|
var NAME = 'fcGroup';
|
|
289
256
|
var Group = defineComponent({
|
|
290
257
|
name: NAME,
|
|
@@ -312,6 +279,10 @@ var Group = defineComponent({
|
|
|
312
279
|
}
|
|
313
280
|
},
|
|
314
281
|
defaultValue: Object,
|
|
282
|
+
sortBtn: {
|
|
283
|
+
type: Boolean,
|
|
284
|
+
"default": true
|
|
285
|
+
},
|
|
315
286
|
disabled: {
|
|
316
287
|
type: Boolean,
|
|
317
288
|
"default": false
|
|
@@ -320,10 +291,6 @@ var Group = defineComponent({
|
|
|
320
291
|
type: Boolean,
|
|
321
292
|
"default": true
|
|
322
293
|
},
|
|
323
|
-
fontSize: {
|
|
324
|
-
type: Number,
|
|
325
|
-
"default": 28
|
|
326
|
-
},
|
|
327
294
|
onBeforeRemove: {
|
|
328
295
|
type: Function,
|
|
329
296
|
"default": function _default() {}
|
|
@@ -332,13 +299,15 @@ var Group = defineComponent({
|
|
|
332
299
|
type: Function,
|
|
333
300
|
"default": function _default() {}
|
|
334
301
|
},
|
|
335
|
-
formCreateInject: Object
|
|
302
|
+
formCreateInject: Object,
|
|
303
|
+
parse: Function
|
|
336
304
|
},
|
|
337
305
|
data: function data() {
|
|
338
306
|
return {
|
|
339
307
|
len: 0,
|
|
340
308
|
cacheRule: {},
|
|
341
309
|
cacheValue: {},
|
|
310
|
+
sort: [],
|
|
342
311
|
form: markRaw(this.formCreateInject.form.$form())
|
|
343
312
|
};
|
|
344
313
|
},
|
|
@@ -392,7 +361,7 @@ var Group = defineComponent({
|
|
|
392
361
|
var _this2 = this;
|
|
393
362
|
|
|
394
363
|
n = n || [];
|
|
395
|
-
var keys = Object.keys(this.
|
|
364
|
+
var keys = Object.keys(this.sort),
|
|
396
365
|
total = keys.length,
|
|
397
366
|
len = total - n.length;
|
|
398
367
|
|
|
@@ -434,7 +403,7 @@ var Group = defineComponent({
|
|
|
434
403
|
var _this3 = this;
|
|
435
404
|
|
|
436
405
|
var cacheRule = this.cacheRule;
|
|
437
|
-
var keys =
|
|
406
|
+
var keys = this.sort;
|
|
438
407
|
|
|
439
408
|
if (keys.filter(function (k) {
|
|
440
409
|
return cacheRule[k].$f;
|
|
@@ -480,6 +449,11 @@ var Group = defineComponent({
|
|
|
480
449
|
extend(options.formData, this.field ? _defineProperty({}, this.field, defVal) : defVal);
|
|
481
450
|
}
|
|
482
451
|
|
|
452
|
+
this.parse && this.parse({
|
|
453
|
+
rule: rule,
|
|
454
|
+
options: options,
|
|
455
|
+
index: this.sort.length
|
|
456
|
+
});
|
|
483
457
|
this.cacheRule[++this.len] = {
|
|
484
458
|
rule: rule,
|
|
485
459
|
options: options
|
|
@@ -495,7 +469,6 @@ var Group = defineComponent({
|
|
|
495
469
|
var _this5 = this;
|
|
496
470
|
|
|
497
471
|
this.cacheRule[key].$f = $f;
|
|
498
|
-
this.formData(key, $f.formData());
|
|
499
472
|
nextTick(function () {
|
|
500
473
|
if (_this5.syncDisabled) {
|
|
501
474
|
$f.disabled(_this5.disabled);
|
|
@@ -517,13 +490,15 @@ var Group = defineComponent({
|
|
|
517
490
|
});
|
|
518
491
|
}
|
|
519
492
|
},
|
|
520
|
-
add: function add() {
|
|
493
|
+
add: function add(i) {
|
|
521
494
|
if (this.disabled || false === this.onBeforeAdd(this.modelValue)) {
|
|
522
495
|
return;
|
|
523
496
|
}
|
|
524
497
|
|
|
525
|
-
this.modelValue
|
|
526
|
-
|
|
498
|
+
var value = _toConsumableArray(this.modelValue);
|
|
499
|
+
|
|
500
|
+
value.push(this.defaultValue ? deepCopy(this.defaultValue) : this.field ? null : {});
|
|
501
|
+
this.input(value);
|
|
527
502
|
},
|
|
528
503
|
del: function del(index, key) {
|
|
529
504
|
if (this.disabled || false === this.onBeforeRemove(this.modelValue, index)) {
|
|
@@ -531,38 +506,56 @@ var Group = defineComponent({
|
|
|
531
506
|
}
|
|
532
507
|
|
|
533
508
|
this.removeRule(key, true);
|
|
534
|
-
|
|
535
|
-
|
|
509
|
+
|
|
510
|
+
var value = _toConsumableArray(this.modelValue);
|
|
511
|
+
|
|
512
|
+
value.splice(index, 1);
|
|
513
|
+
this.input(value);
|
|
536
514
|
},
|
|
537
515
|
addIcon: function addIcon(key) {
|
|
538
|
-
return createVNode(
|
|
539
|
-
"
|
|
540
|
-
"style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer', ";"),
|
|
516
|
+
return createVNode("div", {
|
|
517
|
+
"class": "_fc-group-btn _fc-group-plus-minus",
|
|
541
518
|
"onClick": this.add
|
|
542
|
-
},
|
|
543
|
-
"default": function _default() {
|
|
544
|
-
return [createVNode(script$1, null, null)];
|
|
545
|
-
}
|
|
546
|
-
});
|
|
519
|
+
}, null);
|
|
547
520
|
},
|
|
548
521
|
delIcon: function delIcon(index, key) {
|
|
549
522
|
var _this7 = this;
|
|
550
523
|
|
|
551
|
-
return createVNode(
|
|
552
|
-
"
|
|
553
|
-
"class": "el-icon-remove-outline",
|
|
554
|
-
"style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer;color:#606266', ";"),
|
|
524
|
+
return createVNode("div", {
|
|
525
|
+
"class": "_fc-group-btn _fc-group-plus-minus _fc-group-minus",
|
|
555
526
|
"onClick": function onClick() {
|
|
556
527
|
return _this7.del(index, key);
|
|
557
528
|
}
|
|
558
|
-
},
|
|
559
|
-
|
|
560
|
-
|
|
529
|
+
}, null);
|
|
530
|
+
},
|
|
531
|
+
sortUpIcon: function sortUpIcon(index) {
|
|
532
|
+
var _this8 = this;
|
|
533
|
+
|
|
534
|
+
return createVNode("div", {
|
|
535
|
+
"class": "_fc-group-btn _fc-group-arrow _fc-group-up",
|
|
536
|
+
"onClick": function onClick() {
|
|
537
|
+
return _this8.changeSort(index, -1);
|
|
561
538
|
}
|
|
562
|
-
});
|
|
539
|
+
}, null);
|
|
540
|
+
},
|
|
541
|
+
sortDownIcon: function sortDownIcon(index) {
|
|
542
|
+
var _this9 = this;
|
|
543
|
+
|
|
544
|
+
return createVNode("div", {
|
|
545
|
+
"class": "_fc-group-btn _fc-group-arrow _fc-group-down",
|
|
546
|
+
"onClick": function onClick() {
|
|
547
|
+
return _this9.changeSort(index, 1);
|
|
548
|
+
}
|
|
549
|
+
}, null);
|
|
550
|
+
},
|
|
551
|
+
changeSort: function changeSort(index, sort) {
|
|
552
|
+
var a = this.sort[index];
|
|
553
|
+
this.sort[index] = this.sort[index + sort];
|
|
554
|
+
this.sort[index + sort] = a;
|
|
555
|
+
this.formData(0);
|
|
563
556
|
},
|
|
564
557
|
makeIcon: function makeIcon(total, index, key) {
|
|
565
|
-
var
|
|
558
|
+
var _this10 = this;
|
|
566
559
|
|
|
567
560
|
if (this.$slots.button) {
|
|
568
561
|
return this.$slots.button({
|
|
@@ -571,19 +564,31 @@ var Group = defineComponent({
|
|
|
571
564
|
vm: this,
|
|
572
565
|
key: key,
|
|
573
566
|
del: function del() {
|
|
574
|
-
return
|
|
567
|
+
return _this10.del(index, key);
|
|
575
568
|
},
|
|
576
569
|
add: this.add
|
|
577
570
|
});
|
|
578
571
|
}
|
|
579
572
|
|
|
580
|
-
|
|
581
|
-
|
|
573
|
+
var btn = [];
|
|
574
|
+
|
|
575
|
+
if ((!this.max || total < this.max) && total === index + 1) {
|
|
576
|
+
btn.push(this.addIcon(key));
|
|
582
577
|
}
|
|
583
578
|
|
|
584
579
|
if (total > this.min) {
|
|
585
|
-
|
|
580
|
+
btn.push(this.delIcon(index, key));
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
if (this.sortBtn && index) {
|
|
584
|
+
btn.push(this.sortUpIcon(index));
|
|
586
585
|
}
|
|
586
|
+
|
|
587
|
+
if (this.sortBtn && index !== total - 1) {
|
|
588
|
+
btn.push(this.sortDownIcon(index));
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
return btn;
|
|
587
592
|
},
|
|
588
593
|
emitEvent: function emitEvent(name, args, index, key) {
|
|
589
594
|
this.$emit.apply(this, [name].concat(_toConsumableArray(args), [this.cacheRule[key].$f, index]));
|
|
@@ -595,6 +600,15 @@ var Group = defineComponent({
|
|
|
595
600
|
}
|
|
596
601
|
},
|
|
597
602
|
created: function created() {
|
|
603
|
+
var _this11 = this;
|
|
604
|
+
|
|
605
|
+
watch(function () {
|
|
606
|
+
return _objectSpread2({}, _this11.cacheRule);
|
|
607
|
+
}, function (n) {
|
|
608
|
+
_this11.sort = Object.keys(n);
|
|
609
|
+
}, {
|
|
610
|
+
immediate: true
|
|
611
|
+
});
|
|
598
612
|
var d = (this.expand || 0) - this.modelValue.length;
|
|
599
613
|
|
|
600
614
|
for (var i = 0; i < this.modelValue.length; i++) {
|
|
@@ -606,75 +620,58 @@ var Group = defineComponent({
|
|
|
606
620
|
}
|
|
607
621
|
},
|
|
608
622
|
render: function render() {
|
|
609
|
-
var
|
|
623
|
+
var _this12 = this;
|
|
610
624
|
|
|
611
|
-
var keys =
|
|
625
|
+
var keys = this.sort;
|
|
612
626
|
var button = this.button;
|
|
613
627
|
var Type = this.form;
|
|
614
|
-
|
|
628
|
+
var disabled = this.disabled;
|
|
629
|
+
var children = keys.length === 0 ? this.$slots["default"] ? this.$slots["default"]({
|
|
615
630
|
vm: this,
|
|
616
631
|
add: this.add
|
|
617
|
-
}) : createVNode(resolveComponent("ElIcon"), {
|
|
618
|
-
"key": 1,
|
|
619
|
-
"style": "font-size:".concat(this.fontSize, "px;vertical-align:middle;color:").concat(this.disabled ? '#c9cdd4;cursor: not-allowed' : '#606266;cursor:pointer', ";"),
|
|
620
|
-
"onClick": this.add
|
|
621
|
-
}, {
|
|
622
|
-
"default": function _default() {
|
|
623
|
-
return [createVNode(script$1, null, null)];
|
|
624
|
-
}
|
|
625
632
|
}) : createVNode("div", {
|
|
626
|
-
"
|
|
627
|
-
"
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
return createVNode(
|
|
635
|
-
"
|
|
636
|
-
"key": key
|
|
637
|
-
|
|
633
|
+
"key": 'a_def',
|
|
634
|
+
"class": "_fc-group-plus-minus _fc-group-add",
|
|
635
|
+
"onClick": this.add
|
|
636
|
+
}, null) : keys.map(function (key, index) {
|
|
637
|
+
var _this12$cacheRule$key = _this12.cacheRule[key],
|
|
638
|
+
rule = _this12$cacheRule$key.rule,
|
|
639
|
+
options = _this12$cacheRule$key.options;
|
|
640
|
+
var btn = button && !disabled ? _this12.makeIcon(keys.length, index, key) : [];
|
|
641
|
+
return createVNode("div", {
|
|
642
|
+
"class": "_fc-group-container",
|
|
643
|
+
"key": key
|
|
644
|
+
}, [createVNode(Type, mergeProps({
|
|
645
|
+
"key": key
|
|
638
646
|
}, {
|
|
639
|
-
|
|
640
|
-
return
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
"span": 2,
|
|
668
|
-
"pull": 1,
|
|
669
|
-
"push": 1
|
|
670
|
-
}, _isSlot(_slot = _this9.makeIcon(keys.length, index, key)) ? _slot : {
|
|
671
|
-
"default": function _default() {
|
|
672
|
-
return [_slot];
|
|
673
|
-
}
|
|
674
|
-
}) : null];
|
|
675
|
-
}
|
|
676
|
-
});
|
|
677
|
-
})]);
|
|
647
|
+
'onUpdate:modelValue': function onUpdateModelValue(formData) {
|
|
648
|
+
return _this12.formData(key, formData);
|
|
649
|
+
},
|
|
650
|
+
'onEmit-event': function onEmitEvent(name) {
|
|
651
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
652
|
+
args[_key - 1] = arguments[_key];
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
return _this12.emitEvent(name, args, index, key);
|
|
656
|
+
},
|
|
657
|
+
'onUpdate:api': function onUpdateApi($f) {
|
|
658
|
+
return _this12.add$f(index, key, $f);
|
|
659
|
+
},
|
|
660
|
+
inFor: true,
|
|
661
|
+
modelValue: _this12.field ? _defineProperty({}, _this12.field, _this12._value(_this12.modelValue[index])) : _this12.modelValue[index],
|
|
662
|
+
rule: rule,
|
|
663
|
+
option: options,
|
|
664
|
+
extendOption: true
|
|
665
|
+
}), null), createVNode("div", {
|
|
666
|
+
"class": "_fc-group-idx"
|
|
667
|
+
}, [index + 1]), btn.length ? createVNode("div", {
|
|
668
|
+
"class": "_fc-group-handle"
|
|
669
|
+
}, [btn]) : null]);
|
|
670
|
+
});
|
|
671
|
+
return createVNode("div", {
|
|
672
|
+
"key": 'con',
|
|
673
|
+
"class": '_fc-group ' + (disabled ? '_fc-group-disabled' : '')
|
|
674
|
+
}, [children]);
|
|
678
675
|
}
|
|
679
676
|
});
|
|
680
677
|
|
package/dist/index.esm.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/component-elm-group v3.1.
|
|
2
|
+
* @form-create/component-elm-group v3.1.24
|
|
3
3
|
* (c) 2018-2023 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create with group
|
|
5
5
|
* Released under the MIT License.
|
|
6
6
|
*/
|
|
7
|
-
import{openBlock as e,createElementBlock as t,createElementVNode as n,defineComponent as r,markRaw as o,nextTick as i,createVNode as l,resolveComponent as a,isVNode as u}from"vue";function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){d(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var m={type:function(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"},Undef:function(e){return null==e},Element:function(e){return"object"===s(e)&&null!==e&&1===e.nodeType&&!m.Object(e)},trueArray:function(e){return Array.isArray(e)&&e.length>0},Function:function(e){var t=this.getType(e);return"Function"===t||"AsyncFunction"===t},getType:function(e){var t=Object.prototype.toString.call(e);return/^\[object (.*)\]$/.exec(t)[1]},empty:function(e){return null==e||(!(!Array.isArray(e)||!Array.isArray(e)||e.length)||"string"==typeof e&&!e)}};["Date","Object","String","Boolean","Array","Number"].forEach((function(e){m[e]=function(t){return m.type(t,e)}}));var y={name:"IconCirclePlus"},b={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},v=[n("path",{fill:"currentColor",d:"M352 480h320a32 32 0 110 64H352a32 32 0 010-64z"},null,-1),n("path",{fill:"currentColor",d:"M480 672V352a32 32 0 1164 0v320a32 32 0 01-64 0z"},null,-1),n("path",{fill:"currentColor",d:"M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"},null,-1)];y.render=function(n,r,o,i,l,a){return e(),t("svg",b,v)};var g={name:"IconRemove"},O={class:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},j=[n("path",{fill:"currentColor",d:"M352 480h320a32 32 0 110 64H352a32 32 0 010-64z"},null,-1),n("path",{fill:"currentColor",d:"M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"},null,-1)];function V(e,t,n){e[t]=n}function R(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=!1;for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){var i=t[o];if((r=Array.isArray(i))||m.Object(i)){var l=void 0===e[o];if(r)r=!1,l&&V(e,o,[]);else if(i._clone&&void 0!==n){if(!n){V(e,o,i._clone());continue}i=i.getRule(),l&&V(e,o,{})}else l&&V(e,o,{});e[o]=R(e[o],i,n)}else V(e,o,i),m.Undef(i)||(m.Undef(i.__json)||(e[o].__json=i.__json),m.Undef(i.__origin)||(e[o].__origin=i.__origin))}return void 0!==n&&Array.isArray(e)?e.filter((function(e){return!e||!e.__ctrl})):e}function w(e){return R({},{value:e}).value}g.render=function(n,r,o,i,l,a){return e(),t("svg",O,j)};var $=Object.assign||function(e){for(var t,n=1;n<arguments.length;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&V(e,r,t[r]);return e};var A=r({name:"fcGroup",props:{field:String,rule:Array,expand:Number,options:Object,button:{type:Boolean,default:!0},max:{type:Number,default:0},min:{type:Number,default:0},modelValue:{type:Array,default:function(){return[]}},defaultValue:Object,disabled:{type:Boolean,default:!1},syncDisabled:{type:Boolean,default:!0},fontSize:{type:Number,default:28},onBeforeRemove:{type:Function,default:function(){}},onBeforeAdd:{type:Function,default:function(){}},formCreateInject:Object},data:function(){return{len:0,cacheRule:{},cacheValue:{},form:o(this.formCreateInject.form.$form())}},emits:["update:modelValue","change","itemMounted","remove","add"],watch:{rule:{handler:function(e,t){var n=this;Object.keys(this.cacheRule).forEach((function(r){var o=n.cacheRule[r];if(o.$f){var i=o.$f.formData();if(e===t)o.$f.deferSyncValue((function(){R(o.rule,e),o.$f.setValue(i)}),!0);else{var l=o.$f.formData();o.$f.once("reloading",(function(){o.$f.setValue(l)})),o.rule=w(e)}}}))},deep:!0},disabled:function(e){if(this.syncDisabled){var t=this.cacheRule;Object.keys(t).forEach((function(n){t[n].$f.disabled(e)}))}},expand:function(e){var t=e-this.modelValue.length;t>0&&this.expandRule(t)},modelValue:{handler:function(e){var t=this;e=e||[];var n=Object.keys(this.cacheRule),r=n.length,o=r-e.length;if(o<0){for(var i=o;i<0;i++)this.addRule(e.length+i,!0);for(var l=0;l<r;l++)this.setValue(n[l],e[l])}else{if(o>0)for(var a=0;a<o;a++)this.removeRule(n[r-a-1]);e.forEach((function(r,o){t.setValue(n[o],e[o])}))}},deep:!0}},methods:{_value:function(e){return e&&(t=e,n=this.field,{}.hasOwnProperty.call(t,n))?e[this.field]:e;var t,n},cache:function(e,t){this.cacheValue[e]=JSON.stringify(t)},input:function(e){this.$emit("update:modelValue",e),this.$emit("change",e)},formData:function(e,t){var n=this,r=this.cacheRule,o=Object.keys(r);if(o.filter((function(e){return r[e].$f})).length===o.length){var i=o.map((function(r){var o=e===r?t:f({},n.cacheRule[r].$f.form),i=n.field?o[n.field]||null:o;return n.cache(r,i),i}));this.input(i)}},setValue:function(e,t){var n=this.field;n&&(t=d({},n,this._value(t))),this.cacheValue[e]!==JSON.stringify(n?t[n]:t)&&this.cache(e,t)},addRule:function(e,t){var n=this,r=this.formCreateInject.form.copyRules(this.rule||[]),o=this.options?f({},this.options):{submitBtn:!1,resetBtn:!1};if(this.defaultValue){o.formData||(o.formData={});var l=w(this.defaultValue);!function(){$.apply(this,arguments)}(o.formData,this.field?d({},this.field,l):l)}this.cacheRule[++this.len]={rule:r,options:o},t&&i((function(){return n.$emit("add",r,Object.keys(n.cacheRule).length-1)}))},add$f:function(e,t,n){var r=this;this.cacheRule[t].$f=n,this.formData(t,n.formData()),i((function(){r.syncDisabled&&n.disabled(r.disabled),r.$emit("itemMounted",n,Object.keys(r.cacheRule).indexOf(t))}))},removeRule:function(e,t){var n=this,r=Object.keys(this.cacheRule).indexOf(e);delete this.cacheRule[e],delete this.cacheValue[e],t&&i((function(){return n.$emit("remove",r)}))},add:function(){this.disabled||!1===this.onBeforeAdd(this.modelValue)||(this.modelValue.push(this.field?null:{}),this.$emit("update:modelValue",this.modelValue))},del:function(e,t){this.disabled||!1===this.onBeforeRemove(this.modelValue,e)||(this.removeRule(t,!0),this.modelValue.splice(e,1),this.input(this.modelValue))},addIcon:function(e){return l(a("ElIcon"),{key:"a".concat(e),style:"font-size:".concat(this.fontSize,"px;cursor:").concat(this.disabled?"not-allowed;color:#c9cdd4":"pointer",";"),onClick:this.add},{default:function(){return[l(y,null,null)]}})},delIcon:function(e,t){var n=this;return l(a("ElIcon"),{key:"d".concat(t),class:"el-icon-remove-outline",style:"font-size:".concat(this.fontSize,"px;cursor:").concat(this.disabled?"not-allowed;color:#c9cdd4":"pointer;color:#606266",";"),onClick:function(){return n.del(e,t)}},{default:function(){return[l(g,null,null)]}})},makeIcon:function(e,t,n){var r=this;return this.$slots.button?this.$slots.button({total:e,index:t,vm:this,key:n,del:function(){return r.del(t,n)},add:this.add}):0===t?[0!==this.max&&e>=this.max?null:this.addIcon(n),0===this.min||e>this.min?this.delIcon(t,n):null]:e>this.min?this.delIcon(t,n):void 0},emitEvent:function(e,t,n,r){this.$emit.apply(this,[e].concat(h(t),[this.cacheRule[r].$f,n]))},expandRule:function(e){for(var t=0;t<e;t++)this.modelValue.push(this.field?null:{})}},created:function(){for(var e=(this.expand||0)-this.modelValue.length,t=0;t<this.modelValue.length;t++)this.addRule(t);e>0&&this.expandRule(e)},render:function(){var e=this,t=Object.keys(this.cacheRule),n=this.button,r=this.form;return 0===t.length?this.$slots.default?this.$slots.default({vm:this,add:this.add}):l(a("ElIcon"),{key:1,style:"font-size:".concat(this.fontSize,"px;vertical-align:middle;color:").concat(this.disabled?"#c9cdd4;cursor: not-allowed":"#606266;cursor:pointer",";"),onClick:this.add},{default:function(){return[l(y,null,null)]}}):l("div",{style:"width: 100%;",key:2},[t.map((function(o,i){var c,f=e.cacheRule[o],s=f.rule,h=f.options;return l(a("ElRow"),{align:"middle",key:o,style:"border-bottom:1px dashed #DCDFE6;margin-bottom:10px;"},{default:function(){return[l(a("ElCol"),{span:n?20:24},{default:function(){return[l(r,{key:o,inFor:!0,"onUpdate:modelValue":function(t){return e.formData(o,t)},modelValue:e.field?d({},e.field,e._value(e.modelValue[i])):e.modelValue[i],"onEmit-event":function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),l=1;l<n;l++)r[l-1]=arguments[l];return e.emitEvent(t,r,i,o)},"onUpdate:api":function(t){return e.add$f(i,o,t)},rule:s,option:h,extendOption:!0},null)]}}),n?l(a("ElCol"),{span:2,pull:1,push:1},(f=c=e.makeIcon(t.length,i,o),"function"==typeof f||"[object Object]"===Object.prototype.toString.call(f)&&!u(f)?c:{default:function(){return[c]}})):null];var f}})}))])}});export{A as default};
|
|
7
|
+
import{defineComponent as e,markRaw as t,nextTick as r,createVNode as n,watch as o,mergeProps as i}from"vue";function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){c(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return f(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var d={type:function(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"},Undef:function(e){return null==e},Element:function(e){return"object"===l(e)&&null!==e&&1===e.nodeType&&!d.Object(e)},trueArray:function(e){return Array.isArray(e)&&e.length>0},Function:function(e){var t=this.getType(e);return"Function"===t||"AsyncFunction"===t},getType:function(e){var t=Object.prototype.toString.call(e);return/^\[object (.*)\]$/.exec(t)[1]},empty:function(e){return null==e||(!(!Array.isArray(e)||!Array.isArray(e)||e.length)||"string"==typeof e&&!e)}};function p(e,t,r){e[t]=r}function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,n=!1;for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){var i=t[o];if((n=Array.isArray(i))||d.Object(i)){var u=void 0===e[o];if(n)n=!1,u&&p(e,o,[]);else if(i._clone&&void 0!==r){if(!r){p(e,o,i._clone());continue}i=i.getRule(),u&&p(e,o,{})}else u&&p(e,o,{});e[o]=h(e[o],i,r)}else p(e,o,i),d.Undef(i)||(d.Undef(i.__json)||(e[o].__json=i.__json),d.Undef(i.__origin)||(e[o].__origin=i.__origin))}return void 0!==r&&Array.isArray(e)?e.filter((function(e){return!e||!e.__ctrl})):e}function m(e){return h({},{value:e}).value}["Date","Object","String","Boolean","Array","Number"].forEach((function(e){d[e]=function(t){return d.type(t,e)}}));var g=Object.assign||function(e){for(var t,r=1;r<arguments.length;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&p(e,n,t[n]);return e};!function(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}('._fc-group{display:flex;flex-direction:column;justify-content:center;min-height:38px;width:100%}._fc-group-disabled ._fc-group-add,._fc-group-disabled ._fc-group-btn{cursor:not-allowed}._fc-group-handle{background-color:#fff;border:1px dashed #d9d9d9;border-radius:15px;bottom:-15px;display:flex;flex-direction:row;padding:3px 8px;position:absolute;right:30px}._fc-group-btn{cursor:pointer}._fc-group-idx{align-items:center;background:#eee;border-radius:15px;bottom:-15px;display:flex;font-weight:700;height:30px;justify-content:center;left:10px;position:absolute;width:30px}._fc-group-handle ._fc-group-btn+._fc-group-btn{margin-left:7px}._fc-group-container{border:1px dashed #d9d9d9;border-radius:5px;display:flex;flex-direction:column;margin:5px 5px 25px;padding:20px 20px 25px;position:relative}._fc-group-arrow{height:20px;position:relative;width:20px}._fc-group-arrow:before{border-left:2px solid #999;border-top:2px solid #999;content:"";height:9px;left:5px;position:absolute;top:8px;transform:rotate(45deg);width:9px}._fc-group-arrow._fc-group-down{transform:rotate(180deg)}._fc-group-plus-minus{cursor:pointer;height:20px;position:relative;width:20px}._fc-group-plus-minus:after,._fc-group-plus-minus:before{background-color:#409eff;content:"";height:2px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:60%}._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{border:1px solid rgba(64,158,255,.5);border-radius:15px;cursor:pointer;height:25px;width:25px}._fc-group-add._fc-group-plus-minus:after,._fc-group-add._fc-group-plus-minus:before{width:50%}');var y=e({name:"fcGroup",props:{field:String,rule:Array,expand:Number,options:Object,button:{type:Boolean,default:!0},max:{type:Number,default:0},min:{type:Number,default:0},modelValue:{type:Array,default:function(){return[]}},defaultValue:Object,sortBtn:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},syncDisabled:{type:Boolean,default:!0},onBeforeRemove:{type:Function,default:function(){}},onBeforeAdd:{type:Function,default:function(){}},formCreateInject:Object,parse:Function},data:function(){return{len:0,cacheRule:{},cacheValue:{},sort:[],form:t(this.formCreateInject.form.$form())}},emits:["update:modelValue","change","itemMounted","remove","add"],watch:{rule:{handler:function(e,t){var r=this;Object.keys(this.cacheRule).forEach((function(n){var o=r.cacheRule[n];if(o.$f){var i=o.$f.formData();if(e===t)o.$f.deferSyncValue((function(){h(o.rule,e),o.$f.setValue(i)}),!0);else{var u=o.$f.formData();o.$f.once("reloading",(function(){o.$f.setValue(u)})),o.rule=m(e)}}}))},deep:!0},disabled:function(e){if(this.syncDisabled){var t=this.cacheRule;Object.keys(t).forEach((function(r){t[r].$f.disabled(e)}))}},expand:function(e){var t=e-this.modelValue.length;t>0&&this.expandRule(t)},modelValue:{handler:function(e){var t=this;e=e||[];var r=Object.keys(this.sort),n=r.length,o=n-e.length;if(o<0){for(var i=o;i<0;i++)this.addRule(e.length+i,!0);for(var u=0;u<n;u++)this.setValue(r[u],e[u])}else{if(o>0)for(var a=0;a<o;a++)this.removeRule(r[n-a-1]);e.forEach((function(n,o){t.setValue(r[o],e[o])}))}},deep:!0}},methods:{_value:function(e){return e&&(t=e,r=this.field,{}.hasOwnProperty.call(t,r))?e[this.field]:e;var t,r},cache:function(e,t){this.cacheValue[e]=JSON.stringify(t)},input:function(e){this.$emit("update:modelValue",e),this.$emit("change",e)},formData:function(e,t){var r=this,n=this.cacheRule,o=this.sort;if(o.filter((function(e){return n[e].$f})).length===o.length){var i=o.map((function(n){var o=e===n?t:a({},r.cacheRule[n].$f.form),i=r.field?o[r.field]||null:o;return r.cache(n,i),i}));this.input(i)}},setValue:function(e,t){var r=this.field;r&&(t=c({},r,this._value(t))),this.cacheValue[e]!==JSON.stringify(r?t[r]:t)&&this.cache(e,t)},addRule:function(e,t){var n=this,o=this.formCreateInject.form.copyRules(this.rule||[]),i=this.options?a({},this.options):{submitBtn:!1,resetBtn:!1};if(this.defaultValue){i.formData||(i.formData={});var u=m(this.defaultValue);!function(){g.apply(this,arguments)}(i.formData,this.field?c({},this.field,u):u)}this.parse&&this.parse({rule:o,options:i,index:this.sort.length}),this.cacheRule[++this.len]={rule:o,options:i},t&&r((function(){return n.$emit("add",o,Object.keys(n.cacheRule).length-1)}))},add$f:function(e,t,n){var o=this;this.cacheRule[t].$f=n,r((function(){o.syncDisabled&&n.disabled(o.disabled),o.$emit("itemMounted",n,Object.keys(o.cacheRule).indexOf(t))}))},removeRule:function(e,t){var n=this,o=Object.keys(this.cacheRule).indexOf(e);delete this.cacheRule[e],delete this.cacheValue[e],t&&r((function(){return n.$emit("remove",o)}))},add:function(e){if(!this.disabled&&!1!==this.onBeforeAdd(this.modelValue)){var t=s(this.modelValue);t.push(this.defaultValue?m(this.defaultValue):this.field?null:{}),this.input(t)}},del:function(e,t){if(!this.disabled&&!1!==this.onBeforeRemove(this.modelValue,e)){this.removeRule(t,!0);var r=s(this.modelValue);r.splice(e,1),this.input(r)}},addIcon:function(e){return n("div",{class:"_fc-group-btn _fc-group-plus-minus",onClick:this.add},null)},delIcon:function(e,t){var r=this;return n("div",{class:"_fc-group-btn _fc-group-plus-minus _fc-group-minus",onClick:function(){return r.del(e,t)}},null)},sortUpIcon:function(e){var t=this;return n("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-up",onClick:function(){return t.changeSort(e,-1)}},null)},sortDownIcon:function(e){var t=this;return n("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-down",onClick:function(){return t.changeSort(e,1)}},null)},changeSort:function(e,t){var r=this.sort[e];this.sort[e]=this.sort[e+t],this.sort[e+t]=r,this.formData(0)},makeIcon:function(e,t,r){var n=this;if(this.$slots.button)return this.$slots.button({total:e,index:t,vm:this,key:r,del:function(){return n.del(t,r)},add:this.add});var o=[];return(!this.max||e<this.max)&&e===t+1&&o.push(this.addIcon(r)),e>this.min&&o.push(this.delIcon(t,r)),this.sortBtn&&t&&o.push(this.sortUpIcon(t)),this.sortBtn&&t!==e-1&&o.push(this.sortDownIcon(t)),o},emitEvent:function(e,t,r,n){this.$emit.apply(this,[e].concat(s(t),[this.cacheRule[n].$f,r]))},expandRule:function(e){for(var t=0;t<e;t++)this.modelValue.push(this.field?null:{})}},created:function(){var e=this;o((function(){return a({},e.cacheRule)}),(function(t){e.sort=Object.keys(t)}),{immediate:!0});for(var t=(this.expand||0)-this.modelValue.length,r=0;r<this.modelValue.length;r++)this.addRule(r);t>0&&this.expandRule(t)},render:function(){var e=this,t=this.sort,r=this.button,o=this.form,u=this.disabled,a=0===t.length?this.$slots.default?this.$slots.default({vm:this,add:this.add}):n("div",{key:"a_def",class:"_fc-group-plus-minus _fc-group-add",onClick:this.add},null):t.map((function(a,l){var s=e.cacheRule[a],f=s.rule,d=s.options,p=r&&!u?e.makeIcon(t.length,l,a):[];return n("div",{class:"_fc-group-container",key:a},[n(o,i({key:a},{"onUpdate:modelValue":function(t){return e.formData(a,t)},"onEmit-event":function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return e.emitEvent(t,n,l,a)},"onUpdate:api":function(t){return e.add$f(l,a,t)},inFor:!0,modelValue:e.field?c({},e.field,e._value(e.modelValue[l])):e.modelValue[l],rule:f,option:d,extendOption:!0}),null),n("div",{class:"_fc-group-idx"},[l+1]),p.length?n("div",{class:"_fc-group-handle"},[p]):null])}));return n("div",{key:"con",class:"_fc-group "+(u?"_fc-group-disabled":"")},[a])}});export{y as default};
|