@form-create/element-ui 3.1.23 → 3.1.25

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.25
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,9 +1006,54 @@ 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
 
1015
+ var is = {
1016
+ type: function type(arg, _type) {
1017
+ return Object.prototype.toString.call(arg) === '[object ' + _type + ']';
1018
+ },
1019
+ Undef: function Undef(v) {
1020
+ return v === undefined || v === null;
1021
+ },
1022
+ Element: function Element(arg) {
1023
+ return _typeof(arg) === 'object' && arg !== null && arg.nodeType === 1 && !is.Object(arg);
1024
+ },
1025
+ trueArray: function trueArray(data) {
1026
+ return Array.isArray(data) && data.length > 0;
1027
+ },
1028
+ Function: function Function(v) {
1029
+ var type = this.getType(v);
1030
+ return type === 'Function' || type === 'AsyncFunction';
1031
+ },
1032
+ getType: function getType(v) {
1033
+ var str = Object.prototype.toString.call(v);
1034
+ return /^\[object (.*)\]$/.exec(str)[1];
1035
+ },
1036
+ empty: function empty(value) {
1037
+ if (value === undefined || value === null) {
1038
+ return true;
1039
+ }
1040
+
1041
+ if (Array.isArray(value) && Array.isArray(value) && !value.length) {
1042
+ return true;
1043
+ }
1044
+
1045
+ return typeof value === 'string' && !value;
1046
+ }
1047
+ };
1048
+ ['Date', 'Object', 'String', 'Boolean', 'Array', 'Number'].forEach(function (t) {
1049
+ is[t] = function (arg) {
1050
+ return is.type(arg, t);
1051
+ };
1052
+ });
1053
+ function hasProperty(rule, k) {
1054
+ return {}.hasOwnProperty.call(rule, k);
1055
+ }
1056
+
1007
1057
  var NAME$6 = 'fcSelect';
1008
1058
  var Select = defineComponent({
1009
1059
  name: NAME$6,
@@ -1016,7 +1066,7 @@ var Select = defineComponent({
1016
1066
  },
1017
1067
  type: String
1018
1068
  },
1019
- emits: ['update:modelValue'],
1069
+ emits: ['update:modelValue', 'fc.el'],
1020
1070
  setup: function setup(props) {
1021
1071
  var options = toRef(props.formCreateInject, 'options', []);
1022
1072
  var value = toRef(props, 'modelValue');
@@ -1035,20 +1085,42 @@ var Select = defineComponent({
1035
1085
  _this$$slots$default,
1036
1086
  _this$$slots;
1037
1087
 
1088
+ var makeOption = function makeOption(props, index) {
1089
+ return createVNode(resolveComponent("ElOption"), mergeProps$1(props, {
1090
+ "key": '' + index + '-' + props.value
1091
+ }), null);
1092
+ };
1093
+
1094
+ var makeOptionGroup = function makeOptionGroup(props, index) {
1095
+ return createVNode(resolveComponent("ElOptionGroup"), {
1096
+ "label": props.label,
1097
+ "key": '' + index + '-' + props.label
1098
+ }, {
1099
+ "default": function _default() {
1100
+ return [is.trueArray(props.options) && props.options.map(function (v, index) {
1101
+ return makeOption(v, index);
1102
+ })];
1103
+ }
1104
+ });
1105
+ };
1106
+
1107
+ var options = this.options();
1038
1108
  return createVNode(resolveComponent("ElSelect"), mergeProps$1(this.$attrs, {
1039
1109
  "modelValue": this.value,
1040
1110
  "onUpdate:modelValue": function onUpdateModelValue(v) {
1041
1111
  return _this.$emit('update:modelValue', v);
1042
- }
1112
+ },
1113
+ "ref": "el"
1043
1114
  }), _objectSpread2({
1044
1115
  "default": function _default() {
1045
- return [_this.options().map(function (props, index) {
1046
- return createVNode(resolveComponent("ElOption"), mergeProps$1(props, {
1047
- "key": '' + index + '-' + props.value
1048
- }), null);
1116
+ return [options.map(function (props, index) {
1117
+ return hasProperty(props || '', 'options') ? makeOptionGroup(props, index) : makeOption(props, index);
1049
1118
  }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
1050
1119
  }
1051
1120
  }, getSlot(this.$slots, ['default'])));
1121
+ },
1122
+ mounted: function mounted() {
1123
+ this.$emit('fc.el', this.$refs.el);
1052
1124
  }
1053
1125
  });
1054
1126
 
@@ -1074,7 +1146,7 @@ var Tree = defineComponent({
1074
1146
  }
1075
1147
  }
1076
1148
  },
1077
- emits: ['update:modelValue'],
1149
+ emits: ['update:modelValue', 'fc.el'],
1078
1150
  watch: {
1079
1151
  modelValue: function modelValue() {
1080
1152
  this.setValue();
@@ -1113,33 +1185,34 @@ var Tree = defineComponent({
1113
1185
  },
1114
1186
  mounted: function mounted() {
1115
1187
  this.setValue();
1188
+ this.$emit('fc.el', this.$refs.tree);
1116
1189
  }
1117
1190
  });
1118
1191
 
1119
- var css_248z$1 = "._fc-exceed .el-upload{display:none}";
1120
- styleInject(css_248z$1);
1192
+ var css_248z$2 = "._fc-exceed .el-upload{display:none}";
1193
+ styleInject(css_248z$2);
1121
1194
 
1122
- var script$3 = {
1195
+ var script$1 = {
1123
1196
  name: 'IconUpload'
1124
1197
  };
1125
1198
 
1126
- var _hoisted_1$3 = {
1199
+ var _hoisted_1$1 = {
1127
1200
  "class": "icon",
1128
1201
  viewBox: "0 0 1024 1024",
1129
1202
  xmlns: "http://www.w3.org/2000/svg"
1130
1203
  };
1131
1204
 
1132
- var _hoisted_2$3 = /*#__PURE__*/createElementVNode("path", {
1205
+ var _hoisted_2$1 = /*#__PURE__*/createElementVNode("path", {
1133
1206
  fill: "currentColor",
1134
1207
  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
1208
  }, null, -1);
1136
1209
 
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);
1210
+ var _hoisted_3$1 = [_hoisted_2$1];
1211
+ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
1212
+ return openBlock(), createElementBlock("svg", _hoisted_1$1, _hoisted_3$1);
1140
1213
  }
1141
1214
 
1142
- script$3.render = render$3;
1215
+ script$1.render = render$1;
1143
1216
 
1144
1217
  function parseFile(file, i) {
1145
1218
  return {
@@ -1171,7 +1244,7 @@ var Upload = defineComponent({
1171
1244
  modalTitle: String,
1172
1245
  modelValue: [Array, String]
1173
1246
  },
1174
- emits: ['update:modelValue', 'change', 'remove'],
1247
+ emits: ['update:modelValue', 'change', 'remove', 'fc.el'],
1175
1248
  data: function data() {
1176
1249
  return {
1177
1250
  previewVisible: false,
@@ -1235,12 +1308,13 @@ var Upload = defineComponent({
1235
1308
  "onPreview": this.handlePreview,
1236
1309
  "onChange": this.handleChange,
1237
1310
  "onRemove": this.handleRemove,
1238
- "fileList": this.fileList
1311
+ "fileList": this.fileList,
1312
+ "ref": "upload"
1239
1313
  }), _objectSpread2({
1240
1314
  "default": function _default() {
1241
1315
  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
1316
  "default": function _default() {
1243
- return [createVNode(script$3, null, null)];
1317
+ return [createVNode(script$1, null, null)];
1244
1318
  }
1245
1319
  })];
1246
1320
  }
@@ -1258,109 +1332,11 @@ var Upload = defineComponent({
1258
1332
  }, null)];
1259
1333
  }
1260
1334
  })]);
1261
- }
1262
- });
1263
-
1264
- var is = {
1265
- type: function type(arg, _type) {
1266
- return Object.prototype.toString.call(arg) === '[object ' + _type + ']';
1267
- },
1268
- Undef: function Undef(v) {
1269
- return v === undefined || v === null;
1270
- },
1271
- Element: function Element(arg) {
1272
- return _typeof(arg) === 'object' && arg !== null && arg.nodeType === 1 && !is.Object(arg);
1273
- },
1274
- trueArray: function trueArray(data) {
1275
- return Array.isArray(data) && data.length > 0;
1276
- },
1277
- Function: function Function(v) {
1278
- var type = this.getType(v);
1279
- return type === 'Function' || type === 'AsyncFunction';
1280
- },
1281
- getType: function getType(v) {
1282
- var str = Object.prototype.toString.call(v);
1283
- return /^\[object (.*)\]$/.exec(str)[1];
1284
1335
  },
1285
- empty: function empty(value) {
1286
- if (value === undefined || value === null) {
1287
- return true;
1288
- }
1289
-
1290
- if (Array.isArray(value) && Array.isArray(value) && !value.length) {
1291
- return true;
1292
- }
1293
-
1294
- return typeof value === 'string' && !value;
1336
+ mounted: function mounted() {
1337
+ this.$emit('fc.el', this.$refs.upload);
1295
1338
  }
1296
- };
1297
- ['Date', 'Object', 'String', 'Boolean', 'Array', 'Number'].forEach(function (t) {
1298
- is[t] = function (arg) {
1299
- return is.type(arg, t);
1300
- };
1301
1339
  });
1302
- function hasProperty(rule, k) {
1303
- return {}.hasOwnProperty.call(rule, k);
1304
- }
1305
-
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
1340
 
1365
1341
  function $set(target, field, value) {
1366
1342
  target[field] = value;
@@ -1437,9 +1413,8 @@ function extend() {
1437
1413
  return _extends.apply(this, arguments);
1438
1414
  }
1439
1415
 
1440
- function _isSlot(s) {
1441
- return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
1442
- }
1416
+ 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%}";
1417
+ styleInject(css_248z$1);
1443
1418
 
1444
1419
  var NAME$3 = 'fcGroup';
1445
1420
  var Group = defineComponent({
@@ -1468,6 +1443,10 @@ var Group = defineComponent({
1468
1443
  }
1469
1444
  },
1470
1445
  defaultValue: Object,
1446
+ sortBtn: {
1447
+ type: Boolean,
1448
+ "default": true
1449
+ },
1471
1450
  disabled: {
1472
1451
  type: Boolean,
1473
1452
  "default": false
@@ -1476,10 +1455,6 @@ var Group = defineComponent({
1476
1455
  type: Boolean,
1477
1456
  "default": true
1478
1457
  },
1479
- fontSize: {
1480
- type: Number,
1481
- "default": 28
1482
- },
1483
1458
  onBeforeRemove: {
1484
1459
  type: Function,
1485
1460
  "default": function _default() {}
@@ -1488,13 +1463,15 @@ var Group = defineComponent({
1488
1463
  type: Function,
1489
1464
  "default": function _default() {}
1490
1465
  },
1491
- formCreateInject: Object
1466
+ formCreateInject: Object,
1467
+ parse: Function
1492
1468
  },
1493
1469
  data: function data() {
1494
1470
  return {
1495
1471
  len: 0,
1496
1472
  cacheRule: {},
1497
1473
  cacheValue: {},
1474
+ sort: [],
1498
1475
  form: markRaw(this.formCreateInject.form.$form())
1499
1476
  };
1500
1477
  },
@@ -1548,7 +1525,7 @@ var Group = defineComponent({
1548
1525
  var _this2 = this;
1549
1526
 
1550
1527
  n = n || [];
1551
- var keys = Object.keys(this.cacheRule),
1528
+ var keys = Object.keys(this.sort),
1552
1529
  total = keys.length,
1553
1530
  len = total - n.length;
1554
1531
 
@@ -1590,7 +1567,7 @@ var Group = defineComponent({
1590
1567
  var _this3 = this;
1591
1568
 
1592
1569
  var cacheRule = this.cacheRule;
1593
- var keys = Object.keys(cacheRule);
1570
+ var keys = this.sort;
1594
1571
 
1595
1572
  if (keys.filter(function (k) {
1596
1573
  return cacheRule[k].$f;
@@ -1636,6 +1613,11 @@ var Group = defineComponent({
1636
1613
  extend(options.formData, this.field ? _defineProperty({}, this.field, defVal) : defVal);
1637
1614
  }
1638
1615
 
1616
+ this.parse && this.parse({
1617
+ rule: rule,
1618
+ options: options,
1619
+ index: this.sort.length
1620
+ });
1639
1621
  this.cacheRule[++this.len] = {
1640
1622
  rule: rule,
1641
1623
  options: options
@@ -1651,7 +1633,6 @@ var Group = defineComponent({
1651
1633
  var _this5 = this;
1652
1634
 
1653
1635
  this.cacheRule[key].$f = $f;
1654
- this.formData(key, $f.formData());
1655
1636
  nextTick(function () {
1656
1637
  if (_this5.syncDisabled) {
1657
1638
  $f.disabled(_this5.disabled);
@@ -1673,13 +1654,15 @@ var Group = defineComponent({
1673
1654
  });
1674
1655
  }
1675
1656
  },
1676
- add: function add() {
1657
+ add: function add(i) {
1677
1658
  if (this.disabled || false === this.onBeforeAdd(this.modelValue)) {
1678
1659
  return;
1679
1660
  }
1680
1661
 
1681
- this.modelValue.push(this.field ? null : {});
1682
- this.$emit('update:modelValue', this.modelValue);
1662
+ var value = _toConsumableArray(this.modelValue);
1663
+
1664
+ value.push(this.defaultValue ? deepCopy(this.defaultValue) : this.field ? null : {});
1665
+ this.input(value);
1683
1666
  },
1684
1667
  del: function del(index, key) {
1685
1668
  if (this.disabled || false === this.onBeforeRemove(this.modelValue, index)) {
@@ -1687,38 +1670,56 @@ var Group = defineComponent({
1687
1670
  }
1688
1671
 
1689
1672
  this.removeRule(key, true);
1690
- this.modelValue.splice(index, 1);
1691
- this.input(this.modelValue);
1673
+
1674
+ var value = _toConsumableArray(this.modelValue);
1675
+
1676
+ value.splice(index, 1);
1677
+ this.input(value);
1692
1678
  },
1693
1679
  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', ";"),
1680
+ return createVNode("div", {
1681
+ "class": "_fc-group-btn _fc-group-plus-minus",
1697
1682
  "onClick": this.add
1698
- }, {
1699
- "default": function _default() {
1700
- return [createVNode(script$2, null, null)];
1701
- }
1702
- });
1683
+ }, null);
1703
1684
  },
1704
1685
  delIcon: function delIcon(index, key) {
1705
1686
  var _this7 = this;
1706
1687
 
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', ";"),
1688
+ return createVNode("div", {
1689
+ "class": "_fc-group-btn _fc-group-plus-minus _fc-group-minus",
1711
1690
  "onClick": function onClick() {
1712
1691
  return _this7.del(index, key);
1713
1692
  }
1714
- }, {
1715
- "default": function _default() {
1716
- return [createVNode(script$1, null, null)];
1693
+ }, null);
1694
+ },
1695
+ sortUpIcon: function sortUpIcon(index) {
1696
+ var _this8 = this;
1697
+
1698
+ return createVNode("div", {
1699
+ "class": "_fc-group-btn _fc-group-arrow _fc-group-up",
1700
+ "onClick": function onClick() {
1701
+ return _this8.changeSort(index, -1);
1717
1702
  }
1718
- });
1703
+ }, null);
1704
+ },
1705
+ sortDownIcon: function sortDownIcon(index) {
1706
+ var _this9 = this;
1707
+
1708
+ return createVNode("div", {
1709
+ "class": "_fc-group-btn _fc-group-arrow _fc-group-down",
1710
+ "onClick": function onClick() {
1711
+ return _this9.changeSort(index, 1);
1712
+ }
1713
+ }, null);
1714
+ },
1715
+ changeSort: function changeSort(index, sort) {
1716
+ var a = this.sort[index];
1717
+ this.sort[index] = this.sort[index + sort];
1718
+ this.sort[index + sort] = a;
1719
+ this.formData(0);
1719
1720
  },
1720
1721
  makeIcon: function makeIcon(total, index, key) {
1721
- var _this8 = this;
1722
+ var _this10 = this;
1722
1723
 
1723
1724
  if (this.$slots.button) {
1724
1725
  return this.$slots.button({
@@ -1727,19 +1728,31 @@ var Group = defineComponent({
1727
1728
  vm: this,
1728
1729
  key: key,
1729
1730
  del: function del() {
1730
- return _this8.del(index, key);
1731
+ return _this10.del(index, key);
1731
1732
  },
1732
1733
  add: this.add
1733
1734
  });
1734
1735
  }
1735
1736
 
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];
1737
+ var btn = [];
1738
+
1739
+ if ((!this.max || total < this.max) && total === index + 1) {
1740
+ btn.push(this.addIcon(key));
1738
1741
  }
1739
1742
 
1740
1743
  if (total > this.min) {
1741
- return this.delIcon(index, key);
1744
+ btn.push(this.delIcon(index, key));
1742
1745
  }
1746
+
1747
+ if (this.sortBtn && index) {
1748
+ btn.push(this.sortUpIcon(index));
1749
+ }
1750
+
1751
+ if (this.sortBtn && index !== total - 1) {
1752
+ btn.push(this.sortDownIcon(index));
1753
+ }
1754
+
1755
+ return btn;
1743
1756
  },
1744
1757
  emitEvent: function emitEvent(name, args, index, key) {
1745
1758
  this.$emit.apply(this, [name].concat(_toConsumableArray(args), [this.cacheRule[key].$f, index]));
@@ -1751,6 +1764,15 @@ var Group = defineComponent({
1751
1764
  }
1752
1765
  },
1753
1766
  created: function created() {
1767
+ var _this11 = this;
1768
+
1769
+ watch(function () {
1770
+ return _objectSpread2({}, _this11.cacheRule);
1771
+ }, function (n) {
1772
+ _this11.sort = Object.keys(n);
1773
+ }, {
1774
+ immediate: true
1775
+ });
1754
1776
  var d = (this.expand || 0) - this.modelValue.length;
1755
1777
 
1756
1778
  for (var i = 0; i < this.modelValue.length; i++) {
@@ -1762,75 +1784,58 @@ var Group = defineComponent({
1762
1784
  }
1763
1785
  },
1764
1786
  render: function render() {
1765
- var _this9 = this;
1787
+ var _this12 = this;
1766
1788
 
1767
- var keys = Object.keys(this.cacheRule);
1789
+ var keys = this.sort;
1768
1790
  var button = this.button;
1769
1791
  var Type = this.form;
1770
- return keys.length === 0 ? this.$slots["default"] ? this.$slots["default"]({
1792
+ var disabled = this.disabled;
1793
+ var children = keys.length === 0 ? this.$slots["default"] ? this.$slots["default"]({
1771
1794
  vm: this,
1772
1795
  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
1796
  }) : 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;"
1797
+ "key": 'a_def',
1798
+ "class": "_fc-group-plus-minus _fc-group-add",
1799
+ "onClick": this.add
1800
+ }, null) : keys.map(function (key, index) {
1801
+ var _this12$cacheRule$key = _this12.cacheRule[key],
1802
+ rule = _this12$cacheRule$key.rule,
1803
+ options = _this12$cacheRule$key.options;
1804
+ var btn = button && !disabled ? _this12.makeIcon(keys.length, index, key) : [];
1805
+ return createVNode("div", {
1806
+ "class": "_fc-group-container",
1807
+ "key": key
1808
+ }, [createVNode(Type, mergeProps$1({
1809
+ "key": key
1794
1810
  }, {
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
- })]);
1811
+ 'onUpdate:modelValue': function onUpdateModelValue(formData) {
1812
+ return _this12.formData(key, formData);
1813
+ },
1814
+ 'onEmit-event': function onEmitEvent(name) {
1815
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1816
+ args[_key - 1] = arguments[_key];
1817
+ }
1818
+
1819
+ return _this12.emitEvent(name, args, index, key);
1820
+ },
1821
+ 'onUpdate:api': function onUpdateApi($f) {
1822
+ return _this12.add$f(index, key, $f);
1823
+ },
1824
+ inFor: true,
1825
+ modelValue: _this12.field ? _defineProperty({}, _this12.field, _this12._value(_this12.modelValue[index])) : _this12.modelValue[index],
1826
+ rule: rule,
1827
+ option: options,
1828
+ extendOption: true
1829
+ }), null), createVNode("div", {
1830
+ "class": "_fc-group-idx"
1831
+ }, [index + 1]), btn.length ? createVNode("div", {
1832
+ "class": "_fc-group-handle"
1833
+ }, [btn]) : null]);
1834
+ });
1835
+ return createVNode("div", {
1836
+ "key": 'con',
1837
+ "class": '_fc-group ' + (disabled ? '_fc-group-disabled' : '')
1838
+ }, [children]);
1834
1839
  }
1835
1840
  });
1836
1841
 
@@ -3333,6 +3338,13 @@ function useRender$1(Render) {
3333
3338
  vn.el.__rule__ = ctx.rule;
3334
3339
 
3335
3340
  _this7.onMounted(ctx, vn.el);
3341
+ },
3342
+ 'fc.el': function fcEl(el) {
3343
+ ctx.exportEl = el;
3344
+
3345
+ if (el) {
3346
+ (el.$el || el).__rule__ = ctx.rule;
3347
+ }
3336
3348
  }
3337
3349
  }
3338
3350
  }];
@@ -3702,6 +3714,7 @@ function RuleContext(handle, rule, defaultValue) {
3702
3714
  refRule: {},
3703
3715
  input: isInput,
3704
3716
  el: undefined,
3717
+ exportEl: undefined,
3705
3718
  defaultValue: isInput ? deepCopy(defaultValue) : undefined,
3706
3719
  field: rule.field || undefined
3707
3720
  });
@@ -3937,7 +3950,8 @@ extend(RuleContext.prototype, {
3937
3950
  vm: handle.vm,
3938
3951
  trueType: handle.getType(this.originType),
3939
3952
  vNode: handle.$render.vNode,
3940
- updated: false
3953
+ updated: false,
3954
+ cacheValue: this.rule.value
3941
3955
  });
3942
3956
  !init && this.unwatch();
3943
3957
  this.watchTo();
@@ -4225,6 +4239,8 @@ function useLoader(Handler) {
4225
4239
 
4226
4240
  !isCopy && !isInit && _this6.effect(ctx, 'load');
4227
4241
 
4242
+ _this6.effect(ctx, 'created');
4243
+
4228
4244
  var _load = ctx.loadChildrenPending();
4229
4245
 
4230
4246
  ctx.parser.loadChildren === false || loadChildren(_load, ctx);
@@ -5044,6 +5060,8 @@ function useEffect(Handler) {
5044
5060
  data.mergeProp = function (prop) {
5045
5061
  return mergeRule(data.getProp(), [prop]);
5046
5062
  };
5063
+
5064
+ data.id = ctx.id;
5047
5065
  }
5048
5066
 
5049
5067
  _this4.bus.$emit("p:".concat(attr, ":").concat(_type, ":").concat(p.input ? 1 : 0), event, [data, rule, _this4.api]);
@@ -5060,9 +5078,13 @@ function unique(arr) {
5060
5078
 
5061
5079
  function getComponent(p) {
5062
5080
  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;
5081
+
5082
+ if (Array.isArray(c)) {
5083
+ var arr = unique(c.filter(function (v) {
5084
+ return v !== '*';
5085
+ }));
5086
+ return arr.length ? arr : false;
5087
+ } else if (is.String(c)) return [c];else return false;
5066
5088
  }
5067
5089
 
5068
5090
  function Handler(fc) {
@@ -5371,6 +5393,58 @@ extend(Manager.prototype, {
5371
5393
  render: function render(children) {}
5372
5394
  });
5373
5395
 
5396
+ var loadData = function loadData(fc) {
5397
+ var loadData = {
5398
+ name: 'loadData',
5399
+ _fn: [],
5400
+ created: function created(inject, rule, api) {
5401
+ this.deleted(inject);
5402
+ var attrs = toArray(inject.getValue());
5403
+ var events = [];
5404
+ attrs.forEach(function (attr) {
5405
+ if (attr) {
5406
+ var on = function on() {
5407
+ if (attr.watch !== false) {
5408
+ fc.bus.$off('p.loadData.' + attr.attr, on);
5409
+ fc.bus.$once('p.loadData.' + attr.attr, on);
5410
+ }
5411
+
5412
+ var value = undefined;
5413
+
5414
+ if (attr.attr) {
5415
+ value = fc.loadData[attr.attr] || attr["default"];
5416
+
5417
+ if (attr.copy) {
5418
+ value = deepCopy(value);
5419
+ }
5420
+ }
5421
+
5422
+ deepSet(inject.getProp(), attr.to || 'options', value);
5423
+ api.sync(rule);
5424
+ };
5425
+
5426
+ events.push(function () {
5427
+ return fc.bus.$off('p.loadData.' + attr.attr, on);
5428
+ });
5429
+ on();
5430
+ }
5431
+ });
5432
+ this._fn[inject.id] = events;
5433
+ },
5434
+ deleted: function deleted(inject) {
5435
+ if (this._fn[inject.id]) {
5436
+ this._fn[inject.id].forEach(function (un) {
5437
+ un();
5438
+ });
5439
+ }
5440
+
5441
+ inject.clearProp();
5442
+ }
5443
+ };
5444
+ loadData.watch = loadData.created;
5445
+ return loadData;
5446
+ };
5447
+
5374
5448
  var componentValidate = {
5375
5449
  name: 'componentValidate',
5376
5450
  load: function load(attr, rule, api) {
@@ -5419,6 +5493,15 @@ var fetch = function fetch(fc) {
5419
5493
  function run(inject, rule, api) {
5420
5494
  var option = inject.value;
5421
5495
 
5496
+ var set = function set(val) {
5497
+ if (val === undefined) {
5498
+ inject.clearProp();
5499
+ api.sync(rule);
5500
+ } else {
5501
+ deepSet(inject.getProp(), option.to || 'options', val);
5502
+ }
5503
+ };
5504
+
5422
5505
  if (is.Function(option)) {
5423
5506
  option = option(rule, api);
5424
5507
  }
@@ -5426,7 +5509,8 @@ var fetch = function fetch(fc) {
5426
5509
  option = parseOpt(option);
5427
5510
 
5428
5511
  if (!option || !option.action) {
5429
- return false;
5512
+ set(undefined);
5513
+ return;
5430
5514
  }
5431
5515
 
5432
5516
  if (!option.to) {
@@ -5443,46 +5527,65 @@ var fetch = function fetch(fc) {
5443
5527
  }
5444
5528
  };
5445
5529
 
5446
- var set = function set(val) {
5447
- if (val === undefined) {
5448
- inject.clearProp();
5449
- api.sync(rule);
5450
- } else {
5451
- deepSet(inject.getProp(), option.to, val);
5452
- }
5453
- };
5530
+ var config = _objectSpread2(_objectSpread2({
5531
+ headers: {}
5532
+ }, option), {}, {
5533
+ onSuccess: function onSuccess(body, flag) {
5534
+ if (check()) return;
5454
5535
 
5455
- invoke(function () {
5456
- return fc.create.fetch(_objectSpread2(_objectSpread2({}, option), {}, {
5457
- onSuccess: function onSuccess(body) {
5458
- if (check()) return;
5536
+ var fn = function fn(v) {
5537
+ return flag ? v : v.data;
5538
+ };
5459
5539
 
5460
- var fn = function fn(v) {
5461
- return v.data;
5540
+ if (is.Function(option.parse)) {
5541
+ fn = option.parse;
5542
+ } else if (option.parse && is.String(option.parse)) {
5543
+ fn = function fn(v) {
5544
+ option.parse.split('.').forEach(function (k) {
5545
+ if (v) {
5546
+ v = v[k];
5547
+ }
5548
+ });
5549
+ return v;
5462
5550
  };
5551
+ }
5463
5552
 
5464
- if (is.Function(option.parse)) {
5465
- fn = option.parse;
5466
- }
5553
+ set(fn(body, rule, api));
5554
+ api.sync(rule);
5555
+ },
5556
+ onError: function onError(e) {
5557
+ set(undefined);
5558
+ if (check()) return;
5467
5559
 
5468
- set(fn(body, rule, api));
5469
- api.sync(rule);
5470
- },
5471
- onError: function onError(e) {
5472
- set(undefined);
5473
- if (check()) return;
5560
+ (_onError || function (e) {
5561
+ return err(e.message || 'fetch fail ' + option.action);
5562
+ })(e, rule, api);
5563
+ }
5564
+ });
5474
5565
 
5475
- (_onError || function (e) {
5476
- return err(e.message || 'fetch fail ' + option.action);
5477
- })(e, rule, api);
5478
- }
5479
- }), {
5566
+ fc.options.beforeFetch && invoke(function () {
5567
+ return fc.options.beforeFetch(config, {
5568
+ rule: rule,
5569
+ api: api
5570
+ });
5571
+ });
5572
+
5573
+ if (is.Function(option.action)) {
5574
+ option.action(rule, api).then(function (val) {
5575
+ config.onSuccess(val, true);
5576
+ })["catch"](function (e) {
5577
+ config.onError(e);
5578
+ });
5579
+ return;
5580
+ }
5581
+
5582
+ invoke(function () {
5583
+ return fc.create.fetch(config, {
5480
5584
  inject: inject,
5481
5585
  rule: rule,
5482
5586
  api: api
5483
5587
  });
5484
5588
  });
5485
- return true;
5486
5589
  }
5487
5590
 
5488
5591
  return {
@@ -5490,17 +5593,15 @@ var fetch = function fetch(fc) {
5490
5593
  loaded: function loaded() {
5491
5594
  run.apply(void 0, arguments);
5492
5595
  },
5493
- watch: function watch(inject, rule, api) {
5494
- if (!run(inject, rule, api)) {
5495
- inject.clearProp();
5496
- api.sync(rule);
5497
- }
5596
+ watch: function watch() {
5597
+ run.apply(void 0, arguments);
5498
5598
  }
5499
5599
  };
5500
5600
  };
5501
5601
 
5502
5602
  var $provider = {
5503
5603
  fetch: fetch,
5604
+ loadData: loadData,
5504
5605
  componentValidate: componentValidate
5505
5606
  };
5506
5607
 
@@ -5570,14 +5671,20 @@ function FormCreateFactory(config) {
5570
5671
  var globalConfig = {
5571
5672
  global: {}
5572
5673
  };
5573
- var data = {};
5674
+ var loadData = {};
5574
5675
  var CreateNode = CreateNodeFactory();
5575
5676
  exportAttrs(config.attrs || {});
5576
5677
 
5577
5678
  function getApi(name) {
5578
5679
  var val = instance[name];
5579
- if (Array.isArray(val)) return _toConsumableArray(val);
5580
- return val;
5680
+
5681
+ if (Array.isArray(val)) {
5682
+ return val.map(function (v) {
5683
+ return v.api();
5684
+ });
5685
+ } else if (val) {
5686
+ return val.api();
5687
+ }
5581
5688
  }
5582
5689
 
5583
5690
  function useApp(fn) {
@@ -5687,7 +5794,7 @@ function FormCreateFactory(config) {
5687
5794
  providers: providers,
5688
5795
  useApps: useApps,
5689
5796
  maker: maker,
5690
- data: data
5797
+ loadData: loadData
5691
5798
  };
5692
5799
  } else {
5693
5800
  delete _config.inherit;
@@ -5700,6 +5807,27 @@ function FormCreateFactory(config) {
5700
5807
  modelFields[name] = field;
5701
5808
  }
5702
5809
 
5810
+ function _emitData(id) {
5811
+ Object.keys(instance).forEach(function (v) {
5812
+ var apis = Array.isArray(instance[v]) ? instance[v] : [instance[v]];
5813
+ apis.forEach(function (that) {
5814
+ that.bus.$emit('p.loadData.' + id);
5815
+ });
5816
+ });
5817
+ }
5818
+
5819
+ function setData(id, data) {
5820
+ loadData[id] = data;
5821
+
5822
+ _emitData(id);
5823
+ }
5824
+
5825
+ function removeData(id) {
5826
+ delete loadData[id];
5827
+
5828
+ _emitData(id);
5829
+ }
5830
+
5703
5831
  function FormCreate(vm) {
5704
5832
  var _this = this;
5705
5833
 
@@ -5712,12 +5840,13 @@ function FormCreateFactory(config) {
5712
5840
  providers: providers,
5713
5841
  modelFields: modelFields,
5714
5842
  rules: vm.props.rule,
5715
- name: vm.props.name,
5843
+ name: vm.props.name || uniqueId(),
5716
5844
  inFor: vm.props.inFor,
5717
5845
  prop: {
5718
5846
  components: components,
5719
5847
  directives: directives
5720
5848
  },
5849
+ loadData: loadData,
5721
5850
  CreateNode: CreateNode,
5722
5851
  bus: new Mitt(),
5723
5852
  unwatch: null,
@@ -5742,9 +5871,9 @@ function FormCreateFactory(config) {
5742
5871
  if (this.name) {
5743
5872
  if (this.inFor) {
5744
5873
  if (!instance[this.name]) instance[this.name] = [];
5745
- instance[this.name].push(this.api());
5874
+ instance[this.name].push(this);
5746
5875
  } else {
5747
- instance[this.name] = this.api();
5876
+ instance[this.name] = this;
5748
5877
  }
5749
5878
  }
5750
5879
  }
@@ -5814,7 +5943,7 @@ function FormCreateFactory(config) {
5814
5943
  unmount: function unmount() {
5815
5944
  if (this.name) {
5816
5945
  if (this.inFor) {
5817
- var idx = instance[this.name].indexOf(this.api());
5946
+ var idx = instance[this.name].indexOf(this);
5818
5947
  instance[this.name].splice(idx, 1);
5819
5948
  } else {
5820
5949
  delete instance[this.name];
@@ -5837,7 +5966,8 @@ function FormCreateFactory(config) {
5837
5966
  extend(formCreate, {
5838
5967
  version: config.version,
5839
5968
  ui: config.ui,
5840
- data: data,
5969
+ setData: setData,
5970
+ removeData: removeData,
5841
5971
  maker: maker,
5842
5972
  component: component,
5843
5973
  directive: directive,
@@ -5907,7 +6037,7 @@ function FormCreateFactory(config) {
5907
6037
  inherit.providers && extend(providers, inherit.providers);
5908
6038
  inherit.useApps && extend(useApps, inherit.useApps);
5909
6039
  inherit.maker && extend(maker, inherit.maker);
5910
- inherit.data && extend(data, inherit.data);
6040
+ inherit.loadData && extend(loadData, inherit.loadData);
5911
6041
  }
5912
6042
 
5913
6043
  return create;
@@ -6546,6 +6676,14 @@ function tidyBtnProp(btn, def) {
6546
6676
 
6547
6677
  function extendApi(api, h) {
6548
6678
  extend(api, {
6679
+ formEl: function formEl() {
6680
+ return h.$manager.form();
6681
+ },
6682
+ wrapEl: function wrapEl(id) {
6683
+ var ctx = h.getFieldCtx(id);
6684
+ if (!ctx) return;
6685
+ return h.vm.refs[ctx.wrapRef];
6686
+ },
6549
6687
  validate: function validate(callback) {
6550
6688
  return new Promise(function (resolve, reject) {
6551
6689
  var forms = api.children;
@@ -6777,7 +6915,7 @@ function install(FormCreate) {
6777
6915
  function elmFormCreate() {
6778
6916
  return FormCreateFactory({
6779
6917
  ui: 'element-ui',
6780
- version: '3.1.23',
6918
+ version: '3.1.25',
6781
6919
  manager: manager,
6782
6920
  extendApi: extendApi,
6783
6921
  install: install,