@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,11 +1,10 @@
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
- import { defineComponent, toRefs, inject, ref, toRef, watch, resolveComponent, createVNode, mergeProps as mergeProps$1, isVNode, nextTick, markRaw, reactive, getCurrentInstance, provide, onMounted, onBeforeUnmount, onUpdated, computed, customRef, withDirectives, resolveDirective, createApp, h } from 'vue';
8
- import ElementPlus from 'element-plus';
7
+ import { defineComponent, toRef, resolveComponent, createVNode, mergeProps as mergeProps$1, isVNode, nextTick, Fragment, markRaw, reactive, getCurrentInstance, provide, inject, toRefs, onMounted, onBeforeUnmount, onUpdated, watch, computed, customRef, withDirectives, resolveDirective, createApp, h, ref } from 'vue';
9
8
 
10
9
  function ownKeys(object, enumerableOnly) {
11
10
  var keys = Object.keys(object);
@@ -206,11 +205,12 @@ function getSlot(slots, exclude) {
206
205
  }, []);
207
206
  }
208
207
 
209
- var NAME$a = 'fcCheckbox';
208
+ var NAME$9 = 'fcCheckbox';
210
209
  var Checkbox = defineComponent({
211
- name: NAME$a,
210
+ name: NAME$9,
212
211
  inheritAttrs: false,
213
212
  props: {
213
+ formCreateInject: Object,
214
214
  modelValue: {
215
215
  type: Array,
216
216
  "default": function _default() {
@@ -221,51 +221,21 @@ var Checkbox = defineComponent({
221
221
  },
222
222
  emits: ['update:modelValue'],
223
223
  setup: function setup(props, _) {
224
- var _toRefs = toRefs(inject('formCreateInject')),
225
- options = _toRefs.options;
226
-
227
- var trueValue = ref([]);
224
+ var options = toRef(props.formCreateInject, 'options', []);
228
225
  var value = toRef(props, 'modelValue');
229
226
 
230
227
  var _options = function _options() {
231
228
  return Array.isArray(options.value) ? options.value : [];
232
229
  };
233
230
 
234
- var update = function update() {
235
- trueValue.value = value.value ? _options().filter(function (opt) {
236
- return value.value.indexOf(opt.value) !== -1;
237
- }).map(function (option) {
238
- return option.label;
239
- }) : [];
240
- };
241
-
242
- watch(options, function () {
243
- update();
244
- }, {
245
- deep: true,
246
- immediate: true
247
- });
248
231
  return {
249
232
  options: _options,
250
- trueValue: trueValue,
251
233
  value: value,
252
234
  onInput: function onInput(n) {
253
- _.emit('update:modelValue', _options().filter(function (opt) {
254
- return n.indexOf(opt.label) !== -1;
255
- }).map(function (opt) {
256
- return opt.value;
257
- }).filter(function (v) {
258
- return v !== undefined;
259
- }));
260
- },
261
- update: update
235
+ _.emit('update:modelValue', n);
236
+ }
262
237
  };
263
238
  },
264
- watch: {
265
- modelValue: function modelValue() {
266
- this.update();
267
- }
268
- },
269
239
  render: function render() {
270
240
  var _this$$slots$default,
271
241
  _this$$slots,
@@ -274,17 +244,23 @@ var Checkbox = defineComponent({
274
244
  var name = this.type === 'button' ? 'ElCheckboxButton' : 'ElCheckbox';
275
245
  var Type = resolveComponent(name);
276
246
  return createVNode(resolveComponent("ElCheckboxGroup"), mergeProps$1(this.$attrs, {
277
- "modelValue": this.trueValue,
247
+ "modelValue": this.value,
278
248
  "onUpdate:modelValue": this.onInput
279
249
  }), _objectSpread2({
280
250
  "default": function _default() {
281
251
  return [_this.options().map(function (opt, index) {
282
252
  var props = _objectSpread2({}, opt);
283
253
 
254
+ var value = props.value;
284
255
  delete props.value;
285
256
  return createVNode(Type, mergeProps$1(props, {
257
+ "label": value,
286
258
  "key": name + index + opt.value
287
- }), null);
259
+ }), {
260
+ "default": function _default() {
261
+ return [props.label || props.value || ''];
262
+ }
263
+ });
288
264
  }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
289
265
  }
290
266
  }, getSlot(this.$slots, ['default'])));
@@ -366,16 +342,16 @@ function styleInject(css, ref) {
366
342
  }
367
343
  }
368
344
 
369
- 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}";
345
+ var css_248z$2 = "._fc-frame ._fc-files img{display:inline-block;height:100%;vertical-align:top;width:100%}._fc-frame ._fc-upload-btn{border:1px dashed #c0ccda}._fc-frame ._fc-upload-cover{background:rgba(0,0,0,.6);bottom:0;left:0;opacity:0;position:absolute;right:0;top:0;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}._fc-frame ._fc-upload-cover i{color:#fff;cursor:pointer;font-size:20px;margin:0 2px}._fc-frame ._fc-files:hover ._fc-upload-cover{opacity:1}._fc-frame .el-upload{display:block}._fc-frame ._fc-upload-btn{cursor:pointer}._fc-files,._fc-frame ._fc-upload-btn{background:#fff;border:1px solid #c0ccda;border-radius:4px;-webkit-box-shadow:2px 2px 5px rgba(0,0,0,.1);box-shadow:2px 2px 5px rgba(0,0,0,.1);-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;height:58px;line-height:58px;margin-right:4px;overflow:hidden;position:relative;text-align:center;width:58px}";
370
346
  styleInject(css_248z$2);
371
347
 
372
348
  function _isSlot$1(s) {
373
349
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
374
350
  }
375
351
 
376
- var NAME$9 = 'fcFrame';
352
+ var NAME$8 = 'fcFrame';
377
353
  var Frame = defineComponent({
378
- name: NAME$9,
354
+ name: NAME$8,
379
355
  props: {
380
356
  type: {
381
357
  type: String,
@@ -396,7 +372,7 @@ var Frame = defineComponent({
396
372
  },
397
373
  icon: {
398
374
  type: String,
399
- "default": 'el-icon-upload2'
375
+ "default": 'upload'
400
376
  },
401
377
  width: {
402
378
  type: String,
@@ -419,7 +395,10 @@ var Frame = defineComponent({
419
395
  "default": '关闭'
420
396
  },
421
397
  modalTitle: String,
422
- handleIcon: [String, Boolean],
398
+ handleIcon: {
399
+ type: [String, Boolean],
400
+ "default": undefined
401
+ },
423
402
  title: String,
424
403
  allowRemove: {
425
404
  type: Boolean,
@@ -474,9 +453,9 @@ var Frame = defineComponent({
474
453
  okBtn: {
475
454
  type: Boolean,
476
455
  "default": true
477
- }
456
+ },
457
+ formCreateInject: Object
478
458
  },
479
- inject: ['formCreateInject'],
480
459
  emits: ['update:modelValue', 'change'],
481
460
  data: function data() {
482
461
  return {
@@ -493,9 +472,6 @@ var Frame = defineComponent({
493
472
  }
494
473
  },
495
474
  methods: {
496
- key: function key(unique) {
497
- return unique;
498
- },
499
475
  close: function close() {
500
476
  this.closeModel(true);
501
477
  },
@@ -535,7 +511,7 @@ var Frame = defineComponent({
535
511
  }).toString(),
536
512
  readonly: true
537
513
  }, {
538
- "key": this.key('input')
514
+ "key": 1
539
515
  }), {
540
516
  append: function append() {
541
517
  return createVNode(resolveComponent("ElButton"), {
@@ -546,14 +522,18 @@ var Frame = defineComponent({
546
522
  }, null);
547
523
  },
548
524
  suffix: function suffix() {
549
- return _this.fileList.length ? createVNode("i", {
550
- "class": "el-input__icon el-icon-circle-close",
525
+ return _this.fileList.length ? createVNode(resolveComponent("ElIcon"), {
526
+ "class": "el-input__icon",
551
527
  "onClick": function onClick() {
552
528
  _this.fileList = [];
553
529
 
554
530
  _this.input();
555
531
  }
556
- }, null) : null;
532
+ }, {
533
+ "default": function _default() {
534
+ return [createVNode(resolveComponent("CircleClose"), null, null)];
535
+ }
536
+ }) : null;
557
537
  }
558
538
  });
559
539
  },
@@ -563,13 +543,13 @@ var Frame = defineComponent({
563
543
  }
564
544
 
565
545
  return createVNode("div", {
566
- "key": this.key('group')
546
+ "key": 2
567
547
  }, [children]);
568
548
  },
569
549
  makeItem: function makeItem(index, children) {
570
550
  return createVNode("div", {
571
- "class": "fc-files",
572
- "key": this.key('file' + index)
551
+ "class": "_fc-files",
552
+ "key": '3' + index
573
553
  }, [children]);
574
554
  },
575
555
  valid: function valid(f) {
@@ -592,43 +572,53 @@ var Frame = defineComponent({
592
572
  }
593
573
 
594
574
  return createVNode("div", {
595
- "class": "fc-upload-cover",
596
- "key": this.key('uc')
575
+ "class": "_fc-upload-cover",
576
+ "key": 4
597
577
  }, [icons]);
598
578
  }
599
579
  },
600
580
  makeHandleIcon: function makeHandleIcon(val, index) {
601
581
  var _this2 = this;
602
582
 
603
- return createVNode("i", {
604
- "class": this.handleIcon === true || this.handleIcon === undefined ? 'el-icon-view' : this.handleIcon,
583
+ var Type = resolveComponent(this.handleIcon === true || this.handleIcon === undefined ? 'view' : this.handleIcon);
584
+ return createVNode(resolveComponent("ElIcon"), {
605
585
  "onClick": function onClick() {
606
586
  return _this2.handleClick(val);
607
587
  },
608
- "key": this.key('hi' + index)
609
- }, null);
588
+ "key": '5' + index
589
+ }, {
590
+ "default": function _default() {
591
+ return [createVNode(Type, null, null)];
592
+ }
593
+ });
610
594
  },
611
595
  makeRemoveIcon: function makeRemoveIcon(val, index) {
612
596
  var _this3 = this;
613
597
 
614
- return createVNode("i", {
615
- "class": "el-icon-delete",
598
+ return createVNode(resolveComponent("ElIcon"), {
616
599
  "onClick": function onClick() {
617
600
  return _this3.handleRemove(val);
618
601
  },
619
- "key": this.key('ri' + index)
620
- }, null);
602
+ "key": '6' + index
603
+ }, {
604
+ "default": function _default() {
605
+ return [createVNode(resolveComponent("delete"), null, null)];
606
+ }
607
+ });
621
608
  },
622
609
  makeFiles: function makeFiles() {
623
610
  var _this4 = this;
624
611
 
625
612
  return this.makeGroup(this.fileList.map(function (src, index) {
626
- return _this4.makeItem(index, [createVNode("i", {
627
- "class": "el-icon-tickets",
613
+ return _this4.makeItem(index, [createVNode(resolveComponent("ElIcon"), {
628
614
  "onClick": function onClick() {
629
615
  return _this4.handleClick(src);
630
616
  }
631
- }, null), _this4.makeIcons(src, index)]);
617
+ }, {
618
+ "default": function _default() {
619
+ return [createVNode(resolveComponent("document"), null, null)];
620
+ }
621
+ }), _this4.makeIcons(src, index)]);
632
622
  }));
633
623
  },
634
624
  makeImages: function makeImages() {
@@ -643,15 +633,18 @@ var Frame = defineComponent({
643
633
  makeBtn: function makeBtn() {
644
634
  var _this6 = this;
645
635
 
636
+ var Type = resolveComponent(this.icon);
646
637
  return createVNode("div", {
647
- "class": "fc-upload-btn",
638
+ "class": "_fc-upload-btn",
648
639
  "onClick": function onClick() {
649
640
  return _this6.showModel();
650
641
  },
651
- "key": this.key('btn')
652
- }, [createVNode("i", {
653
- "class": this.icon
654
- }, null)]);
642
+ "key": 7
643
+ }, [createVNode(resolveComponent("ElIcon"), null, {
644
+ "default": function _default() {
645
+ return [createVNode(Type, null, null)];
646
+ }
647
+ })]);
655
648
  },
656
649
  handleClick: function handleClick(src) {
657
650
  if (this.onHandle) {
@@ -781,7 +774,6 @@ var Frame = defineComponent({
781
774
  }, {
782
775
  "default": function _default() {
783
776
  return [createVNode("img", {
784
- "alt": "example",
785
777
  "style": "width: 100%",
786
778
  "src": _this9.previewImage
787
779
  }, null)];
@@ -803,7 +795,7 @@ var Frame = defineComponent({
803
795
  "src": src,
804
796
  "frameBorder": "0",
805
797
  "style": {
806
- 'height': height,
798
+ height: height,
807
799
  'border': '0 none',
808
800
  'width': '100%'
809
801
  }
@@ -832,64 +824,35 @@ var Frame = defineComponent({
832
824
  }
833
825
  });
834
826
 
835
- var NAME$8 = 'fcRadio';
827
+ var NAME$7 = 'fcRadio';
836
828
  var Radio = defineComponent({
837
- name: NAME$8,
829
+ name: NAME$7,
838
830
  inheritAttrs: false,
839
831
  props: {
832
+ formCreateInject: Object,
840
833
  modelValue: {
841
- type: [String, Number],
842
- "default": function _default() {
843
- return [];
844
- }
834
+ type: [String, Number, Boolean],
835
+ "default": ''
845
836
  },
846
837
  type: String
847
838
  },
848
839
  emits: ['update:modelValue'],
849
840
  setup: function setup(props, _) {
850
- var _toRefs = toRefs(inject('formCreateInject')),
851
- options = _toRefs.options;
852
-
853
- var trueValue = ref([]);
841
+ var options = toRef(props.formCreateInject, 'options', []);
854
842
  var value = toRef(props, 'modelValue');
855
843
 
856
844
  var _options = function _options() {
857
845
  return Array.isArray(options.value) ? options.value : [];
858
846
  };
859
847
 
860
- var update = function update() {
861
- trueValue.value = _options().filter(function (opt) {
862
- return opt.value === value.value;
863
- }).reduce(function (initial, opt) {
864
- return opt.label;
865
- }, '');
866
- };
867
-
868
- watch(options, function () {
869
- update();
870
- }, {
871
- deep: true,
872
- immediate: true
873
- });
874
848
  return {
875
849
  options: _options,
876
- trueValue: trueValue,
877
850
  value: value,
878
851
  onInput: function onInput(n) {
879
- _.emit('update:modelValue', _options().filter(function (opt) {
880
- return opt.label === n;
881
- }).reduce(function (initial, opt) {
882
- return opt.value;
883
- }, ''));
884
- },
885
- update: update
852
+ _.emit('update:modelValue', n);
853
+ }
886
854
  };
887
855
  },
888
- watch: {
889
- modelValue: function modelValue() {
890
- this.update();
891
- }
892
- },
893
856
  render: function render() {
894
857
  var _this$$slots$default,
895
858
  _this$$slots,
@@ -898,41 +861,44 @@ var Radio = defineComponent({
898
861
  var name = this.type === 'button' ? 'ElRadioButton' : 'ElRadio';
899
862
  var Type = resolveComponent(name);
900
863
  return createVNode(resolveComponent("ElRadioGroup"), mergeProps$1(this.$attrs, {
901
- "modelValue": this.trueValue,
864
+ "modelValue": this.value,
902
865
  "onUpdate:modelValue": this.onInput
903
866
  }), _objectSpread2({
904
867
  "default": function _default() {
905
868
  return [_this.options().map(function (opt, index) {
906
869
  var props = _objectSpread2({}, opt);
907
870
 
871
+ var value = props.value;
908
872
  delete props.value;
909
873
  return createVNode(Type, mergeProps$1(props, {
874
+ "label": value,
910
875
  "key": name + index + opt.value
911
- }), null);
876
+ }), {
877
+ "default": function _default() {
878
+ return [props.label || props.value || ''];
879
+ }
880
+ });
912
881
  }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
913
882
  }
914
883
  }, getSlot(this.$slots, ['default'])));
915
884
  }
916
885
  });
917
886
 
918
- var NAME$7 = 'fcSelect';
887
+ var NAME$6 = 'fcSelect';
919
888
  var Select = defineComponent({
920
- name: NAME$7,
889
+ name: NAME$6,
921
890
  inheritAttrs: false,
922
891
  props: {
892
+ formCreateInject: Object,
923
893
  modelValue: {
924
- type: Array,
925
- "default": function _default() {
926
- return [];
927
- }
894
+ type: [Array, String, Number, Boolean, Object],
895
+ "default": undefined
928
896
  },
929
897
  type: String
930
898
  },
931
899
  emits: ['update:modelValue'],
932
900
  setup: function setup(props) {
933
- var _toRefs = toRefs(inject('formCreateInject')),
934
- options = _toRefs.options;
935
-
901
+ var options = toRef(props.formCreateInject, 'options', []);
936
902
  var value = toRef(props, 'modelValue');
937
903
 
938
904
  var _options = function _options() {
@@ -966,9 +932,9 @@ var Select = defineComponent({
966
932
  }
967
933
  });
968
934
 
969
- var NAME$6 = 'fcTree';
935
+ var NAME$5 = 'fcTree';
970
936
  var Tree = defineComponent({
971
- name: NAME$6,
937
+ name: NAME$5,
972
938
  inheritAttrs: false,
973
939
  formCreateParser: {
974
940
  mergeProp: function mergeProp(ctx) {
@@ -1030,7 +996,7 @@ var Tree = defineComponent({
1030
996
  }
1031
997
  });
1032
998
 
1033
- 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}";
999
+ var css_248z$1 = "._fc-exceed .el-upload{display:none}";
1034
1000
  styleInject(css_248z$1);
1035
1001
 
1036
1002
  function parseFile(file, i) {
@@ -1045,37 +1011,21 @@ function getFileName(file) {
1045
1011
  return ('' + file).split('/').pop();
1046
1012
  }
1047
1013
 
1048
- var NAME$5 = 'fcUpload';
1014
+ var NAME$4 = 'fcUpload';
1049
1015
  var Upload = defineComponent({
1050
- name: NAME$5,
1016
+ name: NAME$4,
1051
1017
  inheritAttrs: false,
1052
1018
  props: {
1053
- onHandle: Function,
1054
- uploadType: {
1055
- type: String,
1056
- "default": 'file'
1057
- },
1058
- limit: {
1059
- type: Number,
1060
- "default": 0
1061
- },
1062
- allowRemove: {
1063
- type: Boolean,
1064
- "default": true
1065
- },
1066
1019
  previewMask: undefined,
1067
1020
  modalTitle: String,
1068
- handleIcon: [String, Boolean],
1069
1021
  modelValue: [Array, String]
1070
1022
  },
1071
- emits: ['update:modelValue'],
1023
+ emits: ['update:modelValue', 'change', 'remove'],
1072
1024
  data: function data() {
1073
1025
  return {
1074
- uploadList: [],
1075
1026
  previewVisible: false,
1076
1027
  previewImage: '',
1077
- fileList: [],
1078
- cacheFiles: []
1028
+ fileList: []
1079
1029
  };
1080
1030
  },
1081
1031
  created: function created() {
@@ -1083,13 +1033,6 @@ var Upload = defineComponent({
1083
1033
  },
1084
1034
  watch: {
1085
1035
  modelValue: function modelValue(n) {
1086
- if (this.$refs.upload.uploadFiles.every(function (file) {
1087
- return !file.status || file.status === 'success';
1088
- })) {
1089
- this.$refs.upload.uploadFiles = toArray(n).map(parseFile);
1090
- this.uploadList = this.$refs.upload.uploadFiles;
1091
- }
1092
-
1093
1036
  this.fileList = toArray(n).map(parseFile);
1094
1037
  },
1095
1038
  limit: function limit(n, o) {
@@ -1099,141 +1042,62 @@ var Upload = defineComponent({
1099
1042
  }
1100
1043
  },
1101
1044
  methods: {
1102
- key: function key(unique) {
1103
- return unique;
1104
- },
1105
- isDisabled: function isDisabled() {
1106
- return this.$attrs.disabled === true;
1107
- },
1108
- onRemove: function onRemove(file) {
1109
- if (this.isDisabled()) {
1110
- return;
1111
- }
1112
-
1113
- this.$refs.upload.handleRemove(file);
1114
- },
1115
- handleClick: function handleClick(file) {
1116
- if (this.onHandle) {
1117
- return this.onHandle(file);
1045
+ handlePreview: function handlePreview(file) {
1046
+ if (this.onPreview) {
1047
+ this.onPreview.apply(this, arguments);
1118
1048
  } else {
1119
1049
  this.previewImage = file.url;
1120
1050
  this.previewVisible = true;
1121
1051
  }
1122
1052
  },
1123
- makeItem: function makeItem(file, index) {
1124
- return this.uploadType === 'image' ? createVNode("img", {
1125
- "src": file.url,
1126
- "key": this.key('img' + index)
1127
- }, null) : createVNode("i", {
1128
- "class": "el-icon-document",
1129
- "key": this.key('i' + index)
1130
- }, null);
1131
- },
1132
- makeRemoveIcon: function makeRemoveIcon(file, index) {
1133
- var _this = this;
1134
-
1135
- return createVNode("i", {
1136
- "class": "el-icon-delete",
1137
- "onClick": function onClick() {
1138
- return _this.onRemove(file);
1139
- },
1140
- "key": this.key('ri' + index)
1141
- }, null);
1142
- },
1143
- makeHandleIcon: function makeHandleIcon(file, index) {
1144
- var _this2 = this;
1145
-
1146
- return createVNode("i", {
1147
- "class": this.handleIcon === true || this.handleIcon === undefined ? 'el-icon-view' : this.handleIcon,
1148
- "onClick": function onClick() {
1149
- return _this2.handleClick(file);
1150
- },
1151
- "key": this.key('hi' + index)
1152
- }, null);
1153
- },
1154
- makeProgress: function makeProgress(file, index) {
1155
- return createVNode(resolveComponent("ElProgress"), mergeProps$1({
1156
- percentage: file.percentage,
1157
- type: 'circle',
1158
- width: 52
1159
- }, {
1160
- "style": "margin-top:2px;",
1161
- "key": this.key('pg' + index)
1162
- }), null);
1163
- },
1164
- makeIcons: function makeIcons(file, index) {
1165
- var icons = [];
1166
-
1167
- if (this.allowRemove || this.handleIcon !== false) {
1168
- if (this.uploadType !== 'file' && this.handleIcon !== false || this.uploadType === 'file' && this.handleIcon) {
1169
- icons.push(this.makeHandleIcon(file, index));
1170
- }
1171
-
1172
- if (this.allowRemove) {
1173
- icons.push(this.makeRemoveIcon(file, index));
1174
- }
1175
-
1176
- return createVNode("div", {
1177
- "class": "fc-upload-cover"
1178
- }, [icons]);
1179
- }
1180
- },
1181
- makeFiles: function makeFiles() {
1182
- var _this3 = this;
1183
-
1184
- return this.uploadList.map(function (file, index) {
1185
- return createVNode("div", {
1186
- "key": _this3.key(index),
1187
- "class": "fc-files"
1188
- }, [file.percentage !== undefined && file.status !== 'success' ? _this3.makeProgress(file, index) : [_this3.makeItem(file, index), _this3.makeIcons(file, index)]]);
1189
- });
1190
- },
1191
- makeUpload: function makeUpload() {
1192
- var _this$$slots$default,
1193
- _this$$slots,
1194
- _this4 = this;
1195
-
1196
- var isShow = !this.limit || this.limit > this.uploadList.length;
1197
- return createVNode(resolveComponent("ElUpload"), mergeProps$1(this.$attrs, {
1198
- "showFileList": false,
1199
- "fileList": this.fileList,
1200
- "ref": "upload",
1201
- "style": {
1202
- display: 'inline-block'
1203
- },
1204
- "key": this.key('upload')
1205
- }), _objectSpread2({
1206
- "default": function _default() {
1207
- return [isShow ? ((_this$$slots$default = (_this$$slots = _this4.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)) || createVNode("div", {
1208
- "class": "fc-upload-btn"
1209
- }, [createVNode("i", {
1210
- "class": "el-icon-upload2"
1211
- }, null)]) : undefined];
1212
- }
1213
- }, getSlot(this.$slots, ['default'])));
1214
- },
1215
- update: function update() {
1216
- var files = this.$refs.upload.uploadFiles.map(function (file) {
1053
+ update: function update(fileList) {
1054
+ var files = fileList.map(function (file) {
1217
1055
  return file.url;
1218
1056
  }).filter(function (url) {
1219
1057
  return url !== undefined;
1220
1058
  });
1221
-
1222
- if (this.cacheFiles.length !== files.length) {
1223
- this.cacheFiles = _toConsumableArray(files);
1224
- this.$emit('update:modelValue', this.limit === 1 ? files[0] || '' : files);
1225
- }
1059
+ this.$emit('update:modelValue', this.limit === 1 ? files[0] || '' : files);
1226
1060
  },
1227
1061
  handleCancel: function handleCancel() {
1228
1062
  this.previewVisible = false;
1063
+ },
1064
+ handleChange: function handleChange(file, fileList) {
1065
+ this.$emit.apply(this, ['change'].concat(Array.prototype.slice.call(arguments)));
1066
+
1067
+ if (file.status === 'success') {
1068
+ this.update(fileList);
1069
+ }
1070
+ },
1071
+ handleRemove: function handleRemove(file, fileList) {
1072
+ this.$emit.apply(this, ['remove'].concat(Array.prototype.slice.call(arguments)));
1073
+ this.update(fileList);
1229
1074
  }
1230
1075
  },
1231
1076
  render: function render() {
1232
- var _this5 = this;
1077
+ var _this$$slots$default,
1078
+ _this$$slots,
1079
+ _this = this;
1233
1080
 
1234
- return createVNode("div", {
1235
- "class": "_fc-upload"
1236
- }, [[this.$attrs.showFileList ? [] : this.makeFiles(), this.makeUpload()], createVNode(resolveComponent("ElDialog"), {
1081
+ return createVNode(Fragment, null, [createVNode(resolveComponent("ElUpload"), mergeProps$1({
1082
+ "key": this.modelValue.length,
1083
+ "list-type": "picture-card"
1084
+ }, this.$attrs, {
1085
+ "class": {
1086
+ '_fc-exceed': this.$attrs.limit ? this.$attrs.limit <= this.modelValue.length : false
1087
+ },
1088
+ "onPreview": this.handlePreview,
1089
+ "onChange": this.handleChange,
1090
+ "onRemove": this.handleRemove,
1091
+ "fileList": this.fileList
1092
+ }), _objectSpread2({
1093
+ "default": function _default() {
1094
+ return [((_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)) || createVNode(resolveComponent("ElIcon"), null, {
1095
+ "default": function _default() {
1096
+ return [createVNode(resolveComponent("upload"), null, null)];
1097
+ }
1098
+ })];
1099
+ }
1100
+ }, getSlot(this.$slots, ['default']))), createVNode(resolveComponent("ElDialog"), {
1237
1101
  "appendToBody": true,
1238
1102
  "modal": this.previewMask,
1239
1103
  "title": this.modalTitle,
@@ -1242,24 +1106,11 @@ var Upload = defineComponent({
1242
1106
  }, {
1243
1107
  "default": function _default() {
1244
1108
  return [createVNode("img", {
1245
- "alt": "example",
1246
1109
  "style": "width: 100%",
1247
- "src": _this5.previewImage
1110
+ "src": _this.previewImage
1248
1111
  }, null)];
1249
1112
  }
1250
1113
  })]);
1251
- },
1252
- mounted: function mounted() {
1253
- var _this6 = this;
1254
-
1255
- this.uploadList = this.$refs.upload.uploadFiles;
1256
- this.$watch(function () {
1257
- return _this6.$refs.upload.uploadFiles;
1258
- }, function () {
1259
- _this6.update();
1260
- }, {
1261
- deep: true
1262
- });
1263
1114
  }
1264
1115
  });
1265
1116
 
@@ -1290,9 +1141,9 @@ function _isSlot(s) {
1290
1141
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
1291
1142
  }
1292
1143
 
1293
- var NAME$4 = 'fcGroup';
1144
+ var NAME$3 = 'fcGroup';
1294
1145
  var Group = defineComponent({
1295
- name: NAME$4,
1146
+ name: NAME$3,
1296
1147
  props: {
1297
1148
  field: String,
1298
1149
  rule: Array,
@@ -1335,9 +1186,9 @@ var Group = defineComponent({
1335
1186
  onBeforeAdd: {
1336
1187
  type: Function,
1337
1188
  "default": function _default() {}
1338
- }
1189
+ },
1190
+ formCreateInject: Object
1339
1191
  },
1340
- inject: ['formCreateInject'],
1341
1192
  data: function data() {
1342
1193
  return {
1343
1194
  len: 0,
@@ -1394,7 +1245,8 @@ var Group = defineComponent({
1394
1245
  });
1395
1246
  }
1396
1247
  },
1397
- deep: true
1248
+ deep: true,
1249
+ flush: 'post'
1398
1250
  }
1399
1251
  },
1400
1252
  methods: {
@@ -1514,24 +1366,31 @@ var Group = defineComponent({
1514
1366
  this.input(this.modelValue);
1515
1367
  },
1516
1368
  addIcon: function addIcon(key) {
1517
- return createVNode("i", {
1369
+ return createVNode(resolveComponent("el-icon"), {
1518
1370
  "key": "a".concat(key),
1519
- "class": "el-icon-circle-plus-outline",
1520
1371
  "style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer', ";"),
1521
1372
  "onClick": this.add
1522
- }, null);
1373
+ }, {
1374
+ "default": function _default() {
1375
+ return [createVNode(resolveComponent("circle-plus"), null, null)];
1376
+ }
1377
+ });
1523
1378
  },
1524
1379
  delIcon: function delIcon(index, key) {
1525
1380
  var _this7 = this;
1526
1381
 
1527
- return createVNode("i", {
1382
+ return createVNode(resolveComponent("ElIcon"), {
1528
1383
  "key": "d".concat(key),
1529
1384
  "class": "el-icon-remove-outline",
1530
1385
  "style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer;color:#606266', ";"),
1531
1386
  "onClick": function onClick() {
1532
1387
  return _this7.del(index, key);
1533
1388
  }
1534
- }, null);
1389
+ }, {
1390
+ "default": function _default() {
1391
+ return [createVNode(resolveComponent("remove"), null, null)];
1392
+ }
1393
+ });
1535
1394
  },
1536
1395
  makeIcon: function makeIcon(total, index, key) {
1537
1396
  var _this8 = this;
@@ -1569,13 +1428,13 @@ var Group = defineComponent({
1569
1428
  created: function created() {
1570
1429
  var d = (this.expand || 0) - this.modelValue.length;
1571
1430
 
1572
- if (d > 0) {
1573
- this.expandRule(d);
1574
- }
1575
-
1576
1431
  for (var i = 0; i < this.modelValue.length; i++) {
1577
1432
  this.addRule(i);
1578
1433
  }
1434
+
1435
+ if (d > 0) {
1436
+ this.expandRule(d);
1437
+ }
1579
1438
  },
1580
1439
  render: function render() {
1581
1440
  var _this9 = this;
@@ -1587,12 +1446,12 @@ var Group = defineComponent({
1587
1446
  vm: this,
1588
1447
  add: this.add
1589
1448
  }) : createVNode("i", {
1590
- "key": 'a_def',
1449
+ "key": 1,
1591
1450
  "class": "el-icon-circle-plus-outline",
1592
1451
  "style": "font-size:".concat(this.fontSize, "px;vertical-align:middle;color:").concat(this.disabled ? '#c9cdd4;cursor: not-allowed' : '#606266;cursor:pointer', ";"),
1593
1452
  "onClick": this.add
1594
1453
  }, null) : createVNode("div", {
1595
- "key": 'con'
1454
+ "key": 2
1596
1455
  }, [keys.map(function (key, index) {
1597
1456
  var _slot;
1598
1457
 
@@ -1650,9 +1509,9 @@ var Group = defineComponent({
1650
1509
  }
1651
1510
  });
1652
1511
 
1653
- var NAME$3 = 'fcSubForm';
1512
+ var NAME$2 = 'fcSubForm';
1654
1513
  var Sub = defineComponent({
1655
- name: NAME$3,
1514
+ name: NAME$2,
1656
1515
  props: {
1657
1516
  rule: Array,
1658
1517
  options: {
@@ -1677,9 +1536,9 @@ var Sub = defineComponent({
1677
1536
  syncDisabled: {
1678
1537
  type: Boolean,
1679
1538
  "default": true
1680
- }
1539
+ },
1540
+ formCreateInject: Object
1681
1541
  },
1682
- inject: ['formCreateInject'],
1683
1542
  data: function data() {
1684
1543
  return {
1685
1544
  cacheValue: {},
@@ -1740,10 +1599,10 @@ var Sub = defineComponent({
1740
1599
 
1741
1600
  var components = [Checkbox, Frame, Radio, Select, Tree, Upload, Group, Sub];
1742
1601
 
1743
- var NAME$2 = 'FormCreate';
1602
+ var NAME$1 = 'FormCreate';
1744
1603
  function $FormCreate(FormCreate) {
1745
1604
  return defineComponent({
1746
- name: NAME$2,
1605
+ name: NAME$1,
1747
1606
  props: {
1748
1607
  rule: {
1749
1608
  type: Array,
@@ -1760,7 +1619,8 @@ function $FormCreate(FormCreate) {
1760
1619
  },
1761
1620
  extendOption: Boolean,
1762
1621
  modelValue: Object,
1763
- api: Object
1622
+ api: Object,
1623
+ name: String
1764
1624
  },
1765
1625
  emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync', 'reload', 'repeat-field', 'update'],
1766
1626
  render: function render() {
@@ -1776,6 +1636,7 @@ function $FormCreate(FormCreate) {
1776
1636
  modelValue = _toRefs.modelValue;
1777
1637
 
1778
1638
  var data = reactive({
1639
+ ctxInject: {},
1779
1640
  destroyed: false,
1780
1641
  isShow: true,
1781
1642
  unique: 1,
@@ -1968,11 +1829,11 @@ function deepExtend(origin) {
1968
1829
  $set(origin, key, clone);
1969
1830
 
1970
1831
  if (!is.Undef(clone)) {
1971
- if (clone.__json !== undefined) {
1832
+ if (!is.Undef(clone.__json)) {
1972
1833
  origin[key].__json = clone.__json;
1973
1834
  }
1974
1835
 
1975
- if (clone.__origin !== undefined) {
1836
+ if (!is.Undef(clone.__origin)) {
1976
1837
  origin[key].__origin = clone.__origin;
1977
1838
  }
1978
1839
  }
@@ -2023,7 +1884,7 @@ function toJson(obj, space) {
2023
1884
  return val;
2024
1885
  }
2025
1886
 
2026
- if (hasProperty(val, '__json')) {
1887
+ if (val.__json) {
2027
1888
  return val.__json;
2028
1889
  }
2029
1890
 
@@ -2224,33 +2085,6 @@ function toProps(rule) {
2224
2085
  return prop;
2225
2086
  }
2226
2087
 
2227
- function toString(val) {
2228
- return val == null ? '' : _typeof(val) === 'object' ? JSON.stringify(val, null, 2) : String(val);
2229
- }
2230
-
2231
- var id$1 = 0;
2232
- function uniqueId() {
2233
- return Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now()).concat(++id$1)).toString(36);
2234
- }
2235
-
2236
- function deepSet(data, idx, val) {
2237
- var _data = data,
2238
- to;
2239
- (idx || '').split('.').forEach(function (v) {
2240
- if (to) {
2241
- if (!_data[to] || _typeof(_data[to]) != 'object') {
2242
- _data[to] = {};
2243
- }
2244
-
2245
- _data = _data[to];
2246
- }
2247
-
2248
- to = v;
2249
- });
2250
- _data[to] = val;
2251
- return _data;
2252
- }
2253
-
2254
2088
  function baseRule() {
2255
2089
  return {
2256
2090
  props: {},
@@ -2451,7 +2285,8 @@ function Api(h) {
2451
2285
 
2452
2286
  if (ctx) {
2453
2287
  if (child) {
2454
- rules = ctx.rule.children;
2288
+ rules = ctx.getPending('children', ctx.rule.children);
2289
+ if (!Array.isArray(rules)) return;
2455
2290
  index = ctx.rule.children.length - 1;
2456
2291
  } else {
2457
2292
  index = ctx.root.indexOf(ctx.origin);
@@ -2468,7 +2303,8 @@ function Api(h) {
2468
2303
 
2469
2304
  if (ctx) {
2470
2305
  if (child) {
2471
- rules = ctx.rule.children;
2306
+ rules = ctx.getPending('children', ctx.rule.children);
2307
+ if (!Array.isArray(rules)) return;
2472
2308
  } else {
2473
2309
  index = ctx.root.indexOf(ctx.origin);
2474
2310
  rules = ctx.root;
@@ -2703,6 +2539,10 @@ function Api(h) {
2703
2539
  }
2704
2540
 
2705
2541
  (_h$vm = h.vm).emit.apply(_h$vm, [name].concat(args));
2542
+ },
2543
+ helper: {
2544
+ tidyFields: tidyFields,
2545
+ props: props
2706
2546
  }
2707
2547
  };
2708
2548
  ['on', 'once', 'off', 'set'].forEach(function (n) {
@@ -2764,11 +2604,55 @@ function lower(str) {
2764
2604
  return str.replace(str[0], str[0].toLowerCase());
2765
2605
  }
2766
2606
 
2607
+ function toString(val) {
2608
+ return val == null ? '' : _typeof(val) === 'object' ? JSON.stringify(val, null, 2) : String(val);
2609
+ }
2610
+
2611
+ var id$2 = 0;
2612
+ function uniqueId() {
2613
+ return Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now()).concat(++id$2)).toString(36);
2614
+ }
2615
+
2616
+ function deepSet(data, idx, val) {
2617
+ var _data = data,
2618
+ to;
2619
+ (idx || '').split('.').forEach(function (v) {
2620
+ if (to) {
2621
+ if (!_data[to] || _typeof(_data[to]) != 'object') {
2622
+ _data[to] = {};
2623
+ }
2624
+
2625
+ _data = _data[to];
2626
+ }
2627
+
2628
+ to = v;
2629
+ });
2630
+ _data[to] = val;
2631
+ return _data;
2632
+ }
2633
+
2767
2634
  function useRender$1(Render) {
2768
2635
  extend(Render.prototype, {
2769
2636
  initRender: function initRender() {
2770
2637
  this.cacheConfig = {};
2771
2638
  },
2639
+ getTypeSlot: function getTypeSlot(type) {
2640
+ var name = 'type-' + toLine(type);
2641
+
2642
+ var _fn = function _fn(vm) {
2643
+ if (vm) {
2644
+ var slot = vm.slots[name] || vm.slots['type-' + type];
2645
+
2646
+ if (slot) {
2647
+ return slot;
2648
+ }
2649
+
2650
+ return _fn(vm.setupState.parent);
2651
+ }
2652
+ };
2653
+
2654
+ return _fn(this.vm);
2655
+ },
2772
2656
  render: function render() {
2773
2657
  var _this = this;
2774
2658
 
@@ -2789,7 +2673,7 @@ function useRender$1(Render) {
2789
2673
  ctx.initProp();
2790
2674
  this.mergeGlobal(ctx);
2791
2675
  ctx.initNone();
2792
- var slots = this.renderChildren(ctx);
2676
+ var slots = this.renderChildren(ctx.loadChildrenPending(), ctx);
2793
2677
  var def = slots["default"];
2794
2678
  def && slotBag.setSlot(ctx.rule.slot, function () {
2795
2679
  return def();
@@ -2816,8 +2700,15 @@ function useRender$1(Render) {
2816
2700
  ctx.prop = mergeRule({}, [this.cacheConfig[ctx.trueType].value, ctx.prop]);
2817
2701
  },
2818
2702
  setOptions: function setOptions(ctx) {
2819
- if (ctx.prop.optionsTo && ctx.prop.options) {
2820
- deepSet(ctx.prop, ctx.prop.optionsTo, ctx.prop.options);
2703
+ var opt = ctx.loadPending({
2704
+ key: 'options',
2705
+ origin: ctx.prop.options,
2706
+ def: []
2707
+ });
2708
+ ctx.prop.options = opt;
2709
+
2710
+ if (ctx.prop.optionsTo && opt) {
2711
+ deepSet(ctx.prop, ctx.prop.optionsTo, opt);
2821
2712
  }
2822
2713
  },
2823
2714
  deepSet: function deepSet$1(ctx) {
@@ -2846,42 +2737,45 @@ function useRender$1(Render) {
2846
2737
  renderCtx: function renderCtx(ctx, parent) {
2847
2738
  var _this4 = this;
2848
2739
 
2849
- if (ctx.type === 'hidden') return;
2850
- var rule = ctx.rule;
2851
- var preview = this.options.preview || false;
2852
-
2853
- if (!this.cache[ctx.id] || this.cache[ctx.id].slot !== rule.slot) {
2854
- var vn;
2855
- ctx.initProp();
2856
- this.mergeGlobal(ctx);
2857
- ctx.initNone();
2858
- this.$manager.tidyRule(ctx);
2859
- this.deepSet(ctx);
2860
- this.setOptions(ctx);
2861
- this.ctxProp(ctx);
2862
- var prop = ctx.prop;
2863
-
2864
- if (prop.hidden) {
2865
- this.setCache(ctx, undefined, parent);
2866
- return;
2867
- }
2740
+ try {
2741
+ if (ctx.type === 'hidden') return;
2742
+ var rule = ctx.rule;
2743
+ var preview = this.options.preview || false;
2744
+
2745
+ if (!this.cache[ctx.id] || this.cache[ctx.id].slot !== rule.slot) {
2746
+ var vn;
2747
+ ctx.initProp();
2748
+ this.mergeGlobal(ctx);
2749
+ ctx.initNone();
2750
+ this.$manager.tidyRule(ctx);
2751
+ this.deepSet(ctx);
2752
+ this.setOptions(ctx);
2753
+ this.ctxProp(ctx);
2754
+ var prop = ctx.prop;
2755
+ prop.props.formCreateInject = this.injectProp(ctx);
2756
+
2757
+ if (prop.hidden) {
2758
+ this.setCache(ctx, undefined, parent);
2759
+ return;
2760
+ }
2868
2761
 
2869
- vn = function vn() {
2870
- return _this4.item(ctx, function () {
2762
+ vn = function vn() {
2871
2763
  var children = {};
2872
2764
 
2765
+ var _load = ctx.loadChildrenPending();
2766
+
2873
2767
  if (ctx.parser.renderChildren) {
2874
- children = ctx.parser.renderChildren(ctx);
2768
+ children = ctx.parser.renderChildren(_load, ctx);
2875
2769
  } else if (ctx.parser.loadChildren !== false) {
2876
- children = _this4.renderChildren(ctx);
2770
+ children = _this4.renderChildren(_load, ctx);
2877
2771
  }
2878
2772
 
2879
- var slot = 'type-' + toLine(ctx.type);
2773
+ var slot = _this4.getTypeSlot(ctx.type);
2880
2774
 
2881
2775
  var _vn;
2882
2776
 
2883
- if (_this4.vm.slots[slot]) {
2884
- _vn = _this4.vm.slots[slot]({
2777
+ if (slot) {
2778
+ _vn = slot({
2885
2779
  rule: rule,
2886
2780
  prop: prop,
2887
2781
  preview: preview,
@@ -2903,16 +2797,22 @@ function useRender$1(Render) {
2903
2797
  _vn = _this4.display(_vn);
2904
2798
  }
2905
2799
 
2800
+ _this4.setCache(ctx, function () {
2801
+ return _vn;
2802
+ }, parent);
2803
+
2906
2804
  return _vn;
2907
- });
2908
- };
2805
+ };
2909
2806
 
2910
- this.setCache(ctx, vn, parent);
2911
- ctx._vnode = vn;
2912
- return vn;
2913
- }
2807
+ this.setCache(ctx, vn, parent);
2808
+ return vn;
2809
+ }
2914
2810
 
2915
- return this.getCache(ctx);
2811
+ return this.getCache(ctx);
2812
+ } catch (e) {
2813
+ console.error(e);
2814
+ return;
2815
+ }
2916
2816
  },
2917
2817
  getModelField: function getModelField(ctx) {
2918
2818
  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';
@@ -2946,30 +2846,36 @@ function useRender$1(Render) {
2946
2846
  return vn;
2947
2847
  }
2948
2848
  },
2949
- item: function item(ctx, vn) {
2950
- return this.vNode.h('FcFragment', {
2951
- key: ctx.prop.key,
2952
- formCreateInject: this.injectProp(ctx)
2953
- }, vn);
2954
- },
2955
2849
  isFragment: function isFragment(ctx) {
2956
2850
  return ctx.type === 'fragment' || ctx.type === 'template';
2957
2851
  },
2958
2852
  injectProp: function injectProp(ctx) {
2959
2853
  var _this6 = this;
2960
2854
 
2961
- return {
2855
+ var state = this.vm.setupState;
2856
+
2857
+ if (!state.ctxInject[ctx.id]) {
2858
+ state.ctxInject[ctx.id] = {
2859
+ api: this.$handle.api,
2860
+ form: this.fc.create,
2861
+ subForm: function subForm(_subForm) {
2862
+ _this6.$handle.addSubForm(ctx, _subForm);
2863
+ },
2864
+ options: [],
2865
+ children: [],
2866
+ preview: false,
2867
+ field: ctx.field,
2868
+ rule: ctx.rule
2869
+ };
2870
+ }
2871
+
2872
+ var inject = state.ctxInject[ctx.id];
2873
+ extend(inject, {
2962
2874
  preview: this.options.preview || false,
2963
- api: this.$handle.api,
2964
- form: this.fc.create,
2965
- subForm: function subForm(_subForm) {
2966
- _this6.$handle.addSubForm(ctx, _subForm);
2967
- },
2968
- field: ctx.field,
2969
- options: ctx.prop.options || [],
2970
- children: ctx.rule.children,
2971
- rule: ctx.rule
2972
- };
2875
+ options: ctx.prop.options,
2876
+ children: ctx.loadChildrenPending()
2877
+ });
2878
+ return inject;
2973
2879
  },
2974
2880
  ctxProp: function ctxProp(ctx, custom) {
2975
2881
  var _this7 = this;
@@ -3013,10 +2919,9 @@ function useRender$1(Render) {
3013
2919
  onInput: function onInput(ctx, value) {
3014
2920
  this.$handle.onInput(ctx, value);
3015
2921
  },
3016
- renderChildren: function renderChildren(ctx) {
2922
+ renderChildren: function renderChildren(children, ctx) {
3017
2923
  var _this8 = this;
3018
2924
 
3019
- var children = ctx.rule.children;
3020
2925
  if (!is.trueArray(children)) return {};
3021
2926
  var slotBag = makeSlotBag();
3022
2927
  children.map(function (child) {
@@ -3073,12 +2978,16 @@ function useRender$1(Render) {
3073
2978
  });
3074
2979
  }
3075
2980
 
3076
- return this.vNode.make(type, rule, slotBag.mergeBag(children).getSlots());
2981
+ var props = _objectSpread2({}, rule);
2982
+
2983
+ delete props.type;
2984
+ delete props.is;
2985
+ return this.vNode.make(type, props, slotBag.mergeBag(children).getSlots());
3077
2986
  }
3078
2987
  });
3079
2988
  }
3080
2989
 
3081
- var id = 1;
2990
+ var id$1 = 1;
3082
2991
  function Render(handle) {
3083
2992
  extend(this, {
3084
2993
  $handle: handle,
@@ -3086,7 +2995,7 @@ function Render(handle) {
3086
2995
  vm: handle.vm,
3087
2996
  $manager: handle.$manager,
3088
2997
  vNode: new handle.fc.CreateNode(handle.vm),
3089
- id: id++
2998
+ id: id$1++
3090
2999
  });
3091
3000
  funcProxy(this, {
3092
3001
  options: function options() {
@@ -3334,6 +3243,7 @@ function RuleContext(handle, rule) {
3334
3243
  rule: rule,
3335
3244
  origin: rule.__origin__ || rule,
3336
3245
  name: rule.name,
3246
+ pending: {},
3337
3247
  none: false,
3338
3248
  watch: [],
3339
3249
  linkOn: [],
@@ -3356,6 +3266,102 @@ function RuleContext(handle, rule) {
3356
3266
  this.update(handle, true);
3357
3267
  }
3358
3268
  extend(RuleContext.prototype, {
3269
+ loadChildrenPending: function loadChildrenPending() {
3270
+ var _this = this;
3271
+
3272
+ var children = this.rule.children || [];
3273
+ if (Array.isArray(children)) return children;
3274
+ return this.loadPending({
3275
+ key: 'children',
3276
+ origin: children,
3277
+ def: [],
3278
+ onLoad: function onLoad(data) {
3279
+ _this.$handle && _this.$handle.loadChildren(data, _this);
3280
+ },
3281
+ onUpdate: function onUpdate(value, oldValue) {
3282
+ if (_this.$handle) {
3283
+ value === oldValue ? _this.$handle.loadChildren(value, _this) : _this.$handle.updateChildren(_this, value, oldValue);
3284
+ }
3285
+ },
3286
+ onReload: function onReload(value) {
3287
+ if (_this.$handle) {
3288
+ _this.$handle.updateChildren(_this, [], value);
3289
+ } else {
3290
+ delete _this.pending.children;
3291
+ }
3292
+ }
3293
+ });
3294
+ },
3295
+ loadPending: function loadPending(config) {
3296
+ var _this2 = this;
3297
+
3298
+ var key = config.key,
3299
+ origin = config.origin,
3300
+ def = config.def,
3301
+ onLoad = config.onLoad,
3302
+ onReload = config.onReload,
3303
+ onUpdate = config.onUpdate;
3304
+
3305
+ if (this.pending[key] && this.pending[key].origin === origin) {
3306
+ return this.getPending(key, def);
3307
+ }
3308
+
3309
+ delete this.pending[key];
3310
+ var value = origin;
3311
+
3312
+ if (is.Function(origin)) {
3313
+ var source = invoke(function () {
3314
+ return origin({
3315
+ rule: _this2.rule,
3316
+ api: _this2.$api,
3317
+ update: function update(data) {
3318
+ var value = data || def;
3319
+
3320
+ var oldValue = _this2.getPending(key, def);
3321
+
3322
+ _this2.setPending(key, origin, value);
3323
+
3324
+ onUpdate && onUpdate(value, oldValue);
3325
+ },
3326
+ reload: function reload() {
3327
+ var oldValue = _this2.getPending(key, def);
3328
+
3329
+ delete _this2.pending[key];
3330
+ onReload && onReload(oldValue);
3331
+ _this2.$api && _this2.$api.sync(_this2.rule);
3332
+ }
3333
+ });
3334
+ });
3335
+
3336
+ if (source && is.Function(source.then)) {
3337
+ source.then(function (data) {
3338
+ var value = data || def;
3339
+
3340
+ _this2.setPending(key, origin, value);
3341
+
3342
+ onLoad && onLoad(value);
3343
+ _this2.$api && _this2.$api.sync(_this2.rule);
3344
+ });
3345
+ value = def;
3346
+ this.setPending(key, origin, value);
3347
+ } else {
3348
+ value = source || def;
3349
+ this.setPending(key, origin, value);
3350
+ onLoad && onLoad(value);
3351
+ }
3352
+ }
3353
+
3354
+ return value;
3355
+ },
3356
+ getPending: function getPending(key, def) {
3357
+ return this.pending[key] && this.pending[key].value || def;
3358
+ },
3359
+ setPending: function setPending(key, origin, value) {
3360
+ this.pending[key] = {
3361
+ origin: origin,
3362
+ value: reactive(value)
3363
+ };
3364
+ },
3359
3365
  effectData: function effectData(name) {
3360
3366
  if (!this.payload[name]) {
3361
3367
  this.payload[name] = {};
@@ -3379,13 +3385,13 @@ extend(RuleContext.prototype, {
3379
3385
  parser.init(this);
3380
3386
  },
3381
3387
  initProp: function initProp() {
3382
- var _this = this;
3388
+ var _this3 = this;
3383
3389
 
3384
3390
  var rule = _objectSpread2({}, this.rule);
3385
3391
 
3386
3392
  delete rule.children;
3387
3393
  this.prop = mergeProps([rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
3388
- return _this.payload[k];
3394
+ return _this3.payload[k];
3389
3395
  })), [this.computed]));
3390
3396
  },
3391
3397
  initNone: function initNone() {
@@ -3412,10 +3418,10 @@ extend(RuleContext.prototype, {
3412
3418
  this.$handle.appendLink(this);
3413
3419
  },
3414
3420
  watchTo: function watchTo() {
3415
- var _this2 = this;
3421
+ var _this4 = this;
3416
3422
 
3417
3423
  nextTick(function () {
3418
- _this2.$handle.watchCtx(_this2);
3424
+ _this4.$handle && _this4.$handle.watchCtx(_this4);
3419
3425
  });
3420
3426
  },
3421
3427
  "delete": function _delete() {
@@ -3445,15 +3451,15 @@ extend(RuleContext.prototype, {
3445
3451
  this.ctrlRule = [];
3446
3452
  },
3447
3453
  rm: function rm() {
3448
- var _this3 = this;
3454
+ var _this5 = this;
3449
3455
 
3450
3456
  var _rm = function _rm() {
3451
- var index = _this3.root.indexOf(_this3.origin);
3457
+ var index = _this5.root.indexOf(_this5.origin);
3452
3458
 
3453
3459
  if (index > -1) {
3454
- _this3.root.splice(index, 1);
3460
+ _this5.root.splice(index, 1);
3455
3461
 
3456
- _this3.$handle && _this3.$handle.refresh();
3462
+ _this5.$handle && _this5.$handle.refresh();
3457
3463
  }
3458
3464
  };
3459
3465
 
@@ -3464,17 +3470,17 @@ extend(RuleContext.prototype, {
3464
3470
  }
3465
3471
 
3466
3472
  this.$handle.noWatch(function () {
3467
- _this3.$handle.deferSyncValue(function () {
3468
- _this3.rmCtrl();
3473
+ _this5.$handle.deferSyncValue(function () {
3474
+ _this5.rmCtrl();
3469
3475
 
3470
3476
  _rm();
3471
3477
 
3472
- _this3.$handle.rmCtx(_this3);
3478
+ _this5.$handle.rmCtx(_this5);
3473
3479
 
3474
- extend(_this3, {
3480
+ extend(_this5, {
3475
3481
  root: []
3476
3482
  });
3477
- }, _this3.input);
3483
+ }, _this5.input);
3478
3484
  });
3479
3485
  },
3480
3486
  update: function update(handle, init) {
@@ -3513,7 +3519,6 @@ function useLoader(Handler) {
3513
3519
  });
3514
3520
  fullRule(rule);
3515
3521
  this.appendValue(rule);
3516
- rule.options = Array.isArray(rule.options) ? rule.options : [];
3517
3522
  [rule, rule['prefix'], rule['suffix']].forEach(function (item) {
3518
3523
  if (!item) {
3519
3524
  return;
@@ -3633,7 +3638,7 @@ function useLoader(Handler) {
3633
3638
  if (!is.Object(_rule) || !getRule(_rule).type) return err('未定义生成规则的 type 字段', _rule);
3634
3639
 
3635
3640
  if (_rule.__fc__ && _rule.__fc__.root === rules && _this6.ctxs[_rule.__fc__.id]) {
3636
- loadChildren(_rule.__fc__.rule.children, _rule.__fc__);
3641
+ loadChildren(_rule.__fc__.loadChildrenPending(), _rule.__fc__);
3637
3642
  return _rule.__fc__;
3638
3643
  }
3639
3644
 
@@ -3704,7 +3709,10 @@ function useLoader(Handler) {
3704
3709
  _this6.setCtx(ctx);
3705
3710
 
3706
3711
  !isCopy && !isInit && _this6.effect(ctx, 'load');
3707
- ctx.parser.loadChildren === false || loadChildren(ctx.rule.children, ctx);
3712
+
3713
+ var _load = ctx.loadChildrenPending();
3714
+
3715
+ ctx.parser.loadChildren === false || loadChildren(_load, ctx);
3708
3716
 
3709
3717
  if (!parent) {
3710
3718
  var _preIndex = preIndex(index);
@@ -3800,7 +3808,7 @@ function useLoader(Handler) {
3800
3808
  if (valid) {
3801
3809
  flag = true;
3802
3810
  var ruleCon = {
3803
- type: 'template',
3811
+ type: 'fragment',
3804
3812
  "native": true,
3805
3813
  __ctrl: true,
3806
3814
  children: rule
@@ -3901,7 +3909,7 @@ function useInput(Handler) {
3901
3909
  this.setFormData(ctx, formValue);
3902
3910
  this.syncValue();
3903
3911
  this.valueChange(ctx, value);
3904
- this.vm.emit('change', ctx.field, value, ctx.origin, this.api, setFlag);
3912
+ this.vm.emit('change', ctx.field, value, ctx.origin, this.api, setFlag || false);
3905
3913
  this.effect(ctx, 'value');
3906
3914
  },
3907
3915
  onInput: function onInput(ctx, value) {
@@ -3912,7 +3920,7 @@ function useInput(Handler) {
3912
3920
  }
3913
3921
  },
3914
3922
  setFormData: function setFormData(ctx, value) {
3915
- $set(this.formData, ctx.id, value);
3923
+ $set(this.formData, ctx.id, value === undefined ? null : value);
3916
3924
  },
3917
3925
  getFormData: function getFormData(ctx) {
3918
3926
  return this.formData[ctx.id];
@@ -4134,13 +4142,13 @@ function useContext(Handler) {
4134
4142
  var none = ['field', 'value', 'vm', 'template', 'name', 'config', 'control', 'inject', 'sync', 'payload', 'optionsTo', 'update'];
4135
4143
  var all = attrs();
4136
4144
  all.filter(function (k) {
4137
- return none.indexOf(k) === -1;
4145
+ return k[0] !== '_' && none.indexOf(k) === -1;
4138
4146
  }).forEach(function (key) {
4139
4147
  var ref = toRef(ctx.rule, key);
4140
4148
  var flag = key === 'children';
4141
4149
  ctx.refRule[key] = ref;
4142
4150
  ctx.watch.push(watch(flag ? function () {
4143
- return _toConsumableArray(ref.value || []);
4151
+ return is.Function(ref.value) ? ref.value : _toConsumableArray(ref.value || []);
4144
4152
  } : function () {
4145
4153
  return ref.value;
4146
4154
  }, function (_, o) {
@@ -4170,20 +4178,16 @@ function useContext(Handler) {
4170
4178
  ctx.updateType();
4171
4179
 
4172
4180
  _this.bindParser(ctx);
4173
- } else if (key === 'children') {
4174
- _this.deferSyncValue(function () {
4175
- o && o.forEach(function (child) {
4176
- if ((n || []).indexOf(child) === -1 && child && !is.String(child) && child.__fc__ && !_this.ctxs[child.__fc__.id]) {
4177
- _this.rmCtx(child.__fc__);
4178
- }
4179
- });
4181
+ } else if (flag) {
4182
+ if (is.Function(o)) {
4183
+ o = ctx.getPending('children', []);
4184
+ }
4180
4185
 
4181
- if (is.trueArray(n)) {
4182
- _this.loadChildren(n, ctx);
4186
+ if (is.Function(n)) {
4187
+ n = ctx.loadChildrenPending();
4188
+ }
4183
4189
 
4184
- _this.bus.$emit('update', _this.api);
4185
- }
4186
- });
4190
+ _this.updateChildren(ctx, n, o);
4187
4191
  }
4188
4192
 
4189
4193
  _this.$render.clearCache(ctx);
@@ -4210,15 +4214,32 @@ function useContext(Handler) {
4210
4214
 
4211
4215
  this.watchEffect(ctx);
4212
4216
  },
4213
- rmSub: function rmSub(sub) {
4217
+ updateChildren: function updateChildren(ctx, n, o) {
4214
4218
  var _this2 = this;
4215
4219
 
4220
+ this.deferSyncValue(function () {
4221
+ o && o.forEach(function (child) {
4222
+ if ((n || []).indexOf(child) === -1 && child && !is.String(child) && child.__fc__) {
4223
+ _this2.rmCtx(child.__fc__);
4224
+ }
4225
+ });
4226
+
4227
+ if (is.trueArray(n)) {
4228
+ _this2.loadChildren(n, ctx);
4229
+
4230
+ _this2.bus.$emit('update', _this2.api);
4231
+ }
4232
+ });
4233
+ },
4234
+ rmSub: function rmSub(sub) {
4235
+ var _this3 = this;
4236
+
4216
4237
  is.trueArray(sub) && sub.forEach(function (r) {
4217
- r && r.__fc__ && _this2.rmCtx(r.__fc__);
4238
+ r && r.__fc__ && _this3.rmCtx(r.__fc__);
4218
4239
  });
4219
4240
  },
4220
4241
  rmCtx: function rmCtx(ctx) {
4221
- var _this3 = this;
4242
+ var _this4 = this;
4222
4243
 
4223
4244
  if (ctx.deleted) return;
4224
4245
  var id = ctx.id,
@@ -4228,20 +4249,23 @@ function useContext(Handler) {
4228
4249
  $del(this.ctxs, id);
4229
4250
  $del(this.formData, id);
4230
4251
  $del(this.subForm, id);
4252
+ $del(this.vm.setupState.ctxInject, id);
4231
4253
  input && this.rmIdCtx(ctx, field, 'field');
4232
4254
  name && this.rmIdCtx(ctx, name, 'name');
4233
4255
  this.deferSyncValue(function () {
4234
- if (!_this3.reloading) {
4256
+ if (!_this4.reloading) {
4235
4257
  if (ctx.parser.loadChildren !== false) {
4236
- if (is.trueArray(ctx.rule.children)) {
4237
- ctx.rule.children.forEach(function (h) {
4238
- return h.__fc__ && _this3.rmCtx(h.__fc__);
4258
+ var children = ctx.getPending('children', ctx.rule.children);
4259
+
4260
+ if (is.trueArray(children)) {
4261
+ children.forEach(function (h) {
4262
+ return h.__fc__ && _this4.rmCtx(h.__fc__);
4239
4263
  });
4240
4264
  }
4241
4265
  }
4242
4266
 
4243
- if (ctx.root === _this3.rules) {
4244
- _this3.vm.setupState.renderRule();
4267
+ if (ctx.root === _this4.rules) {
4268
+ _this4.vm.setupState.renderRule();
4245
4269
  }
4246
4270
  }
4247
4271
  }, input);
@@ -4323,7 +4347,6 @@ function useEffect(Handler) {
4323
4347
  watchEffect: function watchEffect(ctx) {
4324
4348
  var _this3 = this;
4325
4349
 
4326
- this.vm;
4327
4350
  Object.keys(ctx.rule.effect || {}).forEach(function (k) {
4328
4351
  ctx.watch.push(watch(function () {
4329
4352
  return ctx.rule.effect[k];
@@ -4361,7 +4384,7 @@ function useEffect(Handler) {
4361
4384
  input = _ref.input,
4362
4385
  type = _ref.type,
4363
4386
  custom = _ref.custom;
4364
- if (!type || type === 'fcFragment') return;
4387
+ if (!type || ['fcFragment', 'fragment'].indexOf(type) > -1) return;
4365
4388
  var effect = custom ? custom : rule.effect || {};
4366
4389
  Object.keys(effect).forEach(function (attr) {
4367
4390
  var p = _this4.providers[attr];
@@ -4558,26 +4581,8 @@ function fetch(option) {
4558
4581
  xhr.send(formData);
4559
4582
  }
4560
4583
 
4561
- var NAME$1 = 'FcFragment';
4584
+ var NAME = 'fcFragment';
4562
4585
  var fragment = defineComponent({
4563
- name: NAME$1,
4564
- inheritAttrs: false,
4565
- props: ['formCreateInject'],
4566
- setup: function setup(props) {
4567
- var data = toRef(props, 'formCreateInject');
4568
- var $inject = reactive(_objectSpread2({}, data.value));
4569
- watch(data, function () {
4570
- extend($inject, data.value);
4571
- });
4572
- provide('formCreateInject', $inject);
4573
- },
4574
- render: function render() {
4575
- return this.$slots["default"]();
4576
- }
4577
- });
4578
-
4579
- var NAME = 'FcVnode';
4580
- var vnode = defineComponent({
4581
4586
  name: NAME,
4582
4587
  inheritAttrs: false,
4583
4588
  props: ['vnode'],
@@ -4588,8 +4593,12 @@ var vnode = defineComponent({
4588
4593
 
4589
4594
  function tidyDirectives(directives) {
4590
4595
  return Object.keys(directives).map(function (n) {
4591
- var directive = directives[n];
4592
- return [resolveDirective(n), directive.arg, directive.value, directive.modifiers];
4596
+ var data = directives[n];
4597
+ var directive = resolveDirective(n);
4598
+ if (!directive) return;
4599
+ return [directive, data.value, data.arg, data.modifiers];
4600
+ }).filter(function (v) {
4601
+ return !!v;
4593
4602
  });
4594
4603
  }
4595
4604
 
@@ -4616,7 +4625,18 @@ function CreateNodeFactory() {
4616
4625
  return makeDirective(data, this.h(tag, toProps(data), children));
4617
4626
  },
4618
4627
  h: function h(tag, data, children) {
4619
- return createVNode(getCurrentInstance().appContext.config.isNativeTag(tag) ? tag : resolveComponent(tag), data, children);
4628
+ var isNativeTag = getCurrentInstance().appContext.config.isNativeTag(tag);
4629
+
4630
+ if (isNativeTag) {
4631
+ delete data.formCreateInject;
4632
+ }
4633
+
4634
+ try {
4635
+ return createVNode(isNativeTag ? tag : resolveComponent(tag), data, children);
4636
+ } catch (e) {
4637
+ console.error(e);
4638
+ return createVNode('');
4639
+ }
4620
4640
  },
4621
4641
  aliasMap: aliasMap
4622
4642
  });
@@ -4800,6 +4820,25 @@ function run(inject, rule, api) {
4800
4820
  return true;
4801
4821
  }
4802
4822
 
4823
+ var name$6 = 'html';
4824
+ var html = {
4825
+ name: name$6,
4826
+ loadChildren: false,
4827
+ render: function render(children, ctx) {
4828
+ ctx.prop.props.innerHTML = children["default"]();
4829
+ return ctx.vNode.make(ctx.prop.props.tag || 'div', ctx.prop);
4830
+ },
4831
+ renderChildren: function renderChildren(children) {
4832
+ return {
4833
+ "default": function _default() {
4834
+ return children.filter(function (v) {
4835
+ return is.String(v);
4836
+ }).join('');
4837
+ }
4838
+ };
4839
+ }
4840
+ };
4841
+
4803
4842
  function parseProp(name, id) {
4804
4843
  var prop;
4805
4844
 
@@ -4828,8 +4867,10 @@ function exportAttrs(attrs) {
4828
4867
  arrayAttrs.push.apply(arrayAttrs, _toConsumableArray(array));
4829
4868
  normalAttrs.push.apply(normalAttrs, _toConsumableArray(normal));
4830
4869
  appendProto([].concat(_toConsumableArray(key), _toConsumableArray(array), _toConsumableArray(normal)));
4831
- } //todo 表单嵌套
4870
+ }
4832
4871
 
4872
+ var id = 1;
4873
+ var instance = {}; //todo 表单嵌套
4833
4874
 
4834
4875
  function FormCreateFactory(config) {
4835
4876
  var components = _defineProperty({}, fragment.name, fragment);
@@ -4837,6 +4878,7 @@ function FormCreateFactory(config) {
4837
4878
  var parsers = {};
4838
4879
  var directives = {};
4839
4880
  var modelFields = {};
4881
+ var useApps = [];
4840
4882
  var providers = {
4841
4883
  fetch: $fetch
4842
4884
  };
@@ -4848,6 +4890,14 @@ function FormCreateFactory(config) {
4848
4890
  var CreateNode = CreateNodeFactory();
4849
4891
  exportAttrs(config.attrs || {});
4850
4892
 
4893
+ function getApi(name) {
4894
+ return instance[name];
4895
+ }
4896
+
4897
+ function useApp(fn) {
4898
+ useApps.push(fn);
4899
+ }
4900
+
4851
4901
  function directive() {
4852
4902
  var data = nameProp.apply(void 0, arguments);
4853
4903
  if (data.id && data.prop) directives[data.id] = data.prop;
@@ -4916,7 +4966,7 @@ function FormCreateFactory(config) {
4916
4966
  }
4917
4967
 
4918
4968
  function $vnode() {
4919
- return vnode;
4969
+ return fragment;
4920
4970
  } //todo 检查回调函数作用域
4921
4971
 
4922
4972
 
@@ -4927,7 +4977,11 @@ function FormCreateFactory(config) {
4927
4977
 
4928
4978
  function create(rules, option) {
4929
4979
  var app = createFormApp(rules, option || {});
4930
- config.appUse && config.appUse(app);
4980
+ useApps.forEach(function (v) {
4981
+ invoke(function () {
4982
+ return v(create, app);
4983
+ });
4984
+ });
4931
4985
  var div = document.createElement('div');
4932
4986
  ((option === null || option === void 0 ? void 0 : option.el) || document.body).appendChild(div);
4933
4987
  var vm = app.mount(div);
@@ -4946,6 +5000,7 @@ function FormCreateFactory(config) {
4946
5000
  var _this = this;
4947
5001
 
4948
5002
  extend(this, {
5003
+ id: id++,
4949
5004
  create: create,
4950
5005
  vm: vm,
4951
5006
  manager: createManager(config.manager),
@@ -4953,6 +5008,7 @@ function FormCreateFactory(config) {
4953
5008
  providers: providers,
4954
5009
  modelFields: modelFields,
4955
5010
  rules: vm.props.rule,
5011
+ name: vm.props.name,
4956
5012
  prop: {
4957
5013
  components: components,
4958
5014
  directives: directives
@@ -4977,6 +5033,10 @@ function FormCreateFactory(config) {
4977
5033
  extend(vm.appContext.components, components);
4978
5034
  extend(vm.appContext.directives, directives);
4979
5035
  this.$handle = new Handler(this);
5036
+
5037
+ if (this.name) {
5038
+ instance[this.name] = this.api();
5039
+ }
4980
5040
  }
4981
5041
 
4982
5042
  extend(FormCreate.prototype, {
@@ -5042,6 +5102,10 @@ function FormCreateFactory(config) {
5042
5102
  this.$handle.mounted();
5043
5103
  },
5044
5104
  unmount: function unmount() {
5105
+ if (this.name) {
5106
+ delete instance[this.name];
5107
+ }
5108
+
5045
5109
  this.unwatch && this.unwatch();
5046
5110
  this.$handle.reloadRule([]);
5047
5111
  },
@@ -5075,17 +5139,19 @@ function FormCreateFactory(config) {
5075
5139
  $form: $form,
5076
5140
  parseFn: parseFn,
5077
5141
  parseJson: parseJson,
5078
- toJson: toJson
5142
+ toJson: toJson,
5143
+ useApp: useApp,
5144
+ getApi: getApi
5079
5145
  });
5080
5146
  }
5081
5147
 
5082
5148
  function useStatic(formCreate) {
5083
5149
  extend(formCreate, {
5084
5150
  create: create,
5085
- install: function install(Vue, options) {
5151
+ install: function install(app, options) {
5086
5152
  globalConfig = _objectSpread2(_objectSpread2({}, globalConfig), options || {});
5087
- if (Vue._installedFormCreate === true) return;
5088
- Vue._installedFormCreate = true;
5153
+ if (app._installedFormCreate === true) return;
5154
+ app._installedFormCreate = true;
5089
5155
 
5090
5156
  var $formCreate = function $formCreate(rules) {
5091
5157
  var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -5093,9 +5159,13 @@ function FormCreateFactory(config) {
5093
5159
  };
5094
5160
 
5095
5161
  useAttr($formCreate);
5096
- Vue.config.globalProperties.$formCreate = $formCreate;
5097
- Vue.component('FormCreate', $form());
5098
- Vue.component('fc-vnode', vnode);
5162
+ app.config.globalProperties.$formCreate = $formCreate;
5163
+ app.component('FormCreate', $form());
5164
+ useApps.forEach(function (v) {
5165
+ invoke(function () {
5166
+ return v(formCreate, app);
5167
+ });
5168
+ });
5099
5169
  }
5100
5170
  });
5101
5171
  }
@@ -5105,7 +5175,13 @@ function FormCreateFactory(config) {
5105
5175
  CreateNode.use({
5106
5176
  fragment: 'fcFragment'
5107
5177
  });
5108
- if (config.install) create.use(config);
5178
+ config.install && create.use(config);
5179
+ useApp(function (_, app) {
5180
+ app.mixin({
5181
+ props: ['formCreateInject']
5182
+ });
5183
+ });
5184
+ parser(html);
5109
5185
  return create;
5110
5186
  }
5111
5187
 
@@ -5250,7 +5326,7 @@ var parsers = [datePicker, hidden, input, slider, timePicker, row, select];
5250
5326
  var PRE = 'el';
5251
5327
  var alias = {
5252
5328
  button: PRE + '-button',
5253
- icon: 'i',
5329
+ icon: PRE + '-icon',
5254
5330
  slider: PRE + '-slider',
5255
5331
  rate: PRE + '-rate',
5256
5332
  upload: 'fc-upload',
@@ -5307,7 +5383,6 @@ function getConfig() {
5307
5383
  type: 'default',
5308
5384
  loading: false,
5309
5385
  disabled: false,
5310
- icon: 'el-icon-refresh',
5311
5386
  innerText: '重置',
5312
5387
  show: false,
5313
5388
  col: undefined,
@@ -5344,15 +5419,29 @@ function tidyBool(opt, name) {
5344
5419
 
5345
5420
  var manager = {
5346
5421
  validate: function validate() {
5347
- return this.form().validate();
5422
+ var form = this.form();
5423
+
5424
+ if (form) {
5425
+ return form.validate();
5426
+ } else {
5427
+ return new Promise(function (v) {
5428
+ return v();
5429
+ });
5430
+ }
5348
5431
  },
5349
5432
  validateField: function validateField(field) {
5350
5433
  var _this = this;
5351
5434
 
5352
5435
  return new Promise(function (resolve, reject) {
5353
- _this.form().validateField(field, function (res) {
5354
- res ? reject(res) : resolve(null);
5355
- });
5436
+ var form = _this.form();
5437
+
5438
+ if (form) {
5439
+ form.validateField(field, function (res) {
5440
+ res ? reject(res) : resolve(null);
5441
+ });
5442
+ } else {
5443
+ resolve();
5444
+ }
5356
5445
  });
5357
5446
  },
5358
5447
  clearValidateState: function clearValidateState(ctx) {
@@ -5383,7 +5472,7 @@ var manager = {
5383
5472
  info: {
5384
5473
  trigger: 'hover',
5385
5474
  placement: 'top-start',
5386
- icon: 'el-icon-warning'
5475
+ icon: true
5387
5476
  },
5388
5477
  title: {},
5389
5478
  col: {
@@ -5499,10 +5588,16 @@ var manager = {
5499
5588
 
5500
5589
  children[infoProp.align !== 'left' ? 'unshift' : 'push'](this.$r(mergeProps([infoProp, prop]), _defineProperty({}, titleProp.slot || (isTip ? 'default' : 'reference'), function () {
5501
5590
  return _this4.$r({
5502
- type: 'i',
5503
- "class": infoProp.icon === true ? 'el-icon-warning' : infoProp.icon,
5591
+ type: 'ElIcon',
5592
+ style: 'top:2px',
5504
5593
  key: "".concat(uni, "i")
5505
- }, {}, true);
5594
+ }, {
5595
+ "default": function _default() {
5596
+ return _this4.$r({
5597
+ type: infoProp.icon === true ? 'warning' : infoProp.icon
5598
+ });
5599
+ }
5600
+ }, true);
5506
5601
  })));
5507
5602
  }
5508
5603
 
@@ -5564,7 +5659,7 @@ var manager = {
5564
5659
 
5565
5660
  var resetBtn = _objectSpread2({}, this.options.resetBtn);
5566
5661
 
5567
- var text = resetBtn.innerText;
5662
+ var innerText = resetBtn.innerText;
5568
5663
  delete resetBtn.innerText;
5569
5664
  return this.$r({
5570
5665
  type: 'button',
@@ -5579,14 +5674,14 @@ var manager = {
5579
5674
  }
5580
5675
  },
5581
5676
  key: "".concat(this.key, "b2")
5582
- }, [text]);
5677
+ }, [innerText]);
5583
5678
  },
5584
5679
  makeSubmitBtn: function makeSubmitBtn() {
5585
5680
  var _this6 = this;
5586
5681
 
5587
5682
  var submitBtn = _objectSpread2({}, this.options.submitBtn);
5588
5683
 
5589
- var text = submitBtn.innerText;
5684
+ var innerText = submitBtn.innerText;
5590
5685
  delete submitBtn.innerText;
5591
5686
  return this.$r({
5592
5687
  type: 'button',
@@ -5601,7 +5696,7 @@ var manager = {
5601
5696
  }
5602
5697
  },
5603
5698
  key: "".concat(this.key, "b1")
5604
- }, [text]);
5699
+ }, [innerText]);
5605
5700
  }
5606
5701
  };
5607
5702
 
@@ -5687,7 +5782,7 @@ function useFrame(maker) {
5687
5782
  return maker;
5688
5783
  }
5689
5784
 
5690
- 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)}";
5785
+ 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%}";
5691
5786
  styleInject(css_248z);
5692
5787
 
5693
5788
  function tidyBtnProp(btn, def) {
@@ -5859,18 +5954,19 @@ function install(FormCreate) {
5859
5954
  Object.keys(maker$1).forEach(function (name) {
5860
5955
  FormCreate.maker[name] = maker$1[name];
5861
5956
  });
5862
- }
5863
5957
 
5864
- function appUse(app) {
5865
- app.use(ElementPlus);
5958
+ if (typeof window !== 'undefined' && window.ElementPlus) {
5959
+ FormCreate.useApp(function (_, app) {
5960
+ app.use(window.ElementPlus);
5961
+ });
5962
+ }
5866
5963
  }
5867
5964
 
5868
5965
  function elmFormCreate() {
5869
5966
  return FormCreateFactory({
5870
5967
  ui: 'element-ui',
5871
- version: '3.0.0-alpha.3',
5968
+ version: '3.1.0',
5872
5969
  manager: manager,
5873
- appUse: appUse,
5874
5970
  extendApi: extendApi,
5875
5971
  install: install,
5876
5972
  attrs: {