@form-create/element-ui 3.1.23 → 3.1.24

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.23
2
+ * @form-create/element-ui v3.1.24
3
3
  * (c) 2018-2023 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, openBlock, createElementBlock, createElementVNode, isVNode, nextTick, Fragment, markRaw, reactive, getCurrentInstance, provide, inject, toRefs, onMounted, onBeforeUnmount, onUpdated, watch, computed, withDirectives, resolveDirective, createApp, h, ref } from 'vue';
7
+ import { defineComponent, toRef, resolveComponent, createVNode, mergeProps as mergeProps$1, openBlock, createElementBlock, createElementVNode, isVNode, nextTick, Fragment, markRaw, watch, reactive, getCurrentInstance, provide, inject, toRefs, onMounted, onBeforeUnmount, onUpdated, computed, withDirectives, resolveDirective, createApp, h, ref } from 'vue';
8
8
 
9
9
  function ownKeys(object, enumerableOnly) {
10
10
  var keys = Object.keys(object);
@@ -219,7 +219,7 @@ var Checkbox = defineComponent({
219
219
  },
220
220
  type: String
221
221
  },
222
- emits: ['update:modelValue'],
222
+ emits: ['update:modelValue', 'fc.el'],
223
223
  setup: function setup(props, _) {
224
224
  var options = toRef(props.formCreateInject, 'options', []);
225
225
  var value = toRef(props, 'modelValue');
@@ -245,7 +245,8 @@ var Checkbox = defineComponent({
245
245
  var Type = resolveComponent(name);
246
246
  return createVNode(resolveComponent("ElCheckboxGroup"), mergeProps$1(this.$attrs, {
247
247
  "modelValue": this.value,
248
- "onUpdate:modelValue": this.onInput
248
+ "onUpdate:modelValue": this.onInput,
249
+ "ref": "el"
249
250
  }), _objectSpread2({
250
251
  "default": function _default() {
251
252
  return [_this.options().map(function (opt, index) {
@@ -264,6 +265,9 @@ var Checkbox = defineComponent({
264
265
  }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
265
266
  }
266
267
  }, getSlot(this.$slots, ['default'])));
268
+ },
269
+ mounted: function mounted() {
270
+ this.$emit('fc.el', this.$refs.el);
267
271
  }
268
272
  });
269
273
 
@@ -342,125 +346,125 @@ function styleInject(css, ref) {
342
346
  }
343
347
  }
344
348
 
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
- styleInject(css_248z$2);
349
+ var css_248z$3 = "._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
+ styleInject(css_248z$3);
347
351
 
348
- var script$8 = {
352
+ var script$6 = {
349
353
  name: 'IconCircleClose'
350
354
  };
351
355
 
352
- var _hoisted_1$8 = {
356
+ var _hoisted_1$6 = {
353
357
  "class": "icon",
354
358
  viewBox: "0 0 1024 1024",
355
359
  xmlns: "http://www.w3.org/2000/svg"
356
360
  };
357
361
 
358
- var _hoisted_2$8 = /*#__PURE__*/createElementVNode("path", {
362
+ var _hoisted_2$6 = /*#__PURE__*/createElementVNode("path", {
359
363
  fill: "currentColor",
360
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"
361
365
  }, null, -1);
362
366
 
363
- var _hoisted_3$8 = /*#__PURE__*/createElementVNode("path", {
367
+ var _hoisted_3$6 = /*#__PURE__*/createElementVNode("path", {
364
368
  fill: "currentColor",
365
369
  d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"
366
370
  }, null, -1);
367
371
 
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);
372
+ var _hoisted_4 = [_hoisted_2$6, _hoisted_3$6];
373
+ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
374
+ return openBlock(), createElementBlock("svg", _hoisted_1$6, _hoisted_4);
371
375
  }
372
376
 
373
- script$8.render = render$8;
377
+ script$6.render = render$6;
374
378
 
375
- var script$7 = {
379
+ var script$5 = {
376
380
  name: 'IconDocument'
377
381
  };
378
382
 
379
- var _hoisted_1$7 = {
383
+ var _hoisted_1$5 = {
380
384
  "class": "icon",
381
385
  viewBox: "0 0 1024 1024",
382
386
  xmlns: "http://www.w3.org/2000/svg"
383
387
  };
384
388
 
385
- var _hoisted_2$7 = /*#__PURE__*/createElementVNode("path", {
389
+ var _hoisted_2$5 = /*#__PURE__*/createElementVNode("path", {
386
390
  fill: "currentColor",
387
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"
388
392
  }, null, -1);
389
393
 
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);
394
+ var _hoisted_3$5 = [_hoisted_2$5];
395
+ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
396
+ return openBlock(), createElementBlock("svg", _hoisted_1$5, _hoisted_3$5);
393
397
  }
394
398
 
395
- script$7.render = render$7;
399
+ script$5.render = render$5;
396
400
 
397
- var script$6 = {
401
+ var script$4 = {
398
402
  name: 'IconDelete'
399
403
  };
400
404
 
401
- var _hoisted_1$6 = {
405
+ var _hoisted_1$4 = {
402
406
  "class": "icon",
403
407
  viewBox: "0 0 1024 1024",
404
408
  xmlns: "http://www.w3.org/2000/svg"
405
409
  };
406
410
 
407
- var _hoisted_2$6 = /*#__PURE__*/createElementVNode("path", {
411
+ var _hoisted_2$4 = /*#__PURE__*/createElementVNode("path", {
408
412
  fill: "currentColor",
409
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"
410
414
  }, null, -1);
411
415
 
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);
416
+ var _hoisted_3$4 = [_hoisted_2$4];
417
+ function render$4(_ctx, _cache, $props, $setup, $data, $options) {
418
+ return openBlock(), createElementBlock("svg", _hoisted_1$4, _hoisted_3$4);
415
419
  }
416
420
 
417
- script$6.render = render$6;
421
+ script$4.render = render$4;
418
422
 
419
- var script$5 = {
423
+ var script$3 = {
420
424
  name: 'IconView'
421
425
  };
422
426
 
423
- var _hoisted_1$5 = {
427
+ var _hoisted_1$3 = {
424
428
  "class": "icon",
425
429
  viewBox: "0 0 1024 1024",
426
430
  xmlns: "http://www.w3.org/2000/svg"
427
431
  };
428
432
 
429
- var _hoisted_2$5 = /*#__PURE__*/createElementVNode("path", {
433
+ var _hoisted_2$3 = /*#__PURE__*/createElementVNode("path", {
430
434
  fill: "currentColor",
431
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"
432
436
  }, null, -1);
433
437
 
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);
438
+ var _hoisted_3$3 = [_hoisted_2$3];
439
+ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
440
+ return openBlock(), createElementBlock("svg", _hoisted_1$3, _hoisted_3$3);
437
441
  }
438
442
 
439
- script$5.render = render$5;
443
+ script$3.render = render$3;
440
444
 
441
- var script$4 = {
445
+ var script$2 = {
442
446
  name: 'IconFolderOpened'
443
447
  };
444
448
 
445
- var _hoisted_1$4 = {
449
+ var _hoisted_1$2 = {
446
450
  "class": "icon",
447
451
  viewBox: "0 0 1024 1024",
448
452
  xmlns: "http://www.w3.org/2000/svg"
449
453
  };
450
454
 
451
- var _hoisted_2$4 = /*#__PURE__*/createElementVNode("path", {
455
+ var _hoisted_2$2 = /*#__PURE__*/createElementVNode("path", {
452
456
  fill: "currentColor",
453
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"
454
458
  }, null, -1);
455
459
 
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);
460
+ var _hoisted_3$2 = [_hoisted_2$2];
461
+ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
462
+ return openBlock(), createElementBlock("svg", _hoisted_1$2, _hoisted_3$2);
459
463
  }
460
464
 
461
- script$4.render = render$4;
465
+ script$2.render = render$2;
462
466
 
463
- function _isSlot$1(s) {
467
+ function _isSlot(s) {
464
468
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
465
469
  }
466
470
 
@@ -573,8 +577,8 @@ var Frame = defineComponent({
573
577
  },
574
578
  emits: ['update:modelValue', 'change'],
575
579
  components: {
576
- IconFolderOpened: script$4,
577
- IconView: script$5
580
+ IconFolderOpened: script$2,
581
+ IconView: script$3
578
582
  },
579
583
  data: function data() {
580
584
  return {
@@ -650,7 +654,7 @@ var Frame = defineComponent({
650
654
  }
651
655
  }, {
652
656
  "default": function _default() {
653
- return [createVNode(script$8, null, null)];
657
+ return [createVNode(script$6, null, null)];
654
658
  }
655
659
  }) : null;
656
660
  }
@@ -721,7 +725,7 @@ var Frame = defineComponent({
721
725
  "key": '6' + index
722
726
  }, {
723
727
  "default": function _default() {
724
- return [createVNode(script$6, null, null)];
728
+ return [createVNode(script$4, null, null)];
725
729
  }
726
730
  });
727
731
  },
@@ -735,7 +739,7 @@ var Frame = defineComponent({
735
739
  }
736
740
  }, {
737
741
  "default": function _default() {
738
- return [createVNode(script$7, null, null)];
742
+ return [createVNode(script$5, null, null)];
739
743
  }
740
744
  }), _this4.makeIcons(src, index)]);
741
745
  }));
@@ -841,7 +845,7 @@ var Frame = defineComponent({
841
845
  "onClick": function onClick() {
842
846
  return _this8.onCancel() !== false && (_this8.frameVisible = false);
843
847
  }
844
- }, _isSlot$1(closeBtnText) ? closeBtnText : {
848
+ }, _isSlot(closeBtnText) ? closeBtnText : {
845
849
  "default": function _default() {
846
850
  return [closeBtnText];
847
851
  }
@@ -850,7 +854,7 @@ var Frame = defineComponent({
850
854
  "onClick": function onClick() {
851
855
  return _this8.onOk() !== false && _this8.closeModel();
852
856
  }
853
- }, _isSlot$1(okBtnText) ? okBtnText : {
857
+ }, _isSlot(okBtnText) ? okBtnText : {
854
858
  "default": function _default() {
855
859
  return [okBtnText];
856
860
  }
@@ -956,7 +960,7 @@ var Radio = defineComponent({
956
960
  },
957
961
  type: String
958
962
  },
959
- emits: ['update:modelValue'],
963
+ emits: ['update:modelValue', 'fc.el'],
960
964
  setup: function setup(props, _) {
961
965
  var options = toRef(props.formCreateInject, 'options', []);
962
966
  var value = toRef(props, 'modelValue');
@@ -982,7 +986,8 @@ var Radio = defineComponent({
982
986
  var Type = resolveComponent(name);
983
987
  return createVNode(resolveComponent("ElRadioGroup"), mergeProps$1(this.$attrs, {
984
988
  "modelValue": this.value,
985
- "onUpdate:modelValue": this.onInput
989
+ "onUpdate:modelValue": this.onInput,
990
+ "ref": "el"
986
991
  }), _objectSpread2({
987
992
  "default": function _default() {
988
993
  return [_this.options().map(function (opt, index) {
@@ -1001,6 +1006,9 @@ var Radio = defineComponent({
1001
1006
  }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
1002
1007
  }
1003
1008
  }, getSlot(this.$slots, ['default'])));
1009
+ },
1010
+ mounted: function mounted() {
1011
+ this.$emit('fc.el', this.$refs.el);
1004
1012
  }
1005
1013
  });
1006
1014
 
@@ -1016,7 +1024,7 @@ var Select = defineComponent({
1016
1024
  },
1017
1025
  type: String
1018
1026
  },
1019
- emits: ['update:modelValue'],
1027
+ emits: ['update:modelValue', 'fc.el'],
1020
1028
  setup: function setup(props) {
1021
1029
  var options = toRef(props.formCreateInject, 'options', []);
1022
1030
  var value = toRef(props, 'modelValue');
@@ -1039,7 +1047,8 @@ var Select = defineComponent({
1039
1047
  "modelValue": this.value,
1040
1048
  "onUpdate:modelValue": function onUpdateModelValue(v) {
1041
1049
  return _this.$emit('update:modelValue', v);
1042
- }
1050
+ },
1051
+ "ref": "el"
1043
1052
  }), _objectSpread2({
1044
1053
  "default": function _default() {
1045
1054
  return [_this.options().map(function (props, index) {
@@ -1049,6 +1058,9 @@ var Select = defineComponent({
1049
1058
  }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
1050
1059
  }
1051
1060
  }, getSlot(this.$slots, ['default'])));
1061
+ },
1062
+ mounted: function mounted() {
1063
+ this.$emit('fc.el', this.$refs.el);
1052
1064
  }
1053
1065
  });
1054
1066
 
@@ -1074,7 +1086,7 @@ var Tree = defineComponent({
1074
1086
  }
1075
1087
  }
1076
1088
  },
1077
- emits: ['update:modelValue'],
1089
+ emits: ['update:modelValue', 'fc.el'],
1078
1090
  watch: {
1079
1091
  modelValue: function modelValue() {
1080
1092
  this.setValue();
@@ -1113,33 +1125,34 @@ var Tree = defineComponent({
1113
1125
  },
1114
1126
  mounted: function mounted() {
1115
1127
  this.setValue();
1128
+ this.$emit('fc.el', this.$refs.tree);
1116
1129
  }
1117
1130
  });
1118
1131
 
1119
- var css_248z$1 = "._fc-exceed .el-upload{display:none}";
1120
- styleInject(css_248z$1);
1132
+ var css_248z$2 = "._fc-exceed .el-upload{display:none}";
1133
+ styleInject(css_248z$2);
1121
1134
 
1122
- var script$3 = {
1135
+ var script$1 = {
1123
1136
  name: 'IconUpload'
1124
1137
  };
1125
1138
 
1126
- var _hoisted_1$3 = {
1139
+ var _hoisted_1$1 = {
1127
1140
  "class": "icon",
1128
1141
  viewBox: "0 0 1024 1024",
1129
1142
  xmlns: "http://www.w3.org/2000/svg"
1130
1143
  };
1131
1144
 
1132
- var _hoisted_2$3 = /*#__PURE__*/createElementVNode("path", {
1145
+ var _hoisted_2$1 = /*#__PURE__*/createElementVNode("path", {
1133
1146
  fill: "currentColor",
1134
1147
  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
1148
  }, null, -1);
1136
1149
 
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);
1150
+ var _hoisted_3$1 = [_hoisted_2$1];
1151
+ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
1152
+ return openBlock(), createElementBlock("svg", _hoisted_1$1, _hoisted_3$1);
1140
1153
  }
1141
1154
 
1142
- script$3.render = render$3;
1155
+ script$1.render = render$1;
1143
1156
 
1144
1157
  function parseFile(file, i) {
1145
1158
  return {
@@ -1171,7 +1184,7 @@ var Upload = defineComponent({
1171
1184
  modalTitle: String,
1172
1185
  modelValue: [Array, String]
1173
1186
  },
1174
- emits: ['update:modelValue', 'change', 'remove'],
1187
+ emits: ['update:modelValue', 'change', 'remove', 'fc.el'],
1175
1188
  data: function data() {
1176
1189
  return {
1177
1190
  previewVisible: false,
@@ -1235,12 +1248,13 @@ var Upload = defineComponent({
1235
1248
  "onPreview": this.handlePreview,
1236
1249
  "onChange": this.handleChange,
1237
1250
  "onRemove": this.handleRemove,
1238
- "fileList": this.fileList
1251
+ "fileList": this.fileList,
1252
+ "ref": "upload"
1239
1253
  }), _objectSpread2({
1240
1254
  "default": function _default() {
1241
1255
  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, {
1242
1256
  "default": function _default() {
1243
- return [createVNode(script$3, null, null)];
1257
+ return [createVNode(script$1, null, null)];
1244
1258
  }
1245
1259
  })];
1246
1260
  }
@@ -1258,6 +1272,9 @@ var Upload = defineComponent({
1258
1272
  }, null)];
1259
1273
  }
1260
1274
  })]);
1275
+ },
1276
+ mounted: function mounted() {
1277
+ this.$emit('fc.el', this.$refs.upload);
1261
1278
  }
1262
1279
  });
1263
1280
 
@@ -1303,65 +1320,6 @@ function hasProperty(rule, k) {
1303
1320
  return {}.hasOwnProperty.call(rule, k);
1304
1321
  }
1305
1322
 
1306
- var script$2 = {
1307
- name: 'IconCirclePlus'
1308
- };
1309
-
1310
- var _hoisted_1$2 = {
1311
- "class": "icon",
1312
- viewBox: "0 0 1024 1024",
1313
- xmlns: "http://www.w3.org/2000/svg"
1314
- };
1315
-
1316
- var _hoisted_2$2 = /*#__PURE__*/createElementVNode("path", {
1317
- fill: "currentColor",
1318
- d: "M352 480h320a32 32 0 110 64H352a32 32 0 010-64z"
1319
- }, null, -1);
1320
-
1321
- var _hoisted_3$2 = /*#__PURE__*/createElementVNode("path", {
1322
- fill: "currentColor",
1323
- d: "M480 672V352a32 32 0 1164 0v320a32 32 0 01-64 0z"
1324
- }, null, -1);
1325
-
1326
- var _hoisted_4$1 = /*#__PURE__*/createElementVNode("path", {
1327
- fill: "currentColor",
1328
- d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"
1329
- }, null, -1);
1330
-
1331
- var _hoisted_5 = [_hoisted_2$2, _hoisted_3$2, _hoisted_4$1];
1332
- function render$2(_ctx, _cache, $props, $setup, $data, $options) {
1333
- return openBlock(), createElementBlock("svg", _hoisted_1$2, _hoisted_5);
1334
- }
1335
-
1336
- script$2.render = render$2;
1337
-
1338
- var script$1 = {
1339
- name: 'IconRemove'
1340
- };
1341
-
1342
- var _hoisted_1$1 = {
1343
- "class": "icon",
1344
- viewBox: "0 0 1024 1024",
1345
- xmlns: "http://www.w3.org/2000/svg"
1346
- };
1347
-
1348
- var _hoisted_2$1 = /*#__PURE__*/createElementVNode("path", {
1349
- fill: "currentColor",
1350
- d: "M352 480h320a32 32 0 110 64H352a32 32 0 010-64z"
1351
- }, null, -1);
1352
-
1353
- var _hoisted_3$1 = /*#__PURE__*/createElementVNode("path", {
1354
- fill: "currentColor",
1355
- d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"
1356
- }, null, -1);
1357
-
1358
- var _hoisted_4 = [_hoisted_2$1, _hoisted_3$1];
1359
- function render$1(_ctx, _cache, $props, $setup, $data, $options) {
1360
- return openBlock(), createElementBlock("svg", _hoisted_1$1, _hoisted_4);
1361
- }
1362
-
1363
- script$1.render = render$1;
1364
-
1365
1323
  function $set(target, field, value) {
1366
1324
  target[field] = value;
1367
1325
  }
@@ -1437,9 +1395,8 @@ function extend() {
1437
1395
  return _extends.apply(this, arguments);
1438
1396
  }
1439
1397
 
1440
- function _isSlot(s) {
1441
- return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
1442
- }
1398
+ var css_248z$1 = "._fc-group{display:flex;flex-direction:column;justify-content:center;min-height:38px;width:100%}._fc-group-disabled ._fc-group-add,._fc-group-disabled ._fc-group-btn{cursor:not-allowed}._fc-group-handle{background-color:#fff;border:1px dashed #d9d9d9;border-radius:15px;bottom:-15px;display:flex;flex-direction:row;padding:3px 8px;position:absolute;right:30px}._fc-group-btn{cursor:pointer}._fc-group-idx{align-items:center;background:#eee;border-radius:15px;bottom:-15px;display:flex;font-weight:700;height:30px;justify-content:center;left:10px;position:absolute;width:30px}._fc-group-handle ._fc-group-btn+._fc-group-btn{margin-left:7px}._fc-group-container{border:1px dashed #d9d9d9;border-radius:5px;display:flex;flex-direction:column;margin:5px 5px 25px;padding:20px 20px 25px;position:relative}._fc-group-arrow{height:20px;position:relative;width:20px}._fc-group-arrow:before{border-left:2px solid #999;border-top:2px solid #999;content:\"\";height:9px;left:5px;position:absolute;top:8px;transform:rotate(45deg);width:9px}._fc-group-arrow._fc-group-down{transform:rotate(180deg)}._fc-group-plus-minus{cursor:pointer;height:20px;position:relative;width:20px}._fc-group-plus-minus:after,._fc-group-plus-minus:before{background-color:#409eff;content:\"\";height:2px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:60%}._fc-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-group-plus-minus._fc-group-minus:before{display:none}._fc-group-plus-minus._fc-group-minus:after{background-color:#f56c6c}._fc-group-add{border:1px solid rgba(64,158,255,.5);border-radius:15px;cursor:pointer;height:25px;width:25px}._fc-group-add._fc-group-plus-minus:after,._fc-group-add._fc-group-plus-minus:before{width:50%}";
1399
+ styleInject(css_248z$1);
1443
1400
 
1444
1401
  var NAME$3 = 'fcGroup';
1445
1402
  var Group = defineComponent({
@@ -1468,6 +1425,10 @@ var Group = defineComponent({
1468
1425
  }
1469
1426
  },
1470
1427
  defaultValue: Object,
1428
+ sortBtn: {
1429
+ type: Boolean,
1430
+ "default": true
1431
+ },
1471
1432
  disabled: {
1472
1433
  type: Boolean,
1473
1434
  "default": false
@@ -1476,10 +1437,6 @@ var Group = defineComponent({
1476
1437
  type: Boolean,
1477
1438
  "default": true
1478
1439
  },
1479
- fontSize: {
1480
- type: Number,
1481
- "default": 28
1482
- },
1483
1440
  onBeforeRemove: {
1484
1441
  type: Function,
1485
1442
  "default": function _default() {}
@@ -1488,13 +1445,15 @@ var Group = defineComponent({
1488
1445
  type: Function,
1489
1446
  "default": function _default() {}
1490
1447
  },
1491
- formCreateInject: Object
1448
+ formCreateInject: Object,
1449
+ parse: Function
1492
1450
  },
1493
1451
  data: function data() {
1494
1452
  return {
1495
1453
  len: 0,
1496
1454
  cacheRule: {},
1497
1455
  cacheValue: {},
1456
+ sort: [],
1498
1457
  form: markRaw(this.formCreateInject.form.$form())
1499
1458
  };
1500
1459
  },
@@ -1548,7 +1507,7 @@ var Group = defineComponent({
1548
1507
  var _this2 = this;
1549
1508
 
1550
1509
  n = n || [];
1551
- var keys = Object.keys(this.cacheRule),
1510
+ var keys = Object.keys(this.sort),
1552
1511
  total = keys.length,
1553
1512
  len = total - n.length;
1554
1513
 
@@ -1590,7 +1549,7 @@ var Group = defineComponent({
1590
1549
  var _this3 = this;
1591
1550
 
1592
1551
  var cacheRule = this.cacheRule;
1593
- var keys = Object.keys(cacheRule);
1552
+ var keys = this.sort;
1594
1553
 
1595
1554
  if (keys.filter(function (k) {
1596
1555
  return cacheRule[k].$f;
@@ -1636,6 +1595,11 @@ var Group = defineComponent({
1636
1595
  extend(options.formData, this.field ? _defineProperty({}, this.field, defVal) : defVal);
1637
1596
  }
1638
1597
 
1598
+ this.parse && this.parse({
1599
+ rule: rule,
1600
+ options: options,
1601
+ index: this.sort.length
1602
+ });
1639
1603
  this.cacheRule[++this.len] = {
1640
1604
  rule: rule,
1641
1605
  options: options
@@ -1651,7 +1615,6 @@ var Group = defineComponent({
1651
1615
  var _this5 = this;
1652
1616
 
1653
1617
  this.cacheRule[key].$f = $f;
1654
- this.formData(key, $f.formData());
1655
1618
  nextTick(function () {
1656
1619
  if (_this5.syncDisabled) {
1657
1620
  $f.disabled(_this5.disabled);
@@ -1673,13 +1636,15 @@ var Group = defineComponent({
1673
1636
  });
1674
1637
  }
1675
1638
  },
1676
- add: function add() {
1639
+ add: function add(i) {
1677
1640
  if (this.disabled || false === this.onBeforeAdd(this.modelValue)) {
1678
1641
  return;
1679
1642
  }
1680
1643
 
1681
- this.modelValue.push(this.field ? null : {});
1682
- this.$emit('update:modelValue', this.modelValue);
1644
+ var value = _toConsumableArray(this.modelValue);
1645
+
1646
+ value.push(this.defaultValue ? deepCopy(this.defaultValue) : this.field ? null : {});
1647
+ this.input(value);
1683
1648
  },
1684
1649
  del: function del(index, key) {
1685
1650
  if (this.disabled || false === this.onBeforeRemove(this.modelValue, index)) {
@@ -1687,38 +1652,56 @@ var Group = defineComponent({
1687
1652
  }
1688
1653
 
1689
1654
  this.removeRule(key, true);
1690
- this.modelValue.splice(index, 1);
1691
- this.input(this.modelValue);
1655
+
1656
+ var value = _toConsumableArray(this.modelValue);
1657
+
1658
+ value.splice(index, 1);
1659
+ this.input(value);
1692
1660
  },
1693
1661
  addIcon: function addIcon(key) {
1694
- return createVNode(resolveComponent("ElIcon"), {
1695
- "key": "a".concat(key),
1696
- "style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer', ";"),
1662
+ return createVNode("div", {
1663
+ "class": "_fc-group-btn _fc-group-plus-minus",
1697
1664
  "onClick": this.add
1698
- }, {
1699
- "default": function _default() {
1700
- return [createVNode(script$2, null, null)];
1701
- }
1702
- });
1665
+ }, null);
1703
1666
  },
1704
1667
  delIcon: function delIcon(index, key) {
1705
1668
  var _this7 = this;
1706
1669
 
1707
- return createVNode(resolveComponent("ElIcon"), {
1708
- "key": "d".concat(key),
1709
- "class": "el-icon-remove-outline",
1710
- "style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer;color:#606266', ";"),
1670
+ return createVNode("div", {
1671
+ "class": "_fc-group-btn _fc-group-plus-minus _fc-group-minus",
1711
1672
  "onClick": function onClick() {
1712
1673
  return _this7.del(index, key);
1713
1674
  }
1714
- }, {
1715
- "default": function _default() {
1716
- return [createVNode(script$1, null, null)];
1675
+ }, null);
1676
+ },
1677
+ sortUpIcon: function sortUpIcon(index) {
1678
+ var _this8 = this;
1679
+
1680
+ return createVNode("div", {
1681
+ "class": "_fc-group-btn _fc-group-arrow _fc-group-up",
1682
+ "onClick": function onClick() {
1683
+ return _this8.changeSort(index, -1);
1717
1684
  }
1718
- });
1685
+ }, null);
1686
+ },
1687
+ sortDownIcon: function sortDownIcon(index) {
1688
+ var _this9 = this;
1689
+
1690
+ return createVNode("div", {
1691
+ "class": "_fc-group-btn _fc-group-arrow _fc-group-down",
1692
+ "onClick": function onClick() {
1693
+ return _this9.changeSort(index, 1);
1694
+ }
1695
+ }, null);
1696
+ },
1697
+ changeSort: function changeSort(index, sort) {
1698
+ var a = this.sort[index];
1699
+ this.sort[index] = this.sort[index + sort];
1700
+ this.sort[index + sort] = a;
1701
+ this.formData(0);
1719
1702
  },
1720
1703
  makeIcon: function makeIcon(total, index, key) {
1721
- var _this8 = this;
1704
+ var _this10 = this;
1722
1705
 
1723
1706
  if (this.$slots.button) {
1724
1707
  return this.$slots.button({
@@ -1727,19 +1710,31 @@ var Group = defineComponent({
1727
1710
  vm: this,
1728
1711
  key: key,
1729
1712
  del: function del() {
1730
- return _this8.del(index, key);
1713
+ return _this10.del(index, key);
1731
1714
  },
1732
1715
  add: this.add
1733
1716
  });
1734
1717
  }
1735
1718
 
1736
- if (index === 0) {
1737
- return [this.max !== 0 && total >= this.max ? null : this.addIcon(key), this.min === 0 || total > this.min ? this.delIcon(index, key) : null];
1719
+ var btn = [];
1720
+
1721
+ if ((!this.max || total < this.max) && total === index + 1) {
1722
+ btn.push(this.addIcon(key));
1738
1723
  }
1739
1724
 
1740
1725
  if (total > this.min) {
1741
- return this.delIcon(index, key);
1726
+ btn.push(this.delIcon(index, key));
1727
+ }
1728
+
1729
+ if (this.sortBtn && index) {
1730
+ btn.push(this.sortUpIcon(index));
1742
1731
  }
1732
+
1733
+ if (this.sortBtn && index !== total - 1) {
1734
+ btn.push(this.sortDownIcon(index));
1735
+ }
1736
+
1737
+ return btn;
1743
1738
  },
1744
1739
  emitEvent: function emitEvent(name, args, index, key) {
1745
1740
  this.$emit.apply(this, [name].concat(_toConsumableArray(args), [this.cacheRule[key].$f, index]));
@@ -1751,6 +1746,15 @@ var Group = defineComponent({
1751
1746
  }
1752
1747
  },
1753
1748
  created: function created() {
1749
+ var _this11 = this;
1750
+
1751
+ watch(function () {
1752
+ return _objectSpread2({}, _this11.cacheRule);
1753
+ }, function (n) {
1754
+ _this11.sort = Object.keys(n);
1755
+ }, {
1756
+ immediate: true
1757
+ });
1754
1758
  var d = (this.expand || 0) - this.modelValue.length;
1755
1759
 
1756
1760
  for (var i = 0; i < this.modelValue.length; i++) {
@@ -1762,75 +1766,58 @@ var Group = defineComponent({
1762
1766
  }
1763
1767
  },
1764
1768
  render: function render() {
1765
- var _this9 = this;
1769
+ var _this12 = this;
1766
1770
 
1767
- var keys = Object.keys(this.cacheRule);
1771
+ var keys = this.sort;
1768
1772
  var button = this.button;
1769
1773
  var Type = this.form;
1770
- return keys.length === 0 ? this.$slots["default"] ? this.$slots["default"]({
1774
+ var disabled = this.disabled;
1775
+ var children = keys.length === 0 ? this.$slots["default"] ? this.$slots["default"]({
1771
1776
  vm: this,
1772
1777
  add: this.add
1773
- }) : createVNode(resolveComponent("ElIcon"), {
1774
- "key": 1,
1775
- "style": "font-size:".concat(this.fontSize, "px;vertical-align:middle;color:").concat(this.disabled ? '#c9cdd4;cursor: not-allowed' : '#606266;cursor:pointer', ";"),
1776
- "onClick": this.add
1777
- }, {
1778
- "default": function _default() {
1779
- return [createVNode(script$2, null, null)];
1780
- }
1781
1778
  }) : createVNode("div", {
1782
- "style": "width: 100%;",
1783
- "key": 2
1784
- }, [keys.map(function (key, index) {
1785
- var _slot;
1786
-
1787
- var _this9$cacheRule$key = _this9.cacheRule[key],
1788
- rule = _this9$cacheRule$key.rule,
1789
- options = _this9$cacheRule$key.options;
1790
- return createVNode(resolveComponent("ElRow"), {
1791
- "align": "middle",
1792
- "key": key,
1793
- "style": "border-bottom:1px dashed #DCDFE6;margin-bottom:10px;"
1779
+ "key": 'a_def',
1780
+ "class": "_fc-group-plus-minus _fc-group-add",
1781
+ "onClick": this.add
1782
+ }, null) : keys.map(function (key, index) {
1783
+ var _this12$cacheRule$key = _this12.cacheRule[key],
1784
+ rule = _this12$cacheRule$key.rule,
1785
+ options = _this12$cacheRule$key.options;
1786
+ var btn = button && !disabled ? _this12.makeIcon(keys.length, index, key) : [];
1787
+ return createVNode("div", {
1788
+ "class": "_fc-group-container",
1789
+ "key": key
1790
+ }, [createVNode(Type, mergeProps$1({
1791
+ "key": key
1794
1792
  }, {
1795
- "default": function _default() {
1796
- return [createVNode(resolveComponent("ElCol"), {
1797
- "span": button ? 20 : 24
1798
- }, {
1799
- "default": function _default() {
1800
- return [createVNode(Type, {
1801
- "key": key,
1802
- "inFor": true,
1803
- "onUpdate:modelValue": function onUpdateModelValue(formData) {
1804
- return _this9.formData(key, formData);
1805
- },
1806
- "modelValue": _this9.field ? _defineProperty({}, _this9.field, _this9._value(_this9.modelValue[index])) : _this9.modelValue[index],
1807
- "onEmit-event": function onEmitEvent(name) {
1808
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1809
- args[_key - 1] = arguments[_key];
1810
- }
1811
-
1812
- return _this9.emitEvent(name, args, index, key);
1813
- },
1814
- "onUpdate:api": function onUpdateApi($f) {
1815
- return _this9.add$f(index, key, $f);
1816
- },
1817
- "rule": rule,
1818
- "option": options,
1819
- "extendOption": true
1820
- }, null)];
1821
- }
1822
- }), button ? createVNode(resolveComponent("ElCol"), {
1823
- "span": 2,
1824
- "pull": 1,
1825
- "push": 1
1826
- }, _isSlot(_slot = _this9.makeIcon(keys.length, index, key)) ? _slot : {
1827
- "default": function _default() {
1828
- return [_slot];
1829
- }
1830
- }) : null];
1831
- }
1832
- });
1833
- })]);
1793
+ 'onUpdate:modelValue': function onUpdateModelValue(formData) {
1794
+ return _this12.formData(key, formData);
1795
+ },
1796
+ 'onEmit-event': function onEmitEvent(name) {
1797
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1798
+ args[_key - 1] = arguments[_key];
1799
+ }
1800
+
1801
+ return _this12.emitEvent(name, args, index, key);
1802
+ },
1803
+ 'onUpdate:api': function onUpdateApi($f) {
1804
+ return _this12.add$f(index, key, $f);
1805
+ },
1806
+ inFor: true,
1807
+ modelValue: _this12.field ? _defineProperty({}, _this12.field, _this12._value(_this12.modelValue[index])) : _this12.modelValue[index],
1808
+ rule: rule,
1809
+ option: options,
1810
+ extendOption: true
1811
+ }), null), createVNode("div", {
1812
+ "class": "_fc-group-idx"
1813
+ }, [index + 1]), btn.length ? createVNode("div", {
1814
+ "class": "_fc-group-handle"
1815
+ }, [btn]) : null]);
1816
+ });
1817
+ return createVNode("div", {
1818
+ "key": 'con',
1819
+ "class": '_fc-group ' + (disabled ? '_fc-group-disabled' : '')
1820
+ }, [children]);
1834
1821
  }
1835
1822
  });
1836
1823
 
@@ -3333,6 +3320,13 @@ function useRender$1(Render) {
3333
3320
  vn.el.__rule__ = ctx.rule;
3334
3321
 
3335
3322
  _this7.onMounted(ctx, vn.el);
3323
+ },
3324
+ 'fc.el': function fcEl(el) {
3325
+ ctx.exportEl = el;
3326
+
3327
+ if (el) {
3328
+ (el.$el || el).__rule__ = ctx.rule;
3329
+ }
3336
3330
  }
3337
3331
  }
3338
3332
  }];
@@ -3702,6 +3696,7 @@ function RuleContext(handle, rule, defaultValue) {
3702
3696
  refRule: {},
3703
3697
  input: isInput,
3704
3698
  el: undefined,
3699
+ exportEl: undefined,
3705
3700
  defaultValue: isInput ? deepCopy(defaultValue) : undefined,
3706
3701
  field: rule.field || undefined
3707
3702
  });
@@ -4225,6 +4220,8 @@ function useLoader(Handler) {
4225
4220
 
4226
4221
  !isCopy && !isInit && _this6.effect(ctx, 'load');
4227
4222
 
4223
+ _this6.effect(ctx, 'created');
4224
+
4228
4225
  var _load = ctx.loadChildrenPending();
4229
4226
 
4230
4227
  ctx.parser.loadChildren === false || loadChildren(_load, ctx);
@@ -5044,6 +5041,8 @@ function useEffect(Handler) {
5044
5041
  data.mergeProp = function (prop) {
5045
5042
  return mergeRule(data.getProp(), [prop]);
5046
5043
  };
5044
+
5045
+ data.id = ctx.id;
5047
5046
  }
5048
5047
 
5049
5048
  _this4.bus.$emit("p:".concat(attr, ":").concat(_type, ":").concat(p.input ? 1 : 0), event, [data, rule, _this4.api]);
@@ -5060,9 +5059,13 @@ function unique(arr) {
5060
5059
 
5061
5060
  function getComponent(p) {
5062
5061
  var c = p.components;
5063
- if (Array.isArray(c)) return unique(c.filter(function (v) {
5064
- return v !== '*';
5065
- }));else if (is.String(c)) return [c];else return false;
5062
+
5063
+ if (Array.isArray(c)) {
5064
+ var arr = unique(c.filter(function (v) {
5065
+ return v !== '*';
5066
+ }));
5067
+ return arr.length ? arr : false;
5068
+ } else if (is.String(c)) return [c];else return false;
5066
5069
  }
5067
5070
 
5068
5071
  function Handler(fc) {
@@ -5371,6 +5374,58 @@ extend(Manager.prototype, {
5371
5374
  render: function render(children) {}
5372
5375
  });
5373
5376
 
5377
+ var loadData = function loadData(fc) {
5378
+ var loadData = {
5379
+ name: 'loadData',
5380
+ _fn: [],
5381
+ created: function created(inject, rule, api) {
5382
+ this.deleted(inject);
5383
+ var attrs = toArray(inject.getValue());
5384
+ var events = [];
5385
+ attrs.forEach(function (attr) {
5386
+ if (attr) {
5387
+ var on = function on() {
5388
+ if (attr.watch !== false) {
5389
+ fc.bus.$off('p.loadData.' + attr.attr, on);
5390
+ fc.bus.$once('p.loadData.' + attr.attr, on);
5391
+ }
5392
+
5393
+ var value = undefined;
5394
+
5395
+ if (attr.attr) {
5396
+ value = fc.loadData[attr.attr] || attr["default"];
5397
+
5398
+ if (attr.copy) {
5399
+ value = deepCopy(value);
5400
+ }
5401
+ }
5402
+
5403
+ deepSet(inject.getProp(), attr.to || 'options', value);
5404
+ api.sync(rule);
5405
+ };
5406
+
5407
+ events.push(function () {
5408
+ return fc.bus.$off('p.loadData.' + attr.attr, on);
5409
+ });
5410
+ on();
5411
+ }
5412
+ });
5413
+ this._fn[inject.id] = events;
5414
+ },
5415
+ deleted: function deleted(inject) {
5416
+ if (this._fn[inject.id]) {
5417
+ this._fn[inject.id].forEach(function (un) {
5418
+ un();
5419
+ });
5420
+ }
5421
+
5422
+ inject.clearProp();
5423
+ }
5424
+ };
5425
+ loadData.watch = loadData.created;
5426
+ return loadData;
5427
+ };
5428
+
5374
5429
  var componentValidate = {
5375
5430
  name: 'componentValidate',
5376
5431
  load: function load(attr, rule, api) {
@@ -5463,6 +5518,15 @@ var fetch = function fetch(fc) {
5463
5518
 
5464
5519
  if (is.Function(option.parse)) {
5465
5520
  fn = option.parse;
5521
+ } else if (option.parse && is.String(option.parse)) {
5522
+ fn = function fn(v) {
5523
+ option.parse.split('.').forEach(function (k) {
5524
+ if (v) {
5525
+ v = v[k];
5526
+ }
5527
+ });
5528
+ return v;
5529
+ };
5466
5530
  }
5467
5531
 
5468
5532
  set(fn(body, rule, api));
@@ -5501,6 +5565,7 @@ var fetch = function fetch(fc) {
5501
5565
 
5502
5566
  var $provider = {
5503
5567
  fetch: fetch,
5568
+ loadData: loadData,
5504
5569
  componentValidate: componentValidate
5505
5570
  };
5506
5571
 
@@ -5570,14 +5635,20 @@ function FormCreateFactory(config) {
5570
5635
  var globalConfig = {
5571
5636
  global: {}
5572
5637
  };
5573
- var data = {};
5638
+ var loadData = {};
5574
5639
  var CreateNode = CreateNodeFactory();
5575
5640
  exportAttrs(config.attrs || {});
5576
5641
 
5577
5642
  function getApi(name) {
5578
5643
  var val = instance[name];
5579
- if (Array.isArray(val)) return _toConsumableArray(val);
5580
- return val;
5644
+
5645
+ if (Array.isArray(val)) {
5646
+ return val.map(function (v) {
5647
+ return v.api();
5648
+ });
5649
+ } else if (val) {
5650
+ return val.api();
5651
+ }
5581
5652
  }
5582
5653
 
5583
5654
  function useApp(fn) {
@@ -5687,7 +5758,7 @@ function FormCreateFactory(config) {
5687
5758
  providers: providers,
5688
5759
  useApps: useApps,
5689
5760
  maker: maker,
5690
- data: data
5761
+ loadData: loadData
5691
5762
  };
5692
5763
  } else {
5693
5764
  delete _config.inherit;
@@ -5700,6 +5771,27 @@ function FormCreateFactory(config) {
5700
5771
  modelFields[name] = field;
5701
5772
  }
5702
5773
 
5774
+ function _emitData(id) {
5775
+ Object.keys(instance).forEach(function (v) {
5776
+ var apis = Array.isArray(instance[v]) ? instance[v] : [instance[v]];
5777
+ apis.forEach(function (that) {
5778
+ that.bus.$emit('p.loadData.' + id);
5779
+ });
5780
+ });
5781
+ }
5782
+
5783
+ function setData(id, data) {
5784
+ loadData[id] = data;
5785
+
5786
+ _emitData(id);
5787
+ }
5788
+
5789
+ function removeData(id) {
5790
+ delete loadData[id];
5791
+
5792
+ _emitData(id);
5793
+ }
5794
+
5703
5795
  function FormCreate(vm) {
5704
5796
  var _this = this;
5705
5797
 
@@ -5712,12 +5804,13 @@ function FormCreateFactory(config) {
5712
5804
  providers: providers,
5713
5805
  modelFields: modelFields,
5714
5806
  rules: vm.props.rule,
5715
- name: vm.props.name,
5807
+ name: vm.props.name || uniqueId(),
5716
5808
  inFor: vm.props.inFor,
5717
5809
  prop: {
5718
5810
  components: components,
5719
5811
  directives: directives
5720
5812
  },
5813
+ loadData: loadData,
5721
5814
  CreateNode: CreateNode,
5722
5815
  bus: new Mitt(),
5723
5816
  unwatch: null,
@@ -5742,9 +5835,9 @@ function FormCreateFactory(config) {
5742
5835
  if (this.name) {
5743
5836
  if (this.inFor) {
5744
5837
  if (!instance[this.name]) instance[this.name] = [];
5745
- instance[this.name].push(this.api());
5838
+ instance[this.name].push(this);
5746
5839
  } else {
5747
- instance[this.name] = this.api();
5840
+ instance[this.name] = this;
5748
5841
  }
5749
5842
  }
5750
5843
  }
@@ -5814,7 +5907,7 @@ function FormCreateFactory(config) {
5814
5907
  unmount: function unmount() {
5815
5908
  if (this.name) {
5816
5909
  if (this.inFor) {
5817
- var idx = instance[this.name].indexOf(this.api());
5910
+ var idx = instance[this.name].indexOf(this);
5818
5911
  instance[this.name].splice(idx, 1);
5819
5912
  } else {
5820
5913
  delete instance[this.name];
@@ -5837,7 +5930,8 @@ function FormCreateFactory(config) {
5837
5930
  extend(formCreate, {
5838
5931
  version: config.version,
5839
5932
  ui: config.ui,
5840
- data: data,
5933
+ setData: setData,
5934
+ removeData: removeData,
5841
5935
  maker: maker,
5842
5936
  component: component,
5843
5937
  directive: directive,
@@ -5907,7 +6001,7 @@ function FormCreateFactory(config) {
5907
6001
  inherit.providers && extend(providers, inherit.providers);
5908
6002
  inherit.useApps && extend(useApps, inherit.useApps);
5909
6003
  inherit.maker && extend(maker, inherit.maker);
5910
- inherit.data && extend(data, inherit.data);
6004
+ inherit.loadData && extend(loadData, inherit.loadData);
5911
6005
  }
5912
6006
 
5913
6007
  return create;
@@ -6546,6 +6640,14 @@ function tidyBtnProp(btn, def) {
6546
6640
 
6547
6641
  function extendApi(api, h) {
6548
6642
  extend(api, {
6643
+ formEl: function formEl() {
6644
+ return h.$manager.form();
6645
+ },
6646
+ wrapEl: function wrapEl(id) {
6647
+ var ctx = h.getFieldCtx(id);
6648
+ if (!ctx) return;
6649
+ return h.vm.refs[ctx.wrapRef];
6650
+ },
6549
6651
  validate: function validate(callback) {
6550
6652
  return new Promise(function (resolve, reject) {
6551
6653
  var forms = api.children;
@@ -6777,7 +6879,7 @@ function install(FormCreate) {
6777
6879
  function elmFormCreate() {
6778
6880
  return FormCreateFactory({
6779
6881
  ui: 'element-ui',
6780
- version: '3.1.23',
6882
+ version: '3.1.24',
6781
6883
  manager: manager,
6782
6884
  extendApi: extendApi,
6783
6885
  install: install,