@form-create/element-ui 3.1.1 → 3.1.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.
- package/auto-import.js +28 -19
- package/dist/form-create.esm.js +631 -165
- package/dist/form-create.esm.min.js +2 -2
- package/dist/form-create.js +630 -164
- package/dist/form-create.min.js +2 -2
- package/package.json +13 -13
- package/src/components/icon/IconWarning.vue +12 -0
- package/src/components/index.js +2 -0
- package/src/core/index.js +3 -0
- package/src/core/manager.js +1 -1
- package/src/core/provider.js +41 -0
package/dist/form-create.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/element-ui v3.1.
|
|
2
|
+
* @form-create/element-ui v3.1.4
|
|
3
3
|
* (c) 2018-2022 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create
|
|
5
5
|
* Released under the MIT License.
|
|
@@ -346,9 +346,124 @@
|
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
-
var css_248z$2 = "._fc-frame ._fc-files img{display:inline-block;height:100%;vertical-align:top;width:100%}._fc-frame ._fc-upload-btn{border:1px dashed #c0ccda}._fc-frame ._fc-upload-cover{background:rgba(0,0,0,.6);bottom:0;left:0;opacity:0;position:absolute;right:0;top:0;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}._fc-frame ._fc-upload-cover i{color:#fff;cursor:pointer;font-size:20px;margin:0 2px}._fc-frame ._fc-files:hover ._fc-upload-cover{opacity:1}._fc-frame .el-upload{display:block}._fc-frame ._fc-upload-
|
|
349
|
+
var css_248z$2 = "._fc-frame ._fc-files img{display:inline-block;height:100%;vertical-align:top;width:100%}._fc-frame ._fc-upload-btn{border:1px dashed #c0ccda;cursor:pointer}._fc-frame ._fc-upload-cover{background:rgba(0,0,0,.6);bottom:0;left:0;opacity:0;position:absolute;right:0;top:0;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}._fc-frame ._fc-upload-cover i{color:#fff;cursor:pointer;font-size:20px;margin:0 2px}._fc-frame ._fc-files:hover ._fc-upload-cover{opacity:1}._fc-frame .el-upload{display:block}._fc-frame ._fc-upload-icon{cursor:pointer}._fc-files,._fc-frame ._fc-upload-btn{background:#fff;border:1px solid #c0ccda;border-radius:4px;-webkit-box-shadow:2px 2px 5px rgba(0,0,0,.1);box-shadow:2px 2px 5px rgba(0,0,0,.1);-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;height:58px;line-height:58px;margin-right:4px;overflow:hidden;position:relative;text-align:center;width:58px}";
|
|
350
350
|
styleInject(css_248z$2);
|
|
351
351
|
|
|
352
|
+
var script$8 = {
|
|
353
|
+
name: 'IconCircleClose'
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
var _hoisted_1$8 = {
|
|
357
|
+
"class": "icon",
|
|
358
|
+
viewBox: "0 0 1024 1024",
|
|
359
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
var _hoisted_2$8 = /*#__PURE__*/vue.createElementVNode("path", {
|
|
363
|
+
fill: "currentColor",
|
|
364
|
+
d: "M466.752 512l-90.496-90.496a32 32 0 0145.248-45.248L512 466.752l90.496-90.496a32 32 0 1145.248 45.248L557.248 512l90.496 90.496a32 32 0 11-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 01-45.248-45.248L466.752 512z"
|
|
365
|
+
}, null, -1);
|
|
366
|
+
|
|
367
|
+
var _hoisted_3$8 = /*#__PURE__*/vue.createElementVNode("path", {
|
|
368
|
+
fill: "currentColor",
|
|
369
|
+
d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"
|
|
370
|
+
}, null, -1);
|
|
371
|
+
|
|
372
|
+
var _hoisted_4$2 = [_hoisted_2$8, _hoisted_3$8];
|
|
373
|
+
function render$8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
374
|
+
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$8, _hoisted_4$2);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
script$8.render = render$8;
|
|
378
|
+
|
|
379
|
+
var script$7 = {
|
|
380
|
+
name: 'IconDocument'
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
var _hoisted_1$7 = {
|
|
384
|
+
"class": "icon",
|
|
385
|
+
viewBox: "0 0 1024 1024",
|
|
386
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
var _hoisted_2$7 = /*#__PURE__*/vue.createElementVNode("path", {
|
|
390
|
+
fill: "currentColor",
|
|
391
|
+
d: "M832 384H576V128H192v768h640V384zm-26.496-64L640 154.496V320h165.504zM160 64h480l256 256v608a32 32 0 01-32 32H160a32 32 0 01-32-32V96a32 32 0 0132-32zm160 448h384v64H320v-64zm0-192h160v64H320v-64zm0 384h384v64H320v-64z"
|
|
392
|
+
}, null, -1);
|
|
393
|
+
|
|
394
|
+
var _hoisted_3$7 = [_hoisted_2$7];
|
|
395
|
+
function render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
396
|
+
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$7, _hoisted_3$7);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
script$7.render = render$7;
|
|
400
|
+
|
|
401
|
+
var script$6 = {
|
|
402
|
+
name: 'IconDelete'
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
var _hoisted_1$6 = {
|
|
406
|
+
"class": "icon",
|
|
407
|
+
viewBox: "0 0 1024 1024",
|
|
408
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
var _hoisted_2$6 = /*#__PURE__*/vue.createElementVNode("path", {
|
|
412
|
+
fill: "currentColor",
|
|
413
|
+
d: "M160 256H96a32 32 0 010-64h256V95.936a32 32 0 0132-32h256a32 32 0 0132 32V192h256a32 32 0 110 64h-64v672a32 32 0 01-32 32H192a32 32 0 01-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 01-32-32V416a32 32 0 0164 0v320a32 32 0 01-32 32zm192 0a32 32 0 01-32-32V416a32 32 0 0164 0v320a32 32 0 01-32 32z"
|
|
414
|
+
}, null, -1);
|
|
415
|
+
|
|
416
|
+
var _hoisted_3$6 = [_hoisted_2$6];
|
|
417
|
+
function render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
418
|
+
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$6, _hoisted_3$6);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
script$6.render = render$6;
|
|
422
|
+
|
|
423
|
+
var script$5 = {
|
|
424
|
+
name: 'IconView'
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
var _hoisted_1$5 = {
|
|
428
|
+
"class": "icon",
|
|
429
|
+
viewBox: "0 0 1024 1024",
|
|
430
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
var _hoisted_2$5 = /*#__PURE__*/vue.createElementVNode("path", {
|
|
434
|
+
fill: "currentColor",
|
|
435
|
+
d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 110 448 224 224 0 010-448zm0 64a160.192 160.192 0 00-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z"
|
|
436
|
+
}, null, -1);
|
|
437
|
+
|
|
438
|
+
var _hoisted_3$5 = [_hoisted_2$5];
|
|
439
|
+
function render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
440
|
+
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$5, _hoisted_3$5);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
script$5.render = render$5;
|
|
444
|
+
|
|
445
|
+
var script$4 = {
|
|
446
|
+
name: 'IconFolderOpened'
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
var _hoisted_1$4 = {
|
|
450
|
+
"class": "icon",
|
|
451
|
+
viewBox: "0 0 1024 1024",
|
|
452
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
var _hoisted_2$4 = /*#__PURE__*/vue.createElementVNode("path", {
|
|
456
|
+
fill: "currentColor",
|
|
457
|
+
d: "M878.08 448H241.92l-96 384h636.16l96-384zM832 384v-64H485.76L357.504 192H128v448l57.92-231.744A32 32 0 01216.96 384H832zm-24.96 512H96a32 32 0 01-32-32V160a32 32 0 0132-32h287.872l128.384 128H864a32 32 0 0132 32v96h23.04a32 32 0 0131.04 39.744l-112 448A32 32 0 01807.04 896z"
|
|
458
|
+
}, null, -1);
|
|
459
|
+
|
|
460
|
+
var _hoisted_3$4 = [_hoisted_2$4];
|
|
461
|
+
function render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
462
|
+
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$4, _hoisted_3$4);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
script$4.render = render$4;
|
|
466
|
+
|
|
352
467
|
function _isSlot$1(s) {
|
|
353
468
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
354
469
|
}
|
|
@@ -376,7 +491,7 @@
|
|
|
376
491
|
},
|
|
377
492
|
icon: {
|
|
378
493
|
type: String,
|
|
379
|
-
"default": '
|
|
494
|
+
"default": 'IconFolderOpened'
|
|
380
495
|
},
|
|
381
496
|
width: {
|
|
382
497
|
type: String,
|
|
@@ -461,6 +576,10 @@
|
|
|
461
576
|
formCreateInject: Object
|
|
462
577
|
},
|
|
463
578
|
emits: ['update:modelValue', 'change'],
|
|
579
|
+
components: {
|
|
580
|
+
IconFolderOpened: script$4,
|
|
581
|
+
IconView: script$5
|
|
582
|
+
},
|
|
464
583
|
data: function data() {
|
|
465
584
|
return {
|
|
466
585
|
fileList: toArray(this.modelValue),
|
|
@@ -519,7 +638,7 @@
|
|
|
519
638
|
}), {
|
|
520
639
|
append: function append() {
|
|
521
640
|
return vue.createVNode(vue.resolveComponent("ElButton"), {
|
|
522
|
-
"icon": _this.icon,
|
|
641
|
+
"icon": vue.resolveComponent(_this.icon),
|
|
523
642
|
"onClick": function onClick() {
|
|
524
643
|
return _this.showModel();
|
|
525
644
|
}
|
|
@@ -527,7 +646,7 @@
|
|
|
527
646
|
},
|
|
528
647
|
suffix: function suffix() {
|
|
529
648
|
return _this.fileList.length ? vue.createVNode(vue.resolveComponent("ElIcon"), {
|
|
530
|
-
"class": "el-input__icon",
|
|
649
|
+
"class": "el-input__icon _fc-upload-icon",
|
|
531
650
|
"onClick": function onClick() {
|
|
532
651
|
_this.fileList = [];
|
|
533
652
|
|
|
@@ -535,7 +654,7 @@
|
|
|
535
654
|
}
|
|
536
655
|
}, {
|
|
537
656
|
"default": function _default() {
|
|
538
|
-
return [vue.createVNode(
|
|
657
|
+
return [vue.createVNode(script$8, null, null)];
|
|
539
658
|
}
|
|
540
659
|
}) : null;
|
|
541
660
|
}
|
|
@@ -584,7 +703,7 @@
|
|
|
584
703
|
makeHandleIcon: function makeHandleIcon(val, index) {
|
|
585
704
|
var _this2 = this;
|
|
586
705
|
|
|
587
|
-
var Type = vue.resolveComponent(this.handleIcon === true || this.handleIcon === undefined ? 'view' : this.handleIcon);
|
|
706
|
+
var Type = vue.resolveComponent(this.handleIcon === true || this.handleIcon === undefined ? 'icon-view' : this.handleIcon);
|
|
588
707
|
return vue.createVNode(vue.resolveComponent("ElIcon"), {
|
|
589
708
|
"onClick": function onClick() {
|
|
590
709
|
return _this2.handleClick(val);
|
|
@@ -606,7 +725,7 @@
|
|
|
606
725
|
"key": '6' + index
|
|
607
726
|
}, {
|
|
608
727
|
"default": function _default() {
|
|
609
|
-
return [vue.createVNode(
|
|
728
|
+
return [vue.createVNode(script$6, null, null)];
|
|
610
729
|
}
|
|
611
730
|
});
|
|
612
731
|
},
|
|
@@ -620,7 +739,7 @@
|
|
|
620
739
|
}
|
|
621
740
|
}, {
|
|
622
741
|
"default": function _default() {
|
|
623
|
-
return [vue.createVNode(
|
|
742
|
+
return [vue.createVNode(script$7, null, null)];
|
|
624
743
|
}
|
|
625
744
|
}), _this4.makeIcons(src, index)]);
|
|
626
745
|
}));
|
|
@@ -680,6 +799,7 @@
|
|
|
680
799
|
try {
|
|
681
800
|
if (this.helper === true) {
|
|
682
801
|
iframe['form_create_helper'] = {
|
|
802
|
+
api: this.formCreateInject.api,
|
|
683
803
|
close: function close(field) {
|
|
684
804
|
_this7.valid(field);
|
|
685
805
|
|
|
@@ -1003,6 +1123,28 @@
|
|
|
1003
1123
|
var css_248z$1 = "._fc-exceed .el-upload{display:none}";
|
|
1004
1124
|
styleInject(css_248z$1);
|
|
1005
1125
|
|
|
1126
|
+
var script$3 = {
|
|
1127
|
+
name: 'IconUpload'
|
|
1128
|
+
};
|
|
1129
|
+
|
|
1130
|
+
var _hoisted_1$3 = {
|
|
1131
|
+
"class": "icon",
|
|
1132
|
+
viewBox: "0 0 1024 1024",
|
|
1133
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1134
|
+
};
|
|
1135
|
+
|
|
1136
|
+
var _hoisted_2$3 = /*#__PURE__*/vue.createElementVNode("path", {
|
|
1137
|
+
fill: "currentColor",
|
|
1138
|
+
d: "M160 832h704a32 32 0 110 64H160a32 32 0 110-64zm384-578.304V704h-64V247.296L237.248 490.048 192 444.8 508.8 128l316.8 316.8-45.312 45.248L544 253.696z"
|
|
1139
|
+
}, null, -1);
|
|
1140
|
+
|
|
1141
|
+
var _hoisted_3$3 = [_hoisted_2$3];
|
|
1142
|
+
function render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1143
|
+
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$3, _hoisted_3$3);
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
script$3.render = render$3;
|
|
1147
|
+
|
|
1006
1148
|
function parseFile(file, i) {
|
|
1007
1149
|
return {
|
|
1008
1150
|
url: file,
|
|
@@ -1097,7 +1239,7 @@
|
|
|
1097
1239
|
"default": function _default() {
|
|
1098
1240
|
return [((_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)) || vue.createVNode(vue.resolveComponent("ElIcon"), null, {
|
|
1099
1241
|
"default": function _default() {
|
|
1100
|
-
return [vue.createVNode(
|
|
1242
|
+
return [vue.createVNode(script$3, null, null)];
|
|
1101
1243
|
}
|
|
1102
1244
|
})];
|
|
1103
1245
|
}
|
|
@@ -1130,9 +1272,28 @@
|
|
|
1130
1272
|
},
|
|
1131
1273
|
trueArray: function trueArray(data) {
|
|
1132
1274
|
return Array.isArray(data) && data.length > 0;
|
|
1275
|
+
},
|
|
1276
|
+
Function: function Function(v) {
|
|
1277
|
+
var type = this.getType(v);
|
|
1278
|
+
return type === 'Function' || type === 'AsyncFunction';
|
|
1279
|
+
},
|
|
1280
|
+
getType: function getType(v) {
|
|
1281
|
+
var str = Object.prototype.toString.call(v);
|
|
1282
|
+
return /^\[object (.*)\]$/.exec(str)[1];
|
|
1283
|
+
},
|
|
1284
|
+
empty: function empty(value) {
|
|
1285
|
+
if (value === undefined || value === null) {
|
|
1286
|
+
return true;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
if (Array.isArray(value) && Array.isArray(value) && !value.length) {
|
|
1290
|
+
return true;
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
return typeof value === 'string' && !value;
|
|
1133
1294
|
}
|
|
1134
1295
|
};
|
|
1135
|
-
['Date', 'Object', '
|
|
1296
|
+
['Date', 'Object', 'String', 'Boolean', 'Array', 'Number'].forEach(function (t) {
|
|
1136
1297
|
is[t] = function (arg) {
|
|
1137
1298
|
return is.type(arg, t);
|
|
1138
1299
|
};
|
|
@@ -1141,6 +1302,140 @@
|
|
|
1141
1302
|
return {}.hasOwnProperty.call(rule, k);
|
|
1142
1303
|
}
|
|
1143
1304
|
|
|
1305
|
+
var script$2 = {
|
|
1306
|
+
name: 'IconCirclePlus'
|
|
1307
|
+
};
|
|
1308
|
+
|
|
1309
|
+
var _hoisted_1$2 = {
|
|
1310
|
+
"class": "icon",
|
|
1311
|
+
viewBox: "0 0 1024 1024",
|
|
1312
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1313
|
+
};
|
|
1314
|
+
|
|
1315
|
+
var _hoisted_2$2 = /*#__PURE__*/vue.createElementVNode("path", {
|
|
1316
|
+
fill: "currentColor",
|
|
1317
|
+
d: "M352 480h320a32 32 0 110 64H352a32 32 0 010-64z"
|
|
1318
|
+
}, null, -1);
|
|
1319
|
+
|
|
1320
|
+
var _hoisted_3$2 = /*#__PURE__*/vue.createElementVNode("path", {
|
|
1321
|
+
fill: "currentColor",
|
|
1322
|
+
d: "M480 672V352a32 32 0 1164 0v320a32 32 0 01-64 0z"
|
|
1323
|
+
}, null, -1);
|
|
1324
|
+
|
|
1325
|
+
var _hoisted_4$1 = /*#__PURE__*/vue.createElementVNode("path", {
|
|
1326
|
+
fill: "currentColor",
|
|
1327
|
+
d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"
|
|
1328
|
+
}, null, -1);
|
|
1329
|
+
|
|
1330
|
+
var _hoisted_5 = [_hoisted_2$2, _hoisted_3$2, _hoisted_4$1];
|
|
1331
|
+
function render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1332
|
+
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$2, _hoisted_5);
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
script$2.render = render$2;
|
|
1336
|
+
|
|
1337
|
+
var script$1 = {
|
|
1338
|
+
name: 'IconRemove'
|
|
1339
|
+
};
|
|
1340
|
+
|
|
1341
|
+
var _hoisted_1$1 = {
|
|
1342
|
+
"class": "icon",
|
|
1343
|
+
viewBox: "0 0 1024 1024",
|
|
1344
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1345
|
+
};
|
|
1346
|
+
|
|
1347
|
+
var _hoisted_2$1 = /*#__PURE__*/vue.createElementVNode("path", {
|
|
1348
|
+
fill: "currentColor",
|
|
1349
|
+
d: "M352 480h320a32 32 0 110 64H352a32 32 0 010-64z"
|
|
1350
|
+
}, null, -1);
|
|
1351
|
+
|
|
1352
|
+
var _hoisted_3$1 = /*#__PURE__*/vue.createElementVNode("path", {
|
|
1353
|
+
fill: "currentColor",
|
|
1354
|
+
d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"
|
|
1355
|
+
}, null, -1);
|
|
1356
|
+
|
|
1357
|
+
var _hoisted_4 = [_hoisted_2$1, _hoisted_3$1];
|
|
1358
|
+
function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1359
|
+
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$1, _hoisted_4);
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
script$1.render = render$1;
|
|
1363
|
+
|
|
1364
|
+
function $set(target, field, value) {
|
|
1365
|
+
target[field] = value;
|
|
1366
|
+
}
|
|
1367
|
+
function $del(target, field) {
|
|
1368
|
+
delete target[field];
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
function deepExtend(origin) {
|
|
1372
|
+
var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1373
|
+
var mode = arguments.length > 2 ? arguments[2] : undefined;
|
|
1374
|
+
var isArr = false;
|
|
1375
|
+
|
|
1376
|
+
for (var key in target) {
|
|
1377
|
+
if (Object.prototype.hasOwnProperty.call(target, key)) {
|
|
1378
|
+
var clone = target[key];
|
|
1379
|
+
|
|
1380
|
+
if ((isArr = Array.isArray(clone)) || is.Object(clone)) {
|
|
1381
|
+
var nst = origin[key] === undefined;
|
|
1382
|
+
|
|
1383
|
+
if (isArr) {
|
|
1384
|
+
isArr = false;
|
|
1385
|
+
nst && $set(origin, key, []);
|
|
1386
|
+
} else if (clone._clone && mode !== undefined) {
|
|
1387
|
+
if (mode) {
|
|
1388
|
+
clone = clone.getRule();
|
|
1389
|
+
nst && $set(origin, key, {});
|
|
1390
|
+
} else {
|
|
1391
|
+
$set(origin, key, clone._clone());
|
|
1392
|
+
continue;
|
|
1393
|
+
}
|
|
1394
|
+
} else {
|
|
1395
|
+
nst && $set(origin, key, {});
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
origin[key] = deepExtend(origin[key], clone, mode);
|
|
1399
|
+
} else {
|
|
1400
|
+
$set(origin, key, clone);
|
|
1401
|
+
|
|
1402
|
+
if (!is.Undef(clone)) {
|
|
1403
|
+
if (!is.Undef(clone.__json)) {
|
|
1404
|
+
origin[key].__json = clone.__json;
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
if (!is.Undef(clone.__origin)) {
|
|
1408
|
+
origin[key].__origin = clone.__origin;
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
return mode !== undefined && Array.isArray(origin) ? origin.filter(function (v) {
|
|
1416
|
+
return !v || !v.__ctrl;
|
|
1417
|
+
}) : origin;
|
|
1418
|
+
}
|
|
1419
|
+
function deepCopy(value) {
|
|
1420
|
+
return deepExtend({}, {
|
|
1421
|
+
value: value
|
|
1422
|
+
}).value;
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
var _extends = Object.assign || function (a) {
|
|
1426
|
+
for (var b, c = 1; c < arguments.length; c++) {
|
|
1427
|
+
for (var d in b = arguments[c], b) {
|
|
1428
|
+
Object.prototype.hasOwnProperty.call(b, d) && $set(a, d, b[d]);
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
return a;
|
|
1433
|
+
};
|
|
1434
|
+
|
|
1435
|
+
function extend() {
|
|
1436
|
+
return _extends.apply(this, arguments);
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1144
1439
|
function _isSlot(s) {
|
|
1145
1440
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
1146
1441
|
}
|
|
@@ -1171,6 +1466,7 @@
|
|
|
1171
1466
|
return [];
|
|
1172
1467
|
}
|
|
1173
1468
|
},
|
|
1469
|
+
defaultValue: Object,
|
|
1174
1470
|
disabled: {
|
|
1175
1471
|
type: Boolean,
|
|
1176
1472
|
"default": false
|
|
@@ -1240,8 +1536,6 @@
|
|
|
1240
1536
|
for (var _i2 = 0; _i2 < len; _i2++) {
|
|
1241
1537
|
this.removeRule(keys[total - _i2 - 1]);
|
|
1242
1538
|
}
|
|
1243
|
-
|
|
1244
|
-
this.subForm();
|
|
1245
1539
|
}
|
|
1246
1540
|
|
|
1247
1541
|
n.forEach(function (val, i) {
|
|
@@ -1249,8 +1543,7 @@
|
|
|
1249
1543
|
});
|
|
1250
1544
|
}
|
|
1251
1545
|
},
|
|
1252
|
-
deep: true
|
|
1253
|
-
flush: 'post'
|
|
1546
|
+
deep: true
|
|
1254
1547
|
}
|
|
1255
1548
|
},
|
|
1256
1549
|
methods: {
|
|
@@ -1307,6 +1600,13 @@
|
|
|
1307
1600
|
submitBtn: false,
|
|
1308
1601
|
resetBtn: false
|
|
1309
1602
|
};
|
|
1603
|
+
|
|
1604
|
+
if (this.defaultValue) {
|
|
1605
|
+
if (!options.formData) options.formData = {};
|
|
1606
|
+
var defVal = deepCopy(this.defaultValue);
|
|
1607
|
+
extend(options.formData, this.field ? _defineProperty({}, this.field, defVal) : defVal);
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1310
1610
|
this.cacheRule[++this.len] = {
|
|
1311
1611
|
rule: rule,
|
|
1312
1612
|
options: options
|
|
@@ -1322,7 +1622,7 @@
|
|
|
1322
1622
|
var _this4 = this;
|
|
1323
1623
|
|
|
1324
1624
|
this.cacheRule[key].$f = $f;
|
|
1325
|
-
this.
|
|
1625
|
+
this.formData(key, $f.formData());
|
|
1326
1626
|
vue.nextTick(function () {
|
|
1327
1627
|
if (_this4.syncDisabled) {
|
|
1328
1628
|
$f.disabled(_this4.disabled);
|
|
@@ -1331,15 +1631,8 @@
|
|
|
1331
1631
|
_this4.$emit('itemMounted', $f, Object.keys(_this4.cacheRule).indexOf(key));
|
|
1332
1632
|
});
|
|
1333
1633
|
},
|
|
1334
|
-
subForm: function subForm() {
|
|
1335
|
-
var _this5 = this;
|
|
1336
|
-
|
|
1337
|
-
this.formCreateInject.subForm(Object.keys(this.cacheRule).map(function (k) {
|
|
1338
|
-
return _this5.cacheRule[k].$f;
|
|
1339
|
-
}));
|
|
1340
|
-
},
|
|
1341
1634
|
removeRule: function removeRule(key, emit) {
|
|
1342
|
-
var
|
|
1635
|
+
var _this5 = this;
|
|
1343
1636
|
|
|
1344
1637
|
var index = Object.keys(this.cacheRule).indexOf(key);
|
|
1345
1638
|
delete this.cacheRule[key];
|
|
@@ -1347,7 +1640,7 @@
|
|
|
1347
1640
|
|
|
1348
1641
|
if (emit) {
|
|
1349
1642
|
vue.nextTick(function () {
|
|
1350
|
-
return
|
|
1643
|
+
return _this5.$emit('remove', index);
|
|
1351
1644
|
});
|
|
1352
1645
|
}
|
|
1353
1646
|
},
|
|
@@ -1365,39 +1658,38 @@
|
|
|
1365
1658
|
}
|
|
1366
1659
|
|
|
1367
1660
|
this.removeRule(key, true);
|
|
1368
|
-
this.subForm();
|
|
1369
1661
|
this.modelValue.splice(index, 1);
|
|
1370
1662
|
this.input(this.modelValue);
|
|
1371
1663
|
},
|
|
1372
1664
|
addIcon: function addIcon(key) {
|
|
1373
|
-
return vue.createVNode(vue.resolveComponent("
|
|
1665
|
+
return vue.createVNode(vue.resolveComponent("ElIcon"), {
|
|
1374
1666
|
"key": "a".concat(key),
|
|
1375
1667
|
"style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer', ";"),
|
|
1376
1668
|
"onClick": this.add
|
|
1377
1669
|
}, {
|
|
1378
1670
|
"default": function _default() {
|
|
1379
|
-
return [vue.createVNode(
|
|
1671
|
+
return [vue.createVNode(script$2, null, null)];
|
|
1380
1672
|
}
|
|
1381
1673
|
});
|
|
1382
1674
|
},
|
|
1383
1675
|
delIcon: function delIcon(index, key) {
|
|
1384
|
-
var
|
|
1676
|
+
var _this6 = this;
|
|
1385
1677
|
|
|
1386
1678
|
return vue.createVNode(vue.resolveComponent("ElIcon"), {
|
|
1387
1679
|
"key": "d".concat(key),
|
|
1388
1680
|
"class": "el-icon-remove-outline",
|
|
1389
1681
|
"style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer;color:#606266', ";"),
|
|
1390
1682
|
"onClick": function onClick() {
|
|
1391
|
-
return
|
|
1683
|
+
return _this6.del(index, key);
|
|
1392
1684
|
}
|
|
1393
1685
|
}, {
|
|
1394
1686
|
"default": function _default() {
|
|
1395
|
-
return [vue.createVNode(
|
|
1687
|
+
return [vue.createVNode(script$1, null, null)];
|
|
1396
1688
|
}
|
|
1397
1689
|
});
|
|
1398
1690
|
},
|
|
1399
1691
|
makeIcon: function makeIcon(total, index, key) {
|
|
1400
|
-
var
|
|
1692
|
+
var _this7 = this;
|
|
1401
1693
|
|
|
1402
1694
|
if (this.$slots.button) {
|
|
1403
1695
|
return this.$slots.button({
|
|
@@ -1406,7 +1698,7 @@
|
|
|
1406
1698
|
vm: this,
|
|
1407
1699
|
key: key,
|
|
1408
1700
|
del: function del() {
|
|
1409
|
-
return
|
|
1701
|
+
return _this7.del(index, key);
|
|
1410
1702
|
},
|
|
1411
1703
|
add: this.add
|
|
1412
1704
|
});
|
|
@@ -1441,7 +1733,7 @@
|
|
|
1441
1733
|
}
|
|
1442
1734
|
},
|
|
1443
1735
|
render: function render() {
|
|
1444
|
-
var
|
|
1736
|
+
var _this8 = this;
|
|
1445
1737
|
|
|
1446
1738
|
var keys = Object.keys(this.cacheRule);
|
|
1447
1739
|
var button = this.button;
|
|
@@ -1449,19 +1741,22 @@
|
|
|
1449
1741
|
return keys.length === 0 ? this.$slots["default"] ? this.$slots["default"]({
|
|
1450
1742
|
vm: this,
|
|
1451
1743
|
add: this.add
|
|
1452
|
-
}) : vue.createVNode("
|
|
1744
|
+
}) : vue.createVNode(vue.resolveComponent("ElIcon"), {
|
|
1453
1745
|
"key": 1,
|
|
1454
|
-
"class": "el-icon-circle-plus-outline",
|
|
1455
1746
|
"style": "font-size:".concat(this.fontSize, "px;vertical-align:middle;color:").concat(this.disabled ? '#c9cdd4;cursor: not-allowed' : '#606266;cursor:pointer', ";"),
|
|
1456
1747
|
"onClick": this.add
|
|
1457
|
-
},
|
|
1748
|
+
}, {
|
|
1749
|
+
"default": function _default() {
|
|
1750
|
+
return [vue.createVNode(script$2, null, null)];
|
|
1751
|
+
}
|
|
1752
|
+
}) : vue.createVNode("div", {
|
|
1458
1753
|
"key": 2
|
|
1459
1754
|
}, [keys.map(function (key, index) {
|
|
1460
1755
|
var _slot;
|
|
1461
1756
|
|
|
1462
|
-
var
|
|
1463
|
-
rule =
|
|
1464
|
-
options =
|
|
1757
|
+
var _this8$cacheRule$key = _this8.cacheRule[key],
|
|
1758
|
+
rule = _this8$cacheRule$key.rule,
|
|
1759
|
+
options = _this8$cacheRule$key.options;
|
|
1465
1760
|
return vue.createVNode(vue.resolveComponent("ElRow"), {
|
|
1466
1761
|
"align": "middle",
|
|
1467
1762
|
"type": "flex",
|
|
@@ -1477,19 +1772,20 @@
|
|
|
1477
1772
|
"default": function _default() {
|
|
1478
1773
|
return [vue.createVNode(Type, {
|
|
1479
1774
|
"key": key,
|
|
1775
|
+
"inFor": true,
|
|
1480
1776
|
"onUpdate:modelValue": function onUpdateModelValue(formData) {
|
|
1481
|
-
return
|
|
1777
|
+
return _this8.formData(key, formData);
|
|
1482
1778
|
},
|
|
1483
|
-
"modelValue":
|
|
1779
|
+
"modelValue": _this8.field ? _defineProperty({}, _this8.field, _this8._value(_this8.modelValue[index])) : _this8.modelValue[index],
|
|
1484
1780
|
"onEmit-event": function onEmitEvent(name) {
|
|
1485
1781
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
1486
1782
|
args[_key - 1] = arguments[_key];
|
|
1487
1783
|
}
|
|
1488
1784
|
|
|
1489
|
-
return
|
|
1785
|
+
return _this8.emitEvent(name, args, index, key);
|
|
1490
1786
|
},
|
|
1491
1787
|
"onUpdate:api": function onUpdateApi($f) {
|
|
1492
|
-
return
|
|
1788
|
+
return _this8.add$f(index, key, $f);
|
|
1493
1789
|
},
|
|
1494
1790
|
"rule": rule,
|
|
1495
1791
|
"option": options,
|
|
@@ -1502,7 +1798,7 @@
|
|
|
1502
1798
|
"span": 2,
|
|
1503
1799
|
"pull": 1,
|
|
1504
1800
|
"push": 1
|
|
1505
|
-
}, _isSlot(_slot =
|
|
1801
|
+
}, _isSlot(_slot = _this8.makeIcon(keys.length, index, key)) ? _slot : {
|
|
1506
1802
|
"default": function _default() {
|
|
1507
1803
|
return [_slot];
|
|
1508
1804
|
}
|
|
@@ -1579,7 +1875,6 @@
|
|
|
1579
1875
|
var _this = this;
|
|
1580
1876
|
|
|
1581
1877
|
this.subApi = api;
|
|
1582
|
-
this.formCreateInject.subForm(api);
|
|
1583
1878
|
vue.nextTick(function () {
|
|
1584
1879
|
_this.syncDisabled && api.disabled(_this.disabled);
|
|
1585
1880
|
|
|
@@ -1601,9 +1896,46 @@
|
|
|
1601
1896
|
}
|
|
1602
1897
|
});
|
|
1603
1898
|
|
|
1604
|
-
var
|
|
1899
|
+
var script = {
|
|
1900
|
+
name: 'IconWarning'
|
|
1901
|
+
};
|
|
1902
|
+
|
|
1903
|
+
var _hoisted_1 = {
|
|
1904
|
+
"class": "icon",
|
|
1905
|
+
viewBox: "0 0 1024 1024",
|
|
1906
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1907
|
+
};
|
|
1908
|
+
|
|
1909
|
+
var _hoisted_2 = /*#__PURE__*/vue.createElementVNode("path", {
|
|
1910
|
+
fill: "currentColor",
|
|
1911
|
+
d: "M512 64a448 448 0 110 896 448 448 0 010-896zm0 832a384 384 0 000-768 384 384 0 000 768zm48-176a48 48 0 11-96 0 48 48 0 0196 0zm-48-464a32 32 0 0132 32v288a32 32 0 01-64 0V288a32 32 0 0132-32z"
|
|
1912
|
+
}, null, -1);
|
|
1913
|
+
|
|
1914
|
+
var _hoisted_3 = [_hoisted_2];
|
|
1915
|
+
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1916
|
+
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1, _hoisted_3);
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
script.render = render;
|
|
1920
|
+
|
|
1921
|
+
var components = [Checkbox, Frame, Radio, Select, Tree, Upload, Group, Sub, script];
|
|
1605
1922
|
|
|
1606
1923
|
var NAME$1 = 'FormCreate';
|
|
1924
|
+
|
|
1925
|
+
var getRuleInject = function getRuleInject(vm, parent) {
|
|
1926
|
+
if (vm === parent) {
|
|
1927
|
+
return;
|
|
1928
|
+
}
|
|
1929
|
+
|
|
1930
|
+
if (vm.ctx.formCreateInject) {
|
|
1931
|
+
return vm.ctx.formCreateInject;
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
if (vm.parent) {
|
|
1935
|
+
return getRuleInject(vm.parent, parent);
|
|
1936
|
+
}
|
|
1937
|
+
};
|
|
1938
|
+
|
|
1607
1939
|
function $FormCreate(FormCreate) {
|
|
1608
1940
|
return vue.defineComponent({
|
|
1609
1941
|
name: NAME$1,
|
|
@@ -1624,7 +1956,12 @@
|
|
|
1624
1956
|
extendOption: Boolean,
|
|
1625
1957
|
modelValue: Object,
|
|
1626
1958
|
api: Object,
|
|
1627
|
-
name: String
|
|
1959
|
+
name: String,
|
|
1960
|
+
subForm: {
|
|
1961
|
+
type: Boolean,
|
|
1962
|
+
"default": true
|
|
1963
|
+
},
|
|
1964
|
+
inFor: Boolean
|
|
1628
1965
|
},
|
|
1629
1966
|
emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync', 'reload', 'repeat-field', 'update'],
|
|
1630
1967
|
render: function render() {
|
|
@@ -1637,7 +1974,9 @@
|
|
|
1637
1974
|
|
|
1638
1975
|
var _toRefs = vue.toRefs(props),
|
|
1639
1976
|
rule = _toRefs.rule,
|
|
1640
|
-
modelValue = _toRefs.modelValue
|
|
1977
|
+
modelValue = _toRefs.modelValue,
|
|
1978
|
+
subForm = _toRefs.subForm,
|
|
1979
|
+
inFor = _toRefs.inFor;
|
|
1641
1980
|
|
|
1642
1981
|
var data = vue.reactive({
|
|
1643
1982
|
ctxInject: {},
|
|
@@ -1649,16 +1988,60 @@
|
|
|
1649
1988
|
});
|
|
1650
1989
|
var fc = new FormCreate(vm);
|
|
1651
1990
|
var fapi = fc.api();
|
|
1991
|
+
var isMore = inFor.value;
|
|
1992
|
+
|
|
1993
|
+
var addSubForm = function addSubForm() {
|
|
1994
|
+
if (parent) {
|
|
1995
|
+
var _inject = getRuleInject(vm, parent);
|
|
1996
|
+
|
|
1997
|
+
if (_inject) {
|
|
1998
|
+
var sub;
|
|
1999
|
+
|
|
2000
|
+
if (isMore) {
|
|
2001
|
+
sub = toArray(_inject.getSubForm());
|
|
2002
|
+
sub.push(fapi);
|
|
2003
|
+
} else {
|
|
2004
|
+
sub = fapi;
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
_inject.subForm(sub);
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
};
|
|
2011
|
+
|
|
2012
|
+
var rmSubForm = function rmSubForm() {
|
|
2013
|
+
var inject = getRuleInject(vm, parent);
|
|
2014
|
+
|
|
2015
|
+
if (inject) {
|
|
2016
|
+
if (isMore) {
|
|
2017
|
+
var sub = toArray(inject.getSubForm());
|
|
2018
|
+
var idx = sub.indexOf(fapi);
|
|
2019
|
+
|
|
2020
|
+
if (idx > -1) {
|
|
2021
|
+
sub.splice(idx, 1);
|
|
2022
|
+
}
|
|
2023
|
+
} else {
|
|
2024
|
+
inject.subForm();
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
};
|
|
2028
|
+
|
|
1652
2029
|
vue.onMounted(function () {
|
|
1653
2030
|
fc.mounted();
|
|
1654
2031
|
});
|
|
1655
2032
|
vue.onBeforeUnmount(function () {
|
|
2033
|
+
rmSubForm();
|
|
1656
2034
|
data.destroyed = true;
|
|
1657
2035
|
fc.unmount();
|
|
1658
2036
|
});
|
|
1659
2037
|
vue.onUpdated(function () {
|
|
1660
2038
|
fc.updated();
|
|
1661
2039
|
});
|
|
2040
|
+
vue.watch(subForm, function (n) {
|
|
2041
|
+
n ? addSubForm() : rmSubForm();
|
|
2042
|
+
}, {
|
|
2043
|
+
immediate: true
|
|
2044
|
+
});
|
|
1662
2045
|
vue.watch(function () {
|
|
1663
2046
|
return _toConsumableArray(rule.value);
|
|
1664
2047
|
}, function (n) {
|
|
@@ -1673,8 +2056,8 @@
|
|
|
1673
2056
|
fapi.refresh();
|
|
1674
2057
|
});
|
|
1675
2058
|
vue.watch(modelValue, function (n) {
|
|
1676
|
-
if (JSON.stringify(n) === data.updateValue) return;
|
|
1677
|
-
fapi.setValue(n);
|
|
2059
|
+
if (JSON.stringify(n || {}) === data.updateValue) return;
|
|
2060
|
+
fapi.setValue(n || {});
|
|
1678
2061
|
}, {
|
|
1679
2062
|
deep: true
|
|
1680
2063
|
});
|
|
@@ -1704,27 +2087,6 @@
|
|
|
1704
2087
|
});
|
|
1705
2088
|
}
|
|
1706
2089
|
|
|
1707
|
-
function $set(target, field, value) {
|
|
1708
|
-
target[field] = value;
|
|
1709
|
-
}
|
|
1710
|
-
function $del(target, field) {
|
|
1711
|
-
delete target[field];
|
|
1712
|
-
}
|
|
1713
|
-
|
|
1714
|
-
var _extends = Object.assign || function (a) {
|
|
1715
|
-
for (var b, c = 1; c < arguments.length; c++) {
|
|
1716
|
-
for (var d in b = arguments[c], b) {
|
|
1717
|
-
Object.prototype.hasOwnProperty.call(b, d) && $set(a, d, b[d]);
|
|
1718
|
-
}
|
|
1719
|
-
}
|
|
1720
|
-
|
|
1721
|
-
return a;
|
|
1722
|
-
};
|
|
1723
|
-
|
|
1724
|
-
function extend() {
|
|
1725
|
-
return _extends.apply(this, arguments);
|
|
1726
|
-
}
|
|
1727
|
-
|
|
1728
2090
|
var normalMerge = ['props'];
|
|
1729
2091
|
var toArrayMerge = ['class', 'style', 'directives'];
|
|
1730
2092
|
var functionalMerge = ['on'];
|
|
@@ -1794,67 +2156,13 @@
|
|
|
1794
2156
|
};
|
|
1795
2157
|
};
|
|
1796
2158
|
|
|
1797
|
-
var keyAttrs = ['type', 'slot', 'emitPrefix', 'value', 'name', 'native', 'hidden', 'display', 'inject', 'options', 'emit', 'link', 'prefix', 'suffix', 'update', 'sync', 'optionsTo', 'key'];
|
|
2159
|
+
var keyAttrs = ['type', 'slot', 'emitPrefix', 'value', 'name', 'native', 'hidden', 'display', 'inject', 'options', 'emit', 'link', 'prefix', 'suffix', 'update', 'sync', 'optionsTo', 'key', 'slotUpdate'];
|
|
1798
2160
|
var arrayAttrs = ['validate', 'children', 'control'];
|
|
1799
2161
|
var normalAttrs = ['effect'];
|
|
1800
2162
|
function attrs() {
|
|
1801
2163
|
return [].concat(keyAttrs, _toConsumableArray(normalMerge), _toConsumableArray(toArrayMerge), _toConsumableArray(functionalMerge), arrayAttrs, normalAttrs);
|
|
1802
2164
|
}
|
|
1803
2165
|
|
|
1804
|
-
function deepExtend(origin) {
|
|
1805
|
-
var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1806
|
-
var mode = arguments.length > 2 ? arguments[2] : undefined;
|
|
1807
|
-
var isArr = false;
|
|
1808
|
-
|
|
1809
|
-
for (var key in target) {
|
|
1810
|
-
if (Object.prototype.hasOwnProperty.call(target, key)) {
|
|
1811
|
-
var clone = target[key];
|
|
1812
|
-
|
|
1813
|
-
if ((isArr = Array.isArray(clone)) || is.Object(clone)) {
|
|
1814
|
-
var nst = origin[key] === undefined;
|
|
1815
|
-
|
|
1816
|
-
if (isArr) {
|
|
1817
|
-
isArr = false;
|
|
1818
|
-
nst && $set(origin, key, []);
|
|
1819
|
-
} else if (clone._clone && mode !== undefined) {
|
|
1820
|
-
if (mode) {
|
|
1821
|
-
clone = clone.getRule();
|
|
1822
|
-
nst && $set(origin, key, {});
|
|
1823
|
-
} else {
|
|
1824
|
-
$set(origin, key, clone._clone());
|
|
1825
|
-
continue;
|
|
1826
|
-
}
|
|
1827
|
-
} else {
|
|
1828
|
-
nst && $set(origin, key, {});
|
|
1829
|
-
}
|
|
1830
|
-
|
|
1831
|
-
origin[key] = deepExtend(origin[key], clone, mode);
|
|
1832
|
-
} else {
|
|
1833
|
-
$set(origin, key, clone);
|
|
1834
|
-
|
|
1835
|
-
if (!is.Undef(clone)) {
|
|
1836
|
-
if (!is.Undef(clone.__json)) {
|
|
1837
|
-
origin[key].__json = clone.__json;
|
|
1838
|
-
}
|
|
1839
|
-
|
|
1840
|
-
if (!is.Undef(clone.__origin)) {
|
|
1841
|
-
origin[key].__origin = clone.__origin;
|
|
1842
|
-
}
|
|
1843
|
-
}
|
|
1844
|
-
}
|
|
1845
|
-
}
|
|
1846
|
-
}
|
|
1847
|
-
|
|
1848
|
-
return mode !== undefined && Array.isArray(origin) ? origin.filter(function (v) {
|
|
1849
|
-
return !v || !v.__ctrl;
|
|
1850
|
-
}) : origin;
|
|
1851
|
-
}
|
|
1852
|
-
function deepCopy(value) {
|
|
1853
|
-
return deepExtend({}, {
|
|
1854
|
-
value: value
|
|
1855
|
-
}).value;
|
|
1856
|
-
}
|
|
1857
|
-
|
|
1858
2166
|
function format(type, msg, rule) {
|
|
1859
2167
|
return "[form-create ".concat(type, "]: ").concat(msg) + (rule ? '\n\nrule: ' + JSON.stringify(rule.getRule ? rule.getRule() : rule) : '');
|
|
1860
2168
|
}
|
|
@@ -2012,14 +2320,14 @@
|
|
|
2012
2320
|
if (!slotBag[slot]) slotBag[slot] = [];
|
|
2013
2321
|
slotBag[slot].push(vnFn);
|
|
2014
2322
|
},
|
|
2015
|
-
getSlot: function getSlot(slot) {
|
|
2323
|
+
getSlot: function getSlot(slot, val) {
|
|
2016
2324
|
slot = slotName(slot);
|
|
2017
2325
|
var children = [];
|
|
2018
2326
|
(slotBag[slot] || []).forEach(function (fn) {
|
|
2019
2327
|
if (Array.isArray(fn)) {
|
|
2020
2328
|
children.push.apply(children, _toConsumableArray(fn));
|
|
2021
2329
|
} else if (is.Function(fn)) {
|
|
2022
|
-
var res = fn();
|
|
2330
|
+
var res = fn.apply(void 0, _toConsumableArray(val || []));
|
|
2023
2331
|
|
|
2024
2332
|
if (Array.isArray(res)) {
|
|
2025
2333
|
children.push.apply(children, _toConsumableArray(res));
|
|
@@ -2038,7 +2346,11 @@
|
|
|
2038
2346
|
var slots = {};
|
|
2039
2347
|
Object.keys(slotBag).forEach(function (k) {
|
|
2040
2348
|
slots[k] = function () {
|
|
2041
|
-
|
|
2349
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2350
|
+
args[_key] = arguments[_key];
|
|
2351
|
+
}
|
|
2352
|
+
|
|
2353
|
+
return _this.getSlot(k, args);
|
|
2042
2354
|
};
|
|
2043
2355
|
});
|
|
2044
2356
|
return slots;
|
|
@@ -2462,6 +2774,25 @@
|
|
|
2462
2774
|
return origin ? ctx.origin : ctx.rule;
|
|
2463
2775
|
}
|
|
2464
2776
|
},
|
|
2777
|
+
setEffect: function setEffect(id, attr, value) {
|
|
2778
|
+
var ctx = h.getCtx(id);
|
|
2779
|
+
|
|
2780
|
+
if (ctx && attr) {
|
|
2781
|
+
if (attr[0] === '$') {
|
|
2782
|
+
attr = attr.substr(1);
|
|
2783
|
+
}
|
|
2784
|
+
|
|
2785
|
+
if (hasProperty(ctx.rule, '$' + attr)) {
|
|
2786
|
+
$set(ctx.rule, '$' + attr, value);
|
|
2787
|
+
}
|
|
2788
|
+
|
|
2789
|
+
if (!hasProperty(ctx.rule, 'effect')) {
|
|
2790
|
+
ctx.rule.effect = {};
|
|
2791
|
+
}
|
|
2792
|
+
|
|
2793
|
+
$set(ctx.rule.effect, attr, value);
|
|
2794
|
+
}
|
|
2795
|
+
},
|
|
2465
2796
|
updateValidate: function updateValidate(id, validate, merge) {
|
|
2466
2797
|
if (merge) {
|
|
2467
2798
|
api.mergeRule(id, {
|
|
@@ -2764,6 +3095,25 @@
|
|
|
2764
3095
|
}
|
|
2765
3096
|
|
|
2766
3097
|
vn = function vn() {
|
|
3098
|
+
for (var _len = arguments.length, slotValue = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3099
|
+
slotValue[_key] = arguments[_key];
|
|
3100
|
+
}
|
|
3101
|
+
|
|
3102
|
+
var inject = {
|
|
3103
|
+
rule: rule,
|
|
3104
|
+
prop: prop,
|
|
3105
|
+
preview: preview,
|
|
3106
|
+
api: _this4.$handle.api,
|
|
3107
|
+
model: prop.model || {},
|
|
3108
|
+
slotValue: slotValue
|
|
3109
|
+
};
|
|
3110
|
+
|
|
3111
|
+
if (slotValue.length && rule.slotUpdate) {
|
|
3112
|
+
invoke(function () {
|
|
3113
|
+
return rule.slotUpdate(inject);
|
|
3114
|
+
});
|
|
3115
|
+
}
|
|
3116
|
+
|
|
2767
3117
|
var children = {};
|
|
2768
3118
|
|
|
2769
3119
|
var _load = ctx.loadChildrenPending();
|
|
@@ -2779,14 +3129,8 @@
|
|
|
2779
3129
|
var _vn;
|
|
2780
3130
|
|
|
2781
3131
|
if (slot) {
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
prop: prop,
|
|
2785
|
-
preview: preview,
|
|
2786
|
-
children: children,
|
|
2787
|
-
api: _this4.$handle.api,
|
|
2788
|
-
model: prop.model || {}
|
|
2789
|
-
});
|
|
3132
|
+
inject.children = children;
|
|
3133
|
+
_vn = slot(inject);
|
|
2790
3134
|
} else {
|
|
2791
3135
|
_vn = preview ? ctx.parser.preview(children, ctx) : ctx.parser.render(children, ctx);
|
|
2792
3136
|
}
|
|
@@ -2865,11 +3209,15 @@
|
|
|
2865
3209
|
subForm: function subForm(_subForm) {
|
|
2866
3210
|
_this6.$handle.addSubForm(ctx, _subForm);
|
|
2867
3211
|
},
|
|
3212
|
+
getSubForm: function getSubForm() {
|
|
3213
|
+
return _this6.$handle.subForm[ctx.id];
|
|
3214
|
+
},
|
|
2868
3215
|
options: [],
|
|
2869
3216
|
children: [],
|
|
2870
3217
|
preview: false,
|
|
2871
3218
|
field: ctx.field,
|
|
2872
|
-
rule: ctx.rule
|
|
3219
|
+
rule: ctx.rule,
|
|
3220
|
+
input: ctx.input
|
|
2873
3221
|
};
|
|
2874
3222
|
}
|
|
2875
3223
|
|
|
@@ -2904,12 +3252,17 @@
|
|
|
2904
3252
|
|
|
2905
3253
|
if (!custom && ctx.input) {
|
|
2906
3254
|
var field = this.getModelField(ctx);
|
|
2907
|
-
|
|
2908
|
-
|
|
3255
|
+
var model = {
|
|
3256
|
+
callback: function callback(value) {
|
|
2909
3257
|
_this7.onInput(ctx, value);
|
|
2910
|
-
}
|
|
2911
|
-
|
|
3258
|
+
},
|
|
3259
|
+
value: this.$handle.getFormData(ctx)
|
|
3260
|
+
};
|
|
3261
|
+
props.push({
|
|
3262
|
+
on: _defineProperty({}, "update:".concat(field), model.callback),
|
|
3263
|
+
props: _defineProperty({}, field, model.value)
|
|
2912
3264
|
});
|
|
3265
|
+
ctx.prop.model = model;
|
|
2913
3266
|
}
|
|
2914
3267
|
|
|
2915
3268
|
mergeProps(props, ctx.prop);
|
|
@@ -3924,7 +4277,7 @@
|
|
|
3924
4277
|
}
|
|
3925
4278
|
},
|
|
3926
4279
|
setFormData: function setFormData(ctx, value) {
|
|
3927
|
-
$set(this.formData, ctx.id, value ===
|
|
4280
|
+
$set(this.formData, ctx.id, value === null ? undefined : value);
|
|
3928
4281
|
},
|
|
3929
4282
|
getFormData: function getFormData(ctx) {
|
|
3930
4283
|
return this.formData[ctx.id];
|
|
@@ -3962,9 +4315,7 @@
|
|
|
3962
4315
|
delete this.appendData[rule.field];
|
|
3963
4316
|
},
|
|
3964
4317
|
addSubForm: function addSubForm(ctx, subForm) {
|
|
3965
|
-
|
|
3966
|
-
this.subForm[ctx.id] = subForm;
|
|
3967
|
-
}
|
|
4318
|
+
this.subForm[ctx.id] = subForm;
|
|
3968
4319
|
},
|
|
3969
4320
|
deferSyncValue: function deferSyncValue(fn, sync) {
|
|
3970
4321
|
if (!this.deferSyncFn) {
|
|
@@ -4143,10 +4494,10 @@
|
|
|
4143
4494
|
watchCtx: function watchCtx(ctx) {
|
|
4144
4495
|
var _this = this;
|
|
4145
4496
|
|
|
4146
|
-
var none = ['field', 'value', 'vm', 'template', 'name', 'config', 'control', 'inject', 'sync', 'payload', 'optionsTo', 'update'];
|
|
4497
|
+
var none = ['field', 'value', 'vm', 'template', 'name', 'config', 'control', 'inject', 'sync', 'payload', 'optionsTo', 'update', 'slotUpdate'];
|
|
4147
4498
|
var all = attrs();
|
|
4148
4499
|
all.filter(function (k) {
|
|
4149
|
-
return k[0] !== '_' && none.indexOf(k) === -1;
|
|
4500
|
+
return k[0] !== '_' && k[0] !== '$' && none.indexOf(k) === -1;
|
|
4150
4501
|
}).forEach(function (key) {
|
|
4151
4502
|
var ref = vue.toRef(ctx.rule, key);
|
|
4152
4503
|
var flag = key === 'children';
|
|
@@ -4351,10 +4702,21 @@
|
|
|
4351
4702
|
watchEffect: function watchEffect(ctx) {
|
|
4352
4703
|
var _this3 = this;
|
|
4353
4704
|
|
|
4705
|
+
var effect = {};
|
|
4354
4706
|
Object.keys(ctx.rule.effect || {}).forEach(function (k) {
|
|
4355
|
-
|
|
4707
|
+
effect[k] = function () {
|
|
4356
4708
|
return ctx.rule.effect[k];
|
|
4357
|
-
}
|
|
4709
|
+
};
|
|
4710
|
+
});
|
|
4711
|
+
Object.keys(ctx.rule).forEach(function (k) {
|
|
4712
|
+
if (k[0] === '$') {
|
|
4713
|
+
effect[k.substr(1)] = function () {
|
|
4714
|
+
return ctx.rule[k];
|
|
4715
|
+
};
|
|
4716
|
+
}
|
|
4717
|
+
});
|
|
4718
|
+
Object.keys(effect).forEach(function (k) {
|
|
4719
|
+
ctx.watch.push(vue.watch(effect[k], function (n) {
|
|
4358
4720
|
_this3.effect(ctx, 'watch', _defineProperty({}, k, n));
|
|
4359
4721
|
}, {
|
|
4360
4722
|
deep: true
|
|
@@ -4378,7 +4740,12 @@
|
|
|
4378
4740
|
}, event);
|
|
4379
4741
|
},
|
|
4380
4742
|
getEffect: function getEffect(rule, name) {
|
|
4381
|
-
if (hasProperty(rule, '
|
|
4743
|
+
if (hasProperty(rule, '$' + name)) {
|
|
4744
|
+
return rule['$' + name];
|
|
4745
|
+
}
|
|
4746
|
+
|
|
4747
|
+
if (hasProperty(rule, 'effect') && hasProperty(rule.effect, name)) return rule.effect[name];
|
|
4748
|
+
return undefined;
|
|
4382
4749
|
},
|
|
4383
4750
|
emitEffect: function emitEffect(_ref, event, append) {
|
|
4384
4751
|
var _this4 = this;
|
|
@@ -4389,7 +4756,13 @@
|
|
|
4389
4756
|
type = _ref.type,
|
|
4390
4757
|
custom = _ref.custom;
|
|
4391
4758
|
if (!type || ['fcFragment', 'fragment'].indexOf(type) > -1) return;
|
|
4392
|
-
var effect = custom ? custom : rule.
|
|
4759
|
+
var effect = custom ? custom : Object.keys(rule).reduce(function (i, k) {
|
|
4760
|
+
if (k[0] === '$') {
|
|
4761
|
+
i[k.substr(1)] = rule[k];
|
|
4762
|
+
}
|
|
4763
|
+
|
|
4764
|
+
return i;
|
|
4765
|
+
}, _objectSpread2({}, rule.effect || {}));
|
|
4393
4766
|
Object.keys(effect).forEach(function (attr) {
|
|
4394
4767
|
var p = _this4.providers[attr];
|
|
4395
4768
|
if (!p || p.input && !input) return;
|
|
@@ -4824,6 +5197,10 @@
|
|
|
4824
5197
|
return true;
|
|
4825
5198
|
}
|
|
4826
5199
|
|
|
5200
|
+
var $provider = {
|
|
5201
|
+
fetch: $fetch
|
|
5202
|
+
};
|
|
5203
|
+
|
|
4827
5204
|
var name$6 = 'html';
|
|
4828
5205
|
var html = {
|
|
4829
5206
|
name: name$6,
|
|
@@ -4883,9 +5260,9 @@
|
|
|
4883
5260
|
var directives = {};
|
|
4884
5261
|
var modelFields = {};
|
|
4885
5262
|
var useApps = [];
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
5263
|
+
|
|
5264
|
+
var providers = _objectSpread2({}, $provider);
|
|
5265
|
+
|
|
4889
5266
|
var maker = makerFactory();
|
|
4890
5267
|
var globalConfig = {
|
|
4891
5268
|
global: {}
|
|
@@ -4895,7 +5272,9 @@
|
|
|
4895
5272
|
exportAttrs(config.attrs || {});
|
|
4896
5273
|
|
|
4897
5274
|
function getApi(name) {
|
|
4898
|
-
|
|
5275
|
+
var val = instance[name];
|
|
5276
|
+
if (Array.isArray(val)) return _toConsumableArray(val);
|
|
5277
|
+
return val;
|
|
4899
5278
|
}
|
|
4900
5279
|
|
|
4901
5280
|
function useApp(fn) {
|
|
@@ -4939,7 +5318,7 @@
|
|
|
4939
5318
|
return components[name];
|
|
4940
5319
|
}
|
|
4941
5320
|
} else {
|
|
4942
|
-
name = toCase(id.name);
|
|
5321
|
+
name = toCase(id.displayName || id.name);
|
|
4943
5322
|
component = id;
|
|
4944
5323
|
}
|
|
4945
5324
|
|
|
@@ -4992,8 +5371,25 @@
|
|
|
4992
5371
|
return vm.$refs.fc.fapi;
|
|
4993
5372
|
}
|
|
4994
5373
|
|
|
4995
|
-
function factory() {
|
|
4996
|
-
|
|
5374
|
+
function factory(inherit) {
|
|
5375
|
+
var _config = _objectSpread2({}, config);
|
|
5376
|
+
|
|
5377
|
+
if (inherit) {
|
|
5378
|
+
_config.inherit = {
|
|
5379
|
+
components: components,
|
|
5380
|
+
parsers: parsers,
|
|
5381
|
+
directives: directives,
|
|
5382
|
+
modelFields: modelFields,
|
|
5383
|
+
providers: providers,
|
|
5384
|
+
useApps: useApps,
|
|
5385
|
+
maker: maker,
|
|
5386
|
+
data: data
|
|
5387
|
+
};
|
|
5388
|
+
} else {
|
|
5389
|
+
delete _config.inherit;
|
|
5390
|
+
}
|
|
5391
|
+
|
|
5392
|
+
return FormCreateFactory(_config);
|
|
4997
5393
|
}
|
|
4998
5394
|
|
|
4999
5395
|
function setModelField(name, field) {
|
|
@@ -5013,6 +5409,7 @@
|
|
|
5013
5409
|
modelFields: modelFields,
|
|
5014
5410
|
rules: vm.props.rule,
|
|
5015
5411
|
name: vm.props.name,
|
|
5412
|
+
inFor: vm.props.inFor,
|
|
5016
5413
|
prop: {
|
|
5017
5414
|
components: components,
|
|
5018
5415
|
directives: directives
|
|
@@ -5039,7 +5436,12 @@
|
|
|
5039
5436
|
this.$handle = new Handler(this);
|
|
5040
5437
|
|
|
5041
5438
|
if (this.name) {
|
|
5042
|
-
|
|
5439
|
+
if (this.inFor) {
|
|
5440
|
+
if (!instance[this.name]) instance[this.name] = [];
|
|
5441
|
+
instance[this.name].push(this.api());
|
|
5442
|
+
} else {
|
|
5443
|
+
instance[this.name] = this.api();
|
|
5444
|
+
}
|
|
5043
5445
|
}
|
|
5044
5446
|
}
|
|
5045
5447
|
|
|
@@ -5107,7 +5509,12 @@
|
|
|
5107
5509
|
},
|
|
5108
5510
|
unmount: function unmount() {
|
|
5109
5511
|
if (this.name) {
|
|
5110
|
-
|
|
5512
|
+
if (this.inFor) {
|
|
5513
|
+
var idx = instance[this.name].indexOf(this.api());
|
|
5514
|
+
instance[this.name].splice(idx, 1);
|
|
5515
|
+
} else {
|
|
5516
|
+
delete instance[this.name];
|
|
5517
|
+
}
|
|
5111
5518
|
}
|
|
5112
5519
|
|
|
5113
5520
|
this.unwatch && this.unwatch();
|
|
@@ -5186,6 +5593,19 @@
|
|
|
5186
5593
|
});
|
|
5187
5594
|
});
|
|
5188
5595
|
parser(html);
|
|
5596
|
+
|
|
5597
|
+
if (config.inherit) {
|
|
5598
|
+
var inherit = config.inherit;
|
|
5599
|
+
inherit.components && extend(components, inherit.components);
|
|
5600
|
+
inherit.parsers && extend(parsers, inherit.parsers);
|
|
5601
|
+
inherit.directives && extend(directives, inherit.directives);
|
|
5602
|
+
inherit.modelFields && extend(modelFields, inherit.modelFields);
|
|
5603
|
+
inherit.providers && extend(providers, inherit.providers);
|
|
5604
|
+
inherit.useApps && extend(useApps, inherit.useApps);
|
|
5605
|
+
inherit.maker && extend(maker, inherit.maker);
|
|
5606
|
+
inherit.data && extend(data, inherit.data);
|
|
5607
|
+
}
|
|
5608
|
+
|
|
5189
5609
|
return create;
|
|
5190
5610
|
}
|
|
5191
5611
|
|
|
@@ -5598,7 +6018,7 @@
|
|
|
5598
6018
|
}, {
|
|
5599
6019
|
"default": function _default() {
|
|
5600
6020
|
return _this4.$r({
|
|
5601
|
-
type: infoProp.icon === true ? 'warning' : infoProp.icon
|
|
6021
|
+
type: infoProp.icon === true ? 'icon-warning' : infoProp.icon
|
|
5602
6022
|
});
|
|
5603
6023
|
}
|
|
5604
6024
|
}, true);
|
|
@@ -5947,11 +6367,57 @@
|
|
|
5947
6367
|
return api;
|
|
5948
6368
|
}
|
|
5949
6369
|
|
|
6370
|
+
var required = {
|
|
6371
|
+
name: 'required',
|
|
6372
|
+
load: function load(inject, rule, api) {
|
|
6373
|
+
var val = parseVa(inject.getValue());
|
|
6374
|
+
|
|
6375
|
+
if (val.required === false) {
|
|
6376
|
+
inject.clearProp();
|
|
6377
|
+
} else {
|
|
6378
|
+
var validate = _objectSpread2(_objectSpread2({}, val), {}, {
|
|
6379
|
+
required: true,
|
|
6380
|
+
validator: function validator(_, v, call) {
|
|
6381
|
+
is.empty(v) ? call(validate.message) : call();
|
|
6382
|
+
}
|
|
6383
|
+
});
|
|
6384
|
+
|
|
6385
|
+
if (!validate.message) {
|
|
6386
|
+
validate.message = rule.title + ' is required';
|
|
6387
|
+
}
|
|
6388
|
+
|
|
6389
|
+
inject.getProp().validate = [validate];
|
|
6390
|
+
}
|
|
6391
|
+
|
|
6392
|
+
api.sync(rule);
|
|
6393
|
+
},
|
|
6394
|
+
watch: function watch() {
|
|
6395
|
+
required.load.apply(required, arguments);
|
|
6396
|
+
}
|
|
6397
|
+
};
|
|
6398
|
+
|
|
6399
|
+
function parseVa(val) {
|
|
6400
|
+
if (is.Boolean(val)) {
|
|
6401
|
+
return {
|
|
6402
|
+
required: val
|
|
6403
|
+
};
|
|
6404
|
+
} else if (is.String(val)) {
|
|
6405
|
+
return {
|
|
6406
|
+
message: val
|
|
6407
|
+
};
|
|
6408
|
+
} else if (!is.Object(val)) {
|
|
6409
|
+
return {};
|
|
6410
|
+
} else {
|
|
6411
|
+
return val;
|
|
6412
|
+
}
|
|
6413
|
+
}
|
|
6414
|
+
|
|
5950
6415
|
function install(FormCreate) {
|
|
5951
6416
|
FormCreate.componentAlias(alias);
|
|
5952
6417
|
components.forEach(function (component) {
|
|
5953
6418
|
FormCreate.component(component.name, component);
|
|
5954
6419
|
});
|
|
6420
|
+
FormCreate.register(required);
|
|
5955
6421
|
parsers.forEach(function (parser) {
|
|
5956
6422
|
FormCreate.parser(parser);
|
|
5957
6423
|
});
|
|
@@ -5969,7 +6435,7 @@
|
|
|
5969
6435
|
function elmFormCreate() {
|
|
5970
6436
|
return FormCreateFactory({
|
|
5971
6437
|
ui: 'element-ui',
|
|
5972
|
-
version: '3.1.
|
|
6438
|
+
version: '3.1.4',
|
|
5973
6439
|
manager: manager,
|
|
5974
6440
|
extendApi: extendApi,
|
|
5975
6441
|
install: install,
|