@form-create/component-antdv-group 3.1.23 → 3.1.27
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 +157 -144
- package/dist/index.esm.min.js +3 -3
- package/dist/index.js +156 -143
- package/dist/index.min.js +3 -3
- package/package.json +2 -2
- package/src/component.jsx +76 -44
- package/src/style.css +125 -0
- package/src/MinusCircleOutlined.vue +0 -17
- package/src/PlusCircleOutlined.vue +0 -18
package/dist/index.esm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/component-antdv-group v3.1.
|
|
3
|
-
* (c) 2018-
|
|
2
|
+
* @form-create/component-antdv-group v3.1.27
|
|
3
|
+
* (c) 2018-2024 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,62 +150,6 @@ function hasProperty(rule, k) {
|
|
|
150
150
|
return {}.hasOwnProperty.call(rule, k);
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
var script$1 = {
|
|
154
|
-
name: 'MinusCircleOutlined'
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
var _hoisted_1$1 = {
|
|
158
|
-
"class": "anticon"
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
var _hoisted_2$1 = /*#__PURE__*/createElementVNode("svg", {
|
|
162
|
-
height: "1em",
|
|
163
|
-
width: "1em",
|
|
164
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
165
|
-
viewBox: "0 0 1024 1024"
|
|
166
|
-
}, [/*#__PURE__*/createElementVNode("path", {
|
|
167
|
-
d: "M696 480H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z",
|
|
168
|
-
fill: "currentColor"
|
|
169
|
-
}), /*#__PURE__*/createElementVNode("path", {
|
|
170
|
-
d: "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448s448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372s372 166.6 372 372s-166.6 372-372 372z",
|
|
171
|
-
fill: "currentColor"
|
|
172
|
-
})], -1);
|
|
173
|
-
|
|
174
|
-
var _hoisted_3$1 = [_hoisted_2$1];
|
|
175
|
-
function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
176
|
-
return openBlock(), createElementBlock("span", _hoisted_1$1, _hoisted_3$1);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
script$1.render = render$1;
|
|
180
|
-
|
|
181
|
-
var script = {
|
|
182
|
-
name: 'PlusCircleOutlined'
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
var _hoisted_1 = {
|
|
186
|
-
"class": "anticon"
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
var _hoisted_2 = /*#__PURE__*/createElementVNode("svg", {
|
|
190
|
-
height: "1em",
|
|
191
|
-
width: "1em",
|
|
192
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
193
|
-
viewBox: "0 0 1024 1024"
|
|
194
|
-
}, [/*#__PURE__*/createElementVNode("path", {
|
|
195
|
-
d: "M696 480H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z",
|
|
196
|
-
fill: "currentColor"
|
|
197
|
-
}), /*#__PURE__*/createElementVNode("path", {
|
|
198
|
-
d: "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448s448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372s372 166.6 372 372s-166.6 372-372 372z",
|
|
199
|
-
fill: "currentColor"
|
|
200
|
-
})], -1);
|
|
201
|
-
|
|
202
|
-
var _hoisted_3 = [_hoisted_2];
|
|
203
|
-
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
204
|
-
return openBlock(), createElementBlock("span", _hoisted_1, _hoisted_3);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
script.render = render;
|
|
208
|
-
|
|
209
153
|
function $set(target, field, value) {
|
|
210
154
|
target[field] = value;
|
|
211
155
|
}
|
|
@@ -278,10 +222,36 @@ function extend() {
|
|
|
278
222
|
return _extends.apply(this, arguments);
|
|
279
223
|
}
|
|
280
224
|
|
|
281
|
-
function
|
|
282
|
-
|
|
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
|
+
}
|
|
283
250
|
}
|
|
284
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
|
+
|
|
285
255
|
var NAME = 'fcGroup';
|
|
286
256
|
var Group = defineComponent({
|
|
287
257
|
name: NAME,
|
|
@@ -309,6 +279,10 @@ var Group = defineComponent({
|
|
|
309
279
|
}
|
|
310
280
|
},
|
|
311
281
|
defaultValue: Object,
|
|
282
|
+
sortBtn: {
|
|
283
|
+
type: Boolean,
|
|
284
|
+
"default": true
|
|
285
|
+
},
|
|
312
286
|
disabled: {
|
|
313
287
|
type: Boolean,
|
|
314
288
|
"default": false
|
|
@@ -317,10 +291,6 @@ var Group = defineComponent({
|
|
|
317
291
|
type: Boolean,
|
|
318
292
|
"default": true
|
|
319
293
|
},
|
|
320
|
-
fontSize: {
|
|
321
|
-
type: Number,
|
|
322
|
-
"default": 28
|
|
323
|
-
},
|
|
324
294
|
onBeforeRemove: {
|
|
325
295
|
type: Function,
|
|
326
296
|
"default": function _default() {}
|
|
@@ -329,13 +299,15 @@ var Group = defineComponent({
|
|
|
329
299
|
type: Function,
|
|
330
300
|
"default": function _default() {}
|
|
331
301
|
},
|
|
332
|
-
formCreateInject: Object
|
|
302
|
+
formCreateInject: Object,
|
|
303
|
+
parse: Function
|
|
333
304
|
},
|
|
334
305
|
data: function data() {
|
|
335
306
|
return {
|
|
336
307
|
len: 0,
|
|
337
308
|
cacheRule: {},
|
|
338
309
|
cacheValue: {},
|
|
310
|
+
sort: [],
|
|
339
311
|
form: markRaw(this.formCreateInject.form.$form())
|
|
340
312
|
};
|
|
341
313
|
},
|
|
@@ -389,7 +361,7 @@ var Group = defineComponent({
|
|
|
389
361
|
var _this2 = this;
|
|
390
362
|
|
|
391
363
|
n = n || [];
|
|
392
|
-
var keys = Object.keys(this.
|
|
364
|
+
var keys = Object.keys(this.sort),
|
|
393
365
|
total = keys.length,
|
|
394
366
|
len = total - n.length;
|
|
395
367
|
|
|
@@ -431,7 +403,7 @@ var Group = defineComponent({
|
|
|
431
403
|
var _this3 = this;
|
|
432
404
|
|
|
433
405
|
var cacheRule = this.cacheRule;
|
|
434
|
-
var keys =
|
|
406
|
+
var keys = this.sort;
|
|
435
407
|
|
|
436
408
|
if (keys.filter(function (k) {
|
|
437
409
|
return cacheRule[k].$f;
|
|
@@ -477,6 +449,11 @@ var Group = defineComponent({
|
|
|
477
449
|
extend(options.formData, this.field ? _defineProperty({}, this.field, defVal) : defVal);
|
|
478
450
|
}
|
|
479
451
|
|
|
452
|
+
this.parse && this.parse({
|
|
453
|
+
rule: rule,
|
|
454
|
+
options: options,
|
|
455
|
+
index: this.sort.length
|
|
456
|
+
});
|
|
480
457
|
this.cacheRule[++this.len] = {
|
|
481
458
|
rule: rule,
|
|
482
459
|
options: options
|
|
@@ -492,7 +469,6 @@ var Group = defineComponent({
|
|
|
492
469
|
var _this5 = this;
|
|
493
470
|
|
|
494
471
|
this.cacheRule[key].$f = $f;
|
|
495
|
-
this.formData(key, $f.formData());
|
|
496
472
|
nextTick(function () {
|
|
497
473
|
if (_this5.syncDisabled) {
|
|
498
474
|
$f.disabled(_this5.disabled);
|
|
@@ -514,13 +490,15 @@ var Group = defineComponent({
|
|
|
514
490
|
});
|
|
515
491
|
}
|
|
516
492
|
},
|
|
517
|
-
add: function add() {
|
|
493
|
+
add: function add(i) {
|
|
518
494
|
if (this.disabled || false === this.onBeforeAdd(this.modelValue)) {
|
|
519
495
|
return;
|
|
520
496
|
}
|
|
521
497
|
|
|
522
|
-
this.modelValue
|
|
523
|
-
|
|
498
|
+
var value = _toConsumableArray(this.modelValue);
|
|
499
|
+
|
|
500
|
+
value.push(this.defaultValue ? deepCopy(this.defaultValue) : this.field ? null : {});
|
|
501
|
+
this.input(value);
|
|
524
502
|
},
|
|
525
503
|
del: function del(index, key) {
|
|
526
504
|
if (this.disabled || false === this.onBeforeRemove(this.modelValue, index)) {
|
|
@@ -528,30 +506,57 @@ var Group = defineComponent({
|
|
|
528
506
|
}
|
|
529
507
|
|
|
530
508
|
this.removeRule(key, true);
|
|
531
|
-
|
|
532
|
-
|
|
509
|
+
|
|
510
|
+
var value = _toConsumableArray(this.modelValue);
|
|
511
|
+
|
|
512
|
+
value.splice(index, 1);
|
|
513
|
+
this.input(value);
|
|
533
514
|
},
|
|
534
515
|
addIcon: function addIcon(key) {
|
|
535
|
-
return createVNode(
|
|
536
|
-
"
|
|
537
|
-
"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",
|
|
538
518
|
"onClick": this.add
|
|
539
519
|
}, null);
|
|
540
520
|
},
|
|
541
521
|
delIcon: function delIcon(index, key) {
|
|
542
522
|
var _this7 = this;
|
|
543
523
|
|
|
544
|
-
return createVNode(
|
|
545
|
-
"
|
|
546
|
-
"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",
|
|
547
526
|
"onClick": function onClick() {
|
|
548
527
|
return _this7.del(index, key);
|
|
549
528
|
}
|
|
550
529
|
}, null);
|
|
551
530
|
},
|
|
552
|
-
|
|
531
|
+
sortUpIcon: function sortUpIcon(index) {
|
|
553
532
|
var _this8 = this;
|
|
554
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);
|
|
538
|
+
}
|
|
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);
|
|
556
|
+
},
|
|
557
|
+
makeIcon: function makeIcon(total, index, key) {
|
|
558
|
+
var _this10 = this;
|
|
559
|
+
|
|
555
560
|
if (this.$slots.button) {
|
|
556
561
|
return this.$slots.button({
|
|
557
562
|
total: total,
|
|
@@ -559,30 +564,51 @@ var Group = defineComponent({
|
|
|
559
564
|
vm: this,
|
|
560
565
|
key: key,
|
|
561
566
|
del: function del() {
|
|
562
|
-
return
|
|
567
|
+
return _this10.del(index, key);
|
|
563
568
|
},
|
|
564
569
|
add: this.add
|
|
565
570
|
});
|
|
566
571
|
}
|
|
567
572
|
|
|
568
|
-
|
|
569
|
-
|
|
573
|
+
var btn = [];
|
|
574
|
+
|
|
575
|
+
if ((!this.max || total < this.max) && total === index + 1) {
|
|
576
|
+
btn.push(this.addIcon(key));
|
|
570
577
|
}
|
|
571
578
|
|
|
572
579
|
if (total > this.min) {
|
|
573
|
-
|
|
580
|
+
btn.push(this.delIcon(index, key));
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
if (this.sortBtn && index) {
|
|
584
|
+
btn.push(this.sortUpIcon(index));
|
|
574
585
|
}
|
|
586
|
+
|
|
587
|
+
if (this.sortBtn && index !== total - 1) {
|
|
588
|
+
btn.push(this.sortDownIcon(index));
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
return btn;
|
|
575
592
|
},
|
|
576
593
|
emitEvent: function emitEvent(name, args, index, key) {
|
|
577
594
|
this.$emit.apply(this, [name].concat(_toConsumableArray(args), [this.cacheRule[key].$f, index]));
|
|
578
595
|
},
|
|
579
596
|
expandRule: function expandRule(n) {
|
|
580
597
|
for (var i = 0; i < n; i++) {
|
|
581
|
-
this.
|
|
598
|
+
this.addRule(i);
|
|
582
599
|
}
|
|
583
600
|
}
|
|
584
601
|
},
|
|
585
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
|
+
});
|
|
586
612
|
var d = (this.expand || 0) - this.modelValue.length;
|
|
587
613
|
|
|
588
614
|
for (var i = 0; i < this.modelValue.length; i++) {
|
|
@@ -594,71 +620,58 @@ var Group = defineComponent({
|
|
|
594
620
|
}
|
|
595
621
|
},
|
|
596
622
|
render: function render() {
|
|
597
|
-
var
|
|
623
|
+
var _this12 = this;
|
|
598
624
|
|
|
599
|
-
var keys =
|
|
625
|
+
var keys = this.sort;
|
|
600
626
|
var button = this.button;
|
|
601
627
|
var Type = this.form;
|
|
602
|
-
|
|
628
|
+
var disabled = this.disabled;
|
|
629
|
+
var children = keys.length === 0 ? this.$slots["default"] ? this.$slots["default"]({
|
|
603
630
|
vm: this,
|
|
604
631
|
add: this.add
|
|
605
|
-
}) : createVNode(
|
|
606
|
-
"key":
|
|
607
|
-
"
|
|
632
|
+
}) : createVNode("div", {
|
|
633
|
+
"key": 'a_def',
|
|
634
|
+
"class": "_fc-group-plus-minus _fc-group-add",
|
|
608
635
|
"onClick": this.add
|
|
609
|
-
}, null) :
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
"
|
|
619
|
-
"type": "flex",
|
|
620
|
-
"key": key,
|
|
621
|
-
"style": "border-bottom:1px dashed #DCDFE6;margin-bottom:10px;"
|
|
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
|
|
622
646
|
}, {
|
|
623
|
-
|
|
624
|
-
return
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
"span": 2,
|
|
652
|
-
"pull": 1,
|
|
653
|
-
"push": 1
|
|
654
|
-
}, _isSlot(_slot = _this9.makeIcon(keys.length, index, key)) ? _slot : {
|
|
655
|
-
"default": function _default() {
|
|
656
|
-
return [_slot];
|
|
657
|
-
}
|
|
658
|
-
}) : null];
|
|
659
|
-
}
|
|
660
|
-
});
|
|
661
|
-
})]);
|
|
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]);
|
|
662
675
|
}
|
|
663
676
|
});
|
|
664
677
|
|
package/dist/index.esm.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/component-antdv-group v3.1.
|
|
3
|
-
* (c) 2018-
|
|
2
|
+
* @form-create/component-antdv-group v3.1.27
|
|
3
|
+
* (c) 2018-2024 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 s(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 f(e){return f="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},f(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"===f(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:"MinusCircleOutlined"},v={class:"anticon"},b=[n("svg",{height:"1em",width:"1em",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[n("path",{d:"M696 480H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z",fill:"currentColor"}),n("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448s448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372s372 166.6 372 372s-166.6 372-372 372z",fill:"currentColor"})],-1)];y.render=function(n,r,o,i,l,a){return e(),t("span",v,b)};var g={name:"PlusCircleOutlined"},O={class:"anticon"},j=[n("svg",{height:"1em",width:"1em",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[n("path",{d:"M696 480H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z",fill:"currentColor"}),n("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448s448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372s372 166.6 372 372s-166.6 372-372 372z",fill:"currentColor"})],-1)];function V(e,t,n){e[t]=n}function w(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]=w(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 R(e){return w({},{value:e}).value}g.render=function(n,r,o,i,l,a){return e(),t("span",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 S=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(){w(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=R(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:s({},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?s({},this.options):{submitBtn:!1,resetBtn:!1};if(this.defaultValue){o.formData||(o.formData={});var l=R(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(g,{key:"a".concat(e),style:"font-size:".concat(this.fontSize,"px;cursor:").concat(this.disabled?"not-allowed;color:#c9cdd4":"pointer",";"),onClick:this.add},null)},delIcon:function(e,t){var n=this;return l(y,{key:"d".concat(t),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)}},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(g,{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},null):l("div",{key:2},[t.map((function(o,i){var c,s=e.cacheRule[o],f=s.rule,h=s.options;return l(a("aRow"),{align:"middle",type:"flex",key:o,style:"border-bottom:1px dashed #DCDFE6;margin-bottom:10px;"},{default:function(){return[l(a("aCol"),{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:f,option:h,extendOption:!0},null)]}}),n?l(a("aCol"),{span:2,pull:1,push:1},(s=c=e.makeIcon(t.length,i,o),"function"==typeof s||"[object Object]"===Object.prototype.toString.call(s)&&!u(s)?c:{default:function(){return[c]}})):null];var s}})}))])}});export{S 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.addRule(t)}},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};
|