@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.
@@ -1,10 +1,10 @@
1
1
  /*!
2
- * @form-create/element-ui v3.1.0
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.
6
6
  */
7
- import { defineComponent, toRef, resolveComponent, createVNode, mergeProps as mergeProps$1, isVNode, nextTick, Fragment, markRaw, reactive, getCurrentInstance, provide, inject, toRefs, onMounted, onBeforeUnmount, onUpdated, watch, computed, customRef, withDirectives, resolveDirective, createApp, h, ref } from 'vue';
7
+ import { defineComponent, toRef, resolveComponent, createVNode, mergeProps as mergeProps$1, openBlock, createElementBlock, createElementVNode, isVNode, nextTick, Fragment, markRaw, reactive, getCurrentInstance, provide, inject, toRefs, onMounted, onBeforeUnmount, onUpdated, watch, computed, customRef, withDirectives, resolveDirective, createApp, h, ref } from 'vue';
8
8
 
9
9
  function ownKeys(object, enumerableOnly) {
10
10
  var keys = Object.keys(object);
@@ -342,9 +342,124 @@ function styleInject(css, ref) {
342
342
  }
343
343
  }
344
344
 
345
- 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-btn{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}";
345
+ 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}";
346
346
  styleInject(css_248z$2);
347
347
 
348
+ var script$8 = {
349
+ name: 'IconCircleClose'
350
+ };
351
+
352
+ var _hoisted_1$8 = {
353
+ "class": "icon",
354
+ viewBox: "0 0 1024 1024",
355
+ xmlns: "http://www.w3.org/2000/svg"
356
+ };
357
+
358
+ var _hoisted_2$8 = /*#__PURE__*/createElementVNode("path", {
359
+ fill: "currentColor",
360
+ 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"
361
+ }, null, -1);
362
+
363
+ var _hoisted_3$8 = /*#__PURE__*/createElementVNode("path", {
364
+ fill: "currentColor",
365
+ d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"
366
+ }, null, -1);
367
+
368
+ var _hoisted_4$2 = [_hoisted_2$8, _hoisted_3$8];
369
+ function render$8(_ctx, _cache, $props, $setup, $data, $options) {
370
+ return openBlock(), createElementBlock("svg", _hoisted_1$8, _hoisted_4$2);
371
+ }
372
+
373
+ script$8.render = render$8;
374
+
375
+ var script$7 = {
376
+ name: 'IconDocument'
377
+ };
378
+
379
+ var _hoisted_1$7 = {
380
+ "class": "icon",
381
+ viewBox: "0 0 1024 1024",
382
+ xmlns: "http://www.w3.org/2000/svg"
383
+ };
384
+
385
+ var _hoisted_2$7 = /*#__PURE__*/createElementVNode("path", {
386
+ fill: "currentColor",
387
+ 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"
388
+ }, null, -1);
389
+
390
+ var _hoisted_3$7 = [_hoisted_2$7];
391
+ function render$7(_ctx, _cache, $props, $setup, $data, $options) {
392
+ return openBlock(), createElementBlock("svg", _hoisted_1$7, _hoisted_3$7);
393
+ }
394
+
395
+ script$7.render = render$7;
396
+
397
+ var script$6 = {
398
+ name: 'IconDelete'
399
+ };
400
+
401
+ var _hoisted_1$6 = {
402
+ "class": "icon",
403
+ viewBox: "0 0 1024 1024",
404
+ xmlns: "http://www.w3.org/2000/svg"
405
+ };
406
+
407
+ var _hoisted_2$6 = /*#__PURE__*/createElementVNode("path", {
408
+ fill: "currentColor",
409
+ 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"
410
+ }, null, -1);
411
+
412
+ var _hoisted_3$6 = [_hoisted_2$6];
413
+ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
414
+ return openBlock(), createElementBlock("svg", _hoisted_1$6, _hoisted_3$6);
415
+ }
416
+
417
+ script$6.render = render$6;
418
+
419
+ var script$5 = {
420
+ name: 'IconView'
421
+ };
422
+
423
+ var _hoisted_1$5 = {
424
+ "class": "icon",
425
+ viewBox: "0 0 1024 1024",
426
+ xmlns: "http://www.w3.org/2000/svg"
427
+ };
428
+
429
+ var _hoisted_2$5 = /*#__PURE__*/createElementVNode("path", {
430
+ fill: "currentColor",
431
+ 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"
432
+ }, null, -1);
433
+
434
+ var _hoisted_3$5 = [_hoisted_2$5];
435
+ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
436
+ return openBlock(), createElementBlock("svg", _hoisted_1$5, _hoisted_3$5);
437
+ }
438
+
439
+ script$5.render = render$5;
440
+
441
+ var script$4 = {
442
+ name: 'IconFolderOpened'
443
+ };
444
+
445
+ var _hoisted_1$4 = {
446
+ "class": "icon",
447
+ viewBox: "0 0 1024 1024",
448
+ xmlns: "http://www.w3.org/2000/svg"
449
+ };
450
+
451
+ var _hoisted_2$4 = /*#__PURE__*/createElementVNode("path", {
452
+ fill: "currentColor",
453
+ 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"
454
+ }, null, -1);
455
+
456
+ var _hoisted_3$4 = [_hoisted_2$4];
457
+ function render$4(_ctx, _cache, $props, $setup, $data, $options) {
458
+ return openBlock(), createElementBlock("svg", _hoisted_1$4, _hoisted_3$4);
459
+ }
460
+
461
+ script$4.render = render$4;
462
+
348
463
  function _isSlot$1(s) {
349
464
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
350
465
  }
@@ -372,7 +487,7 @@ var Frame = defineComponent({
372
487
  },
373
488
  icon: {
374
489
  type: String,
375
- "default": 'upload'
490
+ "default": 'IconFolderOpened'
376
491
  },
377
492
  width: {
378
493
  type: String,
@@ -457,6 +572,10 @@ var Frame = defineComponent({
457
572
  formCreateInject: Object
458
573
  },
459
574
  emits: ['update:modelValue', 'change'],
575
+ components: {
576
+ IconFolderOpened: script$4,
577
+ IconView: script$5
578
+ },
460
579
  data: function data() {
461
580
  return {
462
581
  fileList: toArray(this.modelValue),
@@ -515,7 +634,7 @@ var Frame = defineComponent({
515
634
  }), {
516
635
  append: function append() {
517
636
  return createVNode(resolveComponent("ElButton"), {
518
- "icon": _this.icon,
637
+ "icon": resolveComponent(_this.icon),
519
638
  "onClick": function onClick() {
520
639
  return _this.showModel();
521
640
  }
@@ -523,7 +642,7 @@ var Frame = defineComponent({
523
642
  },
524
643
  suffix: function suffix() {
525
644
  return _this.fileList.length ? createVNode(resolveComponent("ElIcon"), {
526
- "class": "el-input__icon",
645
+ "class": "el-input__icon _fc-upload-icon",
527
646
  "onClick": function onClick() {
528
647
  _this.fileList = [];
529
648
 
@@ -531,7 +650,7 @@ var Frame = defineComponent({
531
650
  }
532
651
  }, {
533
652
  "default": function _default() {
534
- return [createVNode(resolveComponent("CircleClose"), null, null)];
653
+ return [createVNode(script$8, null, null)];
535
654
  }
536
655
  }) : null;
537
656
  }
@@ -580,7 +699,7 @@ var Frame = defineComponent({
580
699
  makeHandleIcon: function makeHandleIcon(val, index) {
581
700
  var _this2 = this;
582
701
 
583
- var Type = resolveComponent(this.handleIcon === true || this.handleIcon === undefined ? 'view' : this.handleIcon);
702
+ var Type = resolveComponent(this.handleIcon === true || this.handleIcon === undefined ? 'icon-view' : this.handleIcon);
584
703
  return createVNode(resolveComponent("ElIcon"), {
585
704
  "onClick": function onClick() {
586
705
  return _this2.handleClick(val);
@@ -602,7 +721,7 @@ var Frame = defineComponent({
602
721
  "key": '6' + index
603
722
  }, {
604
723
  "default": function _default() {
605
- return [createVNode(resolveComponent("delete"), null, null)];
724
+ return [createVNode(script$6, null, null)];
606
725
  }
607
726
  });
608
727
  },
@@ -616,7 +735,7 @@ var Frame = defineComponent({
616
735
  }
617
736
  }, {
618
737
  "default": function _default() {
619
- return [createVNode(resolveComponent("document"), null, null)];
738
+ return [createVNode(script$7, null, null)];
620
739
  }
621
740
  }), _this4.makeIcons(src, index)]);
622
741
  }));
@@ -676,6 +795,7 @@ var Frame = defineComponent({
676
795
  try {
677
796
  if (this.helper === true) {
678
797
  iframe['form_create_helper'] = {
798
+ api: this.formCreateInject.api,
679
799
  close: function close(field) {
680
800
  _this7.valid(field);
681
801
 
@@ -999,6 +1119,28 @@ var Tree = defineComponent({
999
1119
  var css_248z$1 = "._fc-exceed .el-upload{display:none}";
1000
1120
  styleInject(css_248z$1);
1001
1121
 
1122
+ var script$3 = {
1123
+ name: 'IconUpload'
1124
+ };
1125
+
1126
+ var _hoisted_1$3 = {
1127
+ "class": "icon",
1128
+ viewBox: "0 0 1024 1024",
1129
+ xmlns: "http://www.w3.org/2000/svg"
1130
+ };
1131
+
1132
+ var _hoisted_2$3 = /*#__PURE__*/createElementVNode("path", {
1133
+ fill: "currentColor",
1134
+ 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"
1135
+ }, null, -1);
1136
+
1137
+ var _hoisted_3$3 = [_hoisted_2$3];
1138
+ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
1139
+ return openBlock(), createElementBlock("svg", _hoisted_1$3, _hoisted_3$3);
1140
+ }
1141
+
1142
+ script$3.render = render$3;
1143
+
1002
1144
  function parseFile(file, i) {
1003
1145
  return {
1004
1146
  url: file,
@@ -1093,7 +1235,7 @@ var Upload = defineComponent({
1093
1235
  "default": function _default() {
1094
1236
  return [((_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)) || createVNode(resolveComponent("ElIcon"), null, {
1095
1237
  "default": function _default() {
1096
- return [createVNode(resolveComponent("upload"), null, null)];
1238
+ return [createVNode(script$3, null, null)];
1097
1239
  }
1098
1240
  })];
1099
1241
  }
@@ -1126,9 +1268,28 @@ var is = {
1126
1268
  },
1127
1269
  trueArray: function trueArray(data) {
1128
1270
  return Array.isArray(data) && data.length > 0;
1271
+ },
1272
+ Function: function Function(v) {
1273
+ var type = this.getType(v);
1274
+ return type === 'Function' || type === 'AsyncFunction';
1275
+ },
1276
+ getType: function getType(v) {
1277
+ var str = Object.prototype.toString.call(v);
1278
+ return /^\[object (.*)\]$/.exec(str)[1];
1279
+ },
1280
+ empty: function empty(value) {
1281
+ if (value === undefined || value === null) {
1282
+ return true;
1283
+ }
1284
+
1285
+ if (Array.isArray(value) && Array.isArray(value) && !value.length) {
1286
+ return true;
1287
+ }
1288
+
1289
+ return typeof value === 'string' && !value;
1129
1290
  }
1130
1291
  };
1131
- ['Date', 'Object', 'Function', 'String', 'Boolean', 'Array', 'Number'].forEach(function (t) {
1292
+ ['Date', 'Object', 'String', 'Boolean', 'Array', 'Number'].forEach(function (t) {
1132
1293
  is[t] = function (arg) {
1133
1294
  return is.type(arg, t);
1134
1295
  };
@@ -1137,6 +1298,140 @@ function hasProperty(rule, k) {
1137
1298
  return {}.hasOwnProperty.call(rule, k);
1138
1299
  }
1139
1300
 
1301
+ var script$2 = {
1302
+ name: 'IconCirclePlus'
1303
+ };
1304
+
1305
+ var _hoisted_1$2 = {
1306
+ "class": "icon",
1307
+ viewBox: "0 0 1024 1024",
1308
+ xmlns: "http://www.w3.org/2000/svg"
1309
+ };
1310
+
1311
+ var _hoisted_2$2 = /*#__PURE__*/createElementVNode("path", {
1312
+ fill: "currentColor",
1313
+ d: "M352 480h320a32 32 0 110 64H352a32 32 0 010-64z"
1314
+ }, null, -1);
1315
+
1316
+ var _hoisted_3$2 = /*#__PURE__*/createElementVNode("path", {
1317
+ fill: "currentColor",
1318
+ d: "M480 672V352a32 32 0 1164 0v320a32 32 0 01-64 0z"
1319
+ }, null, -1);
1320
+
1321
+ var _hoisted_4$1 = /*#__PURE__*/createElementVNode("path", {
1322
+ fill: "currentColor",
1323
+ d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"
1324
+ }, null, -1);
1325
+
1326
+ var _hoisted_5 = [_hoisted_2$2, _hoisted_3$2, _hoisted_4$1];
1327
+ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
1328
+ return openBlock(), createElementBlock("svg", _hoisted_1$2, _hoisted_5);
1329
+ }
1330
+
1331
+ script$2.render = render$2;
1332
+
1333
+ var script$1 = {
1334
+ name: 'IconRemove'
1335
+ };
1336
+
1337
+ var _hoisted_1$1 = {
1338
+ "class": "icon",
1339
+ viewBox: "0 0 1024 1024",
1340
+ xmlns: "http://www.w3.org/2000/svg"
1341
+ };
1342
+
1343
+ var _hoisted_2$1 = /*#__PURE__*/createElementVNode("path", {
1344
+ fill: "currentColor",
1345
+ d: "M352 480h320a32 32 0 110 64H352a32 32 0 010-64z"
1346
+ }, null, -1);
1347
+
1348
+ var _hoisted_3$1 = /*#__PURE__*/createElementVNode("path", {
1349
+ fill: "currentColor",
1350
+ d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"
1351
+ }, null, -1);
1352
+
1353
+ var _hoisted_4 = [_hoisted_2$1, _hoisted_3$1];
1354
+ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
1355
+ return openBlock(), createElementBlock("svg", _hoisted_1$1, _hoisted_4);
1356
+ }
1357
+
1358
+ script$1.render = render$1;
1359
+
1360
+ function $set(target, field, value) {
1361
+ target[field] = value;
1362
+ }
1363
+ function $del(target, field) {
1364
+ delete target[field];
1365
+ }
1366
+
1367
+ function deepExtend(origin) {
1368
+ var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1369
+ var mode = arguments.length > 2 ? arguments[2] : undefined;
1370
+ var isArr = false;
1371
+
1372
+ for (var key in target) {
1373
+ if (Object.prototype.hasOwnProperty.call(target, key)) {
1374
+ var clone = target[key];
1375
+
1376
+ if ((isArr = Array.isArray(clone)) || is.Object(clone)) {
1377
+ var nst = origin[key] === undefined;
1378
+
1379
+ if (isArr) {
1380
+ isArr = false;
1381
+ nst && $set(origin, key, []);
1382
+ } else if (clone._clone && mode !== undefined) {
1383
+ if (mode) {
1384
+ clone = clone.getRule();
1385
+ nst && $set(origin, key, {});
1386
+ } else {
1387
+ $set(origin, key, clone._clone());
1388
+ continue;
1389
+ }
1390
+ } else {
1391
+ nst && $set(origin, key, {});
1392
+ }
1393
+
1394
+ origin[key] = deepExtend(origin[key], clone, mode);
1395
+ } else {
1396
+ $set(origin, key, clone);
1397
+
1398
+ if (!is.Undef(clone)) {
1399
+ if (!is.Undef(clone.__json)) {
1400
+ origin[key].__json = clone.__json;
1401
+ }
1402
+
1403
+ if (!is.Undef(clone.__origin)) {
1404
+ origin[key].__origin = clone.__origin;
1405
+ }
1406
+ }
1407
+ }
1408
+ }
1409
+ }
1410
+
1411
+ return mode !== undefined && Array.isArray(origin) ? origin.filter(function (v) {
1412
+ return !v || !v.__ctrl;
1413
+ }) : origin;
1414
+ }
1415
+ function deepCopy(value) {
1416
+ return deepExtend({}, {
1417
+ value: value
1418
+ }).value;
1419
+ }
1420
+
1421
+ var _extends = Object.assign || function (a) {
1422
+ for (var b, c = 1; c < arguments.length; c++) {
1423
+ for (var d in b = arguments[c], b) {
1424
+ Object.prototype.hasOwnProperty.call(b, d) && $set(a, d, b[d]);
1425
+ }
1426
+ }
1427
+
1428
+ return a;
1429
+ };
1430
+
1431
+ function extend() {
1432
+ return _extends.apply(this, arguments);
1433
+ }
1434
+
1140
1435
  function _isSlot(s) {
1141
1436
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
1142
1437
  }
@@ -1167,6 +1462,7 @@ var Group = defineComponent({
1167
1462
  return [];
1168
1463
  }
1169
1464
  },
1465
+ defaultValue: Object,
1170
1466
  disabled: {
1171
1467
  type: Boolean,
1172
1468
  "default": false
@@ -1236,8 +1532,6 @@ var Group = defineComponent({
1236
1532
  for (var _i2 = 0; _i2 < len; _i2++) {
1237
1533
  this.removeRule(keys[total - _i2 - 1]);
1238
1534
  }
1239
-
1240
- this.subForm();
1241
1535
  }
1242
1536
 
1243
1537
  n.forEach(function (val, i) {
@@ -1245,8 +1539,7 @@ var Group = defineComponent({
1245
1539
  });
1246
1540
  }
1247
1541
  },
1248
- deep: true,
1249
- flush: 'post'
1542
+ deep: true
1250
1543
  }
1251
1544
  },
1252
1545
  methods: {
@@ -1303,6 +1596,13 @@ var Group = defineComponent({
1303
1596
  submitBtn: false,
1304
1597
  resetBtn: false
1305
1598
  };
1599
+
1600
+ if (this.defaultValue) {
1601
+ if (!options.formData) options.formData = {};
1602
+ var defVal = deepCopy(this.defaultValue);
1603
+ extend(options.formData, this.field ? _defineProperty({}, this.field, defVal) : defVal);
1604
+ }
1605
+
1306
1606
  this.cacheRule[++this.len] = {
1307
1607
  rule: rule,
1308
1608
  options: options
@@ -1318,7 +1618,7 @@ var Group = defineComponent({
1318
1618
  var _this4 = this;
1319
1619
 
1320
1620
  this.cacheRule[key].$f = $f;
1321
- this.subForm();
1621
+ this.formData(key, $f.formData());
1322
1622
  nextTick(function () {
1323
1623
  if (_this4.syncDisabled) {
1324
1624
  $f.disabled(_this4.disabled);
@@ -1327,15 +1627,8 @@ var Group = defineComponent({
1327
1627
  _this4.$emit('itemMounted', $f, Object.keys(_this4.cacheRule).indexOf(key));
1328
1628
  });
1329
1629
  },
1330
- subForm: function subForm() {
1331
- var _this5 = this;
1332
-
1333
- this.formCreateInject.subForm(Object.keys(this.cacheRule).map(function (k) {
1334
- return _this5.cacheRule[k].$f;
1335
- }));
1336
- },
1337
1630
  removeRule: function removeRule(key, emit) {
1338
- var _this6 = this;
1631
+ var _this5 = this;
1339
1632
 
1340
1633
  var index = Object.keys(this.cacheRule).indexOf(key);
1341
1634
  delete this.cacheRule[key];
@@ -1343,7 +1636,7 @@ var Group = defineComponent({
1343
1636
 
1344
1637
  if (emit) {
1345
1638
  nextTick(function () {
1346
- return _this6.$emit('remove', index);
1639
+ return _this5.$emit('remove', index);
1347
1640
  });
1348
1641
  }
1349
1642
  },
@@ -1361,39 +1654,38 @@ var Group = defineComponent({
1361
1654
  }
1362
1655
 
1363
1656
  this.removeRule(key, true);
1364
- this.subForm();
1365
1657
  this.modelValue.splice(index, 1);
1366
1658
  this.input(this.modelValue);
1367
1659
  },
1368
1660
  addIcon: function addIcon(key) {
1369
- return createVNode(resolveComponent("el-icon"), {
1661
+ return createVNode(resolveComponent("ElIcon"), {
1370
1662
  "key": "a".concat(key),
1371
1663
  "style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer', ";"),
1372
1664
  "onClick": this.add
1373
1665
  }, {
1374
1666
  "default": function _default() {
1375
- return [createVNode(resolveComponent("circle-plus"), null, null)];
1667
+ return [createVNode(script$2, null, null)];
1376
1668
  }
1377
1669
  });
1378
1670
  },
1379
1671
  delIcon: function delIcon(index, key) {
1380
- var _this7 = this;
1672
+ var _this6 = this;
1381
1673
 
1382
1674
  return createVNode(resolveComponent("ElIcon"), {
1383
1675
  "key": "d".concat(key),
1384
1676
  "class": "el-icon-remove-outline",
1385
1677
  "style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer;color:#606266', ";"),
1386
1678
  "onClick": function onClick() {
1387
- return _this7.del(index, key);
1679
+ return _this6.del(index, key);
1388
1680
  }
1389
1681
  }, {
1390
1682
  "default": function _default() {
1391
- return [createVNode(resolveComponent("remove"), null, null)];
1683
+ return [createVNode(script$1, null, null)];
1392
1684
  }
1393
1685
  });
1394
1686
  },
1395
1687
  makeIcon: function makeIcon(total, index, key) {
1396
- var _this8 = this;
1688
+ var _this7 = this;
1397
1689
 
1398
1690
  if (this.$slots.button) {
1399
1691
  return this.$slots.button({
@@ -1402,7 +1694,7 @@ var Group = defineComponent({
1402
1694
  vm: this,
1403
1695
  key: key,
1404
1696
  del: function del() {
1405
- return _this8.del(index, key);
1697
+ return _this7.del(index, key);
1406
1698
  },
1407
1699
  add: this.add
1408
1700
  });
@@ -1437,7 +1729,7 @@ var Group = defineComponent({
1437
1729
  }
1438
1730
  },
1439
1731
  render: function render() {
1440
- var _this9 = this;
1732
+ var _this8 = this;
1441
1733
 
1442
1734
  var keys = Object.keys(this.cacheRule);
1443
1735
  var button = this.button;
@@ -1445,19 +1737,22 @@ var Group = defineComponent({
1445
1737
  return keys.length === 0 ? this.$slots["default"] ? this.$slots["default"]({
1446
1738
  vm: this,
1447
1739
  add: this.add
1448
- }) : createVNode("i", {
1740
+ }) : createVNode(resolveComponent("ElIcon"), {
1449
1741
  "key": 1,
1450
- "class": "el-icon-circle-plus-outline",
1451
1742
  "style": "font-size:".concat(this.fontSize, "px;vertical-align:middle;color:").concat(this.disabled ? '#c9cdd4;cursor: not-allowed' : '#606266;cursor:pointer', ";"),
1452
1743
  "onClick": this.add
1453
- }, null) : createVNode("div", {
1744
+ }, {
1745
+ "default": function _default() {
1746
+ return [createVNode(script$2, null, null)];
1747
+ }
1748
+ }) : createVNode("div", {
1454
1749
  "key": 2
1455
1750
  }, [keys.map(function (key, index) {
1456
1751
  var _slot;
1457
1752
 
1458
- var _this9$cacheRule$key = _this9.cacheRule[key],
1459
- rule = _this9$cacheRule$key.rule,
1460
- options = _this9$cacheRule$key.options;
1753
+ var _this8$cacheRule$key = _this8.cacheRule[key],
1754
+ rule = _this8$cacheRule$key.rule,
1755
+ options = _this8$cacheRule$key.options;
1461
1756
  return createVNode(resolveComponent("ElRow"), {
1462
1757
  "align": "middle",
1463
1758
  "type": "flex",
@@ -1473,19 +1768,20 @@ var Group = defineComponent({
1473
1768
  "default": function _default() {
1474
1769
  return [createVNode(Type, {
1475
1770
  "key": key,
1771
+ "inFor": true,
1476
1772
  "onUpdate:modelValue": function onUpdateModelValue(formData) {
1477
- return _this9.formData(key, formData);
1773
+ return _this8.formData(key, formData);
1478
1774
  },
1479
- "modelValue": _this9.field ? _defineProperty({}, _this9.field, _this9._value(_this9.modelValue[index])) : _this9.modelValue[index],
1775
+ "modelValue": _this8.field ? _defineProperty({}, _this8.field, _this8._value(_this8.modelValue[index])) : _this8.modelValue[index],
1480
1776
  "onEmit-event": function onEmitEvent(name) {
1481
1777
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1482
1778
  args[_key - 1] = arguments[_key];
1483
1779
  }
1484
1780
 
1485
- return _this9.emitEvent(name, args, index, key);
1781
+ return _this8.emitEvent(name, args, index, key);
1486
1782
  },
1487
1783
  "onUpdate:api": function onUpdateApi($f) {
1488
- return _this9.add$f(index, key, $f);
1784
+ return _this8.add$f(index, key, $f);
1489
1785
  },
1490
1786
  "rule": rule,
1491
1787
  "option": options,
@@ -1498,7 +1794,7 @@ var Group = defineComponent({
1498
1794
  "span": 2,
1499
1795
  "pull": 1,
1500
1796
  "push": 1
1501
- }, _isSlot(_slot = _this9.makeIcon(keys.length, index, key)) ? _slot : {
1797
+ }, _isSlot(_slot = _this8.makeIcon(keys.length, index, key)) ? _slot : {
1502
1798
  "default": function _default() {
1503
1799
  return [_slot];
1504
1800
  }
@@ -1575,7 +1871,6 @@ var Sub = defineComponent({
1575
1871
  var _this = this;
1576
1872
 
1577
1873
  this.subApi = api;
1578
- this.formCreateInject.subForm(api);
1579
1874
  nextTick(function () {
1580
1875
  _this.syncDisabled && api.disabled(_this.disabled);
1581
1876
 
@@ -1597,9 +1892,46 @@ var Sub = defineComponent({
1597
1892
  }
1598
1893
  });
1599
1894
 
1600
- var components = [Checkbox, Frame, Radio, Select, Tree, Upload, Group, Sub];
1895
+ var script = {
1896
+ name: 'IconWarning'
1897
+ };
1898
+
1899
+ var _hoisted_1 = {
1900
+ "class": "icon",
1901
+ viewBox: "0 0 1024 1024",
1902
+ xmlns: "http://www.w3.org/2000/svg"
1903
+ };
1904
+
1905
+ var _hoisted_2 = /*#__PURE__*/createElementVNode("path", {
1906
+ fill: "currentColor",
1907
+ 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"
1908
+ }, null, -1);
1909
+
1910
+ var _hoisted_3 = [_hoisted_2];
1911
+ function render(_ctx, _cache, $props, $setup, $data, $options) {
1912
+ return openBlock(), createElementBlock("svg", _hoisted_1, _hoisted_3);
1913
+ }
1914
+
1915
+ script.render = render;
1916
+
1917
+ var components = [Checkbox, Frame, Radio, Select, Tree, Upload, Group, Sub, script];
1601
1918
 
1602
1919
  var NAME$1 = 'FormCreate';
1920
+
1921
+ var getRuleInject = function getRuleInject(vm, parent) {
1922
+ if (vm === parent) {
1923
+ return;
1924
+ }
1925
+
1926
+ if (vm.ctx.formCreateInject) {
1927
+ return vm.ctx.formCreateInject;
1928
+ }
1929
+
1930
+ if (vm.parent) {
1931
+ return getRuleInject(vm.parent, parent);
1932
+ }
1933
+ };
1934
+
1603
1935
  function $FormCreate(FormCreate) {
1604
1936
  return defineComponent({
1605
1937
  name: NAME$1,
@@ -1620,7 +1952,12 @@ function $FormCreate(FormCreate) {
1620
1952
  extendOption: Boolean,
1621
1953
  modelValue: Object,
1622
1954
  api: Object,
1623
- name: String
1955
+ name: String,
1956
+ subForm: {
1957
+ type: Boolean,
1958
+ "default": true
1959
+ },
1960
+ inFor: Boolean
1624
1961
  },
1625
1962
  emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync', 'reload', 'repeat-field', 'update'],
1626
1963
  render: function render() {
@@ -1633,7 +1970,9 @@ function $FormCreate(FormCreate) {
1633
1970
 
1634
1971
  var _toRefs = toRefs(props),
1635
1972
  rule = _toRefs.rule,
1636
- modelValue = _toRefs.modelValue;
1973
+ modelValue = _toRefs.modelValue,
1974
+ subForm = _toRefs.subForm,
1975
+ inFor = _toRefs.inFor;
1637
1976
 
1638
1977
  var data = reactive({
1639
1978
  ctxInject: {},
@@ -1645,16 +1984,60 @@ function $FormCreate(FormCreate) {
1645
1984
  });
1646
1985
  var fc = new FormCreate(vm);
1647
1986
  var fapi = fc.api();
1987
+ var isMore = inFor.value;
1988
+
1989
+ var addSubForm = function addSubForm() {
1990
+ if (parent) {
1991
+ var _inject = getRuleInject(vm, parent);
1992
+
1993
+ if (_inject) {
1994
+ var sub;
1995
+
1996
+ if (isMore) {
1997
+ sub = toArray(_inject.getSubForm());
1998
+ sub.push(fapi);
1999
+ } else {
2000
+ sub = fapi;
2001
+ }
2002
+
2003
+ _inject.subForm(sub);
2004
+ }
2005
+ }
2006
+ };
2007
+
2008
+ var rmSubForm = function rmSubForm() {
2009
+ var inject = getRuleInject(vm, parent);
2010
+
2011
+ if (inject) {
2012
+ if (isMore) {
2013
+ var sub = toArray(inject.getSubForm());
2014
+ var idx = sub.indexOf(fapi);
2015
+
2016
+ if (idx > -1) {
2017
+ sub.splice(idx, 1);
2018
+ }
2019
+ } else {
2020
+ inject.subForm();
2021
+ }
2022
+ }
2023
+ };
2024
+
1648
2025
  onMounted(function () {
1649
2026
  fc.mounted();
1650
2027
  });
1651
2028
  onBeforeUnmount(function () {
2029
+ rmSubForm();
1652
2030
  data.destroyed = true;
1653
2031
  fc.unmount();
1654
2032
  });
1655
2033
  onUpdated(function () {
1656
2034
  fc.updated();
1657
2035
  });
2036
+ watch(subForm, function (n) {
2037
+ n ? addSubForm() : rmSubForm();
2038
+ }, {
2039
+ immediate: true
2040
+ });
1658
2041
  watch(function () {
1659
2042
  return _toConsumableArray(rule.value);
1660
2043
  }, function (n) {
@@ -1669,8 +2052,8 @@ function $FormCreate(FormCreate) {
1669
2052
  fapi.refresh();
1670
2053
  });
1671
2054
  watch(modelValue, function (n) {
1672
- if (JSON.stringify(n) === data.updateValue) return;
1673
- fapi.setValue(n);
2055
+ if (JSON.stringify(n || {}) === data.updateValue) return;
2056
+ fapi.setValue(n || {});
1674
2057
  }, {
1675
2058
  deep: true
1676
2059
  });
@@ -1700,27 +2083,6 @@ function $FormCreate(FormCreate) {
1700
2083
  });
1701
2084
  }
1702
2085
 
1703
- function $set(target, field, value) {
1704
- target[field] = value;
1705
- }
1706
- function $del(target, field) {
1707
- delete target[field];
1708
- }
1709
-
1710
- var _extends = Object.assign || function (a) {
1711
- for (var b, c = 1; c < arguments.length; c++) {
1712
- for (var d in b = arguments[c], b) {
1713
- Object.prototype.hasOwnProperty.call(b, d) && $set(a, d, b[d]);
1714
- }
1715
- }
1716
-
1717
- return a;
1718
- };
1719
-
1720
- function extend() {
1721
- return _extends.apply(this, arguments);
1722
- }
1723
-
1724
2086
  var normalMerge = ['props'];
1725
2087
  var toArrayMerge = ['class', 'style', 'directives'];
1726
2088
  var functionalMerge = ['on'];
@@ -1790,67 +2152,13 @@ var mergeFn = function mergeFn(fn1, fn2) {
1790
2152
  };
1791
2153
  };
1792
2154
 
1793
- var keyAttrs = ['type', 'slot', 'emitPrefix', 'value', 'name', 'native', 'hidden', 'display', 'inject', 'options', 'emit', 'link', 'prefix', 'suffix', 'update', 'sync', 'optionsTo', 'key'];
2155
+ var keyAttrs = ['type', 'slot', 'emitPrefix', 'value', 'name', 'native', 'hidden', 'display', 'inject', 'options', 'emit', 'link', 'prefix', 'suffix', 'update', 'sync', 'optionsTo', 'key', 'slotUpdate'];
1794
2156
  var arrayAttrs = ['validate', 'children', 'control'];
1795
2157
  var normalAttrs = ['effect'];
1796
2158
  function attrs() {
1797
2159
  return [].concat(keyAttrs, _toConsumableArray(normalMerge), _toConsumableArray(toArrayMerge), _toConsumableArray(functionalMerge), arrayAttrs, normalAttrs);
1798
2160
  }
1799
2161
 
1800
- function deepExtend(origin) {
1801
- var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1802
- var mode = arguments.length > 2 ? arguments[2] : undefined;
1803
- var isArr = false;
1804
-
1805
- for (var key in target) {
1806
- if (Object.prototype.hasOwnProperty.call(target, key)) {
1807
- var clone = target[key];
1808
-
1809
- if ((isArr = Array.isArray(clone)) || is.Object(clone)) {
1810
- var nst = origin[key] === undefined;
1811
-
1812
- if (isArr) {
1813
- isArr = false;
1814
- nst && $set(origin, key, []);
1815
- } else if (clone._clone && mode !== undefined) {
1816
- if (mode) {
1817
- clone = clone.getRule();
1818
- nst && $set(origin, key, {});
1819
- } else {
1820
- $set(origin, key, clone._clone());
1821
- continue;
1822
- }
1823
- } else {
1824
- nst && $set(origin, key, {});
1825
- }
1826
-
1827
- origin[key] = deepExtend(origin[key], clone, mode);
1828
- } else {
1829
- $set(origin, key, clone);
1830
-
1831
- if (!is.Undef(clone)) {
1832
- if (!is.Undef(clone.__json)) {
1833
- origin[key].__json = clone.__json;
1834
- }
1835
-
1836
- if (!is.Undef(clone.__origin)) {
1837
- origin[key].__origin = clone.__origin;
1838
- }
1839
- }
1840
- }
1841
- }
1842
- }
1843
-
1844
- return mode !== undefined && Array.isArray(origin) ? origin.filter(function (v) {
1845
- return !v || !v.__ctrl;
1846
- }) : origin;
1847
- }
1848
- function deepCopy(value) {
1849
- return deepExtend({}, {
1850
- value: value
1851
- }).value;
1852
- }
1853
-
1854
2162
  function format(type, msg, rule) {
1855
2163
  return "[form-create ".concat(type, "]: ").concat(msg) + (rule ? '\n\nrule: ' + JSON.stringify(rule.getRule ? rule.getRule() : rule) : '');
1856
2164
  }
@@ -2008,14 +2316,14 @@ function makeSlotBag() {
2008
2316
  if (!slotBag[slot]) slotBag[slot] = [];
2009
2317
  slotBag[slot].push(vnFn);
2010
2318
  },
2011
- getSlot: function getSlot(slot) {
2319
+ getSlot: function getSlot(slot, val) {
2012
2320
  slot = slotName(slot);
2013
2321
  var children = [];
2014
2322
  (slotBag[slot] || []).forEach(function (fn) {
2015
2323
  if (Array.isArray(fn)) {
2016
2324
  children.push.apply(children, _toConsumableArray(fn));
2017
2325
  } else if (is.Function(fn)) {
2018
- var res = fn();
2326
+ var res = fn.apply(void 0, _toConsumableArray(val || []));
2019
2327
 
2020
2328
  if (Array.isArray(res)) {
2021
2329
  children.push.apply(children, _toConsumableArray(res));
@@ -2034,7 +2342,11 @@ function makeSlotBag() {
2034
2342
  var slots = {};
2035
2343
  Object.keys(slotBag).forEach(function (k) {
2036
2344
  slots[k] = function () {
2037
- return _this.getSlot(k);
2345
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2346
+ args[_key] = arguments[_key];
2347
+ }
2348
+
2349
+ return _this.getSlot(k, args);
2038
2350
  };
2039
2351
  });
2040
2352
  return slots;
@@ -2458,6 +2770,25 @@ function Api(h) {
2458
2770
  return origin ? ctx.origin : ctx.rule;
2459
2771
  }
2460
2772
  },
2773
+ setEffect: function setEffect(id, attr, value) {
2774
+ var ctx = h.getCtx(id);
2775
+
2776
+ if (ctx && attr) {
2777
+ if (attr[0] === '$') {
2778
+ attr = attr.substr(1);
2779
+ }
2780
+
2781
+ if (hasProperty(ctx.rule, '$' + attr)) {
2782
+ $set(ctx.rule, '$' + attr, value);
2783
+ }
2784
+
2785
+ if (!hasProperty(ctx.rule, 'effect')) {
2786
+ ctx.rule.effect = {};
2787
+ }
2788
+
2789
+ $set(ctx.rule.effect, attr, value);
2790
+ }
2791
+ },
2461
2792
  updateValidate: function updateValidate(id, validate, merge) {
2462
2793
  if (merge) {
2463
2794
  api.mergeRule(id, {
@@ -2760,6 +3091,25 @@ function useRender$1(Render) {
2760
3091
  }
2761
3092
 
2762
3093
  vn = function vn() {
3094
+ for (var _len = arguments.length, slotValue = new Array(_len), _key = 0; _key < _len; _key++) {
3095
+ slotValue[_key] = arguments[_key];
3096
+ }
3097
+
3098
+ var inject = {
3099
+ rule: rule,
3100
+ prop: prop,
3101
+ preview: preview,
3102
+ api: _this4.$handle.api,
3103
+ model: prop.model || {},
3104
+ slotValue: slotValue
3105
+ };
3106
+
3107
+ if (slotValue.length && rule.slotUpdate) {
3108
+ invoke(function () {
3109
+ return rule.slotUpdate(inject);
3110
+ });
3111
+ }
3112
+
2763
3113
  var children = {};
2764
3114
 
2765
3115
  var _load = ctx.loadChildrenPending();
@@ -2775,14 +3125,8 @@ function useRender$1(Render) {
2775
3125
  var _vn;
2776
3126
 
2777
3127
  if (slot) {
2778
- _vn = slot({
2779
- rule: rule,
2780
- prop: prop,
2781
- preview: preview,
2782
- children: children,
2783
- api: _this4.$handle.api,
2784
- model: prop.model || {}
2785
- });
3128
+ inject.children = children;
3129
+ _vn = slot(inject);
2786
3130
  } else {
2787
3131
  _vn = preview ? ctx.parser.preview(children, ctx) : ctx.parser.render(children, ctx);
2788
3132
  }
@@ -2861,11 +3205,15 @@ function useRender$1(Render) {
2861
3205
  subForm: function subForm(_subForm) {
2862
3206
  _this6.$handle.addSubForm(ctx, _subForm);
2863
3207
  },
3208
+ getSubForm: function getSubForm() {
3209
+ return _this6.$handle.subForm[ctx.id];
3210
+ },
2864
3211
  options: [],
2865
3212
  children: [],
2866
3213
  preview: false,
2867
3214
  field: ctx.field,
2868
- rule: ctx.rule
3215
+ rule: ctx.rule,
3216
+ input: ctx.input
2869
3217
  };
2870
3218
  }
2871
3219
 
@@ -2900,12 +3248,17 @@ function useRender$1(Render) {
2900
3248
 
2901
3249
  if (!custom && ctx.input) {
2902
3250
  var field = this.getModelField(ctx);
2903
- props.push({
2904
- on: _defineProperty({}, "update:".concat(field), function update(value) {
3251
+ var model = {
3252
+ callback: function callback(value) {
2905
3253
  _this7.onInput(ctx, value);
2906
- }),
2907
- props: _defineProperty({}, field, this.$handle.getFormData(ctx))
3254
+ },
3255
+ value: this.$handle.getFormData(ctx)
3256
+ };
3257
+ props.push({
3258
+ on: _defineProperty({}, "update:".concat(field), model.callback),
3259
+ props: _defineProperty({}, field, model.value)
2908
3260
  });
3261
+ ctx.prop.model = model;
2909
3262
  }
2910
3263
 
2911
3264
  mergeProps(props, ctx.prop);
@@ -3920,7 +4273,7 @@ function useInput(Handler) {
3920
4273
  }
3921
4274
  },
3922
4275
  setFormData: function setFormData(ctx, value) {
3923
- $set(this.formData, ctx.id, value === undefined ? null : value);
4276
+ $set(this.formData, ctx.id, value === null ? undefined : value);
3924
4277
  },
3925
4278
  getFormData: function getFormData(ctx) {
3926
4279
  return this.formData[ctx.id];
@@ -3958,9 +4311,7 @@ function useInput(Handler) {
3958
4311
  delete this.appendData[rule.field];
3959
4312
  },
3960
4313
  addSubForm: function addSubForm(ctx, subForm) {
3961
- if (ctx.input) {
3962
- this.subForm[ctx.id] = subForm;
3963
- }
4314
+ this.subForm[ctx.id] = subForm;
3964
4315
  },
3965
4316
  deferSyncValue: function deferSyncValue(fn, sync) {
3966
4317
  if (!this.deferSyncFn) {
@@ -4139,10 +4490,10 @@ function useContext(Handler) {
4139
4490
  watchCtx: function watchCtx(ctx) {
4140
4491
  var _this = this;
4141
4492
 
4142
- var none = ['field', 'value', 'vm', 'template', 'name', 'config', 'control', 'inject', 'sync', 'payload', 'optionsTo', 'update'];
4493
+ var none = ['field', 'value', 'vm', 'template', 'name', 'config', 'control', 'inject', 'sync', 'payload', 'optionsTo', 'update', 'slotUpdate'];
4143
4494
  var all = attrs();
4144
4495
  all.filter(function (k) {
4145
- return k[0] !== '_' && none.indexOf(k) === -1;
4496
+ return k[0] !== '_' && k[0] !== '$' && none.indexOf(k) === -1;
4146
4497
  }).forEach(function (key) {
4147
4498
  var ref = toRef(ctx.rule, key);
4148
4499
  var flag = key === 'children';
@@ -4347,10 +4698,21 @@ function useEffect(Handler) {
4347
4698
  watchEffect: function watchEffect(ctx) {
4348
4699
  var _this3 = this;
4349
4700
 
4701
+ var effect = {};
4350
4702
  Object.keys(ctx.rule.effect || {}).forEach(function (k) {
4351
- ctx.watch.push(watch(function () {
4703
+ effect[k] = function () {
4352
4704
  return ctx.rule.effect[k];
4353
- }, function (n) {
4705
+ };
4706
+ });
4707
+ Object.keys(ctx.rule).forEach(function (k) {
4708
+ if (k[0] === '$') {
4709
+ effect[k.substr(1)] = function () {
4710
+ return ctx.rule[k];
4711
+ };
4712
+ }
4713
+ });
4714
+ Object.keys(effect).forEach(function (k) {
4715
+ ctx.watch.push(watch(effect[k], function (n) {
4354
4716
  _this3.effect(ctx, 'watch', _defineProperty({}, k, n));
4355
4717
  }, {
4356
4718
  deep: true
@@ -4374,7 +4736,12 @@ function useEffect(Handler) {
4374
4736
  }, event);
4375
4737
  },
4376
4738
  getEffect: function getEffect(rule, name) {
4377
- if (hasProperty(rule, 'effect') && hasProperty(rule.effect, name)) return rule.effect[name];else return undefined;
4739
+ if (hasProperty(rule, '$' + name)) {
4740
+ return rule['$' + name];
4741
+ }
4742
+
4743
+ if (hasProperty(rule, 'effect') && hasProperty(rule.effect, name)) return rule.effect[name];
4744
+ return undefined;
4378
4745
  },
4379
4746
  emitEffect: function emitEffect(_ref, event, append) {
4380
4747
  var _this4 = this;
@@ -4385,7 +4752,13 @@ function useEffect(Handler) {
4385
4752
  type = _ref.type,
4386
4753
  custom = _ref.custom;
4387
4754
  if (!type || ['fcFragment', 'fragment'].indexOf(type) > -1) return;
4388
- var effect = custom ? custom : rule.effect || {};
4755
+ var effect = custom ? custom : Object.keys(rule).reduce(function (i, k) {
4756
+ if (k[0] === '$') {
4757
+ i[k.substr(1)] = rule[k];
4758
+ }
4759
+
4760
+ return i;
4761
+ }, _objectSpread2({}, rule.effect || {}));
4389
4762
  Object.keys(effect).forEach(function (attr) {
4390
4763
  var p = _this4.providers[attr];
4391
4764
  if (!p || p.input && !input) return;
@@ -4820,6 +5193,10 @@ function run(inject, rule, api) {
4820
5193
  return true;
4821
5194
  }
4822
5195
 
5196
+ var $provider = {
5197
+ fetch: $fetch
5198
+ };
5199
+
4823
5200
  var name$6 = 'html';
4824
5201
  var html = {
4825
5202
  name: name$6,
@@ -4879,9 +5256,9 @@ function FormCreateFactory(config) {
4879
5256
  var directives = {};
4880
5257
  var modelFields = {};
4881
5258
  var useApps = [];
4882
- var providers = {
4883
- fetch: $fetch
4884
- };
5259
+
5260
+ var providers = _objectSpread2({}, $provider);
5261
+
4885
5262
  var maker = makerFactory();
4886
5263
  var globalConfig = {
4887
5264
  global: {}
@@ -4891,7 +5268,9 @@ function FormCreateFactory(config) {
4891
5268
  exportAttrs(config.attrs || {});
4892
5269
 
4893
5270
  function getApi(name) {
4894
- return instance[name];
5271
+ var val = instance[name];
5272
+ if (Array.isArray(val)) return _toConsumableArray(val);
5273
+ return val;
4895
5274
  }
4896
5275
 
4897
5276
  function useApp(fn) {
@@ -4935,7 +5314,7 @@ function FormCreateFactory(config) {
4935
5314
  return components[name];
4936
5315
  }
4937
5316
  } else {
4938
- name = toCase(id.name);
5317
+ name = toCase(id.displayName || id.name);
4939
5318
  component = id;
4940
5319
  }
4941
5320
 
@@ -4988,8 +5367,25 @@ function FormCreateFactory(config) {
4988
5367
  return vm.$refs.fc.fapi;
4989
5368
  }
4990
5369
 
4991
- function factory() {
4992
- return FormCreateFactory(config);
5370
+ function factory(inherit) {
5371
+ var _config = _objectSpread2({}, config);
5372
+
5373
+ if (inherit) {
5374
+ _config.inherit = {
5375
+ components: components,
5376
+ parsers: parsers,
5377
+ directives: directives,
5378
+ modelFields: modelFields,
5379
+ providers: providers,
5380
+ useApps: useApps,
5381
+ maker: maker,
5382
+ data: data
5383
+ };
5384
+ } else {
5385
+ delete _config.inherit;
5386
+ }
5387
+
5388
+ return FormCreateFactory(_config);
4993
5389
  }
4994
5390
 
4995
5391
  function setModelField(name, field) {
@@ -5009,6 +5405,7 @@ function FormCreateFactory(config) {
5009
5405
  modelFields: modelFields,
5010
5406
  rules: vm.props.rule,
5011
5407
  name: vm.props.name,
5408
+ inFor: vm.props.inFor,
5012
5409
  prop: {
5013
5410
  components: components,
5014
5411
  directives: directives
@@ -5035,7 +5432,12 @@ function FormCreateFactory(config) {
5035
5432
  this.$handle = new Handler(this);
5036
5433
 
5037
5434
  if (this.name) {
5038
- instance[this.name] = this.api();
5435
+ if (this.inFor) {
5436
+ if (!instance[this.name]) instance[this.name] = [];
5437
+ instance[this.name].push(this.api());
5438
+ } else {
5439
+ instance[this.name] = this.api();
5440
+ }
5039
5441
  }
5040
5442
  }
5041
5443
 
@@ -5103,7 +5505,12 @@ function FormCreateFactory(config) {
5103
5505
  },
5104
5506
  unmount: function unmount() {
5105
5507
  if (this.name) {
5106
- delete instance[this.name];
5508
+ if (this.inFor) {
5509
+ var idx = instance[this.name].indexOf(this.api());
5510
+ instance[this.name].splice(idx, 1);
5511
+ } else {
5512
+ delete instance[this.name];
5513
+ }
5107
5514
  }
5108
5515
 
5109
5516
  this.unwatch && this.unwatch();
@@ -5182,6 +5589,19 @@ function FormCreateFactory(config) {
5182
5589
  });
5183
5590
  });
5184
5591
  parser(html);
5592
+
5593
+ if (config.inherit) {
5594
+ var inherit = config.inherit;
5595
+ inherit.components && extend(components, inherit.components);
5596
+ inherit.parsers && extend(parsers, inherit.parsers);
5597
+ inherit.directives && extend(directives, inherit.directives);
5598
+ inherit.modelFields && extend(modelFields, inherit.modelFields);
5599
+ inherit.providers && extend(providers, inherit.providers);
5600
+ inherit.useApps && extend(useApps, inherit.useApps);
5601
+ inherit.maker && extend(maker, inherit.maker);
5602
+ inherit.data && extend(data, inherit.data);
5603
+ }
5604
+
5185
5605
  return create;
5186
5606
  }
5187
5607
 
@@ -5594,7 +6014,7 @@ var manager = {
5594
6014
  }, {
5595
6015
  "default": function _default() {
5596
6016
  return _this4.$r({
5597
- type: infoProp.icon === true ? 'warning' : infoProp.icon
6017
+ type: infoProp.icon === true ? 'icon-warning' : infoProp.icon
5598
6018
  });
5599
6019
  }
5600
6020
  }, true);
@@ -5943,11 +6363,57 @@ function extendApi(api, h) {
5943
6363
  return api;
5944
6364
  }
5945
6365
 
6366
+ var required = {
6367
+ name: 'required',
6368
+ load: function load(inject, rule, api) {
6369
+ var val = parseVa(inject.getValue());
6370
+
6371
+ if (val.required === false) {
6372
+ inject.clearProp();
6373
+ } else {
6374
+ var validate = _objectSpread2(_objectSpread2({}, val), {}, {
6375
+ required: true,
6376
+ validator: function validator(_, v, call) {
6377
+ is.empty(v) ? call(validate.message) : call();
6378
+ }
6379
+ });
6380
+
6381
+ if (!validate.message) {
6382
+ validate.message = rule.title + ' is required';
6383
+ }
6384
+
6385
+ inject.getProp().validate = [validate];
6386
+ }
6387
+
6388
+ api.sync(rule);
6389
+ },
6390
+ watch: function watch() {
6391
+ required.load.apply(required, arguments);
6392
+ }
6393
+ };
6394
+
6395
+ function parseVa(val) {
6396
+ if (is.Boolean(val)) {
6397
+ return {
6398
+ required: val
6399
+ };
6400
+ } else if (is.String(val)) {
6401
+ return {
6402
+ message: val
6403
+ };
6404
+ } else if (!is.Object(val)) {
6405
+ return {};
6406
+ } else {
6407
+ return val;
6408
+ }
6409
+ }
6410
+
5946
6411
  function install(FormCreate) {
5947
6412
  FormCreate.componentAlias(alias);
5948
6413
  components.forEach(function (component) {
5949
6414
  FormCreate.component(component.name, component);
5950
6415
  });
6416
+ FormCreate.register(required);
5951
6417
  parsers.forEach(function (parser) {
5952
6418
  FormCreate.parser(parser);
5953
6419
  });
@@ -5965,7 +6431,7 @@ function install(FormCreate) {
5965
6431
  function elmFormCreate() {
5966
6432
  return FormCreateFactory({
5967
6433
  ui: 'element-ui',
5968
- version: '3.1.0',
6434
+ version: '3.1.4',
5969
6435
  manager: manager,
5970
6436
  extendApi: extendApi,
5971
6437
  install: install,