@form-create/component-antdv-group 3.2.23 → 3.2.31

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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @form-create/component-antdv-group v3.2.23
2
+ * @form-create/component-antdv-group v3.2.31
3
3
  * (c) 2018-2025 xaboy
4
4
  * Github https://github.com/xaboy/form-create with group
5
5
  * Released under the MIT License.
@@ -253,9 +253,21 @@
253
253
  }
254
254
  }
255
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%}";
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%}._fc-group._fc-group-card{display:flex;flex-direction:column;gap:16px;width:100%}._fc-group._fc-group-card._fc-group-disabled ._fc-group-add,._fc-group._fc-group-card._fc-group-disabled ._fc-group-btn{cursor:not-allowed;opacity:.5}._fc-group._fc-group-card ._fc-group-container{background:#fff;border:1px solid #f0f0f0;border-radius:6px;display:flex;flex-direction:column;margin:0;overflow:hidden;padding:0;position:relative}._fc-group._fc-group-card ._fc-group-header{align-items:center;background:#fafafa;border-bottom:1px solid #f0f0f0;display:flex;justify-content:space-between;padding:16px 20px 12px}._fc-group._fc-group-card ._fc-group-idx{align-items:center;background:#f0f0f0;border:1px solid #e0e0e0;border-radius:6px;color:#666;display:flex;flex-shrink:0;font-size:12px;font-weight:500;height:24px;justify-content:center;margin-right:12px;position:static;width:24px}._fc-group._fc-group-card ._fc-group-title{color:rgba(0,0,0,.85);flex:1;font-size:14px;font-weight:500;line-height:1.5715}._fc-group._fc-group-card ._fc-group-handle{align-items:center;background-color:transparent;border:none;border-radius:0;bottom:auto;display:flex;flex-direction:row;flex-shrink:0;gap:4px;margin-left:12px;padding:0;position:static;right:auto}._fc-group._fc-group-card ._fc-group-btn{align-items:center;background:#fff;border:1px solid #d9d9d9;border-radius:4px;color:rgba(0,0,0,.45);cursor:pointer;display:flex;height:24px;justify-content:center;position:relative;width:24px}._fc-group._fc-group-card ._fc-group-btn:hover{background:#f0f8ff;border-color:#1890ff;color:#1890ff}._fc-group._fc-group-card ._fc-group-btn:active{border-color:#096dd9;color:#096dd9}._fc-group._fc-group-card ._fc-group-arrow{position:relative}._fc-group._fc-group-card ._fc-group-arrow:before{border-left:1px solid;border-top:1px solid;content:\"\";height:5px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%) rotate(45deg);width:5px}._fc-group._fc-group-card ._fc-group-arrow._fc-group-down{transform:rotate(180deg)}._fc-group._fc-group-card ._fc-group-sort{align-items:center;display:flex;flex-direction:column;height:24px;justify-content:center;position:relative}._fc-group._fc-group-card ._fc-group-sort:after,._fc-group._fc-group-card ._fc-group-sort:before{border-left:1px solid;border-top:1px solid;content:\"\";height:4px;left:50%;position:absolute;transform:translateX(-50%);width:4px}._fc-group._fc-group-card ._fc-group-sort:before{top:6px;transform:translateX(-50%) rotate(45deg)}._fc-group._fc-group-card ._fc-group-sort:after{bottom:6px;transform:translateX(-50%) rotate(225deg)}._fc-group._fc-group-card ._fc-group-sort-down,._fc-group._fc-group-card ._fc-group-sort-up{cursor:pointer;height:12px;left:0;position:absolute;right:0;z-index:1}._fc-group._fc-group-card ._fc-group-sort-up{top:0}._fc-group._fc-group-card ._fc-group-sort-down{bottom:0}._fc-group._fc-group-card ._fc-group-sort-down:hover,._fc-group._fc-group-card ._fc-group-sort-up:hover{background:rgba(24,144,255,.1)}._fc-group._fc-group-card ._fc-group-plus-minus{background:#409eff;border-color:#409eff;color:#fff;height:24px;position:relative;width:24px}._fc-group._fc-group-card ._fc-group-plus-minus:hover{background:#66b1ff;border-color:#66b1ff;color:#fff}._fc-group._fc-group-card ._fc-group-plus-minus:after,._fc-group._fc-group-card ._fc-group-plus-minus:before{background-color:currentColor;content:\"\";height:1px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:8px}._fc-group._fc-group-card ._fc-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-group._fc-group-card ._fc-group-plus-minus._fc-group-minus{background:#f56c6c;border-color:#f56c6c}._fc-group._fc-group-card ._fc-group-plus-minus._fc-group-minus:hover{background:#f78989;border-color:#f78989}._fc-group._fc-group-card ._fc-group-plus-minus._fc-group-minus:before{display:none}._fc-group._fc-group-card ._fc-group-content{padding:20px}._fc-group._fc-group-card ._fc-group-add{align-items:center;background:#fff;border:1px solid #d9d9d9;border-radius:4px;color:rgba(0,0,0,.45);cursor:pointer;display:flex;height:24px;justify-content:center;position:relative;width:24px}._fc-group._fc-group-card ._fc-group-add:hover{background:#f0f8ff;border-color:#409eff;color:#409eff}._fc-group._fc-group-card ._fc-group-add._fc-group-plus-minus{background:#409eff;border-color:#409eff;color:#fff;height:24px;width:24px}._fc-group._fc-group-card ._fc-group-add._fc-group-plus-minus:hover{background:#66b1ff;border-color:#66b1ff;color:#fff}._fc-group._fc-group-card ._fc-group-add._fc-group-plus-minus:after,._fc-group._fc-group-card ._fc-group-add._fc-group-plus-minus:before{background-color:currentColor;content:\"\";height:1px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:8px}._fc-group._fc-group-card ._fc-group-add._fc-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-group._fc-group-card ._fc-group-empty{color:rgba(0,0,0,.45);font-size:14px;padding:40px 20px;text-align:center}@media (max-width:768px){._fc-group._fc-group-card ._fc-group-container{border-left:none;border-radius:0;border-right:none;margin:0 -8px}._fc-group._fc-group-card ._fc-group-header{padding:12px 16px 8px}._fc-group._fc-group-card ._fc-group-content{padding:16px}._fc-group._fc-group-card ._fc-group-handle{gap:2px}._fc-group._fc-group-card ._fc-group-btn{height:22px;width:22px}}@media (prefers-color-scheme:dark){._fc-group._fc-group-card ._fc-group-container{background:#141414;border-color:#303030}._fc-group._fc-group-card ._fc-group-container:hover{border-color:#434343}._fc-group._fc-group-card ._fc-group-header{background:#1f1f1f;border-bottom-color:#303030}._fc-group._fc-group-card ._fc-group-title{color:hsla(0,0%,100%,.85)}._fc-group._fc-group-card ._fc-group-btn{background:#1f1f1f;border-color:#434343;color:hsla(0,0%,100%,.45)}._fc-group._fc-group-card ._fc-group-btn:hover{background:#111b26;border-color:#177ddc;color:#177ddc}._fc-group._fc-group-card ._fc-group-content{background:#141414}._fc-group._fc-group-card ._fc-group-add{background:#1f1f1f;border-color:#434343;color:hsla(0,0%,100%,.45)}._fc-group._fc-group-card ._fc-group-add:hover{background:#111b26;border-color:#177ddc;color:#177ddc}}";
257
257
  styleInject(css_248z);
258
258
 
259
+ function isPromise(value) {
260
+ return value && _typeof(value) === 'object' && typeof value.then === 'function';
261
+ }
262
+
263
+ function toPromise(value) {
264
+ if (isPromise(value)) {
265
+ return value;
266
+ }
267
+
268
+ return Promise.resolve(value);
269
+ }
270
+
259
271
  var NAME = 'fcGroup';
260
272
  var Group = vue.defineComponent({
261
273
  name: NAME,
@@ -295,6 +307,14 @@
295
307
  type: Boolean,
296
308
  "default": true
297
309
  },
310
+ title: {
311
+ type: [String, Function],
312
+ "default": null
313
+ },
314
+ type: {
315
+ type: String,
316
+ "default": 'default'
317
+ },
298
318
  onBeforeRemove: {
299
319
  type: Function,
300
320
  "default": function _default() {}
@@ -496,16 +516,27 @@
496
516
  this.input(value);
497
517
  },
498
518
  del: function del(index, key) {
499
- if (this.disabled || false === this.onBeforeRemove(this.modelValue, index)) {
519
+ var _this7 = this;
520
+
521
+ if (this.disabled) {
500
522
  return;
501
523
  }
502
524
 
503
- this.removeRule(key, true);
525
+ var del = function del() {
526
+ _this7.removeRule(key, true);
504
527
 
505
- var value = _toConsumableArray(this.modelValue);
528
+ var value = _toConsumableArray(_this7.modelValue);
506
529
 
507
- value.splice(index, 1);
508
- this.input(value);
530
+ value.splice(index, 1);
531
+
532
+ _this7.input(value);
533
+ };
534
+
535
+ toPromise(this.onBeforeRemove(this.modelValue, index)).then(function (res) {
536
+ if (false !== res) {
537
+ del();
538
+ }
539
+ });
509
540
  },
510
541
  addIcon: function addIcon(key) {
511
542
  return vue.createVNode("div", {
@@ -514,48 +545,83 @@
514
545
  }, null);
515
546
  },
516
547
  delIcon: function delIcon(index, key) {
517
- var _this7 = this;
548
+ var _this8 = this;
518
549
 
519
550
  return vue.createVNode("div", {
520
551
  "class": "_fc-group-btn _fc-group-plus-minus _fc-group-minus",
521
552
  "onClick": function onClick() {
522
- return _this7.del(index, key);
553
+ return _this8.del(index, key);
523
554
  }
524
555
  }, null);
525
556
  },
526
557
  sortUpIcon: function sortUpIcon(index) {
527
- var _this8 = this;
558
+ var _this9 = this;
528
559
 
529
560
  return vue.createVNode("div", {
530
561
  "class": "_fc-group-btn _fc-group-arrow _fc-group-up",
531
562
  "onClick": function onClick() {
532
- return _this8.changeSort(index, -1);
563
+ return _this9.changeSort(index, -1);
533
564
  }
534
565
  }, null);
535
566
  },
536
567
  sortDownIcon: function sortDownIcon(index) {
537
- var _this9 = this;
568
+ var _this10 = this;
538
569
 
539
570
  return vue.createVNode("div", {
540
571
  "class": "_fc-group-btn _fc-group-arrow _fc-group-down",
541
572
  "onClick": function onClick() {
542
- return _this9.changeSort(index, 1);
573
+ return _this10.changeSort(index, 1);
543
574
  }
544
575
  }, null);
545
576
  },
546
577
  changeSort: function changeSort(index, sort) {
547
- var _this10 = this;
578
+ var _this11 = this;
548
579
 
549
580
  var a = this.sort[index];
550
581
  this.sort[index] = this.sort[index + sort];
551
582
  this.sort[index + sort] = a;
552
583
  this.formCreateInject.subForm(this.sort.map(function (k) {
553
- return _this10.cacheRule[k].$f;
584
+ return _this11.cacheRule[k].$f;
554
585
  }));
555
586
  this.formData(0);
556
587
  },
588
+ sortIcon: function sortIcon(index, total) {
589
+ var _this12 = this;
590
+
591
+ var canMoveUp = index > 0;
592
+ var canMoveDown = index < total - 1;
593
+
594
+ if (!canMoveUp && !canMoveDown) {
595
+ return null;
596
+ }
597
+
598
+ if (canMoveUp && canMoveDown) {
599
+ // 显示合并的上下箭头按钮
600
+ return vue.createVNode("div", {
601
+ "class": "_fc-group-btn _fc-group-sort"
602
+ }, [vue.createVNode("div", {
603
+ "class": "_fc-group-sort-up",
604
+ "onClick": function onClick() {
605
+ return _this12.changeSort(index, -1);
606
+ }
607
+ }, null), vue.createVNode("div", {
608
+ "class": "_fc-group-sort-down",
609
+ "onClick": function onClick() {
610
+ return _this12.changeSort(index, 1);
611
+ }
612
+ }, null)]);
613
+ }
614
+
615
+ if (canMoveUp) {
616
+ return this.sortUpIcon(index);
617
+ }
618
+
619
+ if (canMoveDown) {
620
+ return this.sortDownIcon(index);
621
+ }
622
+ },
557
623
  makeIcon: function makeIcon(total, index, key) {
558
- var _this11 = this;
624
+ var _this13 = this;
559
625
 
560
626
  if (this.$slots.button) {
561
627
  return this.$slots.button({
@@ -564,7 +630,7 @@
564
630
  vm: this,
565
631
  key: key,
566
632
  del: function del() {
567
- return _this11.del(index, key);
633
+ return _this13.del(index, key);
568
634
  },
569
635
  add: this.add
570
636
  });
@@ -580,12 +646,12 @@
580
646
  btn.push(this.delIcon(index, key));
581
647
  }
582
648
 
583
- if (this.sortBtn && index) {
584
- btn.push(this.sortUpIcon(index));
585
- }
649
+ if (this.sortBtn) {
650
+ var sortBtn = this.sortIcon(index, total);
586
651
 
587
- if (this.sortBtn && index !== total - 1) {
588
- btn.push(this.sortDownIcon(index));
652
+ if (sortBtn) {
653
+ btn.push(sortBtn);
654
+ }
589
655
  }
590
656
 
591
657
  return btn;
@@ -595,8 +661,21 @@
595
661
  },
596
662
  expandRule: function expandRule(n) {
597
663
  for (var i = 0; i < n; i++) {
598
- this.addRule(i);
664
+ this.modelValue.push(this.field ? null : {});
665
+ }
666
+
667
+ this.input(_toConsumableArray(this.modelValue));
668
+ },
669
+ getTitle: function getTitle(index, key) {
670
+ if (typeof this.title === 'function') {
671
+ return this.title(index, this.modelValue[index], key);
672
+ }
673
+
674
+ if (typeof this.title === 'string') {
675
+ return this.title.replace('{index}', index + 1);
599
676
  }
677
+
678
+ return false;
600
679
  }
601
680
  },
602
681
  created: function created() {
@@ -611,12 +690,13 @@
611
690
  }
612
691
  },
613
692
  render: function render() {
614
- var _this12 = this;
693
+ var _this14 = this;
615
694
 
616
695
  var keys = this.sort;
617
696
  var button = this.button;
618
697
  var Type = this.form;
619
698
  var disabled = this.disabled;
699
+ var isCardType = this.type === 'card';
620
700
  var children = keys.length === 0 ? this.$slots["default"] ? this.$slots["default"]({
621
701
  vm: this,
622
702
  add: this.add
@@ -625,44 +705,86 @@
625
705
  "class": "_fc-group-plus-minus _fc-group-add fc-clock",
626
706
  "onClick": this.add
627
707
  }, null) : keys.map(function (key, index) {
628
- var _this12$cacheRule$key = _this12.cacheRule[key],
629
- rule = _this12$cacheRule$key.rule,
630
- options = _this12$cacheRule$key.options;
631
- var btn = button && !disabled ? _this12.makeIcon(keys.length, index, key) : [];
632
- return vue.createVNode("div", {
633
- "class": "_fc-group-container",
634
- "key": key
635
- }, [vue.createVNode(Type, vue.mergeProps({
636
- "key": key
637
- }, {
638
- disabled: disabled,
639
- 'onUpdate:modelValue': function onUpdateModelValue(formData) {
640
- return _this12.formData(key, formData);
641
- },
642
- 'onEmit-event': function onEmitEvent(name) {
643
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
644
- args[_key - 1] = arguments[_key];
645
- }
708
+ var _this14$cacheRule$key = _this14.cacheRule[key],
709
+ rule = _this14$cacheRule$key.rule,
710
+ options = _this14$cacheRule$key.options;
711
+ var btn = button && !disabled ? _this14.makeIcon(keys.length, index, key) : [];
712
+
713
+ var title = _this14.getTitle(index, key);
714
+
715
+ if (isCardType) {
716
+ return vue.createVNode("div", {
717
+ "class": "_fc-group-container",
718
+ "key": key
719
+ }, [vue.createVNode("div", {
720
+ "class": "_fc-group-header"
721
+ }, [title === false ? vue.createVNode("div", {
722
+ "class": "_fc-group-idx"
723
+ }, [index + 1]) : null, title !== false ? vue.createVNode("div", {
724
+ "class": "_fc-group-title"
725
+ }, [title]) : null, vue.createVNode("div", {
726
+ "class": "_fc-group-handle fc-clock"
727
+ }, [btn.length ? btn : null])]), vue.createVNode("div", {
728
+ "class": "_fc-group-content"
729
+ }, [vue.createVNode(Type, vue.mergeProps({
730
+ "key": key
731
+ }, {
732
+ disabled: disabled,
733
+ 'onUpdate:modelValue': function onUpdateModelValue(formData) {
734
+ return _this14.formData(key, formData);
735
+ },
736
+ 'onEmit-event': function onEmitEvent(name) {
737
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
738
+ args[_key - 1] = arguments[_key];
739
+ }
646
740
 
647
- return _this12.emitEvent(name, args, index, key);
648
- },
649
- 'onUpdate:api': function onUpdateApi($f) {
650
- return _this12.add$f(index, key, $f);
651
- },
652
- inFor: true,
653
- modelValue: _this12.field ? _defineProperty({}, _this12.field, _this12._value(_this12.modelValue[index])) : _this12.modelValue[index],
654
- rule: rule,
655
- option: options,
656
- extendOption: true
657
- }), null), vue.createVNode("div", {
658
- "class": "_fc-group-idx"
659
- }, [index + 1]), btn.length ? vue.createVNode("div", {
660
- "class": "_fc-group-handle fc-clock"
661
- }, [btn]) : null]);
741
+ return _this14.emitEvent(name, args, index, key);
742
+ },
743
+ 'onUpdate:api': function onUpdateApi($f) {
744
+ return _this14.add$f(index, key, $f);
745
+ },
746
+ inFor: true,
747
+ modelValue: _this14.field ? _defineProperty({}, _this14.field, _this14._value(_this14.modelValue[index])) : _this14.modelValue[index],
748
+ rule: rule,
749
+ option: options,
750
+ extendOption: true
751
+ }), null)])]);
752
+ } else {
753
+ return vue.createVNode("div", {
754
+ "class": "_fc-group-container",
755
+ "key": key
756
+ }, [vue.createVNode(Type, vue.mergeProps({
757
+ "key": key
758
+ }, {
759
+ disabled: disabled,
760
+ 'onUpdate:modelValue': function onUpdateModelValue(formData) {
761
+ return _this14.formData(key, formData);
762
+ },
763
+ 'onEmit-event': function onEmitEvent(name) {
764
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
765
+ args[_key2 - 1] = arguments[_key2];
766
+ }
767
+
768
+ return _this14.emitEvent(name, args, index, key);
769
+ },
770
+ 'onUpdate:api': function onUpdateApi($f) {
771
+ return _this14.add$f(index, key, $f);
772
+ },
773
+ inFor: true,
774
+ modelValue: _this14.field ? _defineProperty({}, _this14.field, _this14._value(_this14.modelValue[index])) : _this14.modelValue[index],
775
+ rule: rule,
776
+ option: options,
777
+ extendOption: true
778
+ }), null), vue.createVNode("div", {
779
+ "class": "_fc-group-idx"
780
+ }, [index + 1]), btn.length ? vue.createVNode("div", {
781
+ "class": "_fc-group-handle fc-clock"
782
+ }, [btn]) : null]);
783
+ }
662
784
  });
663
785
  return vue.createVNode("div", {
664
786
  "key": 'con',
665
- "class": '_fc-group ' + (disabled ? '_fc-group-disabled' : '')
787
+ "class": '_fc-group ' + (disabled ? '_fc-group-disabled' : '') + (isCardType ? ' _fc-group-card' : '')
666
788
  }, [children]);
667
789
  }
668
790
  });
package/dist/index.min.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
- * @form-create/component-antdv-group v3.2.23
2
+ * @form-create/component-antdv-group v3.2.31
3
3
  * (c) 2018-2025 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 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},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=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]&&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.cacheRule[e].$f&&this.cacheRule[e].$f.coverValue(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},this.sort=Object.keys(this.cacheRule),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.$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],this.sort=Object.keys(this.cacheRule),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,n=this.sort[e];this.sort[e]=this.sort[e+t],this.sort[e+t]=n,this.formCreateInject.subForm(this.sort.map((function(e){return r.cacheRule[e].$f}))),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.addRule(t)}},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,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 fc-clock",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},{disabled:u,"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 fc-clock"},[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})}));
7
+ !function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],e):e((r="undefined"!=typeof globalThis?globalThis:r||self).FcGroup={},r.Vue)}(this,(function(r,e){"use strict";function o(r,e){var o=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.push.apply(o,t)}return o}function t(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?o(Object(t),!0).forEach((function(e){c(r,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))}))}return r}function n(r){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},n(r)}function c(r,e,o){return e in r?Object.defineProperty(r,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[e]=o,r}function u(r){return function(r){if(Array.isArray(r))return i(r)}(r)||function(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}(r)||function(r,e){if(!r)return;if("string"==typeof r)return i(r,e);var o=Object.prototype.toString.call(r).slice(8,-1);"Object"===o&&r.constructor&&(o=r.constructor.name);if("Map"===o||"Set"===o)return Array.from(r);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return i(r,e)}(r)||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 i(r,e){(null==e||e>r.length)&&(e=r.length);for(var o=0,t=new Array(e);o<e;o++)t[o]=r[o];return t}var f={type:function(r,e){return Object.prototype.toString.call(r)==="[object "+e+"]"},Undef:function(r){return null==r},Element:function(r){return"object"===n(r)&&null!==r&&1===r.nodeType&&!f.Object(r)},trueArray:function(r){return Array.isArray(r)&&r.length>0},Function:function(r){var e=this.getType(r);return"Function"===e||"AsyncFunction"===e},getType:function(r){var e=Object.prototype.toString.call(r);return/^\[object (.*)\]$/.exec(e)[1]},empty:function(r){return null==r||(!(!Array.isArray(r)||!Array.isArray(r)||r.length)||"string"==typeof r&&!r)}};function a(r,e,o){r[e]=o}function p(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0,t=!1;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var c=e[n];if((t=Array.isArray(c))||f.Object(c)){var u=void 0===r[n];if(t)t=!1,u&&a(r,n,[]);else if(c._clone&&void 0!==o){if(!o){a(r,n,c._clone());continue}c=c.getRule(),u&&a(r,n,{})}else u&&a(r,n,{});r[n]=p(r[n],c,o)}else a(r,n,c),f.Undef(c)||(f.Undef(c.__json)||(r[n].__json=c.__json),f.Undef(c.__origin)||(r[n].__origin=c.__origin))}return void 0!==o&&Array.isArray(r)?r.filter((function(r){return!r||!r.__ctrl})):r}function d(r){return p({},{value:r}).value}["Date","Object","String","Boolean","Array","Number"].forEach((function(r){f[r]=function(e){return f.type(e,r)}}));var l=Object.assign||function(r){for(var e,o=1;o<arguments.length;o++)for(var t in e=arguments[o])Object.prototype.hasOwnProperty.call(e,t)&&a(r,t,e[t]);return r};function s(r){return function(r){return r&&"object"===n(r)&&"function"==typeof r.then}(r)?r:Promise.resolve(r)}!function(r,e){void 0===e&&(e={});var o=e.insertAt;if(r&&"undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===o&&t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n),n.styleSheet?n.styleSheet.cssText=r:n.appendChild(document.createTextNode(r))}}('._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%}._fc-group._fc-group-card{display:flex;flex-direction:column;gap:16px;width:100%}._fc-group._fc-group-card._fc-group-disabled ._fc-group-add,._fc-group._fc-group-card._fc-group-disabled ._fc-group-btn{cursor:not-allowed;opacity:.5}._fc-group._fc-group-card ._fc-group-container{background:#fff;border:1px solid #f0f0f0;border-radius:6px;display:flex;flex-direction:column;margin:0;overflow:hidden;padding:0;position:relative}._fc-group._fc-group-card ._fc-group-header{align-items:center;background:#fafafa;border-bottom:1px solid #f0f0f0;display:flex;justify-content:space-between;padding:16px 20px 12px}._fc-group._fc-group-card ._fc-group-idx{align-items:center;background:#f0f0f0;border:1px solid #e0e0e0;border-radius:6px;color:#666;display:flex;flex-shrink:0;font-size:12px;font-weight:500;height:24px;justify-content:center;margin-right:12px;position:static;width:24px}._fc-group._fc-group-card ._fc-group-title{color:rgba(0,0,0,.85);flex:1;font-size:14px;font-weight:500;line-height:1.5715}._fc-group._fc-group-card ._fc-group-handle{align-items:center;background-color:transparent;border:none;border-radius:0;bottom:auto;display:flex;flex-direction:row;flex-shrink:0;gap:4px;margin-left:12px;padding:0;position:static;right:auto}._fc-group._fc-group-card ._fc-group-btn{align-items:center;background:#fff;border:1px solid #d9d9d9;border-radius:4px;color:rgba(0,0,0,.45);cursor:pointer;display:flex;height:24px;justify-content:center;position:relative;width:24px}._fc-group._fc-group-card ._fc-group-btn:hover{background:#f0f8ff;border-color:#1890ff;color:#1890ff}._fc-group._fc-group-card ._fc-group-btn:active{border-color:#096dd9;color:#096dd9}._fc-group._fc-group-card ._fc-group-arrow{position:relative}._fc-group._fc-group-card ._fc-group-arrow:before{border-left:1px solid;border-top:1px solid;content:"";height:5px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%) rotate(45deg);width:5px}._fc-group._fc-group-card ._fc-group-arrow._fc-group-down{transform:rotate(180deg)}._fc-group._fc-group-card ._fc-group-sort{align-items:center;display:flex;flex-direction:column;height:24px;justify-content:center;position:relative}._fc-group._fc-group-card ._fc-group-sort:after,._fc-group._fc-group-card ._fc-group-sort:before{border-left:1px solid;border-top:1px solid;content:"";height:4px;left:50%;position:absolute;transform:translateX(-50%);width:4px}._fc-group._fc-group-card ._fc-group-sort:before{top:6px;transform:translateX(-50%) rotate(45deg)}._fc-group._fc-group-card ._fc-group-sort:after{bottom:6px;transform:translateX(-50%) rotate(225deg)}._fc-group._fc-group-card ._fc-group-sort-down,._fc-group._fc-group-card ._fc-group-sort-up{cursor:pointer;height:12px;left:0;position:absolute;right:0;z-index:1}._fc-group._fc-group-card ._fc-group-sort-up{top:0}._fc-group._fc-group-card ._fc-group-sort-down{bottom:0}._fc-group._fc-group-card ._fc-group-sort-down:hover,._fc-group._fc-group-card ._fc-group-sort-up:hover{background:rgba(24,144,255,.1)}._fc-group._fc-group-card ._fc-group-plus-minus{background:#409eff;border-color:#409eff;color:#fff;height:24px;position:relative;width:24px}._fc-group._fc-group-card ._fc-group-plus-minus:hover{background:#66b1ff;border-color:#66b1ff;color:#fff}._fc-group._fc-group-card ._fc-group-plus-minus:after,._fc-group._fc-group-card ._fc-group-plus-minus:before{background-color:currentColor;content:"";height:1px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:8px}._fc-group._fc-group-card ._fc-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-group._fc-group-card ._fc-group-plus-minus._fc-group-minus{background:#f56c6c;border-color:#f56c6c}._fc-group._fc-group-card ._fc-group-plus-minus._fc-group-minus:hover{background:#f78989;border-color:#f78989}._fc-group._fc-group-card ._fc-group-plus-minus._fc-group-minus:before{display:none}._fc-group._fc-group-card ._fc-group-content{padding:20px}._fc-group._fc-group-card ._fc-group-add{align-items:center;background:#fff;border:1px solid #d9d9d9;border-radius:4px;color:rgba(0,0,0,.45);cursor:pointer;display:flex;height:24px;justify-content:center;position:relative;width:24px}._fc-group._fc-group-card ._fc-group-add:hover{background:#f0f8ff;border-color:#409eff;color:#409eff}._fc-group._fc-group-card ._fc-group-add._fc-group-plus-minus{background:#409eff;border-color:#409eff;color:#fff;height:24px;width:24px}._fc-group._fc-group-card ._fc-group-add._fc-group-plus-minus:hover{background:#66b1ff;border-color:#66b1ff;color:#fff}._fc-group._fc-group-card ._fc-group-add._fc-group-plus-minus:after,._fc-group._fc-group-card ._fc-group-add._fc-group-plus-minus:before{background-color:currentColor;content:"";height:1px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:8px}._fc-group._fc-group-card ._fc-group-add._fc-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-group._fc-group-card ._fc-group-empty{color:rgba(0,0,0,.45);font-size:14px;padding:40px 20px;text-align:center}@media (max-width:768px){._fc-group._fc-group-card ._fc-group-container{border-left:none;border-radius:0;border-right:none;margin:0 -8px}._fc-group._fc-group-card ._fc-group-header{padding:12px 16px 8px}._fc-group._fc-group-card ._fc-group-content{padding:16px}._fc-group._fc-group-card ._fc-group-handle{gap:2px}._fc-group._fc-group-card ._fc-group-btn{height:22px;width:22px}}@media (prefers-color-scheme:dark){._fc-group._fc-group-card ._fc-group-container{background:#141414;border-color:#303030}._fc-group._fc-group-card ._fc-group-container:hover{border-color:#434343}._fc-group._fc-group-card ._fc-group-header{background:#1f1f1f;border-bottom-color:#303030}._fc-group._fc-group-card ._fc-group-title{color:hsla(0,0%,100%,.85)}._fc-group._fc-group-card ._fc-group-btn{background:#1f1f1f;border-color:#434343;color:hsla(0,0%,100%,.45)}._fc-group._fc-group-card ._fc-group-btn:hover{background:#111b26;border-color:#177ddc;color:#177ddc}._fc-group._fc-group-card ._fc-group-content{background:#141414}._fc-group._fc-group-card ._fc-group-add{background:#1f1f1f;border-color:#434343;color:hsla(0,0%,100%,.45)}._fc-group._fc-group-card ._fc-group-add:hover{background:#111b26;border-color:#177ddc;color:#177ddc}}');var g=e.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},title:{type:[String,Function],default:null},type:{type:String,default:"default"},onBeforeRemove:{type:Function,default:function(){}},onBeforeAdd:{type:Function,default:function(){}},formCreateInject:Object,parse:Function},data:function(){return{len:0,cacheRule:{},cacheValue:{},sort:[],form:e.markRaw(this.formCreateInject.form.$form())}},emits:["update:modelValue","change","itemMounted","remove","add"],watch:{rule:{handler:function(r,e){var o=this;Object.keys(this.cacheRule).forEach((function(t){var n=o.cacheRule[t];if(n.$f){var c=n.$f.formData();if(r===e)n.$f.deferSyncValue((function(){p(n.rule,r),n.$f.setValue(c)}),!0);else{var u=n.$f.formData();n.$f.once("reloading",(function(){n.$f.setValue(u)})),n.rule=d(r)}}}))},deep:!0},expand:function(r){var e=r-this.modelValue.length;e>0&&this.expandRule(e)},modelValue:{handler:function(r){var e=this;r=r||[];var o=this.sort,t=o.length,n=t-r.length;if(n<0){for(var c=n;c<0;c++)this.addRule(r.length+c,!0);for(var u=0;u<t;u++)this.setValue(o[u],r[u])}else{if(n>0)for(var i=0;i<n;i++)this.removeRule(o[t-i-1]);r.forEach((function(t,n){e.setValue(o[n],r[n])}))}},deep:!0}},methods:{_value:function(r){return r&&(e=r,o=this.field,{}.hasOwnProperty.call(e,o))?r[this.field]:r;var e,o},cache:function(r,e){this.cacheValue[r]=JSON.stringify(e)},input:function(r){this.$emit("update:modelValue",r),this.$emit("change",r)},formData:function(r,e){var o=this,n=this.cacheRule,c=this.sort;if(c.filter((function(r){return n[r]&&n[r].$f})).length===c.length){var u=c.map((function(n){var c=r===n?e:t({},o.cacheRule[n].$f.form),u=o.field?c[o.field]||null:c;return o.cache(n,u),u}));this.input(u)}},setValue:function(r,e){var o=this.field;o&&(e=c({},o,this._value(e))),this.cacheValue[r]!==JSON.stringify(o?e[o]:e)&&(this.cacheRule[r].$f&&this.cacheRule[r].$f.coverValue(e),this.cache(r,e))},addRule:function(r,o){var n=this,u=this.formCreateInject.form.copyRules(this.rule||[]),i=this.options?t({},this.options):{submitBtn:!1,resetBtn:!1};if(this.defaultValue){i.formData||(i.formData={});var f=d(this.defaultValue);!function(){l.apply(this,arguments)}(i.formData,this.field?c({},this.field,f):f)}this.parse&&this.parse({rule:u,options:i,index:this.sort.length}),this.cacheRule[++this.len]={rule:u,options:i},this.sort=Object.keys(this.cacheRule),o&&e.nextTick((function(){return n.$emit("add",u,Object.keys(n.cacheRule).length-1)}))},add$f:function(r,o,t){var n=this;this.cacheRule[o].$f=t,e.nextTick((function(){n.$emit("itemMounted",t,Object.keys(n.cacheRule).indexOf(o))}))},removeRule:function(r,o){var t=this,n=Object.keys(this.cacheRule).indexOf(r);delete this.cacheRule[r],delete this.cacheValue[r],this.sort=Object.keys(this.cacheRule),o&&e.nextTick((function(){return t.$emit("remove",n)}))},add:function(r){if(!this.disabled&&!1!==this.onBeforeAdd(this.modelValue)){var e=u(this.modelValue);e.push(this.defaultValue?d(this.defaultValue):this.field?null:{}),this.input(e)}},del:function(r,e){var o=this;if(!this.disabled){var t=function(){o.removeRule(e,!0);var t=u(o.modelValue);t.splice(r,1),o.input(t)};s(this.onBeforeRemove(this.modelValue,r)).then((function(r){!1!==r&&t()}))}},addIcon:function(r){return e.createVNode("div",{class:"_fc-group-btn _fc-group-plus-minus",onClick:this.add},null)},delIcon:function(r,o){var t=this;return e.createVNode("div",{class:"_fc-group-btn _fc-group-plus-minus _fc-group-minus",onClick:function(){return t.del(r,o)}},null)},sortUpIcon:function(r){var o=this;return e.createVNode("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-up",onClick:function(){return o.changeSort(r,-1)}},null)},sortDownIcon:function(r){var o=this;return e.createVNode("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-down",onClick:function(){return o.changeSort(r,1)}},null)},changeSort:function(r,e){var o=this,t=this.sort[r];this.sort[r]=this.sort[r+e],this.sort[r+e]=t,this.formCreateInject.subForm(this.sort.map((function(r){return o.cacheRule[r].$f}))),this.formData(0)},sortIcon:function(r,o){var t=this,n=r>0,c=r<o-1;return n||c?n&&c?e.createVNode("div",{class:"_fc-group-btn _fc-group-sort"},[e.createVNode("div",{class:"_fc-group-sort-up",onClick:function(){return t.changeSort(r,-1)}},null),e.createVNode("div",{class:"_fc-group-sort-down",onClick:function(){return t.changeSort(r,1)}},null)]):n?this.sortUpIcon(r):c?this.sortDownIcon(r):void 0:null},makeIcon:function(r,e,o){var t=this;if(this.$slots.button)return this.$slots.button({total:r,index:e,vm:this,key:o,del:function(){return t.del(e,o)},add:this.add});var n=[];if((!this.max||r<this.max)&&r===e+1&&n.push(this.addIcon(o)),r>this.min&&n.push(this.delIcon(e,o)),this.sortBtn){var c=this.sortIcon(e,r);c&&n.push(c)}return n},emitEvent:function(r,e,o,t){this.$emit.apply(this,[r].concat(u(e),[this.cacheRule[t].$f,o]))},expandRule:function(r){for(var e=0;e<r;e++)this.modelValue.push(this.field?null:{});this.input(u(this.modelValue))},getTitle:function(r,e){return"function"==typeof this.title?this.title(r,this.modelValue[r],e):"string"==typeof this.title&&this.title.replace("{index}",r+1)}},created:function(){for(var r=(this.expand||0)-this.modelValue.length,e=0;e<this.modelValue.length;e++)this.addRule(e);r>0&&this.expandRule(r)},render:function(){var r=this,o=this.sort,t=this.button,n=this.form,u=this.disabled,i="card"===this.type,f=0===o.length?this.$slots.default?this.$slots.default({vm:this,add:this.add}):e.createVNode("div",{key:"a_def",class:"_fc-group-plus-minus _fc-group-add fc-clock",onClick:this.add},null):o.map((function(f,a){var p=r.cacheRule[f],d=p.rule,l=p.options,s=t&&!u?r.makeIcon(o.length,a,f):[],g=r.getTitle(a,f);return i?e.createVNode("div",{class:"_fc-group-container",key:f},[e.createVNode("div",{class:"_fc-group-header"},[!1===g?e.createVNode("div",{class:"_fc-group-idx"},[a+1]):null,!1!==g?e.createVNode("div",{class:"_fc-group-title"},[g]):null,e.createVNode("div",{class:"_fc-group-handle fc-clock"},[s.length?s:null])]),e.createVNode("div",{class:"_fc-group-content"},[e.createVNode(n,e.mergeProps({key:f},{disabled:u,"onUpdate:modelValue":function(e){return r.formData(f,e)},"onEmit-event":function(e){for(var o=arguments.length,t=new Array(o>1?o-1:0),n=1;n<o;n++)t[n-1]=arguments[n];return r.emitEvent(e,t,a,f)},"onUpdate:api":function(e){return r.add$f(a,f,e)},inFor:!0,modelValue:r.field?c({},r.field,r._value(r.modelValue[a])):r.modelValue[a],rule:d,option:l,extendOption:!0}),null)])]):e.createVNode("div",{class:"_fc-group-container",key:f},[e.createVNode(n,e.mergeProps({key:f},{disabled:u,"onUpdate:modelValue":function(e){return r.formData(f,e)},"onEmit-event":function(e){for(var o=arguments.length,t=new Array(o>1?o-1:0),n=1;n<o;n++)t[n-1]=arguments[n];return r.emitEvent(e,t,a,f)},"onUpdate:api":function(e){return r.add$f(a,f,e)},inFor:!0,modelValue:r.field?c({},r.field,r._value(r.modelValue[a])):r.modelValue[a],rule:d,option:l,extendOption:!0}),null),e.createVNode("div",{class:"_fc-group-idx"},[a+1]),s.length?e.createVNode("div",{class:"_fc-group-handle fc-clock"},[s]):null])}));return e.createVNode("div",{key:"con",class:"_fc-group "+(u?"_fc-group-disabled":"")+(i?" _fc-group-card":"")},[f])}});r.default=g,Object.defineProperty(r,"__esModule",{value:!0})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@form-create/component-antdv-group",
3
- "version": "3.2.23",
3
+ "version": "3.2.31",
4
4
  "description": "@form-create/ant-design-vue 内置组件",
5
5
  "main": "./dist/index.min.js",
6
6
  "module": "./dist/index.esm.js",
@@ -30,7 +30,7 @@
30
30
  "author": "xaboy",
31
31
  "license": "MIT",
32
32
  "dependencies": {
33
- "@form-create/utils": "^3.2.23"
33
+ "@form-create/utils": "^3.2.31"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@ant-design/icons-vue": "^6.0.1"
@@ -56,5 +56,5 @@
56
56
  "esm"
57
57
  ]
58
58
  },
59
- "gitHead": "57998b12f9f396719286af0dc19aa30f31347382"
59
+ "gitHead": "067dc202ea8d62bfc2187ed19e0b023bb42c3ef2"
60
60
  }