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

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.34
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}}";
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,23 +646,33 @@
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;
592
658
  },
593
- emitEvent: function emitEvent(name, args, index, key) {
594
- this.$emit.apply(this, [name].concat(_toConsumableArray(args), [this.cacheRule[key].$f, index]));
595
- },
596
659
  expandRule: function expandRule(n) {
597
660
  for (var i = 0; i < n; i++) {
598
- this.addRule(i);
661
+ this.modelValue.push(this.field ? null : {});
662
+ }
663
+
664
+ this.input(_toConsumableArray(this.modelValue));
665
+ },
666
+ getTitle: function getTitle(index, key) {
667
+ if (typeof this.title === 'function') {
668
+ return this.title(index, this.modelValue[index], key);
669
+ }
670
+
671
+ if (typeof this.title === 'string') {
672
+ return this.title.replace('{index}', index + 1);
599
673
  }
674
+
675
+ return false;
600
676
  }
601
677
  },
602
678
  created: function created() {
@@ -611,12 +687,13 @@
611
687
  }
612
688
  },
613
689
  render: function render() {
614
- var _this12 = this;
690
+ var _this14 = this;
615
691
 
616
692
  var keys = this.sort;
617
693
  var button = this.button;
618
694
  var Type = this.form;
619
695
  var disabled = this.disabled;
696
+ var isCardType = this.type === 'card';
620
697
  var children = keys.length === 0 ? this.$slots["default"] ? this.$slots["default"]({
621
698
  vm: this,
622
699
  add: this.add
@@ -625,44 +702,72 @@
625
702
  "class": "_fc-group-plus-minus _fc-group-add fc-clock",
626
703
  "onClick": this.add
627
704
  }, 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
- }
646
-
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]);
705
+ var _this14$cacheRule$key = _this14.cacheRule[key],
706
+ rule = _this14$cacheRule$key.rule,
707
+ options = _this14$cacheRule$key.options;
708
+ var btn = button && !disabled ? _this14.makeIcon(keys.length, index, key) : [];
709
+
710
+ var title = _this14.getTitle(index, key);
711
+
712
+ if (isCardType) {
713
+ return vue.createVNode("div", {
714
+ "class": "_fc-group-container",
715
+ "key": key
716
+ }, [vue.createVNode("div", {
717
+ "class": "_fc-group-header"
718
+ }, [title === false ? vue.createVNode("div", {
719
+ "class": "_fc-group-idx"
720
+ }, [index + 1]) : null, title !== false ? vue.createVNode("div", {
721
+ "class": "_fc-group-title"
722
+ }, [title]) : null, vue.createVNode("div", {
723
+ "class": "_fc-group-handle fc-clock"
724
+ }, [btn.length ? btn : null])]), vue.createVNode("div", {
725
+ "class": "_fc-group-content"
726
+ }, [vue.createVNode(Type, vue.mergeProps({
727
+ "key": key
728
+ }, {
729
+ disabled: disabled,
730
+ 'onUpdate:modelValue': function onUpdateModelValue(formData) {
731
+ return _this14.formData(key, formData);
732
+ },
733
+ 'onUpdate:api': function onUpdateApi($f) {
734
+ return _this14.add$f(index, key, $f);
735
+ },
736
+ inFor: true,
737
+ modelValue: _this14.field ? _defineProperty({}, _this14.field, _this14._value(_this14.modelValue[index])) : _this14.modelValue[index],
738
+ rule: rule,
739
+ option: options,
740
+ extendOption: true
741
+ }), null)])]);
742
+ } else {
743
+ return vue.createVNode("div", {
744
+ "class": "_fc-group-container",
745
+ "key": key
746
+ }, [vue.createVNode(Type, vue.mergeProps({
747
+ "key": key
748
+ }, {
749
+ disabled: disabled,
750
+ 'onUpdate:modelValue': function onUpdateModelValue(formData) {
751
+ return _this14.formData(key, formData);
752
+ },
753
+ 'onUpdate:api': function onUpdateApi($f) {
754
+ return _this14.add$f(index, key, $f);
755
+ },
756
+ inFor: true,
757
+ modelValue: _this14.field ? _defineProperty({}, _this14.field, _this14._value(_this14.modelValue[index])) : _this14.modelValue[index],
758
+ rule: rule,
759
+ option: options,
760
+ extendOption: true
761
+ }), null), vue.createVNode("div", {
762
+ "class": "_fc-group-idx"
763
+ }, [index + 1]), btn.length ? vue.createVNode("div", {
764
+ "class": "_fc-group-handle fc-clock"
765
+ }, [btn]) : null]);
766
+ }
662
767
  });
663
768
  return vue.createVNode("div", {
664
769
  "key": 'con',
665
- "class": '_fc-group ' + (disabled ? '_fc-group-disabled' : '')
770
+ "class": '_fc-group ' + (disabled ? '_fc-group-disabled' : '') + (isCardType ? ' _fc-group-card' : '')
666
771
  }, [children]);
667
772
  }
668
773
  });
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.34
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(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).FcGroup={},e.Vue)}(this,(function(e,r){"use strict";function t(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function o(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?t(Object(o),!0).forEach((function(r){c(e,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}function n(e){return n="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},n(e)}function c(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function u(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,r){if(!e)return;if("string"==typeof e)return i(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return i(e,r)}(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 i(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,o=new Array(r);t<r;t++)o[t]=e[t];return o}var f={type:function(e,r){return Object.prototype.toString.call(e)==="[object "+r+"]"},Undef:function(e){return null==e},Element:function(e){return"object"===n(e)&&null!==e&&1===e.nodeType&&!f.Object(e)},trueArray:function(e){return Array.isArray(e)&&e.length>0},Function:function(e){var r=this.getType(e);return"Function"===r||"AsyncFunction"===r},getType:function(e){var r=Object.prototype.toString.call(e);return/^\[object (.*)\]$/.exec(r)[1]},empty:function(e){return null==e||(!(!Array.isArray(e)||!Array.isArray(e)||e.length)||"string"==typeof e&&!e)}};function a(e,r,t){e[r]=t}function p(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=arguments.length>2?arguments[2]:void 0,o=!1;for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)){var c=r[n];if((o=Array.isArray(c))||f.Object(c)){var u=void 0===e[n];if(o)o=!1,u&&a(e,n,[]);else if(c._clone&&void 0!==t){if(!t){a(e,n,c._clone());continue}c=c.getRule(),u&&a(e,n,{})}else u&&a(e,n,{});e[n]=p(e[n],c,t)}else a(e,n,c),f.Undef(c)||(f.Undef(c.__json)||(e[n].__json=c.__json),f.Undef(c.__origin)||(e[n].__origin=c.__origin))}return void 0!==t&&Array.isArray(e)?e.filter((function(e){return!e||!e.__ctrl})):e}function l(e){return p({},{value:e}).value}["Date","Object","String","Boolean","Array","Number"].forEach((function(e){f[e]=function(r){return f.type(r,e)}}));var d=Object.assign||function(e){for(var r,t=1;t<arguments.length;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&a(e,o,r[o]);return e};function s(e){return function(e){return e&&"object"===n(e)&&"function"==typeof e.then}(e)?e:Promise.resolve(e)}!function(e,r){void 0===r&&(r={});var t=r.insertAt;if(e&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===t&&o.firstChild?o.insertBefore(n,o.firstChild):o.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.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%}._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}}');var g=r.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:r.markRaw(this.formCreateInject.form.$form())}},emits:["update:modelValue","change","itemMounted","remove","add"],watch:{rule:{handler:function(e,r){var t=this;Object.keys(this.cacheRule).forEach((function(o){var n=t.cacheRule[o];if(n.$f){var c=n.$f.formData();if(e===r)n.$f.deferSyncValue((function(){p(n.rule,e),n.$f.setValue(c)}),!0);else{var u=n.$f.formData();n.$f.once("reloading",(function(){n.$f.setValue(u)})),n.rule=l(e)}}}))},deep:!0},expand:function(e){var r=e-this.modelValue.length;r>0&&this.expandRule(r)},modelValue:{handler:function(e){var r=this;e=e||[];var t=this.sort,o=t.length,n=o-e.length;if(n<0){for(var c=n;c<0;c++)this.addRule(e.length+c,!0);for(var u=0;u<o;u++)this.setValue(t[u],e[u])}else{if(n>0)for(var i=0;i<n;i++)this.removeRule(t[o-i-1]);e.forEach((function(o,n){r.setValue(t[n],e[n])}))}},deep:!0}},methods:{_value:function(e){return e&&(r=e,t=this.field,{}.hasOwnProperty.call(r,t))?e[this.field]:e;var r,t},cache:function(e,r){this.cacheValue[e]=JSON.stringify(r)},input:function(e){this.$emit("update:modelValue",e),this.$emit("change",e)},formData:function(e,r){var t=this,n=this.cacheRule,c=this.sort;if(c.filter((function(e){return n[e]&&n[e].$f})).length===c.length){var u=c.map((function(n){var c=e===n?r:o({},t.cacheRule[n].$f.form),u=t.field?c[t.field]||null:c;return t.cache(n,u),u}));this.input(u)}},setValue:function(e,r){var t=this.field;t&&(r=c({},t,this._value(r))),this.cacheValue[e]!==JSON.stringify(t?r[t]:r)&&(this.cacheRule[e].$f&&this.cacheRule[e].$f.coverValue(r),this.cache(e,r))},addRule:function(e,t){var n=this,u=this.formCreateInject.form.copyRules(this.rule||[]),i=this.options?o({},this.options):{submitBtn:!1,resetBtn:!1};if(this.defaultValue){i.formData||(i.formData={});var f=l(this.defaultValue);!function(){d.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),t&&r.nextTick((function(){return n.$emit("add",u,Object.keys(n.cacheRule).length-1)}))},add$f:function(e,t,o){var n=this;this.cacheRule[t].$f=o,r.nextTick((function(){n.$emit("itemMounted",o,Object.keys(n.cacheRule).indexOf(t))}))},removeRule:function(e,t){var o=this,n=Object.keys(this.cacheRule).indexOf(e);delete this.cacheRule[e],delete this.cacheValue[e],this.sort=Object.keys(this.cacheRule),t&&r.nextTick((function(){return o.$emit("remove",n)}))},add:function(e){if(!this.disabled&&!1!==this.onBeforeAdd(this.modelValue)){var r=u(this.modelValue);r.push(this.defaultValue?l(this.defaultValue):this.field?null:{}),this.input(r)}},del:function(e,r){var t=this;if(!this.disabled){var o=function(){t.removeRule(r,!0);var o=u(t.modelValue);o.splice(e,1),t.input(o)};s(this.onBeforeRemove(this.modelValue,e)).then((function(e){!1!==e&&o()}))}},addIcon:function(e){return r.createVNode("div",{class:"_fc-group-btn _fc-group-plus-minus",onClick:this.add},null)},delIcon:function(e,t){var o=this;return r.createVNode("div",{class:"_fc-group-btn _fc-group-plus-minus _fc-group-minus",onClick:function(){return o.del(e,t)}},null)},sortUpIcon:function(e){var t=this;return r.createVNode("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-up",onClick:function(){return t.changeSort(e,-1)}},null)},sortDownIcon:function(e){var t=this;return r.createVNode("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-down",onClick:function(){return t.changeSort(e,1)}},null)},changeSort:function(e,r){var t=this,o=this.sort[e];this.sort[e]=this.sort[e+r],this.sort[e+r]=o,this.formCreateInject.subForm(this.sort.map((function(e){return t.cacheRule[e].$f}))),this.formData(0)},sortIcon:function(e,t){var o=this,n=e>0,c=e<t-1;return n||c?n&&c?r.createVNode("div",{class:"_fc-group-btn _fc-group-sort"},[r.createVNode("div",{class:"_fc-group-sort-up",onClick:function(){return o.changeSort(e,-1)}},null),r.createVNode("div",{class:"_fc-group-sort-down",onClick:function(){return o.changeSort(e,1)}},null)]):n?this.sortUpIcon(e):c?this.sortDownIcon(e):void 0:null},makeIcon:function(e,r,t){var o=this;if(this.$slots.button)return this.$slots.button({total:e,index:r,vm:this,key:t,del:function(){return o.del(r,t)},add:this.add});var n=[];if((!this.max||e<this.max)&&e===r+1&&n.push(this.addIcon(t)),e>this.min&&n.push(this.delIcon(r,t)),this.sortBtn){var c=this.sortIcon(r,e);c&&n.push(c)}return n},expandRule:function(e){for(var r=0;r<e;r++)this.modelValue.push(this.field?null:{});this.input(u(this.modelValue))},getTitle:function(e,r){return"function"==typeof this.title?this.title(e,this.modelValue[e],r):"string"==typeof this.title&&this.title.replace("{index}",e+1)}},created:function(){for(var e=(this.expand||0)-this.modelValue.length,r=0;r<this.modelValue.length;r++)this.addRule(r);e>0&&this.expandRule(e)},render:function(){var e=this,t=this.sort,o=this.button,n=this.form,u=this.disabled,i="card"===this.type,f=0===t.length?this.$slots.default?this.$slots.default({vm:this,add:this.add}):r.createVNode("div",{key:"a_def",class:"_fc-group-plus-minus _fc-group-add fc-clock",onClick:this.add},null):t.map((function(f,a){var p=e.cacheRule[f],l=p.rule,d=p.options,s=o&&!u?e.makeIcon(t.length,a,f):[],g=e.getTitle(a,f);return i?r.createVNode("div",{class:"_fc-group-container",key:f},[r.createVNode("div",{class:"_fc-group-header"},[!1===g?r.createVNode("div",{class:"_fc-group-idx"},[a+1]):null,!1!==g?r.createVNode("div",{class:"_fc-group-title"},[g]):null,r.createVNode("div",{class:"_fc-group-handle fc-clock"},[s.length?s:null])]),r.createVNode("div",{class:"_fc-group-content"},[r.createVNode(n,r.mergeProps({key:f},{disabled:u,"onUpdate:modelValue":function(r){return e.formData(f,r)},"onUpdate:api":function(r){return e.add$f(a,f,r)},inFor:!0,modelValue:e.field?c({},e.field,e._value(e.modelValue[a])):e.modelValue[a],rule:l,option:d,extendOption:!0}),null)])]):r.createVNode("div",{class:"_fc-group-container",key:f},[r.createVNode(n,r.mergeProps({key:f},{disabled:u,"onUpdate:modelValue":function(r){return e.formData(f,r)},"onUpdate:api":function(r){return e.add$f(a,f,r)},inFor:!0,modelValue:e.field?c({},e.field,e._value(e.modelValue[a])):e.modelValue[a],rule:l,option:d,extendOption:!0}),null),r.createVNode("div",{class:"_fc-group-idx"},[a+1]),s.length?r.createVNode("div",{class:"_fc-group-handle fc-clock"},[s]):null])}));return r.createVNode("div",{key:"con",class:"_fc-group "+(u?"_fc-group-disabled":"")+(i?" _fc-group-card":"")},[f])}});e.default=g,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.2.23",
3
+ "version": "3.2.34",
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": "9ef5ee0cfb9d729c40c62a89be1590daabcf7482"
60
60
  }