@form-create/element-ui 3.0.0-alpha.3 → 3.1.1

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,18 +1,14 @@
1
1
  /*!
2
- * @form-create/element-ui v3.0.0-alpha.3
3
- * (c) 2018-2021 xaboy
2
+ * @form-create/element-ui v3.1.0
3
+ * (c) 2018-2022 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
6
6
  */
7
7
  (function (global, factory) {
8
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('element-plus')) :
9
- typeof define === 'function' && define.amd ? define(['exports', 'vue', 'element-plus'], factory) :
10
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.formCreate = {}, global.Vue, global.ElementPlus));
11
- })(this, (function (exports, vue, ElementPlus) { 'use strict';
12
-
13
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
-
15
- var ElementPlus__default = /*#__PURE__*/_interopDefaultLegacy(ElementPlus);
8
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) :
9
+ typeof define === 'function' && define.amd ? define(['exports', 'vue'], factory) :
10
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.formCreate = {}, global.Vue));
11
+ })(this, (function (exports, vue) { 'use strict';
16
12
 
17
13
  function ownKeys(object, enumerableOnly) {
18
14
  var keys = Object.keys(object);
@@ -213,11 +209,12 @@
213
209
  }, []);
214
210
  }
215
211
 
216
- var NAME$a = 'fcCheckbox';
212
+ var NAME$9 = 'fcCheckbox';
217
213
  var Checkbox = vue.defineComponent({
218
- name: NAME$a,
214
+ name: NAME$9,
219
215
  inheritAttrs: false,
220
216
  props: {
217
+ formCreateInject: Object,
221
218
  modelValue: {
222
219
  type: Array,
223
220
  "default": function _default() {
@@ -228,51 +225,21 @@
228
225
  },
229
226
  emits: ['update:modelValue'],
230
227
  setup: function setup(props, _) {
231
- var _toRefs = vue.toRefs(vue.inject('formCreateInject')),
232
- options = _toRefs.options;
233
-
234
- var trueValue = vue.ref([]);
228
+ var options = vue.toRef(props.formCreateInject, 'options', []);
235
229
  var value = vue.toRef(props, 'modelValue');
236
230
 
237
231
  var _options = function _options() {
238
232
  return Array.isArray(options.value) ? options.value : [];
239
233
  };
240
234
 
241
- var update = function update() {
242
- trueValue.value = value.value ? _options().filter(function (opt) {
243
- return value.value.indexOf(opt.value) !== -1;
244
- }).map(function (option) {
245
- return option.label;
246
- }) : [];
247
- };
248
-
249
- vue.watch(options, function () {
250
- update();
251
- }, {
252
- deep: true,
253
- immediate: true
254
- });
255
235
  return {
256
236
  options: _options,
257
- trueValue: trueValue,
258
237
  value: value,
259
238
  onInput: function onInput(n) {
260
- _.emit('update:modelValue', _options().filter(function (opt) {
261
- return n.indexOf(opt.label) !== -1;
262
- }).map(function (opt) {
263
- return opt.value;
264
- }).filter(function (v) {
265
- return v !== undefined;
266
- }));
267
- },
268
- update: update
239
+ _.emit('update:modelValue', n);
240
+ }
269
241
  };
270
242
  },
271
- watch: {
272
- modelValue: function modelValue() {
273
- this.update();
274
- }
275
- },
276
243
  render: function render() {
277
244
  var _this$$slots$default,
278
245
  _this$$slots,
@@ -281,17 +248,23 @@
281
248
  var name = this.type === 'button' ? 'ElCheckboxButton' : 'ElCheckbox';
282
249
  var Type = vue.resolveComponent(name);
283
250
  return vue.createVNode(vue.resolveComponent("ElCheckboxGroup"), vue.mergeProps(this.$attrs, {
284
- "modelValue": this.trueValue,
251
+ "modelValue": this.value,
285
252
  "onUpdate:modelValue": this.onInput
286
253
  }), _objectSpread2({
287
254
  "default": function _default() {
288
255
  return [_this.options().map(function (opt, index) {
289
256
  var props = _objectSpread2({}, opt);
290
257
 
258
+ var value = props.value;
291
259
  delete props.value;
292
260
  return vue.createVNode(Type, vue.mergeProps(props, {
261
+ "label": value,
293
262
  "key": name + index + opt.value
294
- }), null);
263
+ }), {
264
+ "default": function _default() {
265
+ return [props.label || props.value || ''];
266
+ }
267
+ });
295
268
  }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
296
269
  }
297
270
  }, getSlot(this.$slots, ['default'])));
@@ -373,16 +346,16 @@
373
346
  }
374
347
  }
375
348
 
376
- 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-btn,.fc-files{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}";
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}._fc-frame ._fc-upload-cover{background:rgba(0,0,0,.6);bottom:0;left:0;opacity:0;position:absolute;right:0;top:0;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}._fc-frame ._fc-upload-cover i{color:#fff;cursor:pointer;font-size:20px;margin:0 2px}._fc-frame ._fc-files:hover ._fc-upload-cover{opacity:1}._fc-frame .el-upload{display:block}._fc-frame ._fc-upload-btn{cursor:pointer}._fc-files,._fc-frame ._fc-upload-btn{background:#fff;border:1px solid #c0ccda;border-radius:4px;-webkit-box-shadow:2px 2px 5px rgba(0,0,0,.1);box-shadow:2px 2px 5px rgba(0,0,0,.1);-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;height:58px;line-height:58px;margin-right:4px;overflow:hidden;position:relative;text-align:center;width:58px}";
377
350
  styleInject(css_248z$2);
378
351
 
379
352
  function _isSlot$1(s) {
380
353
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
381
354
  }
382
355
 
383
- var NAME$9 = 'fcFrame';
356
+ var NAME$8 = 'fcFrame';
384
357
  var Frame = vue.defineComponent({
385
- name: NAME$9,
358
+ name: NAME$8,
386
359
  props: {
387
360
  type: {
388
361
  type: String,
@@ -403,7 +376,7 @@
403
376
  },
404
377
  icon: {
405
378
  type: String,
406
- "default": 'el-icon-upload2'
379
+ "default": 'upload'
407
380
  },
408
381
  width: {
409
382
  type: String,
@@ -426,7 +399,10 @@
426
399
  "default": '关闭'
427
400
  },
428
401
  modalTitle: String,
429
- handleIcon: [String, Boolean],
402
+ handleIcon: {
403
+ type: [String, Boolean],
404
+ "default": undefined
405
+ },
430
406
  title: String,
431
407
  allowRemove: {
432
408
  type: Boolean,
@@ -481,9 +457,9 @@
481
457
  okBtn: {
482
458
  type: Boolean,
483
459
  "default": true
484
- }
460
+ },
461
+ formCreateInject: Object
485
462
  },
486
- inject: ['formCreateInject'],
487
463
  emits: ['update:modelValue', 'change'],
488
464
  data: function data() {
489
465
  return {
@@ -500,9 +476,6 @@
500
476
  }
501
477
  },
502
478
  methods: {
503
- key: function key(unique) {
504
- return unique;
505
- },
506
479
  close: function close() {
507
480
  this.closeModel(true);
508
481
  },
@@ -542,7 +515,7 @@
542
515
  }).toString(),
543
516
  readonly: true
544
517
  }, {
545
- "key": this.key('input')
518
+ "key": 1
546
519
  }), {
547
520
  append: function append() {
548
521
  return vue.createVNode(vue.resolveComponent("ElButton"), {
@@ -553,14 +526,18 @@
553
526
  }, null);
554
527
  },
555
528
  suffix: function suffix() {
556
- return _this.fileList.length ? vue.createVNode("i", {
557
- "class": "el-input__icon el-icon-circle-close",
529
+ return _this.fileList.length ? vue.createVNode(vue.resolveComponent("ElIcon"), {
530
+ "class": "el-input__icon",
558
531
  "onClick": function onClick() {
559
532
  _this.fileList = [];
560
533
 
561
534
  _this.input();
562
535
  }
563
- }, null) : null;
536
+ }, {
537
+ "default": function _default() {
538
+ return [vue.createVNode(vue.resolveComponent("CircleClose"), null, null)];
539
+ }
540
+ }) : null;
564
541
  }
565
542
  });
566
543
  },
@@ -570,13 +547,13 @@
570
547
  }
571
548
 
572
549
  return vue.createVNode("div", {
573
- "key": this.key('group')
550
+ "key": 2
574
551
  }, [children]);
575
552
  },
576
553
  makeItem: function makeItem(index, children) {
577
554
  return vue.createVNode("div", {
578
- "class": "fc-files",
579
- "key": this.key('file' + index)
555
+ "class": "_fc-files",
556
+ "key": '3' + index
580
557
  }, [children]);
581
558
  },
582
559
  valid: function valid(f) {
@@ -599,43 +576,53 @@
599
576
  }
600
577
 
601
578
  return vue.createVNode("div", {
602
- "class": "fc-upload-cover",
603
- "key": this.key('uc')
579
+ "class": "_fc-upload-cover",
580
+ "key": 4
604
581
  }, [icons]);
605
582
  }
606
583
  },
607
584
  makeHandleIcon: function makeHandleIcon(val, index) {
608
585
  var _this2 = this;
609
586
 
610
- return vue.createVNode("i", {
611
- "class": this.handleIcon === true || this.handleIcon === undefined ? 'el-icon-view' : this.handleIcon,
587
+ var Type = vue.resolveComponent(this.handleIcon === true || this.handleIcon === undefined ? 'view' : this.handleIcon);
588
+ return vue.createVNode(vue.resolveComponent("ElIcon"), {
612
589
  "onClick": function onClick() {
613
590
  return _this2.handleClick(val);
614
591
  },
615
- "key": this.key('hi' + index)
616
- }, null);
592
+ "key": '5' + index
593
+ }, {
594
+ "default": function _default() {
595
+ return [vue.createVNode(Type, null, null)];
596
+ }
597
+ });
617
598
  },
618
599
  makeRemoveIcon: function makeRemoveIcon(val, index) {
619
600
  var _this3 = this;
620
601
 
621
- return vue.createVNode("i", {
622
- "class": "el-icon-delete",
602
+ return vue.createVNode(vue.resolveComponent("ElIcon"), {
623
603
  "onClick": function onClick() {
624
604
  return _this3.handleRemove(val);
625
605
  },
626
- "key": this.key('ri' + index)
627
- }, null);
606
+ "key": '6' + index
607
+ }, {
608
+ "default": function _default() {
609
+ return [vue.createVNode(vue.resolveComponent("delete"), null, null)];
610
+ }
611
+ });
628
612
  },
629
613
  makeFiles: function makeFiles() {
630
614
  var _this4 = this;
631
615
 
632
616
  return this.makeGroup(this.fileList.map(function (src, index) {
633
- return _this4.makeItem(index, [vue.createVNode("i", {
634
- "class": "el-icon-tickets",
617
+ return _this4.makeItem(index, [vue.createVNode(vue.resolveComponent("ElIcon"), {
635
618
  "onClick": function onClick() {
636
619
  return _this4.handleClick(src);
637
620
  }
638
- }, null), _this4.makeIcons(src, index)]);
621
+ }, {
622
+ "default": function _default() {
623
+ return [vue.createVNode(vue.resolveComponent("document"), null, null)];
624
+ }
625
+ }), _this4.makeIcons(src, index)]);
639
626
  }));
640
627
  },
641
628
  makeImages: function makeImages() {
@@ -650,15 +637,18 @@
650
637
  makeBtn: function makeBtn() {
651
638
  var _this6 = this;
652
639
 
640
+ var Type = vue.resolveComponent(this.icon);
653
641
  return vue.createVNode("div", {
654
- "class": "fc-upload-btn",
642
+ "class": "_fc-upload-btn",
655
643
  "onClick": function onClick() {
656
644
  return _this6.showModel();
657
645
  },
658
- "key": this.key('btn')
659
- }, [vue.createVNode("i", {
660
- "class": this.icon
661
- }, null)]);
646
+ "key": 7
647
+ }, [vue.createVNode(vue.resolveComponent("ElIcon"), null, {
648
+ "default": function _default() {
649
+ return [vue.createVNode(Type, null, null)];
650
+ }
651
+ })]);
662
652
  },
663
653
  handleClick: function handleClick(src) {
664
654
  if (this.onHandle) {
@@ -788,7 +778,6 @@
788
778
  }, {
789
779
  "default": function _default() {
790
780
  return [vue.createVNode("img", {
791
- "alt": "example",
792
781
  "style": "width: 100%",
793
782
  "src": _this9.previewImage
794
783
  }, null)];
@@ -810,7 +799,7 @@
810
799
  "src": src,
811
800
  "frameBorder": "0",
812
801
  "style": {
813
- 'height': height,
802
+ height: height,
814
803
  'border': '0 none',
815
804
  'width': '100%'
816
805
  }
@@ -839,64 +828,35 @@
839
828
  }
840
829
  });
841
830
 
842
- var NAME$8 = 'fcRadio';
831
+ var NAME$7 = 'fcRadio';
843
832
  var Radio = vue.defineComponent({
844
- name: NAME$8,
833
+ name: NAME$7,
845
834
  inheritAttrs: false,
846
835
  props: {
836
+ formCreateInject: Object,
847
837
  modelValue: {
848
- type: [String, Number],
849
- "default": function _default() {
850
- return [];
851
- }
838
+ type: [String, Number, Boolean],
839
+ "default": ''
852
840
  },
853
841
  type: String
854
842
  },
855
843
  emits: ['update:modelValue'],
856
844
  setup: function setup(props, _) {
857
- var _toRefs = vue.toRefs(vue.inject('formCreateInject')),
858
- options = _toRefs.options;
859
-
860
- var trueValue = vue.ref([]);
845
+ var options = vue.toRef(props.formCreateInject, 'options', []);
861
846
  var value = vue.toRef(props, 'modelValue');
862
847
 
863
848
  var _options = function _options() {
864
849
  return Array.isArray(options.value) ? options.value : [];
865
850
  };
866
851
 
867
- var update = function update() {
868
- trueValue.value = _options().filter(function (opt) {
869
- return opt.value === value.value;
870
- }).reduce(function (initial, opt) {
871
- return opt.label;
872
- }, '');
873
- };
874
-
875
- vue.watch(options, function () {
876
- update();
877
- }, {
878
- deep: true,
879
- immediate: true
880
- });
881
852
  return {
882
853
  options: _options,
883
- trueValue: trueValue,
884
854
  value: value,
885
855
  onInput: function onInput(n) {
886
- _.emit('update:modelValue', _options().filter(function (opt) {
887
- return opt.label === n;
888
- }).reduce(function (initial, opt) {
889
- return opt.value;
890
- }, ''));
891
- },
892
- update: update
856
+ _.emit('update:modelValue', n);
857
+ }
893
858
  };
894
859
  },
895
- watch: {
896
- modelValue: function modelValue() {
897
- this.update();
898
- }
899
- },
900
860
  render: function render() {
901
861
  var _this$$slots$default,
902
862
  _this$$slots,
@@ -905,41 +865,44 @@
905
865
  var name = this.type === 'button' ? 'ElRadioButton' : 'ElRadio';
906
866
  var Type = vue.resolveComponent(name);
907
867
  return vue.createVNode(vue.resolveComponent("ElRadioGroup"), vue.mergeProps(this.$attrs, {
908
- "modelValue": this.trueValue,
868
+ "modelValue": this.value,
909
869
  "onUpdate:modelValue": this.onInput
910
870
  }), _objectSpread2({
911
871
  "default": function _default() {
912
872
  return [_this.options().map(function (opt, index) {
913
873
  var props = _objectSpread2({}, opt);
914
874
 
875
+ var value = props.value;
915
876
  delete props.value;
916
877
  return vue.createVNode(Type, vue.mergeProps(props, {
878
+ "label": value,
917
879
  "key": name + index + opt.value
918
- }), null);
880
+ }), {
881
+ "default": function _default() {
882
+ return [props.label || props.value || ''];
883
+ }
884
+ });
919
885
  }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
920
886
  }
921
887
  }, getSlot(this.$slots, ['default'])));
922
888
  }
923
889
  });
924
890
 
925
- var NAME$7 = 'fcSelect';
891
+ var NAME$6 = 'fcSelect';
926
892
  var Select = vue.defineComponent({
927
- name: NAME$7,
893
+ name: NAME$6,
928
894
  inheritAttrs: false,
929
895
  props: {
896
+ formCreateInject: Object,
930
897
  modelValue: {
931
- type: Array,
932
- "default": function _default() {
933
- return [];
934
- }
898
+ type: [Array, String, Number, Boolean, Object],
899
+ "default": undefined
935
900
  },
936
901
  type: String
937
902
  },
938
903
  emits: ['update:modelValue'],
939
904
  setup: function setup(props) {
940
- var _toRefs = vue.toRefs(vue.inject('formCreateInject')),
941
- options = _toRefs.options;
942
-
905
+ var options = vue.toRef(props.formCreateInject, 'options', []);
943
906
  var value = vue.toRef(props, 'modelValue');
944
907
 
945
908
  var _options = function _options() {
@@ -973,9 +936,9 @@
973
936
  }
974
937
  });
975
938
 
976
- var NAME$6 = 'fcTree';
939
+ var NAME$5 = 'fcTree';
977
940
  var Tree = vue.defineComponent({
978
- name: NAME$6,
941
+ name: NAME$5,
979
942
  inheritAttrs: false,
980
943
  formCreateParser: {
981
944
  mergeProp: function mergeProp(ctx) {
@@ -1037,7 +1000,7 @@
1037
1000
  }
1038
1001
  });
1039
1002
 
1040
- var css_248z$1 = "._fc-upload .fc-files img{display:inline-block;height:100%;vertical-align:top;width:100%}._fc-upload .fc-upload-btn{border:1px dashed #c0ccda;cursor:pointer}._fc-upload .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-upload .fc-upload-cover i{color:#fff;cursor:pointer;font-size:20px;margin:0 2px}._fc-upload .fc-files:hover .fc-upload-cover{opacity:1}._fc-upload .el-upload{display:block}._fc-upload .fc-files,._fc-upload .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}";
1003
+ var css_248z$1 = "._fc-exceed .el-upload{display:none}";
1041
1004
  styleInject(css_248z$1);
1042
1005
 
1043
1006
  function parseFile(file, i) {
@@ -1052,37 +1015,21 @@
1052
1015
  return ('' + file).split('/').pop();
1053
1016
  }
1054
1017
 
1055
- var NAME$5 = 'fcUpload';
1018
+ var NAME$4 = 'fcUpload';
1056
1019
  var Upload = vue.defineComponent({
1057
- name: NAME$5,
1020
+ name: NAME$4,
1058
1021
  inheritAttrs: false,
1059
1022
  props: {
1060
- onHandle: Function,
1061
- uploadType: {
1062
- type: String,
1063
- "default": 'file'
1064
- },
1065
- limit: {
1066
- type: Number,
1067
- "default": 0
1068
- },
1069
- allowRemove: {
1070
- type: Boolean,
1071
- "default": true
1072
- },
1073
1023
  previewMask: undefined,
1074
1024
  modalTitle: String,
1075
- handleIcon: [String, Boolean],
1076
1025
  modelValue: [Array, String]
1077
1026
  },
1078
- emits: ['update:modelValue'],
1027
+ emits: ['update:modelValue', 'change', 'remove'],
1079
1028
  data: function data() {
1080
1029
  return {
1081
- uploadList: [],
1082
1030
  previewVisible: false,
1083
1031
  previewImage: '',
1084
- fileList: [],
1085
- cacheFiles: []
1032
+ fileList: []
1086
1033
  };
1087
1034
  },
1088
1035
  created: function created() {
@@ -1090,13 +1037,6 @@
1090
1037
  },
1091
1038
  watch: {
1092
1039
  modelValue: function modelValue(n) {
1093
- if (this.$refs.upload.uploadFiles.every(function (file) {
1094
- return !file.status || file.status === 'success';
1095
- })) {
1096
- this.$refs.upload.uploadFiles = toArray(n).map(parseFile);
1097
- this.uploadList = this.$refs.upload.uploadFiles;
1098
- }
1099
-
1100
1040
  this.fileList = toArray(n).map(parseFile);
1101
1041
  },
1102
1042
  limit: function limit(n, o) {
@@ -1106,141 +1046,62 @@
1106
1046
  }
1107
1047
  },
1108
1048
  methods: {
1109
- key: function key(unique) {
1110
- return unique;
1111
- },
1112
- isDisabled: function isDisabled() {
1113
- return this.$attrs.disabled === true;
1114
- },
1115
- onRemove: function onRemove(file) {
1116
- if (this.isDisabled()) {
1117
- return;
1118
- }
1119
-
1120
- this.$refs.upload.handleRemove(file);
1121
- },
1122
- handleClick: function handleClick(file) {
1123
- if (this.onHandle) {
1124
- return this.onHandle(file);
1049
+ handlePreview: function handlePreview(file) {
1050
+ if (this.onPreview) {
1051
+ this.onPreview.apply(this, arguments);
1125
1052
  } else {
1126
1053
  this.previewImage = file.url;
1127
1054
  this.previewVisible = true;
1128
1055
  }
1129
1056
  },
1130
- makeItem: function makeItem(file, index) {
1131
- return this.uploadType === 'image' ? vue.createVNode("img", {
1132
- "src": file.url,
1133
- "key": this.key('img' + index)
1134
- }, null) : vue.createVNode("i", {
1135
- "class": "el-icon-document",
1136
- "key": this.key('i' + index)
1137
- }, null);
1138
- },
1139
- makeRemoveIcon: function makeRemoveIcon(file, index) {
1140
- var _this = this;
1141
-
1142
- return vue.createVNode("i", {
1143
- "class": "el-icon-delete",
1144
- "onClick": function onClick() {
1145
- return _this.onRemove(file);
1146
- },
1147
- "key": this.key('ri' + index)
1148
- }, null);
1149
- },
1150
- makeHandleIcon: function makeHandleIcon(file, index) {
1151
- var _this2 = this;
1152
-
1153
- return vue.createVNode("i", {
1154
- "class": this.handleIcon === true || this.handleIcon === undefined ? 'el-icon-view' : this.handleIcon,
1155
- "onClick": function onClick() {
1156
- return _this2.handleClick(file);
1157
- },
1158
- "key": this.key('hi' + index)
1159
- }, null);
1160
- },
1161
- makeProgress: function makeProgress(file, index) {
1162
- return vue.createVNode(vue.resolveComponent("ElProgress"), vue.mergeProps({
1163
- percentage: file.percentage,
1164
- type: 'circle',
1165
- width: 52
1166
- }, {
1167
- "style": "margin-top:2px;",
1168
- "key": this.key('pg' + index)
1169
- }), null);
1170
- },
1171
- makeIcons: function makeIcons(file, index) {
1172
- var icons = [];
1173
-
1174
- if (this.allowRemove || this.handleIcon !== false) {
1175
- if (this.uploadType !== 'file' && this.handleIcon !== false || this.uploadType === 'file' && this.handleIcon) {
1176
- icons.push(this.makeHandleIcon(file, index));
1177
- }
1178
-
1179
- if (this.allowRemove) {
1180
- icons.push(this.makeRemoveIcon(file, index));
1181
- }
1182
-
1183
- return vue.createVNode("div", {
1184
- "class": "fc-upload-cover"
1185
- }, [icons]);
1186
- }
1187
- },
1188
- makeFiles: function makeFiles() {
1189
- var _this3 = this;
1190
-
1191
- return this.uploadList.map(function (file, index) {
1192
- return vue.createVNode("div", {
1193
- "key": _this3.key(index),
1194
- "class": "fc-files"
1195
- }, [file.percentage !== undefined && file.status !== 'success' ? _this3.makeProgress(file, index) : [_this3.makeItem(file, index), _this3.makeIcons(file, index)]]);
1196
- });
1197
- },
1198
- makeUpload: function makeUpload() {
1199
- var _this$$slots$default,
1200
- _this$$slots,
1201
- _this4 = this;
1202
-
1203
- var isShow = !this.limit || this.limit > this.uploadList.length;
1204
- return vue.createVNode(vue.resolveComponent("ElUpload"), vue.mergeProps(this.$attrs, {
1205
- "showFileList": false,
1206
- "fileList": this.fileList,
1207
- "ref": "upload",
1208
- "style": {
1209
- display: 'inline-block'
1210
- },
1211
- "key": this.key('upload')
1212
- }), _objectSpread2({
1213
- "default": function _default() {
1214
- return [isShow ? ((_this$$slots$default = (_this$$slots = _this4.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)) || vue.createVNode("div", {
1215
- "class": "fc-upload-btn"
1216
- }, [vue.createVNode("i", {
1217
- "class": "el-icon-upload2"
1218
- }, null)]) : undefined];
1219
- }
1220
- }, getSlot(this.$slots, ['default'])));
1221
- },
1222
- update: function update() {
1223
- var files = this.$refs.upload.uploadFiles.map(function (file) {
1057
+ update: function update(fileList) {
1058
+ var files = fileList.map(function (file) {
1224
1059
  return file.url;
1225
1060
  }).filter(function (url) {
1226
1061
  return url !== undefined;
1227
1062
  });
1228
-
1229
- if (this.cacheFiles.length !== files.length) {
1230
- this.cacheFiles = _toConsumableArray(files);
1231
- this.$emit('update:modelValue', this.limit === 1 ? files[0] || '' : files);
1232
- }
1063
+ this.$emit('update:modelValue', this.limit === 1 ? files[0] || '' : files);
1233
1064
  },
1234
1065
  handleCancel: function handleCancel() {
1235
1066
  this.previewVisible = false;
1067
+ },
1068
+ handleChange: function handleChange(file, fileList) {
1069
+ this.$emit.apply(this, ['change'].concat(Array.prototype.slice.call(arguments)));
1070
+
1071
+ if (file.status === 'success') {
1072
+ this.update(fileList);
1073
+ }
1074
+ },
1075
+ handleRemove: function handleRemove(file, fileList) {
1076
+ this.$emit.apply(this, ['remove'].concat(Array.prototype.slice.call(arguments)));
1077
+ this.update(fileList);
1236
1078
  }
1237
1079
  },
1238
1080
  render: function render() {
1239
- var _this5 = this;
1081
+ var _this$$slots$default,
1082
+ _this$$slots,
1083
+ _this = this;
1240
1084
 
1241
- return vue.createVNode("div", {
1242
- "class": "_fc-upload"
1243
- }, [[this.$attrs.showFileList ? [] : this.makeFiles(), this.makeUpload()], vue.createVNode(vue.resolveComponent("ElDialog"), {
1085
+ return vue.createVNode(vue.Fragment, null, [vue.createVNode(vue.resolveComponent("ElUpload"), vue.mergeProps({
1086
+ "key": this.modelValue.length,
1087
+ "list-type": "picture-card"
1088
+ }, this.$attrs, {
1089
+ "class": {
1090
+ '_fc-exceed': this.$attrs.limit ? this.$attrs.limit <= this.modelValue.length : false
1091
+ },
1092
+ "onPreview": this.handlePreview,
1093
+ "onChange": this.handleChange,
1094
+ "onRemove": this.handleRemove,
1095
+ "fileList": this.fileList
1096
+ }), _objectSpread2({
1097
+ "default": function _default() {
1098
+ 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, {
1099
+ "default": function _default() {
1100
+ return [vue.createVNode(vue.resolveComponent("upload"), null, null)];
1101
+ }
1102
+ })];
1103
+ }
1104
+ }, getSlot(this.$slots, ['default']))), vue.createVNode(vue.resolveComponent("ElDialog"), {
1244
1105
  "appendToBody": true,
1245
1106
  "modal": this.previewMask,
1246
1107
  "title": this.modalTitle,
@@ -1249,24 +1110,11 @@
1249
1110
  }, {
1250
1111
  "default": function _default() {
1251
1112
  return [vue.createVNode("img", {
1252
- "alt": "example",
1253
1113
  "style": "width: 100%",
1254
- "src": _this5.previewImage
1114
+ "src": _this.previewImage
1255
1115
  }, null)];
1256
1116
  }
1257
1117
  })]);
1258
- },
1259
- mounted: function mounted() {
1260
- var _this6 = this;
1261
-
1262
- this.uploadList = this.$refs.upload.uploadFiles;
1263
- this.$watch(function () {
1264
- return _this6.$refs.upload.uploadFiles;
1265
- }, function () {
1266
- _this6.update();
1267
- }, {
1268
- deep: true
1269
- });
1270
1118
  }
1271
1119
  });
1272
1120
 
@@ -1297,9 +1145,9 @@
1297
1145
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
1298
1146
  }
1299
1147
 
1300
- var NAME$4 = 'fcGroup';
1148
+ var NAME$3 = 'fcGroup';
1301
1149
  var Group = vue.defineComponent({
1302
- name: NAME$4,
1150
+ name: NAME$3,
1303
1151
  props: {
1304
1152
  field: String,
1305
1153
  rule: Array,
@@ -1342,9 +1190,9 @@
1342
1190
  onBeforeAdd: {
1343
1191
  type: Function,
1344
1192
  "default": function _default() {}
1345
- }
1193
+ },
1194
+ formCreateInject: Object
1346
1195
  },
1347
- inject: ['formCreateInject'],
1348
1196
  data: function data() {
1349
1197
  return {
1350
1198
  len: 0,
@@ -1401,7 +1249,8 @@
1401
1249
  });
1402
1250
  }
1403
1251
  },
1404
- deep: true
1252
+ deep: true,
1253
+ flush: 'post'
1405
1254
  }
1406
1255
  },
1407
1256
  methods: {
@@ -1521,24 +1370,31 @@
1521
1370
  this.input(this.modelValue);
1522
1371
  },
1523
1372
  addIcon: function addIcon(key) {
1524
- return vue.createVNode("i", {
1373
+ return vue.createVNode(vue.resolveComponent("el-icon"), {
1525
1374
  "key": "a".concat(key),
1526
- "class": "el-icon-circle-plus-outline",
1527
1375
  "style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer', ";"),
1528
1376
  "onClick": this.add
1529
- }, null);
1377
+ }, {
1378
+ "default": function _default() {
1379
+ return [vue.createVNode(vue.resolveComponent("circle-plus"), null, null)];
1380
+ }
1381
+ });
1530
1382
  },
1531
1383
  delIcon: function delIcon(index, key) {
1532
1384
  var _this7 = this;
1533
1385
 
1534
- return vue.createVNode("i", {
1386
+ return vue.createVNode(vue.resolveComponent("ElIcon"), {
1535
1387
  "key": "d".concat(key),
1536
1388
  "class": "el-icon-remove-outline",
1537
1389
  "style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer;color:#606266', ";"),
1538
1390
  "onClick": function onClick() {
1539
1391
  return _this7.del(index, key);
1540
1392
  }
1541
- }, null);
1393
+ }, {
1394
+ "default": function _default() {
1395
+ return [vue.createVNode(vue.resolveComponent("remove"), null, null)];
1396
+ }
1397
+ });
1542
1398
  },
1543
1399
  makeIcon: function makeIcon(total, index, key) {
1544
1400
  var _this8 = this;
@@ -1576,13 +1432,13 @@
1576
1432
  created: function created() {
1577
1433
  var d = (this.expand || 0) - this.modelValue.length;
1578
1434
 
1579
- if (d > 0) {
1580
- this.expandRule(d);
1581
- }
1582
-
1583
1435
  for (var i = 0; i < this.modelValue.length; i++) {
1584
1436
  this.addRule(i);
1585
1437
  }
1438
+
1439
+ if (d > 0) {
1440
+ this.expandRule(d);
1441
+ }
1586
1442
  },
1587
1443
  render: function render() {
1588
1444
  var _this9 = this;
@@ -1594,12 +1450,12 @@
1594
1450
  vm: this,
1595
1451
  add: this.add
1596
1452
  }) : vue.createVNode("i", {
1597
- "key": 'a_def',
1453
+ "key": 1,
1598
1454
  "class": "el-icon-circle-plus-outline",
1599
1455
  "style": "font-size:".concat(this.fontSize, "px;vertical-align:middle;color:").concat(this.disabled ? '#c9cdd4;cursor: not-allowed' : '#606266;cursor:pointer', ";"),
1600
1456
  "onClick": this.add
1601
1457
  }, null) : vue.createVNode("div", {
1602
- "key": 'con'
1458
+ "key": 2
1603
1459
  }, [keys.map(function (key, index) {
1604
1460
  var _slot;
1605
1461
 
@@ -1657,9 +1513,9 @@
1657
1513
  }
1658
1514
  });
1659
1515
 
1660
- var NAME$3 = 'fcSubForm';
1516
+ var NAME$2 = 'fcSubForm';
1661
1517
  var Sub = vue.defineComponent({
1662
- name: NAME$3,
1518
+ name: NAME$2,
1663
1519
  props: {
1664
1520
  rule: Array,
1665
1521
  options: {
@@ -1684,9 +1540,9 @@
1684
1540
  syncDisabled: {
1685
1541
  type: Boolean,
1686
1542
  "default": true
1687
- }
1543
+ },
1544
+ formCreateInject: Object
1688
1545
  },
1689
- inject: ['formCreateInject'],
1690
1546
  data: function data() {
1691
1547
  return {
1692
1548
  cacheValue: {},
@@ -1747,10 +1603,10 @@
1747
1603
 
1748
1604
  var components = [Checkbox, Frame, Radio, Select, Tree, Upload, Group, Sub];
1749
1605
 
1750
- var NAME$2 = 'FormCreate';
1606
+ var NAME$1 = 'FormCreate';
1751
1607
  function $FormCreate(FormCreate) {
1752
1608
  return vue.defineComponent({
1753
- name: NAME$2,
1609
+ name: NAME$1,
1754
1610
  props: {
1755
1611
  rule: {
1756
1612
  type: Array,
@@ -1767,7 +1623,8 @@
1767
1623
  },
1768
1624
  extendOption: Boolean,
1769
1625
  modelValue: Object,
1770
- api: Object
1626
+ api: Object,
1627
+ name: String
1771
1628
  },
1772
1629
  emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync', 'reload', 'repeat-field', 'update'],
1773
1630
  render: function render() {
@@ -1783,6 +1640,7 @@
1783
1640
  modelValue = _toRefs.modelValue;
1784
1641
 
1785
1642
  var data = vue.reactive({
1643
+ ctxInject: {},
1786
1644
  destroyed: false,
1787
1645
  isShow: true,
1788
1646
  unique: 1,
@@ -1975,11 +1833,11 @@
1975
1833
  $set(origin, key, clone);
1976
1834
 
1977
1835
  if (!is.Undef(clone)) {
1978
- if (clone.__json !== undefined) {
1836
+ if (!is.Undef(clone.__json)) {
1979
1837
  origin[key].__json = clone.__json;
1980
1838
  }
1981
1839
 
1982
- if (clone.__origin !== undefined) {
1840
+ if (!is.Undef(clone.__origin)) {
1983
1841
  origin[key].__origin = clone.__origin;
1984
1842
  }
1985
1843
  }
@@ -2030,7 +1888,7 @@
2030
1888
  return val;
2031
1889
  }
2032
1890
 
2033
- if (hasProperty(val, '__json')) {
1891
+ if (val.__json) {
2034
1892
  return val.__json;
2035
1893
  }
2036
1894
 
@@ -2231,33 +2089,6 @@
2231
2089
  return prop;
2232
2090
  }
2233
2091
 
2234
- function toString(val) {
2235
- return val == null ? '' : _typeof(val) === 'object' ? JSON.stringify(val, null, 2) : String(val);
2236
- }
2237
-
2238
- var id$1 = 0;
2239
- function uniqueId() {
2240
- return Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now()).concat(++id$1)).toString(36);
2241
- }
2242
-
2243
- function deepSet(data, idx, val) {
2244
- var _data = data,
2245
- to;
2246
- (idx || '').split('.').forEach(function (v) {
2247
- if (to) {
2248
- if (!_data[to] || _typeof(_data[to]) != 'object') {
2249
- _data[to] = {};
2250
- }
2251
-
2252
- _data = _data[to];
2253
- }
2254
-
2255
- to = v;
2256
- });
2257
- _data[to] = val;
2258
- return _data;
2259
- }
2260
-
2261
2092
  function baseRule() {
2262
2093
  return {
2263
2094
  props: {},
@@ -2458,7 +2289,8 @@
2458
2289
 
2459
2290
  if (ctx) {
2460
2291
  if (child) {
2461
- rules = ctx.rule.children;
2292
+ rules = ctx.getPending('children', ctx.rule.children);
2293
+ if (!Array.isArray(rules)) return;
2462
2294
  index = ctx.rule.children.length - 1;
2463
2295
  } else {
2464
2296
  index = ctx.root.indexOf(ctx.origin);
@@ -2475,7 +2307,8 @@
2475
2307
 
2476
2308
  if (ctx) {
2477
2309
  if (child) {
2478
- rules = ctx.rule.children;
2310
+ rules = ctx.getPending('children', ctx.rule.children);
2311
+ if (!Array.isArray(rules)) return;
2479
2312
  } else {
2480
2313
  index = ctx.root.indexOf(ctx.origin);
2481
2314
  rules = ctx.root;
@@ -2710,6 +2543,10 @@
2710
2543
  }
2711
2544
 
2712
2545
  (_h$vm = h.vm).emit.apply(_h$vm, [name].concat(args));
2546
+ },
2547
+ helper: {
2548
+ tidyFields: tidyFields,
2549
+ props: props
2713
2550
  }
2714
2551
  };
2715
2552
  ['on', 'once', 'off', 'set'].forEach(function (n) {
@@ -2771,11 +2608,55 @@
2771
2608
  return str.replace(str[0], str[0].toLowerCase());
2772
2609
  }
2773
2610
 
2611
+ function toString(val) {
2612
+ return val == null ? '' : _typeof(val) === 'object' ? JSON.stringify(val, null, 2) : String(val);
2613
+ }
2614
+
2615
+ var id$2 = 0;
2616
+ function uniqueId() {
2617
+ return Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now()).concat(++id$2)).toString(36);
2618
+ }
2619
+
2620
+ function deepSet(data, idx, val) {
2621
+ var _data = data,
2622
+ to;
2623
+ (idx || '').split('.').forEach(function (v) {
2624
+ if (to) {
2625
+ if (!_data[to] || _typeof(_data[to]) != 'object') {
2626
+ _data[to] = {};
2627
+ }
2628
+
2629
+ _data = _data[to];
2630
+ }
2631
+
2632
+ to = v;
2633
+ });
2634
+ _data[to] = val;
2635
+ return _data;
2636
+ }
2637
+
2774
2638
  function useRender$1(Render) {
2775
2639
  extend(Render.prototype, {
2776
2640
  initRender: function initRender() {
2777
2641
  this.cacheConfig = {};
2778
2642
  },
2643
+ getTypeSlot: function getTypeSlot(type) {
2644
+ var name = 'type-' + toLine(type);
2645
+
2646
+ var _fn = function _fn(vm) {
2647
+ if (vm) {
2648
+ var slot = vm.slots[name] || vm.slots['type-' + type];
2649
+
2650
+ if (slot) {
2651
+ return slot;
2652
+ }
2653
+
2654
+ return _fn(vm.setupState.parent);
2655
+ }
2656
+ };
2657
+
2658
+ return _fn(this.vm);
2659
+ },
2779
2660
  render: function render() {
2780
2661
  var _this = this;
2781
2662
 
@@ -2796,7 +2677,7 @@
2796
2677
  ctx.initProp();
2797
2678
  this.mergeGlobal(ctx);
2798
2679
  ctx.initNone();
2799
- var slots = this.renderChildren(ctx);
2680
+ var slots = this.renderChildren(ctx.loadChildrenPending(), ctx);
2800
2681
  var def = slots["default"];
2801
2682
  def && slotBag.setSlot(ctx.rule.slot, function () {
2802
2683
  return def();
@@ -2823,8 +2704,15 @@
2823
2704
  ctx.prop = mergeRule({}, [this.cacheConfig[ctx.trueType].value, ctx.prop]);
2824
2705
  },
2825
2706
  setOptions: function setOptions(ctx) {
2826
- if (ctx.prop.optionsTo && ctx.prop.options) {
2827
- deepSet(ctx.prop, ctx.prop.optionsTo, ctx.prop.options);
2707
+ var opt = ctx.loadPending({
2708
+ key: 'options',
2709
+ origin: ctx.prop.options,
2710
+ def: []
2711
+ });
2712
+ ctx.prop.options = opt;
2713
+
2714
+ if (ctx.prop.optionsTo && opt) {
2715
+ deepSet(ctx.prop, ctx.prop.optionsTo, opt);
2828
2716
  }
2829
2717
  },
2830
2718
  deepSet: function deepSet$1(ctx) {
@@ -2853,42 +2741,45 @@
2853
2741
  renderCtx: function renderCtx(ctx, parent) {
2854
2742
  var _this4 = this;
2855
2743
 
2856
- if (ctx.type === 'hidden') return;
2857
- var rule = ctx.rule;
2858
- var preview = this.options.preview || false;
2859
-
2860
- if (!this.cache[ctx.id] || this.cache[ctx.id].slot !== rule.slot) {
2861
- var vn;
2862
- ctx.initProp();
2863
- this.mergeGlobal(ctx);
2864
- ctx.initNone();
2865
- this.$manager.tidyRule(ctx);
2866
- this.deepSet(ctx);
2867
- this.setOptions(ctx);
2868
- this.ctxProp(ctx);
2869
- var prop = ctx.prop;
2870
-
2871
- if (prop.hidden) {
2872
- this.setCache(ctx, undefined, parent);
2873
- return;
2874
- }
2744
+ try {
2745
+ if (ctx.type === 'hidden') return;
2746
+ var rule = ctx.rule;
2747
+ var preview = this.options.preview || false;
2748
+
2749
+ if (!this.cache[ctx.id] || this.cache[ctx.id].slot !== rule.slot) {
2750
+ var vn;
2751
+ ctx.initProp();
2752
+ this.mergeGlobal(ctx);
2753
+ ctx.initNone();
2754
+ this.$manager.tidyRule(ctx);
2755
+ this.deepSet(ctx);
2756
+ this.setOptions(ctx);
2757
+ this.ctxProp(ctx);
2758
+ var prop = ctx.prop;
2759
+ prop.props.formCreateInject = this.injectProp(ctx);
2760
+
2761
+ if (prop.hidden) {
2762
+ this.setCache(ctx, undefined, parent);
2763
+ return;
2764
+ }
2875
2765
 
2876
- vn = function vn() {
2877
- return _this4.item(ctx, function () {
2766
+ vn = function vn() {
2878
2767
  var children = {};
2879
2768
 
2769
+ var _load = ctx.loadChildrenPending();
2770
+
2880
2771
  if (ctx.parser.renderChildren) {
2881
- children = ctx.parser.renderChildren(ctx);
2772
+ children = ctx.parser.renderChildren(_load, ctx);
2882
2773
  } else if (ctx.parser.loadChildren !== false) {
2883
- children = _this4.renderChildren(ctx);
2774
+ children = _this4.renderChildren(_load, ctx);
2884
2775
  }
2885
2776
 
2886
- var slot = 'type-' + toLine(ctx.type);
2777
+ var slot = _this4.getTypeSlot(ctx.type);
2887
2778
 
2888
2779
  var _vn;
2889
2780
 
2890
- if (_this4.vm.slots[slot]) {
2891
- _vn = _this4.vm.slots[slot]({
2781
+ if (slot) {
2782
+ _vn = slot({
2892
2783
  rule: rule,
2893
2784
  prop: prop,
2894
2785
  preview: preview,
@@ -2910,16 +2801,22 @@
2910
2801
  _vn = _this4.display(_vn);
2911
2802
  }
2912
2803
 
2804
+ _this4.setCache(ctx, function () {
2805
+ return _vn;
2806
+ }, parent);
2807
+
2913
2808
  return _vn;
2914
- });
2915
- };
2809
+ };
2916
2810
 
2917
- this.setCache(ctx, vn, parent);
2918
- ctx._vnode = vn;
2919
- return vn;
2920
- }
2811
+ this.setCache(ctx, vn, parent);
2812
+ return vn;
2813
+ }
2921
2814
 
2922
- return this.getCache(ctx);
2815
+ return this.getCache(ctx);
2816
+ } catch (e) {
2817
+ console.error(e);
2818
+ return;
2819
+ }
2923
2820
  },
2924
2821
  getModelField: function getModelField(ctx) {
2925
2822
  return ctx.rule.modelField || ctx.parser.modelField || this.fc.modelFields[this.vNode.aliasMap[ctx.field]] || this.fc.modelFields[ctx.field] || this.fc.modelFields[ctx.originType] || 'modelValue';
@@ -2953,30 +2850,36 @@
2953
2850
  return vn;
2954
2851
  }
2955
2852
  },
2956
- item: function item(ctx, vn) {
2957
- return this.vNode.h('FcFragment', {
2958
- key: ctx.prop.key,
2959
- formCreateInject: this.injectProp(ctx)
2960
- }, vn);
2961
- },
2962
2853
  isFragment: function isFragment(ctx) {
2963
2854
  return ctx.type === 'fragment' || ctx.type === 'template';
2964
2855
  },
2965
2856
  injectProp: function injectProp(ctx) {
2966
2857
  var _this6 = this;
2967
2858
 
2968
- return {
2859
+ var state = this.vm.setupState;
2860
+
2861
+ if (!state.ctxInject[ctx.id]) {
2862
+ state.ctxInject[ctx.id] = {
2863
+ api: this.$handle.api,
2864
+ form: this.fc.create,
2865
+ subForm: function subForm(_subForm) {
2866
+ _this6.$handle.addSubForm(ctx, _subForm);
2867
+ },
2868
+ options: [],
2869
+ children: [],
2870
+ preview: false,
2871
+ field: ctx.field,
2872
+ rule: ctx.rule
2873
+ };
2874
+ }
2875
+
2876
+ var inject = state.ctxInject[ctx.id];
2877
+ extend(inject, {
2969
2878
  preview: this.options.preview || false,
2970
- api: this.$handle.api,
2971
- form: this.fc.create,
2972
- subForm: function subForm(_subForm) {
2973
- _this6.$handle.addSubForm(ctx, _subForm);
2974
- },
2975
- field: ctx.field,
2976
- options: ctx.prop.options || [],
2977
- children: ctx.rule.children,
2978
- rule: ctx.rule
2979
- };
2879
+ options: ctx.prop.options,
2880
+ children: ctx.loadChildrenPending()
2881
+ });
2882
+ return inject;
2980
2883
  },
2981
2884
  ctxProp: function ctxProp(ctx, custom) {
2982
2885
  var _this7 = this;
@@ -3020,10 +2923,9 @@
3020
2923
  onInput: function onInput(ctx, value) {
3021
2924
  this.$handle.onInput(ctx, value);
3022
2925
  },
3023
- renderChildren: function renderChildren(ctx) {
2926
+ renderChildren: function renderChildren(children, ctx) {
3024
2927
  var _this8 = this;
3025
2928
 
3026
- var children = ctx.rule.children;
3027
2929
  if (!is.trueArray(children)) return {};
3028
2930
  var slotBag = makeSlotBag();
3029
2931
  children.map(function (child) {
@@ -3080,12 +2982,16 @@
3080
2982
  });
3081
2983
  }
3082
2984
 
3083
- return this.vNode.make(type, rule, slotBag.mergeBag(children).getSlots());
2985
+ var props = _objectSpread2({}, rule);
2986
+
2987
+ delete props.type;
2988
+ delete props.is;
2989
+ return this.vNode.make(type, props, slotBag.mergeBag(children).getSlots());
3084
2990
  }
3085
2991
  });
3086
2992
  }
3087
2993
 
3088
- var id = 1;
2994
+ var id$1 = 1;
3089
2995
  function Render(handle) {
3090
2996
  extend(this, {
3091
2997
  $handle: handle,
@@ -3093,7 +2999,7 @@
3093
2999
  vm: handle.vm,
3094
3000
  $manager: handle.$manager,
3095
3001
  vNode: new handle.fc.CreateNode(handle.vm),
3096
- id: id++
3002
+ id: id$1++
3097
3003
  });
3098
3004
  funcProxy(this, {
3099
3005
  options: function options() {
@@ -3341,6 +3247,7 @@
3341
3247
  rule: rule,
3342
3248
  origin: rule.__origin__ || rule,
3343
3249
  name: rule.name,
3250
+ pending: {},
3344
3251
  none: false,
3345
3252
  watch: [],
3346
3253
  linkOn: [],
@@ -3363,6 +3270,102 @@
3363
3270
  this.update(handle, true);
3364
3271
  }
3365
3272
  extend(RuleContext.prototype, {
3273
+ loadChildrenPending: function loadChildrenPending() {
3274
+ var _this = this;
3275
+
3276
+ var children = this.rule.children || [];
3277
+ if (Array.isArray(children)) return children;
3278
+ return this.loadPending({
3279
+ key: 'children',
3280
+ origin: children,
3281
+ def: [],
3282
+ onLoad: function onLoad(data) {
3283
+ _this.$handle && _this.$handle.loadChildren(data, _this);
3284
+ },
3285
+ onUpdate: function onUpdate(value, oldValue) {
3286
+ if (_this.$handle) {
3287
+ value === oldValue ? _this.$handle.loadChildren(value, _this) : _this.$handle.updateChildren(_this, value, oldValue);
3288
+ }
3289
+ },
3290
+ onReload: function onReload(value) {
3291
+ if (_this.$handle) {
3292
+ _this.$handle.updateChildren(_this, [], value);
3293
+ } else {
3294
+ delete _this.pending.children;
3295
+ }
3296
+ }
3297
+ });
3298
+ },
3299
+ loadPending: function loadPending(config) {
3300
+ var _this2 = this;
3301
+
3302
+ var key = config.key,
3303
+ origin = config.origin,
3304
+ def = config.def,
3305
+ onLoad = config.onLoad,
3306
+ onReload = config.onReload,
3307
+ onUpdate = config.onUpdate;
3308
+
3309
+ if (this.pending[key] && this.pending[key].origin === origin) {
3310
+ return this.getPending(key, def);
3311
+ }
3312
+
3313
+ delete this.pending[key];
3314
+ var value = origin;
3315
+
3316
+ if (is.Function(origin)) {
3317
+ var source = invoke(function () {
3318
+ return origin({
3319
+ rule: _this2.rule,
3320
+ api: _this2.$api,
3321
+ update: function update(data) {
3322
+ var value = data || def;
3323
+
3324
+ var oldValue = _this2.getPending(key, def);
3325
+
3326
+ _this2.setPending(key, origin, value);
3327
+
3328
+ onUpdate && onUpdate(value, oldValue);
3329
+ },
3330
+ reload: function reload() {
3331
+ var oldValue = _this2.getPending(key, def);
3332
+
3333
+ delete _this2.pending[key];
3334
+ onReload && onReload(oldValue);
3335
+ _this2.$api && _this2.$api.sync(_this2.rule);
3336
+ }
3337
+ });
3338
+ });
3339
+
3340
+ if (source && is.Function(source.then)) {
3341
+ source.then(function (data) {
3342
+ var value = data || def;
3343
+
3344
+ _this2.setPending(key, origin, value);
3345
+
3346
+ onLoad && onLoad(value);
3347
+ _this2.$api && _this2.$api.sync(_this2.rule);
3348
+ });
3349
+ value = def;
3350
+ this.setPending(key, origin, value);
3351
+ } else {
3352
+ value = source || def;
3353
+ this.setPending(key, origin, value);
3354
+ onLoad && onLoad(value);
3355
+ }
3356
+ }
3357
+
3358
+ return value;
3359
+ },
3360
+ getPending: function getPending(key, def) {
3361
+ return this.pending[key] && this.pending[key].value || def;
3362
+ },
3363
+ setPending: function setPending(key, origin, value) {
3364
+ this.pending[key] = {
3365
+ origin: origin,
3366
+ value: vue.reactive(value)
3367
+ };
3368
+ },
3366
3369
  effectData: function effectData(name) {
3367
3370
  if (!this.payload[name]) {
3368
3371
  this.payload[name] = {};
@@ -3386,13 +3389,13 @@
3386
3389
  parser.init(this);
3387
3390
  },
3388
3391
  initProp: function initProp() {
3389
- var _this = this;
3392
+ var _this3 = this;
3390
3393
 
3391
3394
  var rule = _objectSpread2({}, this.rule);
3392
3395
 
3393
3396
  delete rule.children;
3394
3397
  this.prop = mergeProps([rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
3395
- return _this.payload[k];
3398
+ return _this3.payload[k];
3396
3399
  })), [this.computed]));
3397
3400
  },
3398
3401
  initNone: function initNone() {
@@ -3419,10 +3422,10 @@
3419
3422
  this.$handle.appendLink(this);
3420
3423
  },
3421
3424
  watchTo: function watchTo() {
3422
- var _this2 = this;
3425
+ var _this4 = this;
3423
3426
 
3424
3427
  vue.nextTick(function () {
3425
- _this2.$handle.watchCtx(_this2);
3428
+ _this4.$handle && _this4.$handle.watchCtx(_this4);
3426
3429
  });
3427
3430
  },
3428
3431
  "delete": function _delete() {
@@ -3452,15 +3455,15 @@
3452
3455
  this.ctrlRule = [];
3453
3456
  },
3454
3457
  rm: function rm() {
3455
- var _this3 = this;
3458
+ var _this5 = this;
3456
3459
 
3457
3460
  var _rm = function _rm() {
3458
- var index = _this3.root.indexOf(_this3.origin);
3461
+ var index = _this5.root.indexOf(_this5.origin);
3459
3462
 
3460
3463
  if (index > -1) {
3461
- _this3.root.splice(index, 1);
3464
+ _this5.root.splice(index, 1);
3462
3465
 
3463
- _this3.$handle && _this3.$handle.refresh();
3466
+ _this5.$handle && _this5.$handle.refresh();
3464
3467
  }
3465
3468
  };
3466
3469
 
@@ -3471,17 +3474,17 @@
3471
3474
  }
3472
3475
 
3473
3476
  this.$handle.noWatch(function () {
3474
- _this3.$handle.deferSyncValue(function () {
3475
- _this3.rmCtrl();
3477
+ _this5.$handle.deferSyncValue(function () {
3478
+ _this5.rmCtrl();
3476
3479
 
3477
3480
  _rm();
3478
3481
 
3479
- _this3.$handle.rmCtx(_this3);
3482
+ _this5.$handle.rmCtx(_this5);
3480
3483
 
3481
- extend(_this3, {
3484
+ extend(_this5, {
3482
3485
  root: []
3483
3486
  });
3484
- }, _this3.input);
3487
+ }, _this5.input);
3485
3488
  });
3486
3489
  },
3487
3490
  update: function update(handle, init) {
@@ -3520,7 +3523,6 @@
3520
3523
  });
3521
3524
  fullRule(rule);
3522
3525
  this.appendValue(rule);
3523
- rule.options = Array.isArray(rule.options) ? rule.options : [];
3524
3526
  [rule, rule['prefix'], rule['suffix']].forEach(function (item) {
3525
3527
  if (!item) {
3526
3528
  return;
@@ -3640,7 +3642,7 @@
3640
3642
  if (!is.Object(_rule) || !getRule(_rule).type) return err('未定义生成规则的 type 字段', _rule);
3641
3643
 
3642
3644
  if (_rule.__fc__ && _rule.__fc__.root === rules && _this6.ctxs[_rule.__fc__.id]) {
3643
- loadChildren(_rule.__fc__.rule.children, _rule.__fc__);
3645
+ loadChildren(_rule.__fc__.loadChildrenPending(), _rule.__fc__);
3644
3646
  return _rule.__fc__;
3645
3647
  }
3646
3648
 
@@ -3711,7 +3713,10 @@
3711
3713
  _this6.setCtx(ctx);
3712
3714
 
3713
3715
  !isCopy && !isInit && _this6.effect(ctx, 'load');
3714
- ctx.parser.loadChildren === false || loadChildren(ctx.rule.children, ctx);
3716
+
3717
+ var _load = ctx.loadChildrenPending();
3718
+
3719
+ ctx.parser.loadChildren === false || loadChildren(_load, ctx);
3715
3720
 
3716
3721
  if (!parent) {
3717
3722
  var _preIndex = preIndex(index);
@@ -3807,7 +3812,7 @@
3807
3812
  if (valid) {
3808
3813
  flag = true;
3809
3814
  var ruleCon = {
3810
- type: 'template',
3815
+ type: 'fragment',
3811
3816
  "native": true,
3812
3817
  __ctrl: true,
3813
3818
  children: rule
@@ -3908,7 +3913,7 @@
3908
3913
  this.setFormData(ctx, formValue);
3909
3914
  this.syncValue();
3910
3915
  this.valueChange(ctx, value);
3911
- this.vm.emit('change', ctx.field, value, ctx.origin, this.api, setFlag);
3916
+ this.vm.emit('change', ctx.field, value, ctx.origin, this.api, setFlag || false);
3912
3917
  this.effect(ctx, 'value');
3913
3918
  },
3914
3919
  onInput: function onInput(ctx, value) {
@@ -3919,7 +3924,7 @@
3919
3924
  }
3920
3925
  },
3921
3926
  setFormData: function setFormData(ctx, value) {
3922
- $set(this.formData, ctx.id, value);
3927
+ $set(this.formData, ctx.id, value === undefined ? null : value);
3923
3928
  },
3924
3929
  getFormData: function getFormData(ctx) {
3925
3930
  return this.formData[ctx.id];
@@ -4141,13 +4146,13 @@
4141
4146
  var none = ['field', 'value', 'vm', 'template', 'name', 'config', 'control', 'inject', 'sync', 'payload', 'optionsTo', 'update'];
4142
4147
  var all = attrs();
4143
4148
  all.filter(function (k) {
4144
- return none.indexOf(k) === -1;
4149
+ return k[0] !== '_' && none.indexOf(k) === -1;
4145
4150
  }).forEach(function (key) {
4146
4151
  var ref = vue.toRef(ctx.rule, key);
4147
4152
  var flag = key === 'children';
4148
4153
  ctx.refRule[key] = ref;
4149
4154
  ctx.watch.push(vue.watch(flag ? function () {
4150
- return _toConsumableArray(ref.value || []);
4155
+ return is.Function(ref.value) ? ref.value : _toConsumableArray(ref.value || []);
4151
4156
  } : function () {
4152
4157
  return ref.value;
4153
4158
  }, function (_, o) {
@@ -4177,20 +4182,16 @@
4177
4182
  ctx.updateType();
4178
4183
 
4179
4184
  _this.bindParser(ctx);
4180
- } else if (key === 'children') {
4181
- _this.deferSyncValue(function () {
4182
- o && o.forEach(function (child) {
4183
- if ((n || []).indexOf(child) === -1 && child && !is.String(child) && child.__fc__ && !_this.ctxs[child.__fc__.id]) {
4184
- _this.rmCtx(child.__fc__);
4185
- }
4186
- });
4185
+ } else if (flag) {
4186
+ if (is.Function(o)) {
4187
+ o = ctx.getPending('children', []);
4188
+ }
4187
4189
 
4188
- if (is.trueArray(n)) {
4189
- _this.loadChildren(n, ctx);
4190
+ if (is.Function(n)) {
4191
+ n = ctx.loadChildrenPending();
4192
+ }
4190
4193
 
4191
- _this.bus.$emit('update', _this.api);
4192
- }
4193
- });
4194
+ _this.updateChildren(ctx, n, o);
4194
4195
  }
4195
4196
 
4196
4197
  _this.$render.clearCache(ctx);
@@ -4217,15 +4218,32 @@
4217
4218
 
4218
4219
  this.watchEffect(ctx);
4219
4220
  },
4220
- rmSub: function rmSub(sub) {
4221
+ updateChildren: function updateChildren(ctx, n, o) {
4221
4222
  var _this2 = this;
4222
4223
 
4224
+ this.deferSyncValue(function () {
4225
+ o && o.forEach(function (child) {
4226
+ if ((n || []).indexOf(child) === -1 && child && !is.String(child) && child.__fc__) {
4227
+ _this2.rmCtx(child.__fc__);
4228
+ }
4229
+ });
4230
+
4231
+ if (is.trueArray(n)) {
4232
+ _this2.loadChildren(n, ctx);
4233
+
4234
+ _this2.bus.$emit('update', _this2.api);
4235
+ }
4236
+ });
4237
+ },
4238
+ rmSub: function rmSub(sub) {
4239
+ var _this3 = this;
4240
+
4223
4241
  is.trueArray(sub) && sub.forEach(function (r) {
4224
- r && r.__fc__ && _this2.rmCtx(r.__fc__);
4242
+ r && r.__fc__ && _this3.rmCtx(r.__fc__);
4225
4243
  });
4226
4244
  },
4227
4245
  rmCtx: function rmCtx(ctx) {
4228
- var _this3 = this;
4246
+ var _this4 = this;
4229
4247
 
4230
4248
  if (ctx.deleted) return;
4231
4249
  var id = ctx.id,
@@ -4235,20 +4253,23 @@
4235
4253
  $del(this.ctxs, id);
4236
4254
  $del(this.formData, id);
4237
4255
  $del(this.subForm, id);
4256
+ $del(this.vm.setupState.ctxInject, id);
4238
4257
  input && this.rmIdCtx(ctx, field, 'field');
4239
4258
  name && this.rmIdCtx(ctx, name, 'name');
4240
4259
  this.deferSyncValue(function () {
4241
- if (!_this3.reloading) {
4260
+ if (!_this4.reloading) {
4242
4261
  if (ctx.parser.loadChildren !== false) {
4243
- if (is.trueArray(ctx.rule.children)) {
4244
- ctx.rule.children.forEach(function (h) {
4245
- return h.__fc__ && _this3.rmCtx(h.__fc__);
4262
+ var children = ctx.getPending('children', ctx.rule.children);
4263
+
4264
+ if (is.trueArray(children)) {
4265
+ children.forEach(function (h) {
4266
+ return h.__fc__ && _this4.rmCtx(h.__fc__);
4246
4267
  });
4247
4268
  }
4248
4269
  }
4249
4270
 
4250
- if (ctx.root === _this3.rules) {
4251
- _this3.vm.setupState.renderRule();
4271
+ if (ctx.root === _this4.rules) {
4272
+ _this4.vm.setupState.renderRule();
4252
4273
  }
4253
4274
  }
4254
4275
  }, input);
@@ -4330,7 +4351,6 @@
4330
4351
  watchEffect: function watchEffect(ctx) {
4331
4352
  var _this3 = this;
4332
4353
 
4333
- this.vm;
4334
4354
  Object.keys(ctx.rule.effect || {}).forEach(function (k) {
4335
4355
  ctx.watch.push(vue.watch(function () {
4336
4356
  return ctx.rule.effect[k];
@@ -4368,7 +4388,7 @@
4368
4388
  input = _ref.input,
4369
4389
  type = _ref.type,
4370
4390
  custom = _ref.custom;
4371
- if (!type || type === 'fcFragment') return;
4391
+ if (!type || ['fcFragment', 'fragment'].indexOf(type) > -1) return;
4372
4392
  var effect = custom ? custom : rule.effect || {};
4373
4393
  Object.keys(effect).forEach(function (attr) {
4374
4394
  var p = _this4.providers[attr];
@@ -4565,26 +4585,8 @@
4565
4585
  xhr.send(formData);
4566
4586
  }
4567
4587
 
4568
- var NAME$1 = 'FcFragment';
4588
+ var NAME = 'fcFragment';
4569
4589
  var fragment = vue.defineComponent({
4570
- name: NAME$1,
4571
- inheritAttrs: false,
4572
- props: ['formCreateInject'],
4573
- setup: function setup(props) {
4574
- var data = vue.toRef(props, 'formCreateInject');
4575
- var $inject = vue.reactive(_objectSpread2({}, data.value));
4576
- vue.watch(data, function () {
4577
- extend($inject, data.value);
4578
- });
4579
- vue.provide('formCreateInject', $inject);
4580
- },
4581
- render: function render() {
4582
- return this.$slots["default"]();
4583
- }
4584
- });
4585
-
4586
- var NAME = 'FcVnode';
4587
- var vnode = vue.defineComponent({
4588
4590
  name: NAME,
4589
4591
  inheritAttrs: false,
4590
4592
  props: ['vnode'],
@@ -4595,8 +4597,12 @@
4595
4597
 
4596
4598
  function tidyDirectives(directives) {
4597
4599
  return Object.keys(directives).map(function (n) {
4598
- var directive = directives[n];
4599
- return [vue.resolveDirective(n), directive.arg, directive.value, directive.modifiers];
4600
+ var data = directives[n];
4601
+ var directive = vue.resolveDirective(n);
4602
+ if (!directive) return;
4603
+ return [directive, data.value, data.arg, data.modifiers];
4604
+ }).filter(function (v) {
4605
+ return !!v;
4600
4606
  });
4601
4607
  }
4602
4608
 
@@ -4623,7 +4629,18 @@
4623
4629
  return makeDirective(data, this.h(tag, toProps(data), children));
4624
4630
  },
4625
4631
  h: function h(tag, data, children) {
4626
- return vue.createVNode(vue.getCurrentInstance().appContext.config.isNativeTag(tag) ? tag : vue.resolveComponent(tag), data, children);
4632
+ var isNativeTag = vue.getCurrentInstance().appContext.config.isNativeTag(tag);
4633
+
4634
+ if (isNativeTag) {
4635
+ delete data.formCreateInject;
4636
+ }
4637
+
4638
+ try {
4639
+ return vue.createVNode(isNativeTag ? tag : vue.resolveComponent(tag), data, children);
4640
+ } catch (e) {
4641
+ console.error(e);
4642
+ return vue.createVNode('');
4643
+ }
4627
4644
  },
4628
4645
  aliasMap: aliasMap
4629
4646
  });
@@ -4807,6 +4824,25 @@
4807
4824
  return true;
4808
4825
  }
4809
4826
 
4827
+ var name$6 = 'html';
4828
+ var html = {
4829
+ name: name$6,
4830
+ loadChildren: false,
4831
+ render: function render(children, ctx) {
4832
+ ctx.prop.props.innerHTML = children["default"]();
4833
+ return ctx.vNode.make(ctx.prop.props.tag || 'div', ctx.prop);
4834
+ },
4835
+ renderChildren: function renderChildren(children) {
4836
+ return {
4837
+ "default": function _default() {
4838
+ return children.filter(function (v) {
4839
+ return is.String(v);
4840
+ }).join('');
4841
+ }
4842
+ };
4843
+ }
4844
+ };
4845
+
4810
4846
  function parseProp(name, id) {
4811
4847
  var prop;
4812
4848
 
@@ -4835,8 +4871,10 @@
4835
4871
  arrayAttrs.push.apply(arrayAttrs, _toConsumableArray(array));
4836
4872
  normalAttrs.push.apply(normalAttrs, _toConsumableArray(normal));
4837
4873
  appendProto([].concat(_toConsumableArray(key), _toConsumableArray(array), _toConsumableArray(normal)));
4838
- } //todo 表单嵌套
4874
+ }
4839
4875
 
4876
+ var id = 1;
4877
+ var instance = {}; //todo 表单嵌套
4840
4878
 
4841
4879
  function FormCreateFactory(config) {
4842
4880
  var components = _defineProperty({}, fragment.name, fragment);
@@ -4844,6 +4882,7 @@
4844
4882
  var parsers = {};
4845
4883
  var directives = {};
4846
4884
  var modelFields = {};
4885
+ var useApps = [];
4847
4886
  var providers = {
4848
4887
  fetch: $fetch
4849
4888
  };
@@ -4855,6 +4894,14 @@
4855
4894
  var CreateNode = CreateNodeFactory();
4856
4895
  exportAttrs(config.attrs || {});
4857
4896
 
4897
+ function getApi(name) {
4898
+ return instance[name];
4899
+ }
4900
+
4901
+ function useApp(fn) {
4902
+ useApps.push(fn);
4903
+ }
4904
+
4858
4905
  function directive() {
4859
4906
  var data = nameProp.apply(void 0, arguments);
4860
4907
  if (data.id && data.prop) directives[data.id] = data.prop;
@@ -4923,7 +4970,7 @@
4923
4970
  }
4924
4971
 
4925
4972
  function $vnode() {
4926
- return vnode;
4973
+ return fragment;
4927
4974
  } //todo 检查回调函数作用域
4928
4975
 
4929
4976
 
@@ -4934,7 +4981,11 @@
4934
4981
 
4935
4982
  function create(rules, option) {
4936
4983
  var app = createFormApp(rules, option || {});
4937
- config.appUse && config.appUse(app);
4984
+ useApps.forEach(function (v) {
4985
+ invoke(function () {
4986
+ return v(create, app);
4987
+ });
4988
+ });
4938
4989
  var div = document.createElement('div');
4939
4990
  ((option === null || option === void 0 ? void 0 : option.el) || document.body).appendChild(div);
4940
4991
  var vm = app.mount(div);
@@ -4953,6 +5004,7 @@
4953
5004
  var _this = this;
4954
5005
 
4955
5006
  extend(this, {
5007
+ id: id++,
4956
5008
  create: create,
4957
5009
  vm: vm,
4958
5010
  manager: createManager(config.manager),
@@ -4960,6 +5012,7 @@
4960
5012
  providers: providers,
4961
5013
  modelFields: modelFields,
4962
5014
  rules: vm.props.rule,
5015
+ name: vm.props.name,
4963
5016
  prop: {
4964
5017
  components: components,
4965
5018
  directives: directives
@@ -4984,6 +5037,10 @@
4984
5037
  extend(vm.appContext.components, components);
4985
5038
  extend(vm.appContext.directives, directives);
4986
5039
  this.$handle = new Handler(this);
5040
+
5041
+ if (this.name) {
5042
+ instance[this.name] = this.api();
5043
+ }
4987
5044
  }
4988
5045
 
4989
5046
  extend(FormCreate.prototype, {
@@ -5049,6 +5106,10 @@
5049
5106
  this.$handle.mounted();
5050
5107
  },
5051
5108
  unmount: function unmount() {
5109
+ if (this.name) {
5110
+ delete instance[this.name];
5111
+ }
5112
+
5052
5113
  this.unwatch && this.unwatch();
5053
5114
  this.$handle.reloadRule([]);
5054
5115
  },
@@ -5082,17 +5143,19 @@
5082
5143
  $form: $form,
5083
5144
  parseFn: parseFn,
5084
5145
  parseJson: parseJson,
5085
- toJson: toJson
5146
+ toJson: toJson,
5147
+ useApp: useApp,
5148
+ getApi: getApi
5086
5149
  });
5087
5150
  }
5088
5151
 
5089
5152
  function useStatic(formCreate) {
5090
5153
  extend(formCreate, {
5091
5154
  create: create,
5092
- install: function install(Vue, options) {
5155
+ install: function install(app, options) {
5093
5156
  globalConfig = _objectSpread2(_objectSpread2({}, globalConfig), options || {});
5094
- if (Vue._installedFormCreate === true) return;
5095
- Vue._installedFormCreate = true;
5157
+ if (app._installedFormCreate === true) return;
5158
+ app._installedFormCreate = true;
5096
5159
 
5097
5160
  var $formCreate = function $formCreate(rules) {
5098
5161
  var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -5100,9 +5163,13 @@
5100
5163
  };
5101
5164
 
5102
5165
  useAttr($formCreate);
5103
- Vue.config.globalProperties.$formCreate = $formCreate;
5104
- Vue.component('FormCreate', $form());
5105
- Vue.component('fc-vnode', vnode);
5166
+ app.config.globalProperties.$formCreate = $formCreate;
5167
+ app.component('FormCreate', $form());
5168
+ useApps.forEach(function (v) {
5169
+ invoke(function () {
5170
+ return v(formCreate, app);
5171
+ });
5172
+ });
5106
5173
  }
5107
5174
  });
5108
5175
  }
@@ -5112,7 +5179,13 @@
5112
5179
  CreateNode.use({
5113
5180
  fragment: 'fcFragment'
5114
5181
  });
5115
- if (config.install) create.use(config);
5182
+ config.install && create.use(config);
5183
+ useApp(function (_, app) {
5184
+ app.mixin({
5185
+ props: ['formCreateInject']
5186
+ });
5187
+ });
5188
+ parser(html);
5116
5189
  return create;
5117
5190
  }
5118
5191
 
@@ -5257,7 +5330,7 @@
5257
5330
  var PRE = 'el';
5258
5331
  var alias = {
5259
5332
  button: PRE + '-button',
5260
- icon: 'i',
5333
+ icon: PRE + '-icon',
5261
5334
  slider: PRE + '-slider',
5262
5335
  rate: PRE + '-rate',
5263
5336
  upload: 'fc-upload',
@@ -5314,7 +5387,6 @@
5314
5387
  type: 'default',
5315
5388
  loading: false,
5316
5389
  disabled: false,
5317
- icon: 'el-icon-refresh',
5318
5390
  innerText: '重置',
5319
5391
  show: false,
5320
5392
  col: undefined,
@@ -5351,15 +5423,29 @@
5351
5423
 
5352
5424
  var manager = {
5353
5425
  validate: function validate() {
5354
- return this.form().validate();
5426
+ var form = this.form();
5427
+
5428
+ if (form) {
5429
+ return form.validate();
5430
+ } else {
5431
+ return new Promise(function (v) {
5432
+ return v();
5433
+ });
5434
+ }
5355
5435
  },
5356
5436
  validateField: function validateField(field) {
5357
5437
  var _this = this;
5358
5438
 
5359
5439
  return new Promise(function (resolve, reject) {
5360
- _this.form().validateField(field, function (res) {
5361
- res ? reject(res) : resolve(null);
5362
- });
5440
+ var form = _this.form();
5441
+
5442
+ if (form) {
5443
+ form.validateField(field, function (res) {
5444
+ res ? reject(res) : resolve(null);
5445
+ });
5446
+ } else {
5447
+ resolve();
5448
+ }
5363
5449
  });
5364
5450
  },
5365
5451
  clearValidateState: function clearValidateState(ctx) {
@@ -5390,7 +5476,7 @@
5390
5476
  info: {
5391
5477
  trigger: 'hover',
5392
5478
  placement: 'top-start',
5393
- icon: 'el-icon-warning'
5479
+ icon: true
5394
5480
  },
5395
5481
  title: {},
5396
5482
  col: {
@@ -5506,10 +5592,16 @@
5506
5592
 
5507
5593
  children[infoProp.align !== 'left' ? 'unshift' : 'push'](this.$r(mergeProps([infoProp, prop]), _defineProperty({}, titleProp.slot || (isTip ? 'default' : 'reference'), function () {
5508
5594
  return _this4.$r({
5509
- type: 'i',
5510
- "class": infoProp.icon === true ? 'el-icon-warning' : infoProp.icon,
5595
+ type: 'ElIcon',
5596
+ style: 'top:2px',
5511
5597
  key: "".concat(uni, "i")
5512
- }, {}, true);
5598
+ }, {
5599
+ "default": function _default() {
5600
+ return _this4.$r({
5601
+ type: infoProp.icon === true ? 'warning' : infoProp.icon
5602
+ });
5603
+ }
5604
+ }, true);
5513
5605
  })));
5514
5606
  }
5515
5607
 
@@ -5571,7 +5663,7 @@
5571
5663
 
5572
5664
  var resetBtn = _objectSpread2({}, this.options.resetBtn);
5573
5665
 
5574
- var text = resetBtn.innerText;
5666
+ var innerText = resetBtn.innerText;
5575
5667
  delete resetBtn.innerText;
5576
5668
  return this.$r({
5577
5669
  type: 'button',
@@ -5586,14 +5678,14 @@
5586
5678
  }
5587
5679
  },
5588
5680
  key: "".concat(this.key, "b2")
5589
- }, [text]);
5681
+ }, [innerText]);
5590
5682
  },
5591
5683
  makeSubmitBtn: function makeSubmitBtn() {
5592
5684
  var _this6 = this;
5593
5685
 
5594
5686
  var submitBtn = _objectSpread2({}, this.options.submitBtn);
5595
5687
 
5596
- var text = submitBtn.innerText;
5688
+ var innerText = submitBtn.innerText;
5597
5689
  delete submitBtn.innerText;
5598
5690
  return this.$r({
5599
5691
  type: 'button',
@@ -5608,7 +5700,7 @@
5608
5700
  }
5609
5701
  },
5610
5702
  key: "".concat(this.key, "b1")
5611
- }, [text]);
5703
+ }, [innerText]);
5612
5704
  }
5613
5705
  };
5614
5706
 
@@ -5694,7 +5786,7 @@
5694
5786
  return maker;
5695
5787
  }
5696
5788
 
5697
- var css_248z = ".form-create .form-create .el-form-item{margin-bottom:22px}.form-create .form-create .el-form-item .el-form-item{margin-bottom:0}.form-create{transform:rotate(0)}";
5789
+ var css_248z = ".form-create .form-create .el-form-item{margin-bottom:22px}.form-create .form-create .el-form-item .el-form-item{margin-bottom:0}.form-create{width:100%}";
5698
5790
  styleInject(css_248z);
5699
5791
 
5700
5792
  function tidyBtnProp(btn, def) {
@@ -5866,18 +5958,19 @@
5866
5958
  Object.keys(maker$1).forEach(function (name) {
5867
5959
  FormCreate.maker[name] = maker$1[name];
5868
5960
  });
5869
- }
5870
5961
 
5871
- function appUse(app) {
5872
- app.use(ElementPlus__default["default"]);
5962
+ if (typeof window !== 'undefined' && window.ElementPlus) {
5963
+ FormCreate.useApp(function (_, app) {
5964
+ app.use(window.ElementPlus);
5965
+ });
5966
+ }
5873
5967
  }
5874
5968
 
5875
5969
  function elmFormCreate() {
5876
5970
  return FormCreateFactory({
5877
5971
  ui: 'element-ui',
5878
- version: '3.0.0-alpha.3',
5972
+ version: '3.1.0',
5879
5973
  manager: manager,
5880
- appUse: appUse,
5881
5974
  extendApi: extendApi,
5882
5975
  install: install,
5883
5976
  attrs: {