@form-create/element-ui 3.1.0 → 3.1.3

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.3
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
@@ -1303,6 +1599,13 @@ var Group = defineComponent({
1303
1599
  submitBtn: false,
1304
1600
  resetBtn: false
1305
1601
  };
1602
+
1603
+ if (this.defaultValue) {
1604
+ if (!options.formData) options.formData = {};
1605
+ var defVal = deepCopy(this.defaultValue);
1606
+ extend(options.formData, this.field ? _defineProperty({}, this.field, defVal) : defVal);
1607
+ }
1608
+
1306
1609
  this.cacheRule[++this.len] = {
1307
1610
  rule: rule,
1308
1611
  options: options
@@ -1319,6 +1622,7 @@ var Group = defineComponent({
1319
1622
 
1320
1623
  this.cacheRule[key].$f = $f;
1321
1624
  this.subForm();
1625
+ this.formData(key, $f.formData());
1322
1626
  nextTick(function () {
1323
1627
  if (_this4.syncDisabled) {
1324
1628
  $f.disabled(_this4.disabled);
@@ -1366,13 +1670,13 @@ var Group = defineComponent({
1366
1670
  this.input(this.modelValue);
1367
1671
  },
1368
1672
  addIcon: function addIcon(key) {
1369
- return createVNode(resolveComponent("el-icon"), {
1673
+ return createVNode(resolveComponent("ElIcon"), {
1370
1674
  "key": "a".concat(key),
1371
1675
  "style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer', ";"),
1372
1676
  "onClick": this.add
1373
1677
  }, {
1374
1678
  "default": function _default() {
1375
- return [createVNode(resolveComponent("circle-plus"), null, null)];
1679
+ return [createVNode(script$2, null, null)];
1376
1680
  }
1377
1681
  });
1378
1682
  },
@@ -1388,7 +1692,7 @@ var Group = defineComponent({
1388
1692
  }
1389
1693
  }, {
1390
1694
  "default": function _default() {
1391
- return [createVNode(resolveComponent("remove"), null, null)];
1695
+ return [createVNode(script$1, null, null)];
1392
1696
  }
1393
1697
  });
1394
1698
  },
@@ -1445,12 +1749,15 @@ var Group = defineComponent({
1445
1749
  return keys.length === 0 ? this.$slots["default"] ? this.$slots["default"]({
1446
1750
  vm: this,
1447
1751
  add: this.add
1448
- }) : createVNode("i", {
1752
+ }) : createVNode(resolveComponent("ElIcon"), {
1449
1753
  "key": 1,
1450
- "class": "el-icon-circle-plus-outline",
1451
1754
  "style": "font-size:".concat(this.fontSize, "px;vertical-align:middle;color:").concat(this.disabled ? '#c9cdd4;cursor: not-allowed' : '#606266;cursor:pointer', ";"),
1452
1755
  "onClick": this.add
1453
- }, null) : createVNode("div", {
1756
+ }, {
1757
+ "default": function _default() {
1758
+ return [createVNode(script$2, null, null)];
1759
+ }
1760
+ }) : createVNode("div", {
1454
1761
  "key": 2
1455
1762
  }, [keys.map(function (key, index) {
1456
1763
  var _slot;
@@ -1597,7 +1904,29 @@ var Sub = defineComponent({
1597
1904
  }
1598
1905
  });
1599
1906
 
1600
- var components = [Checkbox, Frame, Radio, Select, Tree, Upload, Group, Sub];
1907
+ var script = {
1908
+ name: 'IconWarning'
1909
+ };
1910
+
1911
+ var _hoisted_1 = {
1912
+ "class": "icon",
1913
+ viewBox: "0 0 1024 1024",
1914
+ xmlns: "http://www.w3.org/2000/svg"
1915
+ };
1916
+
1917
+ var _hoisted_2 = /*#__PURE__*/createElementVNode("path", {
1918
+ fill: "currentColor",
1919
+ 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"
1920
+ }, null, -1);
1921
+
1922
+ var _hoisted_3 = [_hoisted_2];
1923
+ function render(_ctx, _cache, $props, $setup, $data, $options) {
1924
+ return openBlock(), createElementBlock("svg", _hoisted_1, _hoisted_3);
1925
+ }
1926
+
1927
+ script.render = render;
1928
+
1929
+ var components = [Checkbox, Frame, Radio, Select, Tree, Upload, Group, Sub, script];
1601
1930
 
1602
1931
  var NAME$1 = 'FormCreate';
1603
1932
  function $FormCreate(FormCreate) {
@@ -1700,27 +2029,6 @@ function $FormCreate(FormCreate) {
1700
2029
  });
1701
2030
  }
1702
2031
 
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
2032
  var normalMerge = ['props'];
1725
2033
  var toArrayMerge = ['class', 'style', 'directives'];
1726
2034
  var functionalMerge = ['on'];
@@ -1790,67 +2098,13 @@ var mergeFn = function mergeFn(fn1, fn2) {
1790
2098
  };
1791
2099
  };
1792
2100
 
1793
- var keyAttrs = ['type', 'slot', 'emitPrefix', 'value', 'name', 'native', 'hidden', 'display', 'inject', 'options', 'emit', 'link', 'prefix', 'suffix', 'update', 'sync', 'optionsTo', 'key'];
2101
+ var keyAttrs = ['type', 'slot', 'emitPrefix', 'value', 'name', 'native', 'hidden', 'display', 'inject', 'options', 'emit', 'link', 'prefix', 'suffix', 'update', 'sync', 'optionsTo', 'key', 'slotUpdate'];
1794
2102
  var arrayAttrs = ['validate', 'children', 'control'];
1795
2103
  var normalAttrs = ['effect'];
1796
2104
  function attrs() {
1797
2105
  return [].concat(keyAttrs, _toConsumableArray(normalMerge), _toConsumableArray(toArrayMerge), _toConsumableArray(functionalMerge), arrayAttrs, normalAttrs);
1798
2106
  }
1799
2107
 
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
2108
  function format(type, msg, rule) {
1855
2109
  return "[form-create ".concat(type, "]: ").concat(msg) + (rule ? '\n\nrule: ' + JSON.stringify(rule.getRule ? rule.getRule() : rule) : '');
1856
2110
  }
@@ -2008,14 +2262,14 @@ function makeSlotBag() {
2008
2262
  if (!slotBag[slot]) slotBag[slot] = [];
2009
2263
  slotBag[slot].push(vnFn);
2010
2264
  },
2011
- getSlot: function getSlot(slot) {
2265
+ getSlot: function getSlot(slot, val) {
2012
2266
  slot = slotName(slot);
2013
2267
  var children = [];
2014
2268
  (slotBag[slot] || []).forEach(function (fn) {
2015
2269
  if (Array.isArray(fn)) {
2016
2270
  children.push.apply(children, _toConsumableArray(fn));
2017
2271
  } else if (is.Function(fn)) {
2018
- var res = fn();
2272
+ var res = fn.apply(void 0, _toConsumableArray(val || []));
2019
2273
 
2020
2274
  if (Array.isArray(res)) {
2021
2275
  children.push.apply(children, _toConsumableArray(res));
@@ -2034,7 +2288,11 @@ function makeSlotBag() {
2034
2288
  var slots = {};
2035
2289
  Object.keys(slotBag).forEach(function (k) {
2036
2290
  slots[k] = function () {
2037
- return _this.getSlot(k);
2291
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2292
+ args[_key] = arguments[_key];
2293
+ }
2294
+
2295
+ return _this.getSlot(k, args);
2038
2296
  };
2039
2297
  });
2040
2298
  return slots;
@@ -2760,6 +3018,25 @@ function useRender$1(Render) {
2760
3018
  }
2761
3019
 
2762
3020
  vn = function vn() {
3021
+ for (var _len = arguments.length, slotValue = new Array(_len), _key = 0; _key < _len; _key++) {
3022
+ slotValue[_key] = arguments[_key];
3023
+ }
3024
+
3025
+ var inject = {
3026
+ rule: rule,
3027
+ prop: prop,
3028
+ preview: preview,
3029
+ api: _this4.$handle.api,
3030
+ model: prop.model || {},
3031
+ slotValue: slotValue
3032
+ };
3033
+
3034
+ if (slotValue.length && rule.slotUpdate) {
3035
+ invoke(function () {
3036
+ return rule.slotUpdate(inject);
3037
+ });
3038
+ }
3039
+
2763
3040
  var children = {};
2764
3041
 
2765
3042
  var _load = ctx.loadChildrenPending();
@@ -2775,14 +3052,8 @@ function useRender$1(Render) {
2775
3052
  var _vn;
2776
3053
 
2777
3054
  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
- });
3055
+ inject.children = children;
3056
+ _vn = slot(inject);
2786
3057
  } else {
2787
3058
  _vn = preview ? ctx.parser.preview(children, ctx) : ctx.parser.render(children, ctx);
2788
3059
  }
@@ -2900,12 +3171,17 @@ function useRender$1(Render) {
2900
3171
 
2901
3172
  if (!custom && ctx.input) {
2902
3173
  var field = this.getModelField(ctx);
2903
- props.push({
2904
- on: _defineProperty({}, "update:".concat(field), function update(value) {
3174
+ var model = {
3175
+ callback: function callback(value) {
2905
3176
  _this7.onInput(ctx, value);
2906
- }),
2907
- props: _defineProperty({}, field, this.$handle.getFormData(ctx))
3177
+ },
3178
+ value: this.$handle.getFormData(ctx)
3179
+ };
3180
+ props.push({
3181
+ on: _defineProperty({}, "update:".concat(field), model.callback),
3182
+ props: _defineProperty({}, field, model.value)
2908
3183
  });
3184
+ ctx.prop.model = model;
2909
3185
  }
2910
3186
 
2911
3187
  mergeProps(props, ctx.prop);
@@ -3920,7 +4196,7 @@ function useInput(Handler) {
3920
4196
  }
3921
4197
  },
3922
4198
  setFormData: function setFormData(ctx, value) {
3923
- $set(this.formData, ctx.id, value === undefined ? null : value);
4199
+ $set(this.formData, ctx.id, value === null ? undefined : value);
3924
4200
  },
3925
4201
  getFormData: function getFormData(ctx) {
3926
4202
  return this.formData[ctx.id];
@@ -4139,10 +4415,10 @@ function useContext(Handler) {
4139
4415
  watchCtx: function watchCtx(ctx) {
4140
4416
  var _this = this;
4141
4417
 
4142
- var none = ['field', 'value', 'vm', 'template', 'name', 'config', 'control', 'inject', 'sync', 'payload', 'optionsTo', 'update'];
4418
+ var none = ['field', 'value', 'vm', 'template', 'name', 'config', 'control', 'inject', 'sync', 'payload', 'optionsTo', 'update', 'slotUpdate'];
4143
4419
  var all = attrs();
4144
4420
  all.filter(function (k) {
4145
- return k[0] !== '_' && none.indexOf(k) === -1;
4421
+ return k[0] !== '_' && k[0] !== '$' && none.indexOf(k) === -1;
4146
4422
  }).forEach(function (key) {
4147
4423
  var ref = toRef(ctx.rule, key);
4148
4424
  var flag = key === 'children';
@@ -4347,10 +4623,21 @@ function useEffect(Handler) {
4347
4623
  watchEffect: function watchEffect(ctx) {
4348
4624
  var _this3 = this;
4349
4625
 
4626
+ var effect = {};
4350
4627
  Object.keys(ctx.rule.effect || {}).forEach(function (k) {
4351
- ctx.watch.push(watch(function () {
4628
+ effect[k] = function () {
4352
4629
  return ctx.rule.effect[k];
4353
- }, function (n) {
4630
+ };
4631
+ });
4632
+ Object.keys(ctx.rule).forEach(function (k) {
4633
+ if (k[0] === '$') {
4634
+ effect[k.substr(1)] = function () {
4635
+ return ctx.rule[k];
4636
+ };
4637
+ }
4638
+ });
4639
+ Object.keys(effect).forEach(function (k) {
4640
+ ctx.watch.push(watch(effect[k], function (n) {
4354
4641
  _this3.effect(ctx, 'watch', _defineProperty({}, k, n));
4355
4642
  }, {
4356
4643
  deep: true
@@ -4374,7 +4661,12 @@ function useEffect(Handler) {
4374
4661
  }, event);
4375
4662
  },
4376
4663
  getEffect: function getEffect(rule, name) {
4377
- if (hasProperty(rule, 'effect') && hasProperty(rule.effect, name)) return rule.effect[name];else return undefined;
4664
+ if (hasProperty(rule, '$' + name)) {
4665
+ return rule['$' + name];
4666
+ }
4667
+
4668
+ if (hasProperty(rule, 'effect') && hasProperty(rule.effect, name)) return rule.effect[name];
4669
+ return undefined;
4378
4670
  },
4379
4671
  emitEffect: function emitEffect(_ref, event, append) {
4380
4672
  var _this4 = this;
@@ -4385,7 +4677,13 @@ function useEffect(Handler) {
4385
4677
  type = _ref.type,
4386
4678
  custom = _ref.custom;
4387
4679
  if (!type || ['fcFragment', 'fragment'].indexOf(type) > -1) return;
4388
- var effect = custom ? custom : rule.effect || {};
4680
+ var effect = custom ? custom : Object.keys(rule).reduce(function (i, k) {
4681
+ if (k[0] === '$') {
4682
+ i[k.substr(1)] = rule[k];
4683
+ }
4684
+
4685
+ return i;
4686
+ }, _objectSpread2({}, rule.effect || {}));
4389
4687
  Object.keys(effect).forEach(function (attr) {
4390
4688
  var p = _this4.providers[attr];
4391
4689
  if (!p || p.input && !input) return;
@@ -4750,6 +5048,44 @@ var $fetch = {
4750
5048
  }
4751
5049
  }
4752
5050
  };
5051
+ var $required = {
5052
+ name: 'required',
5053
+ load: function load(inject, rule) {
5054
+ var val = parseVa(inject.getValue());
5055
+
5056
+ var validate = _objectSpread2(_objectSpread2({}, val), {}, {
5057
+ required: true,
5058
+ validator: function validator(_, v) {
5059
+ return new Promise(function (resolve, reject) {
5060
+ is.empty(v) ? reject(validate.message) : resolve();
5061
+ });
5062
+ }
5063
+ });
5064
+
5065
+ if (!validate.message) {
5066
+ validate.message = rule.title + ' is required';
5067
+ }
5068
+
5069
+ inject.getProp().validate = [validate];
5070
+ },
5071
+ watch: function watch() {
5072
+ $required.load.apply($required, arguments);
5073
+ }
5074
+ };
5075
+
5076
+ function parseVa(val) {
5077
+ if (is.Boolean(val)) {
5078
+ return {};
5079
+ } else if (is.String(val)) {
5080
+ return {
5081
+ message: val
5082
+ };
5083
+ } else if (!is.Object(val)) {
5084
+ return {};
5085
+ } else {
5086
+ return val;
5087
+ }
5088
+ }
4753
5089
 
4754
5090
  function parseOpt(option) {
4755
5091
  if (is.String(option)) {
@@ -4820,6 +5156,11 @@ function run(inject, rule, api) {
4820
5156
  return true;
4821
5157
  }
4822
5158
 
5159
+ var $provider = {
5160
+ fetch: $fetch,
5161
+ required: $required
5162
+ };
5163
+
4823
5164
  var name$6 = 'html';
4824
5165
  var html = {
4825
5166
  name: name$6,
@@ -4879,9 +5220,9 @@ function FormCreateFactory(config) {
4879
5220
  var directives = {};
4880
5221
  var modelFields = {};
4881
5222
  var useApps = [];
4882
- var providers = {
4883
- fetch: $fetch
4884
- };
5223
+
5224
+ var providers = _objectSpread2({}, $provider);
5225
+
4885
5226
  var maker = makerFactory();
4886
5227
  var globalConfig = {
4887
5228
  global: {}
@@ -4935,7 +5276,7 @@ function FormCreateFactory(config) {
4935
5276
  return components[name];
4936
5277
  }
4937
5278
  } else {
4938
- name = toCase(id.name);
5279
+ name = toCase(id.displayName || id.name);
4939
5280
  component = id;
4940
5281
  }
4941
5282
 
@@ -4988,8 +5329,25 @@ function FormCreateFactory(config) {
4988
5329
  return vm.$refs.fc.fapi;
4989
5330
  }
4990
5331
 
4991
- function factory() {
4992
- return FormCreateFactory(config);
5332
+ function factory(inherit) {
5333
+ var _config = _objectSpread2({}, config);
5334
+
5335
+ if (inherit) {
5336
+ _config.inherit = {
5337
+ components: components,
5338
+ parsers: parsers,
5339
+ directives: directives,
5340
+ modelFields: modelFields,
5341
+ providers: providers,
5342
+ useApps: useApps,
5343
+ maker: maker,
5344
+ data: data
5345
+ };
5346
+ } else {
5347
+ delete _config.inherit;
5348
+ }
5349
+
5350
+ return FormCreateFactory(_config);
4993
5351
  }
4994
5352
 
4995
5353
  function setModelField(name, field) {
@@ -5182,6 +5540,19 @@ function FormCreateFactory(config) {
5182
5540
  });
5183
5541
  });
5184
5542
  parser(html);
5543
+
5544
+ if (config.inherit) {
5545
+ var inherit = config.inherit;
5546
+ inherit.components && extend(components, inherit.components);
5547
+ inherit.parsers && extend(parsers, inherit.parsers);
5548
+ inherit.directives && extend(directives, inherit.directives);
5549
+ inherit.modelFields && extend(modelFields, inherit.modelFields);
5550
+ inherit.providers && extend(providers, inherit.providers);
5551
+ inherit.useApps && extend(useApps, inherit.useApps);
5552
+ inherit.maker && extend(maker, inherit.maker);
5553
+ inherit.data && extend(data, inherit.data);
5554
+ }
5555
+
5185
5556
  return create;
5186
5557
  }
5187
5558
 
@@ -5594,7 +5965,7 @@ var manager = {
5594
5965
  }, {
5595
5966
  "default": function _default() {
5596
5967
  return _this4.$r({
5597
- type: infoProp.icon === true ? 'warning' : infoProp.icon
5968
+ type: infoProp.icon === true ? 'icon-warning' : infoProp.icon
5598
5969
  });
5599
5970
  }
5600
5971
  }, true);
@@ -5965,7 +6336,7 @@ function install(FormCreate) {
5965
6336
  function elmFormCreate() {
5966
6337
  return FormCreateFactory({
5967
6338
  ui: 'element-ui',
5968
- version: '3.1.0',
6339
+ version: '3.1.3',
5969
6340
  manager: manager,
5970
6341
  extendApi: extendApi,
5971
6342
  install: install,