@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,5 +1,5 @@
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.
@@ -223,7 +223,7 @@
223
223
  },
224
224
  type: String
225
225
  },
226
- emits: ['update:modelValue'],
226
+ emits: ['update:modelValue', 'fc.el'],
227
227
  setup: function setup(props, _) {
228
228
  var options = vue.toRef(props.formCreateInject, 'options', []);
229
229
  var value = vue.toRef(props, 'modelValue');
@@ -249,7 +249,8 @@
249
249
  var Type = vue.resolveComponent(name);
250
250
  return vue.createVNode(vue.resolveComponent("ElCheckboxGroup"), vue.mergeProps(this.$attrs, {
251
251
  "modelValue": this.value,
252
- "onUpdate:modelValue": this.onInput
252
+ "onUpdate:modelValue": this.onInput,
253
+ "ref": "el"
253
254
  }), _objectSpread2({
254
255
  "default": function _default() {
255
256
  return [_this.options().map(function (opt, index) {
@@ -268,6 +269,9 @@
268
269
  }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
269
270
  }
270
271
  }, getSlot(this.$slots, ['default'])));
272
+ },
273
+ mounted: function mounted() {
274
+ this.$emit('fc.el', this.$refs.el);
271
275
  }
272
276
  });
273
277
 
@@ -346,125 +350,125 @@
346
350
  }
347
351
  }
348
352
 
349
- var css_248z$2 = "._fc-frame ._fc-files img{display:inline-block;height:100%;vertical-align:top;width:100%}._fc-frame ._fc-upload-btn{border:1px dashed #c0ccda;cursor:pointer}._fc-frame ._fc-upload-cover{background:rgba(0,0,0,.6);bottom:0;left:0;opacity:0;position:absolute;right:0;top:0;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}._fc-frame ._fc-upload-cover i{color:#fff;cursor:pointer;font-size:20px;margin:0 2px}._fc-frame ._fc-files:hover ._fc-upload-cover{opacity:1}._fc-frame .el-upload{display:block}._fc-frame ._fc-upload-icon{cursor:pointer}._fc-files,._fc-frame ._fc-upload-btn{background:#fff;border:1px solid #c0ccda;border-radius:4px;-webkit-box-shadow:2px 2px 5px rgba(0,0,0,.1);box-shadow:2px 2px 5px rgba(0,0,0,.1);-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;height:58px;line-height:58px;margin-right:4px;overflow:hidden;position:relative;text-align:center;width:58px}";
350
- styleInject(css_248z$2);
353
+ 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}";
354
+ styleInject(css_248z$3);
351
355
 
352
- var script$8 = {
356
+ var script$6 = {
353
357
  name: 'IconCircleClose'
354
358
  };
355
359
 
356
- var _hoisted_1$8 = {
360
+ var _hoisted_1$6 = {
357
361
  "class": "icon",
358
362
  viewBox: "0 0 1024 1024",
359
363
  xmlns: "http://www.w3.org/2000/svg"
360
364
  };
361
365
 
362
- var _hoisted_2$8 = /*#__PURE__*/vue.createElementVNode("path", {
366
+ var _hoisted_2$6 = /*#__PURE__*/vue.createElementVNode("path", {
363
367
  fill: "currentColor",
364
368
  d: "M466.752 512l-90.496-90.496a32 32 0 0145.248-45.248L512 466.752l90.496-90.496a32 32 0 1145.248 45.248L557.248 512l90.496 90.496a32 32 0 11-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 01-45.248-45.248L466.752 512z"
365
369
  }, null, -1);
366
370
 
367
- var _hoisted_3$8 = /*#__PURE__*/vue.createElementVNode("path", {
371
+ var _hoisted_3$6 = /*#__PURE__*/vue.createElementVNode("path", {
368
372
  fill: "currentColor",
369
373
  d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"
370
374
  }, null, -1);
371
375
 
372
- var _hoisted_4$2 = [_hoisted_2$8, _hoisted_3$8];
373
- function render$8(_ctx, _cache, $props, $setup, $data, $options) {
374
- return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$8, _hoisted_4$2);
376
+ var _hoisted_4 = [_hoisted_2$6, _hoisted_3$6];
377
+ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
378
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$6, _hoisted_4);
375
379
  }
376
380
 
377
- script$8.render = render$8;
381
+ script$6.render = render$6;
378
382
 
379
- var script$7 = {
383
+ var script$5 = {
380
384
  name: 'IconDocument'
381
385
  };
382
386
 
383
- var _hoisted_1$7 = {
387
+ var _hoisted_1$5 = {
384
388
  "class": "icon",
385
389
  viewBox: "0 0 1024 1024",
386
390
  xmlns: "http://www.w3.org/2000/svg"
387
391
  };
388
392
 
389
- var _hoisted_2$7 = /*#__PURE__*/vue.createElementVNode("path", {
393
+ var _hoisted_2$5 = /*#__PURE__*/vue.createElementVNode("path", {
390
394
  fill: "currentColor",
391
395
  d: "M832 384H576V128H192v768h640V384zm-26.496-64L640 154.496V320h165.504zM160 64h480l256 256v608a32 32 0 01-32 32H160a32 32 0 01-32-32V96a32 32 0 0132-32zm160 448h384v64H320v-64zm0-192h160v64H320v-64zm0 384h384v64H320v-64z"
392
396
  }, null, -1);
393
397
 
394
- var _hoisted_3$7 = [_hoisted_2$7];
395
- function render$7(_ctx, _cache, $props, $setup, $data, $options) {
396
- return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$7, _hoisted_3$7);
398
+ var _hoisted_3$5 = [_hoisted_2$5];
399
+ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
400
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$5, _hoisted_3$5);
397
401
  }
398
402
 
399
- script$7.render = render$7;
403
+ script$5.render = render$5;
400
404
 
401
- var script$6 = {
405
+ var script$4 = {
402
406
  name: 'IconDelete'
403
407
  };
404
408
 
405
- var _hoisted_1$6 = {
409
+ var _hoisted_1$4 = {
406
410
  "class": "icon",
407
411
  viewBox: "0 0 1024 1024",
408
412
  xmlns: "http://www.w3.org/2000/svg"
409
413
  };
410
414
 
411
- var _hoisted_2$6 = /*#__PURE__*/vue.createElementVNode("path", {
415
+ var _hoisted_2$4 = /*#__PURE__*/vue.createElementVNode("path", {
412
416
  fill: "currentColor",
413
417
  d: "M160 256H96a32 32 0 010-64h256V95.936a32 32 0 0132-32h256a32 32 0 0132 32V192h256a32 32 0 110 64h-64v672a32 32 0 01-32 32H192a32 32 0 01-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 01-32-32V416a32 32 0 0164 0v320a32 32 0 01-32 32zm192 0a32 32 0 01-32-32V416a32 32 0 0164 0v320a32 32 0 01-32 32z"
414
418
  }, null, -1);
415
419
 
416
- var _hoisted_3$6 = [_hoisted_2$6];
417
- function render$6(_ctx, _cache, $props, $setup, $data, $options) {
418
- return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$6, _hoisted_3$6);
420
+ var _hoisted_3$4 = [_hoisted_2$4];
421
+ function render$4(_ctx, _cache, $props, $setup, $data, $options) {
422
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$4, _hoisted_3$4);
419
423
  }
420
424
 
421
- script$6.render = render$6;
425
+ script$4.render = render$4;
422
426
 
423
- var script$5 = {
427
+ var script$3 = {
424
428
  name: 'IconView'
425
429
  };
426
430
 
427
- var _hoisted_1$5 = {
431
+ var _hoisted_1$3 = {
428
432
  "class": "icon",
429
433
  viewBox: "0 0 1024 1024",
430
434
  xmlns: "http://www.w3.org/2000/svg"
431
435
  };
432
436
 
433
- var _hoisted_2$5 = /*#__PURE__*/vue.createElementVNode("path", {
437
+ var _hoisted_2$3 = /*#__PURE__*/vue.createElementVNode("path", {
434
438
  fill: "currentColor",
435
439
  d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 110 448 224 224 0 010-448zm0 64a160.192 160.192 0 00-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z"
436
440
  }, null, -1);
437
441
 
438
- var _hoisted_3$5 = [_hoisted_2$5];
439
- function render$5(_ctx, _cache, $props, $setup, $data, $options) {
440
- return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$5, _hoisted_3$5);
442
+ var _hoisted_3$3 = [_hoisted_2$3];
443
+ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
444
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$3, _hoisted_3$3);
441
445
  }
442
446
 
443
- script$5.render = render$5;
447
+ script$3.render = render$3;
444
448
 
445
- var script$4 = {
449
+ var script$2 = {
446
450
  name: 'IconFolderOpened'
447
451
  };
448
452
 
449
- var _hoisted_1$4 = {
453
+ var _hoisted_1$2 = {
450
454
  "class": "icon",
451
455
  viewBox: "0 0 1024 1024",
452
456
  xmlns: "http://www.w3.org/2000/svg"
453
457
  };
454
458
 
455
- var _hoisted_2$4 = /*#__PURE__*/vue.createElementVNode("path", {
459
+ var _hoisted_2$2 = /*#__PURE__*/vue.createElementVNode("path", {
456
460
  fill: "currentColor",
457
461
  d: "M878.08 448H241.92l-96 384h636.16l96-384zM832 384v-64H485.76L357.504 192H128v448l57.92-231.744A32 32 0 01216.96 384H832zm-24.96 512H96a32 32 0 01-32-32V160a32 32 0 0132-32h287.872l128.384 128H864a32 32 0 0132 32v96h23.04a32 32 0 0131.04 39.744l-112 448A32 32 0 01807.04 896z"
458
462
  }, null, -1);
459
463
 
460
- var _hoisted_3$4 = [_hoisted_2$4];
461
- function render$4(_ctx, _cache, $props, $setup, $data, $options) {
462
- return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$4, _hoisted_3$4);
464
+ var _hoisted_3$2 = [_hoisted_2$2];
465
+ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
466
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$2, _hoisted_3$2);
463
467
  }
464
468
 
465
- script$4.render = render$4;
469
+ script$2.render = render$2;
466
470
 
467
- function _isSlot$1(s) {
471
+ function _isSlot(s) {
468
472
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
469
473
  }
470
474
 
@@ -577,8 +581,8 @@
577
581
  },
578
582
  emits: ['update:modelValue', 'change'],
579
583
  components: {
580
- IconFolderOpened: script$4,
581
- IconView: script$5
584
+ IconFolderOpened: script$2,
585
+ IconView: script$3
582
586
  },
583
587
  data: function data() {
584
588
  return {
@@ -654,7 +658,7 @@
654
658
  }
655
659
  }, {
656
660
  "default": function _default() {
657
- return [vue.createVNode(script$8, null, null)];
661
+ return [vue.createVNode(script$6, null, null)];
658
662
  }
659
663
  }) : null;
660
664
  }
@@ -725,7 +729,7 @@
725
729
  "key": '6' + index
726
730
  }, {
727
731
  "default": function _default() {
728
- return [vue.createVNode(script$6, null, null)];
732
+ return [vue.createVNode(script$4, null, null)];
729
733
  }
730
734
  });
731
735
  },
@@ -739,7 +743,7 @@
739
743
  }
740
744
  }, {
741
745
  "default": function _default() {
742
- return [vue.createVNode(script$7, null, null)];
746
+ return [vue.createVNode(script$5, null, null)];
743
747
  }
744
748
  }), _this4.makeIcons(src, index)]);
745
749
  }));
@@ -845,7 +849,7 @@
845
849
  "onClick": function onClick() {
846
850
  return _this8.onCancel() !== false && (_this8.frameVisible = false);
847
851
  }
848
- }, _isSlot$1(closeBtnText) ? closeBtnText : {
852
+ }, _isSlot(closeBtnText) ? closeBtnText : {
849
853
  "default": function _default() {
850
854
  return [closeBtnText];
851
855
  }
@@ -854,7 +858,7 @@
854
858
  "onClick": function onClick() {
855
859
  return _this8.onOk() !== false && _this8.closeModel();
856
860
  }
857
- }, _isSlot$1(okBtnText) ? okBtnText : {
861
+ }, _isSlot(okBtnText) ? okBtnText : {
858
862
  "default": function _default() {
859
863
  return [okBtnText];
860
864
  }
@@ -960,7 +964,7 @@
960
964
  },
961
965
  type: String
962
966
  },
963
- emits: ['update:modelValue'],
967
+ emits: ['update:modelValue', 'fc.el'],
964
968
  setup: function setup(props, _) {
965
969
  var options = vue.toRef(props.formCreateInject, 'options', []);
966
970
  var value = vue.toRef(props, 'modelValue');
@@ -986,7 +990,8 @@
986
990
  var Type = vue.resolveComponent(name);
987
991
  return vue.createVNode(vue.resolveComponent("ElRadioGroup"), vue.mergeProps(this.$attrs, {
988
992
  "modelValue": this.value,
989
- "onUpdate:modelValue": this.onInput
993
+ "onUpdate:modelValue": this.onInput,
994
+ "ref": "el"
990
995
  }), _objectSpread2({
991
996
  "default": function _default() {
992
997
  return [_this.options().map(function (opt, index) {
@@ -1005,9 +1010,54 @@
1005
1010
  }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
1006
1011
  }
1007
1012
  }, getSlot(this.$slots, ['default'])));
1013
+ },
1014
+ mounted: function mounted() {
1015
+ this.$emit('fc.el', this.$refs.el);
1008
1016
  }
1009
1017
  });
1010
1018
 
1019
+ var is = {
1020
+ type: function type(arg, _type) {
1021
+ return Object.prototype.toString.call(arg) === '[object ' + _type + ']';
1022
+ },
1023
+ Undef: function Undef(v) {
1024
+ return v === undefined || v === null;
1025
+ },
1026
+ Element: function Element(arg) {
1027
+ return _typeof(arg) === 'object' && arg !== null && arg.nodeType === 1 && !is.Object(arg);
1028
+ },
1029
+ trueArray: function trueArray(data) {
1030
+ return Array.isArray(data) && data.length > 0;
1031
+ },
1032
+ Function: function Function(v) {
1033
+ var type = this.getType(v);
1034
+ return type === 'Function' || type === 'AsyncFunction';
1035
+ },
1036
+ getType: function getType(v) {
1037
+ var str = Object.prototype.toString.call(v);
1038
+ return /^\[object (.*)\]$/.exec(str)[1];
1039
+ },
1040
+ empty: function empty(value) {
1041
+ if (value === undefined || value === null) {
1042
+ return true;
1043
+ }
1044
+
1045
+ if (Array.isArray(value) && Array.isArray(value) && !value.length) {
1046
+ return true;
1047
+ }
1048
+
1049
+ return typeof value === 'string' && !value;
1050
+ }
1051
+ };
1052
+ ['Date', 'Object', 'String', 'Boolean', 'Array', 'Number'].forEach(function (t) {
1053
+ is[t] = function (arg) {
1054
+ return is.type(arg, t);
1055
+ };
1056
+ });
1057
+ function hasProperty(rule, k) {
1058
+ return {}.hasOwnProperty.call(rule, k);
1059
+ }
1060
+
1011
1061
  var NAME$6 = 'fcSelect';
1012
1062
  var Select = vue.defineComponent({
1013
1063
  name: NAME$6,
@@ -1020,7 +1070,7 @@
1020
1070
  },
1021
1071
  type: String
1022
1072
  },
1023
- emits: ['update:modelValue'],
1073
+ emits: ['update:modelValue', 'fc.el'],
1024
1074
  setup: function setup(props) {
1025
1075
  var options = vue.toRef(props.formCreateInject, 'options', []);
1026
1076
  var value = vue.toRef(props, 'modelValue');
@@ -1039,20 +1089,42 @@
1039
1089
  _this$$slots$default,
1040
1090
  _this$$slots;
1041
1091
 
1092
+ var makeOption = function makeOption(props, index) {
1093
+ return vue.createVNode(vue.resolveComponent("ElOption"), vue.mergeProps(props, {
1094
+ "key": '' + index + '-' + props.value
1095
+ }), null);
1096
+ };
1097
+
1098
+ var makeOptionGroup = function makeOptionGroup(props, index) {
1099
+ return vue.createVNode(vue.resolveComponent("ElOptionGroup"), {
1100
+ "label": props.label,
1101
+ "key": '' + index + '-' + props.label
1102
+ }, {
1103
+ "default": function _default() {
1104
+ return [is.trueArray(props.options) && props.options.map(function (v, index) {
1105
+ return makeOption(v, index);
1106
+ })];
1107
+ }
1108
+ });
1109
+ };
1110
+
1111
+ var options = this.options();
1042
1112
  return vue.createVNode(vue.resolveComponent("ElSelect"), vue.mergeProps(this.$attrs, {
1043
1113
  "modelValue": this.value,
1044
1114
  "onUpdate:modelValue": function onUpdateModelValue(v) {
1045
1115
  return _this.$emit('update:modelValue', v);
1046
- }
1116
+ },
1117
+ "ref": "el"
1047
1118
  }), _objectSpread2({
1048
1119
  "default": function _default() {
1049
- return [_this.options().map(function (props, index) {
1050
- return vue.createVNode(vue.resolveComponent("ElOption"), vue.mergeProps(props, {
1051
- "key": '' + index + '-' + props.value
1052
- }), null);
1120
+ return [options.map(function (props, index) {
1121
+ return hasProperty(props || '', 'options') ? makeOptionGroup(props, index) : makeOption(props, index);
1053
1122
  }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
1054
1123
  }
1055
1124
  }, getSlot(this.$slots, ['default'])));
1125
+ },
1126
+ mounted: function mounted() {
1127
+ this.$emit('fc.el', this.$refs.el);
1056
1128
  }
1057
1129
  });
1058
1130
 
@@ -1078,7 +1150,7 @@
1078
1150
  }
1079
1151
  }
1080
1152
  },
1081
- emits: ['update:modelValue'],
1153
+ emits: ['update:modelValue', 'fc.el'],
1082
1154
  watch: {
1083
1155
  modelValue: function modelValue() {
1084
1156
  this.setValue();
@@ -1117,33 +1189,34 @@
1117
1189
  },
1118
1190
  mounted: function mounted() {
1119
1191
  this.setValue();
1192
+ this.$emit('fc.el', this.$refs.tree);
1120
1193
  }
1121
1194
  });
1122
1195
 
1123
- var css_248z$1 = "._fc-exceed .el-upload{display:none}";
1124
- styleInject(css_248z$1);
1196
+ var css_248z$2 = "._fc-exceed .el-upload{display:none}";
1197
+ styleInject(css_248z$2);
1125
1198
 
1126
- var script$3 = {
1199
+ var script$1 = {
1127
1200
  name: 'IconUpload'
1128
1201
  };
1129
1202
 
1130
- var _hoisted_1$3 = {
1203
+ var _hoisted_1$1 = {
1131
1204
  "class": "icon",
1132
1205
  viewBox: "0 0 1024 1024",
1133
1206
  xmlns: "http://www.w3.org/2000/svg"
1134
1207
  };
1135
1208
 
1136
- var _hoisted_2$3 = /*#__PURE__*/vue.createElementVNode("path", {
1209
+ var _hoisted_2$1 = /*#__PURE__*/vue.createElementVNode("path", {
1137
1210
  fill: "currentColor",
1138
1211
  d: "M160 832h704a32 32 0 110 64H160a32 32 0 110-64zm384-578.304V704h-64V247.296L237.248 490.048 192 444.8 508.8 128l316.8 316.8-45.312 45.248L544 253.696z"
1139
1212
  }, null, -1);
1140
1213
 
1141
- var _hoisted_3$3 = [_hoisted_2$3];
1142
- function render$3(_ctx, _cache, $props, $setup, $data, $options) {
1143
- return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$3, _hoisted_3$3);
1214
+ var _hoisted_3$1 = [_hoisted_2$1];
1215
+ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
1216
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$1, _hoisted_3$1);
1144
1217
  }
1145
1218
 
1146
- script$3.render = render$3;
1219
+ script$1.render = render$1;
1147
1220
 
1148
1221
  function parseFile(file, i) {
1149
1222
  return {
@@ -1175,7 +1248,7 @@
1175
1248
  modalTitle: String,
1176
1249
  modelValue: [Array, String]
1177
1250
  },
1178
- emits: ['update:modelValue', 'change', 'remove'],
1251
+ emits: ['update:modelValue', 'change', 'remove', 'fc.el'],
1179
1252
  data: function data() {
1180
1253
  return {
1181
1254
  previewVisible: false,
@@ -1239,12 +1312,13 @@
1239
1312
  "onPreview": this.handlePreview,
1240
1313
  "onChange": this.handleChange,
1241
1314
  "onRemove": this.handleRemove,
1242
- "fileList": this.fileList
1315
+ "fileList": this.fileList,
1316
+ "ref": "upload"
1243
1317
  }), _objectSpread2({
1244
1318
  "default": function _default() {
1245
1319
  return [((_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)) || vue.createVNode(vue.resolveComponent("ElIcon"), null, {
1246
1320
  "default": function _default() {
1247
- return [vue.createVNode(script$3, null, null)];
1321
+ return [vue.createVNode(script$1, null, null)];
1248
1322
  }
1249
1323
  })];
1250
1324
  }
@@ -1262,109 +1336,11 @@
1262
1336
  }, null)];
1263
1337
  }
1264
1338
  })]);
1265
- }
1266
- });
1267
-
1268
- var is = {
1269
- type: function type(arg, _type) {
1270
- return Object.prototype.toString.call(arg) === '[object ' + _type + ']';
1271
- },
1272
- Undef: function Undef(v) {
1273
- return v === undefined || v === null;
1274
- },
1275
- Element: function Element(arg) {
1276
- return _typeof(arg) === 'object' && arg !== null && arg.nodeType === 1 && !is.Object(arg);
1277
- },
1278
- trueArray: function trueArray(data) {
1279
- return Array.isArray(data) && data.length > 0;
1280
- },
1281
- Function: function Function(v) {
1282
- var type = this.getType(v);
1283
- return type === 'Function' || type === 'AsyncFunction';
1284
- },
1285
- getType: function getType(v) {
1286
- var str = Object.prototype.toString.call(v);
1287
- return /^\[object (.*)\]$/.exec(str)[1];
1288
1339
  },
1289
- empty: function empty(value) {
1290
- if (value === undefined || value === null) {
1291
- return true;
1292
- }
1293
-
1294
- if (Array.isArray(value) && Array.isArray(value) && !value.length) {
1295
- return true;
1296
- }
1297
-
1298
- return typeof value === 'string' && !value;
1340
+ mounted: function mounted() {
1341
+ this.$emit('fc.el', this.$refs.upload);
1299
1342
  }
1300
- };
1301
- ['Date', 'Object', 'String', 'Boolean', 'Array', 'Number'].forEach(function (t) {
1302
- is[t] = function (arg) {
1303
- return is.type(arg, t);
1304
- };
1305
1343
  });
1306
- function hasProperty(rule, k) {
1307
- return {}.hasOwnProperty.call(rule, k);
1308
- }
1309
-
1310
- var script$2 = {
1311
- name: 'IconCirclePlus'
1312
- };
1313
-
1314
- var _hoisted_1$2 = {
1315
- "class": "icon",
1316
- viewBox: "0 0 1024 1024",
1317
- xmlns: "http://www.w3.org/2000/svg"
1318
- };
1319
-
1320
- var _hoisted_2$2 = /*#__PURE__*/vue.createElementVNode("path", {
1321
- fill: "currentColor",
1322
- d: "M352 480h320a32 32 0 110 64H352a32 32 0 010-64z"
1323
- }, null, -1);
1324
-
1325
- var _hoisted_3$2 = /*#__PURE__*/vue.createElementVNode("path", {
1326
- fill: "currentColor",
1327
- d: "M480 672V352a32 32 0 1164 0v320a32 32 0 01-64 0z"
1328
- }, null, -1);
1329
-
1330
- var _hoisted_4$1 = /*#__PURE__*/vue.createElementVNode("path", {
1331
- fill: "currentColor",
1332
- d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"
1333
- }, null, -1);
1334
-
1335
- var _hoisted_5 = [_hoisted_2$2, _hoisted_3$2, _hoisted_4$1];
1336
- function render$2(_ctx, _cache, $props, $setup, $data, $options) {
1337
- return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$2, _hoisted_5);
1338
- }
1339
-
1340
- script$2.render = render$2;
1341
-
1342
- var script$1 = {
1343
- name: 'IconRemove'
1344
- };
1345
-
1346
- var _hoisted_1$1 = {
1347
- "class": "icon",
1348
- viewBox: "0 0 1024 1024",
1349
- xmlns: "http://www.w3.org/2000/svg"
1350
- };
1351
-
1352
- var _hoisted_2$1 = /*#__PURE__*/vue.createElementVNode("path", {
1353
- fill: "currentColor",
1354
- d: "M352 480h320a32 32 0 110 64H352a32 32 0 010-64z"
1355
- }, null, -1);
1356
-
1357
- var _hoisted_3$1 = /*#__PURE__*/vue.createElementVNode("path", {
1358
- fill: "currentColor",
1359
- d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"
1360
- }, null, -1);
1361
-
1362
- var _hoisted_4 = [_hoisted_2$1, _hoisted_3$1];
1363
- function render$1(_ctx, _cache, $props, $setup, $data, $options) {
1364
- return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$1, _hoisted_4);
1365
- }
1366
-
1367
- script$1.render = render$1;
1368
1344
 
1369
1345
  function $set(target, field, value) {
1370
1346
  target[field] = value;
@@ -1441,9 +1417,8 @@
1441
1417
  return _extends.apply(this, arguments);
1442
1418
  }
1443
1419
 
1444
- function _isSlot(s) {
1445
- return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
1446
- }
1420
+ 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%}";
1421
+ styleInject(css_248z$1);
1447
1422
 
1448
1423
  var NAME$3 = 'fcGroup';
1449
1424
  var Group = vue.defineComponent({
@@ -1472,6 +1447,10 @@
1472
1447
  }
1473
1448
  },
1474
1449
  defaultValue: Object,
1450
+ sortBtn: {
1451
+ type: Boolean,
1452
+ "default": true
1453
+ },
1475
1454
  disabled: {
1476
1455
  type: Boolean,
1477
1456
  "default": false
@@ -1480,10 +1459,6 @@
1480
1459
  type: Boolean,
1481
1460
  "default": true
1482
1461
  },
1483
- fontSize: {
1484
- type: Number,
1485
- "default": 28
1486
- },
1487
1462
  onBeforeRemove: {
1488
1463
  type: Function,
1489
1464
  "default": function _default() {}
@@ -1492,13 +1467,15 @@
1492
1467
  type: Function,
1493
1468
  "default": function _default() {}
1494
1469
  },
1495
- formCreateInject: Object
1470
+ formCreateInject: Object,
1471
+ parse: Function
1496
1472
  },
1497
1473
  data: function data() {
1498
1474
  return {
1499
1475
  len: 0,
1500
1476
  cacheRule: {},
1501
1477
  cacheValue: {},
1478
+ sort: [],
1502
1479
  form: vue.markRaw(this.formCreateInject.form.$form())
1503
1480
  };
1504
1481
  },
@@ -1552,7 +1529,7 @@
1552
1529
  var _this2 = this;
1553
1530
 
1554
1531
  n = n || [];
1555
- var keys = Object.keys(this.cacheRule),
1532
+ var keys = Object.keys(this.sort),
1556
1533
  total = keys.length,
1557
1534
  len = total - n.length;
1558
1535
 
@@ -1594,7 +1571,7 @@
1594
1571
  var _this3 = this;
1595
1572
 
1596
1573
  var cacheRule = this.cacheRule;
1597
- var keys = Object.keys(cacheRule);
1574
+ var keys = this.sort;
1598
1575
 
1599
1576
  if (keys.filter(function (k) {
1600
1577
  return cacheRule[k].$f;
@@ -1640,6 +1617,11 @@
1640
1617
  extend(options.formData, this.field ? _defineProperty({}, this.field, defVal) : defVal);
1641
1618
  }
1642
1619
 
1620
+ this.parse && this.parse({
1621
+ rule: rule,
1622
+ options: options,
1623
+ index: this.sort.length
1624
+ });
1643
1625
  this.cacheRule[++this.len] = {
1644
1626
  rule: rule,
1645
1627
  options: options
@@ -1655,7 +1637,6 @@
1655
1637
  var _this5 = this;
1656
1638
 
1657
1639
  this.cacheRule[key].$f = $f;
1658
- this.formData(key, $f.formData());
1659
1640
  vue.nextTick(function () {
1660
1641
  if (_this5.syncDisabled) {
1661
1642
  $f.disabled(_this5.disabled);
@@ -1677,13 +1658,15 @@
1677
1658
  });
1678
1659
  }
1679
1660
  },
1680
- add: function add() {
1661
+ add: function add(i) {
1681
1662
  if (this.disabled || false === this.onBeforeAdd(this.modelValue)) {
1682
1663
  return;
1683
1664
  }
1684
1665
 
1685
- this.modelValue.push(this.field ? null : {});
1686
- this.$emit('update:modelValue', this.modelValue);
1666
+ var value = _toConsumableArray(this.modelValue);
1667
+
1668
+ value.push(this.defaultValue ? deepCopy(this.defaultValue) : this.field ? null : {});
1669
+ this.input(value);
1687
1670
  },
1688
1671
  del: function del(index, key) {
1689
1672
  if (this.disabled || false === this.onBeforeRemove(this.modelValue, index)) {
@@ -1691,38 +1674,56 @@
1691
1674
  }
1692
1675
 
1693
1676
  this.removeRule(key, true);
1694
- this.modelValue.splice(index, 1);
1695
- this.input(this.modelValue);
1677
+
1678
+ var value = _toConsumableArray(this.modelValue);
1679
+
1680
+ value.splice(index, 1);
1681
+ this.input(value);
1696
1682
  },
1697
1683
  addIcon: function addIcon(key) {
1698
- return vue.createVNode(vue.resolveComponent("ElIcon"), {
1699
- "key": "a".concat(key),
1700
- "style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer', ";"),
1684
+ return vue.createVNode("div", {
1685
+ "class": "_fc-group-btn _fc-group-plus-minus",
1701
1686
  "onClick": this.add
1702
- }, {
1703
- "default": function _default() {
1704
- return [vue.createVNode(script$2, null, null)];
1705
- }
1706
- });
1687
+ }, null);
1707
1688
  },
1708
1689
  delIcon: function delIcon(index, key) {
1709
1690
  var _this7 = this;
1710
1691
 
1711
- return vue.createVNode(vue.resolveComponent("ElIcon"), {
1712
- "key": "d".concat(key),
1713
- "class": "el-icon-remove-outline",
1714
- "style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer;color:#606266', ";"),
1692
+ return vue.createVNode("div", {
1693
+ "class": "_fc-group-btn _fc-group-plus-minus _fc-group-minus",
1715
1694
  "onClick": function onClick() {
1716
1695
  return _this7.del(index, key);
1717
1696
  }
1718
- }, {
1719
- "default": function _default() {
1720
- return [vue.createVNode(script$1, null, null)];
1697
+ }, null);
1698
+ },
1699
+ sortUpIcon: function sortUpIcon(index) {
1700
+ var _this8 = this;
1701
+
1702
+ return vue.createVNode("div", {
1703
+ "class": "_fc-group-btn _fc-group-arrow _fc-group-up",
1704
+ "onClick": function onClick() {
1705
+ return _this8.changeSort(index, -1);
1721
1706
  }
1722
- });
1707
+ }, null);
1708
+ },
1709
+ sortDownIcon: function sortDownIcon(index) {
1710
+ var _this9 = this;
1711
+
1712
+ return vue.createVNode("div", {
1713
+ "class": "_fc-group-btn _fc-group-arrow _fc-group-down",
1714
+ "onClick": function onClick() {
1715
+ return _this9.changeSort(index, 1);
1716
+ }
1717
+ }, null);
1718
+ },
1719
+ changeSort: function changeSort(index, sort) {
1720
+ var a = this.sort[index];
1721
+ this.sort[index] = this.sort[index + sort];
1722
+ this.sort[index + sort] = a;
1723
+ this.formData(0);
1723
1724
  },
1724
1725
  makeIcon: function makeIcon(total, index, key) {
1725
- var _this8 = this;
1726
+ var _this10 = this;
1726
1727
 
1727
1728
  if (this.$slots.button) {
1728
1729
  return this.$slots.button({
@@ -1731,19 +1732,31 @@
1731
1732
  vm: this,
1732
1733
  key: key,
1733
1734
  del: function del() {
1734
- return _this8.del(index, key);
1735
+ return _this10.del(index, key);
1735
1736
  },
1736
1737
  add: this.add
1737
1738
  });
1738
1739
  }
1739
1740
 
1740
- if (index === 0) {
1741
- return [this.max !== 0 && total >= this.max ? null : this.addIcon(key), this.min === 0 || total > this.min ? this.delIcon(index, key) : null];
1741
+ var btn = [];
1742
+
1743
+ if ((!this.max || total < this.max) && total === index + 1) {
1744
+ btn.push(this.addIcon(key));
1742
1745
  }
1743
1746
 
1744
1747
  if (total > this.min) {
1745
- return this.delIcon(index, key);
1748
+ btn.push(this.delIcon(index, key));
1746
1749
  }
1750
+
1751
+ if (this.sortBtn && index) {
1752
+ btn.push(this.sortUpIcon(index));
1753
+ }
1754
+
1755
+ if (this.sortBtn && index !== total - 1) {
1756
+ btn.push(this.sortDownIcon(index));
1757
+ }
1758
+
1759
+ return btn;
1747
1760
  },
1748
1761
  emitEvent: function emitEvent(name, args, index, key) {
1749
1762
  this.$emit.apply(this, [name].concat(_toConsumableArray(args), [this.cacheRule[key].$f, index]));
@@ -1755,6 +1768,15 @@
1755
1768
  }
1756
1769
  },
1757
1770
  created: function created() {
1771
+ var _this11 = this;
1772
+
1773
+ vue.watch(function () {
1774
+ return _objectSpread2({}, _this11.cacheRule);
1775
+ }, function (n) {
1776
+ _this11.sort = Object.keys(n);
1777
+ }, {
1778
+ immediate: true
1779
+ });
1758
1780
  var d = (this.expand || 0) - this.modelValue.length;
1759
1781
 
1760
1782
  for (var i = 0; i < this.modelValue.length; i++) {
@@ -1766,75 +1788,58 @@
1766
1788
  }
1767
1789
  },
1768
1790
  render: function render() {
1769
- var _this9 = this;
1791
+ var _this12 = this;
1770
1792
 
1771
- var keys = Object.keys(this.cacheRule);
1793
+ var keys = this.sort;
1772
1794
  var button = this.button;
1773
1795
  var Type = this.form;
1774
- return keys.length === 0 ? this.$slots["default"] ? this.$slots["default"]({
1796
+ var disabled = this.disabled;
1797
+ var children = keys.length === 0 ? this.$slots["default"] ? this.$slots["default"]({
1775
1798
  vm: this,
1776
1799
  add: this.add
1777
- }) : vue.createVNode(vue.resolveComponent("ElIcon"), {
1778
- "key": 1,
1779
- "style": "font-size:".concat(this.fontSize, "px;vertical-align:middle;color:").concat(this.disabled ? '#c9cdd4;cursor: not-allowed' : '#606266;cursor:pointer', ";"),
1780
- "onClick": this.add
1781
- }, {
1782
- "default": function _default() {
1783
- return [vue.createVNode(script$2, null, null)];
1784
- }
1785
1800
  }) : vue.createVNode("div", {
1786
- "style": "width: 100%;",
1787
- "key": 2
1788
- }, [keys.map(function (key, index) {
1789
- var _slot;
1790
-
1791
- var _this9$cacheRule$key = _this9.cacheRule[key],
1792
- rule = _this9$cacheRule$key.rule,
1793
- options = _this9$cacheRule$key.options;
1794
- return vue.createVNode(vue.resolveComponent("ElRow"), {
1795
- "align": "middle",
1796
- "key": key,
1797
- "style": "border-bottom:1px dashed #DCDFE6;margin-bottom:10px;"
1801
+ "key": 'a_def',
1802
+ "class": "_fc-group-plus-minus _fc-group-add",
1803
+ "onClick": this.add
1804
+ }, null) : keys.map(function (key, index) {
1805
+ var _this12$cacheRule$key = _this12.cacheRule[key],
1806
+ rule = _this12$cacheRule$key.rule,
1807
+ options = _this12$cacheRule$key.options;
1808
+ var btn = button && !disabled ? _this12.makeIcon(keys.length, index, key) : [];
1809
+ return vue.createVNode("div", {
1810
+ "class": "_fc-group-container",
1811
+ "key": key
1812
+ }, [vue.createVNode(Type, vue.mergeProps({
1813
+ "key": key
1798
1814
  }, {
1799
- "default": function _default() {
1800
- return [vue.createVNode(vue.resolveComponent("ElCol"), {
1801
- "span": button ? 20 : 24
1802
- }, {
1803
- "default": function _default() {
1804
- return [vue.createVNode(Type, {
1805
- "key": key,
1806
- "inFor": true,
1807
- "onUpdate:modelValue": function onUpdateModelValue(formData) {
1808
- return _this9.formData(key, formData);
1809
- },
1810
- "modelValue": _this9.field ? _defineProperty({}, _this9.field, _this9._value(_this9.modelValue[index])) : _this9.modelValue[index],
1811
- "onEmit-event": function onEmitEvent(name) {
1812
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1813
- args[_key - 1] = arguments[_key];
1814
- }
1815
-
1816
- return _this9.emitEvent(name, args, index, key);
1817
- },
1818
- "onUpdate:api": function onUpdateApi($f) {
1819
- return _this9.add$f(index, key, $f);
1820
- },
1821
- "rule": rule,
1822
- "option": options,
1823
- "extendOption": true
1824
- }, null)];
1825
- }
1826
- }), button ? vue.createVNode(vue.resolveComponent("ElCol"), {
1827
- "span": 2,
1828
- "pull": 1,
1829
- "push": 1
1830
- }, _isSlot(_slot = _this9.makeIcon(keys.length, index, key)) ? _slot : {
1831
- "default": function _default() {
1832
- return [_slot];
1833
- }
1834
- }) : null];
1835
- }
1836
- });
1837
- })]);
1815
+ 'onUpdate:modelValue': function onUpdateModelValue(formData) {
1816
+ return _this12.formData(key, formData);
1817
+ },
1818
+ 'onEmit-event': function onEmitEvent(name) {
1819
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1820
+ args[_key - 1] = arguments[_key];
1821
+ }
1822
+
1823
+ return _this12.emitEvent(name, args, index, key);
1824
+ },
1825
+ 'onUpdate:api': function onUpdateApi($f) {
1826
+ return _this12.add$f(index, key, $f);
1827
+ },
1828
+ inFor: true,
1829
+ modelValue: _this12.field ? _defineProperty({}, _this12.field, _this12._value(_this12.modelValue[index])) : _this12.modelValue[index],
1830
+ rule: rule,
1831
+ option: options,
1832
+ extendOption: true
1833
+ }), null), vue.createVNode("div", {
1834
+ "class": "_fc-group-idx"
1835
+ }, [index + 1]), btn.length ? vue.createVNode("div", {
1836
+ "class": "_fc-group-handle"
1837
+ }, [btn]) : null]);
1838
+ });
1839
+ return vue.createVNode("div", {
1840
+ "key": 'con',
1841
+ "class": '_fc-group ' + (disabled ? '_fc-group-disabled' : '')
1842
+ }, [children]);
1838
1843
  }
1839
1844
  });
1840
1845
 
@@ -3337,6 +3342,13 @@
3337
3342
  vn.el.__rule__ = ctx.rule;
3338
3343
 
3339
3344
  _this7.onMounted(ctx, vn.el);
3345
+ },
3346
+ 'fc.el': function fcEl(el) {
3347
+ ctx.exportEl = el;
3348
+
3349
+ if (el) {
3350
+ (el.$el || el).__rule__ = ctx.rule;
3351
+ }
3340
3352
  }
3341
3353
  }
3342
3354
  }];
@@ -3706,6 +3718,7 @@
3706
3718
  refRule: {},
3707
3719
  input: isInput,
3708
3720
  el: undefined,
3721
+ exportEl: undefined,
3709
3722
  defaultValue: isInput ? deepCopy(defaultValue) : undefined,
3710
3723
  field: rule.field || undefined
3711
3724
  });
@@ -3941,7 +3954,8 @@
3941
3954
  vm: handle.vm,
3942
3955
  trueType: handle.getType(this.originType),
3943
3956
  vNode: handle.$render.vNode,
3944
- updated: false
3957
+ updated: false,
3958
+ cacheValue: this.rule.value
3945
3959
  });
3946
3960
  !init && this.unwatch();
3947
3961
  this.watchTo();
@@ -4229,6 +4243,8 @@
4229
4243
 
4230
4244
  !isCopy && !isInit && _this6.effect(ctx, 'load');
4231
4245
 
4246
+ _this6.effect(ctx, 'created');
4247
+
4232
4248
  var _load = ctx.loadChildrenPending();
4233
4249
 
4234
4250
  ctx.parser.loadChildren === false || loadChildren(_load, ctx);
@@ -5048,6 +5064,8 @@
5048
5064
  data.mergeProp = function (prop) {
5049
5065
  return mergeRule(data.getProp(), [prop]);
5050
5066
  };
5067
+
5068
+ data.id = ctx.id;
5051
5069
  }
5052
5070
 
5053
5071
  _this4.bus.$emit("p:".concat(attr, ":").concat(_type, ":").concat(p.input ? 1 : 0), event, [data, rule, _this4.api]);
@@ -5064,9 +5082,13 @@
5064
5082
 
5065
5083
  function getComponent(p) {
5066
5084
  var c = p.components;
5067
- if (Array.isArray(c)) return unique(c.filter(function (v) {
5068
- return v !== '*';
5069
- }));else if (is.String(c)) return [c];else return false;
5085
+
5086
+ if (Array.isArray(c)) {
5087
+ var arr = unique(c.filter(function (v) {
5088
+ return v !== '*';
5089
+ }));
5090
+ return arr.length ? arr : false;
5091
+ } else if (is.String(c)) return [c];else return false;
5070
5092
  }
5071
5093
 
5072
5094
  function Handler(fc) {
@@ -5375,6 +5397,58 @@
5375
5397
  render: function render(children) {}
5376
5398
  });
5377
5399
 
5400
+ var loadData = function loadData(fc) {
5401
+ var loadData = {
5402
+ name: 'loadData',
5403
+ _fn: [],
5404
+ created: function created(inject, rule, api) {
5405
+ this.deleted(inject);
5406
+ var attrs = toArray(inject.getValue());
5407
+ var events = [];
5408
+ attrs.forEach(function (attr) {
5409
+ if (attr) {
5410
+ var on = function on() {
5411
+ if (attr.watch !== false) {
5412
+ fc.bus.$off('p.loadData.' + attr.attr, on);
5413
+ fc.bus.$once('p.loadData.' + attr.attr, on);
5414
+ }
5415
+
5416
+ var value = undefined;
5417
+
5418
+ if (attr.attr) {
5419
+ value = fc.loadData[attr.attr] || attr["default"];
5420
+
5421
+ if (attr.copy) {
5422
+ value = deepCopy(value);
5423
+ }
5424
+ }
5425
+
5426
+ deepSet(inject.getProp(), attr.to || 'options', value);
5427
+ api.sync(rule);
5428
+ };
5429
+
5430
+ events.push(function () {
5431
+ return fc.bus.$off('p.loadData.' + attr.attr, on);
5432
+ });
5433
+ on();
5434
+ }
5435
+ });
5436
+ this._fn[inject.id] = events;
5437
+ },
5438
+ deleted: function deleted(inject) {
5439
+ if (this._fn[inject.id]) {
5440
+ this._fn[inject.id].forEach(function (un) {
5441
+ un();
5442
+ });
5443
+ }
5444
+
5445
+ inject.clearProp();
5446
+ }
5447
+ };
5448
+ loadData.watch = loadData.created;
5449
+ return loadData;
5450
+ };
5451
+
5378
5452
  var componentValidate = {
5379
5453
  name: 'componentValidate',
5380
5454
  load: function load(attr, rule, api) {
@@ -5423,6 +5497,15 @@
5423
5497
  function run(inject, rule, api) {
5424
5498
  var option = inject.value;
5425
5499
 
5500
+ var set = function set(val) {
5501
+ if (val === undefined) {
5502
+ inject.clearProp();
5503
+ api.sync(rule);
5504
+ } else {
5505
+ deepSet(inject.getProp(), option.to || 'options', val);
5506
+ }
5507
+ };
5508
+
5426
5509
  if (is.Function(option)) {
5427
5510
  option = option(rule, api);
5428
5511
  }
@@ -5430,7 +5513,8 @@
5430
5513
  option = parseOpt(option);
5431
5514
 
5432
5515
  if (!option || !option.action) {
5433
- return false;
5516
+ set(undefined);
5517
+ return;
5434
5518
  }
5435
5519
 
5436
5520
  if (!option.to) {
@@ -5447,46 +5531,65 @@
5447
5531
  }
5448
5532
  };
5449
5533
 
5450
- var set = function set(val) {
5451
- if (val === undefined) {
5452
- inject.clearProp();
5453
- api.sync(rule);
5454
- } else {
5455
- deepSet(inject.getProp(), option.to, val);
5456
- }
5457
- };
5534
+ var config = _objectSpread2(_objectSpread2({
5535
+ headers: {}
5536
+ }, option), {}, {
5537
+ onSuccess: function onSuccess(body, flag) {
5538
+ if (check()) return;
5458
5539
 
5459
- invoke(function () {
5460
- return fc.create.fetch(_objectSpread2(_objectSpread2({}, option), {}, {
5461
- onSuccess: function onSuccess(body) {
5462
- if (check()) return;
5540
+ var fn = function fn(v) {
5541
+ return flag ? v : v.data;
5542
+ };
5463
5543
 
5464
- var fn = function fn(v) {
5465
- return v.data;
5544
+ if (is.Function(option.parse)) {
5545
+ fn = option.parse;
5546
+ } else if (option.parse && is.String(option.parse)) {
5547
+ fn = function fn(v) {
5548
+ option.parse.split('.').forEach(function (k) {
5549
+ if (v) {
5550
+ v = v[k];
5551
+ }
5552
+ });
5553
+ return v;
5466
5554
  };
5555
+ }
5467
5556
 
5468
- if (is.Function(option.parse)) {
5469
- fn = option.parse;
5470
- }
5557
+ set(fn(body, rule, api));
5558
+ api.sync(rule);
5559
+ },
5560
+ onError: function onError(e) {
5561
+ set(undefined);
5562
+ if (check()) return;
5471
5563
 
5472
- set(fn(body, rule, api));
5473
- api.sync(rule);
5474
- },
5475
- onError: function onError(e) {
5476
- set(undefined);
5477
- if (check()) return;
5564
+ (_onError || function (e) {
5565
+ return err(e.message || 'fetch fail ' + option.action);
5566
+ })(e, rule, api);
5567
+ }
5568
+ });
5478
5569
 
5479
- (_onError || function (e) {
5480
- return err(e.message || 'fetch fail ' + option.action);
5481
- })(e, rule, api);
5482
- }
5483
- }), {
5570
+ fc.options.beforeFetch && invoke(function () {
5571
+ return fc.options.beforeFetch(config, {
5572
+ rule: rule,
5573
+ api: api
5574
+ });
5575
+ });
5576
+
5577
+ if (is.Function(option.action)) {
5578
+ option.action(rule, api).then(function (val) {
5579
+ config.onSuccess(val, true);
5580
+ })["catch"](function (e) {
5581
+ config.onError(e);
5582
+ });
5583
+ return;
5584
+ }
5585
+
5586
+ invoke(function () {
5587
+ return fc.create.fetch(config, {
5484
5588
  inject: inject,
5485
5589
  rule: rule,
5486
5590
  api: api
5487
5591
  });
5488
5592
  });
5489
- return true;
5490
5593
  }
5491
5594
 
5492
5595
  return {
@@ -5494,17 +5597,15 @@
5494
5597
  loaded: function loaded() {
5495
5598
  run.apply(void 0, arguments);
5496
5599
  },
5497
- watch: function watch(inject, rule, api) {
5498
- if (!run(inject, rule, api)) {
5499
- inject.clearProp();
5500
- api.sync(rule);
5501
- }
5600
+ watch: function watch() {
5601
+ run.apply(void 0, arguments);
5502
5602
  }
5503
5603
  };
5504
5604
  };
5505
5605
 
5506
5606
  var $provider = {
5507
5607
  fetch: fetch,
5608
+ loadData: loadData,
5508
5609
  componentValidate: componentValidate
5509
5610
  };
5510
5611
 
@@ -5574,14 +5675,20 @@
5574
5675
  var globalConfig = {
5575
5676
  global: {}
5576
5677
  };
5577
- var data = {};
5678
+ var loadData = {};
5578
5679
  var CreateNode = CreateNodeFactory();
5579
5680
  exportAttrs(config.attrs || {});
5580
5681
 
5581
5682
  function getApi(name) {
5582
5683
  var val = instance[name];
5583
- if (Array.isArray(val)) return _toConsumableArray(val);
5584
- return val;
5684
+
5685
+ if (Array.isArray(val)) {
5686
+ return val.map(function (v) {
5687
+ return v.api();
5688
+ });
5689
+ } else if (val) {
5690
+ return val.api();
5691
+ }
5585
5692
  }
5586
5693
 
5587
5694
  function useApp(fn) {
@@ -5691,7 +5798,7 @@
5691
5798
  providers: providers,
5692
5799
  useApps: useApps,
5693
5800
  maker: maker,
5694
- data: data
5801
+ loadData: loadData
5695
5802
  };
5696
5803
  } else {
5697
5804
  delete _config.inherit;
@@ -5704,6 +5811,27 @@
5704
5811
  modelFields[name] = field;
5705
5812
  }
5706
5813
 
5814
+ function _emitData(id) {
5815
+ Object.keys(instance).forEach(function (v) {
5816
+ var apis = Array.isArray(instance[v]) ? instance[v] : [instance[v]];
5817
+ apis.forEach(function (that) {
5818
+ that.bus.$emit('p.loadData.' + id);
5819
+ });
5820
+ });
5821
+ }
5822
+
5823
+ function setData(id, data) {
5824
+ loadData[id] = data;
5825
+
5826
+ _emitData(id);
5827
+ }
5828
+
5829
+ function removeData(id) {
5830
+ delete loadData[id];
5831
+
5832
+ _emitData(id);
5833
+ }
5834
+
5707
5835
  function FormCreate(vm) {
5708
5836
  var _this = this;
5709
5837
 
@@ -5716,12 +5844,13 @@
5716
5844
  providers: providers,
5717
5845
  modelFields: modelFields,
5718
5846
  rules: vm.props.rule,
5719
- name: vm.props.name,
5847
+ name: vm.props.name || uniqueId(),
5720
5848
  inFor: vm.props.inFor,
5721
5849
  prop: {
5722
5850
  components: components,
5723
5851
  directives: directives
5724
5852
  },
5853
+ loadData: loadData,
5725
5854
  CreateNode: CreateNode,
5726
5855
  bus: new Mitt(),
5727
5856
  unwatch: null,
@@ -5746,9 +5875,9 @@
5746
5875
  if (this.name) {
5747
5876
  if (this.inFor) {
5748
5877
  if (!instance[this.name]) instance[this.name] = [];
5749
- instance[this.name].push(this.api());
5878
+ instance[this.name].push(this);
5750
5879
  } else {
5751
- instance[this.name] = this.api();
5880
+ instance[this.name] = this;
5752
5881
  }
5753
5882
  }
5754
5883
  }
@@ -5818,7 +5947,7 @@
5818
5947
  unmount: function unmount() {
5819
5948
  if (this.name) {
5820
5949
  if (this.inFor) {
5821
- var idx = instance[this.name].indexOf(this.api());
5950
+ var idx = instance[this.name].indexOf(this);
5822
5951
  instance[this.name].splice(idx, 1);
5823
5952
  } else {
5824
5953
  delete instance[this.name];
@@ -5841,7 +5970,8 @@
5841
5970
  extend(formCreate, {
5842
5971
  version: config.version,
5843
5972
  ui: config.ui,
5844
- data: data,
5973
+ setData: setData,
5974
+ removeData: removeData,
5845
5975
  maker: maker,
5846
5976
  component: component,
5847
5977
  directive: directive,
@@ -5911,7 +6041,7 @@
5911
6041
  inherit.providers && extend(providers, inherit.providers);
5912
6042
  inherit.useApps && extend(useApps, inherit.useApps);
5913
6043
  inherit.maker && extend(maker, inherit.maker);
5914
- inherit.data && extend(data, inherit.data);
6044
+ inherit.loadData && extend(loadData, inherit.loadData);
5915
6045
  }
5916
6046
 
5917
6047
  return create;
@@ -6550,6 +6680,14 @@
6550
6680
 
6551
6681
  function extendApi(api, h) {
6552
6682
  extend(api, {
6683
+ formEl: function formEl() {
6684
+ return h.$manager.form();
6685
+ },
6686
+ wrapEl: function wrapEl(id) {
6687
+ var ctx = h.getFieldCtx(id);
6688
+ if (!ctx) return;
6689
+ return h.vm.refs[ctx.wrapRef];
6690
+ },
6553
6691
  validate: function validate(callback) {
6554
6692
  return new Promise(function (resolve, reject) {
6555
6693
  var forms = api.children;
@@ -6781,7 +6919,7 @@
6781
6919
  function elmFormCreate() {
6782
6920
  return FormCreateFactory({
6783
6921
  ui: 'element-ui',
6784
- version: '3.1.23',
6922
+ version: '3.1.25',
6785
6923
  manager: manager,
6786
6924
  extendApi: extendApi,
6787
6925
  install: install,