@form-create/component-antdv-group 2.5.17 → 3.0.0-alpha.4

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.
@@ -0,0 +1,493 @@
1
+ /*!
2
+ * @form-create/component-antdv-group v3.0.0-alpha.4
3
+ * (c) 2018-2022 xaboy
4
+ * Github https://github.com/xaboy/form-create with group
5
+ * Released under the MIT License.
6
+ */
7
+ import { defineComponent, markRaw, nextTick, createVNode, resolveComponent, isVNode } from 'vue';
8
+ import { PlusCircleOutlined, MinusCircleOutlined } from '@ant-design/icons-vue';
9
+
10
+ function ownKeys(object, enumerableOnly) {
11
+ var keys = Object.keys(object);
12
+
13
+ if (Object.getOwnPropertySymbols) {
14
+ var symbols = Object.getOwnPropertySymbols(object);
15
+
16
+ if (enumerableOnly) {
17
+ symbols = symbols.filter(function (sym) {
18
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
19
+ });
20
+ }
21
+
22
+ keys.push.apply(keys, symbols);
23
+ }
24
+
25
+ return keys;
26
+ }
27
+
28
+ function _objectSpread2(target) {
29
+ for (var i = 1; i < arguments.length; i++) {
30
+ var source = arguments[i] != null ? arguments[i] : {};
31
+
32
+ if (i % 2) {
33
+ ownKeys(Object(source), true).forEach(function (key) {
34
+ _defineProperty(target, key, source[key]);
35
+ });
36
+ } else if (Object.getOwnPropertyDescriptors) {
37
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
38
+ } else {
39
+ ownKeys(Object(source)).forEach(function (key) {
40
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
41
+ });
42
+ }
43
+ }
44
+
45
+ return target;
46
+ }
47
+
48
+ function _typeof(obj) {
49
+ "@babel/helpers - typeof";
50
+
51
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
52
+ _typeof = function (obj) {
53
+ return typeof obj;
54
+ };
55
+ } else {
56
+ _typeof = function (obj) {
57
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
58
+ };
59
+ }
60
+
61
+ return _typeof(obj);
62
+ }
63
+
64
+ function _defineProperty(obj, key, value) {
65
+ if (key in obj) {
66
+ Object.defineProperty(obj, key, {
67
+ value: value,
68
+ enumerable: true,
69
+ configurable: true,
70
+ writable: true
71
+ });
72
+ } else {
73
+ obj[key] = value;
74
+ }
75
+
76
+ return obj;
77
+ }
78
+
79
+ function _toConsumableArray(arr) {
80
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
81
+ }
82
+
83
+ function _arrayWithoutHoles(arr) {
84
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
85
+ }
86
+
87
+ function _iterableToArray(iter) {
88
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
89
+ }
90
+
91
+ function _unsupportedIterableToArray(o, minLen) {
92
+ if (!o) return;
93
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
94
+ var n = Object.prototype.toString.call(o).slice(8, -1);
95
+ if (n === "Object" && o.constructor) n = o.constructor.name;
96
+ if (n === "Map" || n === "Set") return Array.from(o);
97
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
98
+ }
99
+
100
+ function _arrayLikeToArray(arr, len) {
101
+ if (len == null || len > arr.length) len = arr.length;
102
+
103
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
104
+
105
+ return arr2;
106
+ }
107
+
108
+ function _nonIterableSpread() {
109
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
110
+ }
111
+
112
+ var is = {
113
+ type: function type(arg, _type) {
114
+ return Object.prototype.toString.call(arg) === '[object ' + _type + ']';
115
+ },
116
+ Undef: function Undef(v) {
117
+ return v === undefined || v === null;
118
+ },
119
+ Element: function Element(arg) {
120
+ return _typeof(arg) === 'object' && arg !== null && arg.nodeType === 1 && !is.Object(arg);
121
+ },
122
+ trueArray: function trueArray(data) {
123
+ return Array.isArray(data) && data.length > 0;
124
+ }
125
+ };
126
+ ['Date', 'Object', 'Function', 'String', 'Boolean', 'Array', 'Number'].forEach(function (t) {
127
+ is[t] = function (arg) {
128
+ return is.type(arg, t);
129
+ };
130
+ });
131
+ function hasProperty(rule, k) {
132
+ return {}.hasOwnProperty.call(rule, k);
133
+ }
134
+
135
+ function _isSlot(s) {
136
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
137
+ }
138
+
139
+ var NAME = 'fcGroup';
140
+ var Group = defineComponent({
141
+ name: NAME,
142
+ props: {
143
+ field: String,
144
+ rule: Array,
145
+ expand: Number,
146
+ options: Object,
147
+ button: {
148
+ type: Boolean,
149
+ "default": true
150
+ },
151
+ max: {
152
+ type: Number,
153
+ "default": 0
154
+ },
155
+ min: {
156
+ type: Number,
157
+ "default": 0
158
+ },
159
+ modelValue: {
160
+ type: Array,
161
+ "default": function _default() {
162
+ return [];
163
+ }
164
+ },
165
+ disabled: {
166
+ type: Boolean,
167
+ "default": false
168
+ },
169
+ syncDisabled: {
170
+ type: Boolean,
171
+ "default": true
172
+ },
173
+ fontSize: {
174
+ type: Number,
175
+ "default": 28
176
+ },
177
+ onBeforeRemove: {
178
+ type: Function,
179
+ "default": function _default() {}
180
+ },
181
+ onBeforeAdd: {
182
+ type: Function,
183
+ "default": function _default() {}
184
+ }
185
+ },
186
+ inject: ['formCreateInject'],
187
+ data: function data() {
188
+ return {
189
+ len: 0,
190
+ cacheRule: {},
191
+ cacheValue: {},
192
+ form: markRaw(this.formCreateInject.form.$form())
193
+ };
194
+ },
195
+ emits: ['update:modelValue', 'change', 'itemMounted', 'remove'],
196
+ watch: {
197
+ disabled: function disabled(n) {
198
+ if (this.syncDisabled) {
199
+ var lst = this.cacheRule;
200
+ Object.keys(lst).forEach(function (k) {
201
+ lst[k].$f.disabled(n);
202
+ });
203
+ }
204
+ },
205
+ expand: function expand(n) {
206
+ var d = n - this.modelValue.length;
207
+
208
+ if (d > 0) {
209
+ this.expandRule(d);
210
+ }
211
+ },
212
+ modelValue: {
213
+ handler: function handler(n) {
214
+ var _this = this;
215
+
216
+ n = n || [];
217
+ var keys = Object.keys(this.cacheRule),
218
+ total = keys.length,
219
+ len = total - n.length;
220
+
221
+ if (len < 0) {
222
+ for (var i = len; i < 0; i++) {
223
+ this.addRule(n.length + i);
224
+ }
225
+
226
+ for (var _i = 0; _i < total; _i++) {
227
+ this.setValue(keys[_i], n[_i]);
228
+ }
229
+ } else {
230
+ if (len > 0) {
231
+ for (var _i2 = 0; _i2 < len; _i2++) {
232
+ this.removeRule(keys[total - _i2 - 1]);
233
+ }
234
+
235
+ this.subForm();
236
+ }
237
+
238
+ n.forEach(function (val, i) {
239
+ _this.setValue(keys[i], n[i]);
240
+ });
241
+ }
242
+ },
243
+ deep: true,
244
+ flush: 'post'
245
+ }
246
+ },
247
+ methods: {
248
+ _value: function _value(v) {
249
+ return v && hasProperty(v, this.field) ? v[this.field] : v;
250
+ },
251
+ cache: function cache(k, val) {
252
+ this.cacheValue[k] = JSON.stringify(val);
253
+ },
254
+ input: function input(value) {
255
+ this.$emit('update:modelValue', value);
256
+ this.$emit('change', value);
257
+ },
258
+ formData: function formData(key, _formData) {
259
+ var _this2 = this;
260
+
261
+ var cacheRule = this.cacheRule;
262
+ var keys = Object.keys(cacheRule);
263
+
264
+ if (keys.filter(function (k) {
265
+ return cacheRule[k].$f;
266
+ }).length !== keys.length) {
267
+ return;
268
+ }
269
+
270
+ var value = keys.map(function (k) {
271
+ var data = key === k ? _formData : _objectSpread2({}, _this2.cacheRule[k].$f.form);
272
+ var value = _this2.field ? data[_this2.field] || null : data;
273
+
274
+ _this2.cache(k, value);
275
+
276
+ return value;
277
+ });
278
+ this.input(value);
279
+ },
280
+ setValue: function setValue(key, value) {
281
+ var field = this.field;
282
+
283
+ if (field) {
284
+ value = _defineProperty({}, field, this._value(value));
285
+ }
286
+
287
+ if (this.cacheValue[key] === JSON.stringify(field ? value[field] : value)) {
288
+ return;
289
+ }
290
+
291
+ this.cache(key, value);
292
+ },
293
+ addRule: function addRule(i, emit) {
294
+ var _this3 = this;
295
+
296
+ var rule = this.formCreateInject.form.copyRules(this.rule || []);
297
+ var options = this.options ? _objectSpread2({}, this.options) : {
298
+ submitBtn: false,
299
+ resetBtn: false
300
+ };
301
+ this.cacheRule[++this.len] = {
302
+ rule: rule,
303
+ options: options
304
+ };
305
+
306
+ if (emit) {
307
+ nextTick(function () {
308
+ return _this3.$emit('add', rule, Object.keys(_this3.cacheRule).length - 1);
309
+ });
310
+ }
311
+ },
312
+ add$f: function add$f(i, key, $f) {
313
+ var _this4 = this;
314
+
315
+ this.cacheRule[key].$f = $f;
316
+ this.subForm();
317
+ nextTick(function () {
318
+ if (_this4.syncDisabled) {
319
+ $f.disabled(_this4.disabled);
320
+ }
321
+
322
+ _this4.$emit('itemMounted', $f, Object.keys(_this4.cacheRule).indexOf(key));
323
+ });
324
+ },
325
+ subForm: function subForm() {
326
+ var _this5 = this;
327
+
328
+ this.formCreateInject.subForm(Object.keys(this.cacheRule).map(function (k) {
329
+ return _this5.cacheRule[k].$f;
330
+ }));
331
+ },
332
+ removeRule: function removeRule(key, emit) {
333
+ var _this6 = this;
334
+
335
+ var index = Object.keys(this.cacheRule).indexOf(key);
336
+ delete this.cacheRule[key];
337
+ delete this.cacheValue[key];
338
+
339
+ if (emit) {
340
+ nextTick(function () {
341
+ return _this6.$emit('remove', index);
342
+ });
343
+ }
344
+ },
345
+ add: function add() {
346
+ if (this.disabled || false === this.onBeforeAdd(this.modelValue)) {
347
+ return;
348
+ }
349
+
350
+ this.modelValue.push(this.field ? null : {});
351
+ this.$emit('update:modelValue', this.modelValue);
352
+ },
353
+ del: function del(index, key) {
354
+ if (this.disabled || false === this.onBeforeRemove(this.modelValue, index)) {
355
+ return;
356
+ }
357
+
358
+ this.removeRule(key, true);
359
+ this.subForm();
360
+ this.modelValue.splice(index, 1);
361
+ this.input(this.modelValue);
362
+ },
363
+ addIcon: function addIcon(key) {
364
+ return createVNode(PlusCircleOutlined, {
365
+ "key": "a".concat(key),
366
+ "style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer', ";"),
367
+ "onClick": this.add
368
+ }, null);
369
+ },
370
+ delIcon: function delIcon(index, key) {
371
+ var _this7 = this;
372
+
373
+ return createVNode(MinusCircleOutlined, {
374
+ "key": "d".concat(key),
375
+ "style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer;color:#606266', ";"),
376
+ "onClick": function onClick() {
377
+ return _this7.del(index, key);
378
+ }
379
+ }, null);
380
+ },
381
+ makeIcon: function makeIcon(total, index, key) {
382
+ var _this8 = this;
383
+
384
+ if (this.$slots.button) {
385
+ return this.$slots.button({
386
+ total: total,
387
+ index: index,
388
+ vm: this,
389
+ key: key,
390
+ del: function del() {
391
+ return _this8.del(index, key);
392
+ },
393
+ add: this.add
394
+ });
395
+ }
396
+
397
+ if (index === 0) {
398
+ return [this.max !== 0 && total >= this.max ? null : this.addIcon(key), this.min === 0 || total > this.min ? this.delIcon(index, key) : null];
399
+ }
400
+
401
+ if (index >= this.min) {
402
+ return this.delIcon(index, key);
403
+ }
404
+ },
405
+ emitEvent: function emitEvent(name, args, index, key) {
406
+ this.$emit.apply(this, [name].concat(_toConsumableArray(args), [this.cacheRule[key].$f, index]));
407
+ },
408
+ expandRule: function expandRule(n) {
409
+ for (var i = 0; i < n; i++) {
410
+ this.modelValue.push(this.field ? null : {});
411
+ }
412
+ }
413
+ },
414
+ created: function created() {
415
+ var d = (this.expand || 0) - this.modelValue.length;
416
+
417
+ for (var i = 0; i < this.modelValue.length; i++) {
418
+ this.addRule(i);
419
+ }
420
+
421
+ if (d > 0) {
422
+ this.expandRule(d);
423
+ }
424
+ },
425
+ render: function render() {
426
+ var _this9 = this;
427
+
428
+ var keys = Object.keys(this.cacheRule);
429
+ var button = this.button;
430
+ var Type = this.form;
431
+ return keys.length === 0 ? this.$slots["default"] ? this.$slots["default"]({
432
+ vm: this,
433
+ add: this.add
434
+ }) : createVNode(PlusCircleOutlined, {
435
+ "key": 'a_def',
436
+ "style": "font-size:".concat(this.fontSize, "px;vertical-align:middle;color:").concat(this.disabled ? '#c9cdd4;cursor: not-allowed' : '#606266;cursor:pointer', ";"),
437
+ "onClick": this.add
438
+ }, null) : createVNode("div", {
439
+ "key": 'con'
440
+ }, [keys.map(function (key, index) {
441
+ var _slot;
442
+
443
+ var _this9$cacheRule$key = _this9.cacheRule[key],
444
+ rule = _this9$cacheRule$key.rule,
445
+ options = _this9$cacheRule$key.options;
446
+ return createVNode(resolveComponent("aRow"), {
447
+ "align": "middle",
448
+ "type": "flex",
449
+ "key": key,
450
+ "style": "border-bottom:1px dashed #DCDFE6;margin-bottom:10px;"
451
+ }, {
452
+ "default": function _default() {
453
+ return [createVNode(resolveComponent("aCol"), {
454
+ "span": button ? 20 : 24
455
+ }, {
456
+ "default": function _default() {
457
+ return [createVNode(Type, {
458
+ "key": key,
459
+ "onUpdate:modelValue": function onUpdateModelValue(formData) {
460
+ return _this9.formData(key, formData);
461
+ },
462
+ "modelValue": _this9.field ? _defineProperty({}, _this9.field, _this9._value(_this9.modelValue[index])) : _this9.modelValue[index],
463
+ "onEmit-event": function onEmitEvent(name) {
464
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
465
+ args[_key - 1] = arguments[_key];
466
+ }
467
+
468
+ return _this9.emitEvent(name, args, index, key);
469
+ },
470
+ "onUpdate:api": function onUpdateApi($f) {
471
+ return _this9.add$f(index, key, $f);
472
+ },
473
+ "rule": rule,
474
+ "option": options,
475
+ "extendOption": true
476
+ }, null)];
477
+ }
478
+ }), button ? createVNode(resolveComponent("aCol"), {
479
+ "span": 2,
480
+ "pull": 1,
481
+ "push": 1
482
+ }, _isSlot(_slot = _this9.makeIcon(keys.length, index, key)) ? _slot : {
483
+ "default": function _default() {
484
+ return [_slot];
485
+ }
486
+ }) : null];
487
+ }
488
+ });
489
+ })]);
490
+ }
491
+ });
492
+
493
+ export { Group as default };
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * @form-create/component-antdv-group v3.0.0-alpha.4
3
+ * (c) 2018-2022 xaboy
4
+ * Github https://github.com/xaboy/form-create with group
5
+ * Released under the MIT License.
6
+ */
7
+ import{defineComponent as e,markRaw as t,nextTick as n,createVNode as o,resolveComponent as r,isVNode as i}from"vue";import{PlusCircleOutlined as l,MinusCircleOutlined as u}from"@ant-design/icons-vue";function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){f(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e){return s="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},s(e)}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){return function(e){if(Array.isArray(e))return h(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return h(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return h(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var m={type:function(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"},Undef:function(e){return null==e},Element:function(e){return"object"===s(e)&&null!==e&&1===e.nodeType&&!m.Object(e)},trueArray:function(e){return Array.isArray(e)&&e.length>0}};["Date","Object","Function","String","Boolean","Array","Number"].forEach((function(e){m[e]=function(t){return m.type(t,e)}}));var p=e({name:"fcGroup",props:{field:String,rule:Array,expand:Number,options:Object,button:{type:Boolean,default:!0},max:{type:Number,default:0},min:{type:Number,default:0},modelValue:{type:Array,default:function(){return[]}},disabled:{type:Boolean,default:!1},syncDisabled:{type:Boolean,default:!0},fontSize:{type:Number,default:28},onBeforeRemove:{type:Function,default:function(){}},onBeforeAdd:{type:Function,default:function(){}}},inject:["formCreateInject"],data:function(){return{len:0,cacheRule:{},cacheValue:{},form:t(this.formCreateInject.form.$form())}},emits:["update:modelValue","change","itemMounted","remove"],watch:{disabled:function(e){if(this.syncDisabled){var t=this.cacheRule;Object.keys(t).forEach((function(n){t[n].$f.disabled(e)}))}},expand:function(e){var t=e-this.modelValue.length;t>0&&this.expandRule(t)},modelValue:{handler:function(e){var t=this;e=e||[];var n=Object.keys(this.cacheRule),o=n.length,r=o-e.length;if(r<0){for(var i=r;i<0;i++)this.addRule(e.length+i);for(var l=0;l<o;l++)this.setValue(n[l],e[l])}else{if(r>0){for(var u=0;u<r;u++)this.removeRule(n[o-u-1]);this.subForm()}e.forEach((function(o,r){t.setValue(n[r],e[r])}))}},deep:!0,flush:"post"}},methods:{_value:function(e){return e&&(t=e,n=this.field,{}.hasOwnProperty.call(t,n))?e[this.field]:e;var t,n},cache:function(e,t){this.cacheValue[e]=JSON.stringify(t)},input:function(e){this.$emit("update:modelValue",e),this.$emit("change",e)},formData:function(e,t){var n=this,o=this.cacheRule,r=Object.keys(o);if(r.filter((function(e){return o[e].$f})).length===r.length){var i=r.map((function(o){var r=e===o?t:c({},n.cacheRule[o].$f.form),i=n.field?r[n.field]||null:r;return n.cache(o,i),i}));this.input(i)}},setValue:function(e,t){var n=this.field;n&&(t=f({},n,this._value(t))),this.cacheValue[e]!==JSON.stringify(n?t[n]:t)&&this.cache(e,t)},addRule:function(e,t){var o=this,r=this.formCreateInject.form.copyRules(this.rule||[]),i=this.options?c({},this.options):{submitBtn:!1,resetBtn:!1};this.cacheRule[++this.len]={rule:r,options:i},t&&n((function(){return o.$emit("add",r,Object.keys(o.cacheRule).length-1)}))},add$f:function(e,t,o){var r=this;this.cacheRule[t].$f=o,this.subForm(),n((function(){r.syncDisabled&&o.disabled(r.disabled),r.$emit("itemMounted",o,Object.keys(r.cacheRule).indexOf(t))}))},subForm:function(){var e=this;this.formCreateInject.subForm(Object.keys(this.cacheRule).map((function(t){return e.cacheRule[t].$f})))},removeRule:function(e,t){var o=this,r=Object.keys(this.cacheRule).indexOf(e);delete this.cacheRule[e],delete this.cacheValue[e],t&&n((function(){return o.$emit("remove",r)}))},add:function(){this.disabled||!1===this.onBeforeAdd(this.modelValue)||(this.modelValue.push(this.field?null:{}),this.$emit("update:modelValue",this.modelValue))},del:function(e,t){this.disabled||!1===this.onBeforeRemove(this.modelValue,e)||(this.removeRule(t,!0),this.subForm(),this.modelValue.splice(e,1),this.input(this.modelValue))},addIcon:function(e){return o(l,{key:"a".concat(e),style:"font-size:".concat(this.fontSize,"px;cursor:").concat(this.disabled?"not-allowed;color:#c9cdd4":"pointer",";"),onClick:this.add},null)},delIcon:function(e,t){var n=this;return o(u,{key:"d".concat(t),style:"font-size:".concat(this.fontSize,"px;cursor:").concat(this.disabled?"not-allowed;color:#c9cdd4":"pointer;color:#606266",";"),onClick:function(){return n.del(e,t)}},null)},makeIcon:function(e,t,n){var o=this;return this.$slots.button?this.$slots.button({total:e,index:t,vm:this,key:n,del:function(){return o.del(t,n)},add:this.add}):0===t?[0!==this.max&&e>=this.max?null:this.addIcon(n),0===this.min||e>this.min?this.delIcon(t,n):null]:t>=this.min?this.delIcon(t,n):void 0},emitEvent:function(e,t,n,o){this.$emit.apply(this,[e].concat(d(t),[this.cacheRule[o].$f,n]))},expandRule:function(e){for(var t=0;t<e;t++)this.modelValue.push(this.field?null:{})}},created:function(){for(var e=(this.expand||0)-this.modelValue.length,t=0;t<this.modelValue.length;t++)this.addRule(t);e>0&&this.expandRule(e)},render:function(){var e=this,t=Object.keys(this.cacheRule),n=this.button,u=this.form;return 0===t.length?this.$slots.default?this.$slots.default({vm:this,add:this.add}):o(l,{key:"a_def",style:"font-size:".concat(this.fontSize,"px;vertical-align:middle;color:").concat(this.disabled?"#c9cdd4;cursor: not-allowed":"#606266;cursor:pointer",";"),onClick:this.add},null):o("div",{key:"con"},[t.map((function(l,a){var c,s=e.cacheRule[l],d=s.rule,h=s.options;return o(r("aRow"),{align:"middle",type:"flex",key:l,style:"border-bottom:1px dashed #DCDFE6;margin-bottom:10px;"},{default:function(){return[o(r("aCol"),{span:n?20:24},{default:function(){return[o(u,{key:l,"onUpdate:modelValue":function(t){return e.formData(l,t)},modelValue:e.field?f({},e.field,e._value(e.modelValue[a])):e.modelValue[a],"onEmit-event":function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return e.emitEvent(t,o,a,l)},"onUpdate:api":function(t){return e.add$f(a,l,t)},rule:d,option:h,extendOption:!0},null)]}}),n?o(r("aCol"),{span:2,pull:1,push:1},(s=c=e.makeIcon(t.length,a,l),"function"==typeof s||"[object Object]"===Object.prototype.toString.call(s)&&!i(s)?c:{default:function(){return[c]}})):null];var s}})}))])}});export{p as default};