@form-create/element-ui 3.0.0-alpha.2 → 3.1.0

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.2
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, computed, resolveComponent, createVNode, mergeProps as mergeProps$1, isVNode, nextTick, markRaw, reactive, getCurrentInstance, provide, onMounted, onBeforeUnmount, onUpdated, watch, 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,46 +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
- var _options = computed(function () {
231
- return Array.isArray(options) ? options : [];
232
- });
233
-
234
- var update = function update() {
235
- trueValue.value = value.value ? _options.value.filter(function (opt) {
236
- return value.value.indexOf(opt.value) !== -1;
237
- }).map(function (option) {
238
- return option.label;
239
- }) : [];
227
+ var _options = function _options() {
228
+ return Array.isArray(options.value) ? options.value : [];
240
229
  };
241
230
 
242
- update();
243
231
  return {
244
232
  options: _options,
245
- trueValue: trueValue,
246
233
  value: value,
247
234
  onInput: function onInput(n) {
248
- _.emit('update:modelValue', _options.value.filter(function (opt) {
249
- return n.indexOf(opt.label) !== -1;
250
- }).map(function (opt) {
251
- return opt.value;
252
- }).filter(function (v) {
253
- return v !== undefined;
254
- }));
255
- },
256
- update: update
235
+ _.emit('update:modelValue', n);
236
+ }
257
237
  };
258
238
  },
259
- watch: {
260
- modelValue: function modelValue() {
261
- this.update();
262
- }
263
- },
264
239
  render: function render() {
265
240
  var _this$$slots$default,
266
241
  _this$$slots,
@@ -269,17 +244,23 @@ var Checkbox = defineComponent({
269
244
  var name = this.type === 'button' ? 'ElCheckboxButton' : 'ElCheckbox';
270
245
  var Type = resolveComponent(name);
271
246
  return createVNode(resolveComponent("ElCheckboxGroup"), mergeProps$1(this.$attrs, {
272
- "modelValue": this.trueValue,
247
+ "modelValue": this.value,
273
248
  "onUpdate:modelValue": this.onInput
274
249
  }), _objectSpread2({
275
250
  "default": function _default() {
276
- return [_this.options.map(function (opt, index) {
251
+ return [_this.options().map(function (opt, index) {
277
252
  var props = _objectSpread2({}, opt);
278
253
 
254
+ var value = props.value;
279
255
  delete props.value;
280
256
  return createVNode(Type, mergeProps$1(props, {
257
+ "label": value,
281
258
  "key": name + index + opt.value
282
- }), null);
259
+ }), {
260
+ "default": function _default() {
261
+ return [props.label || props.value || ''];
262
+ }
263
+ });
283
264
  }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
284
265
  }
285
266
  }, getSlot(this.$slots, ['default'])));
@@ -361,16 +342,16 @@ function styleInject(css, ref) {
361
342
  }
362
343
  }
363
344
 
364
- 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}";
365
346
  styleInject(css_248z$2);
366
347
 
367
348
  function _isSlot$1(s) {
368
349
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
369
350
  }
370
351
 
371
- var NAME$9 = 'fcFrame';
352
+ var NAME$8 = 'fcFrame';
372
353
  var Frame = defineComponent({
373
- name: NAME$9,
354
+ name: NAME$8,
374
355
  props: {
375
356
  type: {
376
357
  type: String,
@@ -391,7 +372,7 @@ var Frame = defineComponent({
391
372
  },
392
373
  icon: {
393
374
  type: String,
394
- "default": 'el-icon-upload2'
375
+ "default": 'upload'
395
376
  },
396
377
  width: {
397
378
  type: String,
@@ -414,7 +395,10 @@ var Frame = defineComponent({
414
395
  "default": '关闭'
415
396
  },
416
397
  modalTitle: String,
417
- handleIcon: [String, Boolean],
398
+ handleIcon: {
399
+ type: [String, Boolean],
400
+ "default": undefined
401
+ },
418
402
  title: String,
419
403
  allowRemove: {
420
404
  type: Boolean,
@@ -469,9 +453,9 @@ var Frame = defineComponent({
469
453
  okBtn: {
470
454
  type: Boolean,
471
455
  "default": true
472
- }
456
+ },
457
+ formCreateInject: Object
473
458
  },
474
- inject: ['formCreateInject'],
475
459
  emits: ['update:modelValue', 'change'],
476
460
  data: function data() {
477
461
  return {
@@ -488,9 +472,6 @@ var Frame = defineComponent({
488
472
  }
489
473
  },
490
474
  methods: {
491
- key: function key(unique) {
492
- return unique;
493
- },
494
475
  close: function close() {
495
476
  this.closeModel(true);
496
477
  },
@@ -530,7 +511,7 @@ var Frame = defineComponent({
530
511
  }).toString(),
531
512
  readonly: true
532
513
  }, {
533
- "key": this.key('input')
514
+ "key": 1
534
515
  }), {
535
516
  append: function append() {
536
517
  return createVNode(resolveComponent("ElButton"), {
@@ -541,14 +522,18 @@ var Frame = defineComponent({
541
522
  }, null);
542
523
  },
543
524
  suffix: function suffix() {
544
- return _this.fileList.length ? createVNode("i", {
545
- "class": "el-input__icon el-icon-circle-close",
525
+ return _this.fileList.length ? createVNode(resolveComponent("ElIcon"), {
526
+ "class": "el-input__icon",
546
527
  "onClick": function onClick() {
547
528
  _this.fileList = [];
548
529
 
549
530
  _this.input();
550
531
  }
551
- }, null) : null;
532
+ }, {
533
+ "default": function _default() {
534
+ return [createVNode(resolveComponent("CircleClose"), null, null)];
535
+ }
536
+ }) : null;
552
537
  }
553
538
  });
554
539
  },
@@ -558,13 +543,13 @@ var Frame = defineComponent({
558
543
  }
559
544
 
560
545
  return createVNode("div", {
561
- "key": this.key('group')
546
+ "key": 2
562
547
  }, [children]);
563
548
  },
564
549
  makeItem: function makeItem(index, children) {
565
550
  return createVNode("div", {
566
- "class": "fc-files",
567
- "key": this.key('file' + index)
551
+ "class": "_fc-files",
552
+ "key": '3' + index
568
553
  }, [children]);
569
554
  },
570
555
  valid: function valid(f) {
@@ -587,43 +572,53 @@ var Frame = defineComponent({
587
572
  }
588
573
 
589
574
  return createVNode("div", {
590
- "class": "fc-upload-cover",
591
- "key": this.key('uc')
575
+ "class": "_fc-upload-cover",
576
+ "key": 4
592
577
  }, [icons]);
593
578
  }
594
579
  },
595
580
  makeHandleIcon: function makeHandleIcon(val, index) {
596
581
  var _this2 = this;
597
582
 
598
- return createVNode("i", {
599
- "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"), {
600
585
  "onClick": function onClick() {
601
586
  return _this2.handleClick(val);
602
587
  },
603
- "key": this.key('hi' + index)
604
- }, null);
588
+ "key": '5' + index
589
+ }, {
590
+ "default": function _default() {
591
+ return [createVNode(Type, null, null)];
592
+ }
593
+ });
605
594
  },
606
595
  makeRemoveIcon: function makeRemoveIcon(val, index) {
607
596
  var _this3 = this;
608
597
 
609
- return createVNode("i", {
610
- "class": "el-icon-delete",
598
+ return createVNode(resolveComponent("ElIcon"), {
611
599
  "onClick": function onClick() {
612
600
  return _this3.handleRemove(val);
613
601
  },
614
- "key": this.key('ri' + index)
615
- }, null);
602
+ "key": '6' + index
603
+ }, {
604
+ "default": function _default() {
605
+ return [createVNode(resolveComponent("delete"), null, null)];
606
+ }
607
+ });
616
608
  },
617
609
  makeFiles: function makeFiles() {
618
610
  var _this4 = this;
619
611
 
620
612
  return this.makeGroup(this.fileList.map(function (src, index) {
621
- return _this4.makeItem(index, [createVNode("i", {
622
- "class": "el-icon-tickets",
613
+ return _this4.makeItem(index, [createVNode(resolveComponent("ElIcon"), {
623
614
  "onClick": function onClick() {
624
615
  return _this4.handleClick(src);
625
616
  }
626
- }, null), _this4.makeIcons(src, index)]);
617
+ }, {
618
+ "default": function _default() {
619
+ return [createVNode(resolveComponent("document"), null, null)];
620
+ }
621
+ }), _this4.makeIcons(src, index)]);
627
622
  }));
628
623
  },
629
624
  makeImages: function makeImages() {
@@ -638,15 +633,18 @@ var Frame = defineComponent({
638
633
  makeBtn: function makeBtn() {
639
634
  var _this6 = this;
640
635
 
636
+ var Type = resolveComponent(this.icon);
641
637
  return createVNode("div", {
642
- "class": "fc-upload-btn",
638
+ "class": "_fc-upload-btn",
643
639
  "onClick": function onClick() {
644
640
  return _this6.showModel();
645
641
  },
646
- "key": this.key('btn')
647
- }, [createVNode("i", {
648
- "class": this.icon
649
- }, null)]);
642
+ "key": 7
643
+ }, [createVNode(resolveComponent("ElIcon"), null, {
644
+ "default": function _default() {
645
+ return [createVNode(Type, null, null)];
646
+ }
647
+ })]);
650
648
  },
651
649
  handleClick: function handleClick(src) {
652
650
  if (this.onHandle) {
@@ -776,7 +774,6 @@ var Frame = defineComponent({
776
774
  }, {
777
775
  "default": function _default() {
778
776
  return [createVNode("img", {
779
- "alt": "example",
780
777
  "style": "width: 100%",
781
778
  "src": _this9.previewImage
782
779
  }, null)];
@@ -798,7 +795,7 @@ var Frame = defineComponent({
798
795
  "src": src,
799
796
  "frameBorder": "0",
800
797
  "style": {
801
- 'height': height,
798
+ height: height,
802
799
  'border': '0 none',
803
800
  'width': '100%'
804
801
  }
@@ -827,59 +824,35 @@ var Frame = defineComponent({
827
824
  }
828
825
  });
829
826
 
830
- var NAME$8 = 'fcRadio';
827
+ var NAME$7 = 'fcRadio';
831
828
  var Radio = defineComponent({
832
- name: NAME$8,
829
+ name: NAME$7,
833
830
  inheritAttrs: false,
834
831
  props: {
832
+ formCreateInject: Object,
835
833
  modelValue: {
836
- type: [String, Number],
837
- "default": function _default() {
838
- return [];
839
- }
834
+ type: [String, Number, Boolean],
835
+ "default": ''
840
836
  },
841
837
  type: String
842
838
  },
843
839
  emits: ['update:modelValue'],
844
840
  setup: function setup(props, _) {
845
- var _toRefs = toRefs(inject('formCreateInject')),
846
- options = _toRefs.options;
847
-
848
- var trueValue = ref([]);
841
+ var options = toRef(props.formCreateInject, 'options', []);
849
842
  var value = toRef(props, 'modelValue');
850
843
 
851
- var _options = computed(function () {
852
- return Array.isArray(options) ? options : [];
853
- });
854
-
855
- var update = function update() {
856
- trueValue.value = _options.value.filter(function (opt) {
857
- return opt.value === value.value;
858
- }).reduce(function (initial, opt) {
859
- return opt.label;
860
- }, '');
844
+ var _options = function _options() {
845
+ return Array.isArray(options.value) ? options.value : [];
861
846
  };
862
847
 
863
- update();
864
848
  return {
865
849
  options: _options,
866
- trueValue: trueValue,
867
850
  value: value,
868
851
  onInput: function onInput(n) {
869
- _.emit('update:modelValue', _options.value.filter(function (opt) {
870
- return opt.label === n;
871
- }).reduce(function (initial, opt) {
872
- return opt.value;
873
- }, ''));
874
- },
875
- update: update
852
+ _.emit('update:modelValue', n);
853
+ }
876
854
  };
877
855
  },
878
- watch: {
879
- modelValue: function modelValue() {
880
- this.update();
881
- }
882
- },
883
856
  render: function render() {
884
857
  var _this$$slots$default,
885
858
  _this$$slots,
@@ -888,46 +861,49 @@ var Radio = defineComponent({
888
861
  var name = this.type === 'button' ? 'ElRadioButton' : 'ElRadio';
889
862
  var Type = resolveComponent(name);
890
863
  return createVNode(resolveComponent("ElRadioGroup"), mergeProps$1(this.$attrs, {
891
- "modelValue": this.trueValue,
864
+ "modelValue": this.value,
892
865
  "onUpdate:modelValue": this.onInput
893
866
  }), _objectSpread2({
894
867
  "default": function _default() {
895
- return [_this.options.map(function (opt, index) {
868
+ return [_this.options().map(function (opt, index) {
896
869
  var props = _objectSpread2({}, opt);
897
870
 
871
+ var value = props.value;
898
872
  delete props.value;
899
873
  return createVNode(Type, mergeProps$1(props, {
874
+ "label": value,
900
875
  "key": name + index + opt.value
901
- }), null);
876
+ }), {
877
+ "default": function _default() {
878
+ return [props.label || props.value || ''];
879
+ }
880
+ });
902
881
  }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
903
882
  }
904
883
  }, getSlot(this.$slots, ['default'])));
905
884
  }
906
885
  });
907
886
 
908
- var NAME$7 = 'fcSelect';
887
+ var NAME$6 = 'fcSelect';
909
888
  var Select = defineComponent({
910
- name: NAME$7,
889
+ name: NAME$6,
911
890
  inheritAttrs: false,
912
891
  props: {
892
+ formCreateInject: Object,
913
893
  modelValue: {
914
- type: Array,
915
- "default": function _default() {
916
- return [];
917
- }
894
+ type: [Array, String, Number, Boolean, Object],
895
+ "default": undefined
918
896
  },
919
897
  type: String
920
898
  },
921
899
  emits: ['update:modelValue'],
922
900
  setup: function setup(props) {
923
- var _toRefs = toRefs(inject('formCreateInject')),
924
- options = _toRefs.options;
925
-
901
+ var options = toRef(props.formCreateInject, 'options', []);
926
902
  var value = toRef(props, 'modelValue');
927
903
 
928
- var _options = computed(function () {
929
- return Array.isArray(options) ? options : [];
930
- });
904
+ var _options = function _options() {
905
+ return Array.isArray(options.value) ? options.value : [];
906
+ };
931
907
 
932
908
  return {
933
909
  options: _options,
@@ -946,7 +922,7 @@ var Select = defineComponent({
946
922
  }
947
923
  }), _objectSpread2({
948
924
  "default": function _default() {
949
- return [_this.options.map(function (props, index) {
925
+ return [_this.options().map(function (props, index) {
950
926
  return createVNode(resolveComponent("ElOption"), mergeProps$1(props, {
951
927
  "key": '' + index + props.value
952
928
  }), null);
@@ -956,9 +932,9 @@ var Select = defineComponent({
956
932
  }
957
933
  });
958
934
 
959
- var NAME$6 = 'fcTree';
935
+ var NAME$5 = 'fcTree';
960
936
  var Tree = defineComponent({
961
- name: NAME$6,
937
+ name: NAME$5,
962
938
  inheritAttrs: false,
963
939
  formCreateParser: {
964
940
  mergeProp: function mergeProp(ctx) {
@@ -1020,7 +996,7 @@ var Tree = defineComponent({
1020
996
  }
1021
997
  });
1022
998
 
1023
- 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}";
1024
1000
  styleInject(css_248z$1);
1025
1001
 
1026
1002
  function parseFile(file, i) {
@@ -1035,33 +1011,18 @@ function getFileName(file) {
1035
1011
  return ('' + file).split('/').pop();
1036
1012
  }
1037
1013
 
1038
- var NAME$5 = 'fcUpload';
1014
+ var NAME$4 = 'fcUpload';
1039
1015
  var Upload = defineComponent({
1040
- name: NAME$5,
1016
+ name: NAME$4,
1041
1017
  inheritAttrs: false,
1042
1018
  props: {
1043
- onHandle: Function,
1044
- uploadType: {
1045
- type: String,
1046
- "default": 'file'
1047
- },
1048
- limit: {
1049
- type: Number,
1050
- "default": 0
1051
- },
1052
- allowRemove: {
1053
- type: Boolean,
1054
- "default": true
1055
- },
1056
1019
  previewMask: undefined,
1057
1020
  modalTitle: String,
1058
- handleIcon: [String, Boolean],
1059
1021
  modelValue: [Array, String]
1060
1022
  },
1061
- emits: ['update:modelValue'],
1023
+ emits: ['update:modelValue', 'change', 'remove'],
1062
1024
  data: function data() {
1063
1025
  return {
1064
- uploadList: [],
1065
1026
  previewVisible: false,
1066
1027
  previewImage: '',
1067
1028
  fileList: []
@@ -1072,13 +1033,6 @@ var Upload = defineComponent({
1072
1033
  },
1073
1034
  watch: {
1074
1035
  modelValue: function modelValue(n) {
1075
- if (this.$refs.upload.uploadFiles.every(function (file) {
1076
- return !file.status || file.status === 'success';
1077
- })) {
1078
- this.$refs.upload.uploadFiles = toArray(n).map(parseFile);
1079
- this.uploadList = this.$refs.upload.uploadFiles;
1080
- }
1081
-
1082
1036
  this.fileList = toArray(n).map(parseFile);
1083
1037
  },
1084
1038
  limit: function limit(n, o) {
@@ -1088,121 +1042,16 @@ var Upload = defineComponent({
1088
1042
  }
1089
1043
  },
1090
1044
  methods: {
1091
- key: function key(unique) {
1092
- return unique;
1093
- },
1094
- isDisabled: function isDisabled() {
1095
- return this.$attrs.disabled === true;
1096
- },
1097
- onRemove: function onRemove(file) {
1098
- if (this.isDisabled()) {
1099
- return;
1100
- }
1101
-
1102
- this.$refs.upload.handleRemove(file);
1103
- },
1104
- handleClick: function handleClick(file) {
1105
- if (this.onHandle) {
1106
- return this.onHandle(file);
1045
+ handlePreview: function handlePreview(file) {
1046
+ if (this.onPreview) {
1047
+ this.onPreview.apply(this, arguments);
1107
1048
  } else {
1108
1049
  this.previewImage = file.url;
1109
1050
  this.previewVisible = true;
1110
1051
  }
1111
1052
  },
1112
- makeItem: function makeItem(file, index) {
1113
- return this.uploadType === 'image' ? createVNode("img", {
1114
- "src": file.url,
1115
- "key": this.key('img' + index)
1116
- }, null) : createVNode("i", {
1117
- "class": "el-icon-document",
1118
- "key": this.key('i' + index)
1119
- }, null);
1120
- },
1121
- makeRemoveIcon: function makeRemoveIcon(file, index) {
1122
- var _this = this;
1123
-
1124
- return createVNode("i", {
1125
- "class": "el-icon-delete",
1126
- "onClick": function onClick() {
1127
- return _this.onRemove(file);
1128
- },
1129
- "key": this.key('ri' + index)
1130
- }, null);
1131
- },
1132
- makeHandleIcon: function makeHandleIcon(file, index) {
1133
- var _this2 = this;
1134
-
1135
- return createVNode("i", {
1136
- "class": this.handleIcon === true || this.handleIcon === undefined ? 'el-icon-view' : this.handleIcon,
1137
- "onClick": function onClick() {
1138
- return _this2.handleClick(file);
1139
- },
1140
- "key": this.key('hi' + index)
1141
- }, null);
1142
- },
1143
- makeProgress: function makeProgress(file, index) {
1144
- return createVNode(resolveComponent("ElProgress"), mergeProps$1({
1145
- percentage: file.percentage,
1146
- type: 'circle',
1147
- width: 52
1148
- }, {
1149
- "style": "margin-top:2px;",
1150
- "key": this.key('pg' + index)
1151
- }), null);
1152
- },
1153
- makeIcons: function makeIcons(file, index) {
1154
- var icons = [];
1155
-
1156
- if (this.allowRemove || this.handleIcon !== false) {
1157
- if (this.uploadType !== 'file' && this.handleIcon !== false || this.uploadType === 'file' && this.handleIcon) {
1158
- icons.push(this.makeHandleIcon(file, index));
1159
- }
1160
-
1161
- if (this.allowRemove) {
1162
- icons.push(this.makeRemoveIcon(file, index));
1163
- }
1164
-
1165
- return createVNode("div", {
1166
- "class": 'fc-upload-cover'
1167
- }, [icons]);
1168
- }
1169
- },
1170
- makeFiles: function makeFiles() {
1171
- var _this3 = this;
1172
-
1173
- return this.uploadList.map(function (file, index) {
1174
- return createVNode("div", {
1175
- "key": _this3.key(index),
1176
- "class": 'fc-files'
1177
- }, [file.percentage !== undefined && file.status !== 'success' ? _this3.makeProgress(file, index) : [_this3.makeItem(file, index), _this3.makeIcons(file, index)]]);
1178
- });
1179
- },
1180
- makeUpload: function makeUpload() {
1181
- var _this$$slots$default,
1182
- _this$$slots,
1183
- _this4 = this;
1184
-
1185
- var isShow = !this.limit || this.limit > this.uploadList.length;
1186
- return createVNode(resolveComponent("ElUpload"), mergeProps$1(this.$attrs, {
1187
- "showFileList": false,
1188
- "fileList": this.fileList,
1189
- "ref": "upload",
1190
- "style": {
1191
- display: 'inline-block'
1192
- },
1193
- "key": this.key('upload')
1194
- }), _objectSpread2({
1195
- "default": function _default() {
1196
- 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", {
1197
- "class": 'fc-upload-btn'
1198
- }, [createVNode("i", {
1199
- "class": "el-icon-upload2"
1200
- }, null)]) : undefined];
1201
- }
1202
- }, getSlot(this.$slots, ['default'])));
1203
- },
1204
- update: function update() {
1205
- var files = this.$refs.upload.uploadFiles.map(function (file) {
1053
+ update: function update(fileList) {
1054
+ var files = fileList.map(function (file) {
1206
1055
  return file.url;
1207
1056
  }).filter(function (url) {
1208
1057
  return url !== undefined;
@@ -1211,14 +1060,44 @@ var Upload = defineComponent({
1211
1060
  },
1212
1061
  handleCancel: function handleCancel() {
1213
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);
1214
1074
  }
1215
1075
  },
1216
1076
  render: function render() {
1217
- var _this5 = this;
1077
+ var _this$$slots$default,
1078
+ _this$$slots,
1079
+ _this = this;
1218
1080
 
1219
- return createVNode("div", {
1220
- "class": '_fc-upload'
1221
- }, [[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"), {
1222
1101
  "appendToBody": true,
1223
1102
  "modal": this.previewMask,
1224
1103
  "title": this.modalTitle,
@@ -1227,24 +1106,11 @@ var Upload = defineComponent({
1227
1106
  }, {
1228
1107
  "default": function _default() {
1229
1108
  return [createVNode("img", {
1230
- "alt": "example",
1231
1109
  "style": "width: 100%",
1232
- "src": _this5.previewImage
1110
+ "src": _this.previewImage
1233
1111
  }, null)];
1234
1112
  }
1235
1113
  })]);
1236
- },
1237
- mounted: function mounted() {
1238
- var _this6 = this;
1239
-
1240
- this.uploadList = this.$refs.upload.uploadFiles;
1241
- this.$watch(function () {
1242
- return _this6.$refs.upload.uploadFiles;
1243
- }, function () {
1244
- _this6.update();
1245
- }, {
1246
- deep: true
1247
- });
1248
1114
  }
1249
1115
  });
1250
1116
 
@@ -1275,9 +1141,9 @@ function _isSlot(s) {
1275
1141
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
1276
1142
  }
1277
1143
 
1278
- var NAME$4 = 'fcGroup';
1144
+ var NAME$3 = 'fcGroup';
1279
1145
  var Group = defineComponent({
1280
- name: NAME$4,
1146
+ name: NAME$3,
1281
1147
  props: {
1282
1148
  field: String,
1283
1149
  rule: Array,
@@ -1320,9 +1186,9 @@ var Group = defineComponent({
1320
1186
  onBeforeAdd: {
1321
1187
  type: Function,
1322
1188
  "default": function _default() {}
1323
- }
1189
+ },
1190
+ formCreateInject: Object
1324
1191
  },
1325
- inject: ['formCreateInject'],
1326
1192
  data: function data() {
1327
1193
  return {
1328
1194
  len: 0,
@@ -1379,7 +1245,8 @@ var Group = defineComponent({
1379
1245
  });
1380
1246
  }
1381
1247
  },
1382
- deep: true
1248
+ deep: true,
1249
+ flush: 'post'
1383
1250
  }
1384
1251
  },
1385
1252
  methods: {
@@ -1499,24 +1366,31 @@ var Group = defineComponent({
1499
1366
  this.input(this.modelValue);
1500
1367
  },
1501
1368
  addIcon: function addIcon(key) {
1502
- return createVNode("i", {
1369
+ return createVNode(resolveComponent("el-icon"), {
1503
1370
  "key": "a".concat(key),
1504
- "class": "el-icon-circle-plus-outline",
1505
1371
  "style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer', ";"),
1506
1372
  "onClick": this.add
1507
- }, null);
1373
+ }, {
1374
+ "default": function _default() {
1375
+ return [createVNode(resolveComponent("circle-plus"), null, null)];
1376
+ }
1377
+ });
1508
1378
  },
1509
1379
  delIcon: function delIcon(index, key) {
1510
1380
  var _this7 = this;
1511
1381
 
1512
- return createVNode("i", {
1382
+ return createVNode(resolveComponent("ElIcon"), {
1513
1383
  "key": "d".concat(key),
1514
1384
  "class": "el-icon-remove-outline",
1515
1385
  "style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer;color:#606266', ";"),
1516
1386
  "onClick": function onClick() {
1517
1387
  return _this7.del(index, key);
1518
1388
  }
1519
- }, null);
1389
+ }, {
1390
+ "default": function _default() {
1391
+ return [createVNode(resolveComponent("remove"), null, null)];
1392
+ }
1393
+ });
1520
1394
  },
1521
1395
  makeIcon: function makeIcon(total, index, key) {
1522
1396
  var _this8 = this;
@@ -1554,13 +1428,13 @@ var Group = defineComponent({
1554
1428
  created: function created() {
1555
1429
  var d = (this.expand || 0) - this.modelValue.length;
1556
1430
 
1557
- if (d > 0) {
1558
- this.expandRule(d);
1559
- }
1560
-
1561
1431
  for (var i = 0; i < this.modelValue.length; i++) {
1562
1432
  this.addRule(i);
1563
1433
  }
1434
+
1435
+ if (d > 0) {
1436
+ this.expandRule(d);
1437
+ }
1564
1438
  },
1565
1439
  render: function render() {
1566
1440
  var _this9 = this;
@@ -1572,12 +1446,12 @@ var Group = defineComponent({
1572
1446
  vm: this,
1573
1447
  add: this.add
1574
1448
  }) : createVNode("i", {
1575
- "key": 'a_def',
1449
+ "key": 1,
1576
1450
  "class": "el-icon-circle-plus-outline",
1577
1451
  "style": "font-size:".concat(this.fontSize, "px;vertical-align:middle;color:").concat(this.disabled ? '#c9cdd4;cursor: not-allowed' : '#606266;cursor:pointer', ";"),
1578
1452
  "onClick": this.add
1579
1453
  }, null) : createVNode("div", {
1580
- "key": 'con'
1454
+ "key": 2
1581
1455
  }, [keys.map(function (key, index) {
1582
1456
  var _slot;
1583
1457
 
@@ -1635,9 +1509,9 @@ var Group = defineComponent({
1635
1509
  }
1636
1510
  });
1637
1511
 
1638
- var NAME$3 = 'fcSubForm';
1512
+ var NAME$2 = 'fcSubForm';
1639
1513
  var Sub = defineComponent({
1640
- name: NAME$3,
1514
+ name: NAME$2,
1641
1515
  props: {
1642
1516
  rule: Array,
1643
1517
  options: {
@@ -1662,9 +1536,9 @@ var Sub = defineComponent({
1662
1536
  syncDisabled: {
1663
1537
  type: Boolean,
1664
1538
  "default": true
1665
- }
1539
+ },
1540
+ formCreateInject: Object
1666
1541
  },
1667
- inject: ['formCreateInject'],
1668
1542
  data: function data() {
1669
1543
  return {
1670
1544
  cacheValue: {},
@@ -1725,10 +1599,10 @@ var Sub = defineComponent({
1725
1599
 
1726
1600
  var components = [Checkbox, Frame, Radio, Select, Tree, Upload, Group, Sub];
1727
1601
 
1728
- var NAME$2 = 'FormCreate';
1602
+ var NAME$1 = 'FormCreate';
1729
1603
  function $FormCreate(FormCreate) {
1730
1604
  return defineComponent({
1731
- name: NAME$2,
1605
+ name: NAME$1,
1732
1606
  props: {
1733
1607
  rule: {
1734
1608
  type: Array,
@@ -1745,22 +1619,24 @@ function $FormCreate(FormCreate) {
1745
1619
  },
1746
1620
  extendOption: Boolean,
1747
1621
  modelValue: Object,
1748
- api: Object
1622
+ api: Object,
1623
+ name: String
1749
1624
  },
1750
- emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync'],
1625
+ emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync', 'reload', 'repeat-field', 'update'],
1751
1626
  render: function render() {
1752
1627
  return this.fc.render();
1753
1628
  },
1754
1629
  setup: function setup(props) {
1755
1630
  var vm = getCurrentInstance();
1756
1631
  provide('parentFC', vm);
1757
- var parent = inject('parentFC');
1632
+ var parent = inject('parentFC', null);
1758
1633
 
1759
1634
  var _toRefs = toRefs(props),
1760
1635
  rule = _toRefs.rule,
1761
1636
  modelValue = _toRefs.modelValue;
1762
1637
 
1763
1638
  var data = reactive({
1639
+ ctxInject: {},
1764
1640
  destroyed: false,
1765
1641
  isShow: true,
1766
1642
  unique: 1,
@@ -1949,14 +1825,18 @@ function deepExtend(origin) {
1949
1825
  }
1950
1826
 
1951
1827
  origin[key] = deepExtend(origin[key], clone, mode);
1952
- } else if (is.Undef(clone)) {
1953
- $set(origin, key, clone);
1954
- } else if (clone.__json !== undefined) {
1955
- $set(origin, key, clone.__json);
1956
- } else if (clone.__origin !== undefined) {
1957
- $set(origin, key, clone.__origin);
1958
1828
  } else {
1959
1829
  $set(origin, key, clone);
1830
+
1831
+ if (!is.Undef(clone)) {
1832
+ if (!is.Undef(clone.__json)) {
1833
+ origin[key].__json = clone.__json;
1834
+ }
1835
+
1836
+ if (!is.Undef(clone.__origin)) {
1837
+ origin[key].__origin = clone.__origin;
1838
+ }
1839
+ }
1960
1840
  }
1961
1841
  }
1962
1842
  }
@@ -2004,7 +1884,7 @@ function toJson(obj, space) {
2004
1884
  return val;
2005
1885
  }
2006
1886
 
2007
- if (hasProperty(val, '__json')) {
1887
+ if (val.__json) {
2008
1888
  return val.__json;
2009
1889
  }
2010
1890
 
@@ -2205,33 +2085,6 @@ function toProps(rule) {
2205
2085
  return prop;
2206
2086
  }
2207
2087
 
2208
- function toString(val) {
2209
- return val == null ? '' : _typeof(val) === 'object' ? JSON.stringify(val, null, 2) : String(val);
2210
- }
2211
-
2212
- var id$1 = 0;
2213
- function uniqueId() {
2214
- return Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now()).concat(++id$1)).toString(36);
2215
- }
2216
-
2217
- function deepSet(data, idx, val) {
2218
- var _data = data,
2219
- to;
2220
- (idx || '').split('.').forEach(function (v) {
2221
- if (to) {
2222
- if (!_data[to] || _typeof(_data[to]) != 'object') {
2223
- _data[to] = {};
2224
- }
2225
-
2226
- _data = _data[to];
2227
- }
2228
-
2229
- to = v;
2230
- });
2231
- _data[to] = val;
2232
- return _data;
2233
- }
2234
-
2235
2088
  function baseRule() {
2236
2089
  return {
2237
2090
  props: {},
@@ -2337,11 +2190,6 @@ function Api(h) {
2337
2190
  }
2338
2191
 
2339
2192
  var api = {
2340
- helper: {
2341
- tidyFields: tidyFields,
2342
- props: props
2343
- },
2344
-
2345
2193
  get config() {
2346
2194
  return h.options;
2347
2195
  },
@@ -2437,7 +2285,8 @@ function Api(h) {
2437
2285
 
2438
2286
  if (ctx) {
2439
2287
  if (child) {
2440
- rules = ctx.rule.children;
2288
+ rules = ctx.getPending('children', ctx.rule.children);
2289
+ if (!Array.isArray(rules)) return;
2441
2290
  index = ctx.rule.children.length - 1;
2442
2291
  } else {
2443
2292
  index = ctx.root.indexOf(ctx.origin);
@@ -2454,7 +2303,8 @@ function Api(h) {
2454
2303
 
2455
2304
  if (ctx) {
2456
2305
  if (child) {
2457
- rules = ctx.rule.children;
2306
+ rules = ctx.getPending('children', ctx.rule.children);
2307
+ if (!Array.isArray(rules)) return;
2458
2308
  } else {
2459
2309
  index = ctx.root.indexOf(ctx.origin);
2460
2310
  rules = ctx.root;
@@ -2489,6 +2339,12 @@ function Api(h) {
2489
2339
  });
2490
2340
  h.refresh();
2491
2341
  },
2342
+ all: function all(origin) {
2343
+ return Object.keys(h.ctxs).map(function (k) {
2344
+ var ctx = h.ctxs[k];
2345
+ return origin ? ctx.origin : ctx.rule;
2346
+ });
2347
+ },
2492
2348
  model: function model(origin) {
2493
2349
  return h.fields().reduce(function (initial, key) {
2494
2350
  var ctx = h.fieldCtx[key][0];
@@ -2674,6 +2530,19 @@ function Api(h) {
2674
2530
  nextRefresh: function nextRefresh(fn) {
2675
2531
  h.nextRefresh();
2676
2532
  fn && invoke(fn);
2533
+ },
2534
+ emit: function emit(name) {
2535
+ var _h$vm;
2536
+
2537
+ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
2538
+ args[_key3 - 1] = arguments[_key3];
2539
+ }
2540
+
2541
+ (_h$vm = h.vm).emit.apply(_h$vm, [name].concat(args));
2542
+ },
2543
+ helper: {
2544
+ tidyFields: tidyFields,
2545
+ props: props
2677
2546
  }
2678
2547
  };
2679
2548
  ['on', 'once', 'off', 'set'].forEach(function (n) {
@@ -2735,11 +2604,55 @@ function lower(str) {
2735
2604
  return str.replace(str[0], str[0].toLowerCase());
2736
2605
  }
2737
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
+
2738
2634
  function useRender$1(Render) {
2739
2635
  extend(Render.prototype, {
2740
2636
  initRender: function initRender() {
2741
2637
  this.cacheConfig = {};
2742
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
+ },
2743
2656
  render: function render() {
2744
2657
  var _this = this;
2745
2658
 
@@ -2760,7 +2673,7 @@ function useRender$1(Render) {
2760
2673
  ctx.initProp();
2761
2674
  this.mergeGlobal(ctx);
2762
2675
  ctx.initNone();
2763
- var slots = this.renderChildren(ctx);
2676
+ var slots = this.renderChildren(ctx.loadChildrenPending(), ctx);
2764
2677
  var def = slots["default"];
2765
2678
  def && slotBag.setSlot(ctx.rule.slot, function () {
2766
2679
  return def();
@@ -2787,8 +2700,15 @@ function useRender$1(Render) {
2787
2700
  ctx.prop = mergeRule({}, [this.cacheConfig[ctx.trueType].value, ctx.prop]);
2788
2701
  },
2789
2702
  setOptions: function setOptions(ctx) {
2790
- if (ctx.prop.optionsTo && ctx.prop.options) {
2791
- 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);
2792
2712
  }
2793
2713
  },
2794
2714
  deepSet: function deepSet$1(ctx) {
@@ -2817,49 +2737,54 @@ function useRender$1(Render) {
2817
2737
  renderCtx: function renderCtx(ctx, parent) {
2818
2738
  var _this4 = this;
2819
2739
 
2820
- if (ctx.type === 'hidden') return;
2821
- var rule = ctx.rule;
2822
-
2823
- if (!this.cache[ctx.id] || this.cache[ctx.id].slot !== rule.slot) {
2824
- var vn;
2825
- ctx.initProp();
2826
- this.mergeGlobal(ctx);
2827
- ctx.initNone();
2828
- this.$manager.tidyRule(ctx);
2829
- this.deepSet(ctx);
2830
- this.setOptions(ctx);
2831
- this.ctxProp(ctx);
2832
- var prop = ctx.prop;
2833
-
2834
- if (prop.hidden) {
2835
- this.setCache(ctx, undefined, parent);
2836
- return;
2837
- }
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
+ }
2838
2761
 
2839
- vn = function vn() {
2840
- return _this4.item(ctx, function () {
2762
+ vn = function vn() {
2841
2763
  var children = {};
2842
2764
 
2765
+ var _load = ctx.loadChildrenPending();
2766
+
2843
2767
  if (ctx.parser.renderChildren) {
2844
- children = ctx.parser.renderChildren(ctx);
2768
+ children = ctx.parser.renderChildren(_load, ctx);
2845
2769
  } else if (ctx.parser.loadChildren !== false) {
2846
- children = _this4.renderChildren(ctx);
2770
+ children = _this4.renderChildren(_load, ctx);
2847
2771
  }
2848
2772
 
2849
- var slot = 'type-' + toLine(ctx.type);
2773
+ var slot = _this4.getTypeSlot(ctx.type);
2850
2774
 
2851
2775
  var _vn;
2852
2776
 
2853
- if (_this4.vm.slots[slot]) {
2854
- _vn = _this4.vm.slots[slot]({
2777
+ if (slot) {
2778
+ _vn = slot({
2855
2779
  rule: rule,
2856
2780
  prop: prop,
2781
+ preview: preview,
2857
2782
  children: children,
2858
2783
  api: _this4.$handle.api,
2859
2784
  model: prop.model || {}
2860
2785
  });
2861
2786
  } else {
2862
- _vn = ctx.parser.render(_this4.renderChildren(ctx), ctx);
2787
+ _vn = preview ? ctx.parser.preview(children, ctx) : ctx.parser.render(children, ctx);
2863
2788
  }
2864
2789
 
2865
2790
  _vn = _this4.renderSides(_vn, ctx);
@@ -2872,16 +2797,22 @@ function useRender$1(Render) {
2872
2797
  _vn = _this4.display(_vn);
2873
2798
  }
2874
2799
 
2800
+ _this4.setCache(ctx, function () {
2801
+ return _vn;
2802
+ }, parent);
2803
+
2875
2804
  return _vn;
2876
- });
2877
- };
2805
+ };
2878
2806
 
2879
- this.setCache(ctx, vn, parent);
2880
- ctx._vnode = vn;
2881
- return vn;
2882
- }
2807
+ this.setCache(ctx, vn, parent);
2808
+ return vn;
2809
+ }
2883
2810
 
2884
- return this.getCache(ctx);
2811
+ return this.getCache(ctx);
2812
+ } catch (e) {
2813
+ console.error(e);
2814
+ return;
2815
+ }
2885
2816
  },
2886
2817
  getModelField: function getModelField(ctx) {
2887
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';
@@ -2915,29 +2846,36 @@ function useRender$1(Render) {
2915
2846
  return vn;
2916
2847
  }
2917
2848
  },
2918
- item: function item(ctx, vn) {
2919
- return this.vNode.h('FcFragment', {
2920
- key: ctx.prop.key,
2921
- formCreateInject: this.injectProp(ctx)
2922
- }, vn);
2923
- },
2924
2849
  isFragment: function isFragment(ctx) {
2925
2850
  return ctx.type === 'fragment' || ctx.type === 'template';
2926
2851
  },
2927
2852
  injectProp: function injectProp(ctx) {
2928
2853
  var _this6 = this;
2929
2854
 
2930
- return {
2931
- api: this.$handle.api,
2932
- form: this.fc.create,
2933
- subForm: function subForm(_subForm) {
2934
- _this6.$handle.addSubForm(ctx, _subForm);
2935
- },
2936
- field: ctx.field,
2937
- options: ctx.prop.options || [],
2938
- children: ctx.rule.children,
2939
- rule: ctx.rule
2940
- };
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, {
2874
+ preview: this.options.preview || false,
2875
+ options: ctx.prop.options,
2876
+ children: ctx.loadChildrenPending()
2877
+ });
2878
+ return inject;
2941
2879
  },
2942
2880
  ctxProp: function ctxProp(ctx, custom) {
2943
2881
  var _this7 = this;
@@ -2981,10 +2919,9 @@ function useRender$1(Render) {
2981
2919
  onInput: function onInput(ctx, value) {
2982
2920
  this.$handle.onInput(ctx, value);
2983
2921
  },
2984
- renderChildren: function renderChildren(ctx) {
2922
+ renderChildren: function renderChildren(children, ctx) {
2985
2923
  var _this8 = this;
2986
2924
 
2987
- var children = ctx.rule.children;
2988
2925
  if (!is.trueArray(children)) return {};
2989
2926
  var slotBag = makeSlotBag();
2990
2927
  children.map(function (child) {
@@ -3041,12 +2978,16 @@ function useRender$1(Render) {
3041
2978
  });
3042
2979
  }
3043
2980
 
3044
- 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());
3045
2986
  }
3046
2987
  });
3047
2988
  }
3048
2989
 
3049
- var id = 1;
2990
+ var id$1 = 1;
3050
2991
  function Render(handle) {
3051
2992
  extend(this, {
3052
2993
  $handle: handle,
@@ -3054,7 +2995,7 @@ function Render(handle) {
3054
2995
  vm: handle.vm,
3055
2996
  $manager: handle.$manager,
3056
2997
  vNode: new handle.fc.CreateNode(handle.vm),
3057
- id: id++
2998
+ id: id$1++
3058
2999
  });
3059
3000
  funcProxy(this, {
3060
3001
  options: function options() {
@@ -3302,6 +3243,7 @@ function RuleContext(handle, rule) {
3302
3243
  rule: rule,
3303
3244
  origin: rule.__origin__ || rule,
3304
3245
  name: rule.name,
3246
+ pending: {},
3305
3247
  none: false,
3306
3248
  watch: [],
3307
3249
  linkOn: [],
@@ -3324,6 +3266,102 @@ function RuleContext(handle, rule) {
3324
3266
  this.update(handle, true);
3325
3267
  }
3326
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
+ },
3327
3365
  effectData: function effectData(name) {
3328
3366
  if (!this.payload[name]) {
3329
3367
  this.payload[name] = {};
@@ -3347,13 +3385,13 @@ extend(RuleContext.prototype, {
3347
3385
  parser.init(this);
3348
3386
  },
3349
3387
  initProp: function initProp() {
3350
- var _this = this;
3388
+ var _this3 = this;
3351
3389
 
3352
3390
  var rule = _objectSpread2({}, this.rule);
3353
3391
 
3354
3392
  delete rule.children;
3355
3393
  this.prop = mergeProps([rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
3356
- return _this.payload[k];
3394
+ return _this3.payload[k];
3357
3395
  })), [this.computed]));
3358
3396
  },
3359
3397
  initNone: function initNone() {
@@ -3380,10 +3418,10 @@ extend(RuleContext.prototype, {
3380
3418
  this.$handle.appendLink(this);
3381
3419
  },
3382
3420
  watchTo: function watchTo() {
3383
- var _this2 = this;
3421
+ var _this4 = this;
3384
3422
 
3385
3423
  nextTick(function () {
3386
- _this2.$handle.watchCtx(_this2);
3424
+ _this4.$handle && _this4.$handle.watchCtx(_this4);
3387
3425
  });
3388
3426
  },
3389
3427
  "delete": function _delete() {
@@ -3413,15 +3451,15 @@ extend(RuleContext.prototype, {
3413
3451
  this.ctrlRule = [];
3414
3452
  },
3415
3453
  rm: function rm() {
3416
- var _this3 = this;
3454
+ var _this5 = this;
3417
3455
 
3418
3456
  var _rm = function _rm() {
3419
- var index = _this3.root.indexOf(_this3.origin);
3457
+ var index = _this5.root.indexOf(_this5.origin);
3420
3458
 
3421
3459
  if (index > -1) {
3422
- _this3.root.splice(index, 1);
3460
+ _this5.root.splice(index, 1);
3423
3461
 
3424
- _this3.$handle && _this3.$handle.refresh();
3462
+ _this5.$handle && _this5.$handle.refresh();
3425
3463
  }
3426
3464
  };
3427
3465
 
@@ -3432,17 +3470,17 @@ extend(RuleContext.prototype, {
3432
3470
  }
3433
3471
 
3434
3472
  this.$handle.noWatch(function () {
3435
- _this3.$handle.deferSyncValue(function () {
3436
- _this3.rmCtrl();
3473
+ _this5.$handle.deferSyncValue(function () {
3474
+ _this5.rmCtrl();
3437
3475
 
3438
3476
  _rm();
3439
3477
 
3440
- _this3.$handle.rmCtx(_this3);
3478
+ _this5.$handle.rmCtx(_this5);
3441
3479
 
3442
- extend(_this3, {
3480
+ extend(_this5, {
3443
3481
  root: []
3444
3482
  });
3445
- }, _this3.input);
3483
+ }, _this5.input);
3446
3484
  });
3447
3485
  },
3448
3486
  update: function update(handle, init) {
@@ -3481,7 +3519,6 @@ function useLoader(Handler) {
3481
3519
  });
3482
3520
  fullRule(rule);
3483
3521
  this.appendValue(rule);
3484
- rule.options = Array.isArray(rule.options) ? rule.options : [];
3485
3522
  [rule, rule['prefix'], rule['suffix']].forEach(function (item) {
3486
3523
  if (!item) {
3487
3524
  return;
@@ -3601,7 +3638,7 @@ function useLoader(Handler) {
3601
3638
  if (!is.Object(_rule) || !getRule(_rule).type) return err('未定义生成规则的 type 字段', _rule);
3602
3639
 
3603
3640
  if (_rule.__fc__ && _rule.__fc__.root === rules && _this6.ctxs[_rule.__fc__.id]) {
3604
- loadChildren(_rule.__fc__.rule.children, _rule.__fc__);
3641
+ loadChildren(_rule.__fc__.loadChildrenPending(), _rule.__fc__);
3605
3642
  return _rule.__fc__;
3606
3643
  }
3607
3644
 
@@ -3672,7 +3709,10 @@ function useLoader(Handler) {
3672
3709
  _this6.setCtx(ctx);
3673
3710
 
3674
3711
  !isCopy && !isInit && _this6.effect(ctx, 'load');
3675
- ctx.parser.loadChildren === false || loadChildren(ctx.rule.children, ctx);
3712
+
3713
+ var _load = ctx.loadChildrenPending();
3714
+
3715
+ ctx.parser.loadChildren === false || loadChildren(_load, ctx);
3676
3716
 
3677
3717
  if (!parent) {
3678
3718
  var _preIndex = preIndex(index);
@@ -3768,7 +3808,7 @@ function useLoader(Handler) {
3768
3808
  if (valid) {
3769
3809
  flag = true;
3770
3810
  var ruleCon = {
3771
- type: 'template',
3811
+ type: 'fragment',
3772
3812
  "native": true,
3773
3813
  __ctrl: true,
3774
3814
  children: rule
@@ -3825,6 +3865,7 @@ function useLoader(Handler) {
3825
3865
  this.refresh();
3826
3866
  this.bus.$off('next-tick', this.nextReload);
3827
3867
  this.bus.$once('next-tick', this.nextReload);
3868
+ this.bus.$emit('update', this.api);
3828
3869
  },
3829
3870
  //todo 组件生成全部通过 alias
3830
3871
  refresh: function refresh() {
@@ -3868,7 +3909,7 @@ function useInput(Handler) {
3868
3909
  this.setFormData(ctx, formValue);
3869
3910
  this.syncValue();
3870
3911
  this.valueChange(ctx, value);
3871
- 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);
3872
3913
  this.effect(ctx, 'value');
3873
3914
  },
3874
3915
  onInput: function onInput(ctx, value) {
@@ -3879,7 +3920,7 @@ function useInput(Handler) {
3879
3920
  }
3880
3921
  },
3881
3922
  setFormData: function setFormData(ctx, value) {
3882
- $set(this.formData, ctx.id, value);
3923
+ $set(this.formData, ctx.id, value === undefined ? null : value);
3883
3924
  },
3884
3925
  getFormData: function getFormData(ctx) {
3885
3926
  return this.formData[ctx.id];
@@ -3948,7 +3989,7 @@ function useInput(Handler) {
3948
3989
  this.vm.setupState.updateValue(_objectSpread2({}, this.form));
3949
3990
  },
3950
3991
  isChange: function isChange(ctx, value) {
3951
- return JSON.stringify(this.getFormData(ctx)) !== JSON.stringify(value);
3992
+ return JSON.stringify(this.getFormData(ctx), strFn) !== JSON.stringify(value, strFn);
3952
3993
  },
3953
3994
  isQuote: function isQuote(ctx, value) {
3954
3995
  return (is.Object(value) || Array.isArray(value)) && value === ctx.rule.value;
@@ -3972,6 +4013,7 @@ function useInput(Handler) {
3972
4013
  if (this.refreshControl(ctx)) {
3973
4014
  this.$render.clearCacheAll();
3974
4015
  this.loadRule();
4016
+ this.bus.$emit('update', this.api);
3975
4017
  this.refresh();
3976
4018
  }
3977
4019
 
@@ -3999,6 +4041,10 @@ function useInput(Handler) {
3999
4041
  });
4000
4042
  }
4001
4043
 
4044
+ function strFn(key, val) {
4045
+ return typeof val === 'function' ? '' + val : val;
4046
+ }
4047
+
4002
4048
  var BaseParser = {
4003
4049
  init: function init(ctx) {},
4004
4050
  toFormValue: function toFormValue(value, ctx) {
@@ -4011,6 +4057,9 @@ var BaseParser = {
4011
4057
  render: function render(children, ctx) {
4012
4058
  return ctx.$render.defaultRender(ctx, children);
4013
4059
  },
4060
+ preview: function preview(children, ctx) {
4061
+ return ctx.$render.defaultRender(ctx, children);
4062
+ },
4014
4063
  mergeProp: function mergeProp(ctx) {}
4015
4064
  };
4016
4065
 
@@ -4093,13 +4142,13 @@ function useContext(Handler) {
4093
4142
  var none = ['field', 'value', 'vm', 'template', 'name', 'config', 'control', 'inject', 'sync', 'payload', 'optionsTo', 'update'];
4094
4143
  var all = attrs();
4095
4144
  all.filter(function (k) {
4096
- return none.indexOf(k) === -1;
4145
+ return k[0] !== '_' && none.indexOf(k) === -1;
4097
4146
  }).forEach(function (key) {
4098
4147
  var ref = toRef(ctx.rule, key);
4099
4148
  var flag = key === 'children';
4100
4149
  ctx.refRule[key] = ref;
4101
4150
  ctx.watch.push(watch(flag ? function () {
4102
- return _toConsumableArray(ref.value || []);
4151
+ return is.Function(ref.value) ? ref.value : _toConsumableArray(ref.value || []);
4103
4152
  } : function () {
4104
4153
  return ref.value;
4105
4154
  }, function (_, o) {
@@ -4129,15 +4178,16 @@ function useContext(Handler) {
4129
4178
  ctx.updateType();
4130
4179
 
4131
4180
  _this.bindParser(ctx);
4132
- } else if (key === 'children') {
4133
- _this.deferSyncValue(function () {
4134
- o && o.forEach(function (child) {
4135
- if ((n || []).indexOf(child) === -1 && child && !is.String(child) && child.__fc__ && !_this.ctxs[child.__fc__.id]) {
4136
- _this.rmCtx(child.__fc__);
4137
- }
4138
- });
4139
- is.trueArray(n) && _this.loadChildren(n, ctx);
4140
- });
4181
+ } else if (flag) {
4182
+ if (is.Function(o)) {
4183
+ o = ctx.getPending('children', []);
4184
+ }
4185
+
4186
+ if (is.Function(n)) {
4187
+ n = ctx.loadChildrenPending();
4188
+ }
4189
+
4190
+ _this.updateChildren(ctx, n, o);
4141
4191
  }
4142
4192
 
4143
4193
  _this.$render.clearCache(ctx);
@@ -4164,15 +4214,32 @@ function useContext(Handler) {
4164
4214
 
4165
4215
  this.watchEffect(ctx);
4166
4216
  },
4167
- rmSub: function rmSub(sub) {
4217
+ updateChildren: function updateChildren(ctx, n, o) {
4168
4218
  var _this2 = this;
4169
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
+
4170
4237
  is.trueArray(sub) && sub.forEach(function (r) {
4171
- r && r.__fc__ && _this2.rmCtx(r.__fc__);
4238
+ r && r.__fc__ && _this3.rmCtx(r.__fc__);
4172
4239
  });
4173
4240
  },
4174
4241
  rmCtx: function rmCtx(ctx) {
4175
- var _this3 = this;
4242
+ var _this4 = this;
4176
4243
 
4177
4244
  if (ctx.deleted) return;
4178
4245
  var id = ctx.id,
@@ -4182,20 +4249,23 @@ function useContext(Handler) {
4182
4249
  $del(this.ctxs, id);
4183
4250
  $del(this.formData, id);
4184
4251
  $del(this.subForm, id);
4252
+ $del(this.vm.setupState.ctxInject, id);
4185
4253
  input && this.rmIdCtx(ctx, field, 'field');
4186
4254
  name && this.rmIdCtx(ctx, name, 'name');
4187
4255
  this.deferSyncValue(function () {
4188
- if (!_this3.reloading) {
4256
+ if (!_this4.reloading) {
4189
4257
  if (ctx.parser.loadChildren !== false) {
4190
- if (is.trueArray(ctx.rule.children)) {
4191
- ctx.rule.children.forEach(function (h) {
4192
- 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__);
4193
4263
  });
4194
4264
  }
4195
4265
  }
4196
4266
 
4197
- if (ctx.root === _this3.rules) {
4198
- _this3.vm.setupState.renderRule();
4267
+ if (ctx.root === _this4.rules) {
4268
+ _this4.vm.setupState.renderRule();
4199
4269
  }
4200
4270
  }
4201
4271
  }, input);
@@ -4208,8 +4278,8 @@ function useContext(Handler) {
4208
4278
  this.$render.clearCache(ctx);
4209
4279
  ctx["delete"]();
4210
4280
  this.effect(ctx, 'deleted');
4211
- input && !this.fieldCtx[field] && this.vm.emit('removeField', field, ctx.rule, this.api);
4212
- ctx.rule.__ctrl || this.vm.emit('removeRule', ctx.rule, this.api);
4281
+ input && !this.fieldCtx[field] && this.vm.emit('remove-field', field, ctx.rule, this.api);
4282
+ ctx.rule.__ctrl || this.vm.emit('remove-rule', ctx.rule, this.api);
4213
4283
  return ctx;
4214
4284
  }
4215
4285
  });
@@ -4277,7 +4347,6 @@ function useEffect(Handler) {
4277
4347
  watchEffect: function watchEffect(ctx) {
4278
4348
  var _this3 = this;
4279
4349
 
4280
- this.vm;
4281
4350
  Object.keys(ctx.rule.effect || {}).forEach(function (k) {
4282
4351
  ctx.watch.push(watch(function () {
4283
4352
  return ctx.rule.effect[k];
@@ -4315,7 +4384,7 @@ function useEffect(Handler) {
4315
4384
  input = _ref.input,
4316
4385
  type = _ref.type,
4317
4386
  custom = _ref.custom;
4318
- if (!type || type === 'fcFragment') return;
4387
+ if (!type || ['fcFragment', 'fragment'].indexOf(type) > -1) return;
4319
4388
  var effect = custom ? custom : rule.effect || {};
4320
4389
  Object.keys(effect).forEach(function (attr) {
4321
4390
  var p = _this4.providers[attr];
@@ -4512,26 +4581,8 @@ function fetch(option) {
4512
4581
  xhr.send(formData);
4513
4582
  }
4514
4583
 
4515
- var NAME$1 = 'FcFragment';
4584
+ var NAME = 'fcFragment';
4516
4585
  var fragment = defineComponent({
4517
- name: NAME$1,
4518
- inheritAttrs: false,
4519
- props: ['formCreateInject'],
4520
- setup: function setup(props) {
4521
- var data = toRef(props, 'formCreateInject');
4522
- var $inject = reactive(_objectSpread2({}, data.value));
4523
- watch(data, function () {
4524
- extend($inject, data.value);
4525
- });
4526
- provide('formCreateInject', $inject);
4527
- },
4528
- render: function render() {
4529
- return this.$slots["default"]();
4530
- }
4531
- });
4532
-
4533
- var NAME = 'FcVnode';
4534
- var vnode = defineComponent({
4535
4586
  name: NAME,
4536
4587
  inheritAttrs: false,
4537
4588
  props: ['vnode'],
@@ -4542,8 +4593,12 @@ var vnode = defineComponent({
4542
4593
 
4543
4594
  function tidyDirectives(directives) {
4544
4595
  return Object.keys(directives).map(function (n) {
4545
- var directive = directives[n];
4546
- 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;
4547
4602
  });
4548
4603
  }
4549
4604
 
@@ -4570,7 +4625,18 @@ function CreateNodeFactory() {
4570
4625
  return makeDirective(data, this.h(tag, toProps(data), children));
4571
4626
  },
4572
4627
  h: function h(tag, data, children) {
4573
- 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
+ }
4574
4640
  },
4575
4641
  aliasMap: aliasMap
4576
4642
  });
@@ -4698,6 +4764,11 @@ function parseOpt(option) {
4698
4764
 
4699
4765
  function run(inject, rule, api) {
4700
4766
  var option = inject.value;
4767
+
4768
+ if (is.Function(option)) {
4769
+ option = option(rule, api);
4770
+ }
4771
+
4701
4772
  option = parseOpt(option);
4702
4773
 
4703
4774
  if (!option || !option.action) {
@@ -4749,6 +4820,25 @@ function run(inject, rule, api) {
4749
4820
  return true;
4750
4821
  }
4751
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
+
4752
4842
  function parseProp(name, id) {
4753
4843
  var prop;
4754
4844
 
@@ -4777,8 +4867,10 @@ function exportAttrs(attrs) {
4777
4867
  arrayAttrs.push.apply(arrayAttrs, _toConsumableArray(array));
4778
4868
  normalAttrs.push.apply(normalAttrs, _toConsumableArray(normal));
4779
4869
  appendProto([].concat(_toConsumableArray(key), _toConsumableArray(array), _toConsumableArray(normal)));
4780
- } //todo 表单嵌套
4870
+ }
4781
4871
 
4872
+ var id = 1;
4873
+ var instance = {}; //todo 表单嵌套
4782
4874
 
4783
4875
  function FormCreateFactory(config) {
4784
4876
  var components = _defineProperty({}, fragment.name, fragment);
@@ -4786,6 +4878,7 @@ function FormCreateFactory(config) {
4786
4878
  var parsers = {};
4787
4879
  var directives = {};
4788
4880
  var modelFields = {};
4881
+ var useApps = [];
4789
4882
  var providers = {
4790
4883
  fetch: $fetch
4791
4884
  };
@@ -4797,6 +4890,14 @@ function FormCreateFactory(config) {
4797
4890
  var CreateNode = CreateNodeFactory();
4798
4891
  exportAttrs(config.attrs || {});
4799
4892
 
4893
+ function getApi(name) {
4894
+ return instance[name];
4895
+ }
4896
+
4897
+ function useApp(fn) {
4898
+ useApps.push(fn);
4899
+ }
4900
+
4800
4901
  function directive() {
4801
4902
  var data = nameProp.apply(void 0, arguments);
4802
4903
  if (data.id && data.prop) directives[data.id] = data.prop;
@@ -4865,7 +4966,7 @@ function FormCreateFactory(config) {
4865
4966
  }
4866
4967
 
4867
4968
  function $vnode() {
4868
- return vnode;
4969
+ return fragment;
4869
4970
  } //todo 检查回调函数作用域
4870
4971
 
4871
4972
 
@@ -4876,7 +4977,11 @@ function FormCreateFactory(config) {
4876
4977
 
4877
4978
  function create(rules, option) {
4878
4979
  var app = createFormApp(rules, option || {});
4879
- config.appUse && config.appUse(app);
4980
+ useApps.forEach(function (v) {
4981
+ invoke(function () {
4982
+ return v(create, app);
4983
+ });
4984
+ });
4880
4985
  var div = document.createElement('div');
4881
4986
  ((option === null || option === void 0 ? void 0 : option.el) || document.body).appendChild(div);
4882
4987
  var vm = app.mount(div);
@@ -4895,6 +5000,7 @@ function FormCreateFactory(config) {
4895
5000
  var _this = this;
4896
5001
 
4897
5002
  extend(this, {
5003
+ id: id++,
4898
5004
  create: create,
4899
5005
  vm: vm,
4900
5006
  manager: createManager(config.manager),
@@ -4902,6 +5008,7 @@ function FormCreateFactory(config) {
4902
5008
  providers: providers,
4903
5009
  modelFields: modelFields,
4904
5010
  rules: vm.props.rule,
5011
+ name: vm.props.name,
4905
5012
  prop: {
4906
5013
  components: components,
4907
5014
  directives: directives
@@ -4926,6 +5033,10 @@ function FormCreateFactory(config) {
4926
5033
  extend(vm.appContext.components, components);
4927
5034
  extend(vm.appContext.directives, directives);
4928
5035
  this.$handle = new Handler(this);
5036
+
5037
+ if (this.name) {
5038
+ instance[this.name] = this.api();
5039
+ }
4929
5040
  }
4930
5041
 
4931
5042
  extend(FormCreate.prototype, {
@@ -4991,6 +5102,10 @@ function FormCreateFactory(config) {
4991
5102
  this.$handle.mounted();
4992
5103
  },
4993
5104
  unmount: function unmount() {
5105
+ if (this.name) {
5106
+ delete instance[this.name];
5107
+ }
5108
+
4994
5109
  this.unwatch && this.unwatch();
4995
5110
  this.$handle.reloadRule([]);
4996
5111
  },
@@ -5022,18 +5137,21 @@ function FormCreateFactory(config) {
5022
5137
  copyRules: copyRules,
5023
5138
  fetch: fetch,
5024
5139
  $form: $form,
5140
+ parseFn: parseFn,
5025
5141
  parseJson: parseJson,
5026
- toJson: toJson
5142
+ toJson: toJson,
5143
+ useApp: useApp,
5144
+ getApi: getApi
5027
5145
  });
5028
5146
  }
5029
5147
 
5030
5148
  function useStatic(formCreate) {
5031
5149
  extend(formCreate, {
5032
5150
  create: create,
5033
- install: function install(Vue, options) {
5151
+ install: function install(app, options) {
5034
5152
  globalConfig = _objectSpread2(_objectSpread2({}, globalConfig), options || {});
5035
- if (Vue._installedFormCreate === true) return;
5036
- Vue._installedFormCreate = true;
5153
+ if (app._installedFormCreate === true) return;
5154
+ app._installedFormCreate = true;
5037
5155
 
5038
5156
  var $formCreate = function $formCreate(rules) {
5039
5157
  var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -5041,9 +5159,13 @@ function FormCreateFactory(config) {
5041
5159
  };
5042
5160
 
5043
5161
  useAttr($formCreate);
5044
- Vue.config.globalProperties.$formCreate = $formCreate;
5045
- Vue.component('FormCreate', $form());
5046
- 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
+ });
5047
5169
  }
5048
5170
  });
5049
5171
  }
@@ -5053,7 +5175,13 @@ function FormCreateFactory(config) {
5053
5175
  CreateNode.use({
5054
5176
  fragment: 'fcFragment'
5055
5177
  });
5056
- 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);
5057
5185
  return create;
5058
5186
  }
5059
5187
 
@@ -5198,7 +5326,7 @@ var parsers = [datePicker, hidden, input, slider, timePicker, row, select];
5198
5326
  var PRE = 'el';
5199
5327
  var alias = {
5200
5328
  button: PRE + '-button',
5201
- icon: 'i',
5329
+ icon: PRE + '-icon',
5202
5330
  slider: PRE + '-slider',
5203
5331
  rate: PRE + '-rate',
5204
5332
  upload: 'fc-upload',
@@ -5255,7 +5383,6 @@ function getConfig() {
5255
5383
  type: 'default',
5256
5384
  loading: false,
5257
5385
  disabled: false,
5258
- icon: 'el-icon-refresh',
5259
5386
  innerText: '重置',
5260
5387
  show: false,
5261
5388
  col: undefined,
@@ -5292,15 +5419,29 @@ function tidyBool(opt, name) {
5292
5419
 
5293
5420
  var manager = {
5294
5421
  validate: function validate() {
5295
- 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
+ }
5296
5431
  },
5297
5432
  validateField: function validateField(field) {
5298
5433
  var _this = this;
5299
5434
 
5300
5435
  return new Promise(function (resolve, reject) {
5301
- _this.form().validateField(field, function (res) {
5302
- res ? reject(res) : resolve(null);
5303
- });
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
+ }
5304
5445
  });
5305
5446
  },
5306
5447
  clearValidateState: function clearValidateState(ctx) {
@@ -5331,7 +5472,7 @@ var manager = {
5331
5472
  info: {
5332
5473
  trigger: 'hover',
5333
5474
  placement: 'top-start',
5334
- icon: 'el-icon-warning'
5475
+ icon: true
5335
5476
  },
5336
5477
  title: {},
5337
5478
  col: {
@@ -5430,40 +5571,41 @@ var manager = {
5430
5571
  var form = this.options.form;
5431
5572
  var children = [(titleProp.title || '') + (form.labelSuffix || form['label-suffix'] || '')];
5432
5573
 
5433
- var titleFn = function titleFn() {
5434
- return _this4.$r(mergeProps([titleProp, {
5435
- props: titleProp,
5436
- key: "".concat(uni, "tit"),
5437
- type: titleProp.type || 'span'
5438
- }]), children);
5439
- };
5440
-
5441
- if (!isFalse(infoProp.show) && (infoProp.info || infoProp["native"])) {
5442
- if (infoProp.icon !== false) {
5443
- children[infoProp.align !== 'left' ? 'unshift' : 'push'](this.$r({
5444
- type: 'i',
5445
- "class": infoProp.icon === true ? 'el-icon-warning' : infoProp.icon,
5446
- key: "".concat(uni, "i")
5447
- }, {}, true));
5448
- }
5449
-
5574
+ if (!isFalse(infoProp.show) && (infoProp.info || infoProp["native"]) && !isFalse(infoProp.icon)) {
5450
5575
  var prop = {
5451
5576
  type: infoProp.type || 'popover',
5452
5577
  props: _objectSpread2({}, infoProp),
5453
5578
  key: "".concat(uni, "pop")
5454
5579
  };
5580
+ delete prop.props.icon;
5581
+ delete prop.props.show;
5582
+ delete prop.props.info;
5455
5583
  var field = 'content';
5456
5584
 
5457
5585
  if (infoProp.info && !hasProperty(prop.props, field)) {
5458
5586
  prop.props[field] = infoProp.info;
5459
5587
  }
5460
5588
 
5461
- return this.$r(mergeProps([infoProp, prop]), _defineProperty({}, titleProp.slot || (isTip ? 'default' : 'reference'), function () {
5462
- return titleFn();
5463
- }));
5589
+ children[infoProp.align !== 'left' ? 'unshift' : 'push'](this.$r(mergeProps([infoProp, prop]), _defineProperty({}, titleProp.slot || (isTip ? 'default' : 'reference'), function () {
5590
+ return _this4.$r({
5591
+ type: 'ElIcon',
5592
+ style: 'top:2px',
5593
+ key: "".concat(uni, "i")
5594
+ }, {
5595
+ "default": function _default() {
5596
+ return _this4.$r({
5597
+ type: infoProp.icon === true ? 'warning' : infoProp.icon
5598
+ });
5599
+ }
5600
+ }, true);
5601
+ })));
5464
5602
  }
5465
5603
 
5466
- return titleFn();
5604
+ return this.$r(mergeProps([titleProp, {
5605
+ props: titleProp,
5606
+ key: "".concat(uni, "tit"),
5607
+ type: titleProp.type || 'span'
5608
+ }]), children);
5467
5609
  },
5468
5610
  makeCol: function makeCol(rule, uni, children) {
5469
5611
  var col = rule.col;
@@ -5517,7 +5659,7 @@ var manager = {
5517
5659
 
5518
5660
  var resetBtn = _objectSpread2({}, this.options.resetBtn);
5519
5661
 
5520
- var text = resetBtn.innerText;
5662
+ var innerText = resetBtn.innerText;
5521
5663
  delete resetBtn.innerText;
5522
5664
  return this.$r({
5523
5665
  type: 'button',
@@ -5532,14 +5674,14 @@ var manager = {
5532
5674
  }
5533
5675
  },
5534
5676
  key: "".concat(this.key, "b2")
5535
- }, [text]);
5677
+ }, [innerText]);
5536
5678
  },
5537
5679
  makeSubmitBtn: function makeSubmitBtn() {
5538
5680
  var _this6 = this;
5539
5681
 
5540
5682
  var submitBtn = _objectSpread2({}, this.options.submitBtn);
5541
5683
 
5542
- var text = submitBtn.innerText;
5684
+ var innerText = submitBtn.innerText;
5543
5685
  delete submitBtn.innerText;
5544
5686
  return this.$r({
5545
5687
  type: 'button',
@@ -5554,7 +5696,7 @@ var manager = {
5554
5696
  }
5555
5697
  },
5556
5698
  key: "".concat(this.key, "b1")
5557
- }, [text]);
5699
+ }, [innerText]);
5558
5700
  }
5559
5701
  };
5560
5702
 
@@ -5640,7 +5782,7 @@ function useFrame(maker) {
5640
5782
  return maker;
5641
5783
  }
5642
5784
 
5643
- 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%}";
5644
5786
  styleInject(css_248z);
5645
5787
 
5646
5788
  function tidyBtnProp(btn, def) {
@@ -5812,18 +5954,19 @@ function install(FormCreate) {
5812
5954
  Object.keys(maker$1).forEach(function (name) {
5813
5955
  FormCreate.maker[name] = maker$1[name];
5814
5956
  });
5815
- }
5816
5957
 
5817
- function appUse(app) {
5818
- app.use(ElementPlus);
5958
+ if (typeof window !== 'undefined' && window.ElementPlus) {
5959
+ FormCreate.useApp(function (_, app) {
5960
+ app.use(window.ElementPlus);
5961
+ });
5962
+ }
5819
5963
  }
5820
5964
 
5821
5965
  function elmFormCreate() {
5822
5966
  return FormCreateFactory({
5823
5967
  ui: 'element-ui',
5824
- version: '3.0.0-alpha.2',
5968
+ version: '3.1.0',
5825
5969
  manager: manager,
5826
- appUse: appUse,
5827
5970
  extendApi: extendApi,
5828
5971
  install: install,
5829
5972
  attrs: {