@form-create/element-ui 3.0.1 → 3.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @form-create/element-ui v3.0.1
2
+ * @form-create/element-ui v3.1.2
3
3
  * (c) 2018-2022 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
@@ -15,9 +15,14 @@
15
15
 
16
16
  if (Object.getOwnPropertySymbols) {
17
17
  var symbols = Object.getOwnPropertySymbols(object);
18
- enumerableOnly && (symbols = symbols.filter(function (sym) {
19
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
20
- })), keys.push.apply(keys, symbols);
18
+
19
+ if (enumerableOnly) {
20
+ symbols = symbols.filter(function (sym) {
21
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
22
+ });
23
+ }
24
+
25
+ keys.push.apply(keys, symbols);
21
26
  }
22
27
 
23
28
  return keys;
@@ -25,12 +30,19 @@
25
30
 
26
31
  function _objectSpread2(target) {
27
32
  for (var i = 1; i < arguments.length; i++) {
28
- var source = null != arguments[i] ? arguments[i] : {};
29
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
30
- _defineProperty(target, key, source[key]);
31
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
32
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
33
- });
33
+ var source = arguments[i] != null ? arguments[i] : {};
34
+
35
+ if (i % 2) {
36
+ ownKeys(Object(source), true).forEach(function (key) {
37
+ _defineProperty(target, key, source[key]);
38
+ });
39
+ } else if (Object.getOwnPropertyDescriptors) {
40
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
41
+ } else {
42
+ ownKeys(Object(source)).forEach(function (key) {
43
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
44
+ });
45
+ }
34
46
  }
35
47
 
36
48
  return target;
@@ -39,11 +51,17 @@
39
51
  function _typeof(obj) {
40
52
  "@babel/helpers - typeof";
41
53
 
42
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
43
- return typeof obj;
44
- } : function (obj) {
45
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
46
- }, _typeof(obj);
54
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
55
+ _typeof = function (obj) {
56
+ return typeof obj;
57
+ };
58
+ } else {
59
+ _typeof = function (obj) {
60
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
61
+ };
62
+ }
63
+
64
+ return _typeof(obj);
47
65
  }
48
66
 
49
67
  function _classCallCheck(instance, Constructor) {
@@ -52,25 +70,6 @@
52
70
  }
53
71
  }
54
72
 
55
- function _defineProperties(target, props) {
56
- for (var i = 0; i < props.length; i++) {
57
- var descriptor = props[i];
58
- descriptor.enumerable = descriptor.enumerable || false;
59
- descriptor.configurable = true;
60
- if ("value" in descriptor) descriptor.writable = true;
61
- Object.defineProperty(target, descriptor.key, descriptor);
62
- }
63
- }
64
-
65
- function _createClass(Constructor, protoProps, staticProps) {
66
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
67
- if (staticProps) _defineProperties(Constructor, staticProps);
68
- Object.defineProperty(Constructor, "prototype", {
69
- writable: false
70
- });
71
- return Constructor;
72
- }
73
-
74
73
  function _defineProperty(obj, key, value) {
75
74
  if (key in obj) {
76
75
  Object.defineProperty(obj, key, {
@@ -98,9 +97,6 @@
98
97
  configurable: true
99
98
  }
100
99
  });
101
- Object.defineProperty(subClass, "prototype", {
102
- writable: false
103
- });
104
100
  if (superClass) _setPrototypeOf(subClass, superClass);
105
101
  }
106
102
 
@@ -213,11 +209,12 @@
213
209
  }, []);
214
210
  }
215
211
 
216
- var NAME$a = 'fcCheckbox';
212
+ var NAME$9 = 'fcCheckbox';
217
213
  var Checkbox = vue.defineComponent({
218
- name: NAME$a,
214
+ name: NAME$9,
219
215
  inheritAttrs: false,
220
216
  props: {
217
+ formCreateInject: Object,
221
218
  modelValue: {
222
219
  type: Array,
223
220
  "default": function _default() {
@@ -228,51 +225,21 @@
228
225
  },
229
226
  emits: ['update:modelValue'],
230
227
  setup: function setup(props, _) {
231
- var _toRefs = vue.toRefs(vue.inject('formCreateInject')),
232
- options = _toRefs.options;
233
-
234
- var trueValue = vue.ref([]);
228
+ var options = vue.toRef(props.formCreateInject, 'options', []);
235
229
  var value = vue.toRef(props, 'modelValue');
236
230
 
237
231
  var _options = function _options() {
238
232
  return Array.isArray(options.value) ? options.value : [];
239
233
  };
240
234
 
241
- var update = function update() {
242
- trueValue.value = value.value ? _options().filter(function (opt) {
243
- return value.value.indexOf(opt.value) !== -1;
244
- }).map(function (option) {
245
- return option.label;
246
- }) : [];
247
- };
248
-
249
- vue.watch(options, function () {
250
- update();
251
- }, {
252
- deep: true,
253
- immediate: true
254
- });
255
235
  return {
256
236
  options: _options,
257
- trueValue: trueValue,
258
237
  value: value,
259
238
  onInput: function onInput(n) {
260
- _.emit('update:modelValue', _options().filter(function (opt) {
261
- return n.indexOf(opt.label) !== -1;
262
- }).map(function (opt) {
263
- return opt.value;
264
- }).filter(function (v) {
265
- return v !== undefined;
266
- }));
267
- },
268
- update: update
239
+ _.emit('update:modelValue', n);
240
+ }
269
241
  };
270
242
  },
271
- watch: {
272
- modelValue: function modelValue() {
273
- this.update();
274
- }
275
- },
276
243
  render: function render() {
277
244
  var _this$$slots$default,
278
245
  _this$$slots,
@@ -281,17 +248,23 @@
281
248
  var name = this.type === 'button' ? 'ElCheckboxButton' : 'ElCheckbox';
282
249
  var Type = vue.resolveComponent(name);
283
250
  return vue.createVNode(vue.resolveComponent("ElCheckboxGroup"), vue.mergeProps(this.$attrs, {
284
- "modelValue": this.trueValue,
251
+ "modelValue": this.value,
285
252
  "onUpdate:modelValue": this.onInput
286
253
  }), _objectSpread2({
287
254
  "default": function _default() {
288
255
  return [_this.options().map(function (opt, index) {
289
256
  var props = _objectSpread2({}, opt);
290
257
 
258
+ var value = props.value;
291
259
  delete props.value;
292
260
  return vue.createVNode(Type, vue.mergeProps(props, {
261
+ "label": value,
293
262
  "key": name + index + opt.value
294
- }), null);
263
+ }), {
264
+ "default": function _default() {
265
+ return [props.label || props.value || ''];
266
+ }
267
+ });
295
268
  }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
296
269
  }
297
270
  }, getSlot(this.$slots, ['default'])));
@@ -373,16 +346,131 @@
373
346
  }
374
347
  }
375
348
 
376
- var css_248z$2 = "._fc-frame .fc-files img{display:inline-block;height:100%;vertical-align:top;width:100%}._fc-frame .fc-upload-btn{border:1px dashed #c0ccda;cursor:pointer}._fc-frame .fc-upload-cover{background:rgba(0,0,0,.6);bottom:0;left:0;opacity:0;position:absolute;right:0;top:0;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}._fc-frame .fc-upload-cover i{color:#fff;cursor:pointer;font-size:20px;margin:0 2px}._fc-frame .fc-files:hover .fc-upload-cover{opacity:1}._fc-frame .el-upload{display:block}._fc-frame .fc-upload-btn,.fc-files{background:#fff;border:1px solid #c0ccda;border-radius:4px;-webkit-box-shadow:2px 2px 5px rgba(0,0,0,.1);box-shadow:2px 2px 5px rgba(0,0,0,.1);-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;height:58px;line-height:58px;margin-right:4px;overflow:hidden;position:relative;text-align:center;width:58px}";
349
+ var css_248z$2 = "._fc-frame ._fc-files img{display:inline-block;height:100%;vertical-align:top;width:100%}._fc-frame ._fc-upload-btn{border:1px dashed #c0ccda;cursor:pointer}._fc-frame ._fc-upload-cover{background:rgba(0,0,0,.6);bottom:0;left:0;opacity:0;position:absolute;right:0;top:0;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}._fc-frame ._fc-upload-cover i{color:#fff;cursor:pointer;font-size:20px;margin:0 2px}._fc-frame ._fc-files:hover ._fc-upload-cover{opacity:1}._fc-frame .el-upload{display:block}._fc-frame ._fc-upload-icon{cursor:pointer}._fc-files,._fc-frame ._fc-upload-btn{background:#fff;border:1px solid #c0ccda;border-radius:4px;-webkit-box-shadow:2px 2px 5px rgba(0,0,0,.1);box-shadow:2px 2px 5px rgba(0,0,0,.1);-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;height:58px;line-height:58px;margin-right:4px;overflow:hidden;position:relative;text-align:center;width:58px}";
377
350
  styleInject(css_248z$2);
378
351
 
352
+ var script$8 = {
353
+ name: 'IconCircleClose'
354
+ };
355
+
356
+ var _hoisted_1$8 = {
357
+ "class": "icon",
358
+ viewBox: "0 0 1024 1024",
359
+ xmlns: "http://www.w3.org/2000/svg"
360
+ };
361
+
362
+ var _hoisted_2$8 = /*#__PURE__*/vue.createElementVNode("path", {
363
+ fill: "currentColor",
364
+ d: "M466.752 512l-90.496-90.496a32 32 0 0145.248-45.248L512 466.752l90.496-90.496a32 32 0 1145.248 45.248L557.248 512l90.496 90.496a32 32 0 11-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 01-45.248-45.248L466.752 512z"
365
+ }, null, -1);
366
+
367
+ var _hoisted_3$8 = /*#__PURE__*/vue.createElementVNode("path", {
368
+ fill: "currentColor",
369
+ d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"
370
+ }, null, -1);
371
+
372
+ var _hoisted_4$2 = [_hoisted_2$8, _hoisted_3$8];
373
+ function render$8(_ctx, _cache, $props, $setup, $data, $options) {
374
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$8, _hoisted_4$2);
375
+ }
376
+
377
+ script$8.render = render$8;
378
+
379
+ var script$7 = {
380
+ name: 'IconDocument'
381
+ };
382
+
383
+ var _hoisted_1$7 = {
384
+ "class": "icon",
385
+ viewBox: "0 0 1024 1024",
386
+ xmlns: "http://www.w3.org/2000/svg"
387
+ };
388
+
389
+ var _hoisted_2$7 = /*#__PURE__*/vue.createElementVNode("path", {
390
+ fill: "currentColor",
391
+ d: "M832 384H576V128H192v768h640V384zm-26.496-64L640 154.496V320h165.504zM160 64h480l256 256v608a32 32 0 01-32 32H160a32 32 0 01-32-32V96a32 32 0 0132-32zm160 448h384v64H320v-64zm0-192h160v64H320v-64zm0 384h384v64H320v-64z"
392
+ }, null, -1);
393
+
394
+ var _hoisted_3$7 = [_hoisted_2$7];
395
+ function render$7(_ctx, _cache, $props, $setup, $data, $options) {
396
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$7, _hoisted_3$7);
397
+ }
398
+
399
+ script$7.render = render$7;
400
+
401
+ var script$6 = {
402
+ name: 'IconDelete'
403
+ };
404
+
405
+ var _hoisted_1$6 = {
406
+ "class": "icon",
407
+ viewBox: "0 0 1024 1024",
408
+ xmlns: "http://www.w3.org/2000/svg"
409
+ };
410
+
411
+ var _hoisted_2$6 = /*#__PURE__*/vue.createElementVNode("path", {
412
+ fill: "currentColor",
413
+ d: "M160 256H96a32 32 0 010-64h256V95.936a32 32 0 0132-32h256a32 32 0 0132 32V192h256a32 32 0 110 64h-64v672a32 32 0 01-32 32H192a32 32 0 01-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 01-32-32V416a32 32 0 0164 0v320a32 32 0 01-32 32zm192 0a32 32 0 01-32-32V416a32 32 0 0164 0v320a32 32 0 01-32 32z"
414
+ }, null, -1);
415
+
416
+ var _hoisted_3$6 = [_hoisted_2$6];
417
+ function render$6(_ctx, _cache, $props, $setup, $data, $options) {
418
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$6, _hoisted_3$6);
419
+ }
420
+
421
+ script$6.render = render$6;
422
+
423
+ var script$5 = {
424
+ name: 'IconView'
425
+ };
426
+
427
+ var _hoisted_1$5 = {
428
+ "class": "icon",
429
+ viewBox: "0 0 1024 1024",
430
+ xmlns: "http://www.w3.org/2000/svg"
431
+ };
432
+
433
+ var _hoisted_2$5 = /*#__PURE__*/vue.createElementVNode("path", {
434
+ fill: "currentColor",
435
+ d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 110 448 224 224 0 010-448zm0 64a160.192 160.192 0 00-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z"
436
+ }, null, -1);
437
+
438
+ var _hoisted_3$5 = [_hoisted_2$5];
439
+ function render$5(_ctx, _cache, $props, $setup, $data, $options) {
440
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$5, _hoisted_3$5);
441
+ }
442
+
443
+ script$5.render = render$5;
444
+
445
+ var script$4 = {
446
+ name: 'IconFolderOpened'
447
+ };
448
+
449
+ var _hoisted_1$4 = {
450
+ "class": "icon",
451
+ viewBox: "0 0 1024 1024",
452
+ xmlns: "http://www.w3.org/2000/svg"
453
+ };
454
+
455
+ var _hoisted_2$4 = /*#__PURE__*/vue.createElementVNode("path", {
456
+ fill: "currentColor",
457
+ d: "M878.08 448H241.92l-96 384h636.16l96-384zM832 384v-64H485.76L357.504 192H128v448l57.92-231.744A32 32 0 01216.96 384H832zm-24.96 512H96a32 32 0 01-32-32V160a32 32 0 0132-32h287.872l128.384 128H864a32 32 0 0132 32v96h23.04a32 32 0 0131.04 39.744l-112 448A32 32 0 01807.04 896z"
458
+ }, null, -1);
459
+
460
+ var _hoisted_3$4 = [_hoisted_2$4];
461
+ function render$4(_ctx, _cache, $props, $setup, $data, $options) {
462
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$4, _hoisted_3$4);
463
+ }
464
+
465
+ script$4.render = render$4;
466
+
379
467
  function _isSlot$1(s) {
380
468
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
381
469
  }
382
470
 
383
- var NAME$9 = 'fcFrame';
471
+ var NAME$8 = 'fcFrame';
384
472
  var Frame = vue.defineComponent({
385
- name: NAME$9,
473
+ name: NAME$8,
386
474
  props: {
387
475
  type: {
388
476
  type: String,
@@ -403,7 +491,7 @@
403
491
  },
404
492
  icon: {
405
493
  type: String,
406
- "default": 'el-icon-upload2'
494
+ "default": 'IconFolderOpened'
407
495
  },
408
496
  width: {
409
497
  type: String,
@@ -426,7 +514,10 @@
426
514
  "default": '关闭'
427
515
  },
428
516
  modalTitle: String,
429
- handleIcon: [String, Boolean],
517
+ handleIcon: {
518
+ type: [String, Boolean],
519
+ "default": undefined
520
+ },
430
521
  title: String,
431
522
  allowRemove: {
432
523
  type: Boolean,
@@ -481,10 +572,14 @@
481
572
  okBtn: {
482
573
  type: Boolean,
483
574
  "default": true
484
- }
575
+ },
576
+ formCreateInject: Object
485
577
  },
486
- inject: ['formCreateInject'],
487
578
  emits: ['update:modelValue', 'change'],
579
+ components: {
580
+ IconFolderOpened: script$4,
581
+ IconView: script$5
582
+ },
488
583
  data: function data() {
489
584
  return {
490
585
  fileList: toArray(this.modelValue),
@@ -500,9 +595,6 @@
500
595
  }
501
596
  },
502
597
  methods: {
503
- key: function key(unique) {
504
- return unique;
505
- },
506
598
  close: function close() {
507
599
  this.closeModel(true);
508
600
  },
@@ -542,25 +634,29 @@
542
634
  }).toString(),
543
635
  readonly: true
544
636
  }, {
545
- "key": this.key('input')
637
+ "key": 1
546
638
  }), {
547
639
  append: function append() {
548
640
  return vue.createVNode(vue.resolveComponent("ElButton"), {
549
- "icon": _this.icon,
641
+ "icon": vue.resolveComponent(_this.icon),
550
642
  "onClick": function onClick() {
551
643
  return _this.showModel();
552
644
  }
553
645
  }, null);
554
646
  },
555
647
  suffix: function suffix() {
556
- return _this.fileList.length ? vue.createVNode("i", {
557
- "class": "el-input__icon el-icon-circle-close",
648
+ return _this.fileList.length ? vue.createVNode(vue.resolveComponent("ElIcon"), {
649
+ "class": "el-input__icon _fc-upload-icon",
558
650
  "onClick": function onClick() {
559
651
  _this.fileList = [];
560
652
 
561
653
  _this.input();
562
654
  }
563
- }, null) : null;
655
+ }, {
656
+ "default": function _default() {
657
+ return [vue.createVNode(script$8, null, null)];
658
+ }
659
+ }) : null;
564
660
  }
565
661
  });
566
662
  },
@@ -570,13 +666,13 @@
570
666
  }
571
667
 
572
668
  return vue.createVNode("div", {
573
- "key": this.key('group')
669
+ "key": 2
574
670
  }, [children]);
575
671
  },
576
672
  makeItem: function makeItem(index, children) {
577
673
  return vue.createVNode("div", {
578
- "class": "fc-files",
579
- "key": this.key('file' + index)
674
+ "class": "_fc-files",
675
+ "key": '3' + index
580
676
  }, [children]);
581
677
  },
582
678
  valid: function valid(f) {
@@ -599,43 +695,53 @@
599
695
  }
600
696
 
601
697
  return vue.createVNode("div", {
602
- "class": "fc-upload-cover",
603
- "key": this.key('uc')
698
+ "class": "_fc-upload-cover",
699
+ "key": 4
604
700
  }, [icons]);
605
701
  }
606
702
  },
607
703
  makeHandleIcon: function makeHandleIcon(val, index) {
608
704
  var _this2 = this;
609
705
 
610
- return vue.createVNode("i", {
611
- "class": this.handleIcon === true || this.handleIcon === undefined ? 'el-icon-view' : this.handleIcon,
706
+ var Type = vue.resolveComponent(this.handleIcon === true || this.handleIcon === undefined ? 'icon-view' : this.handleIcon);
707
+ return vue.createVNode(vue.resolveComponent("ElIcon"), {
612
708
  "onClick": function onClick() {
613
709
  return _this2.handleClick(val);
614
710
  },
615
- "key": this.key('hi' + index)
616
- }, null);
711
+ "key": '5' + index
712
+ }, {
713
+ "default": function _default() {
714
+ return [vue.createVNode(Type, null, null)];
715
+ }
716
+ });
617
717
  },
618
718
  makeRemoveIcon: function makeRemoveIcon(val, index) {
619
719
  var _this3 = this;
620
720
 
621
- return vue.createVNode("i", {
622
- "class": "el-icon-delete",
721
+ return vue.createVNode(vue.resolveComponent("ElIcon"), {
623
722
  "onClick": function onClick() {
624
723
  return _this3.handleRemove(val);
625
724
  },
626
- "key": this.key('ri' + index)
627
- }, null);
725
+ "key": '6' + index
726
+ }, {
727
+ "default": function _default() {
728
+ return [vue.createVNode(script$6, null, null)];
729
+ }
730
+ });
628
731
  },
629
732
  makeFiles: function makeFiles() {
630
733
  var _this4 = this;
631
734
 
632
735
  return this.makeGroup(this.fileList.map(function (src, index) {
633
- return _this4.makeItem(index, [vue.createVNode("i", {
634
- "class": "el-icon-tickets",
736
+ return _this4.makeItem(index, [vue.createVNode(vue.resolveComponent("ElIcon"), {
635
737
  "onClick": function onClick() {
636
738
  return _this4.handleClick(src);
637
739
  }
638
- }, null), _this4.makeIcons(src, index)]);
740
+ }, {
741
+ "default": function _default() {
742
+ return [vue.createVNode(script$7, null, null)];
743
+ }
744
+ }), _this4.makeIcons(src, index)]);
639
745
  }));
640
746
  },
641
747
  makeImages: function makeImages() {
@@ -650,15 +756,18 @@
650
756
  makeBtn: function makeBtn() {
651
757
  var _this6 = this;
652
758
 
759
+ var Type = vue.resolveComponent(this.icon);
653
760
  return vue.createVNode("div", {
654
- "class": "fc-upload-btn",
761
+ "class": "_fc-upload-btn",
655
762
  "onClick": function onClick() {
656
763
  return _this6.showModel();
657
764
  },
658
- "key": this.key('btn')
659
- }, [vue.createVNode("i", {
660
- "class": this.icon
661
- }, null)]);
765
+ "key": 7
766
+ }, [vue.createVNode(vue.resolveComponent("ElIcon"), null, {
767
+ "default": function _default() {
768
+ return [vue.createVNode(Type, null, null)];
769
+ }
770
+ })]);
662
771
  },
663
772
  handleClick: function handleClick(src) {
664
773
  if (this.onHandle) {
@@ -809,7 +918,7 @@
809
918
  "src": src,
810
919
  "frameBorder": "0",
811
920
  "style": {
812
- 'height': height,
921
+ height: height,
813
922
  'border': '0 none',
814
923
  'width': '100%'
815
924
  }
@@ -838,11 +947,12 @@
838
947
  }
839
948
  });
840
949
 
841
- var NAME$8 = 'fcRadio';
950
+ var NAME$7 = 'fcRadio';
842
951
  var Radio = vue.defineComponent({
843
- name: NAME$8,
952
+ name: NAME$7,
844
953
  inheritAttrs: false,
845
954
  props: {
955
+ formCreateInject: Object,
846
956
  modelValue: {
847
957
  type: [String, Number, Boolean],
848
958
  "default": ''
@@ -851,49 +961,21 @@
851
961
  },
852
962
  emits: ['update:modelValue'],
853
963
  setup: function setup(props, _) {
854
- var _toRefs = vue.toRefs(vue.inject('formCreateInject')),
855
- options = _toRefs.options;
856
-
857
- var trueValue = vue.ref([]);
964
+ var options = vue.toRef(props.formCreateInject, 'options', []);
858
965
  var value = vue.toRef(props, 'modelValue');
859
966
 
860
967
  var _options = function _options() {
861
968
  return Array.isArray(options.value) ? options.value : [];
862
969
  };
863
970
 
864
- var update = function update() {
865
- trueValue.value = _options().filter(function (opt) {
866
- return opt.value === value.value;
867
- }).reduce(function (initial, opt) {
868
- return opt.label;
869
- }, '');
870
- };
871
-
872
- vue.watch(options, function () {
873
- update();
874
- }, {
875
- deep: true,
876
- immediate: true
877
- });
878
971
  return {
879
972
  options: _options,
880
- trueValue: trueValue,
881
973
  value: value,
882
974
  onInput: function onInput(n) {
883
- _.emit('update:modelValue', _options().filter(function (opt) {
884
- return opt.label === n;
885
- }).reduce(function (initial, opt) {
886
- return opt.value;
887
- }, ''));
888
- },
889
- update: update
975
+ _.emit('update:modelValue', n);
976
+ }
890
977
  };
891
978
  },
892
- watch: {
893
- modelValue: function modelValue() {
894
- this.update();
895
- }
896
- },
897
979
  render: function render() {
898
980
  var _this$$slots$default,
899
981
  _this$$slots,
@@ -902,28 +984,35 @@
902
984
  var name = this.type === 'button' ? 'ElRadioButton' : 'ElRadio';
903
985
  var Type = vue.resolveComponent(name);
904
986
  return vue.createVNode(vue.resolveComponent("ElRadioGroup"), vue.mergeProps(this.$attrs, {
905
- "modelValue": this.trueValue,
987
+ "modelValue": this.value,
906
988
  "onUpdate:modelValue": this.onInput
907
989
  }), _objectSpread2({
908
990
  "default": function _default() {
909
991
  return [_this.options().map(function (opt, index) {
910
992
  var props = _objectSpread2({}, opt);
911
993
 
994
+ var value = props.value;
912
995
  delete props.value;
913
996
  return vue.createVNode(Type, vue.mergeProps(props, {
997
+ "label": value,
914
998
  "key": name + index + opt.value
915
- }), null);
999
+ }), {
1000
+ "default": function _default() {
1001
+ return [props.label || props.value || ''];
1002
+ }
1003
+ });
916
1004
  }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
917
1005
  }
918
1006
  }, getSlot(this.$slots, ['default'])));
919
1007
  }
920
1008
  });
921
1009
 
922
- var NAME$7 = 'fcSelect';
1010
+ var NAME$6 = 'fcSelect';
923
1011
  var Select = vue.defineComponent({
924
- name: NAME$7,
1012
+ name: NAME$6,
925
1013
  inheritAttrs: false,
926
1014
  props: {
1015
+ formCreateInject: Object,
927
1016
  modelValue: {
928
1017
  type: [Array, String, Number, Boolean, Object],
929
1018
  "default": undefined
@@ -932,9 +1021,7 @@
932
1021
  },
933
1022
  emits: ['update:modelValue'],
934
1023
  setup: function setup(props) {
935
- var _toRefs = vue.toRefs(vue.inject('formCreateInject')),
936
- options = _toRefs.options;
937
-
1024
+ var options = vue.toRef(props.formCreateInject, 'options', []);
938
1025
  var value = vue.toRef(props, 'modelValue');
939
1026
 
940
1027
  var _options = function _options() {
@@ -968,9 +1055,9 @@
968
1055
  }
969
1056
  });
970
1057
 
971
- var NAME$6 = 'fcTree';
1058
+ var NAME$5 = 'fcTree';
972
1059
  var Tree = vue.defineComponent({
973
- name: NAME$6,
1060
+ name: NAME$5,
974
1061
  inheritAttrs: false,
975
1062
  formCreateParser: {
976
1063
  mergeProp: function mergeProp(ctx) {
@@ -1032,9 +1119,31 @@
1032
1119
  }
1033
1120
  });
1034
1121
 
1035
- 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}";
1122
+ var css_248z$1 = "._fc-exceed .el-upload{display:none}";
1036
1123
  styleInject(css_248z$1);
1037
1124
 
1125
+ var script$3 = {
1126
+ name: 'IconUpload'
1127
+ };
1128
+
1129
+ var _hoisted_1$3 = {
1130
+ "class": "icon",
1131
+ viewBox: "0 0 1024 1024",
1132
+ xmlns: "http://www.w3.org/2000/svg"
1133
+ };
1134
+
1135
+ var _hoisted_2$3 = /*#__PURE__*/vue.createElementVNode("path", {
1136
+ fill: "currentColor",
1137
+ d: "M160 832h704a32 32 0 110 64H160a32 32 0 110-64zm384-578.304V704h-64V247.296L237.248 490.048 192 444.8 508.8 128l316.8 316.8-45.312 45.248L544 253.696z"
1138
+ }, null, -1);
1139
+
1140
+ var _hoisted_3$3 = [_hoisted_2$3];
1141
+ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
1142
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$3, _hoisted_3$3);
1143
+ }
1144
+
1145
+ script$3.render = render$3;
1146
+
1038
1147
  function parseFile(file, i) {
1039
1148
  return {
1040
1149
  url: file,
@@ -1047,37 +1156,21 @@
1047
1156
  return ('' + file).split('/').pop();
1048
1157
  }
1049
1158
 
1050
- var NAME$5 = 'fcUpload';
1159
+ var NAME$4 = 'fcUpload';
1051
1160
  var Upload = vue.defineComponent({
1052
- name: NAME$5,
1161
+ name: NAME$4,
1053
1162
  inheritAttrs: false,
1054
1163
  props: {
1055
- onHandle: Function,
1056
- uploadType: {
1057
- type: String,
1058
- "default": 'file'
1059
- },
1060
- limit: {
1061
- type: Number,
1062
- "default": 0
1063
- },
1064
- allowRemove: {
1065
- type: Boolean,
1066
- "default": true
1067
- },
1068
1164
  previewMask: undefined,
1069
1165
  modalTitle: String,
1070
- handleIcon: [String, Boolean],
1071
1166
  modelValue: [Array, String]
1072
1167
  },
1073
- emits: ['update:modelValue'],
1168
+ emits: ['update:modelValue', 'change', 'remove'],
1074
1169
  data: function data() {
1075
1170
  return {
1076
- uploadList: [],
1077
1171
  previewVisible: false,
1078
1172
  previewImage: '',
1079
- fileList: [],
1080
- cacheFiles: []
1173
+ fileList: []
1081
1174
  };
1082
1175
  },
1083
1176
  created: function created() {
@@ -1085,13 +1178,6 @@
1085
1178
  },
1086
1179
  watch: {
1087
1180
  modelValue: function modelValue(n) {
1088
- if (this.$refs.upload.uploadFiles.every(function (file) {
1089
- return !file.status || file.status === 'success';
1090
- })) {
1091
- this.$refs.upload.uploadFiles = toArray(n).map(parseFile);
1092
- this.uploadList = this.$refs.upload.uploadFiles;
1093
- }
1094
-
1095
1181
  this.fileList = toArray(n).map(parseFile);
1096
1182
  },
1097
1183
  limit: function limit(n, o) {
@@ -1101,141 +1187,62 @@
1101
1187
  }
1102
1188
  },
1103
1189
  methods: {
1104
- key: function key(unique) {
1105
- return unique;
1106
- },
1107
- isDisabled: function isDisabled() {
1108
- return this.$attrs.disabled === true;
1109
- },
1110
- onRemove: function onRemove(file) {
1111
- if (this.isDisabled()) {
1112
- return;
1113
- }
1114
-
1115
- this.$refs.upload.handleRemove(file);
1116
- },
1117
- handleClick: function handleClick(file) {
1118
- if (this.onHandle) {
1119
- return this.onHandle(file);
1190
+ handlePreview: function handlePreview(file) {
1191
+ if (this.onPreview) {
1192
+ this.onPreview.apply(this, arguments);
1120
1193
  } else {
1121
1194
  this.previewImage = file.url;
1122
1195
  this.previewVisible = true;
1123
1196
  }
1124
1197
  },
1125
- makeItem: function makeItem(file, index) {
1126
- return this.uploadType === 'image' ? vue.createVNode("img", {
1127
- "src": file.url,
1128
- "key": this.key('img' + index)
1129
- }, null) : vue.createVNode("i", {
1130
- "class": "el-icon-document",
1131
- "key": this.key('i' + index)
1132
- }, null);
1133
- },
1134
- makeRemoveIcon: function makeRemoveIcon(file, index) {
1135
- var _this = this;
1136
-
1137
- return vue.createVNode("i", {
1138
- "class": "el-icon-delete",
1139
- "onClick": function onClick() {
1140
- return _this.onRemove(file);
1141
- },
1142
- "key": this.key('ri' + index)
1143
- }, null);
1144
- },
1145
- makeHandleIcon: function makeHandleIcon(file, index) {
1146
- var _this2 = this;
1147
-
1148
- return vue.createVNode("i", {
1149
- "class": this.handleIcon === true || this.handleIcon === undefined ? 'el-icon-view' : this.handleIcon,
1150
- "onClick": function onClick() {
1151
- return _this2.handleClick(file);
1152
- },
1153
- "key": this.key('hi' + index)
1154
- }, null);
1155
- },
1156
- makeProgress: function makeProgress(file, index) {
1157
- return vue.createVNode(vue.resolveComponent("ElProgress"), vue.mergeProps({
1158
- percentage: file.percentage,
1159
- type: 'circle',
1160
- width: 52
1161
- }, {
1162
- "style": "margin-top:2px;",
1163
- "key": this.key('pg' + index)
1164
- }), null);
1165
- },
1166
- makeIcons: function makeIcons(file, index) {
1167
- var icons = [];
1168
-
1169
- if (this.allowRemove || this.handleIcon !== false) {
1170
- if (this.uploadType !== 'file' && this.handleIcon !== false || this.uploadType === 'file' && this.handleIcon) {
1171
- icons.push(this.makeHandleIcon(file, index));
1172
- }
1173
-
1174
- if (this.allowRemove) {
1175
- icons.push(this.makeRemoveIcon(file, index));
1176
- }
1177
-
1178
- return vue.createVNode("div", {
1179
- "class": "fc-upload-cover"
1180
- }, [icons]);
1181
- }
1182
- },
1183
- makeFiles: function makeFiles() {
1184
- var _this3 = this;
1185
-
1186
- return this.uploadList.map(function (file, index) {
1187
- return vue.createVNode("div", {
1188
- "key": _this3.key(index),
1189
- "class": "fc-files"
1190
- }, [file.percentage !== undefined && file.status !== 'success' ? _this3.makeProgress(file, index) : [_this3.makeItem(file, index), _this3.makeIcons(file, index)]]);
1191
- });
1192
- },
1193
- makeUpload: function makeUpload() {
1194
- var _this$$slots$default,
1195
- _this$$slots,
1196
- _this4 = this;
1197
-
1198
- var isShow = !this.limit || this.limit > this.uploadList.length;
1199
- return vue.createVNode(vue.resolveComponent("ElUpload"), vue.mergeProps(this.$attrs, {
1200
- "showFileList": false,
1201
- "fileList": this.fileList,
1202
- "ref": "upload",
1203
- "style": {
1204
- display: 'inline-block'
1205
- },
1206
- "key": this.key('upload')
1207
- }), _objectSpread2({
1208
- "default": function _default() {
1209
- return [isShow ? ((_this$$slots$default = (_this$$slots = _this4.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)) || vue.createVNode("div", {
1210
- "class": "fc-upload-btn"
1211
- }, [vue.createVNode("i", {
1212
- "class": "el-icon-upload2"
1213
- }, null)]) : undefined];
1214
- }
1215
- }, getSlot(this.$slots, ['default'])));
1216
- },
1217
- update: function update() {
1218
- var files = this.$refs.upload.uploadFiles.map(function (file) {
1198
+ update: function update(fileList) {
1199
+ var files = fileList.map(function (file) {
1219
1200
  return file.url;
1220
1201
  }).filter(function (url) {
1221
1202
  return url !== undefined;
1222
1203
  });
1223
-
1224
- if (this.cacheFiles.length !== files.length) {
1225
- this.cacheFiles = _toConsumableArray(files);
1226
- this.$emit('update:modelValue', this.limit === 1 ? files[0] || '' : files);
1227
- }
1204
+ this.$emit('update:modelValue', this.limit === 1 ? files[0] || '' : files);
1228
1205
  },
1229
1206
  handleCancel: function handleCancel() {
1230
1207
  this.previewVisible = false;
1208
+ },
1209
+ handleChange: function handleChange(file, fileList) {
1210
+ this.$emit.apply(this, ['change'].concat(Array.prototype.slice.call(arguments)));
1211
+
1212
+ if (file.status === 'success') {
1213
+ this.update(fileList);
1214
+ }
1215
+ },
1216
+ handleRemove: function handleRemove(file, fileList) {
1217
+ this.$emit.apply(this, ['remove'].concat(Array.prototype.slice.call(arguments)));
1218
+ this.update(fileList);
1231
1219
  }
1232
1220
  },
1233
1221
  render: function render() {
1234
- var _this5 = this;
1222
+ var _this$$slots$default,
1223
+ _this$$slots,
1224
+ _this = this;
1235
1225
 
1236
- return vue.createVNode("div", {
1237
- "class": "_fc-upload"
1238
- }, [[this.$attrs.showFileList ? [] : this.makeFiles(), this.makeUpload()], vue.createVNode(vue.resolveComponent("ElDialog"), {
1226
+ return vue.createVNode(vue.Fragment, null, [vue.createVNode(vue.resolveComponent("ElUpload"), vue.mergeProps({
1227
+ "key": this.modelValue.length,
1228
+ "list-type": "picture-card"
1229
+ }, this.$attrs, {
1230
+ "class": {
1231
+ '_fc-exceed': this.$attrs.limit ? this.$attrs.limit <= this.modelValue.length : false
1232
+ },
1233
+ "onPreview": this.handlePreview,
1234
+ "onChange": this.handleChange,
1235
+ "onRemove": this.handleRemove,
1236
+ "fileList": this.fileList
1237
+ }), _objectSpread2({
1238
+ "default": function _default() {
1239
+ return [((_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)) || vue.createVNode(vue.resolveComponent("ElIcon"), null, {
1240
+ "default": function _default() {
1241
+ return [vue.createVNode(script$3, null, null)];
1242
+ }
1243
+ })];
1244
+ }
1245
+ }, getSlot(this.$slots, ['default']))), vue.createVNode(vue.resolveComponent("ElDialog"), {
1239
1246
  "appendToBody": true,
1240
1247
  "modal": this.previewMask,
1241
1248
  "title": this.modalTitle,
@@ -1244,24 +1251,11 @@
1244
1251
  }, {
1245
1252
  "default": function _default() {
1246
1253
  return [vue.createVNode("img", {
1247
- "alt": "example",
1248
1254
  "style": "width: 100%",
1249
- "src": _this5.previewImage
1255
+ "src": _this.previewImage
1250
1256
  }, null)];
1251
1257
  }
1252
1258
  })]);
1253
- },
1254
- mounted: function mounted() {
1255
- var _this6 = this;
1256
-
1257
- this.uploadList = this.$refs.upload.uploadFiles;
1258
- this.$watch(function () {
1259
- return _this6.$refs.upload.uploadFiles;
1260
- }, function () {
1261
- _this6.update();
1262
- }, {
1263
- deep: true
1264
- });
1265
1259
  }
1266
1260
  });
1267
1261
 
@@ -1288,13 +1282,72 @@
1288
1282
  return {}.hasOwnProperty.call(rule, k);
1289
1283
  }
1290
1284
 
1285
+ var script$2 = {
1286
+ name: 'IconCirclePlus'
1287
+ };
1288
+
1289
+ var _hoisted_1$2 = {
1290
+ "class": "icon",
1291
+ viewBox: "0 0 1024 1024",
1292
+ xmlns: "http://www.w3.org/2000/svg"
1293
+ };
1294
+
1295
+ var _hoisted_2$2 = /*#__PURE__*/vue.createElementVNode("path", {
1296
+ fill: "currentColor",
1297
+ d: "M352 480h320a32 32 0 110 64H352a32 32 0 010-64z"
1298
+ }, null, -1);
1299
+
1300
+ var _hoisted_3$2 = /*#__PURE__*/vue.createElementVNode("path", {
1301
+ fill: "currentColor",
1302
+ d: "M480 672V352a32 32 0 1164 0v320a32 32 0 01-64 0z"
1303
+ }, null, -1);
1304
+
1305
+ var _hoisted_4$1 = /*#__PURE__*/vue.createElementVNode("path", {
1306
+ fill: "currentColor",
1307
+ d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"
1308
+ }, null, -1);
1309
+
1310
+ var _hoisted_5 = [_hoisted_2$2, _hoisted_3$2, _hoisted_4$1];
1311
+ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
1312
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$2, _hoisted_5);
1313
+ }
1314
+
1315
+ script$2.render = render$2;
1316
+
1317
+ var script$1 = {
1318
+ name: 'IconRemove'
1319
+ };
1320
+
1321
+ var _hoisted_1$1 = {
1322
+ "class": "icon",
1323
+ viewBox: "0 0 1024 1024",
1324
+ xmlns: "http://www.w3.org/2000/svg"
1325
+ };
1326
+
1327
+ var _hoisted_2$1 = /*#__PURE__*/vue.createElementVNode("path", {
1328
+ fill: "currentColor",
1329
+ d: "M352 480h320a32 32 0 110 64H352a32 32 0 010-64z"
1330
+ }, null, -1);
1331
+
1332
+ var _hoisted_3$1 = /*#__PURE__*/vue.createElementVNode("path", {
1333
+ fill: "currentColor",
1334
+ d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"
1335
+ }, null, -1);
1336
+
1337
+ var _hoisted_4 = [_hoisted_2$1, _hoisted_3$1];
1338
+ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
1339
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$1, _hoisted_4);
1340
+ }
1341
+
1342
+ script$1.render = render$1;
1343
+
1291
1344
  function _isSlot(s) {
1292
1345
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
1293
1346
  }
1294
1347
 
1295
- var NAME$4 = 'fcGroup';
1348
+ var NAME$3 = 'fcGroup';
1296
1349
  var Group = vue.defineComponent({
1297
- name: NAME$4,
1350
+ name: NAME$3,
1298
1351
  props: {
1299
1352
  field: String,
1300
1353
  rule: Array,
@@ -1337,9 +1390,9 @@
1337
1390
  onBeforeAdd: {
1338
1391
  type: Function,
1339
1392
  "default": function _default() {}
1340
- }
1393
+ },
1394
+ formCreateInject: Object
1341
1395
  },
1342
- inject: ['formCreateInject'],
1343
1396
  data: function data() {
1344
1397
  return {
1345
1398
  len: 0,
@@ -1517,24 +1570,31 @@
1517
1570
  this.input(this.modelValue);
1518
1571
  },
1519
1572
  addIcon: function addIcon(key) {
1520
- return vue.createVNode("i", {
1573
+ return vue.createVNode(vue.resolveComponent("ElIcon"), {
1521
1574
  "key": "a".concat(key),
1522
- "class": "el-icon-circle-plus-outline",
1523
1575
  "style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer', ";"),
1524
1576
  "onClick": this.add
1525
- }, null);
1577
+ }, {
1578
+ "default": function _default() {
1579
+ return [vue.createVNode(script$2, null, null)];
1580
+ }
1581
+ });
1526
1582
  },
1527
1583
  delIcon: function delIcon(index, key) {
1528
1584
  var _this7 = this;
1529
1585
 
1530
- return vue.createVNode("i", {
1586
+ return vue.createVNode(vue.resolveComponent("ElIcon"), {
1531
1587
  "key": "d".concat(key),
1532
1588
  "class": "el-icon-remove-outline",
1533
1589
  "style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer;color:#606266', ";"),
1534
1590
  "onClick": function onClick() {
1535
1591
  return _this7.del(index, key);
1536
1592
  }
1537
- }, null);
1593
+ }, {
1594
+ "default": function _default() {
1595
+ return [vue.createVNode(script$1, null, null)];
1596
+ }
1597
+ });
1538
1598
  },
1539
1599
  makeIcon: function makeIcon(total, index, key) {
1540
1600
  var _this8 = this;
@@ -1589,13 +1649,16 @@
1589
1649
  return keys.length === 0 ? this.$slots["default"] ? this.$slots["default"]({
1590
1650
  vm: this,
1591
1651
  add: this.add
1592
- }) : vue.createVNode("i", {
1593
- "key": 'a_def',
1594
- "class": "el-icon-circle-plus-outline",
1652
+ }) : vue.createVNode(vue.resolveComponent("ElIcon"), {
1653
+ "key": 1,
1595
1654
  "style": "font-size:".concat(this.fontSize, "px;vertical-align:middle;color:").concat(this.disabled ? '#c9cdd4;cursor: not-allowed' : '#606266;cursor:pointer', ";"),
1596
1655
  "onClick": this.add
1597
- }, null) : vue.createVNode("div", {
1598
- "key": 'con'
1656
+ }, {
1657
+ "default": function _default() {
1658
+ return [vue.createVNode(script$2, null, null)];
1659
+ }
1660
+ }) : vue.createVNode("div", {
1661
+ "key": 2
1599
1662
  }, [keys.map(function (key, index) {
1600
1663
  var _slot;
1601
1664
 
@@ -1653,9 +1716,9 @@
1653
1716
  }
1654
1717
  });
1655
1718
 
1656
- var NAME$3 = 'fcSubForm';
1719
+ var NAME$2 = 'fcSubForm';
1657
1720
  var Sub = vue.defineComponent({
1658
- name: NAME$3,
1721
+ name: NAME$2,
1659
1722
  props: {
1660
1723
  rule: Array,
1661
1724
  options: {
@@ -1680,9 +1743,9 @@
1680
1743
  syncDisabled: {
1681
1744
  type: Boolean,
1682
1745
  "default": true
1683
- }
1746
+ },
1747
+ formCreateInject: Object
1684
1748
  },
1685
- inject: ['formCreateInject'],
1686
1749
  data: function data() {
1687
1750
  return {
1688
1751
  cacheValue: {},
@@ -1741,12 +1804,34 @@
1741
1804
  }
1742
1805
  });
1743
1806
 
1744
- var components = [Checkbox, Frame, Radio, Select, Tree, Upload, Group, Sub];
1807
+ var script = {
1808
+ name: 'IconWarning'
1809
+ };
1810
+
1811
+ var _hoisted_1 = {
1812
+ "class": "icon",
1813
+ viewBox: "0 0 1024 1024",
1814
+ xmlns: "http://www.w3.org/2000/svg"
1815
+ };
1816
+
1817
+ var _hoisted_2 = /*#__PURE__*/vue.createElementVNode("path", {
1818
+ fill: "currentColor",
1819
+ d: "M512 64a448 448 0 110 896 448 448 0 010-896zm0 832a384 384 0 000-768 384 384 0 000 768zm48-176a48 48 0 11-96 0 48 48 0 0196 0zm-48-464a32 32 0 0132 32v288a32 32 0 01-64 0V288a32 32 0 0132-32z"
1820
+ }, null, -1);
1821
+
1822
+ var _hoisted_3 = [_hoisted_2];
1823
+ function render(_ctx, _cache, $props, $setup, $data, $options) {
1824
+ return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1, _hoisted_3);
1825
+ }
1826
+
1827
+ script.render = render;
1828
+
1829
+ var components = [Checkbox, Frame, Radio, Select, Tree, Upload, Group, Sub, script];
1745
1830
 
1746
- var NAME$2 = 'FormCreate';
1831
+ var NAME$1 = 'FormCreate';
1747
1832
  function $FormCreate(FormCreate) {
1748
1833
  return vue.defineComponent({
1749
- name: NAME$2,
1834
+ name: NAME$1,
1750
1835
  props: {
1751
1836
  rule: {
1752
1837
  type: Array,
@@ -1763,7 +1848,8 @@
1763
1848
  },
1764
1849
  extendOption: Boolean,
1765
1850
  modelValue: Object,
1766
- api: Object
1851
+ api: Object,
1852
+ name: String
1767
1853
  },
1768
1854
  emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync', 'reload', 'repeat-field', 'update'],
1769
1855
  render: function render() {
@@ -1779,6 +1865,7 @@
1779
1865
  modelValue = _toRefs.modelValue;
1780
1866
 
1781
1867
  var data = vue.reactive({
1868
+ ctxInject: {},
1782
1869
  destroyed: false,
1783
1870
  isShow: true,
1784
1871
  unique: 1,
@@ -2427,7 +2514,8 @@
2427
2514
 
2428
2515
  if (ctx) {
2429
2516
  if (child) {
2430
- rules = ctx.rule.children;
2517
+ rules = ctx.getPending('children', ctx.rule.children);
2518
+ if (!Array.isArray(rules)) return;
2431
2519
  index = ctx.rule.children.length - 1;
2432
2520
  } else {
2433
2521
  index = ctx.root.indexOf(ctx.origin);
@@ -2444,7 +2532,8 @@
2444
2532
 
2445
2533
  if (ctx) {
2446
2534
  if (child) {
2447
- rules = ctx.rule.children;
2535
+ rules = ctx.getPending('children', ctx.rule.children);
2536
+ if (!Array.isArray(rules)) return;
2448
2537
  } else {
2449
2538
  index = ctx.root.indexOf(ctx.origin);
2450
2539
  rules = ctx.root;
@@ -2748,9 +2837,9 @@
2748
2837
  return val == null ? '' : _typeof(val) === 'object' ? JSON.stringify(val, null, 2) : String(val);
2749
2838
  }
2750
2839
 
2751
- var id$1 = 0;
2840
+ var id$2 = 0;
2752
2841
  function uniqueId() {
2753
- return Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now()).concat(++id$1)).toString(36);
2842
+ return Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now()).concat(++id$2)).toString(36);
2754
2843
  }
2755
2844
 
2756
2845
  function deepSet(data, idx, val) {
@@ -2813,7 +2902,7 @@
2813
2902
  ctx.initProp();
2814
2903
  this.mergeGlobal(ctx);
2815
2904
  ctx.initNone();
2816
- var slots = this.renderChildren(ctx);
2905
+ var slots = this.renderChildren(ctx.loadChildrenPending(), ctx);
2817
2906
  var def = slots["default"];
2818
2907
  def && slotBag.setSlot(ctx.rule.slot, function () {
2819
2908
  return def();
@@ -2840,8 +2929,15 @@
2840
2929
  ctx.prop = mergeRule({}, [this.cacheConfig[ctx.trueType].value, ctx.prop]);
2841
2930
  },
2842
2931
  setOptions: function setOptions(ctx) {
2843
- if (ctx.prop.optionsTo && ctx.prop.options) {
2844
- deepSet(ctx.prop, ctx.prop.optionsTo, ctx.prop.options);
2932
+ var opt = ctx.loadPending({
2933
+ key: 'options',
2934
+ origin: ctx.prop.options,
2935
+ def: []
2936
+ });
2937
+ ctx.prop.options = opt;
2938
+
2939
+ if (ctx.prop.optionsTo && opt) {
2940
+ deepSet(ctx.prop, ctx.prop.optionsTo, opt);
2845
2941
  }
2846
2942
  },
2847
2943
  deepSet: function deepSet$1(ctx) {
@@ -2870,34 +2966,37 @@
2870
2966
  renderCtx: function renderCtx(ctx, parent) {
2871
2967
  var _this4 = this;
2872
2968
 
2873
- if (ctx.type === 'hidden') return;
2874
- var rule = ctx.rule;
2875
- var preview = this.options.preview || false;
2876
-
2877
- if (!this.cache[ctx.id] || this.cache[ctx.id].slot !== rule.slot) {
2878
- var vn;
2879
- ctx.initProp();
2880
- this.mergeGlobal(ctx);
2881
- ctx.initNone();
2882
- this.$manager.tidyRule(ctx);
2883
- this.deepSet(ctx);
2884
- this.setOptions(ctx);
2885
- this.ctxProp(ctx);
2886
- var prop = ctx.prop;
2887
-
2888
- if (prop.hidden) {
2889
- this.setCache(ctx, undefined, parent);
2890
- return;
2891
- }
2969
+ try {
2970
+ if (ctx.type === 'hidden') return;
2971
+ var rule = ctx.rule;
2972
+ var preview = this.options.preview || false;
2973
+
2974
+ if (!this.cache[ctx.id] || this.cache[ctx.id].slot !== rule.slot) {
2975
+ var vn;
2976
+ ctx.initProp();
2977
+ this.mergeGlobal(ctx);
2978
+ ctx.initNone();
2979
+ this.$manager.tidyRule(ctx);
2980
+ this.deepSet(ctx);
2981
+ this.setOptions(ctx);
2982
+ this.ctxProp(ctx);
2983
+ var prop = ctx.prop;
2984
+ prop.props.formCreateInject = this.injectProp(ctx);
2985
+
2986
+ if (prop.hidden) {
2987
+ this.setCache(ctx, undefined, parent);
2988
+ return;
2989
+ }
2892
2990
 
2893
- vn = function vn() {
2894
- return _this4.item(ctx, function () {
2991
+ vn = function vn() {
2895
2992
  var children = {};
2896
2993
 
2994
+ var _load = ctx.loadChildrenPending();
2995
+
2897
2996
  if (ctx.parser.renderChildren) {
2898
- children = ctx.parser.renderChildren(ctx);
2997
+ children = ctx.parser.renderChildren(_load, ctx);
2899
2998
  } else if (ctx.parser.loadChildren !== false) {
2900
- children = _this4.renderChildren(ctx);
2999
+ children = _this4.renderChildren(_load, ctx);
2901
3000
  }
2902
3001
 
2903
3002
  var slot = _this4.getTypeSlot(ctx.type);
@@ -2927,15 +3026,22 @@
2927
3026
  _vn = _this4.display(_vn);
2928
3027
  }
2929
3028
 
3029
+ _this4.setCache(ctx, function () {
3030
+ return _vn;
3031
+ }, parent);
3032
+
2930
3033
  return _vn;
2931
- });
2932
- };
3034
+ };
2933
3035
 
2934
- this.setCache(ctx, vn, parent);
2935
- return vn;
2936
- }
3036
+ this.setCache(ctx, vn, parent);
3037
+ return vn;
3038
+ }
2937
3039
 
2938
- return this.getCache(ctx);
3040
+ return this.getCache(ctx);
3041
+ } catch (e) {
3042
+ console.error(e);
3043
+ return;
3044
+ }
2939
3045
  },
2940
3046
  getModelField: function getModelField(ctx) {
2941
3047
  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';
@@ -2969,30 +3075,36 @@
2969
3075
  return vn;
2970
3076
  }
2971
3077
  },
2972
- item: function item(ctx, vn) {
2973
- return this.vNode.h('FcFragment', {
2974
- key: ctx.prop.key,
2975
- formCreateInject: this.injectProp(ctx)
2976
- }, vn);
2977
- },
2978
3078
  isFragment: function isFragment(ctx) {
2979
3079
  return ctx.type === 'fragment' || ctx.type === 'template';
2980
3080
  },
2981
3081
  injectProp: function injectProp(ctx) {
2982
3082
  var _this6 = this;
2983
3083
 
2984
- return {
3084
+ var state = this.vm.setupState;
3085
+
3086
+ if (!state.ctxInject[ctx.id]) {
3087
+ state.ctxInject[ctx.id] = {
3088
+ api: this.$handle.api,
3089
+ form: this.fc.create,
3090
+ subForm: function subForm(_subForm) {
3091
+ _this6.$handle.addSubForm(ctx, _subForm);
3092
+ },
3093
+ options: [],
3094
+ children: [],
3095
+ preview: false,
3096
+ field: ctx.field,
3097
+ rule: ctx.rule
3098
+ };
3099
+ }
3100
+
3101
+ var inject = state.ctxInject[ctx.id];
3102
+ extend(inject, {
2985
3103
  preview: this.options.preview || false,
2986
- api: this.$handle.api,
2987
- form: this.fc.create,
2988
- subForm: function subForm(_subForm) {
2989
- _this6.$handle.addSubForm(ctx, _subForm);
2990
- },
2991
- field: ctx.field,
2992
- options: ctx.prop.options || [],
2993
- children: ctx.rule.children,
2994
- rule: ctx.rule
2995
- };
3104
+ options: ctx.prop.options,
3105
+ children: ctx.loadChildrenPending()
3106
+ });
3107
+ return inject;
2996
3108
  },
2997
3109
  ctxProp: function ctxProp(ctx, custom) {
2998
3110
  var _this7 = this;
@@ -3036,10 +3148,9 @@
3036
3148
  onInput: function onInput(ctx, value) {
3037
3149
  this.$handle.onInput(ctx, value);
3038
3150
  },
3039
- renderChildren: function renderChildren(ctx) {
3151
+ renderChildren: function renderChildren(children, ctx) {
3040
3152
  var _this8 = this;
3041
3153
 
3042
- var children = ctx.rule.children;
3043
3154
  if (!is.trueArray(children)) return {};
3044
3155
  var slotBag = makeSlotBag();
3045
3156
  children.map(function (child) {
@@ -3105,7 +3216,7 @@
3105
3216
  });
3106
3217
  }
3107
3218
 
3108
- var id = 1;
3219
+ var id$1 = 1;
3109
3220
  function Render(handle) {
3110
3221
  extend(this, {
3111
3222
  $handle: handle,
@@ -3113,7 +3224,7 @@
3113
3224
  vm: handle.vm,
3114
3225
  $manager: handle.$manager,
3115
3226
  vNode: new handle.fc.CreateNode(handle.vm),
3116
- id: id++
3227
+ id: id$1++
3117
3228
  });
3118
3229
  funcProxy(this, {
3119
3230
  options: function options() {
@@ -3361,6 +3472,7 @@
3361
3472
  rule: rule,
3362
3473
  origin: rule.__origin__ || rule,
3363
3474
  name: rule.name,
3475
+ pending: {},
3364
3476
  none: false,
3365
3477
  watch: [],
3366
3478
  linkOn: [],
@@ -3383,6 +3495,102 @@
3383
3495
  this.update(handle, true);
3384
3496
  }
3385
3497
  extend(RuleContext.prototype, {
3498
+ loadChildrenPending: function loadChildrenPending() {
3499
+ var _this = this;
3500
+
3501
+ var children = this.rule.children || [];
3502
+ if (Array.isArray(children)) return children;
3503
+ return this.loadPending({
3504
+ key: 'children',
3505
+ origin: children,
3506
+ def: [],
3507
+ onLoad: function onLoad(data) {
3508
+ _this.$handle && _this.$handle.loadChildren(data, _this);
3509
+ },
3510
+ onUpdate: function onUpdate(value, oldValue) {
3511
+ if (_this.$handle) {
3512
+ value === oldValue ? _this.$handle.loadChildren(value, _this) : _this.$handle.updateChildren(_this, value, oldValue);
3513
+ }
3514
+ },
3515
+ onReload: function onReload(value) {
3516
+ if (_this.$handle) {
3517
+ _this.$handle.updateChildren(_this, [], value);
3518
+ } else {
3519
+ delete _this.pending.children;
3520
+ }
3521
+ }
3522
+ });
3523
+ },
3524
+ loadPending: function loadPending(config) {
3525
+ var _this2 = this;
3526
+
3527
+ var key = config.key,
3528
+ origin = config.origin,
3529
+ def = config.def,
3530
+ onLoad = config.onLoad,
3531
+ onReload = config.onReload,
3532
+ onUpdate = config.onUpdate;
3533
+
3534
+ if (this.pending[key] && this.pending[key].origin === origin) {
3535
+ return this.getPending(key, def);
3536
+ }
3537
+
3538
+ delete this.pending[key];
3539
+ var value = origin;
3540
+
3541
+ if (is.Function(origin)) {
3542
+ var source = invoke(function () {
3543
+ return origin({
3544
+ rule: _this2.rule,
3545
+ api: _this2.$api,
3546
+ update: function update(data) {
3547
+ var value = data || def;
3548
+
3549
+ var oldValue = _this2.getPending(key, def);
3550
+
3551
+ _this2.setPending(key, origin, value);
3552
+
3553
+ onUpdate && onUpdate(value, oldValue);
3554
+ },
3555
+ reload: function reload() {
3556
+ var oldValue = _this2.getPending(key, def);
3557
+
3558
+ delete _this2.pending[key];
3559
+ onReload && onReload(oldValue);
3560
+ _this2.$api && _this2.$api.sync(_this2.rule);
3561
+ }
3562
+ });
3563
+ });
3564
+
3565
+ if (source && is.Function(source.then)) {
3566
+ source.then(function (data) {
3567
+ var value = data || def;
3568
+
3569
+ _this2.setPending(key, origin, value);
3570
+
3571
+ onLoad && onLoad(value);
3572
+ _this2.$api && _this2.$api.sync(_this2.rule);
3573
+ });
3574
+ value = def;
3575
+ this.setPending(key, origin, value);
3576
+ } else {
3577
+ value = source || def;
3578
+ this.setPending(key, origin, value);
3579
+ onLoad && onLoad(value);
3580
+ }
3581
+ }
3582
+
3583
+ return value;
3584
+ },
3585
+ getPending: function getPending(key, def) {
3586
+ return this.pending[key] && this.pending[key].value || def;
3587
+ },
3588
+ setPending: function setPending(key, origin, value) {
3589
+ this.pending[key] = {
3590
+ origin: origin,
3591
+ value: vue.reactive(value)
3592
+ };
3593
+ },
3386
3594
  effectData: function effectData(name) {
3387
3595
  if (!this.payload[name]) {
3388
3596
  this.payload[name] = {};
@@ -3406,13 +3614,13 @@
3406
3614
  parser.init(this);
3407
3615
  },
3408
3616
  initProp: function initProp() {
3409
- var _this = this;
3617
+ var _this3 = this;
3410
3618
 
3411
3619
  var rule = _objectSpread2({}, this.rule);
3412
3620
 
3413
3621
  delete rule.children;
3414
3622
  this.prop = mergeProps([rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
3415
- return _this.payload[k];
3623
+ return _this3.payload[k];
3416
3624
  })), [this.computed]));
3417
3625
  },
3418
3626
  initNone: function initNone() {
@@ -3439,10 +3647,10 @@
3439
3647
  this.$handle.appendLink(this);
3440
3648
  },
3441
3649
  watchTo: function watchTo() {
3442
- var _this2 = this;
3650
+ var _this4 = this;
3443
3651
 
3444
3652
  vue.nextTick(function () {
3445
- _this2.$handle && _this2.$handle.watchCtx(_this2);
3653
+ _this4.$handle && _this4.$handle.watchCtx(_this4);
3446
3654
  });
3447
3655
  },
3448
3656
  "delete": function _delete() {
@@ -3472,15 +3680,15 @@
3472
3680
  this.ctrlRule = [];
3473
3681
  },
3474
3682
  rm: function rm() {
3475
- var _this3 = this;
3683
+ var _this5 = this;
3476
3684
 
3477
3685
  var _rm = function _rm() {
3478
- var index = _this3.root.indexOf(_this3.origin);
3686
+ var index = _this5.root.indexOf(_this5.origin);
3479
3687
 
3480
3688
  if (index > -1) {
3481
- _this3.root.splice(index, 1);
3689
+ _this5.root.splice(index, 1);
3482
3690
 
3483
- _this3.$handle && _this3.$handle.refresh();
3691
+ _this5.$handle && _this5.$handle.refresh();
3484
3692
  }
3485
3693
  };
3486
3694
 
@@ -3491,17 +3699,17 @@
3491
3699
  }
3492
3700
 
3493
3701
  this.$handle.noWatch(function () {
3494
- _this3.$handle.deferSyncValue(function () {
3495
- _this3.rmCtrl();
3702
+ _this5.$handle.deferSyncValue(function () {
3703
+ _this5.rmCtrl();
3496
3704
 
3497
3705
  _rm();
3498
3706
 
3499
- _this3.$handle.rmCtx(_this3);
3707
+ _this5.$handle.rmCtx(_this5);
3500
3708
 
3501
- extend(_this3, {
3709
+ extend(_this5, {
3502
3710
  root: []
3503
3711
  });
3504
- }, _this3.input);
3712
+ }, _this5.input);
3505
3713
  });
3506
3714
  },
3507
3715
  update: function update(handle, init) {
@@ -3540,7 +3748,6 @@
3540
3748
  });
3541
3749
  fullRule(rule);
3542
3750
  this.appendValue(rule);
3543
- rule.options = Array.isArray(rule.options) ? rule.options : [];
3544
3751
  [rule, rule['prefix'], rule['suffix']].forEach(function (item) {
3545
3752
  if (!item) {
3546
3753
  return;
@@ -3660,7 +3867,7 @@
3660
3867
  if (!is.Object(_rule) || !getRule(_rule).type) return err('未定义生成规则的 type 字段', _rule);
3661
3868
 
3662
3869
  if (_rule.__fc__ && _rule.__fc__.root === rules && _this6.ctxs[_rule.__fc__.id]) {
3663
- loadChildren(_rule.__fc__.rule.children, _rule.__fc__);
3870
+ loadChildren(_rule.__fc__.loadChildrenPending(), _rule.__fc__);
3664
3871
  return _rule.__fc__;
3665
3872
  }
3666
3873
 
@@ -3731,7 +3938,10 @@
3731
3938
  _this6.setCtx(ctx);
3732
3939
 
3733
3940
  !isCopy && !isInit && _this6.effect(ctx, 'load');
3734
- ctx.parser.loadChildren === false || loadChildren(ctx.rule.children, ctx);
3941
+
3942
+ var _load = ctx.loadChildrenPending();
3943
+
3944
+ ctx.parser.loadChildren === false || loadChildren(_load, ctx);
3735
3945
 
3736
3946
  if (!parent) {
3737
3947
  var _preIndex = preIndex(index);
@@ -3827,7 +4037,7 @@
3827
4037
  if (valid) {
3828
4038
  flag = true;
3829
4039
  var ruleCon = {
3830
- type: 'template',
4040
+ type: 'fragment',
3831
4041
  "native": true,
3832
4042
  __ctrl: true,
3833
4043
  children: rule
@@ -3939,7 +4149,7 @@
3939
4149
  }
3940
4150
  },
3941
4151
  setFormData: function setFormData(ctx, value) {
3942
- $set(this.formData, ctx.id, value === undefined ? null : value);
4152
+ $set(this.formData, ctx.id, value === null ? undefined : value);
3943
4153
  },
3944
4154
  getFormData: function getFormData(ctx) {
3945
4155
  return this.formData[ctx.id];
@@ -4167,7 +4377,7 @@
4167
4377
  var flag = key === 'children';
4168
4378
  ctx.refRule[key] = ref;
4169
4379
  ctx.watch.push(vue.watch(flag ? function () {
4170
- return _toConsumableArray(ref.value || []);
4380
+ return is.Function(ref.value) ? ref.value : _toConsumableArray(ref.value || []);
4171
4381
  } : function () {
4172
4382
  return ref.value;
4173
4383
  }, function (_, o) {
@@ -4197,20 +4407,16 @@
4197
4407
  ctx.updateType();
4198
4408
 
4199
4409
  _this.bindParser(ctx);
4200
- } else if (key === 'children') {
4201
- _this.deferSyncValue(function () {
4202
- o && o.forEach(function (child) {
4203
- if ((n || []).indexOf(child) === -1 && child && !is.String(child) && child.__fc__ && !_this.ctxs[child.__fc__.id]) {
4204
- _this.rmCtx(child.__fc__);
4205
- }
4206
- });
4410
+ } else if (flag) {
4411
+ if (is.Function(o)) {
4412
+ o = ctx.getPending('children', []);
4413
+ }
4207
4414
 
4208
- if (is.trueArray(n)) {
4209
- _this.loadChildren(n, ctx);
4415
+ if (is.Function(n)) {
4416
+ n = ctx.loadChildrenPending();
4417
+ }
4210
4418
 
4211
- _this.bus.$emit('update', _this.api);
4212
- }
4213
- });
4419
+ _this.updateChildren(ctx, n, o);
4214
4420
  }
4215
4421
 
4216
4422
  _this.$render.clearCache(ctx);
@@ -4237,15 +4443,32 @@
4237
4443
 
4238
4444
  this.watchEffect(ctx);
4239
4445
  },
4240
- rmSub: function rmSub(sub) {
4446
+ updateChildren: function updateChildren(ctx, n, o) {
4241
4447
  var _this2 = this;
4242
4448
 
4449
+ this.deferSyncValue(function () {
4450
+ o && o.forEach(function (child) {
4451
+ if ((n || []).indexOf(child) === -1 && child && !is.String(child) && child.__fc__) {
4452
+ _this2.rmCtx(child.__fc__);
4453
+ }
4454
+ });
4455
+
4456
+ if (is.trueArray(n)) {
4457
+ _this2.loadChildren(n, ctx);
4458
+
4459
+ _this2.bus.$emit('update', _this2.api);
4460
+ }
4461
+ });
4462
+ },
4463
+ rmSub: function rmSub(sub) {
4464
+ var _this3 = this;
4465
+
4243
4466
  is.trueArray(sub) && sub.forEach(function (r) {
4244
- r && r.__fc__ && _this2.rmCtx(r.__fc__);
4467
+ r && r.__fc__ && _this3.rmCtx(r.__fc__);
4245
4468
  });
4246
4469
  },
4247
4470
  rmCtx: function rmCtx(ctx) {
4248
- var _this3 = this;
4471
+ var _this4 = this;
4249
4472
 
4250
4473
  if (ctx.deleted) return;
4251
4474
  var id = ctx.id,
@@ -4255,20 +4478,23 @@
4255
4478
  $del(this.ctxs, id);
4256
4479
  $del(this.formData, id);
4257
4480
  $del(this.subForm, id);
4481
+ $del(this.vm.setupState.ctxInject, id);
4258
4482
  input && this.rmIdCtx(ctx, field, 'field');
4259
4483
  name && this.rmIdCtx(ctx, name, 'name');
4260
4484
  this.deferSyncValue(function () {
4261
- if (!_this3.reloading) {
4485
+ if (!_this4.reloading) {
4262
4486
  if (ctx.parser.loadChildren !== false) {
4263
- if (is.trueArray(ctx.rule.children)) {
4264
- ctx.rule.children.forEach(function (h) {
4265
- return h.__fc__ && _this3.rmCtx(h.__fc__);
4487
+ var children = ctx.getPending('children', ctx.rule.children);
4488
+
4489
+ if (is.trueArray(children)) {
4490
+ children.forEach(function (h) {
4491
+ return h.__fc__ && _this4.rmCtx(h.__fc__);
4266
4492
  });
4267
4493
  }
4268
4494
  }
4269
4495
 
4270
- if (ctx.root === _this3.rules) {
4271
- _this3.vm.setupState.renderRule();
4496
+ if (ctx.root === _this4.rules) {
4497
+ _this4.vm.setupState.renderRule();
4272
4498
  }
4273
4499
  }
4274
4500
  }, input);
@@ -4387,7 +4613,7 @@
4387
4613
  input = _ref.input,
4388
4614
  type = _ref.type,
4389
4615
  custom = _ref.custom;
4390
- if (!type || type === 'fcFragment') return;
4616
+ if (!type || ['fcFragment', 'fragment'].indexOf(type) > -1) return;
4391
4617
  var effect = custom ? custom : rule.effect || {};
4392
4618
  Object.keys(effect).forEach(function (attr) {
4393
4619
  var p = _this4.providers[attr];
@@ -4584,26 +4810,8 @@
4584
4810
  xhr.send(formData);
4585
4811
  }
4586
4812
 
4587
- var NAME$1 = 'FcFragment';
4813
+ var NAME = 'fcFragment';
4588
4814
  var fragment = vue.defineComponent({
4589
- name: NAME$1,
4590
- inheritAttrs: false,
4591
- props: ['formCreateInject'],
4592
- setup: function setup(props) {
4593
- var data = vue.toRef(props, 'formCreateInject');
4594
- var $inject = vue.reactive(_objectSpread2({}, data.value));
4595
- vue.watch(data, function () {
4596
- extend($inject, data.value);
4597
- });
4598
- vue.provide('formCreateInject', $inject);
4599
- },
4600
- render: function render() {
4601
- return this.$slots["default"]();
4602
- }
4603
- });
4604
-
4605
- var NAME = 'FcVnode';
4606
- var vnode = vue.defineComponent({
4607
4815
  name: NAME,
4608
4816
  inheritAttrs: false,
4609
4817
  props: ['vnode'],
@@ -4646,8 +4854,14 @@
4646
4854
  return makeDirective(data, this.h(tag, toProps(data), children));
4647
4855
  },
4648
4856
  h: function h(tag, data, children) {
4857
+ var isNativeTag = vue.getCurrentInstance().appContext.config.isNativeTag(tag);
4858
+
4859
+ if (isNativeTag) {
4860
+ delete data.formCreateInject;
4861
+ }
4862
+
4649
4863
  try {
4650
- return vue.createVNode(vue.getCurrentInstance().appContext.config.isNativeTag(tag) ? tag : vue.resolveComponent(tag), data, children);
4864
+ return vue.createVNode(isNativeTag ? tag : vue.resolveComponent(tag), data, children);
4651
4865
  } catch (e) {
4652
4866
  console.error(e);
4653
4867
  return vue.createVNode('');
@@ -4690,7 +4904,7 @@
4690
4904
  return _super.apply(this, arguments);
4691
4905
  }
4692
4906
 
4693
- return _createClass(CustomManager);
4907
+ return CustomManager;
4694
4908
  }(Manager);
4695
4909
 
4696
4910
  Object.assign(CustomManager.prototype, proto);
@@ -4835,6 +5049,25 @@
4835
5049
  return true;
4836
5050
  }
4837
5051
 
5052
+ var name$6 = 'html';
5053
+ var html = {
5054
+ name: name$6,
5055
+ loadChildren: false,
5056
+ render: function render(children, ctx) {
5057
+ ctx.prop.props.innerHTML = children["default"]();
5058
+ return ctx.vNode.make(ctx.prop.props.tag || 'div', ctx.prop);
5059
+ },
5060
+ renderChildren: function renderChildren(children) {
5061
+ return {
5062
+ "default": function _default() {
5063
+ return children.filter(function (v) {
5064
+ return is.String(v);
5065
+ }).join('');
5066
+ }
5067
+ };
5068
+ }
5069
+ };
5070
+
4838
5071
  function parseProp(name, id) {
4839
5072
  var prop;
4840
5073
 
@@ -4863,8 +5096,10 @@
4863
5096
  arrayAttrs.push.apply(arrayAttrs, _toConsumableArray(array));
4864
5097
  normalAttrs.push.apply(normalAttrs, _toConsumableArray(normal));
4865
5098
  appendProto([].concat(_toConsumableArray(key), _toConsumableArray(array), _toConsumableArray(normal)));
4866
- } //todo 表单嵌套
5099
+ }
4867
5100
 
5101
+ var id = 1;
5102
+ var instance = {}; //todo 表单嵌套
4868
5103
 
4869
5104
  function FormCreateFactory(config) {
4870
5105
  var components = _defineProperty({}, fragment.name, fragment);
@@ -4872,6 +5107,7 @@
4872
5107
  var parsers = {};
4873
5108
  var directives = {};
4874
5109
  var modelFields = {};
5110
+ var useApps = [];
4875
5111
  var providers = {
4876
5112
  fetch: $fetch
4877
5113
  };
@@ -4883,6 +5119,14 @@
4883
5119
  var CreateNode = CreateNodeFactory();
4884
5120
  exportAttrs(config.attrs || {});
4885
5121
 
5122
+ function getApi(name) {
5123
+ return instance[name];
5124
+ }
5125
+
5126
+ function useApp(fn) {
5127
+ useApps.push(fn);
5128
+ }
5129
+
4886
5130
  function directive() {
4887
5131
  var data = nameProp.apply(void 0, arguments);
4888
5132
  if (data.id && data.prop) directives[data.id] = data.prop;
@@ -4920,7 +5164,7 @@
4920
5164
  return components[name];
4921
5165
  }
4922
5166
  } else {
4923
- name = toCase(id.name);
5167
+ name = toCase(id.displayName || id.name);
4924
5168
  component = id;
4925
5169
  }
4926
5170
 
@@ -4951,7 +5195,7 @@
4951
5195
  }
4952
5196
 
4953
5197
  function $vnode() {
4954
- return vnode;
5198
+ return fragment;
4955
5199
  } //todo 检查回调函数作用域
4956
5200
 
4957
5201
 
@@ -4962,7 +5206,11 @@
4962
5206
 
4963
5207
  function create(rules, option) {
4964
5208
  var app = createFormApp(rules, option || {});
4965
- config.appUse && config.appUse(app);
5209
+ useApps.forEach(function (v) {
5210
+ invoke(function () {
5211
+ return v(create, app);
5212
+ });
5213
+ });
4966
5214
  var div = document.createElement('div');
4967
5215
  ((option === null || option === void 0 ? void 0 : option.el) || document.body).appendChild(div);
4968
5216
  var vm = app.mount(div);
@@ -4981,6 +5229,7 @@
4981
5229
  var _this = this;
4982
5230
 
4983
5231
  extend(this, {
5232
+ id: id++,
4984
5233
  create: create,
4985
5234
  vm: vm,
4986
5235
  manager: createManager(config.manager),
@@ -4988,6 +5237,7 @@
4988
5237
  providers: providers,
4989
5238
  modelFields: modelFields,
4990
5239
  rules: vm.props.rule,
5240
+ name: vm.props.name,
4991
5241
  prop: {
4992
5242
  components: components,
4993
5243
  directives: directives
@@ -5012,6 +5262,10 @@
5012
5262
  extend(vm.appContext.components, components);
5013
5263
  extend(vm.appContext.directives, directives);
5014
5264
  this.$handle = new Handler(this);
5265
+
5266
+ if (this.name) {
5267
+ instance[this.name] = this.api();
5268
+ }
5015
5269
  }
5016
5270
 
5017
5271
  extend(FormCreate.prototype, {
@@ -5077,6 +5331,10 @@
5077
5331
  this.$handle.mounted();
5078
5332
  },
5079
5333
  unmount: function unmount() {
5334
+ if (this.name) {
5335
+ delete instance[this.name];
5336
+ }
5337
+
5080
5338
  this.unwatch && this.unwatch();
5081
5339
  this.$handle.reloadRule([]);
5082
5340
  },
@@ -5110,17 +5368,19 @@
5110
5368
  $form: $form,
5111
5369
  parseFn: parseFn,
5112
5370
  parseJson: parseJson,
5113
- toJson: toJson
5371
+ toJson: toJson,
5372
+ useApp: useApp,
5373
+ getApi: getApi
5114
5374
  });
5115
5375
  }
5116
5376
 
5117
5377
  function useStatic(formCreate) {
5118
5378
  extend(formCreate, {
5119
5379
  create: create,
5120
- install: function install(Vue, options) {
5380
+ install: function install(app, options) {
5121
5381
  globalConfig = _objectSpread2(_objectSpread2({}, globalConfig), options || {});
5122
- if (Vue._installedFormCreate === true) return;
5123
- Vue._installedFormCreate = true;
5382
+ if (app._installedFormCreate === true) return;
5383
+ app._installedFormCreate = true;
5124
5384
 
5125
5385
  var $formCreate = function $formCreate(rules) {
5126
5386
  var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -5128,9 +5388,13 @@
5128
5388
  };
5129
5389
 
5130
5390
  useAttr($formCreate);
5131
- Vue.config.globalProperties.$formCreate = $formCreate;
5132
- Vue.component('FormCreate', $form());
5133
- Vue.component('fc-vnode', vnode);
5391
+ app.config.globalProperties.$formCreate = $formCreate;
5392
+ app.component('FormCreate', $form());
5393
+ useApps.forEach(function (v) {
5394
+ invoke(function () {
5395
+ return v(formCreate, app);
5396
+ });
5397
+ });
5134
5398
  }
5135
5399
  });
5136
5400
  }
@@ -5140,7 +5404,13 @@
5140
5404
  CreateNode.use({
5141
5405
  fragment: 'fcFragment'
5142
5406
  });
5143
- if (config.install) create.use(config);
5407
+ config.install && create.use(config);
5408
+ useApp(function (_, app) {
5409
+ app.mixin({
5410
+ props: ['formCreateInject']
5411
+ });
5412
+ });
5413
+ parser(html);
5144
5414
  return create;
5145
5415
  }
5146
5416
 
@@ -5285,7 +5555,7 @@
5285
5555
  var PRE = 'el';
5286
5556
  var alias = {
5287
5557
  button: PRE + '-button',
5288
- icon: 'i',
5558
+ icon: PRE + '-icon',
5289
5559
  slider: PRE + '-slider',
5290
5560
  rate: PRE + '-rate',
5291
5561
  upload: 'fc-upload',
@@ -5342,7 +5612,6 @@
5342
5612
  type: 'default',
5343
5613
  loading: false,
5344
5614
  disabled: false,
5345
- icon: 'el-icon-refresh',
5346
5615
  innerText: '重置',
5347
5616
  show: false,
5348
5617
  col: undefined,
@@ -5432,7 +5701,7 @@
5432
5701
  info: {
5433
5702
  trigger: 'hover',
5434
5703
  placement: 'top-start',
5435
- icon: 'el-icon-warning'
5704
+ icon: true
5436
5705
  },
5437
5706
  title: {},
5438
5707
  col: {
@@ -5548,10 +5817,16 @@
5548
5817
 
5549
5818
  children[infoProp.align !== 'left' ? 'unshift' : 'push'](this.$r(mergeProps([infoProp, prop]), _defineProperty({}, titleProp.slot || (isTip ? 'default' : 'reference'), function () {
5550
5819
  return _this4.$r({
5551
- type: 'i',
5552
- "class": infoProp.icon === true ? 'el-icon-warning' : infoProp.icon,
5820
+ type: 'ElIcon',
5821
+ style: 'top:2px',
5553
5822
  key: "".concat(uni, "i")
5554
- }, {}, true);
5823
+ }, {
5824
+ "default": function _default() {
5825
+ return _this4.$r({
5826
+ type: infoProp.icon === true ? 'icon-warning' : infoProp.icon
5827
+ });
5828
+ }
5829
+ }, true);
5555
5830
  })));
5556
5831
  }
5557
5832
 
@@ -5908,12 +6183,18 @@
5908
6183
  Object.keys(maker$1).forEach(function (name) {
5909
6184
  FormCreate.maker[name] = maker$1[name];
5910
6185
  });
6186
+
6187
+ if (typeof window !== 'undefined' && window.ElementPlus) {
6188
+ FormCreate.useApp(function (_, app) {
6189
+ app.use(window.ElementPlus);
6190
+ });
6191
+ }
5911
6192
  }
5912
6193
 
5913
6194
  function elmFormCreate() {
5914
6195
  return FormCreateFactory({
5915
6196
  ui: 'element-ui',
5916
- version: '3.0.1',
6197
+ version: '3.1.2',
5917
6198
  manager: manager,
5918
6199
  extendApi: extendApi,
5919
6200
  install: install,