@form-create/component-elm-group 3.2.31 → 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.esm.js +6 -23
- package/dist/index.esm.min.js +2 -2
- package/dist/index.js +6 -23
- package/dist/index.min.js +2 -2
- package/package.json +2 -2
- package/src/component.jsx +2 -5
- package/src/style.css +0 -49
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/component-elm-group v3.2.
|
|
2
|
+
* @form-create/component-elm-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.
|
|
@@ -249,7 +249,7 @@ function styleInject(css, ref) {
|
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
var css_248z = "._fc-group{display:flex;flex-direction:column;justify-content:center;min-height:38px;width:100%}._fc-group-disabled ._fc-group-add,._fc-group-disabled ._fc-group-btn{cursor:not-allowed}._fc-group-handle{background-color:#fff;border:1px dashed #d9d9d9;border-radius:15px;bottom:-15px;display:flex;flex-direction:row;padding:3px 8px;position:absolute;right:30px}._fc-group-btn{cursor:pointer}._fc-group-idx{align-items:center;background:#eee;border-radius:15px;bottom:-15px;display:flex;font-weight:700;height:30px;justify-content:center;left:10px;position:absolute;width:30px}._fc-group-handle ._fc-group-btn+._fc-group-btn{margin-left:7px}._fc-group-container{border:1px dashed #d9d9d9;border-radius:5px;display:flex;flex-direction:column;margin:5px 5px 25px;padding:20px 20px 25px;position:relative}._fc-group-arrow{height:20px;position:relative;width:20px}._fc-group-arrow:before{border-left:2px solid #999;border-top:2px solid #999;content:\"\";height:9px;left:5px;position:absolute;top:8px;transform:rotate(45deg);width:9px}._fc-group-arrow._fc-group-down{transform:rotate(180deg)}._fc-group-plus-minus{cursor:pointer;height:20px;position:relative;width:20px}._fc-group-plus-minus:after,._fc-group-plus-minus:before{background-color:#409eff;content:\"\";height:2px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:60%}._fc-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-group-plus-minus._fc-group-minus:before{display:none}._fc-group-plus-minus._fc-group-minus:after{background-color:#f56c6c}._fc-group-add{border:1px solid rgba(64,158,255,.5);border-radius:15px;cursor:pointer;height:25px;width:25px}._fc-group-add._fc-group-plus-minus:after,._fc-group-add._fc-group-plus-minus:before{width:50%}._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}}
|
|
252
|
+
var css_248z = "._fc-group{display:flex;flex-direction:column;justify-content:center;min-height:38px;width:100%}._fc-group-disabled ._fc-group-add,._fc-group-disabled ._fc-group-btn{cursor:not-allowed}._fc-group-handle{background-color:#fff;border:1px dashed #d9d9d9;border-radius:15px;bottom:-15px;display:flex;flex-direction:row;padding:3px 8px;position:absolute;right:30px}._fc-group-btn{cursor:pointer}._fc-group-idx{align-items:center;background:#eee;border-radius:15px;bottom:-15px;display:flex;font-weight:700;height:30px;justify-content:center;left:10px;position:absolute;width:30px}._fc-group-handle ._fc-group-btn+._fc-group-btn{margin-left:7px}._fc-group-container{border:1px dashed #d9d9d9;border-radius:5px;display:flex;flex-direction:column;margin:5px 5px 25px;padding:20px 20px 25px;position:relative}._fc-group-arrow{height:20px;position:relative;width:20px}._fc-group-arrow:before{border-left:2px solid #999;border-top:2px solid #999;content:\"\";height:9px;left:5px;position:absolute;top:8px;transform:rotate(45deg);width:9px}._fc-group-arrow._fc-group-down{transform:rotate(180deg)}._fc-group-plus-minus{cursor:pointer;height:20px;position:relative;width:20px}._fc-group-plus-minus:after,._fc-group-plus-minus:before{background-color:#409eff;content:\"\";height:2px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:60%}._fc-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-group-plus-minus._fc-group-minus:before{display:none}._fc-group-plus-minus._fc-group-minus:after{background-color:#f56c6c}._fc-group-add{border:1px solid rgba(64,158,255,.5);border-radius:15px;cursor:pointer;height:25px;width:25px}._fc-group-add._fc-group-plus-minus:after,._fc-group-add._fc-group-plus-minus:before{width:50%}._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}}";
|
|
253
253
|
styleInject(css_248z);
|
|
254
254
|
|
|
255
255
|
function isPromise(value) {
|
|
@@ -652,9 +652,6 @@ var Group = defineComponent({
|
|
|
652
652
|
|
|
653
653
|
return btn;
|
|
654
654
|
},
|
|
655
|
-
emitEvent: function emitEvent(name, args, index, key) {
|
|
656
|
-
this.$emit.apply(this, [name].concat(_toConsumableArray(args), [this.cacheRule[key].$f, index]));
|
|
657
|
-
},
|
|
658
655
|
expandRule: function expandRule(n) {
|
|
659
656
|
for (var i = 0; i < n; i++) {
|
|
660
657
|
this.modelValue.push(this.field ? null : {});
|
|
@@ -724,18 +721,11 @@ var Group = defineComponent({
|
|
|
724
721
|
"class": "_fc-group-content"
|
|
725
722
|
}, [createVNode(Type, mergeProps({
|
|
726
723
|
"key": key
|
|
727
|
-
}, {
|
|
724
|
+
}, _objectSpread2(_objectSpread2({}, _this14.$attrs), {}, {
|
|
728
725
|
disabled: disabled,
|
|
729
726
|
'onUpdate:modelValue': function onUpdateModelValue(formData) {
|
|
730
727
|
return _this14.formData(key, formData);
|
|
731
728
|
},
|
|
732
|
-
'onEmit-event': function onEmitEvent(name) {
|
|
733
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
734
|
-
args[_key - 1] = arguments[_key];
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
return _this14.emitEvent(name, args, index, key);
|
|
738
|
-
},
|
|
739
729
|
'onUpdate:api': function onUpdateApi($f) {
|
|
740
730
|
return _this14.add$f(index, key, $f);
|
|
741
731
|
},
|
|
@@ -744,25 +734,18 @@ var Group = defineComponent({
|
|
|
744
734
|
rule: rule,
|
|
745
735
|
option: options,
|
|
746
736
|
extendOption: true
|
|
747
|
-
}), null)])]);
|
|
737
|
+
})), null)])]);
|
|
748
738
|
} else {
|
|
749
739
|
return createVNode("div", {
|
|
750
740
|
"class": "_fc-group-container",
|
|
751
741
|
"key": key
|
|
752
742
|
}, [createVNode(Type, mergeProps({
|
|
753
743
|
"key": key
|
|
754
|
-
}, {
|
|
744
|
+
}, _objectSpread2(_objectSpread2({}, _this14.$attrs), {}, {
|
|
755
745
|
disabled: disabled,
|
|
756
746
|
'onUpdate:modelValue': function onUpdateModelValue(formData) {
|
|
757
747
|
return _this14.formData(key, formData);
|
|
758
748
|
},
|
|
759
|
-
'onEmit-event': function onEmitEvent(name) {
|
|
760
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
761
|
-
args[_key2 - 1] = arguments[_key2];
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
return _this14.emitEvent(name, args, index, key);
|
|
765
|
-
},
|
|
766
749
|
'onUpdate:api': function onUpdateApi($f) {
|
|
767
750
|
return _this14.add$f(index, key, $f);
|
|
768
751
|
},
|
|
@@ -771,7 +754,7 @@ var Group = defineComponent({
|
|
|
771
754
|
rule: rule,
|
|
772
755
|
option: options,
|
|
773
756
|
extendOption: true
|
|
774
|
-
}), null), createVNode("div", {
|
|
757
|
+
})), null), createVNode("div", {
|
|
775
758
|
"class": "_fc-group-idx"
|
|
776
759
|
}, [index + 1]), btn.length ? createVNode("div", {
|
|
777
760
|
"class": "_fc-group-handle fc-clock"
|
package/dist/index.esm.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/component-elm-group v3.2.
|
|
2
|
+
* @form-create/component-elm-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
|
-
import{defineComponent as r,markRaw as o,nextTick as e,createVNode as t,mergeProps as n}from"vue";function c(r,o){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);o&&(t=t.filter((function(o){return Object.getOwnPropertyDescriptor(r,o).enumerable}))),e.push.apply(e,t)}return e}function u(r){for(var o=1;o<arguments.length;o++){var e=null!=arguments[o]?arguments[o]:{};o%2?c(Object(e),!0).forEach((function(o){f(r,o,e[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):c(Object(e)).forEach((function(o){Object.defineProperty(r,o,Object.getOwnPropertyDescriptor(e,o))}))}return r}function i(r){return i="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},i(r)}function f(r,o,e){return o in r?Object.defineProperty(r,o,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[o]=e,r}function a(r){return function(r){if(Array.isArray(r))return p(r)}(r)||function(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}(r)||function(r,o){if(!r)return;if("string"==typeof r)return p(r,o);var e=Object.prototype.toString.call(r).slice(8,-1);"Object"===e&&r.constructor&&(e=r.constructor.name);if("Map"===e||"Set"===e)return Array.from(r);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return p(r,o)}(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 p(r,o){(null==o||o>r.length)&&(o=r.length);for(var e=0,t=new Array(o);e<o;e++)t[e]=r[e];return t}var l={type:function(r,o){return Object.prototype.toString.call(r)==="[object "+o+"]"},Undef:function(r){return null==r},Element:function(r){return"object"===i(r)&&null!==r&&1===r.nodeType&&!l.Object(r)},trueArray:function(r){return Array.isArray(r)&&r.length>0},Function:function(r){var o=this.getType(r);return"Function"===o||"AsyncFunction"===o},getType:function(r){var o=Object.prototype.toString.call(r);return/^\[object (.*)\]$/.exec(o)[1]},empty:function(r){return null==r||(!(!Array.isArray(r)||!Array.isArray(r)||r.length)||"string"==typeof r&&!r)}};function d(r,o,e){r[o]=e}function s(r){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=arguments.length>2?arguments[2]:void 0,t=!1;for(var n in o)if(Object.prototype.hasOwnProperty.call(o,n)){var c=o[n];if((t=Array.isArray(c))||l.Object(c)){var u=void 0===r[n];if(t)t=!1,u&&d(r,n,[]);else if(c._clone&&void 0!==e){if(!e){d(r,n,c._clone());continue}c=c.getRule(),u&&d(r,n,{})}else u&&d(r,n,{});r[n]=s(r[n],c,e)}else d(r,n,c),l.Undef(c)||(l.Undef(c.__json)||(r[n].__json=c.__json),l.Undef(c.__origin)||(r[n].__origin=c.__origin))}return void 0!==e&&Array.isArray(r)?r.filter((function(r){return!r||!r.__ctrl})):r}function g(r){return s({},{value:r}).value}["Date","Object","String","Boolean","Array","Number"].forEach((function(r){l[r]=function(o){return l.type(o,r)}}));var h=Object.assign||function(r){for(var o,e=1;e<arguments.length;e++)for(var t in o=arguments[e])Object.prototype.hasOwnProperty.call(o,t)&&d(r,t,o[t]);return r};function _(r){return function(r){return r&&"object"===i(r)&&"function"==typeof r.then}(r)?r:Promise.resolve(r)}!function(r,o){void 0===o&&(o={});var e=o.insertAt;if(r&&"undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===e&&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 b=r({name:"fcGroup",props:{field:String,rule:Array,expand:Number,options:Object,button:{type:Boolean,default:!0},max:{type:Number,default:0},min:{type:Number,default:0},modelValue:{type:Array,default:function(){return[]}},defaultValue:Object,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:o(this.formCreateInject.form.$form())}},emits:["update:modelValue","change","itemMounted","remove","add"],watch:{rule:{handler:function(r,o){var e=this;Object.keys(this.cacheRule).forEach((function(t){var n=e.cacheRule[t];if(n.$f){var c=n.$f.formData();if(r===o)n.$f.deferSyncValue((function(){s(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=g(r)}}}))},deep:!0},expand:function(r){var o=r-this.modelValue.length;o>0&&this.expandRule(o)},modelValue:{handler:function(r){var o=this;r=r||[];var e=this.sort,t=e.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(e[u],r[u])}else{if(n>0)for(var i=0;i<n;i++)this.removeRule(e[t-i-1]);r.forEach((function(t,n){o.setValue(e[n],r[n])}))}},deep:!0}},methods:{_value:function(r){return r&&(o=r,e=this.field,{}.hasOwnProperty.call(o,e))?r[this.field]:r;var o,e},cache:function(r,o){this.cacheValue[r]=JSON.stringify(o)},input:function(r){this.$emit("update:modelValue",r),this.$emit("change",r)},formData:function(r,o){var e=this,t=this.cacheRule,n=this.sort;if(n.filter((function(r){return t[r]&&t[r].$f})).length===n.length){var c=n.map((function(t){var n=r===t?o:u({},e.cacheRule[t].$f.form),c=e.field?n[e.field]||null:n;return e.cache(t,c),c}));this.input(c)}},setValue:function(r,o){var e=this.field;e&&(o=f({},e,this._value(o))),this.cacheValue[r]!==JSON.stringify(e?o[e]:o)&&(this.cacheRule[r].$f&&this.cacheRule[r].$f.coverValue(o),this.cache(r,o))},addRule:function(r,o){var t=this,n=this.formCreateInject.form.copyRules(this.rule||[]),c=this.options?u({},this.options):{submitBtn:!1,resetBtn:!1};if(this.defaultValue){c.formData||(c.formData={});var i=g(this.defaultValue);!function(){h.apply(this,arguments)}(c.formData,this.field?f({},this.field,i):i)}this.parse&&this.parse({rule:n,options:c,index:this.sort.length}),this.cacheRule[++this.len]={rule:n,options:c},this.sort=Object.keys(this.cacheRule),o&&e((function(){return t.$emit("add",n,Object.keys(t.cacheRule).length-1)}))},add$f:function(r,o,t){var n=this;this.cacheRule[o].$f=t,e((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((function(){return t.$emit("remove",n)}))},add:function(r){if(!this.disabled&&!1!==this.onBeforeAdd(this.modelValue)){var o=a(this.modelValue);o.push(this.defaultValue?g(this.defaultValue):this.field?null:{}),this.input(o)}},del:function(r,o){var e=this;if(!this.disabled){var t=function(){e.removeRule(o,!0);var t=a(e.modelValue);t.splice(r,1),e.input(t)};_(this.onBeforeRemove(this.modelValue,r)).then((function(r){!1!==r&&t()}))}},addIcon:function(r){return t("div",{class:"_fc-group-btn _fc-group-plus-minus",onClick:this.add},null)},delIcon:function(r,o){var e=this;return t("div",{class:"_fc-group-btn _fc-group-plus-minus _fc-group-minus",onClick:function(){return e.del(r,o)}},null)},sortUpIcon:function(r){var o=this;return t("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 t("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-down",onClick:function(){return o.changeSort(r,1)}},null)},changeSort:function(r,o){var e=this,t=this.sort[r];this.sort[r]=this.sort[r+o],this.sort[r+o]=t,this.formCreateInject.subForm(this.sort.map((function(r){return e.cacheRule[r].$f}))),this.formData(0)},sortIcon:function(r,o){var e=this,n=r>0,c=r<o-1;return n||c?n&&c?t("div",{class:"_fc-group-btn _fc-group-sort"},[t("div",{class:"_fc-group-sort-up",onClick:function(){return e.changeSort(r,-1)}},null),t("div",{class:"_fc-group-sort-down",onClick:function(){return e.changeSort(r,1)}},null)]):n?this.sortUpIcon(r):c?this.sortDownIcon(r):void 0:null},makeIcon:function(r,o,e){var t=this;if(this.$slots.button)return this.$slots.button({total:r,index:o,vm:this,key:e,del:function(){return t.del(o,e)},add:this.add});var n=[];if((!this.max||r<this.max)&&r===o+1&&n.push(this.addIcon(e)),r>this.min&&n.push(this.delIcon(o,e)),this.sortBtn){var c=this.sortIcon(o,r);c&&n.push(c)}return n},emitEvent:function(r,o,e,t){this.$emit.apply(this,[r].concat(a(o),[this.cacheRule[t].$f,e]))},expandRule:function(r){for(var o=0;o<r;o++)this.modelValue.push(this.field?null:{});this.input(a(this.modelValue))},getTitle:function(r,o){return"function"==typeof this.title?this.title(r,this.modelValue[r],o):"string"==typeof this.title&&this.title.replace("{index}",r+1)}},created:function(){for(var r=(this.expand||0)-this.modelValue.length,o=0;o<this.modelValue.length;o++)this.addRule(o);r>0&&this.expandRule(r)},render:function(){var r=this,o=this.sort,e=this.button,c=this.form,u=this.disabled,i="card"===this.type,a=0===o.length?this.$slots.default?this.$slots.default({vm:this,add:this.add}):t("div",{key:"a_def",class:"_fc-group-plus-minus _fc-group-add fc-clock",onClick:this.add},null):o.map((function(a,p){var l=r.cacheRule[a],d=l.rule,s=l.options,g=e&&!u?r.makeIcon(o.length,p,a):[],h=r.getTitle(p,a);return t("div",{class:"_fc-group-container",key:a},i?[t("div",{class:"_fc-group-header"},[!1===h?t("div",{class:"_fc-group-idx"},[p+1]):null,!1!==h?t("div",{class:"_fc-group-title"},[h]):null,t("div",{class:"_fc-group-handle fc-clock"},[g.length?g:null])]),t("div",{class:"_fc-group-content"},[t(c,n({key:a},{disabled:u,"onUpdate:modelValue":function(o){return r.formData(a,o)},"onEmit-event":function(o){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return r.emitEvent(o,t,p,a)},"onUpdate:api":function(o){return r.add$f(p,a,o)},inFor:!0,modelValue:r.field?f({},r.field,r._value(r.modelValue[p])):r.modelValue[p],rule:d,option:s,extendOption:!0}),null)])]:[t(c,n({key:a},{disabled:u,"onUpdate:modelValue":function(o){return r.formData(a,o)},"onEmit-event":function(o){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return r.emitEvent(o,t,p,a)},"onUpdate:api":function(o){return r.add$f(p,a,o)},inFor:!0,modelValue:r.field?f({},r.field,r._value(r.modelValue[p])):r.modelValue[p],rule:d,option:s,extendOption:!0}),null),t("div",{class:"_fc-group-idx"},[p+1]),g.length?t("div",{class:"_fc-group-handle fc-clock"},[g]):null])}));return t("div",{key:"con",class:"_fc-group "+(u?"_fc-group-disabled":"")+(i?" _fc-group-card":"")},[a])}});export{b as default};
|
|
7
|
+
import{defineComponent as r,markRaw as t,nextTick as e,createVNode as o,mergeProps as n}from"vue";function c(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),e.push.apply(e,o)}return e}function u(r){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?c(Object(e),!0).forEach((function(t){f(r,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):c(Object(e)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}))}return r}function i(r){return i="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},i(r)}function f(r,t,e){return t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function a(r){return function(r){if(Array.isArray(r))return p(r)}(r)||function(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}(r)||function(r,t){if(!r)return;if("string"==typeof r)return p(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);"Object"===e&&r.constructor&&(e=r.constructor.name);if("Map"===e||"Set"===e)return Array.from(r);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return p(r,t)}(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 p(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,o=new Array(t);e<t;e++)o[e]=r[e];return o}var l={type:function(r,t){return Object.prototype.toString.call(r)==="[object "+t+"]"},Undef:function(r){return null==r},Element:function(r){return"object"===i(r)&&null!==r&&1===r.nodeType&&!l.Object(r)},trueArray:function(r){return Array.isArray(r)&&r.length>0},Function:function(r){var t=this.getType(r);return"Function"===t||"AsyncFunction"===t},getType:function(r){var t=Object.prototype.toString.call(r);return/^\[object (.*)\]$/.exec(t)[1]},empty:function(r){return null==r||(!(!Array.isArray(r)||!Array.isArray(r)||r.length)||"string"==typeof r&&!r)}};function d(r,t,e){r[t]=e}function s(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=arguments.length>2?arguments[2]:void 0,o=!1;for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var c=t[n];if((o=Array.isArray(c))||l.Object(c)){var u=void 0===r[n];if(o)o=!1,u&&d(r,n,[]);else if(c._clone&&void 0!==e){if(!e){d(r,n,c._clone());continue}c=c.getRule(),u&&d(r,n,{})}else u&&d(r,n,{});r[n]=s(r[n],c,e)}else d(r,n,c),l.Undef(c)||(l.Undef(c.__json)||(r[n].__json=c.__json),l.Undef(c.__origin)||(r[n].__origin=c.__origin))}return void 0!==e&&Array.isArray(r)?r.filter((function(r){return!r||!r.__ctrl})):r}function g(r){return s({},{value:r}).value}["Date","Object","String","Boolean","Array","Number"].forEach((function(r){l[r]=function(t){return l.type(t,r)}}));var h=Object.assign||function(r){for(var t,e=1;e<arguments.length;e++)for(var o in t=arguments[e])Object.prototype.hasOwnProperty.call(t,o)&&d(r,o,t[o]);return r};function _(r){return function(r){return r&&"object"===i(r)&&"function"==typeof r.then}(r)?r:Promise.resolve(r)}!function(r,t){void 0===t&&(t={});var e=t.insertAt;if(r&&"undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===e&&o.firstChild?o.insertBefore(n,o.firstChild):o.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}}');var b=r({name:"fcGroup",props:{field:String,rule:Array,expand:Number,options:Object,button:{type:Boolean,default:!0},max:{type:Number,default:0},min:{type:Number,default:0},modelValue:{type:Array,default:function(){return[]}},defaultValue:Object,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:t(this.formCreateInject.form.$form())}},emits:["update:modelValue","change","itemMounted","remove","add"],watch:{rule:{handler:function(r,t){var e=this;Object.keys(this.cacheRule).forEach((function(o){var n=e.cacheRule[o];if(n.$f){var c=n.$f.formData();if(r===t)n.$f.deferSyncValue((function(){s(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=g(r)}}}))},deep:!0},expand:function(r){var t=r-this.modelValue.length;t>0&&this.expandRule(t)},modelValue:{handler:function(r){var t=this;r=r||[];var e=this.sort,o=e.length,n=o-r.length;if(n<0){for(var c=n;c<0;c++)this.addRule(r.length+c,!0);for(var u=0;u<o;u++)this.setValue(e[u],r[u])}else{if(n>0)for(var i=0;i<n;i++)this.removeRule(e[o-i-1]);r.forEach((function(o,n){t.setValue(e[n],r[n])}))}},deep:!0}},methods:{_value:function(r){return r&&(t=r,e=this.field,{}.hasOwnProperty.call(t,e))?r[this.field]:r;var t,e},cache:function(r,t){this.cacheValue[r]=JSON.stringify(t)},input:function(r){this.$emit("update:modelValue",r),this.$emit("change",r)},formData:function(r,t){var e=this,o=this.cacheRule,n=this.sort;if(n.filter((function(r){return o[r]&&o[r].$f})).length===n.length){var c=n.map((function(o){var n=r===o?t:u({},e.cacheRule[o].$f.form),c=e.field?n[e.field]||null:n;return e.cache(o,c),c}));this.input(c)}},setValue:function(r,t){var e=this.field;e&&(t=f({},e,this._value(t))),this.cacheValue[r]!==JSON.stringify(e?t[e]:t)&&(this.cacheRule[r].$f&&this.cacheRule[r].$f.coverValue(t),this.cache(r,t))},addRule:function(r,t){var o=this,n=this.formCreateInject.form.copyRules(this.rule||[]),c=this.options?u({},this.options):{submitBtn:!1,resetBtn:!1};if(this.defaultValue){c.formData||(c.formData={});var i=g(this.defaultValue);!function(){h.apply(this,arguments)}(c.formData,this.field?f({},this.field,i):i)}this.parse&&this.parse({rule:n,options:c,index:this.sort.length}),this.cacheRule[++this.len]={rule:n,options:c},this.sort=Object.keys(this.cacheRule),t&&e((function(){return o.$emit("add",n,Object.keys(o.cacheRule).length-1)}))},add$f:function(r,t,o){var n=this;this.cacheRule[t].$f=o,e((function(){n.$emit("itemMounted",o,Object.keys(n.cacheRule).indexOf(t))}))},removeRule:function(r,t){var o=this,n=Object.keys(this.cacheRule).indexOf(r);delete this.cacheRule[r],delete this.cacheValue[r],this.sort=Object.keys(this.cacheRule),t&&e((function(){return o.$emit("remove",n)}))},add:function(r){if(!this.disabled&&!1!==this.onBeforeAdd(this.modelValue)){var t=a(this.modelValue);t.push(this.defaultValue?g(this.defaultValue):this.field?null:{}),this.input(t)}},del:function(r,t){var e=this;if(!this.disabled){var o=function(){e.removeRule(t,!0);var o=a(e.modelValue);o.splice(r,1),e.input(o)};_(this.onBeforeRemove(this.modelValue,r)).then((function(r){!1!==r&&o()}))}},addIcon:function(r){return o("div",{class:"_fc-group-btn _fc-group-plus-minus",onClick:this.add},null)},delIcon:function(r,t){var e=this;return o("div",{class:"_fc-group-btn _fc-group-plus-minus _fc-group-minus",onClick:function(){return e.del(r,t)}},null)},sortUpIcon:function(r){var t=this;return o("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-up",onClick:function(){return t.changeSort(r,-1)}},null)},sortDownIcon:function(r){var t=this;return o("div",{class:"_fc-group-btn _fc-group-arrow _fc-group-down",onClick:function(){return t.changeSort(r,1)}},null)},changeSort:function(r,t){var e=this,o=this.sort[r];this.sort[r]=this.sort[r+t],this.sort[r+t]=o,this.formCreateInject.subForm(this.sort.map((function(r){return e.cacheRule[r].$f}))),this.formData(0)},sortIcon:function(r,t){var e=this,n=r>0,c=r<t-1;return n||c?n&&c?o("div",{class:"_fc-group-btn _fc-group-sort"},[o("div",{class:"_fc-group-sort-up",onClick:function(){return e.changeSort(r,-1)}},null),o("div",{class:"_fc-group-sort-down",onClick:function(){return e.changeSort(r,1)}},null)]):n?this.sortUpIcon(r):c?this.sortDownIcon(r):void 0:null},makeIcon:function(r,t,e){var o=this;if(this.$slots.button)return this.$slots.button({total:r,index:t,vm:this,key:e,del:function(){return o.del(t,e)},add:this.add});var n=[];if((!this.max||r<this.max)&&r===t+1&&n.push(this.addIcon(e)),r>this.min&&n.push(this.delIcon(t,e)),this.sortBtn){var c=this.sortIcon(t,r);c&&n.push(c)}return n},expandRule:function(r){for(var t=0;t<r;t++)this.modelValue.push(this.field?null:{});this.input(a(this.modelValue))},getTitle:function(r,t){return"function"==typeof this.title?this.title(r,this.modelValue[r],t):"string"==typeof this.title&&this.title.replace("{index}",r+1)}},created:function(){for(var r=(this.expand||0)-this.modelValue.length,t=0;t<this.modelValue.length;t++)this.addRule(t);r>0&&this.expandRule(r)},render:function(){var r=this,t=this.sort,e=this.button,c=this.form,i=this.disabled,a="card"===this.type,p=0===t.length?this.$slots.default?this.$slots.default({vm:this,add:this.add}):o("div",{key:"a_def",class:"_fc-group-plus-minus _fc-group-add fc-clock",onClick:this.add},null):t.map((function(p,l){var d=r.cacheRule[p],s=d.rule,g=d.options,h=e&&!i?r.makeIcon(t.length,l,p):[],_=r.getTitle(l,p);return o("div",{class:"_fc-group-container",key:p},a?[o("div",{class:"_fc-group-header"},[!1===_?o("div",{class:"_fc-group-idx"},[l+1]):null,!1!==_?o("div",{class:"_fc-group-title"},[_]):null,o("div",{class:"_fc-group-handle fc-clock"},[h.length?h:null])]),o("div",{class:"_fc-group-content"},[o(c,n({key:p},u(u({},r.$attrs),{},{disabled:i,"onUpdate:modelValue":function(t){return r.formData(p,t)},"onUpdate:api":function(t){return r.add$f(l,p,t)},inFor:!0,modelValue:r.field?f({},r.field,r._value(r.modelValue[l])):r.modelValue[l],rule:s,option:g,extendOption:!0})),null)])]:[o(c,n({key:p},u(u({},r.$attrs),{},{disabled:i,"onUpdate:modelValue":function(t){return r.formData(p,t)},"onUpdate:api":function(t){return r.add$f(l,p,t)},inFor:!0,modelValue:r.field?f({},r.field,r._value(r.modelValue[l])):r.modelValue[l],rule:s,option:g,extendOption:!0})),null),o("div",{class:"_fc-group-idx"},[l+1]),h.length?o("div",{class:"_fc-group-handle fc-clock"},[h]):null])}));return o("div",{key:"con",class:"_fc-group "+(i?"_fc-group-disabled":"")+(a?" _fc-group-card":"")},[p])}});export{b as default};
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/component-elm-group v3.2.
|
|
2
|
+
* @form-create/component-elm-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,7 +253,7 @@
|
|
|
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%}._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}}
|
|
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
259
|
function isPromise(value) {
|
|
@@ -656,9 +656,6 @@
|
|
|
656
656
|
|
|
657
657
|
return btn;
|
|
658
658
|
},
|
|
659
|
-
emitEvent: function emitEvent(name, args, index, key) {
|
|
660
|
-
this.$emit.apply(this, [name].concat(_toConsumableArray(args), [this.cacheRule[key].$f, index]));
|
|
661
|
-
},
|
|
662
659
|
expandRule: function expandRule(n) {
|
|
663
660
|
for (var i = 0; i < n; i++) {
|
|
664
661
|
this.modelValue.push(this.field ? null : {});
|
|
@@ -728,18 +725,11 @@
|
|
|
728
725
|
"class": "_fc-group-content"
|
|
729
726
|
}, [vue.createVNode(Type, vue.mergeProps({
|
|
730
727
|
"key": key
|
|
731
|
-
}, {
|
|
728
|
+
}, _objectSpread2(_objectSpread2({}, _this14.$attrs), {}, {
|
|
732
729
|
disabled: disabled,
|
|
733
730
|
'onUpdate:modelValue': function onUpdateModelValue(formData) {
|
|
734
731
|
return _this14.formData(key, formData);
|
|
735
732
|
},
|
|
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
|
-
}
|
|
740
|
-
|
|
741
|
-
return _this14.emitEvent(name, args, index, key);
|
|
742
|
-
},
|
|
743
733
|
'onUpdate:api': function onUpdateApi($f) {
|
|
744
734
|
return _this14.add$f(index, key, $f);
|
|
745
735
|
},
|
|
@@ -748,25 +738,18 @@
|
|
|
748
738
|
rule: rule,
|
|
749
739
|
option: options,
|
|
750
740
|
extendOption: true
|
|
751
|
-
}), null)])]);
|
|
741
|
+
})), null)])]);
|
|
752
742
|
} else {
|
|
753
743
|
return vue.createVNode("div", {
|
|
754
744
|
"class": "_fc-group-container",
|
|
755
745
|
"key": key
|
|
756
746
|
}, [vue.createVNode(Type, vue.mergeProps({
|
|
757
747
|
"key": key
|
|
758
|
-
}, {
|
|
748
|
+
}, _objectSpread2(_objectSpread2({}, _this14.$attrs), {}, {
|
|
759
749
|
disabled: disabled,
|
|
760
750
|
'onUpdate:modelValue': function onUpdateModelValue(formData) {
|
|
761
751
|
return _this14.formData(key, formData);
|
|
762
752
|
},
|
|
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
753
|
'onUpdate:api': function onUpdateApi($f) {
|
|
771
754
|
return _this14.add$f(index, key, $f);
|
|
772
755
|
},
|
|
@@ -775,7 +758,7 @@
|
|
|
775
758
|
rule: rule,
|
|
776
759
|
option: options,
|
|
777
760
|
extendOption: true
|
|
778
|
-
}), null), vue.createVNode("div", {
|
|
761
|
+
})), null), vue.createVNode("div", {
|
|
779
762
|
"class": "_fc-group-idx"
|
|
780
763
|
}, [index + 1]), btn.length ? vue.createVNode("div", {
|
|
781
764
|
"class": "_fc-group-handle fc-clock"
|
package/dist/index.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/component-elm-group v3.2.
|
|
2
|
+
* @form-create/component-elm-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(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})}));
|
|
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,n=this.button,u=this.form,i=this.disabled,f="card"===this.type,a=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(a,p){var l=e.cacheRule[a],d=l.rule,s=l.options,g=n&&!i?e.makeIcon(t.length,p,a):[],h=e.getTitle(p,a);return f?r.createVNode("div",{class:"_fc-group-container",key:a},[r.createVNode("div",{class:"_fc-group-header"},[!1===h?r.createVNode("div",{class:"_fc-group-idx"},[p+1]):null,!1!==h?r.createVNode("div",{class:"_fc-group-title"},[h]):null,r.createVNode("div",{class:"_fc-group-handle fc-clock"},[g.length?g:null])]),r.createVNode("div",{class:"_fc-group-content"},[r.createVNode(u,r.mergeProps({key:a},o(o({},e.$attrs),{},{disabled:i,"onUpdate:modelValue":function(r){return e.formData(a,r)},"onUpdate:api":function(r){return e.add$f(p,a,r)},inFor:!0,modelValue:e.field?c({},e.field,e._value(e.modelValue[p])):e.modelValue[p],rule:d,option:s,extendOption:!0})),null)])]):r.createVNode("div",{class:"_fc-group-container",key:a},[r.createVNode(u,r.mergeProps({key:a},o(o({},e.$attrs),{},{disabled:i,"onUpdate:modelValue":function(r){return e.formData(a,r)},"onUpdate:api":function(r){return e.add$f(p,a,r)},inFor:!0,modelValue:e.field?c({},e.field,e._value(e.modelValue[p])):e.modelValue[p],rule:d,option:s,extendOption:!0})),null),r.createVNode("div",{class:"_fc-group-idx"},[p+1]),g.length?r.createVNode("div",{class:"_fc-group-handle fc-clock"},[g]):null])}));return r.createVNode("div",{key:"con",class:"_fc-group "+(i?"_fc-group-disabled":"")+(f?" _fc-group-card":"")},[a])}});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-elm-group",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.34",
|
|
4
4
|
"description": "@form-create/element-ui 内置组件",
|
|
5
5
|
"main": "./dist/index.min.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"esm"
|
|
48
48
|
]
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "9ef5ee0cfb9d729c40c62a89be1590daabcf7482"
|
|
51
51
|
}
|
package/src/component.jsx
CHANGED
|
@@ -297,9 +297,6 @@ export default defineComponent({
|
|
|
297
297
|
}
|
|
298
298
|
return btn;
|
|
299
299
|
},
|
|
300
|
-
emitEvent(name, args, index, key) {
|
|
301
|
-
this.$emit(name, ...args, this.cacheRule[key].$f, index);
|
|
302
|
-
},
|
|
303
300
|
expandRule(n) {
|
|
304
301
|
for (let i = 0; i < n; i++) {
|
|
305
302
|
this.modelValue.push(this.field ? null : {});
|
|
@@ -355,9 +352,9 @@ export default defineComponent({
|
|
|
355
352
|
<Type
|
|
356
353
|
key={key}
|
|
357
354
|
{...{
|
|
355
|
+
...this.$attrs,
|
|
358
356
|
disabled,
|
|
359
357
|
'onUpdate:modelValue': (formData) => this.formData(key, formData),
|
|
360
|
-
'onEmit-event': (name, ...args) => this.emitEvent(name, args, index, key),
|
|
361
358
|
'onUpdate:api': ($f) => this.add$f(index, key, $f),
|
|
362
359
|
inFor: true,
|
|
363
360
|
modelValue: this.field ? {[this.field]: this._value(this.modelValue[index])} : this.modelValue[index],
|
|
@@ -373,9 +370,9 @@ export default defineComponent({
|
|
|
373
370
|
<Type
|
|
374
371
|
key={key}
|
|
375
372
|
{...{
|
|
373
|
+
...this.$attrs,
|
|
376
374
|
disabled,
|
|
377
375
|
'onUpdate:modelValue': (formData) => this.formData(key, formData),
|
|
378
|
-
'onEmit-event': (name, ...args) => this.emitEvent(name, args, index, key),
|
|
379
376
|
'onUpdate:api': ($f) => this.add$f(index, key, $f),
|
|
380
377
|
inFor: true,
|
|
381
378
|
modelValue: this.field ? {[this.field]: this._value(this.modelValue[index])} : this.modelValue[index],
|
package/src/style.css
CHANGED
|
@@ -444,52 +444,3 @@
|
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
446
|
|
|
447
|
-
/* 深色模式支持 */
|
|
448
|
-
@media (prefers-color-scheme: dark) {
|
|
449
|
-
._fc-group._fc-group-card ._fc-group-container {
|
|
450
|
-
background: #141414;
|
|
451
|
-
border-color: #303030;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
._fc-group._fc-group-card ._fc-group-container:hover {
|
|
455
|
-
border-color: #434343;
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
._fc-group._fc-group-card ._fc-group-header {
|
|
459
|
-
background: #1f1f1f;
|
|
460
|
-
border-bottom-color: #303030;
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
._fc-group._fc-group-card ._fc-group-title {
|
|
464
|
-
color: rgba(255, 255, 255, 0.85);
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
._fc-group._fc-group-card ._fc-group-btn {
|
|
468
|
-
background: #1f1f1f;
|
|
469
|
-
border-color: #434343;
|
|
470
|
-
color: rgba(255, 255, 255, 0.45);
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
._fc-group._fc-group-card ._fc-group-btn:hover {
|
|
474
|
-
color: #177ddc;
|
|
475
|
-
border-color: #177ddc;
|
|
476
|
-
background: #111b26;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
._fc-group._fc-group-card ._fc-group-content {
|
|
480
|
-
background: #141414;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
._fc-group._fc-group-card ._fc-group-add {
|
|
484
|
-
background: #1f1f1f;
|
|
485
|
-
border-color: #434343;
|
|
486
|
-
color: rgba(255, 255, 255, 0.45);
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
._fc-group._fc-group-card ._fc-group-add:hover {
|
|
490
|
-
background: #111b26;
|
|
491
|
-
border-color: #177ddc;
|
|
492
|
-
color: #177ddc;
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
|