@form-create/element-ui 2.5.12 → 3.0.0-alpha.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,62 +1,56 @@
1
1
  /*!
2
- * @form-create/element-ui v2.5.12
2
+ * @form-create/element-ui v3.0.0-alpha.2
3
3
  * (c) 2018-2021 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
6
6
  */
7
7
  (function (global, factory) {
8
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) :
9
- typeof define === 'function' && define.amd ? define(['exports', 'vue'], factory) :
10
- (global = global || self, factory(global.formCreate = {}, global.Vue));
11
- }(this, (function (exports, Vue) { 'use strict';
12
-
13
- Vue = Vue && Object.prototype.hasOwnProperty.call(Vue, 'default') ? Vue['default'] : Vue;
14
-
15
- function _extends() {
16
- return _extends = Object.assign || function (a) {
17
- for (var b, c = 1; c < arguments.length; c++) {
18
- for (var d in b = arguments[c], b) {
19
- Object.prototype.hasOwnProperty.call(b, d) && (a[d] = b[d]);
20
- }
8
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('element-plus')) :
9
+ typeof define === 'function' && define.amd ? define(['exports', 'vue', 'element-plus'], factory) :
10
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.formCreate = {}, global.Vue, global.ElementPlus));
11
+ })(this, (function (exports, vue, ElementPlus) { 'use strict';
12
+
13
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
+
15
+ var ElementPlus__default = /*#__PURE__*/_interopDefaultLegacy(ElementPlus);
16
+
17
+ function ownKeys(object, enumerableOnly) {
18
+ var keys = Object.keys(object);
19
+
20
+ if (Object.getOwnPropertySymbols) {
21
+ var symbols = Object.getOwnPropertySymbols(object);
22
+
23
+ if (enumerableOnly) {
24
+ symbols = symbols.filter(function (sym) {
25
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
26
+ });
21
27
  }
22
28
 
23
- return a;
24
- }, _extends.apply(this, arguments);
29
+ keys.push.apply(keys, symbols);
30
+ }
31
+
32
+ return keys;
25
33
  }
26
34
 
27
- var normalMerge = ["attrs", "props", "domProps"],
28
- toArrayMerge = ["class", "style", "directives"],
29
- functionalMerge = ["on", "nativeOn"],
30
- mergeJsxProps = function mergeJsxProps(a) {
31
- return a.reduce(function (c, a) {
32
- for (var b in a) {
33
- if (!c[b]) c[b] = a[b];else if (-1 !== normalMerge.indexOf(b)) c[b] = _extends({}, c[b], a[b]);else if (-1 !== toArrayMerge.indexOf(b)) {
34
- var d = c[b] instanceof Array ? c[b] : [c[b]],
35
- e = a[b] instanceof Array ? a[b] : [a[b]];
36
- c[b] = d.concat(e);
37
- } else if (-1 !== functionalMerge.indexOf(b)) {
38
- for (var f in a[b]) {
39
- if (c[b][f]) {
40
- var g = c[b][f] instanceof Array ? c[b][f] : [c[b][f]],
41
- h = a[b][f] instanceof Array ? a[b][f] : [a[b][f]];
42
- c[b][f] = g.concat(h);
43
- } else c[b][f] = a[b][f];
44
- }
45
- } else if ("hook" == b) for (var i in a[b]) {
46
- c[b][i] = c[b][i] ? mergeFn(c[b][i], a[b][i]) : a[b][i];
47
- } else c[b] = a[b];
48
- }
35
+ function _objectSpread2(target) {
36
+ for (var i = 1; i < arguments.length; i++) {
37
+ var source = arguments[i] != null ? arguments[i] : {};
49
38
 
50
- return c;
51
- }, {});
52
- },
53
- mergeFn = function mergeFn(a, b) {
54
- return function () {
55
- a && a.apply(this, arguments), b && b.apply(this, arguments);
56
- };
57
- };
39
+ if (i % 2) {
40
+ ownKeys(Object(source), true).forEach(function (key) {
41
+ _defineProperty(target, key, source[key]);
42
+ });
43
+ } else if (Object.getOwnPropertyDescriptors) {
44
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
45
+ } else {
46
+ ownKeys(Object(source)).forEach(function (key) {
47
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
48
+ });
49
+ }
50
+ }
58
51
 
59
- var helper = mergeJsxProps;
52
+ return target;
53
+ }
60
54
 
61
55
  function _typeof(obj) {
62
56
  "@babel/helpers - typeof";
@@ -95,40 +89,6 @@
95
89
  return obj;
96
90
  }
97
91
 
98
- function ownKeys(object, enumerableOnly) {
99
- var keys = Object.keys(object);
100
-
101
- if (Object.getOwnPropertySymbols) {
102
- var symbols = Object.getOwnPropertySymbols(object);
103
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
104
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
105
- });
106
- keys.push.apply(keys, symbols);
107
- }
108
-
109
- return keys;
110
- }
111
-
112
- function _objectSpread2(target) {
113
- for (var i = 1; i < arguments.length; i++) {
114
- var source = arguments[i] != null ? arguments[i] : {};
115
-
116
- if (i % 2) {
117
- ownKeys(Object(source), true).forEach(function (key) {
118
- _defineProperty(target, key, source[key]);
119
- });
120
- } else if (Object.getOwnPropertyDescriptors) {
121
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
122
- } else {
123
- ownKeys(Object(source)).forEach(function (key) {
124
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
125
- });
126
- }
127
- }
128
-
129
- return target;
130
- }
131
-
132
92
  function _inherits(subClass, superClass) {
133
93
  if (typeof superClass !== "function" && superClass !== null) {
134
94
  throw new TypeError("Super expression must either be null or a function");
@@ -184,6 +144,8 @@
184
144
  function _possibleConstructorReturn(self, call) {
185
145
  if (call && (typeof call === "object" || typeof call === "function")) {
186
146
  return call;
147
+ } else if (call !== void 0) {
148
+ throw new TypeError("Derived constructors may only return object or undefined");
187
149
  }
188
150
 
189
151
  return _assertThisInitialized(self);
@@ -217,7 +179,7 @@
217
179
  }
218
180
 
219
181
  function _iterableToArray(iter) {
220
- if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
182
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
221
183
  }
222
184
 
223
185
  function _unsupportedIterableToArray(o, minLen) {
@@ -251,15 +213,12 @@
251
213
  }, []);
252
214
  }
253
215
 
254
- var NAME = 'fcCheckbox';
255
- var Checkbox = {
256
- name: NAME,
216
+ var NAME$a = 'fcCheckbox';
217
+ var Checkbox = vue.defineComponent({
218
+ name: NAME$a,
219
+ inheritAttrs: false,
257
220
  props: {
258
- formCreateInject: {
259
- type: Object,
260
- required: true
261
- },
262
- value: {
221
+ modelValue: {
263
222
  type: Array,
264
223
  "default": function _default() {
265
224
  return [];
@@ -267,80 +226,126 @@
267
226
  },
268
227
  type: String
269
228
  },
270
- watch: {
271
- value: function value() {
272
- this.update();
273
- }
274
- },
275
- data: function data() {
276
- return {
277
- trueValue: []
278
- };
279
- },
280
- computed: {
281
- options: function options() {
282
- var opt = this.formCreateInject.options;
283
- return Array.isArray(opt) ? opt : [];
284
- }
285
- },
286
- methods: {
287
- onInput: function onInput(n) {
288
- this.$emit('input', this.options.filter(function (opt) {
289
- return n.indexOf(opt.label) !== -1;
290
- }).map(function (opt) {
291
- return opt.value;
292
- }).filter(function (v) {
293
- return v !== undefined;
294
- }));
295
- },
296
- update: function update() {
297
- var _this = this;
229
+ emits: ['update:modelValue'],
230
+ setup: function setup(props, _) {
231
+ var _toRefs = vue.toRefs(vue.inject('formCreateInject')),
232
+ options = _toRefs.options;
233
+
234
+ var trueValue = vue.ref([]);
235
+ var value = vue.toRef(props, 'modelValue');
236
+
237
+ var _options = vue.computed(function () {
238
+ return Array.isArray(options) ? options : [];
239
+ });
298
240
 
299
- this.trueValue = this.value ? this.options.filter(function (opt) {
300
- return _this.value.indexOf(opt.value) !== -1;
241
+ var update = function update() {
242
+ trueValue.value = value.value ? _options.value.filter(function (opt) {
243
+ return value.value.indexOf(opt.value) !== -1;
301
244
  }).map(function (option) {
302
245
  return option.label;
303
246
  }) : [];
304
- }
247
+ };
248
+
249
+ update();
250
+ return {
251
+ options: _options,
252
+ trueValue: trueValue,
253
+ value: value,
254
+ onInput: function onInput(n) {
255
+ _.emit('update:modelValue', _options.value.filter(function (opt) {
256
+ return n.indexOf(opt.label) !== -1;
257
+ }).map(function (opt) {
258
+ return opt.value;
259
+ }).filter(function (v) {
260
+ return v !== undefined;
261
+ }));
262
+ },
263
+ update: update
264
+ };
305
265
  },
306
- created: function created() {
307
- this.update();
266
+ watch: {
267
+ modelValue: function modelValue() {
268
+ this.update();
269
+ }
308
270
  },
309
271
  render: function render() {
310
- var _this2 = this;
311
-
312
- var h = arguments[0];
313
- return h("ElCheckboxGroup", helper([{}, this.formCreateInject.prop, {
314
- "attrs": {
315
- "value": this.trueValue
316
- },
317
- "on": {
318
- "input": this.onInput
272
+ var _this$$slots$default,
273
+ _this$$slots,
274
+ _this = this;
275
+
276
+ var name = this.type === 'button' ? 'ElCheckboxButton' : 'ElCheckbox';
277
+ var Type = vue.resolveComponent(name);
278
+ return vue.createVNode(vue.resolveComponent("ElCheckboxGroup"), vue.mergeProps(this.$attrs, {
279
+ "modelValue": this.trueValue,
280
+ "onUpdate:modelValue": this.onInput
281
+ }), _objectSpread2({
282
+ "default": function _default() {
283
+ return [_this.options.map(function (opt, index) {
284
+ var props = _objectSpread2({}, opt);
285
+
286
+ delete props.value;
287
+ return vue.createVNode(Type, vue.mergeProps(props, {
288
+ "key": name + index + opt.value
289
+ }), null);
290
+ }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
319
291
  }
320
- }]), [this.options.map(function (opt, index) {
321
- var props = _objectSpread2({}, opt);
322
-
323
- var Type = _this2.type === 'button' ? 'ElCheckboxButton' : 'ElCheckbox';
324
- delete props.value;
325
- return h(Type, {
326
- "props": _objectSpread2({}, props),
327
- "key": Type + index + opt.value
328
- });
329
- }), getSlot(this.$slots)]);
292
+ }, getSlot(this.$slots, ['default'])));
330
293
  }
331
- };
294
+ });
332
295
 
333
296
  function toArray(value) {
334
297
  return Array.isArray(value) ? value : [null, undefined, ''].indexOf(value) > -1 ? [] : [value];
335
298
  }
336
299
 
300
+ // https://github.com/developit/mitt
301
+ function Mitt(all) {
302
+ all = all || new Map();
303
+ var mitt = {
304
+ $on: function $on(type, handler) {
305
+ var handlers = all.get(type);
306
+ var added = handlers && handlers.push(handler);
307
+
308
+ if (!added) {
309
+ all.set(type, [handler]);
310
+ }
311
+ },
312
+ $once: function $once(type, handler) {
313
+ handler._once = true;
314
+ mitt.$on(type, handler);
315
+ },
316
+ $off: function $off(type, handler) {
317
+ var handlers = all.get(type);
318
+
319
+ if (handlers) {
320
+ handlers.splice(handlers.indexOf(handler) >>> 0, 1);
321
+ }
322
+ },
323
+ $emit: function $emit(type) {
324
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
325
+ args[_key - 1] = arguments[_key];
326
+ }
327
+
328
+ (all.get(type) || []).slice().map(function (handler) {
329
+ if (handler._once) {
330
+ mitt.$off(type, handler);
331
+ delete handler._once;
332
+ }
333
+
334
+ handler.apply(void 0, args);
335
+ });
336
+ (all.get('*') || []).slice().map(function (handler) {
337
+ handler(type, args);
338
+ });
339
+ }
340
+ };
341
+ return mitt;
342
+ }
343
+
337
344
  function styleInject(css, ref) {
338
- if (ref === void 0) ref = {};
345
+ if ( ref === void 0 ) ref = {};
339
346
  var insertAt = ref.insertAt;
340
347
 
341
- if (!css || typeof document === 'undefined') {
342
- return;
343
- }
348
+ if (!css || typeof document === 'undefined') { return; }
344
349
 
345
350
  var head = document.head || document.getElementsByTagName('head')[0];
346
351
  var style = document.createElement('style');
@@ -363,17 +368,17 @@
363
368
  }
364
369
  }
365
370
 
366
- var css_248z = "._fc-frame .fc-files img {\n width: 100%;\n height: 100%;\n display: inline-block;\n vertical-align: top;\n}\n\n._fc-frame .fc-upload-btn {\n border: 1px dashed #c0ccda;\n cursor: pointer;\n}\n\n._fc-frame .fc-upload-cover {\n opacity: 0;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n background: rgba(0, 0, 0, .6);\n -webkit-transition: opacity .3s;\n -o-transition: opacity .3s;\n transition: opacity .3s;\n}\n\n._fc-frame .fc-upload-cover i {\n color: #fff;\n font-size: 20px;\n cursor: pointer;\n margin: 0 2px;\n}\n\n._fc-frame .fc-files:hover .fc-upload-cover {\n opacity: 1;\n}\n\n._fc-frame .el-upload {\n display: block;\n}\n\n._fc-frame .fc-upload-btn, .fc-files {\n display: inline-block;\n width: 58px;\n height: 58px;\n text-align: center;\n line-height: 58px;\n border: 1px solid #c0ccda;\n border-radius: 4px;\n overflow: hidden;\n background: #fff;\n position: relative;\n -webkit-box-shadow: 2px 2px 5px rgba(0, 0, 0, .1);\n box-shadow: 2px 2px 5px rgba(0, 0, 0, .1);\n margin-right: 4px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n}\n";
367
- styleInject(css_248z);
371
+ 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}";
372
+ styleInject(css_248z$2);
368
373
 
369
- var NAME$1 = 'fcFrame';
370
- var Frame = {
371
- name: NAME$1,
374
+ function _isSlot$1(s) {
375
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
376
+ }
377
+
378
+ var NAME$9 = 'fcFrame';
379
+ var Frame = vue.defineComponent({
380
+ name: NAME$9,
372
381
  props: {
373
- formCreateInject: {
374
- type: Object,
375
- required: true
376
- },
377
382
  type: {
378
383
  type: String,
379
384
  "default": 'input'
@@ -416,10 +421,7 @@
416
421
  "default": '关闭'
417
422
  },
418
423
  modalTitle: String,
419
- handleIcon: {
420
- type: [String, Boolean],
421
- "default": undefined
422
- },
424
+ handleIcon: [String, Boolean],
423
425
  title: String,
424
426
  allowRemove: {
425
427
  type: Boolean,
@@ -449,23 +451,15 @@
449
451
  type: Function,
450
452
  "default": function _default() {}
451
453
  },
452
- onHandle: {
453
- type: Function,
454
- "default": function _default(src) {
455
- this.previewImage = this.getSrc(src);
456
- this.previewVisible = true;
457
- }
458
- },
454
+ onHandle: Function,
459
455
  modal: {
460
456
  type: Object,
461
457
  "default": function _default() {
462
458
  return {};
463
459
  }
464
460
  },
465
- srcKey: {
466
- type: [String, Number]
467
- },
468
- value: [Array, String, Number, Object],
461
+ srcKey: [String, Number],
462
+ modelValue: [Array, String, Number, Object],
469
463
  previewMask: undefined,
470
464
  footer: {
471
465
  type: Boolean,
@@ -484,37 +478,35 @@
484
478
  "default": true
485
479
  }
486
480
  },
481
+ inject: ['formCreateInject'],
482
+ emits: ['update:modelValue', 'change'],
487
483
  data: function data() {
488
484
  return {
489
- fileList: toArray(this.value),
485
+ fileList: toArray(this.modelValue),
490
486
  previewVisible: false,
491
487
  frameVisible: false,
492
- previewImage: ''
488
+ previewImage: '',
489
+ bus: new Mitt()
493
490
  };
494
491
  },
495
492
  watch: {
496
- value: function value(n) {
493
+ modelValue: function modelValue(n) {
497
494
  this.fileList = toArray(n);
498
- },
499
- fileList: function fileList(n) {
500
- var val = this.maxLength === 1 ? n[0] || '' : n;
501
- this.$emit('input', val);
502
- this.$emit('change', val);
503
- },
504
- src: function src(n) {
505
- this.modalVm && (this.modalVm.src = n);
506
495
  }
507
496
  },
508
497
  methods: {
509
498
  key: function key(unique) {
510
499
  return unique;
511
500
  },
501
+ close: function close() {
502
+ this.closeModel(true);
503
+ },
512
504
  closeModel: function closeModel(close) {
513
- this.$emit(close ? '$close' : '$ok');
505
+ this.bus.$emit(close ? '$close' : '$ok');
514
506
 
515
507
  if (this.reload) {
516
- this.$off('$ok');
517
- this.$off('$close');
508
+ this.bus.$off('$ok');
509
+ this.bus.$off('$close');
518
510
  }
519
511
 
520
512
  this.frameVisible = false;
@@ -529,60 +521,58 @@
529
521
 
530
522
  this.frameVisible = true;
531
523
  },
524
+ input: function input() {
525
+ var n = this.fileList;
526
+ var val = this.maxLength === 1 ? n[0] || '' : n;
527
+ this.$emit('update:modelValue', val);
528
+ this.$emit('change', val);
529
+ },
532
530
  makeInput: function makeInput() {
533
531
  var _this = this;
534
532
 
535
- var h = this.$createElement;
536
- var props = {
533
+ return vue.createVNode(vue.resolveComponent("ElInput"), vue.mergeProps({
537
534
  type: 'text',
538
- value: this.fileList.map(function (v) {
535
+ modelValue: this.fileList.map(function (v) {
539
536
  return _this.getSrc(v);
540
537
  }).toString(),
541
538
  readonly: true
542
- };
543
- return h("ElInput", helper([{}, {
544
- "props": props
545
539
  }, {
546
540
  "key": this.key('input')
547
- }]), [this.fileList.length ? h("i", {
548
- "slot": "suffix",
549
- "class": "el-input__icon el-icon-circle-close",
550
- "on": {
551
- "click": function click() {
552
- return _this.fileList = [];
553
- }
554
- }
555
- }) : null, h("ElButton", helper([{
556
- "attrs": {
557
- "icon": this.icon
558
- }
559
- }, {
560
- "on": {
561
- 'click': function click() {
562
- return _this.showModel();
563
- }
541
+ }), {
542
+ append: function append() {
543
+ return vue.createVNode(vue.resolveComponent("ElButton"), {
544
+ "icon": _this.icon,
545
+ "onClick": function onClick() {
546
+ return _this.showModel();
547
+ }
548
+ }, null);
549
+ },
550
+ suffix: function suffix() {
551
+ return _this.fileList.length ? vue.createVNode("i", {
552
+ "class": "el-input__icon el-icon-circle-close",
553
+ "onClick": function onClick() {
554
+ _this.fileList = [];
555
+
556
+ _this.input();
557
+ }
558
+ }, null) : null;
564
559
  }
565
- }, {
566
- "slot": "append"
567
- }]))]);
560
+ });
568
561
  },
569
562
  makeGroup: function makeGroup(children) {
570
- var h = this.$createElement;
571
-
572
563
  if (!this.maxLength || this.fileList.length < this.maxLength) {
573
564
  children.push(this.makeBtn());
574
565
  }
575
566
 
576
- return h("div", {
567
+ return vue.createVNode("div", {
577
568
  "key": this.key('group')
578
- }, _toConsumableArray(children));
569
+ }, [children]);
579
570
  },
580
571
  makeItem: function makeItem(index, children) {
581
- var h = this.$createElement;
582
- return h("div", {
583
- "class": 'fc-files',
572
+ return vue.createVNode("div", {
573
+ "class": "fc-files",
584
574
  "key": this.key('file' + index)
585
- }, _toConsumableArray(children));
575
+ }, [children]);
586
576
  },
587
577
  valid: function valid(f) {
588
578
  var field = this.formCreateInject.field || this.field;
@@ -592,8 +582,6 @@
592
582
  }
593
583
  },
594
584
  makeIcons: function makeIcons(val, index) {
595
- var h = this.$createElement;
596
-
597
585
  if (this.handleIcon !== false || this.allowRemove === true) {
598
586
  var icons = [];
599
587
 
@@ -605,8 +593,8 @@
605
593
  icons.push(this.makeRemoveIcon(val, index));
606
594
  }
607
595
 
608
- return h("div", {
609
- "class": 'fc-upload-cover',
596
+ return vue.createVNode("div", {
597
+ "class": "fc-upload-cover",
610
598
  "key": this.key('uc')
611
599
  }, [icons]);
612
600
  }
@@ -614,76 +602,66 @@
614
602
  makeHandleIcon: function makeHandleIcon(val, index) {
615
603
  var _this2 = this;
616
604
 
617
- var h = this.$createElement;
618
- return h("i", {
605
+ return vue.createVNode("i", {
619
606
  "class": this.handleIcon === true || this.handleIcon === undefined ? 'el-icon-view' : this.handleIcon,
620
- "on": {
621
- "click": function click() {
622
- return _this2.handleClick(val);
623
- }
607
+ "onClick": function onClick() {
608
+ return _this2.handleClick(val);
624
609
  },
625
610
  "key": this.key('hi' + index)
626
- });
611
+ }, null);
627
612
  },
628
613
  makeRemoveIcon: function makeRemoveIcon(val, index) {
629
614
  var _this3 = this;
630
615
 
631
- var h = this.$createElement;
632
- return h("i", {
616
+ return vue.createVNode("i", {
633
617
  "class": "el-icon-delete",
634
- "on": {
635
- "click": function click() {
636
- return _this3.handleRemove(val);
637
- }
618
+ "onClick": function onClick() {
619
+ return _this3.handleRemove(val);
638
620
  },
639
621
  "key": this.key('ri' + index)
640
- });
622
+ }, null);
641
623
  },
642
624
  makeFiles: function makeFiles() {
643
625
  var _this4 = this;
644
626
 
645
- var h = this.$createElement;
646
627
  return this.makeGroup(this.fileList.map(function (src, index) {
647
- return _this4.makeItem(index, [h("i", {
628
+ return _this4.makeItem(index, [vue.createVNode("i", {
648
629
  "class": "el-icon-tickets",
649
- "on": {
650
- "click": function click() {
651
- return _this4.handleClick(src);
652
- }
630
+ "onClick": function onClick() {
631
+ return _this4.handleClick(src);
653
632
  }
654
- }), _this4.makeIcons(src, index)]);
633
+ }, null), _this4.makeIcons(src, index)]);
655
634
  }));
656
635
  },
657
636
  makeImages: function makeImages() {
658
637
  var _this5 = this;
659
638
 
660
- var h = this.$createElement;
661
639
  return this.makeGroup(this.fileList.map(function (src, index) {
662
- return _this5.makeItem(index, [h("img", {
663
- "attrs": {
664
- "src": _this5.getSrc(src)
665
- }
666
- }), _this5.makeIcons(src, index)]);
640
+ return _this5.makeItem(index, [vue.createVNode("img", {
641
+ "src": _this5.getSrc(src)
642
+ }, null), _this5.makeIcons(src, index)]);
667
643
  }));
668
644
  },
669
645
  makeBtn: function makeBtn() {
670
646
  var _this6 = this;
671
647
 
672
- var h = this.$createElement;
673
- return h("div", {
674
- "class": 'fc-upload-btn',
675
- "on": {
676
- "click": function click() {
677
- return _this6.showModel();
678
- }
648
+ return vue.createVNode("div", {
649
+ "class": "fc-upload-btn",
650
+ "onClick": function onClick() {
651
+ return _this6.showModel();
679
652
  },
680
653
  "key": this.key('btn')
681
- }, [h("i", {
654
+ }, [vue.createVNode("i", {
682
655
  "class": this.icon
683
- })]);
656
+ }, null)]);
684
657
  },
685
658
  handleClick: function handleClick(src) {
686
- return this.onHandle(src);
659
+ if (this.onHandle) {
660
+ return this.onHandle(src);
661
+ } else {
662
+ this.previewImage = this.getSrc(src);
663
+ this.previewVisible = true;
664
+ }
687
665
  },
688
666
  handleRemove: function handleRemove(src) {
689
667
  if (this.disabled) {
@@ -692,6 +670,7 @@
692
670
 
693
671
  if (false !== this.onBeforeRemove(src)) {
694
672
  this.fileList.splice(this.fileList.indexOf(src), 1);
673
+ this.input();
695
674
  this.onRemove(src);
696
675
  }
697
676
  },
@@ -714,29 +693,28 @@
714
693
  set: function set(field, value) {
715
694
  _this7.valid(field);
716
695
 
717
- if (!_this7.disabled) _this7.$emit('input', value);
696
+ !_this7.disabled && _this7.$emit('update:modelValue', value);
718
697
  },
719
698
  get: function get(field) {
720
699
  _this7.valid(field);
721
700
 
722
- return _this7.value;
701
+ return _this7.modelValue;
723
702
  },
724
703
  onOk: function onOk(fn) {
725
- return _this7.$on('$ok', fn);
704
+ return _this7.bus.$on('$ok', fn);
726
705
  },
727
706
  onClose: function onClose(fn) {
728
- return _this7.$on('$close', fn);
707
+ return _this7.bus.$on('$close', fn);
729
708
  }
730
709
  };
731
710
  }
732
711
  } catch (e) {
733
- console.log(e);
712
+ console.error(e);
734
713
  }
735
714
  },
736
715
  makeFooter: function makeFooter() {
737
716
  var _this8 = this;
738
717
 
739
- var h = this.$createElement;
740
718
  var _this$$props = this.$props,
741
719
  okBtnText = _this$$props.okBtnText,
742
720
  closeBtnText = _this$$props.closeBtnText,
@@ -748,30 +726,29 @@
748
726
  return;
749
727
  }
750
728
 
751
- return h("div", {
752
- "slot": "footer"
753
- }, [closeBtn ? h("ElButton", {
754
- "on": {
755
- "click": function click() {
756
- return _this8.onCancel() !== false && (_this8.frameVisible = false);
757
- }
729
+ return vue.createVNode("div", null, [closeBtn ? vue.createVNode(vue.resolveComponent("ElButton"), {
730
+ "onClick": function onClick() {
731
+ return _this8.onCancel() !== false && (_this8.frameVisible = false);
758
732
  }
759
- }, [closeBtnText]) : null, okBtn ? h("ElButton", {
760
- "attrs": {
761
- "type": "primary"
762
- },
763
- "on": {
764
- "click": function click() {
765
- return _this8.onOk() !== false && _this8.closeModel();
766
- }
733
+ }, _isSlot$1(closeBtnText) ? closeBtnText : {
734
+ "default": function _default() {
735
+ return [closeBtnText];
767
736
  }
768
- }, [okBtnText]) : null]);
737
+ }) : null, okBtn ? vue.createVNode(vue.resolveComponent("ElButton"), {
738
+ "type": "primary",
739
+ "onClick": function onClick() {
740
+ return _this8.onOk() !== false && _this8.closeModel();
741
+ }
742
+ }, _isSlot$1(okBtnText) ? okBtnText : {
743
+ "default": function _default() {
744
+ return [okBtnText];
745
+ }
746
+ }) : null]);
769
747
  }
770
748
  },
771
749
  render: function render() {
772
750
  var _this9 = this;
773
751
 
774
- var h = arguments[0];
775
752
  var type = this.type;
776
753
  var node;
777
754
 
@@ -790,187 +767,206 @@
790
767
  src = _this$$props2.src,
791
768
  title = _this$$props2.title,
792
769
  modalTitle = _this$$props2.modalTitle;
793
- this.$nextTick(function () {
770
+ vue.nextTick(function () {
794
771
  if (_this9.$refs.frame) {
795
772
  _this9.frameLoad(_this9.$refs.frame.contentWindow || {});
796
773
  }
797
774
  });
798
- return h("div", {
775
+ return vue.createVNode("div", {
799
776
  "class": "_fc-frame"
800
- }, [node, h("el-dialog", {
801
- "attrs": {
802
- "appendToBody": true,
803
- "modal": this.previewMask,
804
- "title": modalTitle,
805
- "visible": this.previewVisible
806
- },
807
- "on": {
808
- "close": this.handleCancel
809
- }
810
- }, [h("img", {
811
- "attrs": {
812
- "alt": "example",
813
- "src": this.previewImage
814
- },
815
- "style": "width: 100%"
816
- })]), h("el-dialog", helper([{
817
- "attrs": {
818
- "appendToBody": true
819
- }
777
+ }, [node, vue.createVNode(vue.resolveComponent("ElDialog"), {
778
+ "appendToBody": true,
779
+ "modal": this.previewMask,
780
+ "title": modalTitle,
781
+ "modelValue": this.previewVisible,
782
+ "onClose": this.handleCancel
820
783
  }, {
821
- "props": _objectSpread2({
822
- width: width,
823
- title: title
824
- }, this.modal)
825
- }, {
826
- "attrs": {
827
- "visible": this.frameVisible
828
- },
829
- "on": {
830
- "close": function close() {
831
- return _this9.closeModel(true);
832
- }
784
+ "default": function _default() {
785
+ return [vue.createVNode("img", {
786
+ "alt": "example",
787
+ "style": "width: 100%",
788
+ "src": _this9.previewImage
789
+ }, null)];
833
790
  }
834
- }]), [this.frameVisible || !this.reload ? h("iframe", {
835
- "ref": "frame",
836
- "attrs": {
837
- "src": src,
838
- "frameBorder": "0"
791
+ }), vue.createVNode(vue.resolveComponent("ElDialog"), vue.mergeProps({
792
+ "appendToBody": true
793
+ }, _objectSpread2({
794
+ width: width,
795
+ title: title
796
+ }, this.modal), {
797
+ "modelValue": this.frameVisible,
798
+ "onClose": function onClose() {
799
+ return _this9.closeModel(true);
800
+ }
801
+ }), {
802
+ "default": function _default() {
803
+ return [_this9.frameVisible || !_this9.reload ? vue.createVNode("iframe", {
804
+ "ref": "frame",
805
+ "src": src,
806
+ "frameBorder": "0",
807
+ "style": {
808
+ 'height': height,
809
+ 'border': '0 none',
810
+ 'width': '100%'
811
+ }
812
+ }, null) : null];
839
813
  },
840
- "style": {
841
- 'height': height,
842
- 'border': '0 none',
843
- 'width': '100%'
814
+ footer: function footer() {
815
+ return _this9.makeFooter();
844
816
  }
845
- }) : null, this.makeFooter()])]);
817
+ })]);
846
818
  },
847
- mounted: function mounted() {
848
- this.$on('fc.closeModal', this.closeModal);
819
+ beforeMount: function beforeMount() {
820
+ var _this$formCreateInjec = this.formCreateInject,
821
+ name = _this$formCreateInjec.name,
822
+ field = _this$formCreateInjec.field,
823
+ api = _this$formCreateInjec.api;
824
+ name && api.on('fc:closeModal:' + name, this.close);
825
+ field && api.on('fc:closeModal:' + field, this.close);
826
+ },
827
+ beforeUnmount: function beforeUnmount() {
828
+ var _this$formCreateInjec2 = this.formCreateInject,
829
+ name = _this$formCreateInjec2.name,
830
+ field = _this$formCreateInjec2.field,
831
+ api = _this$formCreateInjec2.api;
832
+ name && api.off('fc:closeModal:' + name, this.close);
833
+ field && api.off('fc:closeModal:' + field, this.close);
849
834
  }
850
- };
835
+ });
851
836
 
852
- var NAME$2 = 'fcRadio';
853
- var Radio = {
854
- name: NAME$2,
837
+ var NAME$8 = 'fcRadio';
838
+ var Radio = vue.defineComponent({
839
+ name: NAME$8,
840
+ inheritAttrs: false,
855
841
  props: {
856
- formCreateInject: {
857
- type: Object,
858
- required: true
842
+ modelValue: {
843
+ type: [String, Number],
844
+ "default": function _default() {
845
+ return [];
846
+ }
859
847
  },
860
- value: {},
861
848
  type: String
862
849
  },
863
- watch: {
864
- value: function value() {
865
- this.update();
866
- }
867
- },
868
- data: function data() {
869
- return {
870
- trueValue: []
871
- };
872
- },
873
- computed: {
874
- options: function options() {
875
- var opt = this.formCreateInject.options;
876
- return Array.isArray(opt) ? opt : [];
877
- }
878
- },
879
- methods: {
880
- onInput: function onInput(n) {
881
- this.$emit('input', this.options.filter(function (opt) {
882
- return opt.label === n;
883
- }).reduce(function (initial, opt) {
884
- return opt.value;
885
- }, ''));
886
- },
887
- update: function update() {
888
- var _this = this;
850
+ emits: ['update:modelValue'],
851
+ setup: function setup(props, _) {
852
+ var _toRefs = vue.toRefs(vue.inject('formCreateInject')),
853
+ options = _toRefs.options;
854
+
855
+ var trueValue = vue.ref([]);
856
+ var value = vue.toRef(props, 'modelValue');
857
+
858
+ var _options = vue.computed(function () {
859
+ return Array.isArray(options) ? options : [];
860
+ });
889
861
 
890
- this.trueValue = this.options.filter(function (opt) {
891
- return opt.value === _this.value;
862
+ var update = function update() {
863
+ trueValue.value = _options.value.filter(function (opt) {
864
+ return opt.value === value.value;
892
865
  }).reduce(function (initial, opt) {
893
866
  return opt.label;
894
867
  }, '');
895
- }
896
- },
897
- created: function created() {
898
- this.update();
899
- },
900
- render: function render() {
901
- var _this2 = this;
868
+ };
902
869
 
903
- var h = arguments[0];
904
- return h("ElRadioGroup", helper([{}, this.formCreateInject.prop, {
905
- "attrs": {
906
- "value": this.trueValue
870
+ update();
871
+ return {
872
+ options: _options,
873
+ trueValue: trueValue,
874
+ value: value,
875
+ onInput: function onInput(n) {
876
+ _.emit('update:modelValue', _options.value.filter(function (opt) {
877
+ return opt.label === n;
878
+ }).reduce(function (initial, opt) {
879
+ return opt.value;
880
+ }, ''));
907
881
  },
908
- "on": {
909
- "input": this.onInput
910
- }
911
- }]), [this.options.map(function (opt, index) {
912
- var props = _objectSpread2({}, opt);
913
-
914
- var Type = _this2.type === 'button' ? 'ElRadioButton' : 'ElRadio';
915
- delete props.value;
916
- return h(Type, {
917
- "props": _objectSpread2({}, props),
918
- "key": Type + index + opt.value
919
- });
920
- }), getSlot(this.$slots)]);
921
- }
922
- };
923
-
924
- var is = {
925
- type: function type(arg, _type) {
926
- return Object.prototype.toString.call(arg) === '[object ' + _type + ']';
927
- },
928
- Undef: function Undef(v) {
929
- return v === undefined || v === null;
882
+ update: update
883
+ };
930
884
  },
931
- Element: function Element(arg) {
932
- return _typeof(arg) === 'object' && arg !== null && arg.nodeType === 1 && !is.Object(arg);
885
+ watch: {
886
+ modelValue: function modelValue() {
887
+ this.update();
888
+ }
933
889
  },
934
- trueArray: function trueArray(data) {
935
- return Array.isArray(data) && data.length > 0;
890
+ render: function render() {
891
+ var _this$$slots$default,
892
+ _this$$slots,
893
+ _this = this;
894
+
895
+ var name = this.type === 'button' ? 'ElRadioButton' : 'ElRadio';
896
+ var Type = vue.resolveComponent(name);
897
+ return vue.createVNode(vue.resolveComponent("ElRadioGroup"), vue.mergeProps(this.$attrs, {
898
+ "modelValue": this.trueValue,
899
+ "onUpdate:modelValue": this.onInput
900
+ }), _objectSpread2({
901
+ "default": function _default() {
902
+ return [_this.options.map(function (opt, index) {
903
+ var props = _objectSpread2({}, opt);
904
+
905
+ delete props.value;
906
+ return vue.createVNode(Type, vue.mergeProps(props, {
907
+ "key": name + index + opt.value
908
+ }), null);
909
+ }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
910
+ }
911
+ }, getSlot(this.$slots, ['default'])));
936
912
  }
937
- };
938
- ['Date', 'Object', 'Function', 'String', 'Boolean', 'Array', 'Number'].forEach(function (t) {
939
- is[t] = function (arg) {
940
- return is.type(arg, t);
941
- };
942
913
  });
943
- function hasProperty(rule, k) {
944
- return {}.hasOwnProperty.call(rule, k);
945
- }
946
914
 
947
- var NAME$3 = 'fcSelect';
948
- var Select = {
949
- name: NAME$3,
950
- functional: true,
915
+ var NAME$7 = 'fcSelect';
916
+ var Select = vue.defineComponent({
917
+ name: NAME$7,
918
+ inheritAttrs: false,
951
919
  props: {
952
- formCreateInject: {
953
- type: Object,
954
- required: true
955
- }
920
+ modelValue: {
921
+ type: Array,
922
+ "default": function _default() {
923
+ return [];
924
+ }
925
+ },
926
+ type: String
956
927
  },
957
- render: function render(h, ctx) {
958
- var options = ctx.props.formCreateInject.options;
959
- return h("ElSelect", helper([{}, ctx.data]), [(Array.isArray(options) ? options : []).map(function (props, index) {
960
- var slot = props.slot;
961
- return h("ElOption", {
962
- "props": _objectSpread2({}, props),
963
- "key": '' + index + props.value
964
- }, [slot ? h("template", {
965
- "slot": props.slotName || 'default'
966
- }, [is.Function(slot) ? props.slot(h) : slot]) : null]);
967
- }), ctx.children]);
928
+ emits: ['update:modelValue'],
929
+ setup: function setup(props) {
930
+ var _toRefs = vue.toRefs(vue.inject('formCreateInject')),
931
+ options = _toRefs.options;
932
+
933
+ var value = vue.toRef(props, 'modelValue');
934
+
935
+ var _options = vue.computed(function () {
936
+ return Array.isArray(options) ? options : [];
937
+ });
938
+
939
+ return {
940
+ options: _options,
941
+ value: value
942
+ };
943
+ },
944
+ render: function render() {
945
+ var _this = this,
946
+ _this$$slots$default,
947
+ _this$$slots;
948
+
949
+ return vue.createVNode(vue.resolveComponent("ElSelect"), vue.mergeProps(this.$attrs, {
950
+ "modelValue": this.value,
951
+ "onUpdate:modelValue": function onUpdateModelValue(v) {
952
+ return _this.$emit('update:modelValue', v);
953
+ }
954
+ }), _objectSpread2({
955
+ "default": function _default() {
956
+ return [_this.options.map(function (props, index) {
957
+ return vue.createVNode(vue.resolveComponent("ElOption"), vue.mergeProps(props, {
958
+ "key": '' + index + props.value
959
+ }), null);
960
+ }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
961
+ }
962
+ }, getSlot(this.$slots, ['default'])));
968
963
  }
969
- };
964
+ });
970
965
 
971
- var NAME$4 = 'fcTree';
972
- var Tree = {
973
- name: NAME$4,
966
+ var NAME$6 = 'fcTree';
967
+ var Tree = vue.defineComponent({
968
+ name: NAME$6,
969
+ inheritAttrs: false,
974
970
  formCreateParser: {
975
971
  mergeProp: function mergeProp(ctx) {
976
972
  var props = ctx.prop.props;
@@ -981,75 +977,57 @@
981
977
  }
982
978
  },
983
979
  props: {
984
- formCreateInject: {
985
- type: Object,
986
- required: true
987
- },
988
- type: {
989
- type: String,
990
- "default": 'checked'
991
- },
992
- value: {
980
+ type: String,
981
+ modelValue: {
993
982
  type: [Array, String, Number],
994
983
  "default": function _default() {
995
984
  return [];
996
985
  }
997
986
  }
998
987
  },
988
+ emits: ['update:modelValue'],
999
989
  watch: {
1000
- value: function value() {
990
+ modelValue: function modelValue() {
1001
991
  this.setValue();
1002
992
  }
1003
993
  },
1004
994
  methods: {
1005
- onChange: function onChange() {
1006
- this.updateValue();
1007
- },
1008
995
  updateValue: function updateValue() {
1009
996
  if (!this.$refs.tree) return;
1010
- var type = this.type.toLocaleLowerCase();
1011
997
  var value;
1012
998
 
1013
- if (type === 'selected') {
999
+ if (this.type === 'selected') {
1014
1000
  value = this.$refs.tree.getCurrentKey();
1015
1001
  } else {
1016
1002
  value = this.$refs.tree.getCheckedKeys();
1017
1003
  }
1018
1004
 
1019
- this.$emit('input', value);
1005
+ this.$emit('update:modelValue', value);
1020
1006
  },
1021
1007
  setValue: function setValue() {
1022
- var type = this.type.toLocaleLowerCase();
1008
+ if (!this.$refs.tree) return;
1009
+ var type = this.type;
1023
1010
 
1024
1011
  if (type === 'selected') {
1025
- this.$refs.tree.setCurrentKey(this.value);
1012
+ this.$refs.tree.setCurrentKey(this.modelValue);
1026
1013
  } else {
1027
- this.$refs.tree.setCheckedKeys(toArray(this.value));
1014
+ this.$refs.tree.setCheckedKeys(toArray(this.modelValue));
1028
1015
  }
1029
1016
  }
1030
1017
  },
1031
1018
  render: function render() {
1032
- var _this = this;
1033
-
1034
- var h = arguments[0];
1035
- return h("ElTree", helper([{}, this.formCreateInject.prop, {
1019
+ return vue.createVNode(vue.resolveComponent("ElTree"), vue.mergeProps(this.$attrs, {
1036
1020
  "ref": "tree",
1037
- "on": {
1038
- "check": function check() {
1039
- return _this.updateValue();
1040
- },
1041
- "node-click": function nodeClick() {
1042
- return _this.updateValue();
1043
- }
1044
- }
1045
- }]), [getSlot(this.$slots)]);
1021
+ "onCheck": this.updateValue,
1022
+ "onNode-click": this.updateValue
1023
+ }), this.$slots);
1046
1024
  },
1047
1025
  mounted: function mounted() {
1048
1026
  this.setValue();
1049
1027
  }
1050
- };
1028
+ });
1051
1029
 
1052
- var css_248z$1 = "._fc-upload .fc-files img {\n width: 100%;\n height: 100%;\n display: inline-block;\n vertical-align: top;\n}\n\n._fc-upload .fc-upload-btn {\n border: 1px dashed #c0ccda;\n cursor: pointer;\n}\n\n._fc-upload .fc-upload-cover {\n opacity: 0;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n background: rgba(0, 0, 0, .6);\n -webkit-transition: opacity .3s;\n -o-transition: opacity .3s;\n transition: opacity .3s;\n}\n\n._fc-upload .fc-upload-cover i {\n color: #fff;\n font-size: 20px;\n cursor: pointer;\n margin: 0 2px;\n}\n\n._fc-upload .fc-files:hover .fc-upload-cover {\n opacity: 1;\n}\n\n._fc-upload .el-upload {\n display: block;\n}\n\n._fc-upload .fc-upload-btn, ._fc-upload .fc-files {\n display: inline-block;\n width: 58px;\n height: 58px;\n text-align: center;\n line-height: 58px;\n border: 1px solid #c0ccda;\n border-radius: 4px;\n overflow: hidden;\n background: #fff;\n position: relative;\n -webkit-box-shadow: 2px 2px 5px rgba(0, 0, 0, .1);\n box-shadow: 2px 2px 5px rgba(0, 0, 0, .1);\n margin-right: 4px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n}\n";
1030
+ 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}";
1053
1031
  styleInject(css_248z$1);
1054
1032
 
1055
1033
  function parseFile(file, i) {
@@ -1065,20 +1043,11 @@
1065
1043
  }
1066
1044
 
1067
1045
  var NAME$5 = 'fcUpload';
1068
- var Upload = {
1046
+ var Upload = vue.defineComponent({
1069
1047
  name: NAME$5,
1048
+ inheritAttrs: false,
1070
1049
  props: {
1071
- formCreateInject: {
1072
- type: Object,
1073
- required: true
1074
- },
1075
- onHandle: {
1076
- type: Function,
1077
- "default": function _default(file) {
1078
- this.previewImage = file.url;
1079
- this.previewVisible = true;
1080
- }
1081
- },
1050
+ onHandle: Function,
1082
1051
  uploadType: {
1083
1052
  type: String,
1084
1053
  "default": 'file'
@@ -1093,36 +1062,31 @@
1093
1062
  },
1094
1063
  previewMask: undefined,
1095
1064
  modalTitle: String,
1096
- handleIcon: {
1097
- type: [String, Boolean],
1098
- "default": function _default() {
1099
- return undefined;
1100
- }
1101
- },
1102
- value: [Array, String]
1065
+ handleIcon: [String, Boolean],
1066
+ modelValue: [Array, String]
1103
1067
  },
1068
+ emits: ['update:modelValue'],
1104
1069
  data: function data() {
1105
1070
  return {
1106
1071
  uploadList: [],
1107
1072
  previewVisible: false,
1108
- previewImage: ''
1073
+ previewImage: '',
1074
+ fileList: []
1109
1075
  };
1110
1076
  },
1111
1077
  created: function created() {
1112
- if (this.formCreateInject.prop.props.showFileList === undefined) {
1113
- this.formCreateInject.prop.props.showFileList = false;
1114
- }
1115
-
1116
- this.formCreateInject.prop.props.fileList = toArray(this.value).map(parseFile);
1078
+ this.fileList = toArray(this.modelValue).map(parseFile);
1117
1079
  },
1118
1080
  watch: {
1119
- value: function value(n) {
1081
+ modelValue: function modelValue(n) {
1120
1082
  if (this.$refs.upload.uploadFiles.every(function (file) {
1121
1083
  return !file.status || file.status === 'success';
1122
1084
  })) {
1123
1085
  this.$refs.upload.uploadFiles = toArray(n).map(parseFile);
1124
1086
  this.uploadList = this.$refs.upload.uploadFiles;
1125
1087
  }
1088
+
1089
+ this.fileList = toArray(n).map(parseFile);
1126
1090
  },
1127
1091
  limit: function limit(n, o) {
1128
1092
  if (o === 1 || n === 1) {
@@ -1135,7 +1099,7 @@
1135
1099
  return unique;
1136
1100
  },
1137
1101
  isDisabled: function isDisabled() {
1138
- return this.formCreateInject.prop.props.disabled === true;
1102
+ return this.$attrs.disabled === true;
1139
1103
  },
1140
1104
  onRemove: function onRemove(file) {
1141
1105
  if (this.isDisabled()) {
@@ -1145,63 +1109,55 @@
1145
1109
  this.$refs.upload.handleRemove(file);
1146
1110
  },
1147
1111
  handleClick: function handleClick(file) {
1148
- this.onHandle(file);
1112
+ if (this.onHandle) {
1113
+ return this.onHandle(file);
1114
+ } else {
1115
+ this.previewImage = file.url;
1116
+ this.previewVisible = true;
1117
+ }
1149
1118
  },
1150
1119
  makeItem: function makeItem(file, index) {
1151
- var h = this.$createElement;
1152
- return this.uploadType === 'image' ? h("img", {
1153
- "attrs": {
1154
- "src": file.url
1155
- },
1120
+ return this.uploadType === 'image' ? vue.createVNode("img", {
1121
+ "src": file.url,
1156
1122
  "key": this.key('img' + index)
1157
- }) : h("i", {
1158
- "class": "el-icon-tickets",
1123
+ }, null) : vue.createVNode("i", {
1124
+ "class": "el-icon-document",
1159
1125
  "key": this.key('i' + index)
1160
- });
1126
+ }, null);
1161
1127
  },
1162
1128
  makeRemoveIcon: function makeRemoveIcon(file, index) {
1163
1129
  var _this = this;
1164
1130
 
1165
- var h = this.$createElement;
1166
- return h("i", {
1131
+ return vue.createVNode("i", {
1167
1132
  "class": "el-icon-delete",
1168
- "on": {
1169
- "click": function click() {
1170
- return _this.onRemove(file);
1171
- }
1133
+ "onClick": function onClick() {
1134
+ return _this.onRemove(file);
1172
1135
  },
1173
1136
  "key": this.key('ri' + index)
1174
- });
1137
+ }, null);
1175
1138
  },
1176
1139
  makeHandleIcon: function makeHandleIcon(file, index) {
1177
1140
  var _this2 = this;
1178
1141
 
1179
- var h = this.$createElement;
1180
- return h("i", {
1142
+ return vue.createVNode("i", {
1181
1143
  "class": this.handleIcon === true || this.handleIcon === undefined ? 'el-icon-view' : this.handleIcon,
1182
- "on": {
1183
- "click": function click() {
1184
- return _this2.handleClick(file);
1185
- }
1144
+ "onClick": function onClick() {
1145
+ return _this2.handleClick(file);
1186
1146
  },
1187
1147
  "key": this.key('hi' + index)
1188
- });
1148
+ }, null);
1189
1149
  },
1190
1150
  makeProgress: function makeProgress(file, index) {
1191
- var h = this.$createElement;
1192
- return h("ElProgress", helper([{}, {
1193
- "props": {
1194
- percentage: file.percentage,
1195
- type: 'circle',
1196
- width: 52
1197
- }
1151
+ return vue.createVNode(vue.resolveComponent("ElProgress"), vue.mergeProps({
1152
+ percentage: file.percentage,
1153
+ type: 'circle',
1154
+ width: 52
1198
1155
  }, {
1199
1156
  "style": "margin-top:2px;",
1200
1157
  "key": this.key('pg' + index)
1201
- }]));
1158
+ }), null);
1202
1159
  },
1203
1160
  makeIcons: function makeIcons(file, index) {
1204
- var h = this.$createElement;
1205
1161
  var icons = [];
1206
1162
 
1207
1163
  if (this.allowRemove || this.handleIcon !== false) {
@@ -1213,7 +1169,7 @@
1213
1169
  icons.push(this.makeRemoveIcon(file, index));
1214
1170
  }
1215
1171
 
1216
- return h("div", {
1172
+ return vue.createVNode("div", {
1217
1173
  "class": 'fc-upload-cover'
1218
1174
  }, [icons]);
1219
1175
  }
@@ -1221,34 +1177,36 @@
1221
1177
  makeFiles: function makeFiles() {
1222
1178
  var _this3 = this;
1223
1179
 
1224
- var h = this.$createElement;
1225
1180
  return this.uploadList.map(function (file, index) {
1226
- return _this3.$scopedSlots.fileList ? _this3.$scopedSlots.fileList({
1227
- file: file,
1228
- index: index,
1229
- vm: _this3
1230
- }) : h("div", {
1181
+ return vue.createVNode("div", {
1231
1182
  "key": _this3.key(index),
1232
1183
  "class": 'fc-files'
1233
1184
  }, [file.percentage !== undefined && file.status !== 'success' ? _this3.makeProgress(file, index) : [_this3.makeItem(file, index), _this3.makeIcons(file, index)]]);
1234
1185
  });
1235
1186
  },
1236
1187
  makeUpload: function makeUpload() {
1237
- var h = this.$createElement;
1188
+ var _this$$slots$default,
1189
+ _this$$slots,
1190
+ _this4 = this;
1191
+
1238
1192
  var isShow = !this.limit || this.limit > this.uploadList.length;
1239
- return h("ElUpload", helper([{}, this.formCreateInject.prop, {
1193
+ return vue.createVNode(vue.resolveComponent("ElUpload"), vue.mergeProps(this.$attrs, {
1194
+ "showFileList": false,
1195
+ "fileList": this.fileList,
1240
1196
  "ref": "upload",
1241
1197
  "style": {
1242
1198
  display: 'inline-block'
1243
1199
  },
1244
1200
  "key": this.key('upload')
1245
- }]), [isShow ? h("template", {
1246
- "slot": "default"
1247
- }, [this.$slots["default"] || h("div", {
1248
- "class": 'fc-upload-btn'
1249
- }, [h("i", {
1250
- "class": "el-icon-upload2"
1251
- })])]) : null, getSlot(this.$slots, ['default'])]);
1201
+ }), _objectSpread2({
1202
+ "default": function _default() {
1203
+ 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", {
1204
+ "class": 'fc-upload-btn'
1205
+ }, [vue.createVNode("i", {
1206
+ "class": "el-icon-upload2"
1207
+ }, null)]) : undefined];
1208
+ }
1209
+ }, getSlot(this.$slots, ['default'])));
1252
1210
  },
1253
1211
  update: function update() {
1254
1212
  var files = this.$refs.upload.uploadFiles.map(function (file) {
@@ -1256,70 +1214,82 @@
1256
1214
  }).filter(function (url) {
1257
1215
  return url !== undefined;
1258
1216
  });
1259
- this.$emit('input', this.limit === 1 ? files[0] || '' : files);
1217
+ this.$emit('update:modelValue', this.limit === 1 ? files[0] || '' : files);
1260
1218
  },
1261
1219
  handleCancel: function handleCancel() {
1262
1220
  this.previewVisible = false;
1263
1221
  }
1264
1222
  },
1265
1223
  render: function render() {
1266
- var h = arguments[0];
1267
-
1268
- if (this.$refs.upload) {
1269
- if (this.formCreateInject.prop.props.showFileList === undefined) {
1270
- this.formCreateInject.prop.props.showFileList = this.$refs.upload.showFileList;
1271
- }
1224
+ var _this5 = this;
1272
1225
 
1273
- this.formCreateInject.prop.props.fileList = this.$refs.upload.fileList;
1274
- }
1275
-
1276
- return h("div", {
1226
+ return vue.createVNode("div", {
1277
1227
  "class": '_fc-upload'
1278
- }, [[this.formCreateInject.prop.props.showFileList ? [] : this.makeFiles(), this.makeUpload()], h("el-dialog", {
1279
- "attrs": {
1280
- "appendToBody": true,
1281
- "modal": this.previewMask,
1282
- "title": this.modalTitle,
1283
- "visible": this.previewVisible
1284
- },
1285
- "on": {
1286
- "close": this.handleCancel
1228
+ }, [[this.$attrs.showFileList ? [] : this.makeFiles(), this.makeUpload()], vue.createVNode(vue.resolveComponent("ElDialog"), {
1229
+ "appendToBody": true,
1230
+ "modal": this.previewMask,
1231
+ "title": this.modalTitle,
1232
+ "modelValue": this.previewVisible,
1233
+ "onClose": this.handleCancel
1234
+ }, {
1235
+ "default": function _default() {
1236
+ return [vue.createVNode("img", {
1237
+ "alt": "example",
1238
+ "style": "width: 100%",
1239
+ "src": _this5.previewImage
1240
+ }, null)];
1287
1241
  }
1288
- }, [h("img", {
1289
- "attrs": {
1290
- "alt": "example",
1291
- "src": this.previewImage
1292
- },
1293
- "style": "width: 100%"
1294
- })])]);
1242
+ })]);
1295
1243
  },
1296
1244
  mounted: function mounted() {
1297
- var _this4 = this;
1245
+ var _this6 = this;
1298
1246
 
1299
1247
  this.uploadList = this.$refs.upload.uploadFiles;
1300
1248
  this.$watch(function () {
1301
- return _this4.$refs.upload.uploadFiles;
1249
+ return _this6.$refs.upload.uploadFiles;
1302
1250
  }, function () {
1303
- _this4.update();
1251
+ _this6.update();
1304
1252
  }, {
1305
1253
  deep: true
1306
1254
  });
1307
1255
  }
1256
+ });
1257
+
1258
+ var is = {
1259
+ type: function type(arg, _type) {
1260
+ return Object.prototype.toString.call(arg) === '[object ' + _type + ']';
1261
+ },
1262
+ Undef: function Undef(v) {
1263
+ return v === undefined || v === null;
1264
+ },
1265
+ Element: function Element(arg) {
1266
+ return _typeof(arg) === 'object' && arg !== null && arg.nodeType === 1 && !is.Object(arg);
1267
+ },
1268
+ trueArray: function trueArray(data) {
1269
+ return Array.isArray(data) && data.length > 0;
1270
+ }
1308
1271
  };
1272
+ ['Date', 'Object', 'Function', 'String', 'Boolean', 'Array', 'Number'].forEach(function (t) {
1273
+ is[t] = function (arg) {
1274
+ return is.type(arg, t);
1275
+ };
1276
+ });
1277
+ function hasProperty(rule, k) {
1278
+ return {}.hasOwnProperty.call(rule, k);
1279
+ }
1309
1280
 
1310
- var NAME$6 = 'fcGroup';
1311
- var Group = {
1312
- name: NAME$6,
1281
+ function _isSlot(s) {
1282
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
1283
+ }
1284
+
1285
+ var NAME$4 = 'fcGroup';
1286
+ var Group = vue.defineComponent({
1287
+ name: NAME$4,
1313
1288
  props: {
1314
1289
  field: String,
1315
- rule: [Array, Object],
1316
- rules: Array,
1290
+ rule: Array,
1317
1291
  expand: Number,
1318
1292
  options: Object,
1319
- formCreateInject: {
1320
- type: Object,
1321
- required: true
1322
- },
1323
1293
  button: {
1324
1294
  type: Boolean,
1325
1295
  "default": true
@@ -1332,7 +1302,7 @@
1332
1302
  type: Number,
1333
1303
  "default": 0
1334
1304
  },
1335
- value: {
1305
+ modelValue: {
1336
1306
  type: Array,
1337
1307
  "default": function _default() {
1338
1308
  return [];
@@ -1359,27 +1329,16 @@
1359
1329
  "default": function _default() {}
1360
1330
  }
1361
1331
  },
1332
+ inject: ['formCreateInject'],
1362
1333
  data: function data() {
1363
1334
  return {
1364
1335
  len: 0,
1365
1336
  cacheRule: {},
1366
1337
  cacheValue: {},
1367
- type: undefined
1338
+ form: vue.markRaw(this.formCreateInject.form.$form())
1368
1339
  };
1369
1340
  },
1370
- computed: {
1371
- formRule: function formRule() {
1372
- if (this.rule) {
1373
- return Array.isArray(this.rule) ? this.rule : [this.rule];
1374
- }
1375
-
1376
- if (this.rules) {
1377
- return this.rules;
1378
- }
1379
-
1380
- return [];
1381
- }
1382
- },
1341
+ emits: ['update:modelValue', 'change', 'itemMounted', 'remove'],
1383
1342
  watch: {
1384
1343
  disabled: function disabled(n) {
1385
1344
  if (this.syncDisabled) {
@@ -1390,41 +1349,44 @@
1390
1349
  }
1391
1350
  },
1392
1351
  expand: function expand(n) {
1393
- var d = n - this.value.length;
1352
+ var d = n - this.modelValue.length;
1394
1353
 
1395
1354
  if (d > 0) {
1396
1355
  this.expandRule(d);
1397
1356
  }
1398
1357
  },
1399
- value: function value(n) {
1400
- var _this = this;
1358
+ modelValue: {
1359
+ handler: function handler(n) {
1360
+ var _this = this;
1401
1361
 
1402
- n = n || [];
1403
- var keys = Object.keys(this.cacheRule),
1404
- total = keys.length,
1405
- len = total - n.length;
1362
+ n = n || [];
1363
+ var keys = Object.keys(this.cacheRule),
1364
+ total = keys.length,
1365
+ len = total - n.length;
1406
1366
 
1407
- if (len < 0) {
1408
- for (var i = len; i < 0; i++) {
1409
- this.addRule(n.length + i);
1410
- }
1367
+ if (len < 0) {
1368
+ for (var i = len; i < 0; i++) {
1369
+ this.addRule(n.length + i);
1370
+ }
1411
1371
 
1412
- for (var _i = 0; _i < total; _i++) {
1413
- this.setValue(keys[_i], n[_i]);
1414
- }
1415
- } else {
1416
- if (len > 0) {
1417
- for (var _i2 = 0; _i2 < len; _i2++) {
1418
- this.removeRule(keys[total - _i2 - 1]);
1372
+ for (var _i = 0; _i < total; _i++) {
1373
+ this.setValue(keys[_i], n[_i]);
1419
1374
  }
1375
+ } else {
1376
+ if (len > 0) {
1377
+ for (var _i2 = 0; _i2 < len; _i2++) {
1378
+ this.removeRule(keys[total - _i2 - 1]);
1379
+ }
1420
1380
 
1421
- this.subForm();
1422
- }
1381
+ this.subForm();
1382
+ }
1423
1383
 
1424
- n.forEach(function (val, i) {
1425
- _this.setValue(keys[i], n[i]);
1426
- });
1427
- }
1384
+ n.forEach(function (val, i) {
1385
+ _this.setValue(keys[i], n[i]);
1386
+ });
1387
+ }
1388
+ },
1389
+ deep: true
1428
1390
  }
1429
1391
  },
1430
1392
  methods: {
@@ -1435,7 +1397,7 @@
1435
1397
  this.cacheValue[k] = JSON.stringify(val);
1436
1398
  },
1437
1399
  input: function input(value) {
1438
- this.$emit('input', value);
1400
+ this.$emit('update:modelValue', value);
1439
1401
  this.$emit('change', value);
1440
1402
  },
1441
1403
  formData: function formData(key, _formData) {
@@ -1461,8 +1423,7 @@
1461
1423
  this.input(value);
1462
1424
  },
1463
1425
  setValue: function setValue(key, value) {
1464
- var field = this.field,
1465
- $f = this.cacheRule[key].$f;
1426
+ var field = this.field;
1466
1427
 
1467
1428
  if (field) {
1468
1429
  value = _defineProperty({}, field, this._value(value));
@@ -1473,24 +1434,22 @@
1473
1434
  }
1474
1435
 
1475
1436
  this.cache(key, value);
1476
- $f.coverValue(value || {});
1477
1437
  },
1478
1438
  addRule: function addRule(i, emit) {
1479
1439
  var _this3 = this;
1480
1440
 
1481
- var rule = this.formCreateInject.form.copyRules(this.formRule);
1441
+ var rule = this.formCreateInject.form.copyRules(this.rule || []);
1482
1442
  var options = this.options ? _objectSpread2({}, this.options) : {
1483
1443
  submitBtn: false,
1484
1444
  resetBtn: false
1485
1445
  };
1486
- options.formData = this.field ? _defineProperty({}, this.field, this._value(this.value[i])) : this.value[i] || {};
1487
- this.$set(this.cacheRule, ++this.len, {
1446
+ this.cacheRule[++this.len] = {
1488
1447
  rule: rule,
1489
1448
  options: options
1490
- });
1449
+ };
1491
1450
 
1492
1451
  if (emit) {
1493
- this.$nextTick(function () {
1452
+ vue.nextTick(function () {
1494
1453
  return _this3.$emit('add', rule, Object.keys(_this3.cacheRule).length - 1);
1495
1454
  });
1496
1455
  }
@@ -1500,7 +1459,7 @@
1500
1459
 
1501
1460
  this.cacheRule[key].$f = $f;
1502
1461
  this.subForm();
1503
- this.$nextTick(function () {
1462
+ vue.nextTick(function () {
1504
1463
  if (_this4.syncDisabled) {
1505
1464
  $f.disabled(_this4.disabled);
1506
1465
  }
@@ -1519,63 +1478,58 @@
1519
1478
  var _this6 = this;
1520
1479
 
1521
1480
  var index = Object.keys(this.cacheRule).indexOf(key);
1522
- this.$delete(this.cacheRule, key);
1523
- this.$delete(this.cacheValue, key);
1481
+ delete this.cacheRule[key];
1482
+ delete this.cacheValue[key];
1524
1483
 
1525
1484
  if (emit) {
1526
- this.$nextTick(function () {
1485
+ vue.nextTick(function () {
1527
1486
  return _this6.$emit('remove', index);
1528
1487
  });
1529
1488
  }
1530
1489
  },
1531
- add: function add(i) {
1532
- if (this.disabled || false === this.onBeforeAdd(this.value)) {
1490
+ add: function add() {
1491
+ if (this.disabled || false === this.onBeforeAdd(this.modelValue)) {
1533
1492
  return;
1534
1493
  }
1535
1494
 
1536
- this.addRule(i, true);
1495
+ this.modelValue.push(this.field ? null : {});
1496
+ this.$emit('update:modelValue', this.modelValue);
1537
1497
  },
1538
1498
  del: function del(index, key) {
1539
- if (this.disabled || false === this.onBeforeRemove(this.value, index)) {
1499
+ if (this.disabled || false === this.onBeforeRemove(this.modelValue, index)) {
1540
1500
  return;
1541
1501
  }
1542
1502
 
1543
1503
  this.removeRule(key, true);
1544
1504
  this.subForm();
1545
- this.value.splice(index, 1);
1546
- this.input(this.value);
1505
+ this.modelValue.splice(index, 1);
1506
+ this.input(this.modelValue);
1547
1507
  },
1548
1508
  addIcon: function addIcon(key) {
1549
- var h = this.$createElement;
1550
- return h("i", {
1509
+ return vue.createVNode("i", {
1551
1510
  "key": "a".concat(key),
1552
1511
  "class": "el-icon-circle-plus-outline",
1553
1512
  "style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer', ";"),
1554
- "on": {
1555
- "click": this.add
1556
- }
1557
- });
1513
+ "onClick": this.add
1514
+ }, null);
1558
1515
  },
1559
1516
  delIcon: function delIcon(index, key) {
1560
1517
  var _this7 = this;
1561
1518
 
1562
- var h = this.$createElement;
1563
- return h("i", {
1519
+ return vue.createVNode("i", {
1564
1520
  "key": "d".concat(key),
1565
1521
  "class": "el-icon-remove-outline",
1566
1522
  "style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer;color:#606266', ";"),
1567
- "on": {
1568
- "click": function click() {
1569
- return _this7.del(index, key);
1570
- }
1523
+ "onClick": function onClick() {
1524
+ return _this7.del(index, key);
1571
1525
  }
1572
- });
1526
+ }, null);
1573
1527
  },
1574
1528
  makeIcon: function makeIcon(total, index, key) {
1575
1529
  var _this8 = this;
1576
1530
 
1577
- if (this.$scopedSlots.button) {
1578
- return this.$scopedSlots.button({
1531
+ if (this.$slots.button) {
1532
+ return this.$slots.button({
1579
1533
  total: total,
1580
1534
  index: index,
1581
1535
  vm: this,
@@ -1600,102 +1554,109 @@
1600
1554
  },
1601
1555
  expandRule: function expandRule(n) {
1602
1556
  for (var i = 0; i < n; i++) {
1603
- this.value.push(this.field ? null : {});
1557
+ this.modelValue.push(this.field ? null : {});
1604
1558
  }
1605
1559
  }
1606
1560
  },
1607
1561
  created: function created() {
1608
- this.type = this.formCreateInject.form.$form();
1609
- var d = (this.expand || 0) - this.value.length;
1562
+ var d = (this.expand || 0) - this.modelValue.length;
1610
1563
 
1611
1564
  if (d > 0) {
1612
1565
  this.expandRule(d);
1613
1566
  }
1614
1567
 
1615
- for (var i = 0; i < this.value.length; i++) {
1568
+ for (var i = 0; i < this.modelValue.length; i++) {
1616
1569
  this.addRule(i);
1617
1570
  }
1618
1571
  },
1619
1572
  render: function render() {
1620
1573
  var _this9 = this;
1621
1574
 
1622
- var h = arguments[0];
1623
1575
  var keys = Object.keys(this.cacheRule);
1624
1576
  var button = this.button;
1625
- var Type = this.type;
1626
- return keys.length === 0 ? this.$scopedSlots["default"] ? this.$scopedSlots["default"]({
1577
+ var Type = this.form;
1578
+ return keys.length === 0 ? this.$slots["default"] ? this.$slots["default"]({
1627
1579
  vm: this,
1628
1580
  add: this.add
1629
- }) : h("i", {
1581
+ }) : vue.createVNode("i", {
1630
1582
  "key": 'a_def',
1631
1583
  "class": "el-icon-circle-plus-outline",
1632
1584
  "style": "font-size:".concat(this.fontSize, "px;vertical-align:middle;color:").concat(this.disabled ? '#c9cdd4;cursor: not-allowed' : '#606266;cursor:pointer', ";"),
1633
- "on": {
1634
- "click": this.add
1635
- }
1636
- }) : h("div", {
1585
+ "onClick": this.add
1586
+ }, null) : vue.createVNode("div", {
1637
1587
  "key": 'con'
1638
1588
  }, [keys.map(function (key, index) {
1589
+ var _slot;
1590
+
1639
1591
  var _this9$cacheRule$key = _this9.cacheRule[key],
1640
1592
  rule = _this9$cacheRule$key.rule,
1641
1593
  options = _this9$cacheRule$key.options;
1642
- return h("ElRow", {
1643
- "attrs": {
1644
- "align": "middle",
1645
- "type": "flex"
1646
- },
1594
+ return vue.createVNode(vue.resolveComponent("ElRow"), {
1595
+ "align": "middle",
1596
+ "type": "flex",
1647
1597
  "key": key,
1648
1598
  "style": "border-bottom:1px dashed #DCDFE6;margin-bottom:10px;"
1649
- }, [h("ElCol", {
1650
- "attrs": {
1651
- "span": button ? 20 : 24
1652
- }
1653
- }, [h("ElFormItem", [h(Type, helper([{
1654
- "key": key
1655
1599
  }, {
1656
- "on": {
1657
- 'update:value': function updateValue(formData) {
1658
- return _this9.formData(key, formData);
1659
- },
1660
- 'emit-event': function emitEvent(name) {
1661
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1662
- args[_key - 1] = arguments[_key];
1600
+ "default": function _default() {
1601
+ return [vue.createVNode(vue.resolveComponent("ElCol"), {
1602
+ "span": button ? 20 : 24
1603
+ }, {
1604
+ "default": function _default() {
1605
+ return [vue.createVNode(vue.resolveComponent("ElFormItem"), null, {
1606
+ "default": function _default() {
1607
+ return [vue.createVNode(Type, {
1608
+ "key": key,
1609
+ "onUpdate:modelValue": function onUpdateModelValue(formData) {
1610
+ return _this9.formData(key, formData);
1611
+ },
1612
+ "modelValue": _this9.field ? _defineProperty({}, _this9.field, _this9._value(_this9.modelValue[index])) : _this9.modelValue[index],
1613
+ "onEmit-event": function onEmitEvent(name) {
1614
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1615
+ args[_key - 1] = arguments[_key];
1616
+ }
1617
+
1618
+ return _this9.emitEvent(name, args, index, key);
1619
+ },
1620
+ "onUpdate:api": function onUpdateApi($f) {
1621
+ return _this9.add$f(index, key, $f);
1622
+ },
1623
+ "rule": rule,
1624
+ "option": options,
1625
+ "extendOption": true
1626
+ }, null)];
1627
+ }
1628
+ })];
1663
1629
  }
1664
-
1665
- return _this9.emitEvent(name, args, index, key);
1666
- },
1667
- input: function input($f) {
1668
- return _this9.add$f(index, key, $f);
1669
- }
1670
- }
1671
- }, {
1672
- "attrs": {
1673
- "rule": rule,
1674
- "option": options,
1675
- "extendOption": true
1676
- }
1677
- }]))])]), button ? h("ElCol", {
1678
- "attrs": {
1679
- "span": 2,
1680
- "pull": 1,
1681
- "push": 1
1630
+ }), button ? vue.createVNode(vue.resolveComponent("ElCol"), {
1631
+ "span": 2,
1632
+ "pull": 1,
1633
+ "push": 1
1634
+ }, _isSlot(_slot = _this9.makeIcon(keys.length, index, key)) ? _slot : {
1635
+ "default": function _default() {
1636
+ return [_slot];
1637
+ }
1638
+ }) : null];
1682
1639
  }
1683
- }, [_this9.makeIcon(keys.length, index, key)]) : null]);
1640
+ });
1684
1641
  })]);
1685
1642
  }
1686
- };
1643
+ });
1687
1644
 
1688
- var NAME$7 = 'fcSubForm';
1689
- var Sub = {
1690
- name: NAME$7,
1645
+ var NAME$3 = 'fcSubForm';
1646
+ var Sub = vue.defineComponent({
1647
+ name: NAME$3,
1691
1648
  props: {
1692
1649
  rule: Array,
1693
- options: Object,
1694
- formCreateInject: {
1650
+ options: {
1695
1651
  type: Object,
1696
- required: true
1652
+ "default": function _default() {
1653
+ return vue.reactive({
1654
+ submitBtn: false,
1655
+ resetBtn: false
1656
+ });
1657
+ }
1697
1658
  },
1698
- value: {
1659
+ modelValue: {
1699
1660
  type: Object,
1700
1661
  "default": function _default() {
1701
1662
  return {};
@@ -1710,25 +1671,27 @@
1710
1671
  "default": true
1711
1672
  }
1712
1673
  },
1674
+ inject: ['formCreateInject'],
1713
1675
  data: function data() {
1714
1676
  return {
1715
- cacheRule: {},
1716
1677
  cacheValue: {},
1717
- type: undefined
1678
+ subApi: {},
1679
+ form: vue.markRaw(this.formCreateInject.form.$form())
1718
1680
  };
1719
1681
  },
1682
+ emits: ['fc:subform', 'update:modelValue', 'change', 'itemMounted'],
1720
1683
  watch: {
1721
1684
  disabled: function disabled(n) {
1722
- this.syncDisabled && this.cacheRule.$f.disabled(n);
1685
+ this.syncDisabled && this.subApi.disabled(n);
1723
1686
  },
1724
- value: function value(n) {
1687
+ modelValue: function modelValue(n) {
1725
1688
  this.setValue(n);
1726
1689
  }
1727
1690
  },
1728
1691
  methods: {
1729
1692
  formData: function formData(value) {
1730
1693
  this.cacheValue = JSON.stringify(value);
1731
- this.$emit('input', value);
1694
+ this.$emit('update:modelValue', value);
1732
1695
  this.$emit('change', value);
1733
1696
  },
1734
1697
  setValue: function setValue(value) {
@@ -1739,112 +1702,47 @@
1739
1702
  }
1740
1703
 
1741
1704
  this.cacheValue = str;
1742
- this.cacheRule.$f.coverValue(value || {});
1705
+ this.subApi.coverValue(value || {});
1743
1706
  },
1744
- addRule: function addRule() {
1745
- var options = this.options ? this.options : {
1746
- submitBtn: false,
1747
- resetBtn: false
1748
- };
1749
- options.formData = _objectSpread2({}, this.value || {});
1750
- this.cacheRule = {
1751
- rule: this.rule,
1752
- options: options
1753
- };
1754
- },
1755
- add$f: function add$f($f) {
1707
+ add$f: function add$f(api) {
1756
1708
  var _this = this;
1757
1709
 
1758
- this.cacheRule.$f = $f;
1759
- this.subForm();
1760
- this.$nextTick(function () {
1761
- _this.syncDisabled && $f.disabled(_this.disabled);
1710
+ this.subApi = api;
1711
+ this.formCreateInject.subForm(api);
1712
+ vue.nextTick(function () {
1713
+ _this.syncDisabled && api.disabled(_this.disabled);
1762
1714
 
1763
- _this.$emit('itemMounted', $f);
1715
+ _this.$emit('itemMounted', api);
1764
1716
  });
1765
- },
1766
- subForm: function subForm() {
1767
- this.formCreateInject.subForm(this.cacheRule.$f);
1768
- },
1769
- emitEvent: function emitEvent(name) {
1770
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1771
- args[_key - 1] = arguments[_key];
1772
- }
1773
-
1774
- this.$emit.apply(this, [name].concat(args));
1775
1717
  }
1776
1718
  },
1777
- created: function created() {
1778
- this.addRule();
1779
- this.type = this.formCreateInject.form.$form();
1780
- },
1781
1719
  render: function render() {
1782
- var h = arguments[0];
1783
- var _this$cacheRule = this.cacheRule,
1784
- rule = _this$cacheRule.rule,
1785
- options = _this$cacheRule.options;
1786
- var Type = this.type;
1787
- return h(Type, helper([{}, {
1788
- "on": {
1789
- 'update:value': this.formData,
1790
- 'emit-event': this.emitEvent,
1791
- input: this.add$f
1792
- }
1793
- }, {
1794
- "attrs": {
1795
- "rule": rule,
1796
- "option": options,
1797
- "extendOption": true
1798
- }
1799
- }]));
1800
- }
1801
- };
1802
-
1803
- var components = [Checkbox, Frame, Radio, Select, Tree, Upload, Group, Sub];
1804
-
1805
- function $set(target, field, value) {
1806
- Vue.set(target, field, value);
1807
- }
1808
- function $del(target, field) {
1809
- Vue["delete"](target, field);
1810
- }
1811
-
1812
- var _extends$1 = Object.assign || function (a) {
1813
- for (var b, c = 1; c < arguments.length; c++) {
1814
- for (var d in b = arguments[c], b) {
1815
- Object.prototype.hasOwnProperty.call(b, d) && $set(a, d, b[d]);
1816
- }
1817
- }
1818
-
1819
- return a;
1820
- };
1720
+ var Type = this.form;
1721
+ return vue.createVNode(Type, {
1722
+ "onUpdate:modelValue": this.formData,
1723
+ "modelValue": this.modelValue,
1724
+ "onEmit-event": this.$emit,
1725
+ "onUpdate:api": this.add$f,
1726
+ "rule": this.rule,
1727
+ "option": this.options,
1728
+ "extendOption": true
1729
+ }, null);
1730
+ }
1731
+ });
1821
1732
 
1822
- function extend() {
1823
- return _extends$1.apply(this, arguments);
1824
- }
1733
+ var components = [Checkbox, Frame, Radio, Select, Tree, Upload, Group, Sub];
1825
1734
 
1826
- var NAME$8 = 'FormCreate';
1735
+ var NAME$2 = 'FormCreate';
1827
1736
  function $FormCreate(FormCreate) {
1828
- return {
1829
- name: NAME$8,
1830
- componentName: NAME$8,
1831
- model: {
1832
- prop: 'api'
1833
- },
1834
- provide: function provide() {
1835
- return {
1836
- $pfc: this
1837
- };
1838
- },
1839
- inject: {
1840
- $pfc: {
1841
- "default": null
1842
- }
1843
- },
1737
+ return vue.defineComponent({
1738
+ name: NAME$2,
1844
1739
  props: {
1845
1740
  rule: {
1846
1741
  type: Array,
1847
- required: true
1742
+ required: true,
1743
+ "default": function _default() {
1744
+ return [];
1745
+ }
1848
1746
  },
1849
1747
  option: {
1850
1748
  type: Object,
@@ -1853,91 +1751,120 @@
1853
1751
  }
1854
1752
  },
1855
1753
  extendOption: Boolean,
1856
- value: Object,
1754
+ modelValue: Object,
1857
1755
  api: Object
1858
1756
  },
1859
- data: function data() {
1860
- return {
1861
- formData: undefined,
1757
+ emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync'],
1758
+ render: function render() {
1759
+ return this.fc.render();
1760
+ },
1761
+ setup: function setup(props) {
1762
+ var vm = vue.getCurrentInstance();
1763
+ vue.provide('parentFC', vm);
1764
+ var parent = vue.inject('parentFC');
1765
+
1766
+ var _toRefs = vue.toRefs(props),
1767
+ rule = _toRefs.rule,
1768
+ modelValue = _toRefs.modelValue;
1769
+
1770
+ var data = vue.reactive({
1862
1771
  destroyed: false,
1863
- validate: {},
1864
- $f: undefined,
1865
1772
  isShow: true,
1866
1773
  unique: 1,
1867
- renderRule: _toConsumableArray(this.rule || []),
1868
- ctxInject: {},
1869
- updateValue: ''
1870
- };
1871
- },
1872
- render: function render() {
1873
- return this.formCreate.render();
1874
- },
1875
- methods: {
1876
- _refresh: function _refresh() {
1877
- ++this.unique;
1878
- },
1879
- _renderRule: function _renderRule() {
1880
- this.renderRule = _toConsumableArray(this.rule || []);
1881
- },
1882
- _updateValue: function _updateValue(value) {
1883
- if (this.destroyed) return;
1884
- this.updateValue = JSON.stringify(value);
1885
- this.$emit('update:value', value);
1886
- }
1887
- },
1888
- watch: {
1889
- value: {
1890
- handler: function handler(n) {
1891
- if (JSON.stringify(n) === this.updateValue) return;
1892
- this.$f.setValue(n);
1893
- },
1774
+ renderRule: _toConsumableArray(rule.value || []),
1775
+ updateValue: JSON.stringify(modelValue)
1776
+ });
1777
+ var fc = new FormCreate(vm);
1778
+ var fapi = fc.api();
1779
+ vue.onMounted(function () {
1780
+ fc.mounted();
1781
+ });
1782
+ vue.onBeforeUnmount(function () {
1783
+ data.destroyed = true;
1784
+ fc.unmount();
1785
+ });
1786
+ vue.onUpdated(function () {
1787
+ fc.updated();
1788
+ });
1789
+ vue.watch(function () {
1790
+ return _toConsumableArray(rule.value);
1791
+ }, function (n) {
1792
+ if (fc.$handle.isBreakWatch() || n.length === data.renderRule.length && n.every(function (v) {
1793
+ return data.renderRule.indexOf(v) > -1;
1794
+ })) return;
1795
+ fc.$handle.reloadRule(rule.value);
1796
+ vm.setupState.renderRule();
1797
+ });
1798
+ vue.watch(props.option, function (n) {
1799
+ fc.initOptions(n);
1800
+ fapi.refresh();
1801
+ });
1802
+ vue.watch(modelValue, function (n) {
1803
+ if (JSON.stringify(n) === data.updateValue) return;
1804
+ fapi.setValue(n);
1805
+ }, {
1894
1806
  deep: true
1895
- },
1896
- option: {
1897
- handler: function handler(n) {
1898
- this.formCreate.initOptions(n);
1899
- this.$f.refresh();
1807
+ });
1808
+ return _objectSpread2(_objectSpread2({
1809
+ fc: vue.markRaw(fc),
1810
+ parent: parent ? vue.markRaw(parent) : parent,
1811
+ fapi: vue.markRaw(fapi)
1812
+ }, vue.toRefs(data)), {}, {
1813
+ refresh: function refresh() {
1814
+ ++data.unique;
1900
1815
  },
1901
- deep: true
1902
- },
1903
- rule: function rule(n) {
1904
- var _this = this;
1905
-
1906
- if (n.length === this.renderRule.length && n.every(function (v) {
1907
- return _this.renderRule.indexOf(v) > -1;
1908
- })) return;
1909
- this.formCreate.$handle.reloadRule(n);
1910
-
1911
- this._renderRule();
1912
- }
1816
+ renderRule: function renderRule() {
1817
+ data.renderRule = _toConsumableArray(rule.value || []);
1818
+ },
1819
+ updateValue: function updateValue(value) {
1820
+ if (data.destroyed) return;
1821
+ data.updateValue = JSON.stringify(value);
1822
+ vm.emit('update:modelValue', value);
1823
+ }
1824
+ });
1913
1825
  },
1914
- beforeCreate: function beforeCreate() {
1915
- var _this2 = this;
1826
+ created: function created() {
1827
+ var vm = vue.getCurrentInstance();
1828
+ vm.setupState.fc.init();
1829
+ vm.emit('update:api', vm.setupState.fapi);
1830
+ }
1831
+ });
1832
+ }
1916
1833
 
1917
- var _this$$options$propsD = this.$options.propsData,
1918
- rule = _this$$options$propsD.rule,
1919
- option = _this$$options$propsD.option;
1920
- this.formCreate = new FormCreate(this, rule, option);
1921
- Object.keys(this.formCreate.prop).forEach(function (k) {
1922
- extend(_this2.$options[k], _this2.formCreate.prop[k]);
1923
- });
1834
+ function $set(target, field, value) {
1835
+ target[field] = value;
1836
+ }
1837
+ function $del(target, field) {
1838
+ delete target[field];
1839
+ }
1840
+
1841
+ var _extends = Object.assign || function (a) {
1842
+ for (var b, c = 1; c < arguments.length; c++) {
1843
+ for (var d in b = arguments[c], b) {
1844
+ Object.prototype.hasOwnProperty.call(b, d) && $set(a, d, b[d]);
1924
1845
  }
1925
- };
1846
+ }
1847
+
1848
+ return a;
1849
+ };
1850
+
1851
+ function extend() {
1852
+ return _extends.apply(this, arguments);
1926
1853
  }
1927
1854
 
1928
- var normalMerge$1 = ['attrs', 'props', 'domProps', 'scopedSlots'];
1929
- var toArrayMerge$1 = ['class', 'style', 'directives'];
1930
- var functionalMerge$1 = ['on', 'nativeOn'];
1855
+ var normalMerge = ['props'];
1856
+ var toArrayMerge = ['class', 'style', 'directives'];
1857
+ var functionalMerge = ['on'];
1931
1858
 
1932
1859
  var mergeProps = function mergeProps(objects) {
1933
1860
  var initial = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1934
1861
  var opt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1935
1862
 
1936
- var _normalMerge = [].concat(normalMerge$1, _toConsumableArray(opt['normal'] || []));
1863
+ var _normalMerge = [].concat(normalMerge, _toConsumableArray(opt['normal'] || []));
1937
1864
 
1938
- var _toArrayMerge = [].concat(toArrayMerge$1, _toConsumableArray(opt['array'] || []));
1865
+ var _toArrayMerge = [].concat(toArrayMerge, _toConsumableArray(opt['array'] || []));
1939
1866
 
1940
- var _functionalMerge = [].concat(functionalMerge$1, _toConsumableArray(opt['functional'] || []));
1867
+ var _functionalMerge = [].concat(functionalMerge, _toConsumableArray(opt['functional'] || []));
1941
1868
 
1942
1869
  var propsMerge = opt['props'] || [];
1943
1870
  return objects.reduce(function (a, b) {
@@ -1966,7 +1893,7 @@
1966
1893
  } else if (key === 'hook') {
1967
1894
  for (var hook in b[key]) {
1968
1895
  if (a[key][hook]) {
1969
- a[key][hook] = mergeFn$1(a[key][hook], b[key][hook]);
1896
+ a[key][hook] = mergeFn(a[key][hook], b[key][hook]);
1970
1897
  } else {
1971
1898
  a[key][hook] = b[key][hook];
1972
1899
  }
@@ -1987,18 +1914,18 @@
1987
1914
  }, initial);
1988
1915
  };
1989
1916
 
1990
- var mergeFn$1 = function mergeFn(fn1, fn2) {
1917
+ var mergeFn = function mergeFn(fn1, fn2) {
1991
1918
  return function () {
1992
1919
  fn1 && fn1.apply(this, arguments);
1993
1920
  fn2 && fn2.apply(this, arguments);
1994
1921
  };
1995
1922
  };
1996
1923
 
1997
- var keyAttrs = ['type', 'slot', 'emitPrefix', 'value', 'name', 'native', 'hidden', 'display', 'inject', 'options', 'emit', 'nativeEmit', 'link', 'prefix', 'suffix', 'update', 'sync', 'optionsTo', 'key'];
1924
+ var keyAttrs = ['type', 'slot', 'emitPrefix', 'value', 'name', 'native', 'hidden', 'display', 'inject', 'options', 'emit', 'link', 'prefix', 'suffix', 'update', 'sync', 'optionsTo', 'key'];
1998
1925
  var arrayAttrs = ['validate', 'children', 'control'];
1999
- var normalAttrs = ['effect', 'deep'];
1926
+ var normalAttrs = ['effect'];
2000
1927
  function attrs() {
2001
- return [].concat(keyAttrs, _toConsumableArray(normalMerge$1), _toConsumableArray(toArrayMerge$1), _toConsumableArray(functionalMerge$1), arrayAttrs, normalAttrs);
1928
+ return [].concat(keyAttrs, _toConsumableArray(normalMerge), _toConsumableArray(toArrayMerge), _toConsumableArray(functionalMerge), arrayAttrs, normalAttrs);
2002
1929
  }
2003
1930
 
2004
1931
  function deepExtend(origin) {
@@ -2054,9 +1981,6 @@
2054
1981
  function format(type, msg, rule) {
2055
1982
  return "[form-create ".concat(type, "]: ").concat(msg) + (rule ? '\n\nrule: ' + JSON.stringify(rule.getRule ? rule.getRule() : rule) : '');
2056
1983
  }
2057
- function tip(msg, rule) {
2058
- console.warn(format('tip', msg, rule));
2059
- }
2060
1984
  function err(msg, rule) {
2061
1985
  console.error(format('err', msg, rule));
2062
1986
  }
@@ -2065,6 +1989,15 @@
2065
1989
  console.error(e);
2066
1990
  }
2067
1991
 
1992
+ function toLine(name) {
1993
+ var line = name.replace(/([A-Z])/g, '-$1').toLocaleLowerCase();
1994
+ if (line.indexOf('-') === 0) line = line.substr(1);
1995
+ return line;
1996
+ }
1997
+ function upper(str) {
1998
+ return str.replace(str[0], str[0].toLocaleUpperCase());
1999
+ }
2000
+
2068
2001
  var PREFIX = '[[FORM-CREATE-PREFIX-';
2069
2002
  var SUFFIX = '-FORM-CREATE-SUFFIX]]';
2070
2003
  var $T = '$FN:';
@@ -2188,20 +2121,104 @@
2188
2121
 
2189
2122
  return def;
2190
2123
  }
2124
+ function makeSlotBag() {
2125
+ var slotBag = {};
2191
2126
 
2192
- function toString(val) {
2193
- return val == null ? '' : _typeof(val) === 'object' ? JSON.stringify(val, null, 2) : String(val);
2127
+ var slotName = function slotName(n) {
2128
+ return n || 'default';
2129
+ };
2130
+
2131
+ return {
2132
+ setSlot: function setSlot(slot, vnFn) {
2133
+ slot = slotName(slot);
2134
+ if (!vnFn || Array.isArray(vnFn) && vnFn.length) return;
2135
+ if (!slotBag[slot]) slotBag[slot] = [];
2136
+ slotBag[slot].push(vnFn);
2137
+ },
2138
+ getSlot: function getSlot(slot) {
2139
+ slot = slotName(slot);
2140
+ var children = [];
2141
+ (slotBag[slot] || []).forEach(function (fn) {
2142
+ if (Array.isArray(fn)) {
2143
+ children.push.apply(children, _toConsumableArray(fn));
2144
+ } else if (is.Function(fn)) {
2145
+ var res = fn();
2146
+
2147
+ if (Array.isArray(res)) {
2148
+ children.push.apply(children, _toConsumableArray(res));
2149
+ } else {
2150
+ children.push(res);
2151
+ }
2152
+ } else if (!is.Undef(fn)) {
2153
+ children.push(fn);
2154
+ }
2155
+ });
2156
+ return children;
2157
+ },
2158
+ getSlots: function getSlots() {
2159
+ var _this = this;
2160
+
2161
+ var slots = {};
2162
+ Object.keys(slotBag).forEach(function (k) {
2163
+ slots[k] = function () {
2164
+ return _this.getSlot(k);
2165
+ };
2166
+ });
2167
+ return slots;
2168
+ },
2169
+ slotLen: function slotLen(slot) {
2170
+ slot = slotName(slot);
2171
+ return slotBag[slot] ? slotBag[slot].length : 0;
2172
+ },
2173
+ mergeBag: function mergeBag(bag) {
2174
+ var _this2 = this;
2175
+
2176
+ if (!bag) return this;
2177
+ var slots = is.Function(bag.getSlots) ? bag.getSlots() : bag;
2178
+
2179
+ if (Array.isArray(bag) || vue.isVNode(bag)) {
2180
+ this.setSlot(undefined, function () {
2181
+ return bag;
2182
+ });
2183
+ } else {
2184
+ Object.keys(slots).forEach(function (k) {
2185
+ _this2.setSlot(k, slots[k]);
2186
+ });
2187
+ }
2188
+
2189
+ return this;
2190
+ }
2191
+ };
2194
2192
  }
2193
+ function toProps(rule) {
2194
+ var prop = _objectSpread2({}, rule.props || {});
2195
2195
 
2196
- function toLine(name) {
2197
- var line = name.replace(/([A-Z])/g, '-$1').toLocaleLowerCase();
2198
- if (line.indexOf('-') === 0) line = line.substr(1);
2199
- return line;
2196
+ Object.keys(rule.on || {}).forEach(function (k) {
2197
+ var name = "on".concat(upper(k));
2198
+
2199
+ if (Array.isArray(prop[name])) {
2200
+ prop[name] = [].concat(_toConsumableArray(prop[name]), [rule.on[k]]);
2201
+ } else if (prop[name]) {
2202
+ prop[name] = [prop[name], rule.on[k]];
2203
+ } else {
2204
+ prop[name] = rule.on[k];
2205
+ }
2206
+ });
2207
+ prop.key = rule.key;
2208
+ prop.ref = rule.ref;
2209
+ prop["class"] = rule["class"];
2210
+ prop.style = rule.style;
2211
+ if (prop.slot) delete prop.slot;
2212
+ return prop;
2213
+ }
2214
+
2215
+ function toString(val) {
2216
+ return val == null ? '' : _typeof(val) === 'object' ? JSON.stringify(val, null, 2) : String(val);
2200
2217
  }
2201
2218
 
2202
- var id = 0;
2219
+ var id$1 = 0;
2203
2220
  function uniqueId() {
2204
- return Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now()).concat(++id)).toString(36);
2221
+ return Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now()).concat(++id$1)).toString(36);
2205
2222
  }
2206
2223
 
2207
2224
  function deepSet(data, idx, val) {
@@ -2263,6 +2280,10 @@
2263
2280
  $set(this._data, key, value);
2264
2281
  return this;
2265
2282
  },
2283
+ modelField: function modelField(field) {
2284
+ this._data.modelField = field;
2285
+ return this;
2286
+ },
2266
2287
  _clone: function _clone() {
2267
2288
  var clone = new this.constructor();
2268
2289
  clone._data = copyRule(this._data);
@@ -2286,19 +2307,9 @@
2286
2307
  make._data.title = title;
2287
2308
  return make;
2288
2309
  }
2289
- function createTmp(template, vm, field, title) {
2290
- var make = commonMaker('', field);
2291
- make._data.type = 'template';
2292
- make._data.template = template;
2293
- make._data.title = title;
2294
- make._data.vm = vm;
2295
- return make;
2296
- }
2297
2310
  function makerFactory() {
2298
2311
  return {
2299
2312
  create: create,
2300
- createTmp: createTmp,
2301
- template: createTmp,
2302
2313
  factory: creatorFactory
2303
2314
  };
2304
2315
  }
@@ -2342,10 +2353,18 @@
2342
2353
  return h.options;
2343
2354
  },
2344
2355
 
2356
+ set config(val) {
2357
+ h.fc.options.value = val;
2358
+ },
2359
+
2345
2360
  get options() {
2346
2361
  return h.options;
2347
2362
  },
2348
2363
 
2364
+ set options(val) {
2365
+ h.fc.options.value = val;
2366
+ },
2367
+
2349
2368
  get form() {
2350
2369
  return h.form;
2351
2370
  },
@@ -2355,7 +2374,7 @@
2355
2374
  },
2356
2375
 
2357
2376
  get parent() {
2358
- return h.vm.$pfc && h.vm.$pfc.$f;
2377
+ return h.vm.parent && h.vm.parent.setupState.fapi;
2359
2378
  },
2360
2379
 
2361
2380
  get children() {
@@ -2415,10 +2434,6 @@
2415
2434
  ctx.rm();
2416
2435
  return ctx.origin;
2417
2436
  },
2418
- destroy: function destroy() {
2419
- h.vm.$el.parentNode && h.vm.$el.parentNode.removeChild(h.vm.$el);
2420
- h.vm.$destroy();
2421
- },
2422
2437
  fields: function fields() {
2423
2438
  return h.fields();
2424
2439
  },
@@ -2559,7 +2574,7 @@
2559
2574
  api.refresh();
2560
2575
  },
2561
2576
  hideForm: function hideForm(hide) {
2562
- $set(h.vm, 'isShow', !hide);
2577
+ h.vm.setupState.isShow = !hide;
2563
2578
  },
2564
2579
  changeStatus: function changeStatus() {
2565
2580
  return h.changeStatus;
@@ -2609,7 +2624,6 @@
2609
2624
  });
2610
2625
  },
2611
2626
  refreshValidate: function refreshValidate() {
2612
- h.vm.validate = {};
2613
2627
  api.refresh();
2614
2628
  },
2615
2629
  resetFields: function resetFields(fields) {
@@ -2651,11 +2665,10 @@
2651
2665
  },
2652
2666
  el: function el(id) {
2653
2667
  var ctx = h.getCtx(id);
2654
- if (ctx) return ctx.el || h.vm.$refs[ctx.ref];
2668
+ if (ctx) return ctx.el || h.vm.refs[ctx.ref];
2655
2669
  },
2656
2670
  closeModal: function closeModal(id) {
2657
- var el = api.el(id);
2658
- el && el.$emit && el.$emit('close-modal');
2671
+ h.bus.$emit('fc:closeModal:' + id);
2659
2672
  },
2660
2673
  getSubForm: function getSubForm(field) {
2661
2674
  var ctx = h.getCtx(field);
@@ -2672,9 +2685,9 @@
2672
2685
  };
2673
2686
  ['on', 'once', 'off', 'set'].forEach(function (n) {
2674
2687
  api[n] = function () {
2675
- var _h$vm;
2688
+ var _h$bus;
2676
2689
 
2677
- (_h$vm = h.vm)["$".concat(n)].apply(_h$vm, arguments);
2690
+ (_h$bus = h.bus)["$".concat(n)].apply(_h$bus, arguments);
2678
2691
  };
2679
2692
  });
2680
2693
  api.changeValue = api.changeField = api.setValue;
@@ -2729,85 +2742,56 @@
2729
2742
  return str.replace(str[0], str[0].toLowerCase());
2730
2743
  }
2731
2744
 
2732
- function useRender(Render) {
2745
+ function useRender$1(Render) {
2733
2746
  extend(Render.prototype, {
2734
2747
  initRender: function initRender() {
2735
- this.tempList = {};
2736
- this.clearOrgChildren();
2737
- },
2738
- initOrgChildren: function initOrgChildren() {
2739
- var ctxs = this.$handle.ctxs;
2740
- this.orgChildren = Object.keys(ctxs).reduce(function (initial, id) {
2741
- if (ctxs[id].parser.loadChildren !== false) {
2742
- var children = ctxs[id].rule.children;
2743
- initial[id] = is.trueArray(children) ? _toConsumableArray(children) : [];
2744
- }
2745
-
2746
- return initial;
2747
- }, {});
2748
- },
2749
- clearOrgChildren: function clearOrgChildren() {
2750
- this.orgChildren = {};
2748
+ this.cacheConfig = {};
2751
2749
  },
2752
2750
  render: function render() {
2753
2751
  var _this = this;
2754
2752
 
2755
- if (!this.vm.isShow) {
2753
+ // console.warn('renderrrrr', this.id);
2754
+ if (!this.vm.setupState.isShow) {
2756
2755
  return;
2757
2756
  }
2758
2757
 
2759
- this.$h = this.vm.$createElement;
2760
2758
  this.$manager.beforeRender();
2761
- var vn;
2762
-
2763
- var make = function make() {
2764
- return _this.renderList();
2765
- };
2766
-
2767
- make.renderSlot = function (slot) {
2768
- return _this.renderList(slot);
2769
- };
2770
-
2771
- make.renderName = function (name) {
2772
- return _this.renderId(name);
2773
- };
2774
-
2775
- make.renderField = function (field) {
2776
- return _this.renderId(field, 'field');
2777
- };
2778
-
2779
- if (this.vm.$scopedSlots.container) {
2780
- vn = [this.vm.$scopedSlots.container(make)];
2759
+ var slotBag = makeSlotBag();
2760
+ this.sort.forEach(function (k) {
2761
+ _this.renderSlot(slotBag, _this.$handle.ctxs[k]);
2762
+ });
2763
+ return this.$manager.render(slotBag);
2764
+ },
2765
+ renderSlot: function renderSlot(slotBag, ctx, parent) {
2766
+ if (this.isFragment(ctx)) {
2767
+ ctx.initProp();
2768
+ this.mergeGlobal(ctx);
2769
+ ctx.initNone();
2770
+ var slots = this.renderChildren(ctx);
2771
+ var def = slots["default"];
2772
+ def && slotBag.setSlot(ctx.rule.slot, function () {
2773
+ return def();
2774
+ });
2775
+ delete slots["default"];
2776
+ slotBag.mergeBag(slots);
2781
2777
  } else {
2782
- vn = make();
2778
+ slotBag.setSlot(ctx.rule.slot, this.renderCtx(ctx, parent));
2783
2779
  }
2784
-
2785
- return this.$manager.render(vn);
2786
2780
  },
2787
- renderList: function renderList(slot) {
2781
+ mergeGlobal: function mergeGlobal(ctx) {
2788
2782
  var _this2 = this;
2789
2783
 
2790
- return this.sort.map(function (id) {
2791
- return slot ? _this2.renderSlot(_this2.$handle.ctxs[id], slot) : _this2.renderCtx(_this2.$handle.ctxs[id]);
2792
- }).filter(function (val) {
2793
- return val !== undefined;
2794
- });
2795
- },
2796
- makeVm: function makeVm(rule) {
2797
- var _this3 = this;
2798
-
2799
- var vm = rule.vm;
2800
- if (!vm) return new _vue();else if (is.Function(vm)) return invoke(function () {
2801
- return rule.vm(_this3.$handle.getInjectData(rule));
2802
- });else if (!vm._isVue) return new _vue(vm);
2803
- return vm;
2804
- },
2805
- mergeGlobal: function mergeGlobal(ctx) {
2806
2784
  var g = this.$handle.options.global;
2807
- if (!g) return; //todo 缓存配置,更新 option 更新
2785
+ if (!g) return;
2786
+
2787
+ if (!this.cacheConfig[ctx.trueType]) {
2788
+ this.cacheConfig[ctx.trueType] = vue.computed(function () {
2789
+ var g = _this2.$handle.options.global;
2790
+ return mergeRule({}, [g['*'], g[ctx.originType] || g[ctx.type] || g[ctx.type] || {}]);
2791
+ });
2792
+ }
2808
2793
 
2809
- if (!ctx.cacheConfig) ctx.cacheConfig = g[ctx.originType] || g[ctx.type] || g[ctx.trueType] || {};
2810
- ctx.prop = mergeRule({}, [g['*'], ctx.cacheConfig, ctx.prop]);
2794
+ ctx.prop = mergeRule({}, [this.cacheConfig[ctx.trueType].value, ctx.prop]);
2811
2795
  },
2812
2796
  setOptions: function setOptions(ctx) {
2813
2797
  if (ctx.prop.optionsTo && ctx.prop.options) {
@@ -2822,62 +2806,6 @@
2822
2806
  deepSet(ctx.prop, str, deep[str]);
2823
2807
  });
2824
2808
  },
2825
- setTempProps: function setTempProps(vm, ctx) {
2826
- if (!vm.$props) return;
2827
- var prop = ctx.prop;
2828
- var keys = Object.keys(vm.$props);
2829
- var inject = this.injectProp(ctx);
2830
- var injectKeys = Object.keys(inject);
2831
- keys.forEach(function (key) {
2832
- if (hasProperty(prop.props, key)) vm.$props[key] = prop.props[key];else if (injectKeys.indexOf(key) > -1) vm.$props[key] = inject[key];
2833
- });
2834
- var key = vm.$options.model && vm.$options.model.prop || 'value';
2835
-
2836
- if (keys.indexOf(key) > -1) {
2837
- vm.$props[key] = prop.value;
2838
- }
2839
- },
2840
- renderTemp: function renderTemp(ctx) {
2841
- var _this4 = this;
2842
-
2843
- if (!_vue.compile) {
2844
- tip('当前使用的Vue构建版本不支持compile,无法使用template功能');
2845
- return [];
2846
- }
2847
-
2848
- var rule = ctx.prop;
2849
- var id = ctx.id,
2850
- key = ctx.key;
2851
-
2852
- if (!this.tempList[id]) {
2853
- if (!ctx.el) {
2854
- ctx.el = this.makeVm(rule);
2855
- this.vm.$nextTick(function () {
2856
- return ctx.parser.mounted(ctx);
2857
- });
2858
- }
2859
-
2860
- var _vm = ctx.el;
2861
- if (ctx.input) _vm.$on(_vm.$options.model && _vm.$options.model.event || 'input', function (value) {
2862
- _this4.onInput(ctx, value);
2863
- });
2864
- this.tempList[id] = {
2865
- vm: _vm,
2866
- template: _vue.compile(rule.template)
2867
- };
2868
- }
2869
-
2870
- var _this$tempList$id = this.tempList[id],
2871
- vm = _this$tempList$id.vm,
2872
- template = _this$tempList$id.template;
2873
- this.setTempProps(vm, ctx);
2874
- var vn = template.render.call(vm);
2875
- if (is.Undef(vn.data)) vn.data = {};
2876
- vn.key = key;
2877
- vn.data.ref = ctx.ref;
2878
- vn.data.key = key;
2879
- return vn;
2880
- },
2881
2809
  parseSide: function parseSide(side) {
2882
2810
  return is.Object(side) ? mergeRule({}, side) : side;
2883
2811
  },
@@ -2885,109 +2813,94 @@
2885
2813
  var prop = ctx[temp ? 'rule' : 'prop'];
2886
2814
  return [this.renderRule(this.parseSide(prop.prefix)), vn, this.renderRule(this.parseSide(prop.suffix))];
2887
2815
  },
2888
- renderSlot: function renderSlot(ctx, slot) {
2889
- return ctx.rule.slot === slot ? this.renderCtx(ctx) : undefined;
2890
- },
2891
2816
  renderId: function renderId(name, type) {
2892
- var _this5 = this;
2817
+ var _this3 = this;
2893
2818
 
2894
2819
  var ctxs = this.$handle[type === 'field' ? 'fieldCtx' : 'nameCtx'][name];
2895
2820
  return ctxs ? ctxs.map(function (ctx) {
2896
- return _this5.renderCtx(ctx, ctx.parent);
2821
+ return _this3.renderCtx(ctx, ctx.parent);
2897
2822
  }) : undefined;
2898
2823
  },
2899
2824
  renderCtx: function renderCtx(ctx, parent) {
2825
+ var _this4 = this;
2826
+
2900
2827
  if (ctx.type === 'hidden') return;
2901
2828
  var rule = ctx.rule;
2902
2829
 
2903
2830
  if (!this.cache[ctx.id] || this.cache[ctx.id].slot !== rule.slot) {
2904
2831
  var vn;
2905
- var cacheFlag = true;
2906
- var _type = ctx.trueType;
2907
- var none = !(is.Undef(rule.display) || !!rule.display);
2908
-
2909
- if (_type === 'template' && !rule.template) {
2910
- vn = this.renderSides(this.renderChildren(ctx), ctx, true);
2911
-
2912
- if (none) {
2913
- this.display(vn);
2914
- }
2915
-
2916
- vn = this.item(ctx, vn);
2917
- } else if (_type === 'fcFragment') {
2918
- vn = this.renderChildren(ctx);
2919
- } else {
2920
- ctx.initProp();
2921
- this.mergeGlobal(ctx);
2922
- this.$manager.tidyRule(ctx);
2923
- this.deepSet(ctx);
2924
- this.setOptions(ctx);
2925
- this.ctxProp(ctx);
2926
- var prop = ctx.prop;
2927
- prop.props.formCreateInject = this.injectProp(ctx);
2928
-
2929
- if (prop.hidden) {
2930
- this.setCache(ctx, undefined, parent);
2931
- return;
2932
- }
2832
+ ctx.initProp();
2833
+ this.mergeGlobal(ctx);
2834
+ ctx.initNone();
2835
+ this.$manager.tidyRule(ctx);
2836
+ this.deepSet(ctx);
2837
+ this.setOptions(ctx);
2838
+ this.ctxProp(ctx);
2839
+ var prop = ctx.prop;
2840
+
2841
+ if (prop.hidden) {
2842
+ this.setCache(ctx, undefined, parent);
2843
+ return;
2844
+ }
2933
2845
 
2934
- if (_type === 'template' && prop.template) {
2935
- vn = this.renderTemp(ctx);
2936
- cacheFlag = false;
2937
- } else {
2938
- var children = [];
2846
+ vn = function vn() {
2847
+ return _this4.item(ctx, function () {
2848
+ var children = {};
2939
2849
 
2940
2850
  if (ctx.parser.renderChildren) {
2941
2851
  children = ctx.parser.renderChildren(ctx);
2942
2852
  } else if (ctx.parser.loadChildren !== false) {
2943
- children = this.renderChildren(ctx);
2853
+ children = _this4.renderChildren(ctx);
2944
2854
  }
2945
2855
 
2946
2856
  var slot = 'type-' + toLine(ctx.type);
2947
2857
 
2948
- if (this.vm.$scopedSlots[slot]) {
2949
- vn = this.vm.$scopedSlots[slot]({
2858
+ var _vn;
2859
+
2860
+ if (_this4.vm.slots[slot]) {
2861
+ _vn = _this4.vm.slots[slot]({
2950
2862
  rule: rule,
2951
2863
  prop: prop,
2952
2864
  children: children,
2953
- api: this.$handle.api,
2865
+ api: _this4.$handle.api,
2954
2866
  model: prop.model || {}
2955
2867
  });
2956
2868
  } else {
2957
- vn = ctx.parser.render(children, ctx);
2869
+ _vn = ctx.parser.render(_this4.renderChildren(ctx), ctx);
2958
2870
  }
2959
- }
2960
2871
 
2961
- vn = this.renderSides(vn, ctx);
2962
-
2963
- if (!(!ctx.input && is.Undef(prop["native"])) && prop["native"] !== true) {
2964
- vn = this.$manager.makeWrap(ctx, vn);
2965
- }
2872
+ _vn = _this4.renderSides(_vn, ctx);
2966
2873
 
2967
- if (none) {
2968
- vn = this.display(vn);
2969
- }
2874
+ if (!(!ctx.input && is.Undef(prop["native"])) && prop["native"] !== true) {
2875
+ _vn = _this4.$manager.makeWrap(ctx, _vn);
2876
+ }
2970
2877
 
2971
- vn = this.item(ctx, vn);
2972
- }
2878
+ if (ctx.none) {
2879
+ _vn = _this4.display(_vn);
2880
+ }
2973
2881
 
2974
- if (cacheFlag) {
2975
- this.setCache(ctx, vn, parent);
2976
- }
2882
+ return _vn;
2883
+ });
2884
+ };
2977
2885
 
2886
+ this.setCache(ctx, vn, parent);
2887
+ ctx._vnode = vn;
2978
2888
  return vn;
2979
2889
  }
2980
2890
 
2981
2891
  return this.getCache(ctx);
2982
2892
  },
2893
+ getModelField: function getModelField(ctx) {
2894
+ 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';
2895
+ },
2983
2896
  display: function display(vn) {
2984
- var _this6 = this;
2897
+ var _this5 = this;
2985
2898
 
2986
2899
  if (Array.isArray(vn)) {
2987
2900
  var data = [];
2988
2901
  vn.forEach(function (v) {
2989
- if (Array.isArray(v)) return _this6.display(v);
2990
- if (_this6.none(v)) data.push(v);
2902
+ if (Array.isArray(v)) return _this5.display(v);
2903
+ if (_this5.none(v)) data.push(v);
2991
2904
  });
2992
2905
  return data;
2993
2906
  } else {
@@ -2995,13 +2908,13 @@
2995
2908
  }
2996
2909
  },
2997
2910
  none: function none(vn) {
2998
- if (vn && vn.data) {
2999
- if (Array.isArray(vn.data.style)) {
3000
- vn.data.style.push({
2911
+ if (vn) {
2912
+ if (Array.isArray(vn.props.style)) {
2913
+ vn.props.style.push({
3001
2914
  display: 'none'
3002
2915
  });
3003
2916
  } else {
3004
- vn.data.style = [vn.data.style, {
2917
+ vn.props.style = [vn.props.style, {
3005
2918
  display: 'none'
3006
2919
  }];
3007
2920
  }
@@ -3010,41 +2923,31 @@
3010
2923
  }
3011
2924
  },
3012
2925
  item: function item(ctx, vn) {
3013
- return this.$h('fcFragment', {
3014
- slot: ctx.rule.slot,
3015
- key: ctx.key
3016
- }, [vn]);
2926
+ return this.vNode.h('FcFragment', {
2927
+ key: ctx.prop.key,
2928
+ formCreateInject: this.injectProp(ctx)
2929
+ }, vn);
2930
+ },
2931
+ isFragment: function isFragment(ctx) {
2932
+ return ctx.type === 'fragment' || ctx.type === 'template';
3017
2933
  },
3018
2934
  injectProp: function injectProp(ctx) {
3019
- var _this7 = this;
3020
-
3021
- if (!this.vm.ctxInject[ctx.id]) {
3022
- $set(this.vm.ctxInject, ctx.id, {});
3023
- }
2935
+ var _this6 = this;
3024
2936
 
3025
- var inject = this.vm.ctxInject[ctx.id];
3026
- extend(inject, {
2937
+ return {
3027
2938
  api: this.$handle.api,
3028
2939
  form: this.fc.create,
3029
2940
  subForm: function subForm(_subForm) {
3030
- _this7.$handle.addSubForm(ctx, _subForm);
2941
+ _this6.$handle.addSubForm(ctx, _subForm);
3031
2942
  },
3032
2943
  field: ctx.field,
3033
- options: ctx.prop.options,
2944
+ options: ctx.prop.options || [],
3034
2945
  children: ctx.rule.children,
3035
- rule: ctx.rule,
3036
- prop: function () {
3037
- var temp = _objectSpread2({}, ctx.prop);
3038
-
3039
- temp.on = temp.on ? _objectSpread2({}, temp.on) : {};
3040
- delete temp.model;
3041
- return temp;
3042
- }()
3043
- });
3044
- return inject;
2946
+ rule: ctx.rule
2947
+ };
3045
2948
  },
3046
2949
  ctxProp: function ctxProp(ctx, custom) {
3047
- var _this8 = this;
2950
+ var _this7 = this;
3048
2951
 
3049
2952
  var ref = ctx.ref,
3050
2953
  key = ctx.key,
@@ -3056,37 +2959,29 @@
3056
2959
  key: rule.key || "".concat(key, "fc"),
3057
2960
  slot: undefined,
3058
2961
  on: {
3059
- 'hook:mounted': function hookMounted() {
3060
- _this8.onMounted(ctx);
3061
- },
3062
- 'fc.sub-form': function fcSubForm(subForm) {
3063
- _this8.$handle.addSubForm(ctx, subForm);
2962
+ vnodeMounted: function vnodeMounted(vn) {
2963
+ vn.el.__rule__ = ctx.rule;
2964
+
2965
+ _this7.onMounted(ctx, vn.el);
3064
2966
  }
3065
2967
  }
3066
2968
  }];
3067
2969
 
3068
2970
  if (!custom && ctx.input) {
2971
+ var field = this.getModelField(ctx);
3069
2972
  props.push({
3070
- model: {
3071
- value: this.$handle.getFormData(ctx),
3072
- callback: function callback(value) {
3073
- _this8.onInput(ctx, value);
3074
- },
3075
- expression: "formData.".concat(ctx.id)
3076
- }
2973
+ on: _defineProperty({}, "update:".concat(field), function update(value) {
2974
+ _this7.onInput(ctx, value);
2975
+ }),
2976
+ props: _defineProperty({}, field, this.$handle.getFormData(ctx))
3077
2977
  });
3078
2978
  }
3079
2979
 
3080
2980
  mergeProps(props, ctx.prop);
3081
2981
  return ctx.prop;
3082
2982
  },
3083
- onMounted: function onMounted(ctx) {
3084
- ctx.el = this.vm.$refs[ctx.ref];
3085
-
3086
- if (ctx.el) {
3087
- (ctx.el.$el || ctx.el).__rule__ = ctx.rule;
3088
- }
3089
-
2983
+ onMounted: function onMounted(ctx, el) {
2984
+ ctx.el = this.vm.refs[ctx.ref] || el;
3090
2985
  ctx.parser.mounted(ctx);
3091
2986
  this.$handle.effect(ctx, 'mounted');
3092
2987
  },
@@ -3094,54 +2989,28 @@
3094
2989
  this.$handle.onInput(ctx, value);
3095
2990
  },
3096
2991
  renderChildren: function renderChildren(ctx) {
3097
- var _this9 = this;
3098
-
3099
- var children = ctx.rule.children,
3100
- orgChildren = this.orgChildren[ctx.id];
3101
-
3102
- var isRm = function isRm(child) {
3103
- return !is.String(child) && child.__fc__ && !_this9.$handle.ctxs[child.__fc__.id];
3104
- };
3105
-
3106
- if (!is.trueArray(children) && orgChildren) {
3107
- this.$handle.deferSyncValue(function () {
3108
- orgChildren.forEach(function (child) {
3109
- if (!child) return;
3110
-
3111
- if (isRm(child)) {
3112
- _this9.$handle.rmCtx(child.__fc__);
3113
- }
3114
- });
3115
- });
3116
- this.orgChildren[ctx.id] = [];
3117
- return [];
3118
- }
3119
-
3120
- orgChildren && this.$handle.deferSyncValue(function () {
3121
- orgChildren.forEach(function (child) {
3122
- if (!child) return;
2992
+ var _this8 = this;
3123
2993
 
3124
- if (children.indexOf(child) === -1 && isRm(child)) {
3125
- _this9.$handle.rmCtx(child.__fc__);
3126
- }
3127
- });
3128
- });
3129
- return children.map(function (child) {
2994
+ var children = ctx.rule.children;
2995
+ if (!is.trueArray(children)) return {};
2996
+ var slotBag = makeSlotBag();
2997
+ children.map(function (child) {
3130
2998
  if (!child) return;
3131
- if (is.String(child)) return child;
2999
+ if (is.String(child)) return slotBag.setSlot(null, child);
3132
3000
 
3133
3001
  if (child.__fc__) {
3134
- return _this9.renderCtx(child.__fc__, ctx);
3002
+ return _this8.renderSlot(slotBag, child.__fc__, ctx);
3135
3003
  }
3136
3004
 
3137
3005
  if (child.type) {
3138
- _this9.vm.$nextTick(function () {
3139
- _this9.$handle.loadChildren(children, ctx);
3006
+ vue.nextTick(function () {
3007
+ _this8.$handle.loadChildren(children, ctx);
3140
3008
 
3141
- _this9.$handle.refresh();
3009
+ _this8.$handle.refresh();
3142
3010
  });
3143
3011
  }
3144
3012
  });
3013
+ return slotBag.getSlots();
3145
3014
  },
3146
3015
  defaultRender: function defaultRender(ctx, children) {
3147
3016
  var prop = ctx.prop;
@@ -3150,7 +3019,7 @@
3150
3019
  return this.vNode.make(lower(ctx.originType), prop, children);
3151
3020
  },
3152
3021
  renderRule: function renderRule(rule, children, origin) {
3153
- var _this10 = this;
3022
+ var _this9 = this;
3154
3023
 
3155
3024
  if (!rule) return undefined;
3156
3025
  if (is.String(rule)) return rule;
@@ -3169,26 +3038,30 @@
3169
3038
  }
3170
3039
 
3171
3040
  if (!type) return undefined;
3172
- var data = [[children]];
3041
+ var slotBag = makeSlotBag();
3173
3042
 
3174
3043
  if (is.trueArray(rule.children)) {
3175
- data.push(rule.children.map(function (v) {
3176
- return _this10.renderRule(v);
3177
- }));
3044
+ rule.children.forEach(function (v) {
3045
+ v && slotBag.setSlot(v === null || v === void 0 ? void 0 : v.slot, function () {
3046
+ return _this9.renderRule(v);
3047
+ });
3048
+ });
3178
3049
  }
3179
3050
 
3180
- return this.$h(type, _objectSpread2({}, rule), data);
3051
+ return this.vNode.make(type, rule, slotBag.mergeBag(children).getSlots());
3181
3052
  }
3182
3053
  });
3183
3054
  }
3184
3055
 
3056
+ var id = 1;
3185
3057
  function Render(handle) {
3186
3058
  extend(this, {
3187
3059
  $handle: handle,
3188
3060
  fc: handle.fc,
3189
3061
  vm: handle.vm,
3190
3062
  $manager: handle.$manager,
3191
- vNode: new handle.fc.CreateNode(handle.vm)
3063
+ vNode: new handle.fc.CreateNode(handle.vm),
3064
+ id: id++
3192
3065
  });
3193
3066
  funcProxy(this, {
3194
3067
  options: function options() {
@@ -3202,7 +3075,7 @@
3202
3075
  this.initRender();
3203
3076
  }
3204
3077
  useCache(Render);
3205
- useRender(Render);
3078
+ useRender$1(Render);
3206
3079
 
3207
3080
  function useInject(Handler) {
3208
3081
  extend(Handler.prototype, {
@@ -3235,7 +3108,7 @@
3235
3108
  }
3236
3109
  }
3237
3110
  },
3238
- parseEmit: function parseEmit(ctx, on) {
3111
+ parseEmit: function parseEmit(ctx) {
3239
3112
  var _this2 = this;
3240
3113
 
3241
3114
  var event = {},
@@ -3244,13 +3117,12 @@
3244
3117
  field = rule.field,
3245
3118
  name = rule.name,
3246
3119
  inject = rule.inject;
3247
- var emit = rule[on ? 'emit' : 'nativeEmit'] || [];
3120
+ var emit = rule.emit || [];
3248
3121
 
3249
3122
  if (is.trueArray(emit)) {
3250
3123
  var emitKey = emitPrefix || field || name;
3251
3124
 
3252
3125
  if (emitKey) {
3253
- if (!on) emitKey = "native-".concat(emitKey);
3254
3126
  emit.forEach(function (eventName) {
3255
3127
  if (!eventName) return;
3256
3128
  var eventInject;
@@ -3263,15 +3135,17 @@
3263
3135
  var fieldKey = toLine("".concat(emitKey, "-").concat(eventName));
3264
3136
 
3265
3137
  var fn = function fn() {
3266
- var _this2$vm, _this2$vm2;
3138
+ var _this2$vm, _this2$vm2, _this2$bus;
3267
3139
 
3268
3140
  for (var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++) {
3269
3141
  arg[_key] = arguments[_key];
3270
3142
  }
3271
3143
 
3272
- (_this2$vm = _this2.vm).$emit.apply(_this2$vm, [fieldKey].concat(arg));
3144
+ (_this2$vm = _this2.vm).emit.apply(_this2$vm, [fieldKey].concat(arg));
3273
3145
 
3274
- (_this2$vm2 = _this2.vm).$emit.apply(_this2$vm2, ['emit-event', fieldKey].concat(arg));
3146
+ (_this2$vm2 = _this2.vm).emit.apply(_this2$vm2, ['emit-event', fieldKey].concat(arg));
3147
+
3148
+ (_this2$bus = _this2.bus).$emit.apply(_this2$bus, [fieldKey].concat(arg));
3275
3149
  };
3276
3150
 
3277
3151
  fn.__emit = true;
@@ -3287,16 +3161,16 @@
3287
3161
  }
3288
3162
  }
3289
3163
 
3290
- ctx.computed[on ? 'on' : 'nativeOn'] = event;
3164
+ ctx.computed.on = event;
3291
3165
  return event;
3292
3166
  },
3293
3167
  getInjectData: function getInjectData(self, inject) {
3294
- var _this$vm$$options$pro = this.vm.$options.propsData,
3295
- option = _this$vm$$options$pro.option,
3296
- rule = _this$vm$$options$pro.rule;
3168
+ var _this$vm = this.vm,
3169
+ option = _this$vm.option,
3170
+ rule = _this$vm.rule;
3297
3171
  return {
3298
- api: this.api,
3299
3172
  $f: this.api,
3173
+ api: this.api,
3300
3174
  rule: rule,
3301
3175
  self: self.__origin__,
3302
3176
  option: option,
@@ -3352,7 +3226,7 @@
3352
3226
  pageEnd: this.rules.length <= first
3353
3227
  });
3354
3228
  this.bus.$on('page-end', function () {
3355
- return _this.vm.$emit('page-end', _this.api);
3229
+ return _this.vm.emit('page-end', _this.api);
3356
3230
  });
3357
3231
  this.pageLoad();
3358
3232
  },
@@ -3361,7 +3235,7 @@
3361
3235
 
3362
3236
  var pageFn = function pageFn() {
3363
3237
  if (_this2.pageEnd) {
3364
- _this2.vm.$off(EVENT, pageFn);
3238
+ _this2.bus.$off(EVENT, pageFn);
3365
3239
 
3366
3240
  _this2.bus.$emit('page-end');
3367
3241
  } else {
@@ -3374,7 +3248,7 @@
3374
3248
  }
3375
3249
  };
3376
3250
 
3377
- this.vm.$on(EVENT, pageFn);
3251
+ this.bus.$on(EVENT, pageFn);
3378
3252
  }
3379
3253
  });
3380
3254
  }
@@ -3383,7 +3257,7 @@
3383
3257
  return rules.length < 31 ? 31 : Math.ceil(rules.length / 3);
3384
3258
  }
3385
3259
 
3386
- function useRender$1(Handler) {
3260
+ function useRender(Handler) {
3387
3261
  extend(Handler.prototype, {
3388
3262
  clearNextTick: function clearNextTick() {
3389
3263
  this.nextTick && clearTimeout(this.nextTick);
@@ -3401,22 +3275,33 @@
3401
3275
  render: function render() {
3402
3276
  // console.warn('%c render', 'color:green');
3403
3277
  ++this.loadedId;
3404
- if (this.vm.unique > 0) return this.$render.render();else {
3405
- this.vm.unique = 1;
3278
+ if (this.vm.setupState.unique > 0) return this.$render.render();else {
3279
+ this.vm.setupState.unique = 1;
3406
3280
  return [];
3407
3281
  }
3408
3282
  }
3409
3283
  });
3410
3284
  }
3411
3285
 
3286
+ function isNone(ctx) {
3287
+ var none = !(is.Undef(ctx.prop.display) || !!ctx.prop.display);
3288
+
3289
+ if (ctx.parent) {
3290
+ return ctx.parent.none || none;
3291
+ } else {
3292
+ return none;
3293
+ }
3294
+ }
3295
+
3412
3296
  function bind(ctx) {
3413
3297
  Object.defineProperties(ctx.origin, {
3414
- __fc__: enumerable(ctx, true)
3298
+ __fc__: enumerable(vue.markRaw(ctx), true)
3415
3299
  });
3416
3300
  }
3417
3301
 
3418
3302
  function RuleContext(handle, rule) {
3419
3303
  var id = uniqueId();
3304
+ var isInput = !!rule.field;
3420
3305
  extend(this, {
3421
3306
  id: id,
3422
3307
  ref: id,
@@ -3424,6 +3309,7 @@
3424
3309
  rule: rule,
3425
3310
  origin: rule.__origin__ || rule,
3426
3311
  name: rule.name,
3312
+ none: false,
3427
3313
  watch: [],
3428
3314
  linkOn: [],
3429
3315
  root: [],
@@ -3433,9 +3319,10 @@
3433
3319
  prop: _objectSpread2({}, rule),
3434
3320
  computed: {},
3435
3321
  payload: {},
3436
- input: !!rule.field,
3322
+ refRule: {},
3323
+ input: isInput,
3437
3324
  el: undefined,
3438
- defaultValue: rule.field ? deepCopy(rule.value) : undefined,
3325
+ defaultValue: isInput ? deepCopy(rule.value) : undefined,
3439
3326
  field: rule.field || undefined
3440
3327
  });
3441
3328
  this.updateType();
@@ -3476,6 +3363,9 @@
3476
3363
  return _this.payload[k];
3477
3364
  })), [this.computed]));
3478
3365
  },
3366
+ initNone: function initNone() {
3367
+ this.none = isNone(this);
3368
+ },
3479
3369
  check: function check(handle) {
3480
3370
  return this.vm === handle.vm;
3481
3371
  },
@@ -3484,6 +3374,7 @@
3484
3374
  return un();
3485
3375
  });
3486
3376
  this.watch = [];
3377
+ this.refRule = {};
3487
3378
  },
3488
3379
  unlink: function unlink() {
3489
3380
  this.linkOn.forEach(function (un) {
@@ -3496,7 +3387,11 @@
3496
3387
  this.$handle.appendLink(this);
3497
3388
  },
3498
3389
  watchTo: function watchTo() {
3499
- this.$handle.watchCtx(this);
3390
+ var _this2 = this;
3391
+
3392
+ vue.nextTick(function () {
3393
+ _this2.$handle.watchCtx(_this2);
3394
+ });
3500
3395
  },
3501
3396
  "delete": function _delete() {
3502
3397
  var undef = void 0;
@@ -3514,7 +3409,8 @@
3514
3409
  vm: undef,
3515
3410
  vNode: undef,
3516
3411
  parent: null,
3517
- cacheConfig: null
3412
+ cacheConfig: null,
3413
+ none: false
3518
3414
  });
3519
3415
  },
3520
3416
  rmCtrl: function rmCtrl() {
@@ -3524,15 +3420,15 @@
3524
3420
  this.ctrlRule = [];
3525
3421
  },
3526
3422
  rm: function rm() {
3527
- var _this2 = this;
3423
+ var _this3 = this;
3528
3424
 
3529
3425
  var _rm = function _rm() {
3530
- var index = _this2.root.indexOf(_this2.origin);
3426
+ var index = _this3.root.indexOf(_this3.origin);
3531
3427
 
3532
3428
  if (index > -1) {
3533
- _this2.root.splice(index, 1);
3429
+ _this3.root.splice(index, 1);
3534
3430
 
3535
- _this2.$handle && _this2.$handle.refresh();
3431
+ _this3.$handle && _this3.$handle.refresh();
3536
3432
  }
3537
3433
  };
3538
3434
 
@@ -3543,17 +3439,17 @@
3543
3439
  }
3544
3440
 
3545
3441
  this.$handle.noWatch(function () {
3546
- _this2.$handle.deferSyncValue(function () {
3547
- _this2.rmCtrl();
3442
+ _this3.$handle.deferSyncValue(function () {
3443
+ _this3.rmCtrl();
3548
3444
 
3549
3445
  _rm();
3550
3446
 
3551
- _this2.$handle.rmCtx(_this2);
3447
+ _this3.$handle.rmCtx(_this3);
3552
3448
 
3553
- extend(_this2, {
3449
+ extend(_this3, {
3554
3450
  root: []
3555
3451
  });
3556
- }, _this2.input);
3452
+ }, _this3.input);
3557
3453
  });
3558
3454
  },
3559
3455
  update: function update(handle, init) {
@@ -3579,7 +3475,7 @@
3579
3475
  var _this = this;
3580
3476
 
3581
3477
  var id = this.loadedId;
3582
- this.vm.$nextTick(function () {
3478
+ vue.nextTick(function () {
3583
3479
  id === _this.loadedId && (fn ? fn() : _this.refresh());
3584
3480
  });
3585
3481
  },
@@ -3611,7 +3507,7 @@
3611
3507
  loadFn: function loadFn(item, rule) {
3612
3508
  var _this3 = this;
3613
3509
 
3614
- ['on', 'props', 'nativeOn', 'deep'].forEach(function (k) {
3510
+ ['on', 'props', 'deep'].forEach(function (k) {
3615
3511
  item[k] && _this3.parseInjectEvent(rule, item[k]);
3616
3512
  });
3617
3513
  },
@@ -3631,7 +3527,7 @@
3631
3527
  pre["update:".concat(prop)] = function (val) {
3632
3528
  rule.props[prop] = val;
3633
3529
 
3634
- _this4.vm.$emit('sync', prop, val, rule, _this4.fapi);
3530
+ _this4.vm.emit('sync', prop, val, rule, _this4.fapi);
3635
3531
  };
3636
3532
 
3637
3533
  return pre;
@@ -3662,9 +3558,7 @@
3662
3558
  _this5.bus.$emit('load-end');
3663
3559
  }
3664
3560
 
3665
- _this5.vm._renderRule();
3666
-
3667
- _this5.$render.initOrgChildren();
3561
+ _this5.vm.setupState.renderRule();
3668
3562
 
3669
3563
  _this5.syncForm();
3670
3564
  });
@@ -3729,7 +3623,7 @@
3729
3623
  });
3730
3624
 
3731
3625
  if (isRepeat()) {
3732
- _this6.vm.$emit('repeat-field', _rule, _this6.api);
3626
+ _this6.vm.emit('repeat-field', _rule, _this6.api);
3733
3627
  }
3734
3628
 
3735
3629
  var ctx;
@@ -3775,9 +3669,7 @@
3775
3669
  _this6.appendValue(ctx.rule);
3776
3670
  }
3777
3671
 
3778
- [false, true].forEach(function (b) {
3779
- return _this6.parseEmit(ctx, b);
3780
- });
3672
+ _this6.parseEmit(ctx);
3781
3673
 
3782
3674
  _this6.syncProp(ctx);
3783
3675
 
@@ -3811,9 +3703,10 @@
3811
3703
  }
3812
3704
 
3813
3705
  _this6.effect(ctx, 'loaded');
3814
- }
3706
+ } // if (ctx.input)
3707
+ // Object.defineProperty(r, 'value', this.valueHandle(ctx));
3708
+
3815
3709
 
3816
- if (ctx.input) Object.defineProperty(r, 'value', _this6.valueHandle(ctx));
3817
3710
  if (_this6.refreshControl(ctx)) _this6.cycleLoad = true;
3818
3711
  return ctx;
3819
3712
  });
@@ -3873,18 +3766,16 @@
3873
3766
  children: rule,
3874
3767
  valid: valid
3875
3768
  }) : ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl), 1);
3876
-
3877
- _this7.vm.$nextTick(function () {
3769
+ vue.nextTick(function () {
3878
3770
  _this7.api.hidden(!valid, rule);
3879
3771
  });
3880
-
3881
3772
  return;
3882
3773
  }
3883
3774
 
3884
3775
  if (valid) {
3885
3776
  flag = true;
3886
3777
  var ruleCon = {
3887
- type: 'fcFragment',
3778
+ type: 'template',
3888
3779
  "native": true,
3889
3780
  __ctrl: true,
3890
3781
  children: rule
@@ -3908,7 +3799,7 @@
3908
3799
  }
3909
3800
  });
3910
3801
  });
3911
- this.vm.$emit('control', ctx.origin, this.api);
3802
+ this.vm.emit('control', ctx.origin, this.api);
3912
3803
  this.effect(ctx, 'control');
3913
3804
  return flag;
3914
3805
  },
@@ -3924,7 +3815,6 @@
3924
3815
  var ctxs = _objectSpread2({}, this.ctxs);
3925
3816
 
3926
3817
  this.clearNextTick();
3927
- this.$render.clearOrgChildren();
3928
3818
  this.initData(rules);
3929
3819
  this.fc.rules = rules;
3930
3820
  this.bus.$once('load-end', function () {
@@ -3945,7 +3835,7 @@
3945
3835
  },
3946
3836
  //todo 组件生成全部通过 alias
3947
3837
  refresh: function refresh() {
3948
- this.vm._refresh();
3838
+ this.vm.setupState.refresh();
3949
3839
  }
3950
3840
  });
3951
3841
  }
@@ -3976,29 +3866,22 @@
3976
3866
 
3977
3867
  function useInput(Handler) {
3978
3868
  extend(Handler.prototype, {
3979
- getValue: function getValue(ctx) {
3980
- if (!hasProperty(ctx, 'cacheValue')) {
3981
- ctx.cacheValue = ctx.parser.toValue(this.getFormData(ctx), ctx);
3982
- }
3983
-
3984
- return ctx.cacheValue;
3985
- },
3986
3869
  setValue: function setValue(ctx, value, formValue, setFlag) {
3987
3870
  if (ctx.deleted) return;
3988
- ctx.cacheValue = value;
3871
+ ctx.rule.value = value;
3989
3872
  this.changeStatus = true;
3990
3873
  this.nextRefresh();
3991
3874
  this.$render.clearCache(ctx);
3992
3875
  this.setFormData(ctx, formValue);
3993
3876
  this.syncValue();
3994
3877
  this.valueChange(ctx, value);
3995
- this.vm.$emit('change', ctx.field, value, ctx.origin, this.api, setFlag);
3878
+ this.vm.emit('change', ctx.field, value, ctx.origin, this.api, setFlag);
3996
3879
  this.effect(ctx, 'value');
3997
3880
  },
3998
3881
  onInput: function onInput(ctx, value) {
3999
3882
  var val;
4000
3883
 
4001
- if (ctx.input && (this.isQuote(ctx, val = ctx.parser.toValue(value, ctx)) || this.isChange(ctx, val))) {
3884
+ if (ctx.input && (this.isQuote(ctx, val = ctx.parser.toValue(value, ctx)) || this.isChange(ctx, value))) {
4002
3885
  this.setValue(ctx, val, value);
4003
3886
  }
4004
3887
  },
@@ -4008,59 +3891,33 @@
4008
3891
  getFormData: function getFormData(ctx) {
4009
3892
  return this.formData[ctx.id];
4010
3893
  },
4011
- validate: function validate() {
4012
- var _this = this;
4013
-
4014
- toEmpty(this.vm.validate);
4015
- this.fields().forEach(function (id) {
4016
- _this.fieldCtx[id].forEach(function (ctx) {
4017
- _this.vm.validate[ctx.id] = toArray(ctx.rule.validate);
4018
- });
4019
- });
4020
- return this.vm.validate;
4021
- },
4022
3894
  syncForm: function syncForm() {
4023
- var _this2 = this;
4024
-
4025
- toEmpty(this.form);
4026
- Object.defineProperties(this.form, this.fields().reduce(function (initial, field) {
4027
- var ctx = _this2.getFieldCtx(field);
3895
+ var _this = this;
4028
3896
 
4029
- var handle = _this2.valueHandle(ctx);
3897
+ this.fields().reduce(function (initial, field) {
3898
+ var ctx = _this.getCtx(field);
4030
3899
 
4031
- handle.configurable = true;
4032
- initial[field] = handle;
3900
+ initial[field] = vue.toRef(ctx.rule, 'value');
4033
3901
  return initial;
4034
3902
  }, Object.keys(this.appendData).reduce(function (initial, field) {
4035
- initial[field] = {
4036
- enumerable: true,
4037
- configurable: true,
4038
- get: function get() {
4039
- return _this2.appendData[field];
4040
- },
4041
- set: function set(val) {
4042
- _this2.appendData[field] = val;
4043
- }
4044
- };
3903
+ initial[field] = vue.customRef(function (track, trigger) {
3904
+ return {
3905
+ get: function get() {
3906
+ track();
3907
+ return _this.appendData[field];
3908
+ },
3909
+ set: function set(val) {
3910
+ trigger();
3911
+ _this.appendData[field] = val;
3912
+
3913
+ _this.syncValue();
3914
+ }
3915
+ };
3916
+ });
4045
3917
  return initial;
4046
- }, {})));
3918
+ }, this.form));
4047
3919
  this.syncValue();
4048
3920
  },
4049
- valueHandle: function valueHandle(ctx) {
4050
- var _this3 = this;
4051
-
4052
- return {
4053
- enumerable: true,
4054
- get: function get() {
4055
- return _this3.getValue(ctx);
4056
- },
4057
- set: function set(value) {
4058
- if (_this3.isChange(ctx, value)) {
4059
- _this3.setValue(ctx, value, ctx.parser.toFormValue(value, ctx), true);
4060
- }
4061
- }
4062
- };
4063
- },
4064
3921
  appendValue: function appendValue(rule) {
4065
3922
  if (!rule.field || !hasProperty(this.appendData, rule.field)) return;
4066
3923
  rule.value = this.appendData[rule.field];
@@ -4095,20 +3952,20 @@
4095
3952
  return this.deferSyncFn.sync = true;
4096
3953
  }
4097
3954
 
4098
- this.vm._updateValue(_objectSpread2({}, this.form));
3955
+ this.vm.setupState.updateValue(_objectSpread2({}, this.form));
4099
3956
  },
4100
3957
  isChange: function isChange(ctx, value) {
4101
- return JSON.stringify(ctx.rule.value) !== JSON.stringify(value);
3958
+ return JSON.stringify(this.getFormData(ctx)) !== JSON.stringify(value);
4102
3959
  },
4103
3960
  isQuote: function isQuote(ctx, value) {
4104
3961
  return (is.Object(value) || Array.isArray(value)) && value === ctx.rule.value;
4105
3962
  },
4106
3963
  refreshUpdate: function refreshUpdate(ctx, val) {
4107
- var _this4 = this;
3964
+ var _this2 = this;
4108
3965
 
4109
3966
  if (is.Function(ctx.rule.update)) {
4110
3967
  var state = invoke(function () {
4111
- return ctx.rule.update(val, ctx.origin, _this4.api);
3968
+ return ctx.rule.update(val, ctx.origin, _this2.api);
4112
3969
  });
4113
3970
  if (state === undefined) return;
4114
3971
  ctx.rule.hidden = state === true;
@@ -4128,18 +3985,18 @@
4128
3985
  this.refreshUpdate(ctx, val);
4129
3986
  },
4130
3987
  appendLink: function appendLink(ctx) {
4131
- var _this5 = this;
3988
+ var _this3 = this;
4132
3989
 
4133
3990
  var link = ctx.rule.link;
4134
3991
  is.trueArray(link) && link.forEach(function (field) {
4135
3992
  var fn = function fn() {
4136
- return _this5.refreshRule(ctx, ctx.rule.value);
3993
+ return _this3.refreshRule(ctx, ctx.rule.value);
4137
3994
  };
4138
3995
 
4139
- _this5.bus.$on('change-' + field, fn);
3996
+ _this3.bus.$on('change-' + field, fn);
4140
3997
 
4141
3998
  ctx.linkOn.push(function () {
4142
- return _this5.bus.$off('change-' + field, fn);
3999
+ return _this3.bus.$off('change-' + field, fn);
4143
4000
  });
4144
4001
  });
4145
4002
  },
@@ -4149,12 +4006,6 @@
4149
4006
  });
4150
4007
  }
4151
4008
 
4152
- function toEmpty(obj) {
4153
- Object.keys(obj).forEach(function (k) {
4154
- return delete obj[k];
4155
- });
4156
- }
4157
-
4158
4009
  var BaseParser = {
4159
4010
  init: function init(ctx) {},
4160
4011
  toFormValue: function toFormValue(value, ctx) {
@@ -4217,7 +4068,7 @@
4217
4068
  this.setFormData(ctx, ctx.parser.toFormValue(rule.value, ctx));
4218
4069
 
4219
4070
  if (this.isMounted && !this.reloading) {
4220
- this.vm.$emit('change', ctx.field, rule.value, ctx.origin, this.api);
4071
+ this.vm.emit('change', ctx.field, rule.value, ctx.origin, this.api);
4221
4072
  }
4222
4073
  },
4223
4074
  getParser: function getParser(ctx) {
@@ -4246,16 +4097,21 @@
4246
4097
  watchCtx: function watchCtx(ctx) {
4247
4098
  var _this = this;
4248
4099
 
4249
- var vm = this.vm;
4250
4100
  var none = ['field', 'value', 'vm', 'template', 'name', 'config', 'control', 'inject', 'sync', 'payload', 'optionsTo', 'update'];
4251
- Object.keys(ctx.rule).filter(function (k) {
4101
+ var all = attrs();
4102
+ all.filter(function (k) {
4252
4103
  return none.indexOf(k) === -1;
4253
4104
  }).forEach(function (key) {
4105
+ var ref = vue.toRef(ctx.rule, key);
4254
4106
  var flag = key === 'children';
4255
- ctx.watch.push(vm.$watch(function () {
4256
- return ctx.rule[key];
4257
- }, function (n, o) {
4258
- if (_this.loading || _this.noWatchFn || _this.reloading) return;
4107
+ ctx.refRule[key] = ref;
4108
+ ctx.watch.push(vue.watch(flag ? function () {
4109
+ return _toConsumableArray(ref.value || []);
4110
+ } : function () {
4111
+ return ref.value;
4112
+ }, function (_, o) {
4113
+ var n = ref.value;
4114
+ if (_this.isBreakWatch()) return;
4259
4115
 
4260
4116
  if (flag && ctx.parser.loadChildren === false) {
4261
4117
  _this.$render.clearCache(ctx);
@@ -4265,34 +4121,29 @@
4265
4121
  return;
4266
4122
  }
4267
4123
 
4268
- _this.watching = true; // if (key === 'hidden')
4269
- // ctx.updateKey(true);
4270
- // else
4124
+ _this.watching = true;
4271
4125
 
4272
4126
  if (key === 'link') {
4273
4127
  ctx.link();
4274
4128
  return;
4275
- } else if (['props', 'on', 'nativeOn', 'deep'].indexOf(key) > -1) {
4129
+ } else if (['props', 'on', 'deep'].indexOf(key) > -1) {
4276
4130
  _this.parseInjectEvent(ctx.rule, n || {});
4277
4131
 
4278
4132
  if (key === 'props' && ctx.input) {
4279
4133
  _this.setFormData(ctx, ctx.parser.toFormValue(ctx.rule.value, ctx));
4280
4134
  }
4281
- } else if (['emit', 'nativeEmit'].indexOf(key) > -1) _this.parseEmit(ctx, key === 'emit');else if (['prefix', 'suffix'].indexOf(key) > -1) n && _this.loadFn(n, ctx.rule);else if (key === 'type') {
4135
+ } else if (key === 'emit') _this.parseEmit(ctx);else if (['prefix', 'suffix'].indexOf(key) > -1) n && _this.loadFn(n, ctx.rule);else if (key === 'type') {
4282
4136
  ctx.updateType();
4283
4137
 
4284
4138
  _this.bindParser(ctx);
4285
4139
  } else if (key === 'children') {
4286
- var _flag = is.trueArray(n);
4287
-
4288
4140
  _this.deferSyncValue(function () {
4289
- if (n !== o) {
4290
- _this.rmSub(o);
4291
-
4292
- _this.$render.initOrgChildren();
4293
- }
4294
-
4295
- _flag && _this.loadChildren(n, ctx);
4141
+ o && o.forEach(function (child) {
4142
+ if ((n || []).indexOf(child) === -1 && child && !is.String(child) && child.__fc__ && !_this.ctxs[child.__fc__.id]) {
4143
+ _this.rmCtx(child.__fc__);
4144
+ }
4145
+ });
4146
+ is.trueArray(n) && _this.loadChildren(n, ctx);
4296
4147
  });
4297
4148
  }
4298
4149
 
@@ -4304,6 +4155,20 @@
4304
4155
  sync: flag
4305
4156
  }));
4306
4157
  });
4158
+
4159
+ if (ctx.input) {
4160
+ var val = vue.toRef(ctx.rule, 'value');
4161
+ ctx.watch.push(vue.watch(function () {
4162
+ return val.value;
4163
+ }, function () {
4164
+ var formValue = ctx.parser.toFormValue(val.value, ctx);
4165
+
4166
+ if (_this.isChange(ctx, formValue)) {
4167
+ _this.setValue(ctx, val.value, formValue, true);
4168
+ }
4169
+ }));
4170
+ }
4171
+
4307
4172
  this.watchEffect(ctx);
4308
4173
  },
4309
4174
  rmSub: function rmSub(sub) {
@@ -4321,21 +4186,9 @@
4321
4186
  field = ctx.field,
4322
4187
  input = ctx.input,
4323
4188
  name = ctx.name;
4324
-
4325
- if (ctx.input) {
4326
- Object.defineProperty(ctx.rule, 'value', {
4327
- value: ctx.rule.value,
4328
- writable: true
4329
- });
4330
- }
4331
-
4332
4189
  $del(this.ctxs, id);
4333
- $del(this.$render.tempList, id);
4334
- $del(this.$render.orgChildren, id);
4335
- $del(this.vm.ctxInject, id);
4336
4190
  $del(this.formData, id);
4337
4191
  $del(this.subForm, id);
4338
- $del(ctx, 'cacheValue');
4339
4192
  input && this.rmIdCtx(ctx, field, 'field');
4340
4193
  name && this.rmIdCtx(ctx, name, 'name');
4341
4194
  this.deferSyncValue(function () {
@@ -4349,7 +4202,7 @@
4349
4202
  }
4350
4203
 
4351
4204
  if (ctx.root === _this3.rules) {
4352
- _this3.vm._renderRule();
4205
+ _this3.vm.setupState.renderRule();
4353
4206
  }
4354
4207
  }
4355
4208
  }, input);
@@ -4362,8 +4215,8 @@
4362
4215
  this.$render.clearCache(ctx);
4363
4216
  ctx["delete"]();
4364
4217
  this.effect(ctx, 'deleted');
4365
- input && !this.fieldCtx[field] && this.vm.$emit('removeField', field, ctx.rule, this.api);
4366
- ctx.rule.__ctrl || this.vm.$emit('removeRule', ctx.rule, this.api);
4218
+ input && !this.fieldCtx[field] && this.vm.emit('removeField', field, ctx.rule, this.api);
4219
+ ctx.rule.__ctrl || this.vm.emit('removeRule', ctx.rule, this.api);
4367
4220
  return ctx;
4368
4221
  }
4369
4222
  });
@@ -4393,7 +4246,7 @@
4393
4246
  is.Function(fn) && invoke(function () {
4394
4247
  return fn(_this2.api);
4395
4248
  });
4396
- this.vm.$emit(name, this.api);
4249
+ this.vm.emit(name, this.api);
4397
4250
  }
4398
4251
  });
4399
4252
  }
@@ -4431,9 +4284,9 @@
4431
4284
  watchEffect: function watchEffect(ctx) {
4432
4285
  var _this3 = this;
4433
4286
 
4434
- var vm = this.vm;
4287
+ this.vm;
4435
4288
  Object.keys(ctx.rule.effect || {}).forEach(function (k) {
4436
- ctx.watch.push(vm.$watch(function () {
4289
+ ctx.watch.push(vue.watch(function () {
4437
4290
  return ctx.rule.effect[k];
4438
4291
  }, function (n) {
4439
4292
  _this3.effect(ctx, 'watch', _defineProperty({}, k, n));
@@ -4528,6 +4381,14 @@
4528
4381
  function Handler(fc) {
4529
4382
  var _this = this;
4530
4383
 
4384
+ funcProxy(this, {
4385
+ options: function options() {
4386
+ return fc.options.value || {};
4387
+ },
4388
+ bus: function bus() {
4389
+ return fc.bus;
4390
+ }
4391
+ });
4531
4392
  extend(this, {
4532
4393
  fc: fc,
4533
4394
  vm: fc.vm,
@@ -4537,9 +4398,9 @@
4537
4398
  noWatchFn: null,
4538
4399
  deferSyncFn: null,
4539
4400
  isMounted: false,
4540
- formData: {},
4401
+ formData: vue.reactive({}),
4541
4402
  subForm: {},
4542
- form: {},
4403
+ form: vue.reactive({}),
4543
4404
  appendData: {},
4544
4405
  providers: {},
4545
4406
  cycleLoad: null,
@@ -4551,14 +4412,6 @@
4551
4412
  _this.lifecycle('reload');
4552
4413
  }
4553
4414
  });
4554
- funcProxy(this, {
4555
- options: function options() {
4556
- return fc.options;
4557
- },
4558
- bus: function bus() {
4559
- return fc.bus;
4560
- }
4561
- });
4562
4415
  this.initData(fc.rules);
4563
4416
  this.$manager = new fc.manager(this);
4564
4417
  this.$render = new Render(this);
@@ -4575,19 +4428,20 @@
4575
4428
  });
4576
4429
  },
4577
4430
  init: function init() {
4578
- this.appendData = _objectSpread2(_objectSpread2(_objectSpread2({}, this.fc.options.formData || {}), this.vm.value || {}), this.appendData);
4431
+ this.appendData = _objectSpread2(_objectSpread2(_objectSpread2({}, this.options.formData || {}), this.fc.vm.props.modelValue || {}), this.appendData);
4579
4432
  this.useProvider();
4580
4433
  this.usePage();
4581
4434
  this.loadRule();
4582
4435
 
4583
4436
  this.$manager.__init();
4584
-
4585
- this.vm.$set(this.vm, 'formData', this.formData);
4437
+ },
4438
+ isBreakWatch: function isBreakWatch() {
4439
+ return this.loading || this.noWatchFn || this.reloading;
4586
4440
  }
4587
4441
  });
4588
4442
  useInject(Handler);
4589
4443
  usePage(Handler);
4590
- useRender$1(Handler);
4444
+ useRender(Handler);
4591
4445
  useLoader(Handler);
4592
4446
  useInput(Handler);
4593
4447
  useContext(Handler);
@@ -4665,42 +4519,65 @@
4665
4519
  xhr.send(formData);
4666
4520
  }
4667
4521
 
4668
- var NAME$9 = 'fcFragment';
4669
- var fragment = {
4670
- name: NAME$9,
4671
- functional: true,
4522
+ var NAME$1 = 'FcFragment';
4523
+ var fragment = vue.defineComponent({
4524
+ name: NAME$1,
4525
+ inheritAttrs: false,
4526
+ props: ['formCreateInject'],
4527
+ setup: function setup(props) {
4528
+ var data = vue.toRef(props, 'formCreateInject');
4529
+ var $inject = vue.reactive(_objectSpread2({}, data.value));
4530
+ vue.watch(data, function () {
4531
+ extend($inject, data.value);
4532
+ });
4533
+ vue.provide('formCreateInject', $inject);
4534
+ },
4535
+ render: function render() {
4536
+ return this.$slots["default"]();
4537
+ }
4538
+ });
4539
+
4540
+ var NAME = 'FcVnode';
4541
+ var vnode = vue.defineComponent({
4542
+ name: NAME,
4543
+ inheritAttrs: false,
4672
4544
  props: ['vnode'],
4673
- render: function render(h, ctx) {
4674
- return ctx.props.vnode ? ctx.props.vnode : ctx.children;
4545
+ render: function render() {
4546
+ return this.vnode;
4675
4547
  }
4676
- };
4548
+ });
4677
4549
 
4678
- function parseProp(prop) {
4679
- if (is.String(prop)) return {
4680
- domProps: {
4681
- innerHTML: prop
4682
- }
4683
- };
4684
- return prop;
4550
+ function tidyDirectives(directives) {
4551
+ return Object.keys(directives).map(function (n) {
4552
+ var directive = directives[n];
4553
+ return [vue.resolveDirective(n), directive.arg, directive.value, directive.modifiers];
4554
+ });
4555
+ }
4556
+
4557
+ function makeDirective(data, vn) {
4558
+ var directives = data.directives;
4559
+ if (!directives) return vn;
4560
+
4561
+ if (!Array.isArray(directives)) {
4562
+ directives = [directives];
4563
+ }
4564
+
4565
+ return vue.withDirectives(vn, directives.reduce(function (lst, v) {
4566
+ return lst.concat(tidyDirectives(v));
4567
+ }, []));
4685
4568
  }
4686
4569
 
4687
4570
  function CreateNodeFactory() {
4688
4571
  var aliasMap = {};
4689
4572
 
4690
- function CreateNode(vm) {
4691
- vm && this.setVm(vm);
4692
- }
4573
+ function CreateNode() {}
4693
4574
 
4694
4575
  extend(CreateNode.prototype, {
4695
- setVm: function setVm(vm) {
4696
- this.vm = vm;
4697
- this.$h = vm.$createElement;
4698
- },
4699
4576
  make: function make(tag, data, children) {
4700
- if (Vue.config.isReservedTag(tag) && data.nativeOn) delete data.nativeOn;
4701
- var Node = this.$h(tag, parseProp(data), children || []);
4702
- Node.context = this.vm;
4703
- return Node;
4577
+ return makeDirective(data, this.h(tag, toProps(data), children));
4578
+ },
4579
+ h: function h(tag, data, children) {
4580
+ return vue.createVNode(vue.getCurrentInstance().appContext.config.isNativeTag(tag) ? tag : vue.resolveComponent(tag), data, children);
4704
4581
  },
4705
4582
  aliasMap: aliasMap
4706
4583
  });
@@ -4778,7 +4655,7 @@
4778
4655
  update: function update() {},
4779
4656
  beforeRender: function beforeRender() {},
4780
4657
  form: function form() {
4781
- return this.vm.$refs[this.ref];
4658
+ return this.vm.refs[this.ref];
4782
4659
  },
4783
4660
  mergeOptions: function mergeOptions(args, opt) {
4784
4661
  var _this2 = this;
@@ -4879,9 +4756,7 @@
4879
4756
  return true;
4880
4757
  }
4881
4758
 
4882
- var _vue = typeof window !== 'undefined' && window.Vue ? window.Vue : Vue;
4883
-
4884
- function _parseProp(name, id) {
4759
+ function parseProp(name, id) {
4885
4760
  var prop;
4886
4761
 
4887
4762
  if (arguments.length === 2) {
@@ -4898,32 +4773,7 @@
4898
4773
  }
4899
4774
 
4900
4775
  function nameProp() {
4901
- return _parseProp.apply(void 0, ['name'].concat(Array.prototype.slice.call(arguments)));
4902
- }
4903
-
4904
- function _getEl(options) {
4905
- if (!options || !options.el) return window.document.body;
4906
- return is.Element(options.el) ? options.el : document.querySelector(options.el);
4907
- }
4908
-
4909
- function mountForm(rules, option) {
4910
- var $vm = new _vue({
4911
- data: function data() {
4912
- //todo 外部无法修改
4913
- return {
4914
- rule: rules,
4915
- option: option || {}
4916
- };
4917
- },
4918
- render: function render(h) {
4919
- return h('FormCreate', {
4920
- ref: 'fc',
4921
- props: this.$data
4922
- });
4923
- }
4924
- });
4925
- $vm.$mount();
4926
- return $vm;
4776
+ return parseProp.apply(void 0, ['name'].concat(Array.prototype.slice.call(arguments)));
4927
4777
  }
4928
4778
 
4929
4779
  function exportAttrs(attrs) {
@@ -4942,6 +4792,7 @@
4942
4792
 
4943
4793
  var parsers = {};
4944
4794
  var directives = {};
4795
+ var modelFields = {};
4945
4796
  var providers = {
4946
4797
  fetch: $fetch
4947
4798
  };
@@ -4986,9 +4837,7 @@
4986
4837
  if (is.String(id)) {
4987
4838
  name = toCase(id);
4988
4839
 
4989
- if (['form-create', 'formcreate'].indexOf(name) > -1) {
4990
- return $form();
4991
- } else if (component === undefined) {
4840
+ if (component === undefined) {
4992
4841
  return components[name];
4993
4842
  }
4994
4843
  } else {
@@ -5002,11 +4851,28 @@
5002
4851
  }
5003
4852
 
5004
4853
  function $form() {
5005
- return _vue.extend($FormCreate(FormCreate));
4854
+ return $FormCreate(FormCreate);
4855
+ }
4856
+
4857
+ function createFormApp(rule, option) {
4858
+ var Type = $form();
4859
+ return vue.createApp({
4860
+ data: function data() {
4861
+ return vue.reactive({
4862
+ rule: rule,
4863
+ option: option
4864
+ });
4865
+ },
4866
+ render: function render() {
4867
+ return vue.h(Type, _objectSpread2({
4868
+ ref: 'fc'
4869
+ }, this.$data));
4870
+ }
4871
+ });
5006
4872
  }
5007
4873
 
5008
4874
  function $vnode() {
5009
- return _vue.extend(fragment);
4875
+ return vnode;
5010
4876
  } //todo 检查回调函数作用域
5011
4877
 
5012
4878
 
@@ -5015,95 +4881,91 @@
5015
4881
  return this;
5016
4882
  }
5017
4883
 
5018
- function create(rules, _opt, parent) {
5019
- var $vm = mountForm(rules, _opt || {});
5020
- var _this = $vm.$refs.fc.formCreate;
5021
- _this.$parent = parent;
5022
-
5023
- _getEl(_this.options).appendChild($vm.$el);
5024
-
5025
- return _this.api();
4884
+ function create(rules, option) {
4885
+ var app = createFormApp(rules, option || {});
4886
+ config.appUse && config.appUse(app);
4887
+ var div = document.createElement('div');
4888
+ ((option === null || option === void 0 ? void 0 : option.el) || document.body).appendChild(div);
4889
+ var vm = app.mount(div);
4890
+ return vm.$refs.fc.fapi;
5026
4891
  }
5027
4892
 
5028
4893
  function factory() {
5029
4894
  return FormCreateFactory(config);
5030
4895
  }
5031
4896
 
5032
- function FormCreate(vm, rules, options) {
4897
+ function setModelField(name, field) {
4898
+ modelFields[name] = field;
4899
+ }
4900
+
4901
+ function FormCreate(vm) {
4902
+ var _this = this;
4903
+
5033
4904
  extend(this, {
5034
- vm: vm,
5035
4905
  create: create,
4906
+ vm: vm,
5036
4907
  manager: createManager(config.manager),
5037
4908
  parsers: parsers,
5038
4909
  providers: providers,
5039
- rules: Array.isArray(rules) ? rules : [],
4910
+ modelFields: modelFields,
4911
+ rules: vm.props.rule,
5040
4912
  prop: {
5041
4913
  components: components,
5042
4914
  directives: directives
5043
4915
  },
5044
4916
  CreateNode: CreateNode,
5045
- bus: new _vue(),
4917
+ bus: new Mitt(),
5046
4918
  unwatch: null,
4919
+ options: vue.ref({}),
5047
4920
  extendApi: config.extendApi || function (api) {
5048
4921
  return api;
5049
4922
  }
5050
4923
  });
5051
- this.init();
5052
- this.initOptions(options || {});
4924
+ vue.nextTick(function () {
4925
+ vue.watch(_this.options, function () {
4926
+ _this.$handle.$manager.updateOptions(_this.options.value);
4927
+
4928
+ _this.api().refresh();
4929
+ }, {
4930
+ deep: true
4931
+ });
4932
+ });
4933
+ extend(vm.appContext.components, components);
4934
+ extend(vm.appContext.directives, directives);
4935
+ this.$handle = new Handler(this);
5053
4936
  }
5054
4937
 
5055
4938
  extend(FormCreate.prototype, {
5056
4939
  init: function init() {
5057
4940
  var _this2 = this;
5058
4941
 
5059
- var vm = this.vm;
5060
- var h = new Handler(this);
5061
- this.$handle = h;
5062
- vm.$f = h.api;
5063
- vm.$emit('input', h.api);
5064
- vm.$on('hook:created', function () {
5065
- if (_this2.isSub()) {
5066
- _this2.unwatch = vm.$watch(function () {
5067
- return vm.$pfc.option;
5068
- }, function () {
5069
- _this2.initOptions(_this2.options);
5070
-
5071
- vm.$f.refresh();
5072
- }, {
5073
- deep: true
5074
- });
5075
-
5076
- _this2.initOptions(_this2.options);
5077
- }
4942
+ if (this.isSub()) {
4943
+ this.unwatch = vue.watch(function () {
4944
+ return _this2.vm.parent.option;
4945
+ }, function () {
4946
+ _this2.initOptions(_this2.options.value);
5078
4947
 
5079
- _this2.created();
5080
- });
5081
- vm.$on('hook:mounted', function () {
5082
- _this2.mounted();
5083
- });
5084
- vm.$on('hook:beforeDestroy', function () {
5085
- vm.destroyed = true;
5086
- _this2.unwatch && _this2.unwatch();
5087
- h.reloadRule([]);
5088
- });
5089
- vm.$on('hook:updated', function () {
5090
- h.bindNextTick(function () {
5091
- return _this2.bus.$emit('next-tick', h.api);
4948
+ _this2.$handle.api.refresh();
4949
+ }, {
4950
+ deep: true
5092
4951
  });
5093
- });
4952
+ }
4953
+
4954
+ this.initOptions(this.vm.props.option || {});
4955
+ this.$handle.init();
5094
4956
  },
5095
4957
  isSub: function isSub() {
5096
- return this.vm.$pfc && this.vm.extendOption;
4958
+ return this.vm.setupState.parent && this.vm.setupState.extendOption;
5097
4959
  },
5098
4960
  initOptions: function initOptions(options) {
5099
- this.options = _objectSpread2({
4961
+ this.options.value = _objectSpread2({
5100
4962
  formData: {},
5101
4963
  submitBtn: {},
5102
4964
  resetBtn: {}
5103
4965
  }, deepCopy(globalConfig));
5104
4966
 
5105
4967
  if (this.isSub()) {
5106
- this.mergeOptions(this.options, this.vm.$pfc.$f.config || {}, true);
4968
+ this.options.value = this.mergeOptions(this.options.value, this.vm.setupState.parent.setupState.fapi.config || {}, true);
5107
4969
  }
5108
4970
 
5109
4971
  this.updateOptions(options);
@@ -5123,11 +4985,8 @@
5123
4985
  return target;
5124
4986
  },
5125
4987
  updateOptions: function updateOptions(options) {
5126
- this.mergeOptions(this.options, options);
5127
- this.$handle.$manager.updateOptions(this.options);
5128
- },
5129
- created: function created() {
5130
- this.$handle.init();
4988
+ this.options.value = this.mergeOptions(this.options.value, options);
4989
+ this.$handle.$manager.updateOptions(this.options.value);
5131
4990
  },
5132
4991
  api: function api() {
5133
4992
  return this.$handle.api;
@@ -5137,6 +4996,17 @@
5137
4996
  },
5138
4997
  mounted: function mounted() {
5139
4998
  this.$handle.mounted();
4999
+ },
5000
+ unmount: function unmount() {
5001
+ this.unwatch && this.unwatch();
5002
+ this.$handle.reloadRule([]);
5003
+ },
5004
+ updated: function updated() {
5005
+ var _this3 = this;
5006
+
5007
+ this.$handle.bindNextTick(function () {
5008
+ return _this3.bus.$emit('next-tick', _this3.$handle.api);
5009
+ });
5140
5010
  }
5141
5011
  });
5142
5012
 
@@ -5148,6 +5018,7 @@
5148
5018
  maker: maker,
5149
5019
  component: component,
5150
5020
  directive: directive,
5021
+ setModelField: setModelField,
5151
5022
  register: register,
5152
5023
  $vnode: $vnode,
5153
5024
  parser: parser,
@@ -5159,30 +5030,7 @@
5159
5030
  fetch: fetch,
5160
5031
  $form: $form,
5161
5032
  parseJson: parseJson,
5162
- toJson: toJson,
5163
- init: function init(rules) {
5164
- var _opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5165
-
5166
- var $vm = mountForm(rules, _opt),
5167
- _this = $vm.$refs.fc.formCreate;
5168
- return {
5169
- mount: function mount($el) {
5170
- if ($el && is.Element($el)) _this.options.el = $el;
5171
-
5172
- _getEl(_this.options).appendChild($vm.$el);
5173
-
5174
- return _this.api();
5175
- },
5176
- remove: function remove() {
5177
- $vm.$el.parentNode && $vm.$el.parentNode.removeChild($vm.$el);
5178
- },
5179
- destroy: function destroy() {
5180
- this.remove();
5181
- $vm.$destroy();
5182
- },
5183
- $f: _this.api()
5184
- };
5185
- }
5033
+ toJson: toJson
5186
5034
  });
5187
5035
  }
5188
5036
 
@@ -5193,17 +5041,16 @@
5193
5041
  globalConfig = _objectSpread2(_objectSpread2({}, globalConfig), options || {});
5194
5042
  if (Vue._installedFormCreate === true) return;
5195
5043
  Vue._installedFormCreate = true;
5196
- _vue = Vue;
5197
5044
 
5198
5045
  var $formCreate = function $formCreate(rules) {
5199
5046
  var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5200
- return create(rules, opt, this);
5047
+ return create(rules, opt);
5201
5048
  };
5202
5049
 
5203
5050
  useAttr($formCreate);
5204
- Vue.prototype.$formCreate = $formCreate;
5051
+ Vue.config.globalProperties.$formCreate = $formCreate;
5205
5052
  Vue.component('FormCreate', $form());
5206
- Vue.component('FcFragment', $vnode());
5053
+ Vue.component('fc-vnode', vnode);
5207
5054
  }
5208
5055
  });
5209
5056
  }
@@ -5218,22 +5065,21 @@
5218
5065
  }
5219
5066
 
5220
5067
  var DEFAULT_FORMATS = {
5221
- date: 'yyyy-MM-dd',
5222
- month: 'yyyy-MM',
5223
- datetime: 'yyyy-MM-dd HH:mm:ss',
5224
- week: 'yyyywWW',
5068
+ date: 'YYYY-MM-DD',
5069
+ month: 'YYYY-MM',
5070
+ datetime: 'YYYY-MM-DD HH:mm:ss',
5225
5071
  timerange: 'HH:mm:ss',
5226
- daterange: 'yyyy-MM-dd',
5227
- monthrange: 'yyyy-MM',
5228
- datetimerange: 'yyyy-MM-dd HH:mm:ss',
5229
- year: 'yyyy'
5072
+ daterange: 'YYYY-MM-DD',
5073
+ monthrange: 'YYYY-MM',
5074
+ datetimerange: 'YYYY-MM-DD HH:mm:ss',
5075
+ year: 'YYYY'
5230
5076
  };
5231
- var name = 'datePicker';
5077
+ var name$5 = 'datePicker';
5232
5078
  var datePicker = {
5233
- name: name,
5079
+ name: name$5,
5234
5080
  maker: function () {
5235
5081
  return ['year', 'month', 'date', 'dates', 'week', 'datetime', 'datetimeRange', 'dateRange', 'monthRange'].reduce(function (initial, type) {
5236
- initial[type] = creatorFactory(name, {
5082
+ initial[type] = creatorFactory(name$5, {
5237
5083
  type: type.toLowerCase()
5238
5084
  });
5239
5085
  return initial;
@@ -5248,28 +5094,28 @@
5248
5094
  }
5249
5095
  };
5250
5096
 
5251
- var name$1 = 'hidden';
5097
+ var name$4 = 'hidden';
5252
5098
  var hidden = {
5253
- name: name$1,
5254
- maker: _defineProperty({}, name$1, function (field, value) {
5255
- return creatorFactory(name$1)('', field, value);
5099
+ name: name$4,
5100
+ maker: _defineProperty({}, name$4, function (field, value) {
5101
+ return creatorFactory(name$4)('', field, value);
5256
5102
  }),
5257
5103
  render: function render() {
5258
5104
  return [];
5259
5105
  }
5260
5106
  };
5261
5107
 
5262
- var name$2 = 'input';
5108
+ var name$3 = 'input';
5263
5109
  var input = {
5264
- name: name$2,
5110
+ name: name$3,
5265
5111
  maker: function () {
5266
5112
  var maker = ['password', 'url', 'email', 'text', 'textarea'].reduce(function (maker, type) {
5267
- maker[type] = creatorFactory(name$2, {
5113
+ maker[type] = creatorFactory(name$3, {
5268
5114
  type: type
5269
5115
  });
5270
5116
  return maker;
5271
5117
  }, {});
5272
- maker.idate = creatorFactory(name$2, {
5118
+ maker.idate = creatorFactory(name$3, {
5273
5119
  type: 'date'
5274
5120
  });
5275
5121
  return maker;
@@ -5283,11 +5129,11 @@
5283
5129
  }
5284
5130
  };
5285
5131
 
5286
- var name$3 = 'slider';
5132
+ var name$2 = 'slider';
5287
5133
  var slider = {
5288
- name: name$3,
5134
+ name: name$2,
5289
5135
  maker: {
5290
- sliderRange: creatorFactory(name$3, {
5136
+ sliderRange: creatorFactory(name$2, {
5291
5137
  range: true
5292
5138
  })
5293
5139
  },
@@ -5307,14 +5153,14 @@
5307
5153
  }
5308
5154
  };
5309
5155
 
5310
- var name$4 = 'timePicker';
5156
+ var name$1 = 'timePicker';
5311
5157
  var timePicker = {
5312
- name: name$4,
5158
+ name: name$1,
5313
5159
  maker: {
5314
- time: creatorFactory(name$4, function (m) {
5160
+ time: creatorFactory(name$1, function (m) {
5315
5161
  return m.props.isRange = false;
5316
5162
  }),
5317
- timeRange: creatorFactory(name$4, function (m) {
5163
+ timeRange: creatorFactory(name$1, function (m) {
5318
5164
  return m.props.isRange = true;
5319
5165
  })
5320
5166
  },
@@ -5334,13 +5180,17 @@
5334
5180
  props: {
5335
5181
  span: 24
5336
5182
  }
5337
- }, [ctx.vNode.row(ctx.prop, _)]);
5183
+ }, {
5184
+ "default": function _default() {
5185
+ return [ctx.vNode.row(ctx.prop, _)];
5186
+ }
5187
+ });
5338
5188
  }
5339
5189
  };
5340
5190
 
5341
- var name$5 = 'select';
5191
+ var name = 'select';
5342
5192
  var select = {
5343
- name: name$5,
5193
+ name: name,
5344
5194
  toFormValue: function toFormValue(value, ctx) {
5345
5195
  if (ctx.prop.props.multiple && !Array.isArray(value)) {
5346
5196
  return toArray(value);
@@ -5354,36 +5204,36 @@
5354
5204
 
5355
5205
  var PRE = 'el';
5356
5206
  var alias = {
5357
- button: PRE + 'Button',
5207
+ button: PRE + '-button',
5358
5208
  icon: 'i',
5359
- slider: PRE + 'Slider',
5360
- rate: PRE + 'Rate',
5361
- upload: 'fcUpload',
5362
- cascader: PRE + 'Cascader',
5363
- popover: PRE + 'Popover',
5364
- tooltip: PRE + 'Tooltip',
5365
- colorPicker: PRE + 'ColorPicker',
5366
- timePicker: PRE + 'TimePicker',
5367
- timeSelect: PRE + 'TimeSelect',
5368
- datePicker: PRE + 'DatePicker',
5369
- 'switch': PRE + 'Switch',
5370
- select: 'fcSelect',
5371
- checkbox: 'fcCheckbox',
5372
- radio: 'fcRadio',
5373
- inputNumber: PRE + 'InputNumber',
5374
- number: PRE + 'InputNumber',
5375
- input: PRE + 'Input',
5376
- formItem: PRE + 'FormItem',
5377
- form: PRE + 'Form',
5378
- frame: 'fcFrame',
5379
- col: PRE + 'Col',
5380
- row: PRE + 'Row',
5381
- tree: 'fcTree',
5382
- autoComplete: PRE + 'Autocomplete',
5383
- auto: PRE + 'Autocomplete',
5384
- group: 'fcGroup',
5385
- object: 'fcSubForm',
5386
- subForm: 'fcSubForm'
5209
+ slider: PRE + '-slider',
5210
+ rate: PRE + '-rate',
5211
+ upload: 'fc-upload',
5212
+ cascader: PRE + '-cascader',
5213
+ popover: PRE + '-popover',
5214
+ tooltip: PRE + '-tooltip',
5215
+ colorPicker: PRE + '-colorPicker',
5216
+ timePicker: PRE + '-time-picker',
5217
+ timeSelect: PRE + '-time-select',
5218
+ datePicker: PRE + '-date-picker',
5219
+ 'switch': PRE + '-switch',
5220
+ select: 'fc-select',
5221
+ checkbox: 'fc-checkbox',
5222
+ radio: 'fc-radio',
5223
+ inputNumber: PRE + '-input-number',
5224
+ number: PRE + '-input-number',
5225
+ input: PRE + '-input',
5226
+ formItem: PRE + '-form-item',
5227
+ form: PRE + '-form',
5228
+ frame: 'fc-frame',
5229
+ col: PRE + '-col',
5230
+ row: PRE + '-row',
5231
+ tree: 'fc-tree',
5232
+ autoComplete: PRE + '-autocomplete',
5233
+ auto: PRE + '-autocomplete',
5234
+ group: 'fc-group',
5235
+ object: 'fc-sub-form',
5236
+ subForm: 'fc-sub-form'
5387
5237
  };
5388
5238
 
5389
5239
  function getConfig() {
@@ -5425,11 +5275,6 @@
5425
5275
  return info.type === 'tooltip';
5426
5276
  }
5427
5277
 
5428
- var upperCaseReg = /[A-Z]/;
5429
- function isAttr(name, value) {
5430
- return !upperCaseReg.test(name) && (is.String(value) || is.Number(value));
5431
- }
5432
-
5433
5278
  function tidy(props, name) {
5434
5279
  if (!hasProperty(props, name)) return;
5435
5280
 
@@ -5453,18 +5298,23 @@
5453
5298
  }
5454
5299
 
5455
5300
  var manager = {
5456
- validate: function validate(call) {
5457
- this.form().validate(call);
5301
+ validate: function validate() {
5302
+ return this.form().validate();
5458
5303
  },
5459
- validateField: function validateField(field, call) {
5460
- this.form().validateField(field, call);
5304
+ validateField: function validateField(field) {
5305
+ var _this = this;
5306
+
5307
+ return new Promise(function (resolve, reject) {
5308
+ _this.form().validateField(field, function (res) {
5309
+ res ? reject(res) : resolve(null);
5310
+ });
5311
+ });
5461
5312
  },
5462
5313
  clearValidateState: function clearValidateState(ctx) {
5463
- var fItem = this.vm.$refs[ctx.wrapRef];
5314
+ var fItem = this.vm.refs[ctx.wrapRef];
5464
5315
 
5465
5316
  if (fItem) {
5466
- fItem.validateMessage = '';
5467
- fItem.validateState = '';
5317
+ fItem.clearValidate();
5468
5318
  }
5469
5319
  },
5470
5320
  tidyOptions: function tidyOptions(options) {
@@ -5480,12 +5330,7 @@
5480
5330
  return prop;
5481
5331
  },
5482
5332
  mergeProp: function mergeProp(ctx) {
5483
- var props = ctx.prop.props;
5484
5333
  ctx.prop = mergeProps([{
5485
- attrs: Object.keys(props).reduce(function (initial, val) {
5486
- if (isAttr(val, props[val])) initial[val] = props[val];
5487
- return initial;
5488
- }, {}),
5489
5334
  info: this.options.info || {},
5490
5335
  wrap: this.options.wrap || {},
5491
5336
  col: this.options.col || {}
@@ -5511,7 +5356,7 @@
5511
5356
  var form = this.options.form;
5512
5357
  this.rule = {
5513
5358
  props: _objectSpread2({}, form),
5514
- nativeOn: {
5359
+ on: {
5515
5360
  submit: function submit(e) {
5516
5361
  e.preventDefault();
5517
5362
  }
@@ -5530,18 +5375,23 @@
5530
5375
  ref: ref
5531
5376
  });
5532
5377
  extend(this.rule.props, {
5533
- model: $handle.formData,
5534
- rules: $handle.validate()
5378
+ model: $handle.formData
5535
5379
  });
5536
5380
  },
5537
5381
  render: function render(children) {
5538
- if (children.length) {
5539
- children.push(this.makeFormBtn());
5382
+ var _this2 = this;
5383
+
5384
+ if (children.slotLen()) {
5385
+ children.setSlot(undefined, function () {
5386
+ return _this2.makeFormBtn();
5387
+ });
5540
5388
  }
5541
5389
 
5542
- return this.$r(this.rule, isFalse(this.options.row.show) ? children : [this.makeRow(children)]);
5390
+ return this.$r(this.rule, isFalse(this.options.row.show) ? children.getSlots() : [this.makeRow(children)]);
5543
5391
  },
5544
5392
  makeWrap: function makeWrap(ctx, children) {
5393
+ var _this3 = this;
5394
+
5545
5395
  var rule = ctx.prop;
5546
5396
  var uni = "".concat(this.key).concat(ctx.key);
5547
5397
  var col = rule.col;
@@ -5562,7 +5412,15 @@
5562
5412
  key: "".concat(uni, "fi"),
5563
5413
  ref: ctx.wrapRef,
5564
5414
  type: 'formItem'
5565
- }]), [children, isTitle ? this.makeInfo(rule, uni) : null]);
5415
+ }]), _objectSpread2({
5416
+ "default": function _default() {
5417
+ return children;
5418
+ }
5419
+ }, isTitle ? {
5420
+ label: function label() {
5421
+ return _this3.makeInfo(rule, uni);
5422
+ }
5423
+ } : {}));
5566
5424
  return inline === true || isFalse(_col) || isFalse(col.show) ? item : this.makeCol(rule, uni, [item]);
5567
5425
  },
5568
5426
  isTitle: function isTitle(rule) {
@@ -5571,7 +5429,7 @@
5571
5429
  return !(!title.title && !title["native"] || isFalse(title.show));
5572
5430
  },
5573
5431
  makeInfo: function makeInfo(rule, uni) {
5574
- var _this = this;
5432
+ var _this4 = this;
5575
5433
 
5576
5434
  var titleProp = rule.title;
5577
5435
  var infoProp = rule.info;
@@ -5579,10 +5437,9 @@
5579
5437
  var form = this.options.form;
5580
5438
  var children = [(titleProp.title || '') + (form.labelSuffix || form['label-suffix'] || '')];
5581
5439
 
5582
- var titleFn = function titleFn(pop) {
5583
- return _this.$r(mergeProps([titleProp, {
5440
+ var titleFn = function titleFn() {
5441
+ return _this4.$r(mergeProps([titleProp, {
5584
5442
  props: titleProp,
5585
- slot: titleProp.slot || (pop ? isTip ? 'default' : 'reference' : 'label'),
5586
5443
  key: "".concat(uni, "tit"),
5587
5444
  type: titleProp.type || 'span'
5588
5445
  }]), children);
@@ -5594,14 +5451,13 @@
5594
5451
  type: 'i',
5595
5452
  "class": infoProp.icon === true ? 'el-icon-warning' : infoProp.icon,
5596
5453
  key: "".concat(uni, "i")
5597
- }));
5454
+ }, {}, true));
5598
5455
  }
5599
5456
 
5600
5457
  var prop = {
5601
5458
  type: infoProp.type || 'popover',
5602
5459
  props: _objectSpread2({}, infoProp),
5603
- key: "".concat(uni, "pop"),
5604
- slot: 'label'
5460
+ key: "".concat(uni, "pop")
5605
5461
  };
5606
5462
  var field = 'content';
5607
5463
 
@@ -5609,7 +5465,9 @@
5609
5465
  prop.props[field] = infoProp.info;
5610
5466
  }
5611
5467
 
5612
- return this.$r(mergeProps([infoProp, prop]), [titleFn(true)]);
5468
+ return this.$r(mergeProps([infoProp, prop]), _defineProperty({}, titleProp.slot || (isTip ? 'default' : 'reference'), function () {
5469
+ return titleFn();
5470
+ }));
5613
5471
  }
5614
5472
 
5615
5473
  return titleFn();
@@ -5662,9 +5520,12 @@
5662
5520
  }, [item]);
5663
5521
  },
5664
5522
  makeResetBtn: function makeResetBtn() {
5665
- var _this2 = this;
5523
+ var _this5 = this;
5666
5524
 
5667
- var resetBtn = this.options.resetBtn;
5525
+ var resetBtn = _objectSpread2({}, this.options.resetBtn);
5526
+
5527
+ var text = resetBtn.innerText;
5528
+ delete resetBtn.innerText;
5668
5529
  return this.$r({
5669
5530
  type: 'button',
5670
5531
  props: resetBtn,
@@ -5673,17 +5534,20 @@
5673
5534
  },
5674
5535
  on: {
5675
5536
  click: function click() {
5676
- var fApi = _this2.$handle.api;
5537
+ var fApi = _this5.$handle.api;
5677
5538
  resetBtn.click ? resetBtn.click(fApi) : fApi.resetFields();
5678
5539
  }
5679
5540
  },
5680
5541
  key: "".concat(this.key, "b2")
5681
- }, [resetBtn.innerText]);
5542
+ }, [text]);
5682
5543
  },
5683
5544
  makeSubmitBtn: function makeSubmitBtn() {
5684
- var _this3 = this;
5545
+ var _this6 = this;
5685
5546
 
5686
- var submitBtn = this.options.submitBtn;
5547
+ var submitBtn = _objectSpread2({}, this.options.submitBtn);
5548
+
5549
+ var text = submitBtn.innerText;
5550
+ delete submitBtn.innerText;
5687
5551
  return this.$r({
5688
5552
  type: 'button',
5689
5553
  props: submitBtn,
@@ -5692,21 +5556,21 @@
5692
5556
  },
5693
5557
  on: {
5694
5558
  click: function click() {
5695
- var fApi = _this3.$handle.api;
5559
+ var fApi = _this6.$handle.api;
5696
5560
  submitBtn.click ? submitBtn.click(fApi) : fApi.submit();
5697
5561
  }
5698
5562
  },
5699
5563
  key: "".concat(this.key, "b1")
5700
- }, [submitBtn.innerText]);
5564
+ }, [text]);
5701
5565
  }
5702
5566
  };
5703
5567
 
5704
- var maker = {};
5705
- useAlias(maker);
5706
- useSelect(maker);
5707
- useTree(maker);
5708
- useUpload(maker);
5709
- useFrame(maker);
5568
+ var maker$1 = {};
5569
+ useAlias(maker$1);
5570
+ useSelect(maker$1);
5571
+ useTree(maker$1);
5572
+ useUpload(maker$1);
5573
+ useFrame(maker$1);
5710
5574
 
5711
5575
  function useAlias(maker) {
5712
5576
  ['group', 'tree', 'switch', 'upload', 'autoComplete', 'checkbox', 'cascader', 'colorPicker', 'datePicker', 'frame', 'inputNumber', 'radio', 'rate'].forEach(function (name) {
@@ -5783,8 +5647,8 @@
5783
5647
  return maker;
5784
5648
  }
5785
5649
 
5786
- var css_248z$2 = ".form-create .form-create .el-form-item {\n margin-bottom: 22px;\n}\n\n.form-create .form-create .el-form-item .el-form-item {\n margin-bottom: 0px;\n}\n\n.form-create{\n transform: rotateZ(0);\n}\n";
5787
- styleInject(css_248z$2);
5650
+ 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)}";
5651
+ styleInject(css_248z);
5788
5652
 
5789
5653
  function tidyBtnProp(btn, def) {
5790
5654
  if (is.Boolean(btn)) btn = {
@@ -5798,103 +5662,38 @@
5798
5662
  function extendApi(api, h) {
5799
5663
  extend(api, {
5800
5664
  validate: function validate(callback) {
5801
- var flag;
5802
- var forms = api.children;
5803
- var len = forms.length;
5804
-
5805
- var validate = function validate() {
5806
- h.$manager.validate(function () {
5807
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
5808
- args[_key] = arguments[_key];
5809
- }
5810
-
5811
- if (!args[0] || !flag) {
5812
- flag = args;
5813
- }
5814
-
5815
- callback && callback.apply(void 0, _toConsumableArray(flag));
5816
- });
5817
- };
5818
-
5819
- var validFn = function validFn(args) {
5820
- setTimeout(function () {
5821
- if (!args[0]) {
5822
- if (!flag) {
5823
- flag = args;
5824
- }
5825
- }
5826
-
5827
- if (! --len) {
5828
- validate();
5829
- }
5665
+ return new Promise(function (resolve, reject) {
5666
+ var forms = api.children;
5667
+ var all = [h.$manager.validate()];
5668
+ forms.forEach(function (v) {
5669
+ all.push(v.validate());
5830
5670
  });
5831
- };
5832
-
5833
- forms.forEach(function (form) {
5834
- form.validate(function () {
5835
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
5836
- args[_key2] = arguments[_key2];
5837
- }
5838
-
5839
- return validFn(args);
5671
+ Promise.all(all).then(function () {
5672
+ resolve(true);
5673
+ callback && callback(true);
5674
+ })["catch"](function (e) {
5675
+ reject(e);
5676
+ callback && callback(e);
5840
5677
  });
5841
5678
  });
5842
-
5843
- if (!len) {
5844
- validate();
5845
- }
5846
5679
  },
5847
5680
  validateField: function validateField(field, callback) {
5848
- var ctx = h.getFieldCtx(field);
5849
- if (!ctx) return;
5850
- var sub = h.subForm[ctx.id];
5851
- var len = 0;
5852
- var flag;
5853
-
5854
- var validate = function validate() {
5855
- h.$manager.validateField(ctx.id, function () {
5856
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
5857
- args[_key3] = arguments[_key3];
5858
- }
5859
-
5860
- if (args[0]) {
5861
- flag = args;
5862
- } else if (flag) {
5863
- return callback && callback('子表单验证未通过', flag[1]);
5864
- }
5865
-
5866
- callback && callback.apply(void 0, _toConsumableArray(flag || args));
5867
- });
5868
- };
5869
-
5870
- var validFn = function validFn(args) {
5871
- setTimeout(function () {
5872
- if (!args[0]) {
5873
- if (!flag) {
5874
- flag = args;
5875
- }
5876
- }
5877
-
5878
- if (! --len) {
5879
- validate();
5880
- }
5681
+ return new Promise(function (resolve, reject) {
5682
+ var ctx = h.getFieldCtx(field);
5683
+ if (!ctx) return;
5684
+ var sub = h.subForm[ctx.id];
5685
+ var all = [h.$manager.validateField(ctx.id)];
5686
+ toArray(sub).forEach(function (v) {
5687
+ all.push(v.validate());
5881
5688
  });
5882
- };
5883
-
5884
- sub && toArray(sub).forEach(function (form) {
5885
- len++;
5886
- form.validate(function () {
5887
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
5888
- args[_key4] = arguments[_key4];
5889
- }
5890
-
5891
- return validFn(args);
5689
+ Promise.all(all).then(function () {
5690
+ resolve(null);
5691
+ callback && callback(null);
5692
+ })["catch"](function (e) {
5693
+ reject(e);
5694
+ callback && callback(e);
5892
5695
  });
5893
5696
  });
5894
-
5895
- if (!len) {
5896
- validate();
5897
- }
5898
5697
  },
5899
5698
  clearValidateState: function clearValidateState(fields) {
5900
5699
  var _this = this;
@@ -5982,25 +5781,27 @@
5982
5781
  api.refreshOptions();
5983
5782
  },
5984
5783
  submit: function submit(successFn, failFn) {
5985
- var _arguments = arguments,
5986
- _this2 = this;
5987
-
5988
- api.validate(function (valid) {
5989
- if (valid) {
5784
+ return new Promise(function (resolve, reject) {
5785
+ api.validate().then(function () {
5990
5786
  var formData = api.formData();
5991
- if (is.Function(successFn)) invoke(function () {
5992
- return successFn(formData, _this2);
5993
- });else {
5994
- is.Function(h.options.onSubmit) && invoke(function () {
5995
- return h.options.onSubmit(formData, _this2);
5996
- });
5997
- h.vm.$emit('submit', formData, _this2);
5787
+ is.Function(successFn) && invoke(function () {
5788
+ return successFn(formData, api);
5789
+ });
5790
+ is.Function(h.options.onSubmit) && invoke(function () {
5791
+ return h.options.onSubmit(formData, api);
5792
+ });
5793
+ h.vm.emit('submit', formData, api);
5794
+ resolve(formData);
5795
+ })["catch"](function () {
5796
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
5797
+ args[_key] = arguments[_key];
5998
5798
  }
5999
- } else {
5799
+
6000
5800
  is.Function(failFn) && invoke(function () {
6001
- return failFn.apply(void 0, [_this2].concat(_toConsumableArray(_arguments)));
5801
+ return failFn.apply(void 0, [api].concat(args));
6002
5802
  });
6003
- }
5803
+ reject.apply(void 0, args);
5804
+ });
6004
5805
  });
6005
5806
  }
6006
5807
  });
@@ -6015,16 +5816,21 @@
6015
5816
  parsers.forEach(function (parser) {
6016
5817
  FormCreate.parser(parser);
6017
5818
  });
6018
- Object.keys(maker).forEach(function (name) {
6019
- FormCreate.maker[name] = maker[name];
5819
+ Object.keys(maker$1).forEach(function (name) {
5820
+ FormCreate.maker[name] = maker$1[name];
6020
5821
  });
6021
5822
  }
6022
5823
 
5824
+ function appUse(app) {
5825
+ app.use(ElementPlus__default["default"]);
5826
+ }
5827
+
6023
5828
  function elmFormCreate() {
6024
5829
  return FormCreateFactory({
6025
- ui: "".concat("element-ui"),
6026
- version: "".concat("2.5.12"),
5830
+ ui: 'element-ui',
5831
+ version: '3.0.0-alpha.2',
6027
5832
  manager: manager,
5833
+ appUse: appUse,
6028
5834
  extendApi: extendApi,
6029
5835
  install: install,
6030
5836
  attrs: {
@@ -6039,17 +5845,13 @@
6039
5845
 
6040
5846
  if (typeof window !== 'undefined') {
6041
5847
  window.formCreate = FormCreate;
6042
-
6043
- if (window.Vue) {
6044
- FormCreate.install(window.Vue);
6045
- }
6046
5848
  }
6047
5849
 
6048
- var maker$1 = FormCreate.maker;
5850
+ var maker = FormCreate.maker;
6049
5851
 
6050
- exports.default = FormCreate;
6051
- exports.maker = maker$1;
5852
+ exports["default"] = FormCreate;
5853
+ exports.maker = maker;
6052
5854
 
6053
5855
  Object.defineProperty(exports, '__esModule', { value: true });
6054
5856
 
6055
- })));
5857
+ }));