@form-create/element-ui 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/auto-import.js +83 -0
- package/dist/form-create.esm.js +524 -468
- package/dist/form-create.esm.min.js +2 -2
- package/dist/form-create.js +523 -467
- package/dist/form-create.min.js +2 -2
- package/package.json +18 -15
- package/src/core/alias.js +1 -1
- package/src/core/config.js +0 -1
- package/src/core/index.js +8 -1
- package/src/core/maker.js +3 -3
- package/src/core/manager.js +9 -4
package/dist/form-create.esm.js
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/element-ui v3.0
|
|
2
|
+
* @form-create/element-ui v3.1.0
|
|
3
3
|
* (c) 2018-2022 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create
|
|
5
5
|
* Released under the MIT License.
|
|
6
6
|
*/
|
|
7
|
-
import { defineComponent,
|
|
7
|
+
import { defineComponent, toRef, resolveComponent, createVNode, mergeProps as mergeProps$1, isVNode, nextTick, Fragment, markRaw, reactive, getCurrentInstance, provide, inject, toRefs, onMounted, onBeforeUnmount, onUpdated, watch, computed, customRef, withDirectives, resolveDirective, createApp, h, ref } from 'vue';
|
|
8
8
|
|
|
9
9
|
function ownKeys(object, enumerableOnly) {
|
|
10
10
|
var keys = Object.keys(object);
|
|
11
11
|
|
|
12
12
|
if (Object.getOwnPropertySymbols) {
|
|
13
13
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
|
|
15
|
+
if (enumerableOnly) {
|
|
16
|
+
symbols = symbols.filter(function (sym) {
|
|
17
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
keys.push.apply(keys, symbols);
|
|
17
22
|
}
|
|
18
23
|
|
|
19
24
|
return keys;
|
|
@@ -21,12 +26,19 @@ function ownKeys(object, enumerableOnly) {
|
|
|
21
26
|
|
|
22
27
|
function _objectSpread2(target) {
|
|
23
28
|
for (var i = 1; i < arguments.length; i++) {
|
|
24
|
-
var source =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
30
|
+
|
|
31
|
+
if (i % 2) {
|
|
32
|
+
ownKeys(Object(source), true).forEach(function (key) {
|
|
33
|
+
_defineProperty(target, key, source[key]);
|
|
34
|
+
});
|
|
35
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
36
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
37
|
+
} else {
|
|
38
|
+
ownKeys(Object(source)).forEach(function (key) {
|
|
39
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
40
|
+
});
|
|
41
|
+
}
|
|
30
42
|
}
|
|
31
43
|
|
|
32
44
|
return target;
|
|
@@ -35,11 +47,17 @@ function _objectSpread2(target) {
|
|
|
35
47
|
function _typeof(obj) {
|
|
36
48
|
"@babel/helpers - typeof";
|
|
37
49
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
50
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
51
|
+
_typeof = function (obj) {
|
|
52
|
+
return typeof obj;
|
|
53
|
+
};
|
|
54
|
+
} else {
|
|
55
|
+
_typeof = function (obj) {
|
|
56
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return _typeof(obj);
|
|
43
61
|
}
|
|
44
62
|
|
|
45
63
|
function _classCallCheck(instance, Constructor) {
|
|
@@ -48,25 +66,6 @@ function _classCallCheck(instance, Constructor) {
|
|
|
48
66
|
}
|
|
49
67
|
}
|
|
50
68
|
|
|
51
|
-
function _defineProperties(target, props) {
|
|
52
|
-
for (var i = 0; i < props.length; i++) {
|
|
53
|
-
var descriptor = props[i];
|
|
54
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
55
|
-
descriptor.configurable = true;
|
|
56
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
57
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
62
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
63
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
64
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
65
|
-
writable: false
|
|
66
|
-
});
|
|
67
|
-
return Constructor;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
69
|
function _defineProperty(obj, key, value) {
|
|
71
70
|
if (key in obj) {
|
|
72
71
|
Object.defineProperty(obj, key, {
|
|
@@ -94,9 +93,6 @@ function _inherits(subClass, superClass) {
|
|
|
94
93
|
configurable: true
|
|
95
94
|
}
|
|
96
95
|
});
|
|
97
|
-
Object.defineProperty(subClass, "prototype", {
|
|
98
|
-
writable: false
|
|
99
|
-
});
|
|
100
96
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
101
97
|
}
|
|
102
98
|
|
|
@@ -209,11 +205,12 @@ function getSlot(slots, exclude) {
|
|
|
209
205
|
}, []);
|
|
210
206
|
}
|
|
211
207
|
|
|
212
|
-
var NAME$
|
|
208
|
+
var NAME$9 = 'fcCheckbox';
|
|
213
209
|
var Checkbox = defineComponent({
|
|
214
|
-
name: NAME$
|
|
210
|
+
name: NAME$9,
|
|
215
211
|
inheritAttrs: false,
|
|
216
212
|
props: {
|
|
213
|
+
formCreateInject: Object,
|
|
217
214
|
modelValue: {
|
|
218
215
|
type: Array,
|
|
219
216
|
"default": function _default() {
|
|
@@ -224,51 +221,21 @@ var Checkbox = defineComponent({
|
|
|
224
221
|
},
|
|
225
222
|
emits: ['update:modelValue'],
|
|
226
223
|
setup: function setup(props, _) {
|
|
227
|
-
var
|
|
228
|
-
options = _toRefs.options;
|
|
229
|
-
|
|
230
|
-
var trueValue = ref([]);
|
|
224
|
+
var options = toRef(props.formCreateInject, 'options', []);
|
|
231
225
|
var value = toRef(props, 'modelValue');
|
|
232
226
|
|
|
233
227
|
var _options = function _options() {
|
|
234
228
|
return Array.isArray(options.value) ? options.value : [];
|
|
235
229
|
};
|
|
236
230
|
|
|
237
|
-
var update = function update() {
|
|
238
|
-
trueValue.value = value.value ? _options().filter(function (opt) {
|
|
239
|
-
return value.value.indexOf(opt.value) !== -1;
|
|
240
|
-
}).map(function (option) {
|
|
241
|
-
return option.label;
|
|
242
|
-
}) : [];
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
watch(options, function () {
|
|
246
|
-
update();
|
|
247
|
-
}, {
|
|
248
|
-
deep: true,
|
|
249
|
-
immediate: true
|
|
250
|
-
});
|
|
251
231
|
return {
|
|
252
232
|
options: _options,
|
|
253
|
-
trueValue: trueValue,
|
|
254
233
|
value: value,
|
|
255
234
|
onInput: function onInput(n) {
|
|
256
|
-
_.emit('update:modelValue',
|
|
257
|
-
|
|
258
|
-
}).map(function (opt) {
|
|
259
|
-
return opt.value;
|
|
260
|
-
}).filter(function (v) {
|
|
261
|
-
return v !== undefined;
|
|
262
|
-
}));
|
|
263
|
-
},
|
|
264
|
-
update: update
|
|
235
|
+
_.emit('update:modelValue', n);
|
|
236
|
+
}
|
|
265
237
|
};
|
|
266
238
|
},
|
|
267
|
-
watch: {
|
|
268
|
-
modelValue: function modelValue() {
|
|
269
|
-
this.update();
|
|
270
|
-
}
|
|
271
|
-
},
|
|
272
239
|
render: function render() {
|
|
273
240
|
var _this$$slots$default,
|
|
274
241
|
_this$$slots,
|
|
@@ -277,17 +244,23 @@ var Checkbox = defineComponent({
|
|
|
277
244
|
var name = this.type === 'button' ? 'ElCheckboxButton' : 'ElCheckbox';
|
|
278
245
|
var Type = resolveComponent(name);
|
|
279
246
|
return createVNode(resolveComponent("ElCheckboxGroup"), mergeProps$1(this.$attrs, {
|
|
280
|
-
"modelValue": this.
|
|
247
|
+
"modelValue": this.value,
|
|
281
248
|
"onUpdate:modelValue": this.onInput
|
|
282
249
|
}), _objectSpread2({
|
|
283
250
|
"default": function _default() {
|
|
284
251
|
return [_this.options().map(function (opt, index) {
|
|
285
252
|
var props = _objectSpread2({}, opt);
|
|
286
253
|
|
|
254
|
+
var value = props.value;
|
|
287
255
|
delete props.value;
|
|
288
256
|
return createVNode(Type, mergeProps$1(props, {
|
|
257
|
+
"label": value,
|
|
289
258
|
"key": name + index + opt.value
|
|
290
|
-
}),
|
|
259
|
+
}), {
|
|
260
|
+
"default": function _default() {
|
|
261
|
+
return [props.label || props.value || ''];
|
|
262
|
+
}
|
|
263
|
+
});
|
|
291
264
|
}), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
|
|
292
265
|
}
|
|
293
266
|
}, getSlot(this.$slots, ['default'])));
|
|
@@ -369,16 +342,16 @@ function styleInject(css, ref) {
|
|
|
369
342
|
}
|
|
370
343
|
}
|
|
371
344
|
|
|
372
|
-
var css_248z$2 = "._fc-frame .
|
|
345
|
+
var css_248z$2 = "._fc-frame ._fc-files img{display:inline-block;height:100%;vertical-align:top;width:100%}._fc-frame ._fc-upload-btn{border:1px dashed #c0ccda}._fc-frame ._fc-upload-cover{background:rgba(0,0,0,.6);bottom:0;left:0;opacity:0;position:absolute;right:0;top:0;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}._fc-frame ._fc-upload-cover i{color:#fff;cursor:pointer;font-size:20px;margin:0 2px}._fc-frame ._fc-files:hover ._fc-upload-cover{opacity:1}._fc-frame .el-upload{display:block}._fc-frame ._fc-upload-btn{cursor:pointer}._fc-files,._fc-frame ._fc-upload-btn{background:#fff;border:1px solid #c0ccda;border-radius:4px;-webkit-box-shadow:2px 2px 5px rgba(0,0,0,.1);box-shadow:2px 2px 5px rgba(0,0,0,.1);-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;height:58px;line-height:58px;margin-right:4px;overflow:hidden;position:relative;text-align:center;width:58px}";
|
|
373
346
|
styleInject(css_248z$2);
|
|
374
347
|
|
|
375
348
|
function _isSlot$1(s) {
|
|
376
349
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
377
350
|
}
|
|
378
351
|
|
|
379
|
-
var NAME$
|
|
352
|
+
var NAME$8 = 'fcFrame';
|
|
380
353
|
var Frame = defineComponent({
|
|
381
|
-
name: NAME$
|
|
354
|
+
name: NAME$8,
|
|
382
355
|
props: {
|
|
383
356
|
type: {
|
|
384
357
|
type: String,
|
|
@@ -399,7 +372,7 @@ var Frame = defineComponent({
|
|
|
399
372
|
},
|
|
400
373
|
icon: {
|
|
401
374
|
type: String,
|
|
402
|
-
"default": '
|
|
375
|
+
"default": 'upload'
|
|
403
376
|
},
|
|
404
377
|
width: {
|
|
405
378
|
type: String,
|
|
@@ -422,7 +395,10 @@ var Frame = defineComponent({
|
|
|
422
395
|
"default": '关闭'
|
|
423
396
|
},
|
|
424
397
|
modalTitle: String,
|
|
425
|
-
handleIcon:
|
|
398
|
+
handleIcon: {
|
|
399
|
+
type: [String, Boolean],
|
|
400
|
+
"default": undefined
|
|
401
|
+
},
|
|
426
402
|
title: String,
|
|
427
403
|
allowRemove: {
|
|
428
404
|
type: Boolean,
|
|
@@ -477,9 +453,9 @@ var Frame = defineComponent({
|
|
|
477
453
|
okBtn: {
|
|
478
454
|
type: Boolean,
|
|
479
455
|
"default": true
|
|
480
|
-
}
|
|
456
|
+
},
|
|
457
|
+
formCreateInject: Object
|
|
481
458
|
},
|
|
482
|
-
inject: ['formCreateInject'],
|
|
483
459
|
emits: ['update:modelValue', 'change'],
|
|
484
460
|
data: function data() {
|
|
485
461
|
return {
|
|
@@ -496,9 +472,6 @@ var Frame = defineComponent({
|
|
|
496
472
|
}
|
|
497
473
|
},
|
|
498
474
|
methods: {
|
|
499
|
-
key: function key(unique) {
|
|
500
|
-
return unique;
|
|
501
|
-
},
|
|
502
475
|
close: function close() {
|
|
503
476
|
this.closeModel(true);
|
|
504
477
|
},
|
|
@@ -538,7 +511,7 @@ var Frame = defineComponent({
|
|
|
538
511
|
}).toString(),
|
|
539
512
|
readonly: true
|
|
540
513
|
}, {
|
|
541
|
-
"key":
|
|
514
|
+
"key": 1
|
|
542
515
|
}), {
|
|
543
516
|
append: function append() {
|
|
544
517
|
return createVNode(resolveComponent("ElButton"), {
|
|
@@ -549,14 +522,18 @@ var Frame = defineComponent({
|
|
|
549
522
|
}, null);
|
|
550
523
|
},
|
|
551
524
|
suffix: function suffix() {
|
|
552
|
-
return _this.fileList.length ? createVNode("
|
|
553
|
-
"class": "el-input__icon
|
|
525
|
+
return _this.fileList.length ? createVNode(resolveComponent("ElIcon"), {
|
|
526
|
+
"class": "el-input__icon",
|
|
554
527
|
"onClick": function onClick() {
|
|
555
528
|
_this.fileList = [];
|
|
556
529
|
|
|
557
530
|
_this.input();
|
|
558
531
|
}
|
|
559
|
-
},
|
|
532
|
+
}, {
|
|
533
|
+
"default": function _default() {
|
|
534
|
+
return [createVNode(resolveComponent("CircleClose"), null, null)];
|
|
535
|
+
}
|
|
536
|
+
}) : null;
|
|
560
537
|
}
|
|
561
538
|
});
|
|
562
539
|
},
|
|
@@ -566,13 +543,13 @@ var Frame = defineComponent({
|
|
|
566
543
|
}
|
|
567
544
|
|
|
568
545
|
return createVNode("div", {
|
|
569
|
-
"key":
|
|
546
|
+
"key": 2
|
|
570
547
|
}, [children]);
|
|
571
548
|
},
|
|
572
549
|
makeItem: function makeItem(index, children) {
|
|
573
550
|
return createVNode("div", {
|
|
574
|
-
"class": "
|
|
575
|
-
"key":
|
|
551
|
+
"class": "_fc-files",
|
|
552
|
+
"key": '3' + index
|
|
576
553
|
}, [children]);
|
|
577
554
|
},
|
|
578
555
|
valid: function valid(f) {
|
|
@@ -595,43 +572,53 @@ var Frame = defineComponent({
|
|
|
595
572
|
}
|
|
596
573
|
|
|
597
574
|
return createVNode("div", {
|
|
598
|
-
"class": "
|
|
599
|
-
"key":
|
|
575
|
+
"class": "_fc-upload-cover",
|
|
576
|
+
"key": 4
|
|
600
577
|
}, [icons]);
|
|
601
578
|
}
|
|
602
579
|
},
|
|
603
580
|
makeHandleIcon: function makeHandleIcon(val, index) {
|
|
604
581
|
var _this2 = this;
|
|
605
582
|
|
|
606
|
-
|
|
607
|
-
|
|
583
|
+
var Type = resolveComponent(this.handleIcon === true || this.handleIcon === undefined ? 'view' : this.handleIcon);
|
|
584
|
+
return createVNode(resolveComponent("ElIcon"), {
|
|
608
585
|
"onClick": function onClick() {
|
|
609
586
|
return _this2.handleClick(val);
|
|
610
587
|
},
|
|
611
|
-
"key":
|
|
612
|
-
},
|
|
588
|
+
"key": '5' + index
|
|
589
|
+
}, {
|
|
590
|
+
"default": function _default() {
|
|
591
|
+
return [createVNode(Type, null, null)];
|
|
592
|
+
}
|
|
593
|
+
});
|
|
613
594
|
},
|
|
614
595
|
makeRemoveIcon: function makeRemoveIcon(val, index) {
|
|
615
596
|
var _this3 = this;
|
|
616
597
|
|
|
617
|
-
return createVNode("
|
|
618
|
-
"class": "el-icon-delete",
|
|
598
|
+
return createVNode(resolveComponent("ElIcon"), {
|
|
619
599
|
"onClick": function onClick() {
|
|
620
600
|
return _this3.handleRemove(val);
|
|
621
601
|
},
|
|
622
|
-
"key":
|
|
623
|
-
},
|
|
602
|
+
"key": '6' + index
|
|
603
|
+
}, {
|
|
604
|
+
"default": function _default() {
|
|
605
|
+
return [createVNode(resolveComponent("delete"), null, null)];
|
|
606
|
+
}
|
|
607
|
+
});
|
|
624
608
|
},
|
|
625
609
|
makeFiles: function makeFiles() {
|
|
626
610
|
var _this4 = this;
|
|
627
611
|
|
|
628
612
|
return this.makeGroup(this.fileList.map(function (src, index) {
|
|
629
|
-
return _this4.makeItem(index, [createVNode("
|
|
630
|
-
"class": "el-icon-tickets",
|
|
613
|
+
return _this4.makeItem(index, [createVNode(resolveComponent("ElIcon"), {
|
|
631
614
|
"onClick": function onClick() {
|
|
632
615
|
return _this4.handleClick(src);
|
|
633
616
|
}
|
|
634
|
-
},
|
|
617
|
+
}, {
|
|
618
|
+
"default": function _default() {
|
|
619
|
+
return [createVNode(resolveComponent("document"), null, null)];
|
|
620
|
+
}
|
|
621
|
+
}), _this4.makeIcons(src, index)]);
|
|
635
622
|
}));
|
|
636
623
|
},
|
|
637
624
|
makeImages: function makeImages() {
|
|
@@ -646,15 +633,18 @@ var Frame = defineComponent({
|
|
|
646
633
|
makeBtn: function makeBtn() {
|
|
647
634
|
var _this6 = this;
|
|
648
635
|
|
|
636
|
+
var Type = resolveComponent(this.icon);
|
|
649
637
|
return createVNode("div", {
|
|
650
|
-
"class": "
|
|
638
|
+
"class": "_fc-upload-btn",
|
|
651
639
|
"onClick": function onClick() {
|
|
652
640
|
return _this6.showModel();
|
|
653
641
|
},
|
|
654
|
-
"key":
|
|
655
|
-
}, [createVNode("
|
|
656
|
-
"
|
|
657
|
-
|
|
642
|
+
"key": 7
|
|
643
|
+
}, [createVNode(resolveComponent("ElIcon"), null, {
|
|
644
|
+
"default": function _default() {
|
|
645
|
+
return [createVNode(Type, null, null)];
|
|
646
|
+
}
|
|
647
|
+
})]);
|
|
658
648
|
},
|
|
659
649
|
handleClick: function handleClick(src) {
|
|
660
650
|
if (this.onHandle) {
|
|
@@ -805,7 +795,7 @@ var Frame = defineComponent({
|
|
|
805
795
|
"src": src,
|
|
806
796
|
"frameBorder": "0",
|
|
807
797
|
"style": {
|
|
808
|
-
|
|
798
|
+
height: height,
|
|
809
799
|
'border': '0 none',
|
|
810
800
|
'width': '100%'
|
|
811
801
|
}
|
|
@@ -834,11 +824,12 @@ var Frame = defineComponent({
|
|
|
834
824
|
}
|
|
835
825
|
});
|
|
836
826
|
|
|
837
|
-
var NAME$
|
|
827
|
+
var NAME$7 = 'fcRadio';
|
|
838
828
|
var Radio = defineComponent({
|
|
839
|
-
name: NAME$
|
|
829
|
+
name: NAME$7,
|
|
840
830
|
inheritAttrs: false,
|
|
841
831
|
props: {
|
|
832
|
+
formCreateInject: Object,
|
|
842
833
|
modelValue: {
|
|
843
834
|
type: [String, Number, Boolean],
|
|
844
835
|
"default": ''
|
|
@@ -847,49 +838,21 @@ var Radio = defineComponent({
|
|
|
847
838
|
},
|
|
848
839
|
emits: ['update:modelValue'],
|
|
849
840
|
setup: function setup(props, _) {
|
|
850
|
-
var
|
|
851
|
-
options = _toRefs.options;
|
|
852
|
-
|
|
853
|
-
var trueValue = ref([]);
|
|
841
|
+
var options = toRef(props.formCreateInject, 'options', []);
|
|
854
842
|
var value = toRef(props, 'modelValue');
|
|
855
843
|
|
|
856
844
|
var _options = function _options() {
|
|
857
845
|
return Array.isArray(options.value) ? options.value : [];
|
|
858
846
|
};
|
|
859
847
|
|
|
860
|
-
var update = function update() {
|
|
861
|
-
trueValue.value = _options().filter(function (opt) {
|
|
862
|
-
return opt.value === value.value;
|
|
863
|
-
}).reduce(function (initial, opt) {
|
|
864
|
-
return opt.label;
|
|
865
|
-
}, '');
|
|
866
|
-
};
|
|
867
|
-
|
|
868
|
-
watch(options, function () {
|
|
869
|
-
update();
|
|
870
|
-
}, {
|
|
871
|
-
deep: true,
|
|
872
|
-
immediate: true
|
|
873
|
-
});
|
|
874
848
|
return {
|
|
875
849
|
options: _options,
|
|
876
|
-
trueValue: trueValue,
|
|
877
850
|
value: value,
|
|
878
851
|
onInput: function onInput(n) {
|
|
879
|
-
_.emit('update:modelValue',
|
|
880
|
-
|
|
881
|
-
}).reduce(function (initial, opt) {
|
|
882
|
-
return opt.value;
|
|
883
|
-
}, ''));
|
|
884
|
-
},
|
|
885
|
-
update: update
|
|
852
|
+
_.emit('update:modelValue', n);
|
|
853
|
+
}
|
|
886
854
|
};
|
|
887
855
|
},
|
|
888
|
-
watch: {
|
|
889
|
-
modelValue: function modelValue() {
|
|
890
|
-
this.update();
|
|
891
|
-
}
|
|
892
|
-
},
|
|
893
856
|
render: function render() {
|
|
894
857
|
var _this$$slots$default,
|
|
895
858
|
_this$$slots,
|
|
@@ -898,28 +861,35 @@ var Radio = defineComponent({
|
|
|
898
861
|
var name = this.type === 'button' ? 'ElRadioButton' : 'ElRadio';
|
|
899
862
|
var Type = resolveComponent(name);
|
|
900
863
|
return createVNode(resolveComponent("ElRadioGroup"), mergeProps$1(this.$attrs, {
|
|
901
|
-
"modelValue": this.
|
|
864
|
+
"modelValue": this.value,
|
|
902
865
|
"onUpdate:modelValue": this.onInput
|
|
903
866
|
}), _objectSpread2({
|
|
904
867
|
"default": function _default() {
|
|
905
868
|
return [_this.options().map(function (opt, index) {
|
|
906
869
|
var props = _objectSpread2({}, opt);
|
|
907
870
|
|
|
871
|
+
var value = props.value;
|
|
908
872
|
delete props.value;
|
|
909
873
|
return createVNode(Type, mergeProps$1(props, {
|
|
874
|
+
"label": value,
|
|
910
875
|
"key": name + index + opt.value
|
|
911
|
-
}),
|
|
876
|
+
}), {
|
|
877
|
+
"default": function _default() {
|
|
878
|
+
return [props.label || props.value || ''];
|
|
879
|
+
}
|
|
880
|
+
});
|
|
912
881
|
}), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
|
|
913
882
|
}
|
|
914
883
|
}, getSlot(this.$slots, ['default'])));
|
|
915
884
|
}
|
|
916
885
|
});
|
|
917
886
|
|
|
918
|
-
var NAME$
|
|
887
|
+
var NAME$6 = 'fcSelect';
|
|
919
888
|
var Select = defineComponent({
|
|
920
|
-
name: NAME$
|
|
889
|
+
name: NAME$6,
|
|
921
890
|
inheritAttrs: false,
|
|
922
891
|
props: {
|
|
892
|
+
formCreateInject: Object,
|
|
923
893
|
modelValue: {
|
|
924
894
|
type: [Array, String, Number, Boolean, Object],
|
|
925
895
|
"default": undefined
|
|
@@ -928,9 +898,7 @@ var Select = defineComponent({
|
|
|
928
898
|
},
|
|
929
899
|
emits: ['update:modelValue'],
|
|
930
900
|
setup: function setup(props) {
|
|
931
|
-
var
|
|
932
|
-
options = _toRefs.options;
|
|
933
|
-
|
|
901
|
+
var options = toRef(props.formCreateInject, 'options', []);
|
|
934
902
|
var value = toRef(props, 'modelValue');
|
|
935
903
|
|
|
936
904
|
var _options = function _options() {
|
|
@@ -964,9 +932,9 @@ var Select = defineComponent({
|
|
|
964
932
|
}
|
|
965
933
|
});
|
|
966
934
|
|
|
967
|
-
var NAME$
|
|
935
|
+
var NAME$5 = 'fcTree';
|
|
968
936
|
var Tree = defineComponent({
|
|
969
|
-
name: NAME$
|
|
937
|
+
name: NAME$5,
|
|
970
938
|
inheritAttrs: false,
|
|
971
939
|
formCreateParser: {
|
|
972
940
|
mergeProp: function mergeProp(ctx) {
|
|
@@ -1028,7 +996,7 @@ var Tree = defineComponent({
|
|
|
1028
996
|
}
|
|
1029
997
|
});
|
|
1030
998
|
|
|
1031
|
-
var css_248z$1 = "._fc-
|
|
999
|
+
var css_248z$1 = "._fc-exceed .el-upload{display:none}";
|
|
1032
1000
|
styleInject(css_248z$1);
|
|
1033
1001
|
|
|
1034
1002
|
function parseFile(file, i) {
|
|
@@ -1043,37 +1011,21 @@ function getFileName(file) {
|
|
|
1043
1011
|
return ('' + file).split('/').pop();
|
|
1044
1012
|
}
|
|
1045
1013
|
|
|
1046
|
-
var NAME$
|
|
1014
|
+
var NAME$4 = 'fcUpload';
|
|
1047
1015
|
var Upload = defineComponent({
|
|
1048
|
-
name: NAME$
|
|
1016
|
+
name: NAME$4,
|
|
1049
1017
|
inheritAttrs: false,
|
|
1050
1018
|
props: {
|
|
1051
|
-
onHandle: Function,
|
|
1052
|
-
uploadType: {
|
|
1053
|
-
type: String,
|
|
1054
|
-
"default": 'file'
|
|
1055
|
-
},
|
|
1056
|
-
limit: {
|
|
1057
|
-
type: Number,
|
|
1058
|
-
"default": 0
|
|
1059
|
-
},
|
|
1060
|
-
allowRemove: {
|
|
1061
|
-
type: Boolean,
|
|
1062
|
-
"default": true
|
|
1063
|
-
},
|
|
1064
1019
|
previewMask: undefined,
|
|
1065
1020
|
modalTitle: String,
|
|
1066
|
-
handleIcon: [String, Boolean],
|
|
1067
1021
|
modelValue: [Array, String]
|
|
1068
1022
|
},
|
|
1069
|
-
emits: ['update:modelValue'],
|
|
1023
|
+
emits: ['update:modelValue', 'change', 'remove'],
|
|
1070
1024
|
data: function data() {
|
|
1071
1025
|
return {
|
|
1072
|
-
uploadList: [],
|
|
1073
1026
|
previewVisible: false,
|
|
1074
1027
|
previewImage: '',
|
|
1075
|
-
fileList: []
|
|
1076
|
-
cacheFiles: []
|
|
1028
|
+
fileList: []
|
|
1077
1029
|
};
|
|
1078
1030
|
},
|
|
1079
1031
|
created: function created() {
|
|
@@ -1081,13 +1033,6 @@ var Upload = defineComponent({
|
|
|
1081
1033
|
},
|
|
1082
1034
|
watch: {
|
|
1083
1035
|
modelValue: function modelValue(n) {
|
|
1084
|
-
if (this.$refs.upload.uploadFiles.every(function (file) {
|
|
1085
|
-
return !file.status || file.status === 'success';
|
|
1086
|
-
})) {
|
|
1087
|
-
this.$refs.upload.uploadFiles = toArray(n).map(parseFile);
|
|
1088
|
-
this.uploadList = this.$refs.upload.uploadFiles;
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
1036
|
this.fileList = toArray(n).map(parseFile);
|
|
1092
1037
|
},
|
|
1093
1038
|
limit: function limit(n, o) {
|
|
@@ -1097,141 +1042,62 @@ var Upload = defineComponent({
|
|
|
1097
1042
|
}
|
|
1098
1043
|
},
|
|
1099
1044
|
methods: {
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
isDisabled: function isDisabled() {
|
|
1104
|
-
return this.$attrs.disabled === true;
|
|
1105
|
-
},
|
|
1106
|
-
onRemove: function onRemove(file) {
|
|
1107
|
-
if (this.isDisabled()) {
|
|
1108
|
-
return;
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
|
-
this.$refs.upload.handleRemove(file);
|
|
1112
|
-
},
|
|
1113
|
-
handleClick: function handleClick(file) {
|
|
1114
|
-
if (this.onHandle) {
|
|
1115
|
-
return this.onHandle(file);
|
|
1045
|
+
handlePreview: function handlePreview(file) {
|
|
1046
|
+
if (this.onPreview) {
|
|
1047
|
+
this.onPreview.apply(this, arguments);
|
|
1116
1048
|
} else {
|
|
1117
1049
|
this.previewImage = file.url;
|
|
1118
1050
|
this.previewVisible = true;
|
|
1119
1051
|
}
|
|
1120
1052
|
},
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
"src": file.url,
|
|
1124
|
-
"key": this.key('img' + index)
|
|
1125
|
-
}, null) : createVNode("i", {
|
|
1126
|
-
"class": "el-icon-document",
|
|
1127
|
-
"key": this.key('i' + index)
|
|
1128
|
-
}, null);
|
|
1129
|
-
},
|
|
1130
|
-
makeRemoveIcon: function makeRemoveIcon(file, index) {
|
|
1131
|
-
var _this = this;
|
|
1132
|
-
|
|
1133
|
-
return createVNode("i", {
|
|
1134
|
-
"class": "el-icon-delete",
|
|
1135
|
-
"onClick": function onClick() {
|
|
1136
|
-
return _this.onRemove(file);
|
|
1137
|
-
},
|
|
1138
|
-
"key": this.key('ri' + index)
|
|
1139
|
-
}, null);
|
|
1140
|
-
},
|
|
1141
|
-
makeHandleIcon: function makeHandleIcon(file, index) {
|
|
1142
|
-
var _this2 = this;
|
|
1143
|
-
|
|
1144
|
-
return createVNode("i", {
|
|
1145
|
-
"class": this.handleIcon === true || this.handleIcon === undefined ? 'el-icon-view' : this.handleIcon,
|
|
1146
|
-
"onClick": function onClick() {
|
|
1147
|
-
return _this2.handleClick(file);
|
|
1148
|
-
},
|
|
1149
|
-
"key": this.key('hi' + index)
|
|
1150
|
-
}, null);
|
|
1151
|
-
},
|
|
1152
|
-
makeProgress: function makeProgress(file, index) {
|
|
1153
|
-
return createVNode(resolveComponent("ElProgress"), mergeProps$1({
|
|
1154
|
-
percentage: file.percentage,
|
|
1155
|
-
type: 'circle',
|
|
1156
|
-
width: 52
|
|
1157
|
-
}, {
|
|
1158
|
-
"style": "margin-top:2px;",
|
|
1159
|
-
"key": this.key('pg' + index)
|
|
1160
|
-
}), null);
|
|
1161
|
-
},
|
|
1162
|
-
makeIcons: function makeIcons(file, index) {
|
|
1163
|
-
var icons = [];
|
|
1164
|
-
|
|
1165
|
-
if (this.allowRemove || this.handleIcon !== false) {
|
|
1166
|
-
if (this.uploadType !== 'file' && this.handleIcon !== false || this.uploadType === 'file' && this.handleIcon) {
|
|
1167
|
-
icons.push(this.makeHandleIcon(file, index));
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
if (this.allowRemove) {
|
|
1171
|
-
icons.push(this.makeRemoveIcon(file, index));
|
|
1172
|
-
}
|
|
1173
|
-
|
|
1174
|
-
return createVNode("div", {
|
|
1175
|
-
"class": "fc-upload-cover"
|
|
1176
|
-
}, [icons]);
|
|
1177
|
-
}
|
|
1178
|
-
},
|
|
1179
|
-
makeFiles: function makeFiles() {
|
|
1180
|
-
var _this3 = this;
|
|
1181
|
-
|
|
1182
|
-
return this.uploadList.map(function (file, index) {
|
|
1183
|
-
return createVNode("div", {
|
|
1184
|
-
"key": _this3.key(index),
|
|
1185
|
-
"class": "fc-files"
|
|
1186
|
-
}, [file.percentage !== undefined && file.status !== 'success' ? _this3.makeProgress(file, index) : [_this3.makeItem(file, index), _this3.makeIcons(file, index)]]);
|
|
1187
|
-
});
|
|
1188
|
-
},
|
|
1189
|
-
makeUpload: function makeUpload() {
|
|
1190
|
-
var _this$$slots$default,
|
|
1191
|
-
_this$$slots,
|
|
1192
|
-
_this4 = this;
|
|
1193
|
-
|
|
1194
|
-
var isShow = !this.limit || this.limit > this.uploadList.length;
|
|
1195
|
-
return createVNode(resolveComponent("ElUpload"), mergeProps$1(this.$attrs, {
|
|
1196
|
-
"showFileList": false,
|
|
1197
|
-
"fileList": this.fileList,
|
|
1198
|
-
"ref": "upload",
|
|
1199
|
-
"style": {
|
|
1200
|
-
display: 'inline-block'
|
|
1201
|
-
},
|
|
1202
|
-
"key": this.key('upload')
|
|
1203
|
-
}), _objectSpread2({
|
|
1204
|
-
"default": function _default() {
|
|
1205
|
-
return [isShow ? ((_this$$slots$default = (_this$$slots = _this4.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)) || createVNode("div", {
|
|
1206
|
-
"class": "fc-upload-btn"
|
|
1207
|
-
}, [createVNode("i", {
|
|
1208
|
-
"class": "el-icon-upload2"
|
|
1209
|
-
}, null)]) : undefined];
|
|
1210
|
-
}
|
|
1211
|
-
}, getSlot(this.$slots, ['default'])));
|
|
1212
|
-
},
|
|
1213
|
-
update: function update() {
|
|
1214
|
-
var files = this.$refs.upload.uploadFiles.map(function (file) {
|
|
1053
|
+
update: function update(fileList) {
|
|
1054
|
+
var files = fileList.map(function (file) {
|
|
1215
1055
|
return file.url;
|
|
1216
1056
|
}).filter(function (url) {
|
|
1217
1057
|
return url !== undefined;
|
|
1218
1058
|
});
|
|
1219
|
-
|
|
1220
|
-
if (this.cacheFiles.length !== files.length) {
|
|
1221
|
-
this.cacheFiles = _toConsumableArray(files);
|
|
1222
|
-
this.$emit('update:modelValue', this.limit === 1 ? files[0] || '' : files);
|
|
1223
|
-
}
|
|
1059
|
+
this.$emit('update:modelValue', this.limit === 1 ? files[0] || '' : files);
|
|
1224
1060
|
},
|
|
1225
1061
|
handleCancel: function handleCancel() {
|
|
1226
1062
|
this.previewVisible = false;
|
|
1063
|
+
},
|
|
1064
|
+
handleChange: function handleChange(file, fileList) {
|
|
1065
|
+
this.$emit.apply(this, ['change'].concat(Array.prototype.slice.call(arguments)));
|
|
1066
|
+
|
|
1067
|
+
if (file.status === 'success') {
|
|
1068
|
+
this.update(fileList);
|
|
1069
|
+
}
|
|
1070
|
+
},
|
|
1071
|
+
handleRemove: function handleRemove(file, fileList) {
|
|
1072
|
+
this.$emit.apply(this, ['remove'].concat(Array.prototype.slice.call(arguments)));
|
|
1073
|
+
this.update(fileList);
|
|
1227
1074
|
}
|
|
1228
1075
|
},
|
|
1229
1076
|
render: function render() {
|
|
1230
|
-
var
|
|
1077
|
+
var _this$$slots$default,
|
|
1078
|
+
_this$$slots,
|
|
1079
|
+
_this = this;
|
|
1231
1080
|
|
|
1232
|
-
return createVNode("
|
|
1233
|
-
"
|
|
1234
|
-
|
|
1081
|
+
return createVNode(Fragment, null, [createVNode(resolveComponent("ElUpload"), mergeProps$1({
|
|
1082
|
+
"key": this.modelValue.length,
|
|
1083
|
+
"list-type": "picture-card"
|
|
1084
|
+
}, this.$attrs, {
|
|
1085
|
+
"class": {
|
|
1086
|
+
'_fc-exceed': this.$attrs.limit ? this.$attrs.limit <= this.modelValue.length : false
|
|
1087
|
+
},
|
|
1088
|
+
"onPreview": this.handlePreview,
|
|
1089
|
+
"onChange": this.handleChange,
|
|
1090
|
+
"onRemove": this.handleRemove,
|
|
1091
|
+
"fileList": this.fileList
|
|
1092
|
+
}), _objectSpread2({
|
|
1093
|
+
"default": function _default() {
|
|
1094
|
+
return [((_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)) || createVNode(resolveComponent("ElIcon"), null, {
|
|
1095
|
+
"default": function _default() {
|
|
1096
|
+
return [createVNode(resolveComponent("upload"), null, null)];
|
|
1097
|
+
}
|
|
1098
|
+
})];
|
|
1099
|
+
}
|
|
1100
|
+
}, getSlot(this.$slots, ['default']))), createVNode(resolveComponent("ElDialog"), {
|
|
1235
1101
|
"appendToBody": true,
|
|
1236
1102
|
"modal": this.previewMask,
|
|
1237
1103
|
"title": this.modalTitle,
|
|
@@ -1240,24 +1106,11 @@ var Upload = defineComponent({
|
|
|
1240
1106
|
}, {
|
|
1241
1107
|
"default": function _default() {
|
|
1242
1108
|
return [createVNode("img", {
|
|
1243
|
-
"alt": "example",
|
|
1244
1109
|
"style": "width: 100%",
|
|
1245
|
-
"src":
|
|
1110
|
+
"src": _this.previewImage
|
|
1246
1111
|
}, null)];
|
|
1247
1112
|
}
|
|
1248
1113
|
})]);
|
|
1249
|
-
},
|
|
1250
|
-
mounted: function mounted() {
|
|
1251
|
-
var _this6 = this;
|
|
1252
|
-
|
|
1253
|
-
this.uploadList = this.$refs.upload.uploadFiles;
|
|
1254
|
-
this.$watch(function () {
|
|
1255
|
-
return _this6.$refs.upload.uploadFiles;
|
|
1256
|
-
}, function () {
|
|
1257
|
-
_this6.update();
|
|
1258
|
-
}, {
|
|
1259
|
-
deep: true
|
|
1260
|
-
});
|
|
1261
1114
|
}
|
|
1262
1115
|
});
|
|
1263
1116
|
|
|
@@ -1288,9 +1141,9 @@ function _isSlot(s) {
|
|
|
1288
1141
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
1289
1142
|
}
|
|
1290
1143
|
|
|
1291
|
-
var NAME$
|
|
1144
|
+
var NAME$3 = 'fcGroup';
|
|
1292
1145
|
var Group = defineComponent({
|
|
1293
|
-
name: NAME$
|
|
1146
|
+
name: NAME$3,
|
|
1294
1147
|
props: {
|
|
1295
1148
|
field: String,
|
|
1296
1149
|
rule: Array,
|
|
@@ -1333,9 +1186,9 @@ var Group = defineComponent({
|
|
|
1333
1186
|
onBeforeAdd: {
|
|
1334
1187
|
type: Function,
|
|
1335
1188
|
"default": function _default() {}
|
|
1336
|
-
}
|
|
1189
|
+
},
|
|
1190
|
+
formCreateInject: Object
|
|
1337
1191
|
},
|
|
1338
|
-
inject: ['formCreateInject'],
|
|
1339
1192
|
data: function data() {
|
|
1340
1193
|
return {
|
|
1341
1194
|
len: 0,
|
|
@@ -1513,24 +1366,31 @@ var Group = defineComponent({
|
|
|
1513
1366
|
this.input(this.modelValue);
|
|
1514
1367
|
},
|
|
1515
1368
|
addIcon: function addIcon(key) {
|
|
1516
|
-
return createVNode("
|
|
1369
|
+
return createVNode(resolveComponent("el-icon"), {
|
|
1517
1370
|
"key": "a".concat(key),
|
|
1518
|
-
"class": "el-icon-circle-plus-outline",
|
|
1519
1371
|
"style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer', ";"),
|
|
1520
1372
|
"onClick": this.add
|
|
1521
|
-
},
|
|
1373
|
+
}, {
|
|
1374
|
+
"default": function _default() {
|
|
1375
|
+
return [createVNode(resolveComponent("circle-plus"), null, null)];
|
|
1376
|
+
}
|
|
1377
|
+
});
|
|
1522
1378
|
},
|
|
1523
1379
|
delIcon: function delIcon(index, key) {
|
|
1524
1380
|
var _this7 = this;
|
|
1525
1381
|
|
|
1526
|
-
return createVNode("
|
|
1382
|
+
return createVNode(resolveComponent("ElIcon"), {
|
|
1527
1383
|
"key": "d".concat(key),
|
|
1528
1384
|
"class": "el-icon-remove-outline",
|
|
1529
1385
|
"style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer;color:#606266', ";"),
|
|
1530
1386
|
"onClick": function onClick() {
|
|
1531
1387
|
return _this7.del(index, key);
|
|
1532
1388
|
}
|
|
1533
|
-
},
|
|
1389
|
+
}, {
|
|
1390
|
+
"default": function _default() {
|
|
1391
|
+
return [createVNode(resolveComponent("remove"), null, null)];
|
|
1392
|
+
}
|
|
1393
|
+
});
|
|
1534
1394
|
},
|
|
1535
1395
|
makeIcon: function makeIcon(total, index, key) {
|
|
1536
1396
|
var _this8 = this;
|
|
@@ -1586,12 +1446,12 @@ var Group = defineComponent({
|
|
|
1586
1446
|
vm: this,
|
|
1587
1447
|
add: this.add
|
|
1588
1448
|
}) : createVNode("i", {
|
|
1589
|
-
"key":
|
|
1449
|
+
"key": 1,
|
|
1590
1450
|
"class": "el-icon-circle-plus-outline",
|
|
1591
1451
|
"style": "font-size:".concat(this.fontSize, "px;vertical-align:middle;color:").concat(this.disabled ? '#c9cdd4;cursor: not-allowed' : '#606266;cursor:pointer', ";"),
|
|
1592
1452
|
"onClick": this.add
|
|
1593
1453
|
}, null) : createVNode("div", {
|
|
1594
|
-
"key":
|
|
1454
|
+
"key": 2
|
|
1595
1455
|
}, [keys.map(function (key, index) {
|
|
1596
1456
|
var _slot;
|
|
1597
1457
|
|
|
@@ -1649,9 +1509,9 @@ var Group = defineComponent({
|
|
|
1649
1509
|
}
|
|
1650
1510
|
});
|
|
1651
1511
|
|
|
1652
|
-
var NAME$
|
|
1512
|
+
var NAME$2 = 'fcSubForm';
|
|
1653
1513
|
var Sub = defineComponent({
|
|
1654
|
-
name: NAME$
|
|
1514
|
+
name: NAME$2,
|
|
1655
1515
|
props: {
|
|
1656
1516
|
rule: Array,
|
|
1657
1517
|
options: {
|
|
@@ -1676,9 +1536,9 @@ var Sub = defineComponent({
|
|
|
1676
1536
|
syncDisabled: {
|
|
1677
1537
|
type: Boolean,
|
|
1678
1538
|
"default": true
|
|
1679
|
-
}
|
|
1539
|
+
},
|
|
1540
|
+
formCreateInject: Object
|
|
1680
1541
|
},
|
|
1681
|
-
inject: ['formCreateInject'],
|
|
1682
1542
|
data: function data() {
|
|
1683
1543
|
return {
|
|
1684
1544
|
cacheValue: {},
|
|
@@ -1739,10 +1599,10 @@ var Sub = defineComponent({
|
|
|
1739
1599
|
|
|
1740
1600
|
var components = [Checkbox, Frame, Radio, Select, Tree, Upload, Group, Sub];
|
|
1741
1601
|
|
|
1742
|
-
var NAME$
|
|
1602
|
+
var NAME$1 = 'FormCreate';
|
|
1743
1603
|
function $FormCreate(FormCreate) {
|
|
1744
1604
|
return defineComponent({
|
|
1745
|
-
name: NAME$
|
|
1605
|
+
name: NAME$1,
|
|
1746
1606
|
props: {
|
|
1747
1607
|
rule: {
|
|
1748
1608
|
type: Array,
|
|
@@ -1759,7 +1619,8 @@ function $FormCreate(FormCreate) {
|
|
|
1759
1619
|
},
|
|
1760
1620
|
extendOption: Boolean,
|
|
1761
1621
|
modelValue: Object,
|
|
1762
|
-
api: Object
|
|
1622
|
+
api: Object,
|
|
1623
|
+
name: String
|
|
1763
1624
|
},
|
|
1764
1625
|
emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync', 'reload', 'repeat-field', 'update'],
|
|
1765
1626
|
render: function render() {
|
|
@@ -1775,6 +1636,7 @@ function $FormCreate(FormCreate) {
|
|
|
1775
1636
|
modelValue = _toRefs.modelValue;
|
|
1776
1637
|
|
|
1777
1638
|
var data = reactive({
|
|
1639
|
+
ctxInject: {},
|
|
1778
1640
|
destroyed: false,
|
|
1779
1641
|
isShow: true,
|
|
1780
1642
|
unique: 1,
|
|
@@ -2423,7 +2285,8 @@ function Api(h) {
|
|
|
2423
2285
|
|
|
2424
2286
|
if (ctx) {
|
|
2425
2287
|
if (child) {
|
|
2426
|
-
rules = ctx.rule.children;
|
|
2288
|
+
rules = ctx.getPending('children', ctx.rule.children);
|
|
2289
|
+
if (!Array.isArray(rules)) return;
|
|
2427
2290
|
index = ctx.rule.children.length - 1;
|
|
2428
2291
|
} else {
|
|
2429
2292
|
index = ctx.root.indexOf(ctx.origin);
|
|
@@ -2440,7 +2303,8 @@ function Api(h) {
|
|
|
2440
2303
|
|
|
2441
2304
|
if (ctx) {
|
|
2442
2305
|
if (child) {
|
|
2443
|
-
rules = ctx.rule.children;
|
|
2306
|
+
rules = ctx.getPending('children', ctx.rule.children);
|
|
2307
|
+
if (!Array.isArray(rules)) return;
|
|
2444
2308
|
} else {
|
|
2445
2309
|
index = ctx.root.indexOf(ctx.origin);
|
|
2446
2310
|
rules = ctx.root;
|
|
@@ -2744,9 +2608,9 @@ function toString(val) {
|
|
|
2744
2608
|
return val == null ? '' : _typeof(val) === 'object' ? JSON.stringify(val, null, 2) : String(val);
|
|
2745
2609
|
}
|
|
2746
2610
|
|
|
2747
|
-
var id$
|
|
2611
|
+
var id$2 = 0;
|
|
2748
2612
|
function uniqueId() {
|
|
2749
|
-
return Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now()).concat(++id$
|
|
2613
|
+
return Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now()).concat(++id$2)).toString(36);
|
|
2750
2614
|
}
|
|
2751
2615
|
|
|
2752
2616
|
function deepSet(data, idx, val) {
|
|
@@ -2809,7 +2673,7 @@ function useRender$1(Render) {
|
|
|
2809
2673
|
ctx.initProp();
|
|
2810
2674
|
this.mergeGlobal(ctx);
|
|
2811
2675
|
ctx.initNone();
|
|
2812
|
-
var slots = this.renderChildren(ctx);
|
|
2676
|
+
var slots = this.renderChildren(ctx.loadChildrenPending(), ctx);
|
|
2813
2677
|
var def = slots["default"];
|
|
2814
2678
|
def && slotBag.setSlot(ctx.rule.slot, function () {
|
|
2815
2679
|
return def();
|
|
@@ -2836,8 +2700,15 @@ function useRender$1(Render) {
|
|
|
2836
2700
|
ctx.prop = mergeRule({}, [this.cacheConfig[ctx.trueType].value, ctx.prop]);
|
|
2837
2701
|
},
|
|
2838
2702
|
setOptions: function setOptions(ctx) {
|
|
2839
|
-
|
|
2840
|
-
|
|
2703
|
+
var opt = ctx.loadPending({
|
|
2704
|
+
key: 'options',
|
|
2705
|
+
origin: ctx.prop.options,
|
|
2706
|
+
def: []
|
|
2707
|
+
});
|
|
2708
|
+
ctx.prop.options = opt;
|
|
2709
|
+
|
|
2710
|
+
if (ctx.prop.optionsTo && opt) {
|
|
2711
|
+
deepSet(ctx.prop, ctx.prop.optionsTo, opt);
|
|
2841
2712
|
}
|
|
2842
2713
|
},
|
|
2843
2714
|
deepSet: function deepSet$1(ctx) {
|
|
@@ -2866,34 +2737,37 @@ function useRender$1(Render) {
|
|
|
2866
2737
|
renderCtx: function renderCtx(ctx, parent) {
|
|
2867
2738
|
var _this4 = this;
|
|
2868
2739
|
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2740
|
+
try {
|
|
2741
|
+
if (ctx.type === 'hidden') return;
|
|
2742
|
+
var rule = ctx.rule;
|
|
2743
|
+
var preview = this.options.preview || false;
|
|
2744
|
+
|
|
2745
|
+
if (!this.cache[ctx.id] || this.cache[ctx.id].slot !== rule.slot) {
|
|
2746
|
+
var vn;
|
|
2747
|
+
ctx.initProp();
|
|
2748
|
+
this.mergeGlobal(ctx);
|
|
2749
|
+
ctx.initNone();
|
|
2750
|
+
this.$manager.tidyRule(ctx);
|
|
2751
|
+
this.deepSet(ctx);
|
|
2752
|
+
this.setOptions(ctx);
|
|
2753
|
+
this.ctxProp(ctx);
|
|
2754
|
+
var prop = ctx.prop;
|
|
2755
|
+
prop.props.formCreateInject = this.injectProp(ctx);
|
|
2756
|
+
|
|
2757
|
+
if (prop.hidden) {
|
|
2758
|
+
this.setCache(ctx, undefined, parent);
|
|
2759
|
+
return;
|
|
2760
|
+
}
|
|
2888
2761
|
|
|
2889
|
-
|
|
2890
|
-
return _this4.item(ctx, function () {
|
|
2762
|
+
vn = function vn() {
|
|
2891
2763
|
var children = {};
|
|
2892
2764
|
|
|
2765
|
+
var _load = ctx.loadChildrenPending();
|
|
2766
|
+
|
|
2893
2767
|
if (ctx.parser.renderChildren) {
|
|
2894
|
-
children = ctx.parser.renderChildren(ctx);
|
|
2768
|
+
children = ctx.parser.renderChildren(_load, ctx);
|
|
2895
2769
|
} else if (ctx.parser.loadChildren !== false) {
|
|
2896
|
-
children = _this4.renderChildren(ctx);
|
|
2770
|
+
children = _this4.renderChildren(_load, ctx);
|
|
2897
2771
|
}
|
|
2898
2772
|
|
|
2899
2773
|
var slot = _this4.getTypeSlot(ctx.type);
|
|
@@ -2923,15 +2797,22 @@ function useRender$1(Render) {
|
|
|
2923
2797
|
_vn = _this4.display(_vn);
|
|
2924
2798
|
}
|
|
2925
2799
|
|
|
2800
|
+
_this4.setCache(ctx, function () {
|
|
2801
|
+
return _vn;
|
|
2802
|
+
}, parent);
|
|
2803
|
+
|
|
2926
2804
|
return _vn;
|
|
2927
|
-
}
|
|
2928
|
-
};
|
|
2805
|
+
};
|
|
2929
2806
|
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2807
|
+
this.setCache(ctx, vn, parent);
|
|
2808
|
+
return vn;
|
|
2809
|
+
}
|
|
2933
2810
|
|
|
2934
|
-
|
|
2811
|
+
return this.getCache(ctx);
|
|
2812
|
+
} catch (e) {
|
|
2813
|
+
console.error(e);
|
|
2814
|
+
return;
|
|
2815
|
+
}
|
|
2935
2816
|
},
|
|
2936
2817
|
getModelField: function getModelField(ctx) {
|
|
2937
2818
|
return ctx.rule.modelField || ctx.parser.modelField || this.fc.modelFields[this.vNode.aliasMap[ctx.field]] || this.fc.modelFields[ctx.field] || this.fc.modelFields[ctx.originType] || 'modelValue';
|
|
@@ -2965,30 +2846,36 @@ function useRender$1(Render) {
|
|
|
2965
2846
|
return vn;
|
|
2966
2847
|
}
|
|
2967
2848
|
},
|
|
2968
|
-
item: function item(ctx, vn) {
|
|
2969
|
-
return this.vNode.h('FcFragment', {
|
|
2970
|
-
key: ctx.prop.key,
|
|
2971
|
-
formCreateInject: this.injectProp(ctx)
|
|
2972
|
-
}, vn);
|
|
2973
|
-
},
|
|
2974
2849
|
isFragment: function isFragment(ctx) {
|
|
2975
2850
|
return ctx.type === 'fragment' || ctx.type === 'template';
|
|
2976
2851
|
},
|
|
2977
2852
|
injectProp: function injectProp(ctx) {
|
|
2978
2853
|
var _this6 = this;
|
|
2979
2854
|
|
|
2980
|
-
|
|
2855
|
+
var state = this.vm.setupState;
|
|
2856
|
+
|
|
2857
|
+
if (!state.ctxInject[ctx.id]) {
|
|
2858
|
+
state.ctxInject[ctx.id] = {
|
|
2859
|
+
api: this.$handle.api,
|
|
2860
|
+
form: this.fc.create,
|
|
2861
|
+
subForm: function subForm(_subForm) {
|
|
2862
|
+
_this6.$handle.addSubForm(ctx, _subForm);
|
|
2863
|
+
},
|
|
2864
|
+
options: [],
|
|
2865
|
+
children: [],
|
|
2866
|
+
preview: false,
|
|
2867
|
+
field: ctx.field,
|
|
2868
|
+
rule: ctx.rule
|
|
2869
|
+
};
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2872
|
+
var inject = state.ctxInject[ctx.id];
|
|
2873
|
+
extend(inject, {
|
|
2981
2874
|
preview: this.options.preview || false,
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
},
|
|
2987
|
-
field: ctx.field,
|
|
2988
|
-
options: ctx.prop.options || [],
|
|
2989
|
-
children: ctx.rule.children,
|
|
2990
|
-
rule: ctx.rule
|
|
2991
|
-
};
|
|
2875
|
+
options: ctx.prop.options,
|
|
2876
|
+
children: ctx.loadChildrenPending()
|
|
2877
|
+
});
|
|
2878
|
+
return inject;
|
|
2992
2879
|
},
|
|
2993
2880
|
ctxProp: function ctxProp(ctx, custom) {
|
|
2994
2881
|
var _this7 = this;
|
|
@@ -3032,10 +2919,9 @@ function useRender$1(Render) {
|
|
|
3032
2919
|
onInput: function onInput(ctx, value) {
|
|
3033
2920
|
this.$handle.onInput(ctx, value);
|
|
3034
2921
|
},
|
|
3035
|
-
renderChildren: function renderChildren(ctx) {
|
|
2922
|
+
renderChildren: function renderChildren(children, ctx) {
|
|
3036
2923
|
var _this8 = this;
|
|
3037
2924
|
|
|
3038
|
-
var children = ctx.rule.children;
|
|
3039
2925
|
if (!is.trueArray(children)) return {};
|
|
3040
2926
|
var slotBag = makeSlotBag();
|
|
3041
2927
|
children.map(function (child) {
|
|
@@ -3101,7 +2987,7 @@ function useRender$1(Render) {
|
|
|
3101
2987
|
});
|
|
3102
2988
|
}
|
|
3103
2989
|
|
|
3104
|
-
var id = 1;
|
|
2990
|
+
var id$1 = 1;
|
|
3105
2991
|
function Render(handle) {
|
|
3106
2992
|
extend(this, {
|
|
3107
2993
|
$handle: handle,
|
|
@@ -3109,7 +2995,7 @@ function Render(handle) {
|
|
|
3109
2995
|
vm: handle.vm,
|
|
3110
2996
|
$manager: handle.$manager,
|
|
3111
2997
|
vNode: new handle.fc.CreateNode(handle.vm),
|
|
3112
|
-
id: id++
|
|
2998
|
+
id: id$1++
|
|
3113
2999
|
});
|
|
3114
3000
|
funcProxy(this, {
|
|
3115
3001
|
options: function options() {
|
|
@@ -3357,6 +3243,7 @@ function RuleContext(handle, rule) {
|
|
|
3357
3243
|
rule: rule,
|
|
3358
3244
|
origin: rule.__origin__ || rule,
|
|
3359
3245
|
name: rule.name,
|
|
3246
|
+
pending: {},
|
|
3360
3247
|
none: false,
|
|
3361
3248
|
watch: [],
|
|
3362
3249
|
linkOn: [],
|
|
@@ -3379,6 +3266,102 @@ function RuleContext(handle, rule) {
|
|
|
3379
3266
|
this.update(handle, true);
|
|
3380
3267
|
}
|
|
3381
3268
|
extend(RuleContext.prototype, {
|
|
3269
|
+
loadChildrenPending: function loadChildrenPending() {
|
|
3270
|
+
var _this = this;
|
|
3271
|
+
|
|
3272
|
+
var children = this.rule.children || [];
|
|
3273
|
+
if (Array.isArray(children)) return children;
|
|
3274
|
+
return this.loadPending({
|
|
3275
|
+
key: 'children',
|
|
3276
|
+
origin: children,
|
|
3277
|
+
def: [],
|
|
3278
|
+
onLoad: function onLoad(data) {
|
|
3279
|
+
_this.$handle && _this.$handle.loadChildren(data, _this);
|
|
3280
|
+
},
|
|
3281
|
+
onUpdate: function onUpdate(value, oldValue) {
|
|
3282
|
+
if (_this.$handle) {
|
|
3283
|
+
value === oldValue ? _this.$handle.loadChildren(value, _this) : _this.$handle.updateChildren(_this, value, oldValue);
|
|
3284
|
+
}
|
|
3285
|
+
},
|
|
3286
|
+
onReload: function onReload(value) {
|
|
3287
|
+
if (_this.$handle) {
|
|
3288
|
+
_this.$handle.updateChildren(_this, [], value);
|
|
3289
|
+
} else {
|
|
3290
|
+
delete _this.pending.children;
|
|
3291
|
+
}
|
|
3292
|
+
}
|
|
3293
|
+
});
|
|
3294
|
+
},
|
|
3295
|
+
loadPending: function loadPending(config) {
|
|
3296
|
+
var _this2 = this;
|
|
3297
|
+
|
|
3298
|
+
var key = config.key,
|
|
3299
|
+
origin = config.origin,
|
|
3300
|
+
def = config.def,
|
|
3301
|
+
onLoad = config.onLoad,
|
|
3302
|
+
onReload = config.onReload,
|
|
3303
|
+
onUpdate = config.onUpdate;
|
|
3304
|
+
|
|
3305
|
+
if (this.pending[key] && this.pending[key].origin === origin) {
|
|
3306
|
+
return this.getPending(key, def);
|
|
3307
|
+
}
|
|
3308
|
+
|
|
3309
|
+
delete this.pending[key];
|
|
3310
|
+
var value = origin;
|
|
3311
|
+
|
|
3312
|
+
if (is.Function(origin)) {
|
|
3313
|
+
var source = invoke(function () {
|
|
3314
|
+
return origin({
|
|
3315
|
+
rule: _this2.rule,
|
|
3316
|
+
api: _this2.$api,
|
|
3317
|
+
update: function update(data) {
|
|
3318
|
+
var value = data || def;
|
|
3319
|
+
|
|
3320
|
+
var oldValue = _this2.getPending(key, def);
|
|
3321
|
+
|
|
3322
|
+
_this2.setPending(key, origin, value);
|
|
3323
|
+
|
|
3324
|
+
onUpdate && onUpdate(value, oldValue);
|
|
3325
|
+
},
|
|
3326
|
+
reload: function reload() {
|
|
3327
|
+
var oldValue = _this2.getPending(key, def);
|
|
3328
|
+
|
|
3329
|
+
delete _this2.pending[key];
|
|
3330
|
+
onReload && onReload(oldValue);
|
|
3331
|
+
_this2.$api && _this2.$api.sync(_this2.rule);
|
|
3332
|
+
}
|
|
3333
|
+
});
|
|
3334
|
+
});
|
|
3335
|
+
|
|
3336
|
+
if (source && is.Function(source.then)) {
|
|
3337
|
+
source.then(function (data) {
|
|
3338
|
+
var value = data || def;
|
|
3339
|
+
|
|
3340
|
+
_this2.setPending(key, origin, value);
|
|
3341
|
+
|
|
3342
|
+
onLoad && onLoad(value);
|
|
3343
|
+
_this2.$api && _this2.$api.sync(_this2.rule);
|
|
3344
|
+
});
|
|
3345
|
+
value = def;
|
|
3346
|
+
this.setPending(key, origin, value);
|
|
3347
|
+
} else {
|
|
3348
|
+
value = source || def;
|
|
3349
|
+
this.setPending(key, origin, value);
|
|
3350
|
+
onLoad && onLoad(value);
|
|
3351
|
+
}
|
|
3352
|
+
}
|
|
3353
|
+
|
|
3354
|
+
return value;
|
|
3355
|
+
},
|
|
3356
|
+
getPending: function getPending(key, def) {
|
|
3357
|
+
return this.pending[key] && this.pending[key].value || def;
|
|
3358
|
+
},
|
|
3359
|
+
setPending: function setPending(key, origin, value) {
|
|
3360
|
+
this.pending[key] = {
|
|
3361
|
+
origin: origin,
|
|
3362
|
+
value: reactive(value)
|
|
3363
|
+
};
|
|
3364
|
+
},
|
|
3382
3365
|
effectData: function effectData(name) {
|
|
3383
3366
|
if (!this.payload[name]) {
|
|
3384
3367
|
this.payload[name] = {};
|
|
@@ -3402,13 +3385,13 @@ extend(RuleContext.prototype, {
|
|
|
3402
3385
|
parser.init(this);
|
|
3403
3386
|
},
|
|
3404
3387
|
initProp: function initProp() {
|
|
3405
|
-
var
|
|
3388
|
+
var _this3 = this;
|
|
3406
3389
|
|
|
3407
3390
|
var rule = _objectSpread2({}, this.rule);
|
|
3408
3391
|
|
|
3409
3392
|
delete rule.children;
|
|
3410
3393
|
this.prop = mergeProps([rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
|
|
3411
|
-
return
|
|
3394
|
+
return _this3.payload[k];
|
|
3412
3395
|
})), [this.computed]));
|
|
3413
3396
|
},
|
|
3414
3397
|
initNone: function initNone() {
|
|
@@ -3435,10 +3418,10 @@ extend(RuleContext.prototype, {
|
|
|
3435
3418
|
this.$handle.appendLink(this);
|
|
3436
3419
|
},
|
|
3437
3420
|
watchTo: function watchTo() {
|
|
3438
|
-
var
|
|
3421
|
+
var _this4 = this;
|
|
3439
3422
|
|
|
3440
3423
|
nextTick(function () {
|
|
3441
|
-
|
|
3424
|
+
_this4.$handle && _this4.$handle.watchCtx(_this4);
|
|
3442
3425
|
});
|
|
3443
3426
|
},
|
|
3444
3427
|
"delete": function _delete() {
|
|
@@ -3468,15 +3451,15 @@ extend(RuleContext.prototype, {
|
|
|
3468
3451
|
this.ctrlRule = [];
|
|
3469
3452
|
},
|
|
3470
3453
|
rm: function rm() {
|
|
3471
|
-
var
|
|
3454
|
+
var _this5 = this;
|
|
3472
3455
|
|
|
3473
3456
|
var _rm = function _rm() {
|
|
3474
|
-
var index =
|
|
3457
|
+
var index = _this5.root.indexOf(_this5.origin);
|
|
3475
3458
|
|
|
3476
3459
|
if (index > -1) {
|
|
3477
|
-
|
|
3460
|
+
_this5.root.splice(index, 1);
|
|
3478
3461
|
|
|
3479
|
-
|
|
3462
|
+
_this5.$handle && _this5.$handle.refresh();
|
|
3480
3463
|
}
|
|
3481
3464
|
};
|
|
3482
3465
|
|
|
@@ -3487,17 +3470,17 @@ extend(RuleContext.prototype, {
|
|
|
3487
3470
|
}
|
|
3488
3471
|
|
|
3489
3472
|
this.$handle.noWatch(function () {
|
|
3490
|
-
|
|
3491
|
-
|
|
3473
|
+
_this5.$handle.deferSyncValue(function () {
|
|
3474
|
+
_this5.rmCtrl();
|
|
3492
3475
|
|
|
3493
3476
|
_rm();
|
|
3494
3477
|
|
|
3495
|
-
|
|
3478
|
+
_this5.$handle.rmCtx(_this5);
|
|
3496
3479
|
|
|
3497
|
-
extend(
|
|
3480
|
+
extend(_this5, {
|
|
3498
3481
|
root: []
|
|
3499
3482
|
});
|
|
3500
|
-
},
|
|
3483
|
+
}, _this5.input);
|
|
3501
3484
|
});
|
|
3502
3485
|
},
|
|
3503
3486
|
update: function update(handle, init) {
|
|
@@ -3536,7 +3519,6 @@ function useLoader(Handler) {
|
|
|
3536
3519
|
});
|
|
3537
3520
|
fullRule(rule);
|
|
3538
3521
|
this.appendValue(rule);
|
|
3539
|
-
rule.options = Array.isArray(rule.options) ? rule.options : [];
|
|
3540
3522
|
[rule, rule['prefix'], rule['suffix']].forEach(function (item) {
|
|
3541
3523
|
if (!item) {
|
|
3542
3524
|
return;
|
|
@@ -3656,7 +3638,7 @@ function useLoader(Handler) {
|
|
|
3656
3638
|
if (!is.Object(_rule) || !getRule(_rule).type) return err('未定义生成规则的 type 字段', _rule);
|
|
3657
3639
|
|
|
3658
3640
|
if (_rule.__fc__ && _rule.__fc__.root === rules && _this6.ctxs[_rule.__fc__.id]) {
|
|
3659
|
-
loadChildren(_rule.__fc__.
|
|
3641
|
+
loadChildren(_rule.__fc__.loadChildrenPending(), _rule.__fc__);
|
|
3660
3642
|
return _rule.__fc__;
|
|
3661
3643
|
}
|
|
3662
3644
|
|
|
@@ -3727,7 +3709,10 @@ function useLoader(Handler) {
|
|
|
3727
3709
|
_this6.setCtx(ctx);
|
|
3728
3710
|
|
|
3729
3711
|
!isCopy && !isInit && _this6.effect(ctx, 'load');
|
|
3730
|
-
|
|
3712
|
+
|
|
3713
|
+
var _load = ctx.loadChildrenPending();
|
|
3714
|
+
|
|
3715
|
+
ctx.parser.loadChildren === false || loadChildren(_load, ctx);
|
|
3731
3716
|
|
|
3732
3717
|
if (!parent) {
|
|
3733
3718
|
var _preIndex = preIndex(index);
|
|
@@ -3823,7 +3808,7 @@ function useLoader(Handler) {
|
|
|
3823
3808
|
if (valid) {
|
|
3824
3809
|
flag = true;
|
|
3825
3810
|
var ruleCon = {
|
|
3826
|
-
type: '
|
|
3811
|
+
type: 'fragment',
|
|
3827
3812
|
"native": true,
|
|
3828
3813
|
__ctrl: true,
|
|
3829
3814
|
children: rule
|
|
@@ -4163,7 +4148,7 @@ function useContext(Handler) {
|
|
|
4163
4148
|
var flag = key === 'children';
|
|
4164
4149
|
ctx.refRule[key] = ref;
|
|
4165
4150
|
ctx.watch.push(watch(flag ? function () {
|
|
4166
|
-
return _toConsumableArray(ref.value || []);
|
|
4151
|
+
return is.Function(ref.value) ? ref.value : _toConsumableArray(ref.value || []);
|
|
4167
4152
|
} : function () {
|
|
4168
4153
|
return ref.value;
|
|
4169
4154
|
}, function (_, o) {
|
|
@@ -4193,20 +4178,16 @@ function useContext(Handler) {
|
|
|
4193
4178
|
ctx.updateType();
|
|
4194
4179
|
|
|
4195
4180
|
_this.bindParser(ctx);
|
|
4196
|
-
} else if (
|
|
4197
|
-
|
|
4198
|
-
o
|
|
4199
|
-
|
|
4200
|
-
_this.rmCtx(child.__fc__);
|
|
4201
|
-
}
|
|
4202
|
-
});
|
|
4181
|
+
} else if (flag) {
|
|
4182
|
+
if (is.Function(o)) {
|
|
4183
|
+
o = ctx.getPending('children', []);
|
|
4184
|
+
}
|
|
4203
4185
|
|
|
4204
|
-
|
|
4205
|
-
|
|
4186
|
+
if (is.Function(n)) {
|
|
4187
|
+
n = ctx.loadChildrenPending();
|
|
4188
|
+
}
|
|
4206
4189
|
|
|
4207
|
-
|
|
4208
|
-
}
|
|
4209
|
-
});
|
|
4190
|
+
_this.updateChildren(ctx, n, o);
|
|
4210
4191
|
}
|
|
4211
4192
|
|
|
4212
4193
|
_this.$render.clearCache(ctx);
|
|
@@ -4233,15 +4214,32 @@ function useContext(Handler) {
|
|
|
4233
4214
|
|
|
4234
4215
|
this.watchEffect(ctx);
|
|
4235
4216
|
},
|
|
4236
|
-
|
|
4217
|
+
updateChildren: function updateChildren(ctx, n, o) {
|
|
4237
4218
|
var _this2 = this;
|
|
4238
4219
|
|
|
4220
|
+
this.deferSyncValue(function () {
|
|
4221
|
+
o && o.forEach(function (child) {
|
|
4222
|
+
if ((n || []).indexOf(child) === -1 && child && !is.String(child) && child.__fc__) {
|
|
4223
|
+
_this2.rmCtx(child.__fc__);
|
|
4224
|
+
}
|
|
4225
|
+
});
|
|
4226
|
+
|
|
4227
|
+
if (is.trueArray(n)) {
|
|
4228
|
+
_this2.loadChildren(n, ctx);
|
|
4229
|
+
|
|
4230
|
+
_this2.bus.$emit('update', _this2.api);
|
|
4231
|
+
}
|
|
4232
|
+
});
|
|
4233
|
+
},
|
|
4234
|
+
rmSub: function rmSub(sub) {
|
|
4235
|
+
var _this3 = this;
|
|
4236
|
+
|
|
4239
4237
|
is.trueArray(sub) && sub.forEach(function (r) {
|
|
4240
|
-
r && r.__fc__ &&
|
|
4238
|
+
r && r.__fc__ && _this3.rmCtx(r.__fc__);
|
|
4241
4239
|
});
|
|
4242
4240
|
},
|
|
4243
4241
|
rmCtx: function rmCtx(ctx) {
|
|
4244
|
-
var
|
|
4242
|
+
var _this4 = this;
|
|
4245
4243
|
|
|
4246
4244
|
if (ctx.deleted) return;
|
|
4247
4245
|
var id = ctx.id,
|
|
@@ -4251,20 +4249,23 @@ function useContext(Handler) {
|
|
|
4251
4249
|
$del(this.ctxs, id);
|
|
4252
4250
|
$del(this.formData, id);
|
|
4253
4251
|
$del(this.subForm, id);
|
|
4252
|
+
$del(this.vm.setupState.ctxInject, id);
|
|
4254
4253
|
input && this.rmIdCtx(ctx, field, 'field');
|
|
4255
4254
|
name && this.rmIdCtx(ctx, name, 'name');
|
|
4256
4255
|
this.deferSyncValue(function () {
|
|
4257
|
-
if (!
|
|
4256
|
+
if (!_this4.reloading) {
|
|
4258
4257
|
if (ctx.parser.loadChildren !== false) {
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4258
|
+
var children = ctx.getPending('children', ctx.rule.children);
|
|
4259
|
+
|
|
4260
|
+
if (is.trueArray(children)) {
|
|
4261
|
+
children.forEach(function (h) {
|
|
4262
|
+
return h.__fc__ && _this4.rmCtx(h.__fc__);
|
|
4262
4263
|
});
|
|
4263
4264
|
}
|
|
4264
4265
|
}
|
|
4265
4266
|
|
|
4266
|
-
if (ctx.root ===
|
|
4267
|
-
|
|
4267
|
+
if (ctx.root === _this4.rules) {
|
|
4268
|
+
_this4.vm.setupState.renderRule();
|
|
4268
4269
|
}
|
|
4269
4270
|
}
|
|
4270
4271
|
}, input);
|
|
@@ -4383,7 +4384,7 @@ function useEffect(Handler) {
|
|
|
4383
4384
|
input = _ref.input,
|
|
4384
4385
|
type = _ref.type,
|
|
4385
4386
|
custom = _ref.custom;
|
|
4386
|
-
if (!type ||
|
|
4387
|
+
if (!type || ['fcFragment', 'fragment'].indexOf(type) > -1) return;
|
|
4387
4388
|
var effect = custom ? custom : rule.effect || {};
|
|
4388
4389
|
Object.keys(effect).forEach(function (attr) {
|
|
4389
4390
|
var p = _this4.providers[attr];
|
|
@@ -4580,26 +4581,8 @@ function fetch(option) {
|
|
|
4580
4581
|
xhr.send(formData);
|
|
4581
4582
|
}
|
|
4582
4583
|
|
|
4583
|
-
var NAME
|
|
4584
|
+
var NAME = 'fcFragment';
|
|
4584
4585
|
var fragment = defineComponent({
|
|
4585
|
-
name: NAME$1,
|
|
4586
|
-
inheritAttrs: false,
|
|
4587
|
-
props: ['formCreateInject'],
|
|
4588
|
-
setup: function setup(props) {
|
|
4589
|
-
var data = toRef(props, 'formCreateInject');
|
|
4590
|
-
var $inject = reactive(_objectSpread2({}, data.value));
|
|
4591
|
-
watch(data, function () {
|
|
4592
|
-
extend($inject, data.value);
|
|
4593
|
-
});
|
|
4594
|
-
provide('formCreateInject', $inject);
|
|
4595
|
-
},
|
|
4596
|
-
render: function render() {
|
|
4597
|
-
return this.$slots["default"]();
|
|
4598
|
-
}
|
|
4599
|
-
});
|
|
4600
|
-
|
|
4601
|
-
var NAME = 'FcVnode';
|
|
4602
|
-
var vnode = defineComponent({
|
|
4603
4586
|
name: NAME,
|
|
4604
4587
|
inheritAttrs: false,
|
|
4605
4588
|
props: ['vnode'],
|
|
@@ -4642,8 +4625,14 @@ function CreateNodeFactory() {
|
|
|
4642
4625
|
return makeDirective(data, this.h(tag, toProps(data), children));
|
|
4643
4626
|
},
|
|
4644
4627
|
h: function h(tag, data, children) {
|
|
4628
|
+
var isNativeTag = getCurrentInstance().appContext.config.isNativeTag(tag);
|
|
4629
|
+
|
|
4630
|
+
if (isNativeTag) {
|
|
4631
|
+
delete data.formCreateInject;
|
|
4632
|
+
}
|
|
4633
|
+
|
|
4645
4634
|
try {
|
|
4646
|
-
return createVNode(
|
|
4635
|
+
return createVNode(isNativeTag ? tag : resolveComponent(tag), data, children);
|
|
4647
4636
|
} catch (e) {
|
|
4648
4637
|
console.error(e);
|
|
4649
4638
|
return createVNode('');
|
|
@@ -4686,7 +4675,7 @@ function createManager(proto) {
|
|
|
4686
4675
|
return _super.apply(this, arguments);
|
|
4687
4676
|
}
|
|
4688
4677
|
|
|
4689
|
-
return
|
|
4678
|
+
return CustomManager;
|
|
4690
4679
|
}(Manager);
|
|
4691
4680
|
|
|
4692
4681
|
Object.assign(CustomManager.prototype, proto);
|
|
@@ -4831,6 +4820,25 @@ function run(inject, rule, api) {
|
|
|
4831
4820
|
return true;
|
|
4832
4821
|
}
|
|
4833
4822
|
|
|
4823
|
+
var name$6 = 'html';
|
|
4824
|
+
var html = {
|
|
4825
|
+
name: name$6,
|
|
4826
|
+
loadChildren: false,
|
|
4827
|
+
render: function render(children, ctx) {
|
|
4828
|
+
ctx.prop.props.innerHTML = children["default"]();
|
|
4829
|
+
return ctx.vNode.make(ctx.prop.props.tag || 'div', ctx.prop);
|
|
4830
|
+
},
|
|
4831
|
+
renderChildren: function renderChildren(children) {
|
|
4832
|
+
return {
|
|
4833
|
+
"default": function _default() {
|
|
4834
|
+
return children.filter(function (v) {
|
|
4835
|
+
return is.String(v);
|
|
4836
|
+
}).join('');
|
|
4837
|
+
}
|
|
4838
|
+
};
|
|
4839
|
+
}
|
|
4840
|
+
};
|
|
4841
|
+
|
|
4834
4842
|
function parseProp(name, id) {
|
|
4835
4843
|
var prop;
|
|
4836
4844
|
|
|
@@ -4859,8 +4867,10 @@ function exportAttrs(attrs) {
|
|
|
4859
4867
|
arrayAttrs.push.apply(arrayAttrs, _toConsumableArray(array));
|
|
4860
4868
|
normalAttrs.push.apply(normalAttrs, _toConsumableArray(normal));
|
|
4861
4869
|
appendProto([].concat(_toConsumableArray(key), _toConsumableArray(array), _toConsumableArray(normal)));
|
|
4862
|
-
}
|
|
4870
|
+
}
|
|
4863
4871
|
|
|
4872
|
+
var id = 1;
|
|
4873
|
+
var instance = {}; //todo 表单嵌套
|
|
4864
4874
|
|
|
4865
4875
|
function FormCreateFactory(config) {
|
|
4866
4876
|
var components = _defineProperty({}, fragment.name, fragment);
|
|
@@ -4868,6 +4878,7 @@ function FormCreateFactory(config) {
|
|
|
4868
4878
|
var parsers = {};
|
|
4869
4879
|
var directives = {};
|
|
4870
4880
|
var modelFields = {};
|
|
4881
|
+
var useApps = [];
|
|
4871
4882
|
var providers = {
|
|
4872
4883
|
fetch: $fetch
|
|
4873
4884
|
};
|
|
@@ -4879,6 +4890,14 @@ function FormCreateFactory(config) {
|
|
|
4879
4890
|
var CreateNode = CreateNodeFactory();
|
|
4880
4891
|
exportAttrs(config.attrs || {});
|
|
4881
4892
|
|
|
4893
|
+
function getApi(name) {
|
|
4894
|
+
return instance[name];
|
|
4895
|
+
}
|
|
4896
|
+
|
|
4897
|
+
function useApp(fn) {
|
|
4898
|
+
useApps.push(fn);
|
|
4899
|
+
}
|
|
4900
|
+
|
|
4882
4901
|
function directive() {
|
|
4883
4902
|
var data = nameProp.apply(void 0, arguments);
|
|
4884
4903
|
if (data.id && data.prop) directives[data.id] = data.prop;
|
|
@@ -4947,7 +4966,7 @@ function FormCreateFactory(config) {
|
|
|
4947
4966
|
}
|
|
4948
4967
|
|
|
4949
4968
|
function $vnode() {
|
|
4950
|
-
return
|
|
4969
|
+
return fragment;
|
|
4951
4970
|
} //todo 检查回调函数作用域
|
|
4952
4971
|
|
|
4953
4972
|
|
|
@@ -4958,7 +4977,11 @@ function FormCreateFactory(config) {
|
|
|
4958
4977
|
|
|
4959
4978
|
function create(rules, option) {
|
|
4960
4979
|
var app = createFormApp(rules, option || {});
|
|
4961
|
-
|
|
4980
|
+
useApps.forEach(function (v) {
|
|
4981
|
+
invoke(function () {
|
|
4982
|
+
return v(create, app);
|
|
4983
|
+
});
|
|
4984
|
+
});
|
|
4962
4985
|
var div = document.createElement('div');
|
|
4963
4986
|
((option === null || option === void 0 ? void 0 : option.el) || document.body).appendChild(div);
|
|
4964
4987
|
var vm = app.mount(div);
|
|
@@ -4977,6 +5000,7 @@ function FormCreateFactory(config) {
|
|
|
4977
5000
|
var _this = this;
|
|
4978
5001
|
|
|
4979
5002
|
extend(this, {
|
|
5003
|
+
id: id++,
|
|
4980
5004
|
create: create,
|
|
4981
5005
|
vm: vm,
|
|
4982
5006
|
manager: createManager(config.manager),
|
|
@@ -4984,6 +5008,7 @@ function FormCreateFactory(config) {
|
|
|
4984
5008
|
providers: providers,
|
|
4985
5009
|
modelFields: modelFields,
|
|
4986
5010
|
rules: vm.props.rule,
|
|
5011
|
+
name: vm.props.name,
|
|
4987
5012
|
prop: {
|
|
4988
5013
|
components: components,
|
|
4989
5014
|
directives: directives
|
|
@@ -5008,6 +5033,10 @@ function FormCreateFactory(config) {
|
|
|
5008
5033
|
extend(vm.appContext.components, components);
|
|
5009
5034
|
extend(vm.appContext.directives, directives);
|
|
5010
5035
|
this.$handle = new Handler(this);
|
|
5036
|
+
|
|
5037
|
+
if (this.name) {
|
|
5038
|
+
instance[this.name] = this.api();
|
|
5039
|
+
}
|
|
5011
5040
|
}
|
|
5012
5041
|
|
|
5013
5042
|
extend(FormCreate.prototype, {
|
|
@@ -5073,6 +5102,10 @@ function FormCreateFactory(config) {
|
|
|
5073
5102
|
this.$handle.mounted();
|
|
5074
5103
|
},
|
|
5075
5104
|
unmount: function unmount() {
|
|
5105
|
+
if (this.name) {
|
|
5106
|
+
delete instance[this.name];
|
|
5107
|
+
}
|
|
5108
|
+
|
|
5076
5109
|
this.unwatch && this.unwatch();
|
|
5077
5110
|
this.$handle.reloadRule([]);
|
|
5078
5111
|
},
|
|
@@ -5106,17 +5139,19 @@ function FormCreateFactory(config) {
|
|
|
5106
5139
|
$form: $form,
|
|
5107
5140
|
parseFn: parseFn,
|
|
5108
5141
|
parseJson: parseJson,
|
|
5109
|
-
toJson: toJson
|
|
5142
|
+
toJson: toJson,
|
|
5143
|
+
useApp: useApp,
|
|
5144
|
+
getApi: getApi
|
|
5110
5145
|
});
|
|
5111
5146
|
}
|
|
5112
5147
|
|
|
5113
5148
|
function useStatic(formCreate) {
|
|
5114
5149
|
extend(formCreate, {
|
|
5115
5150
|
create: create,
|
|
5116
|
-
install: function install(
|
|
5151
|
+
install: function install(app, options) {
|
|
5117
5152
|
globalConfig = _objectSpread2(_objectSpread2({}, globalConfig), options || {});
|
|
5118
|
-
if (
|
|
5119
|
-
|
|
5153
|
+
if (app._installedFormCreate === true) return;
|
|
5154
|
+
app._installedFormCreate = true;
|
|
5120
5155
|
|
|
5121
5156
|
var $formCreate = function $formCreate(rules) {
|
|
5122
5157
|
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -5124,9 +5159,13 @@ function FormCreateFactory(config) {
|
|
|
5124
5159
|
};
|
|
5125
5160
|
|
|
5126
5161
|
useAttr($formCreate);
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5162
|
+
app.config.globalProperties.$formCreate = $formCreate;
|
|
5163
|
+
app.component('FormCreate', $form());
|
|
5164
|
+
useApps.forEach(function (v) {
|
|
5165
|
+
invoke(function () {
|
|
5166
|
+
return v(formCreate, app);
|
|
5167
|
+
});
|
|
5168
|
+
});
|
|
5130
5169
|
}
|
|
5131
5170
|
});
|
|
5132
5171
|
}
|
|
@@ -5136,7 +5175,13 @@ function FormCreateFactory(config) {
|
|
|
5136
5175
|
CreateNode.use({
|
|
5137
5176
|
fragment: 'fcFragment'
|
|
5138
5177
|
});
|
|
5139
|
-
|
|
5178
|
+
config.install && create.use(config);
|
|
5179
|
+
useApp(function (_, app) {
|
|
5180
|
+
app.mixin({
|
|
5181
|
+
props: ['formCreateInject']
|
|
5182
|
+
});
|
|
5183
|
+
});
|
|
5184
|
+
parser(html);
|
|
5140
5185
|
return create;
|
|
5141
5186
|
}
|
|
5142
5187
|
|
|
@@ -5281,7 +5326,7 @@ var parsers = [datePicker, hidden, input, slider, timePicker, row, select];
|
|
|
5281
5326
|
var PRE = 'el';
|
|
5282
5327
|
var alias = {
|
|
5283
5328
|
button: PRE + '-button',
|
|
5284
|
-
icon: '
|
|
5329
|
+
icon: PRE + '-icon',
|
|
5285
5330
|
slider: PRE + '-slider',
|
|
5286
5331
|
rate: PRE + '-rate',
|
|
5287
5332
|
upload: 'fc-upload',
|
|
@@ -5338,7 +5383,6 @@ function getConfig() {
|
|
|
5338
5383
|
type: 'default',
|
|
5339
5384
|
loading: false,
|
|
5340
5385
|
disabled: false,
|
|
5341
|
-
icon: 'el-icon-refresh',
|
|
5342
5386
|
innerText: '重置',
|
|
5343
5387
|
show: false,
|
|
5344
5388
|
col: undefined,
|
|
@@ -5428,7 +5472,7 @@ var manager = {
|
|
|
5428
5472
|
info: {
|
|
5429
5473
|
trigger: 'hover',
|
|
5430
5474
|
placement: 'top-start',
|
|
5431
|
-
icon:
|
|
5475
|
+
icon: true
|
|
5432
5476
|
},
|
|
5433
5477
|
title: {},
|
|
5434
5478
|
col: {
|
|
@@ -5544,10 +5588,16 @@ var manager = {
|
|
|
5544
5588
|
|
|
5545
5589
|
children[infoProp.align !== 'left' ? 'unshift' : 'push'](this.$r(mergeProps([infoProp, prop]), _defineProperty({}, titleProp.slot || (isTip ? 'default' : 'reference'), function () {
|
|
5546
5590
|
return _this4.$r({
|
|
5547
|
-
type: '
|
|
5548
|
-
|
|
5591
|
+
type: 'ElIcon',
|
|
5592
|
+
style: 'top:2px',
|
|
5549
5593
|
key: "".concat(uni, "i")
|
|
5550
|
-
}, {
|
|
5594
|
+
}, {
|
|
5595
|
+
"default": function _default() {
|
|
5596
|
+
return _this4.$r({
|
|
5597
|
+
type: infoProp.icon === true ? 'warning' : infoProp.icon
|
|
5598
|
+
});
|
|
5599
|
+
}
|
|
5600
|
+
}, true);
|
|
5551
5601
|
})));
|
|
5552
5602
|
}
|
|
5553
5603
|
|
|
@@ -5904,12 +5954,18 @@ function install(FormCreate) {
|
|
|
5904
5954
|
Object.keys(maker$1).forEach(function (name) {
|
|
5905
5955
|
FormCreate.maker[name] = maker$1[name];
|
|
5906
5956
|
});
|
|
5957
|
+
|
|
5958
|
+
if (typeof window !== 'undefined' && window.ElementPlus) {
|
|
5959
|
+
FormCreate.useApp(function (_, app) {
|
|
5960
|
+
app.use(window.ElementPlus);
|
|
5961
|
+
});
|
|
5962
|
+
}
|
|
5907
5963
|
}
|
|
5908
5964
|
|
|
5909
5965
|
function elmFormCreate() {
|
|
5910
5966
|
return FormCreateFactory({
|
|
5911
5967
|
ui: 'element-ui',
|
|
5912
|
-
version: '3.0
|
|
5968
|
+
version: '3.1.0',
|
|
5913
5969
|
manager: manager,
|
|
5914
5970
|
extendApi: extendApi,
|
|
5915
5971
|
install: install,
|