@form-create/component-antdv-group 3.1.23 → 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 +155 -142
- package/dist/index.esm.min.js +2 -2
- package/dist/index.js +154 -141
- package/dist/index.min.js +2 -2
- package/package.json +2 -2
- package/src/component.jsx +75 -43
- package/src/style.css +125 -0
- package/src/MinusCircleOutlined.vue +0 -17
- package/src/PlusCircleOutlined.vue +0 -18
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/component-antdv-group v3.1.
|
|
2
|
+
* @form-create/component-antdv-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.
|
|
@@ -154,62 +154,6 @@
|
|
|
154
154
|
return {}.hasOwnProperty.call(rule, k);
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
var script$1 = {
|
|
158
|
-
name: 'MinusCircleOutlined'
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
var _hoisted_1$1 = {
|
|
162
|
-
"class": "anticon"
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
var _hoisted_2$1 = /*#__PURE__*/vue.createElementVNode("svg", {
|
|
166
|
-
height: "1em",
|
|
167
|
-
width: "1em",
|
|
168
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
169
|
-
viewBox: "0 0 1024 1024"
|
|
170
|
-
}, [/*#__PURE__*/vue.createElementVNode("path", {
|
|
171
|
-
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",
|
|
172
|
-
fill: "currentColor"
|
|
173
|
-
}), /*#__PURE__*/vue.createElementVNode("path", {
|
|
174
|
-
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",
|
|
175
|
-
fill: "currentColor"
|
|
176
|
-
})], -1);
|
|
177
|
-
|
|
178
|
-
var _hoisted_3$1 = [_hoisted_2$1];
|
|
179
|
-
function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
180
|
-
return vue.openBlock(), vue.createElementBlock("span", _hoisted_1$1, _hoisted_3$1);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
script$1.render = render$1;
|
|
184
|
-
|
|
185
|
-
var script = {
|
|
186
|
-
name: 'PlusCircleOutlined'
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
var _hoisted_1 = {
|
|
190
|
-
"class": "anticon"
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
var _hoisted_2 = /*#__PURE__*/vue.createElementVNode("svg", {
|
|
194
|
-
height: "1em",
|
|
195
|
-
width: "1em",
|
|
196
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
197
|
-
viewBox: "0 0 1024 1024"
|
|
198
|
-
}, [/*#__PURE__*/vue.createElementVNode("path", {
|
|
199
|
-
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",
|
|
200
|
-
fill: "currentColor"
|
|
201
|
-
}), /*#__PURE__*/vue.createElementVNode("path", {
|
|
202
|
-
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",
|
|
203
|
-
fill: "currentColor"
|
|
204
|
-
})], -1);
|
|
205
|
-
|
|
206
|
-
var _hoisted_3 = [_hoisted_2];
|
|
207
|
-
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
208
|
-
return vue.openBlock(), vue.createElementBlock("span", _hoisted_1, _hoisted_3);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
script.render = render;
|
|
212
|
-
|
|
213
157
|
function $set(target, field, value) {
|
|
214
158
|
target[field] = value;
|
|
215
159
|
}
|
|
@@ -282,10 +226,36 @@
|
|
|
282
226
|
return _extends.apply(this, arguments);
|
|
283
227
|
}
|
|
284
228
|
|
|
285
|
-
function
|
|
286
|
-
|
|
229
|
+
function styleInject(css, ref) {
|
|
230
|
+
if ( ref === void 0 ) ref = {};
|
|
231
|
+
var insertAt = ref.insertAt;
|
|
232
|
+
|
|
233
|
+
if (!css || typeof document === 'undefined') { return; }
|
|
234
|
+
|
|
235
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
236
|
+
var style = document.createElement('style');
|
|
237
|
+
style.type = 'text/css';
|
|
238
|
+
|
|
239
|
+
if (insertAt === 'top') {
|
|
240
|
+
if (head.firstChild) {
|
|
241
|
+
head.insertBefore(style, head.firstChild);
|
|
242
|
+
} else {
|
|
243
|
+
head.appendChild(style);
|
|
244
|
+
}
|
|
245
|
+
} else {
|
|
246
|
+
head.appendChild(style);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (style.styleSheet) {
|
|
250
|
+
style.styleSheet.cssText = css;
|
|
251
|
+
} else {
|
|
252
|
+
style.appendChild(document.createTextNode(css));
|
|
253
|
+
}
|
|
287
254
|
}
|
|
288
255
|
|
|
256
|
+
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%}";
|
|
257
|
+
styleInject(css_248z);
|
|
258
|
+
|
|
289
259
|
var NAME = 'fcGroup';
|
|
290
260
|
var Group = vue.defineComponent({
|
|
291
261
|
name: NAME,
|
|
@@ -313,6 +283,10 @@
|
|
|
313
283
|
}
|
|
314
284
|
},
|
|
315
285
|
defaultValue: Object,
|
|
286
|
+
sortBtn: {
|
|
287
|
+
type: Boolean,
|
|
288
|
+
"default": true
|
|
289
|
+
},
|
|
316
290
|
disabled: {
|
|
317
291
|
type: Boolean,
|
|
318
292
|
"default": false
|
|
@@ -321,10 +295,6 @@
|
|
|
321
295
|
type: Boolean,
|
|
322
296
|
"default": true
|
|
323
297
|
},
|
|
324
|
-
fontSize: {
|
|
325
|
-
type: Number,
|
|
326
|
-
"default": 28
|
|
327
|
-
},
|
|
328
298
|
onBeforeRemove: {
|
|
329
299
|
type: Function,
|
|
330
300
|
"default": function _default() {}
|
|
@@ -333,13 +303,15 @@
|
|
|
333
303
|
type: Function,
|
|
334
304
|
"default": function _default() {}
|
|
335
305
|
},
|
|
336
|
-
formCreateInject: Object
|
|
306
|
+
formCreateInject: Object,
|
|
307
|
+
parse: Function
|
|
337
308
|
},
|
|
338
309
|
data: function data() {
|
|
339
310
|
return {
|
|
340
311
|
len: 0,
|
|
341
312
|
cacheRule: {},
|
|
342
313
|
cacheValue: {},
|
|
314
|
+
sort: [],
|
|
343
315
|
form: vue.markRaw(this.formCreateInject.form.$form())
|
|
344
316
|
};
|
|
345
317
|
},
|
|
@@ -393,7 +365,7 @@
|
|
|
393
365
|
var _this2 = this;
|
|
394
366
|
|
|
395
367
|
n = n || [];
|
|
396
|
-
var keys = Object.keys(this.
|
|
368
|
+
var keys = Object.keys(this.sort),
|
|
397
369
|
total = keys.length,
|
|
398
370
|
len = total - n.length;
|
|
399
371
|
|
|
@@ -435,7 +407,7 @@
|
|
|
435
407
|
var _this3 = this;
|
|
436
408
|
|
|
437
409
|
var cacheRule = this.cacheRule;
|
|
438
|
-
var keys =
|
|
410
|
+
var keys = this.sort;
|
|
439
411
|
|
|
440
412
|
if (keys.filter(function (k) {
|
|
441
413
|
return cacheRule[k].$f;
|
|
@@ -481,6 +453,11 @@
|
|
|
481
453
|
extend(options.formData, this.field ? _defineProperty({}, this.field, defVal) : defVal);
|
|
482
454
|
}
|
|
483
455
|
|
|
456
|
+
this.parse && this.parse({
|
|
457
|
+
rule: rule,
|
|
458
|
+
options: options,
|
|
459
|
+
index: this.sort.length
|
|
460
|
+
});
|
|
484
461
|
this.cacheRule[++this.len] = {
|
|
485
462
|
rule: rule,
|
|
486
463
|
options: options
|
|
@@ -496,7 +473,6 @@
|
|
|
496
473
|
var _this5 = this;
|
|
497
474
|
|
|
498
475
|
this.cacheRule[key].$f = $f;
|
|
499
|
-
this.formData(key, $f.formData());
|
|
500
476
|
vue.nextTick(function () {
|
|
501
477
|
if (_this5.syncDisabled) {
|
|
502
478
|
$f.disabled(_this5.disabled);
|
|
@@ -518,13 +494,15 @@
|
|
|
518
494
|
});
|
|
519
495
|
}
|
|
520
496
|
},
|
|
521
|
-
add: function add() {
|
|
497
|
+
add: function add(i) {
|
|
522
498
|
if (this.disabled || false === this.onBeforeAdd(this.modelValue)) {
|
|
523
499
|
return;
|
|
524
500
|
}
|
|
525
501
|
|
|
526
|
-
this.modelValue
|
|
527
|
-
|
|
502
|
+
var value = _toConsumableArray(this.modelValue);
|
|
503
|
+
|
|
504
|
+
value.push(this.defaultValue ? deepCopy(this.defaultValue) : this.field ? null : {});
|
|
505
|
+
this.input(value);
|
|
528
506
|
},
|
|
529
507
|
del: function del(index, key) {
|
|
530
508
|
if (this.disabled || false === this.onBeforeRemove(this.modelValue, index)) {
|
|
@@ -532,30 +510,57 @@
|
|
|
532
510
|
}
|
|
533
511
|
|
|
534
512
|
this.removeRule(key, true);
|
|
535
|
-
|
|
536
|
-
|
|
513
|
+
|
|
514
|
+
var value = _toConsumableArray(this.modelValue);
|
|
515
|
+
|
|
516
|
+
value.splice(index, 1);
|
|
517
|
+
this.input(value);
|
|
537
518
|
},
|
|
538
519
|
addIcon: function addIcon(key) {
|
|
539
|
-
return vue.createVNode(
|
|
540
|
-
"
|
|
541
|
-
"style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer', ";"),
|
|
520
|
+
return vue.createVNode("div", {
|
|
521
|
+
"class": "_fc-group-btn _fc-group-plus-minus",
|
|
542
522
|
"onClick": this.add
|
|
543
523
|
}, null);
|
|
544
524
|
},
|
|
545
525
|
delIcon: function delIcon(index, key) {
|
|
546
526
|
var _this7 = this;
|
|
547
527
|
|
|
548
|
-
return vue.createVNode(
|
|
549
|
-
"
|
|
550
|
-
"style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer;color:#606266', ";"),
|
|
528
|
+
return vue.createVNode("div", {
|
|
529
|
+
"class": "_fc-group-btn _fc-group-plus-minus _fc-group-minus",
|
|
551
530
|
"onClick": function onClick() {
|
|
552
531
|
return _this7.del(index, key);
|
|
553
532
|
}
|
|
554
533
|
}, null);
|
|
555
534
|
},
|
|
556
|
-
|
|
535
|
+
sortUpIcon: function sortUpIcon(index) {
|
|
557
536
|
var _this8 = this;
|
|
558
537
|
|
|
538
|
+
return vue.createVNode("div", {
|
|
539
|
+
"class": "_fc-group-btn _fc-group-arrow _fc-group-up",
|
|
540
|
+
"onClick": function onClick() {
|
|
541
|
+
return _this8.changeSort(index, -1);
|
|
542
|
+
}
|
|
543
|
+
}, null);
|
|
544
|
+
},
|
|
545
|
+
sortDownIcon: function sortDownIcon(index) {
|
|
546
|
+
var _this9 = this;
|
|
547
|
+
|
|
548
|
+
return vue.createVNode("div", {
|
|
549
|
+
"class": "_fc-group-btn _fc-group-arrow _fc-group-down",
|
|
550
|
+
"onClick": function onClick() {
|
|
551
|
+
return _this9.changeSort(index, 1);
|
|
552
|
+
}
|
|
553
|
+
}, null);
|
|
554
|
+
},
|
|
555
|
+
changeSort: function changeSort(index, sort) {
|
|
556
|
+
var a = this.sort[index];
|
|
557
|
+
this.sort[index] = this.sort[index + sort];
|
|
558
|
+
this.sort[index + sort] = a;
|
|
559
|
+
this.formData(0);
|
|
560
|
+
},
|
|
561
|
+
makeIcon: function makeIcon(total, index, key) {
|
|
562
|
+
var _this10 = this;
|
|
563
|
+
|
|
559
564
|
if (this.$slots.button) {
|
|
560
565
|
return this.$slots.button({
|
|
561
566
|
total: total,
|
|
@@ -563,19 +568,31 @@
|
|
|
563
568
|
vm: this,
|
|
564
569
|
key: key,
|
|
565
570
|
del: function del() {
|
|
566
|
-
return
|
|
571
|
+
return _this10.del(index, key);
|
|
567
572
|
},
|
|
568
573
|
add: this.add
|
|
569
574
|
});
|
|
570
575
|
}
|
|
571
576
|
|
|
572
|
-
|
|
573
|
-
|
|
577
|
+
var btn = [];
|
|
578
|
+
|
|
579
|
+
if ((!this.max || total < this.max) && total === index + 1) {
|
|
580
|
+
btn.push(this.addIcon(key));
|
|
574
581
|
}
|
|
575
582
|
|
|
576
583
|
if (total > this.min) {
|
|
577
|
-
|
|
584
|
+
btn.push(this.delIcon(index, key));
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
if (this.sortBtn && index) {
|
|
588
|
+
btn.push(this.sortUpIcon(index));
|
|
578
589
|
}
|
|
590
|
+
|
|
591
|
+
if (this.sortBtn && index !== total - 1) {
|
|
592
|
+
btn.push(this.sortDownIcon(index));
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
return btn;
|
|
579
596
|
},
|
|
580
597
|
emitEvent: function emitEvent(name, args, index, key) {
|
|
581
598
|
this.$emit.apply(this, [name].concat(_toConsumableArray(args), [this.cacheRule[key].$f, index]));
|
|
@@ -587,6 +604,15 @@
|
|
|
587
604
|
}
|
|
588
605
|
},
|
|
589
606
|
created: function created() {
|
|
607
|
+
var _this11 = this;
|
|
608
|
+
|
|
609
|
+
vue.watch(function () {
|
|
610
|
+
return _objectSpread2({}, _this11.cacheRule);
|
|
611
|
+
}, function (n) {
|
|
612
|
+
_this11.sort = Object.keys(n);
|
|
613
|
+
}, {
|
|
614
|
+
immediate: true
|
|
615
|
+
});
|
|
590
616
|
var d = (this.expand || 0) - this.modelValue.length;
|
|
591
617
|
|
|
592
618
|
for (var i = 0; i < this.modelValue.length; i++) {
|
|
@@ -598,71 +624,58 @@
|
|
|
598
624
|
}
|
|
599
625
|
},
|
|
600
626
|
render: function render() {
|
|
601
|
-
var
|
|
627
|
+
var _this12 = this;
|
|
602
628
|
|
|
603
|
-
var keys =
|
|
629
|
+
var keys = this.sort;
|
|
604
630
|
var button = this.button;
|
|
605
631
|
var Type = this.form;
|
|
606
|
-
|
|
632
|
+
var disabled = this.disabled;
|
|
633
|
+
var children = keys.length === 0 ? this.$slots["default"] ? this.$slots["default"]({
|
|
607
634
|
vm: this,
|
|
608
635
|
add: this.add
|
|
609
|
-
}) : vue.createVNode(
|
|
610
|
-
"key":
|
|
611
|
-
"
|
|
636
|
+
}) : vue.createVNode("div", {
|
|
637
|
+
"key": 'a_def',
|
|
638
|
+
"class": "_fc-group-plus-minus _fc-group-add",
|
|
612
639
|
"onClick": this.add
|
|
613
|
-
}, null) :
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
"
|
|
623
|
-
"type": "flex",
|
|
624
|
-
"key": key,
|
|
625
|
-
"style": "border-bottom:1px dashed #DCDFE6;margin-bottom:10px;"
|
|
640
|
+
}, null) : keys.map(function (key, index) {
|
|
641
|
+
var _this12$cacheRule$key = _this12.cacheRule[key],
|
|
642
|
+
rule = _this12$cacheRule$key.rule,
|
|
643
|
+
options = _this12$cacheRule$key.options;
|
|
644
|
+
var btn = button && !disabled ? _this12.makeIcon(keys.length, index, key) : [];
|
|
645
|
+
return vue.createVNode("div", {
|
|
646
|
+
"class": "_fc-group-container",
|
|
647
|
+
"key": key
|
|
648
|
+
}, [vue.createVNode(Type, vue.mergeProps({
|
|
649
|
+
"key": key
|
|
626
650
|
}, {
|
|
627
|
-
|
|
628
|
-
return
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
"span": 2,
|
|
656
|
-
"pull": 1,
|
|
657
|
-
"push": 1
|
|
658
|
-
}, _isSlot(_slot = _this9.makeIcon(keys.length, index, key)) ? _slot : {
|
|
659
|
-
"default": function _default() {
|
|
660
|
-
return [_slot];
|
|
661
|
-
}
|
|
662
|
-
}) : null];
|
|
663
|
-
}
|
|
664
|
-
});
|
|
665
|
-
})]);
|
|
651
|
+
'onUpdate:modelValue': function onUpdateModelValue(formData) {
|
|
652
|
+
return _this12.formData(key, formData);
|
|
653
|
+
},
|
|
654
|
+
'onEmit-event': function onEmitEvent(name) {
|
|
655
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
656
|
+
args[_key - 1] = arguments[_key];
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
return _this12.emitEvent(name, args, index, key);
|
|
660
|
+
},
|
|
661
|
+
'onUpdate:api': function onUpdateApi($f) {
|
|
662
|
+
return _this12.add$f(index, key, $f);
|
|
663
|
+
},
|
|
664
|
+
inFor: true,
|
|
665
|
+
modelValue: _this12.field ? _defineProperty({}, _this12.field, _this12._value(_this12.modelValue[index])) : _this12.modelValue[index],
|
|
666
|
+
rule: rule,
|
|
667
|
+
option: options,
|
|
668
|
+
extendOption: true
|
|
669
|
+
}), null), vue.createVNode("div", {
|
|
670
|
+
"class": "_fc-group-idx"
|
|
671
|
+
}, [index + 1]), btn.length ? vue.createVNode("div", {
|
|
672
|
+
"class": "_fc-group-handle"
|
|
673
|
+
}, [btn]) : null]);
|
|
674
|
+
});
|
|
675
|
+
return vue.createVNode("div", {
|
|
676
|
+
"key": 'con',
|
|
677
|
+
"class": '_fc-group ' + (disabled ? '_fc-group-disabled' : '')
|
|
678
|
+
}, [children]);
|
|
666
679
|
}
|
|
667
680
|
});
|
|
668
681
|
|
package/dist/index.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/component-antdv-group v3.1.
|
|
2
|
+
* @form-create/component-antdv-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
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FcGroup={},e.Vue)}(this,(function(e,t){"use strict";function n(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 r(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e){return o="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},o(e)}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e){return function(e){if(Array.isArray(e))return a(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 a(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 a(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 a(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 c={type:function(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"},Undef:function(e){return null==e},Element:function(e){return"object"===o(e)&&null!==e&&1===e.nodeType&&!c.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){c[e]=function(t){return c.type(t,e)}}));var u={name:"MinusCircleOutlined"},s={class:"anticon"},f=[t.createElementVNode("svg",{height:"1em",width:"1em",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[t.createElementVNode("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"}),t.createElementVNode("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)];u.render=function(e,n,r,o,i,l){return t.openBlock(),t.createElementBlock("span",s,f)};var d={name:"PlusCircleOutlined"},h={class:"anticon"},p=[t.createElementVNode("svg",{height:"1em",width:"1em",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[t.createElementVNode("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"}),t.createElementVNode("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 m(e,t,n){e[t]=n}function y(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))||c.Object(i)){var l=void 0===e[o];if(r)r=!1,l&&m(e,o,[]);else if(i._clone&&void 0!==n){if(!n){m(e,o,i._clone());continue}i=i.getRule(),l&&m(e,o,{})}else l&&m(e,o,{});e[o]=y(e[o],i,n)}else m(e,o,i),c.Undef(i)||(c.Undef(i.__json)||(e[o].__json=i.__json),c.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 v(e){return y({},{value:e}).value}d.render=function(e,n,r,o,i,l){return t.openBlock(),t.createElementBlock("span",h,p)};var b=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)&&m(e,r,t[r]);return e};var g=t.defineComponent({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:t.markRaw(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(){y(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=v(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,o=this.cacheRule,i=Object.keys(o);if(i.filter((function(e){return o[e].$f})).length===i.length){var l=i.map((function(o){var i=e===o?t:r({},n.cacheRule[o].$f.form),l=n.field?i[n.field]||null:i;return n.cache(o,l),l}));this.input(l)}},setValue:function(e,t){var n=this.field;n&&(t=i({},n,this._value(t))),this.cacheValue[e]!==JSON.stringify(n?t[n]:t)&&this.cache(e,t)},addRule:function(e,n){var o=this,l=this.formCreateInject.form.copyRules(this.rule||[]),a=this.options?r({},this.options):{submitBtn:!1,resetBtn:!1};if(this.defaultValue){a.formData||(a.formData={});var c=v(this.defaultValue);!function(){b.apply(this,arguments)}(a.formData,this.field?i({},this.field,c):c)}this.cacheRule[++this.len]={rule:l,options:a},n&&t.nextTick((function(){return o.$emit("add",l,Object.keys(o.cacheRule).length-1)}))},add$f:function(e,n,r){var o=this;this.cacheRule[n].$f=r,this.formData(n,r.formData()),t.nextTick((function(){o.syncDisabled&&r.disabled(o.disabled),o.$emit("itemMounted",r,Object.keys(o.cacheRule).indexOf(n))}))},removeRule:function(e,n){var r=this,o=Object.keys(this.cacheRule).indexOf(e);delete this.cacheRule[e],delete this.cacheValue[e],n&&t.nextTick((function(){return r.$emit("remove",o)}))},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 t.createVNode(d,{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,n){var r=this;return t.createVNode(u,{key:"d".concat(n),style:"font-size:".concat(this.fontSize,"px;cursor:").concat(this.disabled?"not-allowed;color:#c9cdd4":"pointer;color:#606266",";"),onClick:function(){return r.del(e,n)}},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(l(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,n=Object.keys(this.cacheRule),r=this.button,o=this.form;return 0===n.length?this.$slots.default?this.$slots.default({vm:this,add:this.add}):t.createVNode(d,{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):t.createVNode("div",{key:2},[n.map((function(l,a){var c,u=e.cacheRule[l],s=u.rule,f=u.options;return t.createVNode(t.resolveComponent("aRow"),{align:"middle",type:"flex",key:l,style:"border-bottom:1px dashed #DCDFE6;margin-bottom:10px;"},{default:function(){return[t.createVNode(t.resolveComponent("aCol"),{span:r?20:24},{default:function(){return[t.createVNode(o,{key:l,inFor:!0,"onUpdate:modelValue":function(t){return e.formData(l,t)},modelValue:e.field?i({},e.field,e._value(e.modelValue[a])):e.modelValue[a],"onEmit-event":function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return e.emitEvent(t,r,a,l)},"onUpdate:api":function(t){return e.add$f(a,l,t)},rule:s,option:f,extendOption:!0},null)]}}),r?t.createVNode(t.resolveComponent("aCol"),{span:2,pull:1,push:1},(u=c=e.makeIcon(n.length,a,l),"function"==typeof u||"[object Object]"===Object.prototype.toString.call(u)&&!t.isVNode(u)?c:{default:function(){return[c]}})):null];var u}})}))])}});e.default=g,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
7
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FcGroup={},e.Vue)}(this,(function(e,t){"use strict";function r(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 n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e){return o="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},o(e)}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e){return function(e){if(Array.isArray(e))return a(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 a(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 a(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 a(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 c={type:function(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"},Undef:function(e){return null==e},Element:function(e){return"object"===o(e)&&null!==e&&1===e.nodeType&&!c.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 l(e,t,r){e[t]=r}function s(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))||c.Object(i)){var u=void 0===e[o];if(n)n=!1,u&&l(e,o,[]);else if(i._clone&&void 0!==r){if(!r){l(e,o,i._clone());continue}i=i.getRule(),u&&l(e,o,{})}else u&&l(e,o,{});e[o]=s(e[o],i,r)}else l(e,o,i),c.Undef(i)||(c.Undef(i.__json)||(e[o].__json=i.__json),c.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 f(e){return s({},{value:e}).value}["Date","Object","String","Boolean","Array","Number"].forEach((function(e){c[e]=function(t){return c.type(t,e)}}));var d=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)&&l(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 p=t.defineComponent({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.markRaw(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(){s(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=f(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,o=this.cacheRule,i=this.sort;if(i.filter((function(e){return o[e].$f})).length===i.length){var u=i.map((function(o){var i=e===o?t:n({},r.cacheRule[o].$f.form),u=r.field?i[r.field]||null:i;return r.cache(o,u),u}));this.input(u)}},setValue:function(e,t){var r=this.field;r&&(t=i({},r,this._value(t))),this.cacheValue[e]!==JSON.stringify(r?t[r]:t)&&this.cache(e,t)},addRule:function(e,r){var o=this,u=this.formCreateInject.form.copyRules(this.rule||[]),a=this.options?n({},this.options):{submitBtn:!1,resetBtn:!1};if(this.defaultValue){a.formData||(a.formData={});var c=f(this.defaultValue);!function(){d.apply(this,arguments)}(a.formData,this.field?i({},this.field,c):c)}this.parse&&this.parse({rule:u,options:a,index:this.sort.length}),this.cacheRule[++this.len]={rule:u,options:a},r&&t.nextTick((function(){return o.$emit("add",u,Object.keys(o.cacheRule).length-1)}))},add$f:function(e,r,n){var o=this;this.cacheRule[r].$f=n,t.nextTick((function(){o.syncDisabled&&n.disabled(o.disabled),o.$emit("itemMounted",n,Object.keys(o.cacheRule).indexOf(r))}))},removeRule:function(e,r){var n=this,o=Object.keys(this.cacheRule).indexOf(e);delete this.cacheRule[e],delete this.cacheValue[e],r&&t.nextTick((function(){return n.$emit("remove",o)}))},add:function(e){if(!this.disabled&&!1!==this.onBeforeAdd(this.modelValue)){var t=u(this.modelValue);t.push(this.defaultValue?f(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=u(this.modelValue);r.splice(e,1),this.input(r)}},addIcon:function(e){return t.createVNode("div",{class:"_fc-group-btn _fc-group-plus-minus",onClick:this.add},null)},delIcon:function(e,r){var n=this;return t.createVNode("div",{class:"_fc-group-btn _fc-group-plus-minus _fc-group-minus",onClick:function(){return n.del(e,r)}},null)},sortUpIcon:function(e){var r=this;return t.createVNode("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-up",onClick:function(){return r.changeSort(e,-1)}},null)},sortDownIcon:function(e){var r=this;return t.createVNode("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-down",onClick:function(){return r.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(u(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;t.watch((function(){return n({},e.cacheRule)}),(function(t){e.sort=Object.keys(t)}),{immediate:!0});for(var r=(this.expand||0)-this.modelValue.length,o=0;o<this.modelValue.length;o++)this.addRule(o);r>0&&this.expandRule(r)},render:function(){var e=this,r=this.sort,n=this.button,o=this.form,u=this.disabled,a=0===r.length?this.$slots.default?this.$slots.default({vm:this,add:this.add}):t.createVNode("div",{key:"a_def",class:"_fc-group-plus-minus _fc-group-add",onClick:this.add},null):r.map((function(a,c){var l=e.cacheRule[a],s=l.rule,f=l.options,d=n&&!u?e.makeIcon(r.length,c,a):[];return t.createVNode("div",{class:"_fc-group-container",key:a},[t.createVNode(o,t.mergeProps({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,c,a)},"onUpdate:api":function(t){return e.add$f(c,a,t)},inFor:!0,modelValue:e.field?i({},e.field,e._value(e.modelValue[c])):e.modelValue[c],rule:s,option:f,extendOption:!0}),null),t.createVNode("div",{class:"_fc-group-idx"},[c+1]),d.length?t.createVNode("div",{class:"_fc-group-handle"},[d]):null])}));return t.createVNode("div",{key:"con",class:"_fc-group "+(u?"_fc-group-disabled":"")},[a])}});e.default=p,Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@form-create/component-antdv-group",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.24",
|
|
4
4
|
"description": "@form-create/ant-design-vue 内置组件",
|
|
5
5
|
"main": "./dist/index.min.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"esm"
|
|
57
57
|
]
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "a49b751973d4e82a6dd3fb2d765c8bb5a645d109"
|
|
60
60
|
}
|