@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.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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.
|
|
@@ -15,9 +15,14 @@
|
|
|
15
15
|
|
|
16
16
|
if (Object.getOwnPropertySymbols) {
|
|
17
17
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
|
|
19
|
+
if (enumerableOnly) {
|
|
20
|
+
symbols = symbols.filter(function (sym) {
|
|
21
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
keys.push.apply(keys, symbols);
|
|
21
26
|
}
|
|
22
27
|
|
|
23
28
|
return keys;
|
|
@@ -25,12 +30,19 @@
|
|
|
25
30
|
|
|
26
31
|
function _objectSpread2(target) {
|
|
27
32
|
for (var i = 1; i < arguments.length; i++) {
|
|
28
|
-
var source =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
34
|
+
|
|
35
|
+
if (i % 2) {
|
|
36
|
+
ownKeys(Object(source), true).forEach(function (key) {
|
|
37
|
+
_defineProperty(target, key, source[key]);
|
|
38
|
+
});
|
|
39
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
40
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
41
|
+
} else {
|
|
42
|
+
ownKeys(Object(source)).forEach(function (key) {
|
|
43
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
44
|
+
});
|
|
45
|
+
}
|
|
34
46
|
}
|
|
35
47
|
|
|
36
48
|
return target;
|
|
@@ -39,11 +51,17 @@
|
|
|
39
51
|
function _typeof(obj) {
|
|
40
52
|
"@babel/helpers - typeof";
|
|
41
53
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
54
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
55
|
+
_typeof = function (obj) {
|
|
56
|
+
return typeof obj;
|
|
57
|
+
};
|
|
58
|
+
} else {
|
|
59
|
+
_typeof = function (obj) {
|
|
60
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return _typeof(obj);
|
|
47
65
|
}
|
|
48
66
|
|
|
49
67
|
function _classCallCheck(instance, Constructor) {
|
|
@@ -52,25 +70,6 @@
|
|
|
52
70
|
}
|
|
53
71
|
}
|
|
54
72
|
|
|
55
|
-
function _defineProperties(target, props) {
|
|
56
|
-
for (var i = 0; i < props.length; i++) {
|
|
57
|
-
var descriptor = props[i];
|
|
58
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
59
|
-
descriptor.configurable = true;
|
|
60
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
61
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
66
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
67
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
68
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
69
|
-
writable: false
|
|
70
|
-
});
|
|
71
|
-
return Constructor;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
73
|
function _defineProperty(obj, key, value) {
|
|
75
74
|
if (key in obj) {
|
|
76
75
|
Object.defineProperty(obj, key, {
|
|
@@ -98,9 +97,6 @@
|
|
|
98
97
|
configurable: true
|
|
99
98
|
}
|
|
100
99
|
});
|
|
101
|
-
Object.defineProperty(subClass, "prototype", {
|
|
102
|
-
writable: false
|
|
103
|
-
});
|
|
104
100
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
105
101
|
}
|
|
106
102
|
|
|
@@ -213,11 +209,12 @@
|
|
|
213
209
|
}, []);
|
|
214
210
|
}
|
|
215
211
|
|
|
216
|
-
var NAME$
|
|
212
|
+
var NAME$9 = 'fcCheckbox';
|
|
217
213
|
var Checkbox = vue.defineComponent({
|
|
218
|
-
name: NAME$
|
|
214
|
+
name: NAME$9,
|
|
219
215
|
inheritAttrs: false,
|
|
220
216
|
props: {
|
|
217
|
+
formCreateInject: Object,
|
|
221
218
|
modelValue: {
|
|
222
219
|
type: Array,
|
|
223
220
|
"default": function _default() {
|
|
@@ -228,51 +225,21 @@
|
|
|
228
225
|
},
|
|
229
226
|
emits: ['update:modelValue'],
|
|
230
227
|
setup: function setup(props, _) {
|
|
231
|
-
var
|
|
232
|
-
options = _toRefs.options;
|
|
233
|
-
|
|
234
|
-
var trueValue = vue.ref([]);
|
|
228
|
+
var options = vue.toRef(props.formCreateInject, 'options', []);
|
|
235
229
|
var value = vue.toRef(props, 'modelValue');
|
|
236
230
|
|
|
237
231
|
var _options = function _options() {
|
|
238
232
|
return Array.isArray(options.value) ? options.value : [];
|
|
239
233
|
};
|
|
240
234
|
|
|
241
|
-
var update = function update() {
|
|
242
|
-
trueValue.value = value.value ? _options().filter(function (opt) {
|
|
243
|
-
return value.value.indexOf(opt.value) !== -1;
|
|
244
|
-
}).map(function (option) {
|
|
245
|
-
return option.label;
|
|
246
|
-
}) : [];
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
vue.watch(options, function () {
|
|
250
|
-
update();
|
|
251
|
-
}, {
|
|
252
|
-
deep: true,
|
|
253
|
-
immediate: true
|
|
254
|
-
});
|
|
255
235
|
return {
|
|
256
236
|
options: _options,
|
|
257
|
-
trueValue: trueValue,
|
|
258
237
|
value: value,
|
|
259
238
|
onInput: function onInput(n) {
|
|
260
|
-
_.emit('update:modelValue',
|
|
261
|
-
|
|
262
|
-
}).map(function (opt) {
|
|
263
|
-
return opt.value;
|
|
264
|
-
}).filter(function (v) {
|
|
265
|
-
return v !== undefined;
|
|
266
|
-
}));
|
|
267
|
-
},
|
|
268
|
-
update: update
|
|
239
|
+
_.emit('update:modelValue', n);
|
|
240
|
+
}
|
|
269
241
|
};
|
|
270
242
|
},
|
|
271
|
-
watch: {
|
|
272
|
-
modelValue: function modelValue() {
|
|
273
|
-
this.update();
|
|
274
|
-
}
|
|
275
|
-
},
|
|
276
243
|
render: function render() {
|
|
277
244
|
var _this$$slots$default,
|
|
278
245
|
_this$$slots,
|
|
@@ -281,17 +248,23 @@
|
|
|
281
248
|
var name = this.type === 'button' ? 'ElCheckboxButton' : 'ElCheckbox';
|
|
282
249
|
var Type = vue.resolveComponent(name);
|
|
283
250
|
return vue.createVNode(vue.resolveComponent("ElCheckboxGroup"), vue.mergeProps(this.$attrs, {
|
|
284
|
-
"modelValue": this.
|
|
251
|
+
"modelValue": this.value,
|
|
285
252
|
"onUpdate:modelValue": this.onInput
|
|
286
253
|
}), _objectSpread2({
|
|
287
254
|
"default": function _default() {
|
|
288
255
|
return [_this.options().map(function (opt, index) {
|
|
289
256
|
var props = _objectSpread2({}, opt);
|
|
290
257
|
|
|
258
|
+
var value = props.value;
|
|
291
259
|
delete props.value;
|
|
292
260
|
return vue.createVNode(Type, vue.mergeProps(props, {
|
|
261
|
+
"label": value,
|
|
293
262
|
"key": name + index + opt.value
|
|
294
|
-
}),
|
|
263
|
+
}), {
|
|
264
|
+
"default": function _default() {
|
|
265
|
+
return [props.label || props.value || ''];
|
|
266
|
+
}
|
|
267
|
+
});
|
|
295
268
|
}), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
|
|
296
269
|
}
|
|
297
270
|
}, getSlot(this.$slots, ['default'])));
|
|
@@ -373,16 +346,16 @@
|
|
|
373
346
|
}
|
|
374
347
|
}
|
|
375
348
|
|
|
376
|
-
var css_248z$2 = "._fc-frame .
|
|
349
|
+
var css_248z$2 = "._fc-frame ._fc-files img{display:inline-block;height:100%;vertical-align:top;width:100%}._fc-frame ._fc-upload-btn{border:1px dashed #c0ccda}._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}";
|
|
377
350
|
styleInject(css_248z$2);
|
|
378
351
|
|
|
379
352
|
function _isSlot$1(s) {
|
|
380
353
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
381
354
|
}
|
|
382
355
|
|
|
383
|
-
var NAME$
|
|
356
|
+
var NAME$8 = 'fcFrame';
|
|
384
357
|
var Frame = vue.defineComponent({
|
|
385
|
-
name: NAME$
|
|
358
|
+
name: NAME$8,
|
|
386
359
|
props: {
|
|
387
360
|
type: {
|
|
388
361
|
type: String,
|
|
@@ -403,7 +376,7 @@
|
|
|
403
376
|
},
|
|
404
377
|
icon: {
|
|
405
378
|
type: String,
|
|
406
|
-
"default": '
|
|
379
|
+
"default": 'upload'
|
|
407
380
|
},
|
|
408
381
|
width: {
|
|
409
382
|
type: String,
|
|
@@ -426,7 +399,10 @@
|
|
|
426
399
|
"default": '关闭'
|
|
427
400
|
},
|
|
428
401
|
modalTitle: String,
|
|
429
|
-
handleIcon:
|
|
402
|
+
handleIcon: {
|
|
403
|
+
type: [String, Boolean],
|
|
404
|
+
"default": undefined
|
|
405
|
+
},
|
|
430
406
|
title: String,
|
|
431
407
|
allowRemove: {
|
|
432
408
|
type: Boolean,
|
|
@@ -481,9 +457,9 @@
|
|
|
481
457
|
okBtn: {
|
|
482
458
|
type: Boolean,
|
|
483
459
|
"default": true
|
|
484
|
-
}
|
|
460
|
+
},
|
|
461
|
+
formCreateInject: Object
|
|
485
462
|
},
|
|
486
|
-
inject: ['formCreateInject'],
|
|
487
463
|
emits: ['update:modelValue', 'change'],
|
|
488
464
|
data: function data() {
|
|
489
465
|
return {
|
|
@@ -500,9 +476,6 @@
|
|
|
500
476
|
}
|
|
501
477
|
},
|
|
502
478
|
methods: {
|
|
503
|
-
key: function key(unique) {
|
|
504
|
-
return unique;
|
|
505
|
-
},
|
|
506
479
|
close: function close() {
|
|
507
480
|
this.closeModel(true);
|
|
508
481
|
},
|
|
@@ -542,7 +515,7 @@
|
|
|
542
515
|
}).toString(),
|
|
543
516
|
readonly: true
|
|
544
517
|
}, {
|
|
545
|
-
"key":
|
|
518
|
+
"key": 1
|
|
546
519
|
}), {
|
|
547
520
|
append: function append() {
|
|
548
521
|
return vue.createVNode(vue.resolveComponent("ElButton"), {
|
|
@@ -553,14 +526,18 @@
|
|
|
553
526
|
}, null);
|
|
554
527
|
},
|
|
555
528
|
suffix: function suffix() {
|
|
556
|
-
return _this.fileList.length ? vue.createVNode("
|
|
557
|
-
"class": "el-input__icon
|
|
529
|
+
return _this.fileList.length ? vue.createVNode(vue.resolveComponent("ElIcon"), {
|
|
530
|
+
"class": "el-input__icon",
|
|
558
531
|
"onClick": function onClick() {
|
|
559
532
|
_this.fileList = [];
|
|
560
533
|
|
|
561
534
|
_this.input();
|
|
562
535
|
}
|
|
563
|
-
},
|
|
536
|
+
}, {
|
|
537
|
+
"default": function _default() {
|
|
538
|
+
return [vue.createVNode(vue.resolveComponent("CircleClose"), null, null)];
|
|
539
|
+
}
|
|
540
|
+
}) : null;
|
|
564
541
|
}
|
|
565
542
|
});
|
|
566
543
|
},
|
|
@@ -570,13 +547,13 @@
|
|
|
570
547
|
}
|
|
571
548
|
|
|
572
549
|
return vue.createVNode("div", {
|
|
573
|
-
"key":
|
|
550
|
+
"key": 2
|
|
574
551
|
}, [children]);
|
|
575
552
|
},
|
|
576
553
|
makeItem: function makeItem(index, children) {
|
|
577
554
|
return vue.createVNode("div", {
|
|
578
|
-
"class": "
|
|
579
|
-
"key":
|
|
555
|
+
"class": "_fc-files",
|
|
556
|
+
"key": '3' + index
|
|
580
557
|
}, [children]);
|
|
581
558
|
},
|
|
582
559
|
valid: function valid(f) {
|
|
@@ -599,43 +576,53 @@
|
|
|
599
576
|
}
|
|
600
577
|
|
|
601
578
|
return vue.createVNode("div", {
|
|
602
|
-
"class": "
|
|
603
|
-
"key":
|
|
579
|
+
"class": "_fc-upload-cover",
|
|
580
|
+
"key": 4
|
|
604
581
|
}, [icons]);
|
|
605
582
|
}
|
|
606
583
|
},
|
|
607
584
|
makeHandleIcon: function makeHandleIcon(val, index) {
|
|
608
585
|
var _this2 = this;
|
|
609
586
|
|
|
610
|
-
|
|
611
|
-
|
|
587
|
+
var Type = vue.resolveComponent(this.handleIcon === true || this.handleIcon === undefined ? 'view' : this.handleIcon);
|
|
588
|
+
return vue.createVNode(vue.resolveComponent("ElIcon"), {
|
|
612
589
|
"onClick": function onClick() {
|
|
613
590
|
return _this2.handleClick(val);
|
|
614
591
|
},
|
|
615
|
-
"key":
|
|
616
|
-
},
|
|
592
|
+
"key": '5' + index
|
|
593
|
+
}, {
|
|
594
|
+
"default": function _default() {
|
|
595
|
+
return [vue.createVNode(Type, null, null)];
|
|
596
|
+
}
|
|
597
|
+
});
|
|
617
598
|
},
|
|
618
599
|
makeRemoveIcon: function makeRemoveIcon(val, index) {
|
|
619
600
|
var _this3 = this;
|
|
620
601
|
|
|
621
|
-
return vue.createVNode("
|
|
622
|
-
"class": "el-icon-delete",
|
|
602
|
+
return vue.createVNode(vue.resolveComponent("ElIcon"), {
|
|
623
603
|
"onClick": function onClick() {
|
|
624
604
|
return _this3.handleRemove(val);
|
|
625
605
|
},
|
|
626
|
-
"key":
|
|
627
|
-
},
|
|
606
|
+
"key": '6' + index
|
|
607
|
+
}, {
|
|
608
|
+
"default": function _default() {
|
|
609
|
+
return [vue.createVNode(vue.resolveComponent("delete"), null, null)];
|
|
610
|
+
}
|
|
611
|
+
});
|
|
628
612
|
},
|
|
629
613
|
makeFiles: function makeFiles() {
|
|
630
614
|
var _this4 = this;
|
|
631
615
|
|
|
632
616
|
return this.makeGroup(this.fileList.map(function (src, index) {
|
|
633
|
-
return _this4.makeItem(index, [vue.createVNode("
|
|
634
|
-
"class": "el-icon-tickets",
|
|
617
|
+
return _this4.makeItem(index, [vue.createVNode(vue.resolveComponent("ElIcon"), {
|
|
635
618
|
"onClick": function onClick() {
|
|
636
619
|
return _this4.handleClick(src);
|
|
637
620
|
}
|
|
638
|
-
},
|
|
621
|
+
}, {
|
|
622
|
+
"default": function _default() {
|
|
623
|
+
return [vue.createVNode(vue.resolveComponent("document"), null, null)];
|
|
624
|
+
}
|
|
625
|
+
}), _this4.makeIcons(src, index)]);
|
|
639
626
|
}));
|
|
640
627
|
},
|
|
641
628
|
makeImages: function makeImages() {
|
|
@@ -650,15 +637,18 @@
|
|
|
650
637
|
makeBtn: function makeBtn() {
|
|
651
638
|
var _this6 = this;
|
|
652
639
|
|
|
640
|
+
var Type = vue.resolveComponent(this.icon);
|
|
653
641
|
return vue.createVNode("div", {
|
|
654
|
-
"class": "
|
|
642
|
+
"class": "_fc-upload-btn",
|
|
655
643
|
"onClick": function onClick() {
|
|
656
644
|
return _this6.showModel();
|
|
657
645
|
},
|
|
658
|
-
"key":
|
|
659
|
-
}, [vue.createVNode("
|
|
660
|
-
"
|
|
661
|
-
|
|
646
|
+
"key": 7
|
|
647
|
+
}, [vue.createVNode(vue.resolveComponent("ElIcon"), null, {
|
|
648
|
+
"default": function _default() {
|
|
649
|
+
return [vue.createVNode(Type, null, null)];
|
|
650
|
+
}
|
|
651
|
+
})]);
|
|
662
652
|
},
|
|
663
653
|
handleClick: function handleClick(src) {
|
|
664
654
|
if (this.onHandle) {
|
|
@@ -809,7 +799,7 @@
|
|
|
809
799
|
"src": src,
|
|
810
800
|
"frameBorder": "0",
|
|
811
801
|
"style": {
|
|
812
|
-
|
|
802
|
+
height: height,
|
|
813
803
|
'border': '0 none',
|
|
814
804
|
'width': '100%'
|
|
815
805
|
}
|
|
@@ -838,11 +828,12 @@
|
|
|
838
828
|
}
|
|
839
829
|
});
|
|
840
830
|
|
|
841
|
-
var NAME$
|
|
831
|
+
var NAME$7 = 'fcRadio';
|
|
842
832
|
var Radio = vue.defineComponent({
|
|
843
|
-
name: NAME$
|
|
833
|
+
name: NAME$7,
|
|
844
834
|
inheritAttrs: false,
|
|
845
835
|
props: {
|
|
836
|
+
formCreateInject: Object,
|
|
846
837
|
modelValue: {
|
|
847
838
|
type: [String, Number, Boolean],
|
|
848
839
|
"default": ''
|
|
@@ -851,49 +842,21 @@
|
|
|
851
842
|
},
|
|
852
843
|
emits: ['update:modelValue'],
|
|
853
844
|
setup: function setup(props, _) {
|
|
854
|
-
var
|
|
855
|
-
options = _toRefs.options;
|
|
856
|
-
|
|
857
|
-
var trueValue = vue.ref([]);
|
|
845
|
+
var options = vue.toRef(props.formCreateInject, 'options', []);
|
|
858
846
|
var value = vue.toRef(props, 'modelValue');
|
|
859
847
|
|
|
860
848
|
var _options = function _options() {
|
|
861
849
|
return Array.isArray(options.value) ? options.value : [];
|
|
862
850
|
};
|
|
863
851
|
|
|
864
|
-
var update = function update() {
|
|
865
|
-
trueValue.value = _options().filter(function (opt) {
|
|
866
|
-
return opt.value === value.value;
|
|
867
|
-
}).reduce(function (initial, opt) {
|
|
868
|
-
return opt.label;
|
|
869
|
-
}, '');
|
|
870
|
-
};
|
|
871
|
-
|
|
872
|
-
vue.watch(options, function () {
|
|
873
|
-
update();
|
|
874
|
-
}, {
|
|
875
|
-
deep: true,
|
|
876
|
-
immediate: true
|
|
877
|
-
});
|
|
878
852
|
return {
|
|
879
853
|
options: _options,
|
|
880
|
-
trueValue: trueValue,
|
|
881
854
|
value: value,
|
|
882
855
|
onInput: function onInput(n) {
|
|
883
|
-
_.emit('update:modelValue',
|
|
884
|
-
|
|
885
|
-
}).reduce(function (initial, opt) {
|
|
886
|
-
return opt.value;
|
|
887
|
-
}, ''));
|
|
888
|
-
},
|
|
889
|
-
update: update
|
|
856
|
+
_.emit('update:modelValue', n);
|
|
857
|
+
}
|
|
890
858
|
};
|
|
891
859
|
},
|
|
892
|
-
watch: {
|
|
893
|
-
modelValue: function modelValue() {
|
|
894
|
-
this.update();
|
|
895
|
-
}
|
|
896
|
-
},
|
|
897
860
|
render: function render() {
|
|
898
861
|
var _this$$slots$default,
|
|
899
862
|
_this$$slots,
|
|
@@ -902,28 +865,35 @@
|
|
|
902
865
|
var name = this.type === 'button' ? 'ElRadioButton' : 'ElRadio';
|
|
903
866
|
var Type = vue.resolveComponent(name);
|
|
904
867
|
return vue.createVNode(vue.resolveComponent("ElRadioGroup"), vue.mergeProps(this.$attrs, {
|
|
905
|
-
"modelValue": this.
|
|
868
|
+
"modelValue": this.value,
|
|
906
869
|
"onUpdate:modelValue": this.onInput
|
|
907
870
|
}), _objectSpread2({
|
|
908
871
|
"default": function _default() {
|
|
909
872
|
return [_this.options().map(function (opt, index) {
|
|
910
873
|
var props = _objectSpread2({}, opt);
|
|
911
874
|
|
|
875
|
+
var value = props.value;
|
|
912
876
|
delete props.value;
|
|
913
877
|
return vue.createVNode(Type, vue.mergeProps(props, {
|
|
878
|
+
"label": value,
|
|
914
879
|
"key": name + index + opt.value
|
|
915
|
-
}),
|
|
880
|
+
}), {
|
|
881
|
+
"default": function _default() {
|
|
882
|
+
return [props.label || props.value || ''];
|
|
883
|
+
}
|
|
884
|
+
});
|
|
916
885
|
}), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
|
|
917
886
|
}
|
|
918
887
|
}, getSlot(this.$slots, ['default'])));
|
|
919
888
|
}
|
|
920
889
|
});
|
|
921
890
|
|
|
922
|
-
var NAME$
|
|
891
|
+
var NAME$6 = 'fcSelect';
|
|
923
892
|
var Select = vue.defineComponent({
|
|
924
|
-
name: NAME$
|
|
893
|
+
name: NAME$6,
|
|
925
894
|
inheritAttrs: false,
|
|
926
895
|
props: {
|
|
896
|
+
formCreateInject: Object,
|
|
927
897
|
modelValue: {
|
|
928
898
|
type: [Array, String, Number, Boolean, Object],
|
|
929
899
|
"default": undefined
|
|
@@ -932,9 +902,7 @@
|
|
|
932
902
|
},
|
|
933
903
|
emits: ['update:modelValue'],
|
|
934
904
|
setup: function setup(props) {
|
|
935
|
-
var
|
|
936
|
-
options = _toRefs.options;
|
|
937
|
-
|
|
905
|
+
var options = vue.toRef(props.formCreateInject, 'options', []);
|
|
938
906
|
var value = vue.toRef(props, 'modelValue');
|
|
939
907
|
|
|
940
908
|
var _options = function _options() {
|
|
@@ -968,9 +936,9 @@
|
|
|
968
936
|
}
|
|
969
937
|
});
|
|
970
938
|
|
|
971
|
-
var NAME$
|
|
939
|
+
var NAME$5 = 'fcTree';
|
|
972
940
|
var Tree = vue.defineComponent({
|
|
973
|
-
name: NAME$
|
|
941
|
+
name: NAME$5,
|
|
974
942
|
inheritAttrs: false,
|
|
975
943
|
formCreateParser: {
|
|
976
944
|
mergeProp: function mergeProp(ctx) {
|
|
@@ -1032,7 +1000,7 @@
|
|
|
1032
1000
|
}
|
|
1033
1001
|
});
|
|
1034
1002
|
|
|
1035
|
-
var css_248z$1 = "._fc-
|
|
1003
|
+
var css_248z$1 = "._fc-exceed .el-upload{display:none}";
|
|
1036
1004
|
styleInject(css_248z$1);
|
|
1037
1005
|
|
|
1038
1006
|
function parseFile(file, i) {
|
|
@@ -1047,37 +1015,21 @@
|
|
|
1047
1015
|
return ('' + file).split('/').pop();
|
|
1048
1016
|
}
|
|
1049
1017
|
|
|
1050
|
-
var NAME$
|
|
1018
|
+
var NAME$4 = 'fcUpload';
|
|
1051
1019
|
var Upload = vue.defineComponent({
|
|
1052
|
-
name: NAME$
|
|
1020
|
+
name: NAME$4,
|
|
1053
1021
|
inheritAttrs: false,
|
|
1054
1022
|
props: {
|
|
1055
|
-
onHandle: Function,
|
|
1056
|
-
uploadType: {
|
|
1057
|
-
type: String,
|
|
1058
|
-
"default": 'file'
|
|
1059
|
-
},
|
|
1060
|
-
limit: {
|
|
1061
|
-
type: Number,
|
|
1062
|
-
"default": 0
|
|
1063
|
-
},
|
|
1064
|
-
allowRemove: {
|
|
1065
|
-
type: Boolean,
|
|
1066
|
-
"default": true
|
|
1067
|
-
},
|
|
1068
1023
|
previewMask: undefined,
|
|
1069
1024
|
modalTitle: String,
|
|
1070
|
-
handleIcon: [String, Boolean],
|
|
1071
1025
|
modelValue: [Array, String]
|
|
1072
1026
|
},
|
|
1073
|
-
emits: ['update:modelValue'],
|
|
1027
|
+
emits: ['update:modelValue', 'change', 'remove'],
|
|
1074
1028
|
data: function data() {
|
|
1075
1029
|
return {
|
|
1076
|
-
uploadList: [],
|
|
1077
1030
|
previewVisible: false,
|
|
1078
1031
|
previewImage: '',
|
|
1079
|
-
fileList: []
|
|
1080
|
-
cacheFiles: []
|
|
1032
|
+
fileList: []
|
|
1081
1033
|
};
|
|
1082
1034
|
},
|
|
1083
1035
|
created: function created() {
|
|
@@ -1085,13 +1037,6 @@
|
|
|
1085
1037
|
},
|
|
1086
1038
|
watch: {
|
|
1087
1039
|
modelValue: function modelValue(n) {
|
|
1088
|
-
if (this.$refs.upload.uploadFiles.every(function (file) {
|
|
1089
|
-
return !file.status || file.status === 'success';
|
|
1090
|
-
})) {
|
|
1091
|
-
this.$refs.upload.uploadFiles = toArray(n).map(parseFile);
|
|
1092
|
-
this.uploadList = this.$refs.upload.uploadFiles;
|
|
1093
|
-
}
|
|
1094
|
-
|
|
1095
1040
|
this.fileList = toArray(n).map(parseFile);
|
|
1096
1041
|
},
|
|
1097
1042
|
limit: function limit(n, o) {
|
|
@@ -1101,141 +1046,62 @@
|
|
|
1101
1046
|
}
|
|
1102
1047
|
},
|
|
1103
1048
|
methods: {
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
isDisabled: function isDisabled() {
|
|
1108
|
-
return this.$attrs.disabled === true;
|
|
1109
|
-
},
|
|
1110
|
-
onRemove: function onRemove(file) {
|
|
1111
|
-
if (this.isDisabled()) {
|
|
1112
|
-
return;
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
|
-
this.$refs.upload.handleRemove(file);
|
|
1116
|
-
},
|
|
1117
|
-
handleClick: function handleClick(file) {
|
|
1118
|
-
if (this.onHandle) {
|
|
1119
|
-
return this.onHandle(file);
|
|
1049
|
+
handlePreview: function handlePreview(file) {
|
|
1050
|
+
if (this.onPreview) {
|
|
1051
|
+
this.onPreview.apply(this, arguments);
|
|
1120
1052
|
} else {
|
|
1121
1053
|
this.previewImage = file.url;
|
|
1122
1054
|
this.previewVisible = true;
|
|
1123
1055
|
}
|
|
1124
1056
|
},
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
"src": file.url,
|
|
1128
|
-
"key": this.key('img' + index)
|
|
1129
|
-
}, null) : vue.createVNode("i", {
|
|
1130
|
-
"class": "el-icon-document",
|
|
1131
|
-
"key": this.key('i' + index)
|
|
1132
|
-
}, null);
|
|
1133
|
-
},
|
|
1134
|
-
makeRemoveIcon: function makeRemoveIcon(file, index) {
|
|
1135
|
-
var _this = this;
|
|
1136
|
-
|
|
1137
|
-
return vue.createVNode("i", {
|
|
1138
|
-
"class": "el-icon-delete",
|
|
1139
|
-
"onClick": function onClick() {
|
|
1140
|
-
return _this.onRemove(file);
|
|
1141
|
-
},
|
|
1142
|
-
"key": this.key('ri' + index)
|
|
1143
|
-
}, null);
|
|
1144
|
-
},
|
|
1145
|
-
makeHandleIcon: function makeHandleIcon(file, index) {
|
|
1146
|
-
var _this2 = this;
|
|
1147
|
-
|
|
1148
|
-
return vue.createVNode("i", {
|
|
1149
|
-
"class": this.handleIcon === true || this.handleIcon === undefined ? 'el-icon-view' : this.handleIcon,
|
|
1150
|
-
"onClick": function onClick() {
|
|
1151
|
-
return _this2.handleClick(file);
|
|
1152
|
-
},
|
|
1153
|
-
"key": this.key('hi' + index)
|
|
1154
|
-
}, null);
|
|
1155
|
-
},
|
|
1156
|
-
makeProgress: function makeProgress(file, index) {
|
|
1157
|
-
return vue.createVNode(vue.resolveComponent("ElProgress"), vue.mergeProps({
|
|
1158
|
-
percentage: file.percentage,
|
|
1159
|
-
type: 'circle',
|
|
1160
|
-
width: 52
|
|
1161
|
-
}, {
|
|
1162
|
-
"style": "margin-top:2px;",
|
|
1163
|
-
"key": this.key('pg' + index)
|
|
1164
|
-
}), null);
|
|
1165
|
-
},
|
|
1166
|
-
makeIcons: function makeIcons(file, index) {
|
|
1167
|
-
var icons = [];
|
|
1168
|
-
|
|
1169
|
-
if (this.allowRemove || this.handleIcon !== false) {
|
|
1170
|
-
if (this.uploadType !== 'file' && this.handleIcon !== false || this.uploadType === 'file' && this.handleIcon) {
|
|
1171
|
-
icons.push(this.makeHandleIcon(file, index));
|
|
1172
|
-
}
|
|
1173
|
-
|
|
1174
|
-
if (this.allowRemove) {
|
|
1175
|
-
icons.push(this.makeRemoveIcon(file, index));
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
return vue.createVNode("div", {
|
|
1179
|
-
"class": "fc-upload-cover"
|
|
1180
|
-
}, [icons]);
|
|
1181
|
-
}
|
|
1182
|
-
},
|
|
1183
|
-
makeFiles: function makeFiles() {
|
|
1184
|
-
var _this3 = this;
|
|
1185
|
-
|
|
1186
|
-
return this.uploadList.map(function (file, index) {
|
|
1187
|
-
return vue.createVNode("div", {
|
|
1188
|
-
"key": _this3.key(index),
|
|
1189
|
-
"class": "fc-files"
|
|
1190
|
-
}, [file.percentage !== undefined && file.status !== 'success' ? _this3.makeProgress(file, index) : [_this3.makeItem(file, index), _this3.makeIcons(file, index)]]);
|
|
1191
|
-
});
|
|
1192
|
-
},
|
|
1193
|
-
makeUpload: function makeUpload() {
|
|
1194
|
-
var _this$$slots$default,
|
|
1195
|
-
_this$$slots,
|
|
1196
|
-
_this4 = this;
|
|
1197
|
-
|
|
1198
|
-
var isShow = !this.limit || this.limit > this.uploadList.length;
|
|
1199
|
-
return vue.createVNode(vue.resolveComponent("ElUpload"), vue.mergeProps(this.$attrs, {
|
|
1200
|
-
"showFileList": false,
|
|
1201
|
-
"fileList": this.fileList,
|
|
1202
|
-
"ref": "upload",
|
|
1203
|
-
"style": {
|
|
1204
|
-
display: 'inline-block'
|
|
1205
|
-
},
|
|
1206
|
-
"key": this.key('upload')
|
|
1207
|
-
}), _objectSpread2({
|
|
1208
|
-
"default": function _default() {
|
|
1209
|
-
return [isShow ? ((_this$$slots$default = (_this$$slots = _this4.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)) || vue.createVNode("div", {
|
|
1210
|
-
"class": "fc-upload-btn"
|
|
1211
|
-
}, [vue.createVNode("i", {
|
|
1212
|
-
"class": "el-icon-upload2"
|
|
1213
|
-
}, null)]) : undefined];
|
|
1214
|
-
}
|
|
1215
|
-
}, getSlot(this.$slots, ['default'])));
|
|
1216
|
-
},
|
|
1217
|
-
update: function update() {
|
|
1218
|
-
var files = this.$refs.upload.uploadFiles.map(function (file) {
|
|
1057
|
+
update: function update(fileList) {
|
|
1058
|
+
var files = fileList.map(function (file) {
|
|
1219
1059
|
return file.url;
|
|
1220
1060
|
}).filter(function (url) {
|
|
1221
1061
|
return url !== undefined;
|
|
1222
1062
|
});
|
|
1223
|
-
|
|
1224
|
-
if (this.cacheFiles.length !== files.length) {
|
|
1225
|
-
this.cacheFiles = _toConsumableArray(files);
|
|
1226
|
-
this.$emit('update:modelValue', this.limit === 1 ? files[0] || '' : files);
|
|
1227
|
-
}
|
|
1063
|
+
this.$emit('update:modelValue', this.limit === 1 ? files[0] || '' : files);
|
|
1228
1064
|
},
|
|
1229
1065
|
handleCancel: function handleCancel() {
|
|
1230
1066
|
this.previewVisible = false;
|
|
1067
|
+
},
|
|
1068
|
+
handleChange: function handleChange(file, fileList) {
|
|
1069
|
+
this.$emit.apply(this, ['change'].concat(Array.prototype.slice.call(arguments)));
|
|
1070
|
+
|
|
1071
|
+
if (file.status === 'success') {
|
|
1072
|
+
this.update(fileList);
|
|
1073
|
+
}
|
|
1074
|
+
},
|
|
1075
|
+
handleRemove: function handleRemove(file, fileList) {
|
|
1076
|
+
this.$emit.apply(this, ['remove'].concat(Array.prototype.slice.call(arguments)));
|
|
1077
|
+
this.update(fileList);
|
|
1231
1078
|
}
|
|
1232
1079
|
},
|
|
1233
1080
|
render: function render() {
|
|
1234
|
-
var
|
|
1081
|
+
var _this$$slots$default,
|
|
1082
|
+
_this$$slots,
|
|
1083
|
+
_this = this;
|
|
1235
1084
|
|
|
1236
|
-
return vue.createVNode("
|
|
1237
|
-
"
|
|
1238
|
-
|
|
1085
|
+
return vue.createVNode(vue.Fragment, null, [vue.createVNode(vue.resolveComponent("ElUpload"), vue.mergeProps({
|
|
1086
|
+
"key": this.modelValue.length,
|
|
1087
|
+
"list-type": "picture-card"
|
|
1088
|
+
}, this.$attrs, {
|
|
1089
|
+
"class": {
|
|
1090
|
+
'_fc-exceed': this.$attrs.limit ? this.$attrs.limit <= this.modelValue.length : false
|
|
1091
|
+
},
|
|
1092
|
+
"onPreview": this.handlePreview,
|
|
1093
|
+
"onChange": this.handleChange,
|
|
1094
|
+
"onRemove": this.handleRemove,
|
|
1095
|
+
"fileList": this.fileList
|
|
1096
|
+
}), _objectSpread2({
|
|
1097
|
+
"default": function _default() {
|
|
1098
|
+
return [((_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)) || vue.createVNode(vue.resolveComponent("ElIcon"), null, {
|
|
1099
|
+
"default": function _default() {
|
|
1100
|
+
return [vue.createVNode(vue.resolveComponent("upload"), null, null)];
|
|
1101
|
+
}
|
|
1102
|
+
})];
|
|
1103
|
+
}
|
|
1104
|
+
}, getSlot(this.$slots, ['default']))), vue.createVNode(vue.resolveComponent("ElDialog"), {
|
|
1239
1105
|
"appendToBody": true,
|
|
1240
1106
|
"modal": this.previewMask,
|
|
1241
1107
|
"title": this.modalTitle,
|
|
@@ -1244,24 +1110,11 @@
|
|
|
1244
1110
|
}, {
|
|
1245
1111
|
"default": function _default() {
|
|
1246
1112
|
return [vue.createVNode("img", {
|
|
1247
|
-
"alt": "example",
|
|
1248
1113
|
"style": "width: 100%",
|
|
1249
|
-
"src":
|
|
1114
|
+
"src": _this.previewImage
|
|
1250
1115
|
}, null)];
|
|
1251
1116
|
}
|
|
1252
1117
|
})]);
|
|
1253
|
-
},
|
|
1254
|
-
mounted: function mounted() {
|
|
1255
|
-
var _this6 = this;
|
|
1256
|
-
|
|
1257
|
-
this.uploadList = this.$refs.upload.uploadFiles;
|
|
1258
|
-
this.$watch(function () {
|
|
1259
|
-
return _this6.$refs.upload.uploadFiles;
|
|
1260
|
-
}, function () {
|
|
1261
|
-
_this6.update();
|
|
1262
|
-
}, {
|
|
1263
|
-
deep: true
|
|
1264
|
-
});
|
|
1265
1118
|
}
|
|
1266
1119
|
});
|
|
1267
1120
|
|
|
@@ -1292,9 +1145,9 @@
|
|
|
1292
1145
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
1293
1146
|
}
|
|
1294
1147
|
|
|
1295
|
-
var NAME$
|
|
1148
|
+
var NAME$3 = 'fcGroup';
|
|
1296
1149
|
var Group = vue.defineComponent({
|
|
1297
|
-
name: NAME$
|
|
1150
|
+
name: NAME$3,
|
|
1298
1151
|
props: {
|
|
1299
1152
|
field: String,
|
|
1300
1153
|
rule: Array,
|
|
@@ -1337,9 +1190,9 @@
|
|
|
1337
1190
|
onBeforeAdd: {
|
|
1338
1191
|
type: Function,
|
|
1339
1192
|
"default": function _default() {}
|
|
1340
|
-
}
|
|
1193
|
+
},
|
|
1194
|
+
formCreateInject: Object
|
|
1341
1195
|
},
|
|
1342
|
-
inject: ['formCreateInject'],
|
|
1343
1196
|
data: function data() {
|
|
1344
1197
|
return {
|
|
1345
1198
|
len: 0,
|
|
@@ -1517,24 +1370,31 @@
|
|
|
1517
1370
|
this.input(this.modelValue);
|
|
1518
1371
|
},
|
|
1519
1372
|
addIcon: function addIcon(key) {
|
|
1520
|
-
return vue.createVNode("
|
|
1373
|
+
return vue.createVNode(vue.resolveComponent("el-icon"), {
|
|
1521
1374
|
"key": "a".concat(key),
|
|
1522
|
-
"class": "el-icon-circle-plus-outline",
|
|
1523
1375
|
"style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer', ";"),
|
|
1524
1376
|
"onClick": this.add
|
|
1525
|
-
},
|
|
1377
|
+
}, {
|
|
1378
|
+
"default": function _default() {
|
|
1379
|
+
return [vue.createVNode(vue.resolveComponent("circle-plus"), null, null)];
|
|
1380
|
+
}
|
|
1381
|
+
});
|
|
1526
1382
|
},
|
|
1527
1383
|
delIcon: function delIcon(index, key) {
|
|
1528
1384
|
var _this7 = this;
|
|
1529
1385
|
|
|
1530
|
-
return vue.createVNode("
|
|
1386
|
+
return vue.createVNode(vue.resolveComponent("ElIcon"), {
|
|
1531
1387
|
"key": "d".concat(key),
|
|
1532
1388
|
"class": "el-icon-remove-outline",
|
|
1533
1389
|
"style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer;color:#606266', ";"),
|
|
1534
1390
|
"onClick": function onClick() {
|
|
1535
1391
|
return _this7.del(index, key);
|
|
1536
1392
|
}
|
|
1537
|
-
},
|
|
1393
|
+
}, {
|
|
1394
|
+
"default": function _default() {
|
|
1395
|
+
return [vue.createVNode(vue.resolveComponent("remove"), null, null)];
|
|
1396
|
+
}
|
|
1397
|
+
});
|
|
1538
1398
|
},
|
|
1539
1399
|
makeIcon: function makeIcon(total, index, key) {
|
|
1540
1400
|
var _this8 = this;
|
|
@@ -1590,12 +1450,12 @@
|
|
|
1590
1450
|
vm: this,
|
|
1591
1451
|
add: this.add
|
|
1592
1452
|
}) : vue.createVNode("i", {
|
|
1593
|
-
"key":
|
|
1453
|
+
"key": 1,
|
|
1594
1454
|
"class": "el-icon-circle-plus-outline",
|
|
1595
1455
|
"style": "font-size:".concat(this.fontSize, "px;vertical-align:middle;color:").concat(this.disabled ? '#c9cdd4;cursor: not-allowed' : '#606266;cursor:pointer', ";"),
|
|
1596
1456
|
"onClick": this.add
|
|
1597
1457
|
}, null) : vue.createVNode("div", {
|
|
1598
|
-
"key":
|
|
1458
|
+
"key": 2
|
|
1599
1459
|
}, [keys.map(function (key, index) {
|
|
1600
1460
|
var _slot;
|
|
1601
1461
|
|
|
@@ -1653,9 +1513,9 @@
|
|
|
1653
1513
|
}
|
|
1654
1514
|
});
|
|
1655
1515
|
|
|
1656
|
-
var NAME$
|
|
1516
|
+
var NAME$2 = 'fcSubForm';
|
|
1657
1517
|
var Sub = vue.defineComponent({
|
|
1658
|
-
name: NAME$
|
|
1518
|
+
name: NAME$2,
|
|
1659
1519
|
props: {
|
|
1660
1520
|
rule: Array,
|
|
1661
1521
|
options: {
|
|
@@ -1680,9 +1540,9 @@
|
|
|
1680
1540
|
syncDisabled: {
|
|
1681
1541
|
type: Boolean,
|
|
1682
1542
|
"default": true
|
|
1683
|
-
}
|
|
1543
|
+
},
|
|
1544
|
+
formCreateInject: Object
|
|
1684
1545
|
},
|
|
1685
|
-
inject: ['formCreateInject'],
|
|
1686
1546
|
data: function data() {
|
|
1687
1547
|
return {
|
|
1688
1548
|
cacheValue: {},
|
|
@@ -1743,10 +1603,10 @@
|
|
|
1743
1603
|
|
|
1744
1604
|
var components = [Checkbox, Frame, Radio, Select, Tree, Upload, Group, Sub];
|
|
1745
1605
|
|
|
1746
|
-
var NAME$
|
|
1606
|
+
var NAME$1 = 'FormCreate';
|
|
1747
1607
|
function $FormCreate(FormCreate) {
|
|
1748
1608
|
return vue.defineComponent({
|
|
1749
|
-
name: NAME$
|
|
1609
|
+
name: NAME$1,
|
|
1750
1610
|
props: {
|
|
1751
1611
|
rule: {
|
|
1752
1612
|
type: Array,
|
|
@@ -1763,7 +1623,8 @@
|
|
|
1763
1623
|
},
|
|
1764
1624
|
extendOption: Boolean,
|
|
1765
1625
|
modelValue: Object,
|
|
1766
|
-
api: Object
|
|
1626
|
+
api: Object,
|
|
1627
|
+
name: String
|
|
1767
1628
|
},
|
|
1768
1629
|
emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync', 'reload', 'repeat-field', 'update'],
|
|
1769
1630
|
render: function render() {
|
|
@@ -1779,6 +1640,7 @@
|
|
|
1779
1640
|
modelValue = _toRefs.modelValue;
|
|
1780
1641
|
|
|
1781
1642
|
var data = vue.reactive({
|
|
1643
|
+
ctxInject: {},
|
|
1782
1644
|
destroyed: false,
|
|
1783
1645
|
isShow: true,
|
|
1784
1646
|
unique: 1,
|
|
@@ -2427,7 +2289,8 @@
|
|
|
2427
2289
|
|
|
2428
2290
|
if (ctx) {
|
|
2429
2291
|
if (child) {
|
|
2430
|
-
rules = ctx.rule.children;
|
|
2292
|
+
rules = ctx.getPending('children', ctx.rule.children);
|
|
2293
|
+
if (!Array.isArray(rules)) return;
|
|
2431
2294
|
index = ctx.rule.children.length - 1;
|
|
2432
2295
|
} else {
|
|
2433
2296
|
index = ctx.root.indexOf(ctx.origin);
|
|
@@ -2444,7 +2307,8 @@
|
|
|
2444
2307
|
|
|
2445
2308
|
if (ctx) {
|
|
2446
2309
|
if (child) {
|
|
2447
|
-
rules = ctx.rule.children;
|
|
2310
|
+
rules = ctx.getPending('children', ctx.rule.children);
|
|
2311
|
+
if (!Array.isArray(rules)) return;
|
|
2448
2312
|
} else {
|
|
2449
2313
|
index = ctx.root.indexOf(ctx.origin);
|
|
2450
2314
|
rules = ctx.root;
|
|
@@ -2748,9 +2612,9 @@
|
|
|
2748
2612
|
return val == null ? '' : _typeof(val) === 'object' ? JSON.stringify(val, null, 2) : String(val);
|
|
2749
2613
|
}
|
|
2750
2614
|
|
|
2751
|
-
var id$
|
|
2615
|
+
var id$2 = 0;
|
|
2752
2616
|
function uniqueId() {
|
|
2753
|
-
return Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now()).concat(++id$
|
|
2617
|
+
return Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now()).concat(++id$2)).toString(36);
|
|
2754
2618
|
}
|
|
2755
2619
|
|
|
2756
2620
|
function deepSet(data, idx, val) {
|
|
@@ -2813,7 +2677,7 @@
|
|
|
2813
2677
|
ctx.initProp();
|
|
2814
2678
|
this.mergeGlobal(ctx);
|
|
2815
2679
|
ctx.initNone();
|
|
2816
|
-
var slots = this.renderChildren(ctx);
|
|
2680
|
+
var slots = this.renderChildren(ctx.loadChildrenPending(), ctx);
|
|
2817
2681
|
var def = slots["default"];
|
|
2818
2682
|
def && slotBag.setSlot(ctx.rule.slot, function () {
|
|
2819
2683
|
return def();
|
|
@@ -2840,8 +2704,15 @@
|
|
|
2840
2704
|
ctx.prop = mergeRule({}, [this.cacheConfig[ctx.trueType].value, ctx.prop]);
|
|
2841
2705
|
},
|
|
2842
2706
|
setOptions: function setOptions(ctx) {
|
|
2843
|
-
|
|
2844
|
-
|
|
2707
|
+
var opt = ctx.loadPending({
|
|
2708
|
+
key: 'options',
|
|
2709
|
+
origin: ctx.prop.options,
|
|
2710
|
+
def: []
|
|
2711
|
+
});
|
|
2712
|
+
ctx.prop.options = opt;
|
|
2713
|
+
|
|
2714
|
+
if (ctx.prop.optionsTo && opt) {
|
|
2715
|
+
deepSet(ctx.prop, ctx.prop.optionsTo, opt);
|
|
2845
2716
|
}
|
|
2846
2717
|
},
|
|
2847
2718
|
deepSet: function deepSet$1(ctx) {
|
|
@@ -2870,34 +2741,37 @@
|
|
|
2870
2741
|
renderCtx: function renderCtx(ctx, parent) {
|
|
2871
2742
|
var _this4 = this;
|
|
2872
2743
|
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2744
|
+
try {
|
|
2745
|
+
if (ctx.type === 'hidden') return;
|
|
2746
|
+
var rule = ctx.rule;
|
|
2747
|
+
var preview = this.options.preview || false;
|
|
2748
|
+
|
|
2749
|
+
if (!this.cache[ctx.id] || this.cache[ctx.id].slot !== rule.slot) {
|
|
2750
|
+
var vn;
|
|
2751
|
+
ctx.initProp();
|
|
2752
|
+
this.mergeGlobal(ctx);
|
|
2753
|
+
ctx.initNone();
|
|
2754
|
+
this.$manager.tidyRule(ctx);
|
|
2755
|
+
this.deepSet(ctx);
|
|
2756
|
+
this.setOptions(ctx);
|
|
2757
|
+
this.ctxProp(ctx);
|
|
2758
|
+
var prop = ctx.prop;
|
|
2759
|
+
prop.props.formCreateInject = this.injectProp(ctx);
|
|
2760
|
+
|
|
2761
|
+
if (prop.hidden) {
|
|
2762
|
+
this.setCache(ctx, undefined, parent);
|
|
2763
|
+
return;
|
|
2764
|
+
}
|
|
2892
2765
|
|
|
2893
|
-
|
|
2894
|
-
return _this4.item(ctx, function () {
|
|
2766
|
+
vn = function vn() {
|
|
2895
2767
|
var children = {};
|
|
2896
2768
|
|
|
2769
|
+
var _load = ctx.loadChildrenPending();
|
|
2770
|
+
|
|
2897
2771
|
if (ctx.parser.renderChildren) {
|
|
2898
|
-
children = ctx.parser.renderChildren(ctx);
|
|
2772
|
+
children = ctx.parser.renderChildren(_load, ctx);
|
|
2899
2773
|
} else if (ctx.parser.loadChildren !== false) {
|
|
2900
|
-
children = _this4.renderChildren(ctx);
|
|
2774
|
+
children = _this4.renderChildren(_load, ctx);
|
|
2901
2775
|
}
|
|
2902
2776
|
|
|
2903
2777
|
var slot = _this4.getTypeSlot(ctx.type);
|
|
@@ -2927,15 +2801,22 @@
|
|
|
2927
2801
|
_vn = _this4.display(_vn);
|
|
2928
2802
|
}
|
|
2929
2803
|
|
|
2804
|
+
_this4.setCache(ctx, function () {
|
|
2805
|
+
return _vn;
|
|
2806
|
+
}, parent);
|
|
2807
|
+
|
|
2930
2808
|
return _vn;
|
|
2931
|
-
}
|
|
2932
|
-
};
|
|
2809
|
+
};
|
|
2933
2810
|
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2811
|
+
this.setCache(ctx, vn, parent);
|
|
2812
|
+
return vn;
|
|
2813
|
+
}
|
|
2937
2814
|
|
|
2938
|
-
|
|
2815
|
+
return this.getCache(ctx);
|
|
2816
|
+
} catch (e) {
|
|
2817
|
+
console.error(e);
|
|
2818
|
+
return;
|
|
2819
|
+
}
|
|
2939
2820
|
},
|
|
2940
2821
|
getModelField: function getModelField(ctx) {
|
|
2941
2822
|
return ctx.rule.modelField || ctx.parser.modelField || this.fc.modelFields[this.vNode.aliasMap[ctx.field]] || this.fc.modelFields[ctx.field] || this.fc.modelFields[ctx.originType] || 'modelValue';
|
|
@@ -2969,30 +2850,36 @@
|
|
|
2969
2850
|
return vn;
|
|
2970
2851
|
}
|
|
2971
2852
|
},
|
|
2972
|
-
item: function item(ctx, vn) {
|
|
2973
|
-
return this.vNode.h('FcFragment', {
|
|
2974
|
-
key: ctx.prop.key,
|
|
2975
|
-
formCreateInject: this.injectProp(ctx)
|
|
2976
|
-
}, vn);
|
|
2977
|
-
},
|
|
2978
2853
|
isFragment: function isFragment(ctx) {
|
|
2979
2854
|
return ctx.type === 'fragment' || ctx.type === 'template';
|
|
2980
2855
|
},
|
|
2981
2856
|
injectProp: function injectProp(ctx) {
|
|
2982
2857
|
var _this6 = this;
|
|
2983
2858
|
|
|
2984
|
-
|
|
2859
|
+
var state = this.vm.setupState;
|
|
2860
|
+
|
|
2861
|
+
if (!state.ctxInject[ctx.id]) {
|
|
2862
|
+
state.ctxInject[ctx.id] = {
|
|
2863
|
+
api: this.$handle.api,
|
|
2864
|
+
form: this.fc.create,
|
|
2865
|
+
subForm: function subForm(_subForm) {
|
|
2866
|
+
_this6.$handle.addSubForm(ctx, _subForm);
|
|
2867
|
+
},
|
|
2868
|
+
options: [],
|
|
2869
|
+
children: [],
|
|
2870
|
+
preview: false,
|
|
2871
|
+
field: ctx.field,
|
|
2872
|
+
rule: ctx.rule
|
|
2873
|
+
};
|
|
2874
|
+
}
|
|
2875
|
+
|
|
2876
|
+
var inject = state.ctxInject[ctx.id];
|
|
2877
|
+
extend(inject, {
|
|
2985
2878
|
preview: this.options.preview || false,
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
},
|
|
2991
|
-
field: ctx.field,
|
|
2992
|
-
options: ctx.prop.options || [],
|
|
2993
|
-
children: ctx.rule.children,
|
|
2994
|
-
rule: ctx.rule
|
|
2995
|
-
};
|
|
2879
|
+
options: ctx.prop.options,
|
|
2880
|
+
children: ctx.loadChildrenPending()
|
|
2881
|
+
});
|
|
2882
|
+
return inject;
|
|
2996
2883
|
},
|
|
2997
2884
|
ctxProp: function ctxProp(ctx, custom) {
|
|
2998
2885
|
var _this7 = this;
|
|
@@ -3036,10 +2923,9 @@
|
|
|
3036
2923
|
onInput: function onInput(ctx, value) {
|
|
3037
2924
|
this.$handle.onInput(ctx, value);
|
|
3038
2925
|
},
|
|
3039
|
-
renderChildren: function renderChildren(ctx) {
|
|
2926
|
+
renderChildren: function renderChildren(children, ctx) {
|
|
3040
2927
|
var _this8 = this;
|
|
3041
2928
|
|
|
3042
|
-
var children = ctx.rule.children;
|
|
3043
2929
|
if (!is.trueArray(children)) return {};
|
|
3044
2930
|
var slotBag = makeSlotBag();
|
|
3045
2931
|
children.map(function (child) {
|
|
@@ -3105,7 +2991,7 @@
|
|
|
3105
2991
|
});
|
|
3106
2992
|
}
|
|
3107
2993
|
|
|
3108
|
-
var id = 1;
|
|
2994
|
+
var id$1 = 1;
|
|
3109
2995
|
function Render(handle) {
|
|
3110
2996
|
extend(this, {
|
|
3111
2997
|
$handle: handle,
|
|
@@ -3113,7 +2999,7 @@
|
|
|
3113
2999
|
vm: handle.vm,
|
|
3114
3000
|
$manager: handle.$manager,
|
|
3115
3001
|
vNode: new handle.fc.CreateNode(handle.vm),
|
|
3116
|
-
id: id++
|
|
3002
|
+
id: id$1++
|
|
3117
3003
|
});
|
|
3118
3004
|
funcProxy(this, {
|
|
3119
3005
|
options: function options() {
|
|
@@ -3361,6 +3247,7 @@
|
|
|
3361
3247
|
rule: rule,
|
|
3362
3248
|
origin: rule.__origin__ || rule,
|
|
3363
3249
|
name: rule.name,
|
|
3250
|
+
pending: {},
|
|
3364
3251
|
none: false,
|
|
3365
3252
|
watch: [],
|
|
3366
3253
|
linkOn: [],
|
|
@@ -3383,6 +3270,102 @@
|
|
|
3383
3270
|
this.update(handle, true);
|
|
3384
3271
|
}
|
|
3385
3272
|
extend(RuleContext.prototype, {
|
|
3273
|
+
loadChildrenPending: function loadChildrenPending() {
|
|
3274
|
+
var _this = this;
|
|
3275
|
+
|
|
3276
|
+
var children = this.rule.children || [];
|
|
3277
|
+
if (Array.isArray(children)) return children;
|
|
3278
|
+
return this.loadPending({
|
|
3279
|
+
key: 'children',
|
|
3280
|
+
origin: children,
|
|
3281
|
+
def: [],
|
|
3282
|
+
onLoad: function onLoad(data) {
|
|
3283
|
+
_this.$handle && _this.$handle.loadChildren(data, _this);
|
|
3284
|
+
},
|
|
3285
|
+
onUpdate: function onUpdate(value, oldValue) {
|
|
3286
|
+
if (_this.$handle) {
|
|
3287
|
+
value === oldValue ? _this.$handle.loadChildren(value, _this) : _this.$handle.updateChildren(_this, value, oldValue);
|
|
3288
|
+
}
|
|
3289
|
+
},
|
|
3290
|
+
onReload: function onReload(value) {
|
|
3291
|
+
if (_this.$handle) {
|
|
3292
|
+
_this.$handle.updateChildren(_this, [], value);
|
|
3293
|
+
} else {
|
|
3294
|
+
delete _this.pending.children;
|
|
3295
|
+
}
|
|
3296
|
+
}
|
|
3297
|
+
});
|
|
3298
|
+
},
|
|
3299
|
+
loadPending: function loadPending(config) {
|
|
3300
|
+
var _this2 = this;
|
|
3301
|
+
|
|
3302
|
+
var key = config.key,
|
|
3303
|
+
origin = config.origin,
|
|
3304
|
+
def = config.def,
|
|
3305
|
+
onLoad = config.onLoad,
|
|
3306
|
+
onReload = config.onReload,
|
|
3307
|
+
onUpdate = config.onUpdate;
|
|
3308
|
+
|
|
3309
|
+
if (this.pending[key] && this.pending[key].origin === origin) {
|
|
3310
|
+
return this.getPending(key, def);
|
|
3311
|
+
}
|
|
3312
|
+
|
|
3313
|
+
delete this.pending[key];
|
|
3314
|
+
var value = origin;
|
|
3315
|
+
|
|
3316
|
+
if (is.Function(origin)) {
|
|
3317
|
+
var source = invoke(function () {
|
|
3318
|
+
return origin({
|
|
3319
|
+
rule: _this2.rule,
|
|
3320
|
+
api: _this2.$api,
|
|
3321
|
+
update: function update(data) {
|
|
3322
|
+
var value = data || def;
|
|
3323
|
+
|
|
3324
|
+
var oldValue = _this2.getPending(key, def);
|
|
3325
|
+
|
|
3326
|
+
_this2.setPending(key, origin, value);
|
|
3327
|
+
|
|
3328
|
+
onUpdate && onUpdate(value, oldValue);
|
|
3329
|
+
},
|
|
3330
|
+
reload: function reload() {
|
|
3331
|
+
var oldValue = _this2.getPending(key, def);
|
|
3332
|
+
|
|
3333
|
+
delete _this2.pending[key];
|
|
3334
|
+
onReload && onReload(oldValue);
|
|
3335
|
+
_this2.$api && _this2.$api.sync(_this2.rule);
|
|
3336
|
+
}
|
|
3337
|
+
});
|
|
3338
|
+
});
|
|
3339
|
+
|
|
3340
|
+
if (source && is.Function(source.then)) {
|
|
3341
|
+
source.then(function (data) {
|
|
3342
|
+
var value = data || def;
|
|
3343
|
+
|
|
3344
|
+
_this2.setPending(key, origin, value);
|
|
3345
|
+
|
|
3346
|
+
onLoad && onLoad(value);
|
|
3347
|
+
_this2.$api && _this2.$api.sync(_this2.rule);
|
|
3348
|
+
});
|
|
3349
|
+
value = def;
|
|
3350
|
+
this.setPending(key, origin, value);
|
|
3351
|
+
} else {
|
|
3352
|
+
value = source || def;
|
|
3353
|
+
this.setPending(key, origin, value);
|
|
3354
|
+
onLoad && onLoad(value);
|
|
3355
|
+
}
|
|
3356
|
+
}
|
|
3357
|
+
|
|
3358
|
+
return value;
|
|
3359
|
+
},
|
|
3360
|
+
getPending: function getPending(key, def) {
|
|
3361
|
+
return this.pending[key] && this.pending[key].value || def;
|
|
3362
|
+
},
|
|
3363
|
+
setPending: function setPending(key, origin, value) {
|
|
3364
|
+
this.pending[key] = {
|
|
3365
|
+
origin: origin,
|
|
3366
|
+
value: vue.reactive(value)
|
|
3367
|
+
};
|
|
3368
|
+
},
|
|
3386
3369
|
effectData: function effectData(name) {
|
|
3387
3370
|
if (!this.payload[name]) {
|
|
3388
3371
|
this.payload[name] = {};
|
|
@@ -3406,13 +3389,13 @@
|
|
|
3406
3389
|
parser.init(this);
|
|
3407
3390
|
},
|
|
3408
3391
|
initProp: function initProp() {
|
|
3409
|
-
var
|
|
3392
|
+
var _this3 = this;
|
|
3410
3393
|
|
|
3411
3394
|
var rule = _objectSpread2({}, this.rule);
|
|
3412
3395
|
|
|
3413
3396
|
delete rule.children;
|
|
3414
3397
|
this.prop = mergeProps([rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
|
|
3415
|
-
return
|
|
3398
|
+
return _this3.payload[k];
|
|
3416
3399
|
})), [this.computed]));
|
|
3417
3400
|
},
|
|
3418
3401
|
initNone: function initNone() {
|
|
@@ -3439,10 +3422,10 @@
|
|
|
3439
3422
|
this.$handle.appendLink(this);
|
|
3440
3423
|
},
|
|
3441
3424
|
watchTo: function watchTo() {
|
|
3442
|
-
var
|
|
3425
|
+
var _this4 = this;
|
|
3443
3426
|
|
|
3444
3427
|
vue.nextTick(function () {
|
|
3445
|
-
|
|
3428
|
+
_this4.$handle && _this4.$handle.watchCtx(_this4);
|
|
3446
3429
|
});
|
|
3447
3430
|
},
|
|
3448
3431
|
"delete": function _delete() {
|
|
@@ -3472,15 +3455,15 @@
|
|
|
3472
3455
|
this.ctrlRule = [];
|
|
3473
3456
|
},
|
|
3474
3457
|
rm: function rm() {
|
|
3475
|
-
var
|
|
3458
|
+
var _this5 = this;
|
|
3476
3459
|
|
|
3477
3460
|
var _rm = function _rm() {
|
|
3478
|
-
var index =
|
|
3461
|
+
var index = _this5.root.indexOf(_this5.origin);
|
|
3479
3462
|
|
|
3480
3463
|
if (index > -1) {
|
|
3481
|
-
|
|
3464
|
+
_this5.root.splice(index, 1);
|
|
3482
3465
|
|
|
3483
|
-
|
|
3466
|
+
_this5.$handle && _this5.$handle.refresh();
|
|
3484
3467
|
}
|
|
3485
3468
|
};
|
|
3486
3469
|
|
|
@@ -3491,17 +3474,17 @@
|
|
|
3491
3474
|
}
|
|
3492
3475
|
|
|
3493
3476
|
this.$handle.noWatch(function () {
|
|
3494
|
-
|
|
3495
|
-
|
|
3477
|
+
_this5.$handle.deferSyncValue(function () {
|
|
3478
|
+
_this5.rmCtrl();
|
|
3496
3479
|
|
|
3497
3480
|
_rm();
|
|
3498
3481
|
|
|
3499
|
-
|
|
3482
|
+
_this5.$handle.rmCtx(_this5);
|
|
3500
3483
|
|
|
3501
|
-
extend(
|
|
3484
|
+
extend(_this5, {
|
|
3502
3485
|
root: []
|
|
3503
3486
|
});
|
|
3504
|
-
},
|
|
3487
|
+
}, _this5.input);
|
|
3505
3488
|
});
|
|
3506
3489
|
},
|
|
3507
3490
|
update: function update(handle, init) {
|
|
@@ -3540,7 +3523,6 @@
|
|
|
3540
3523
|
});
|
|
3541
3524
|
fullRule(rule);
|
|
3542
3525
|
this.appendValue(rule);
|
|
3543
|
-
rule.options = Array.isArray(rule.options) ? rule.options : [];
|
|
3544
3526
|
[rule, rule['prefix'], rule['suffix']].forEach(function (item) {
|
|
3545
3527
|
if (!item) {
|
|
3546
3528
|
return;
|
|
@@ -3660,7 +3642,7 @@
|
|
|
3660
3642
|
if (!is.Object(_rule) || !getRule(_rule).type) return err('未定义生成规则的 type 字段', _rule);
|
|
3661
3643
|
|
|
3662
3644
|
if (_rule.__fc__ && _rule.__fc__.root === rules && _this6.ctxs[_rule.__fc__.id]) {
|
|
3663
|
-
loadChildren(_rule.__fc__.
|
|
3645
|
+
loadChildren(_rule.__fc__.loadChildrenPending(), _rule.__fc__);
|
|
3664
3646
|
return _rule.__fc__;
|
|
3665
3647
|
}
|
|
3666
3648
|
|
|
@@ -3731,7 +3713,10 @@
|
|
|
3731
3713
|
_this6.setCtx(ctx);
|
|
3732
3714
|
|
|
3733
3715
|
!isCopy && !isInit && _this6.effect(ctx, 'load');
|
|
3734
|
-
|
|
3716
|
+
|
|
3717
|
+
var _load = ctx.loadChildrenPending();
|
|
3718
|
+
|
|
3719
|
+
ctx.parser.loadChildren === false || loadChildren(_load, ctx);
|
|
3735
3720
|
|
|
3736
3721
|
if (!parent) {
|
|
3737
3722
|
var _preIndex = preIndex(index);
|
|
@@ -3827,7 +3812,7 @@
|
|
|
3827
3812
|
if (valid) {
|
|
3828
3813
|
flag = true;
|
|
3829
3814
|
var ruleCon = {
|
|
3830
|
-
type: '
|
|
3815
|
+
type: 'fragment',
|
|
3831
3816
|
"native": true,
|
|
3832
3817
|
__ctrl: true,
|
|
3833
3818
|
children: rule
|
|
@@ -4167,7 +4152,7 @@
|
|
|
4167
4152
|
var flag = key === 'children';
|
|
4168
4153
|
ctx.refRule[key] = ref;
|
|
4169
4154
|
ctx.watch.push(vue.watch(flag ? function () {
|
|
4170
|
-
return _toConsumableArray(ref.value || []);
|
|
4155
|
+
return is.Function(ref.value) ? ref.value : _toConsumableArray(ref.value || []);
|
|
4171
4156
|
} : function () {
|
|
4172
4157
|
return ref.value;
|
|
4173
4158
|
}, function (_, o) {
|
|
@@ -4197,20 +4182,16 @@
|
|
|
4197
4182
|
ctx.updateType();
|
|
4198
4183
|
|
|
4199
4184
|
_this.bindParser(ctx);
|
|
4200
|
-
} else if (
|
|
4201
|
-
|
|
4202
|
-
o
|
|
4203
|
-
|
|
4204
|
-
_this.rmCtx(child.__fc__);
|
|
4205
|
-
}
|
|
4206
|
-
});
|
|
4185
|
+
} else if (flag) {
|
|
4186
|
+
if (is.Function(o)) {
|
|
4187
|
+
o = ctx.getPending('children', []);
|
|
4188
|
+
}
|
|
4207
4189
|
|
|
4208
|
-
|
|
4209
|
-
|
|
4190
|
+
if (is.Function(n)) {
|
|
4191
|
+
n = ctx.loadChildrenPending();
|
|
4192
|
+
}
|
|
4210
4193
|
|
|
4211
|
-
|
|
4212
|
-
}
|
|
4213
|
-
});
|
|
4194
|
+
_this.updateChildren(ctx, n, o);
|
|
4214
4195
|
}
|
|
4215
4196
|
|
|
4216
4197
|
_this.$render.clearCache(ctx);
|
|
@@ -4237,15 +4218,32 @@
|
|
|
4237
4218
|
|
|
4238
4219
|
this.watchEffect(ctx);
|
|
4239
4220
|
},
|
|
4240
|
-
|
|
4221
|
+
updateChildren: function updateChildren(ctx, n, o) {
|
|
4241
4222
|
var _this2 = this;
|
|
4242
4223
|
|
|
4224
|
+
this.deferSyncValue(function () {
|
|
4225
|
+
o && o.forEach(function (child) {
|
|
4226
|
+
if ((n || []).indexOf(child) === -1 && child && !is.String(child) && child.__fc__) {
|
|
4227
|
+
_this2.rmCtx(child.__fc__);
|
|
4228
|
+
}
|
|
4229
|
+
});
|
|
4230
|
+
|
|
4231
|
+
if (is.trueArray(n)) {
|
|
4232
|
+
_this2.loadChildren(n, ctx);
|
|
4233
|
+
|
|
4234
|
+
_this2.bus.$emit('update', _this2.api);
|
|
4235
|
+
}
|
|
4236
|
+
});
|
|
4237
|
+
},
|
|
4238
|
+
rmSub: function rmSub(sub) {
|
|
4239
|
+
var _this3 = this;
|
|
4240
|
+
|
|
4243
4241
|
is.trueArray(sub) && sub.forEach(function (r) {
|
|
4244
|
-
r && r.__fc__ &&
|
|
4242
|
+
r && r.__fc__ && _this3.rmCtx(r.__fc__);
|
|
4245
4243
|
});
|
|
4246
4244
|
},
|
|
4247
4245
|
rmCtx: function rmCtx(ctx) {
|
|
4248
|
-
var
|
|
4246
|
+
var _this4 = this;
|
|
4249
4247
|
|
|
4250
4248
|
if (ctx.deleted) return;
|
|
4251
4249
|
var id = ctx.id,
|
|
@@ -4255,20 +4253,23 @@
|
|
|
4255
4253
|
$del(this.ctxs, id);
|
|
4256
4254
|
$del(this.formData, id);
|
|
4257
4255
|
$del(this.subForm, id);
|
|
4256
|
+
$del(this.vm.setupState.ctxInject, id);
|
|
4258
4257
|
input && this.rmIdCtx(ctx, field, 'field');
|
|
4259
4258
|
name && this.rmIdCtx(ctx, name, 'name');
|
|
4260
4259
|
this.deferSyncValue(function () {
|
|
4261
|
-
if (!
|
|
4260
|
+
if (!_this4.reloading) {
|
|
4262
4261
|
if (ctx.parser.loadChildren !== false) {
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4262
|
+
var children = ctx.getPending('children', ctx.rule.children);
|
|
4263
|
+
|
|
4264
|
+
if (is.trueArray(children)) {
|
|
4265
|
+
children.forEach(function (h) {
|
|
4266
|
+
return h.__fc__ && _this4.rmCtx(h.__fc__);
|
|
4266
4267
|
});
|
|
4267
4268
|
}
|
|
4268
4269
|
}
|
|
4269
4270
|
|
|
4270
|
-
if (ctx.root ===
|
|
4271
|
-
|
|
4271
|
+
if (ctx.root === _this4.rules) {
|
|
4272
|
+
_this4.vm.setupState.renderRule();
|
|
4272
4273
|
}
|
|
4273
4274
|
}
|
|
4274
4275
|
}, input);
|
|
@@ -4387,7 +4388,7 @@
|
|
|
4387
4388
|
input = _ref.input,
|
|
4388
4389
|
type = _ref.type,
|
|
4389
4390
|
custom = _ref.custom;
|
|
4390
|
-
if (!type ||
|
|
4391
|
+
if (!type || ['fcFragment', 'fragment'].indexOf(type) > -1) return;
|
|
4391
4392
|
var effect = custom ? custom : rule.effect || {};
|
|
4392
4393
|
Object.keys(effect).forEach(function (attr) {
|
|
4393
4394
|
var p = _this4.providers[attr];
|
|
@@ -4584,26 +4585,8 @@
|
|
|
4584
4585
|
xhr.send(formData);
|
|
4585
4586
|
}
|
|
4586
4587
|
|
|
4587
|
-
var NAME
|
|
4588
|
+
var NAME = 'fcFragment';
|
|
4588
4589
|
var fragment = vue.defineComponent({
|
|
4589
|
-
name: NAME$1,
|
|
4590
|
-
inheritAttrs: false,
|
|
4591
|
-
props: ['formCreateInject'],
|
|
4592
|
-
setup: function setup(props) {
|
|
4593
|
-
var data = vue.toRef(props, 'formCreateInject');
|
|
4594
|
-
var $inject = vue.reactive(_objectSpread2({}, data.value));
|
|
4595
|
-
vue.watch(data, function () {
|
|
4596
|
-
extend($inject, data.value);
|
|
4597
|
-
});
|
|
4598
|
-
vue.provide('formCreateInject', $inject);
|
|
4599
|
-
},
|
|
4600
|
-
render: function render() {
|
|
4601
|
-
return this.$slots["default"]();
|
|
4602
|
-
}
|
|
4603
|
-
});
|
|
4604
|
-
|
|
4605
|
-
var NAME = 'FcVnode';
|
|
4606
|
-
var vnode = vue.defineComponent({
|
|
4607
4590
|
name: NAME,
|
|
4608
4591
|
inheritAttrs: false,
|
|
4609
4592
|
props: ['vnode'],
|
|
@@ -4646,8 +4629,14 @@
|
|
|
4646
4629
|
return makeDirective(data, this.h(tag, toProps(data), children));
|
|
4647
4630
|
},
|
|
4648
4631
|
h: function h(tag, data, children) {
|
|
4632
|
+
var isNativeTag = vue.getCurrentInstance().appContext.config.isNativeTag(tag);
|
|
4633
|
+
|
|
4634
|
+
if (isNativeTag) {
|
|
4635
|
+
delete data.formCreateInject;
|
|
4636
|
+
}
|
|
4637
|
+
|
|
4649
4638
|
try {
|
|
4650
|
-
return vue.createVNode(
|
|
4639
|
+
return vue.createVNode(isNativeTag ? tag : vue.resolveComponent(tag), data, children);
|
|
4651
4640
|
} catch (e) {
|
|
4652
4641
|
console.error(e);
|
|
4653
4642
|
return vue.createVNode('');
|
|
@@ -4690,7 +4679,7 @@
|
|
|
4690
4679
|
return _super.apply(this, arguments);
|
|
4691
4680
|
}
|
|
4692
4681
|
|
|
4693
|
-
return
|
|
4682
|
+
return CustomManager;
|
|
4694
4683
|
}(Manager);
|
|
4695
4684
|
|
|
4696
4685
|
Object.assign(CustomManager.prototype, proto);
|
|
@@ -4835,6 +4824,25 @@
|
|
|
4835
4824
|
return true;
|
|
4836
4825
|
}
|
|
4837
4826
|
|
|
4827
|
+
var name$6 = 'html';
|
|
4828
|
+
var html = {
|
|
4829
|
+
name: name$6,
|
|
4830
|
+
loadChildren: false,
|
|
4831
|
+
render: function render(children, ctx) {
|
|
4832
|
+
ctx.prop.props.innerHTML = children["default"]();
|
|
4833
|
+
return ctx.vNode.make(ctx.prop.props.tag || 'div', ctx.prop);
|
|
4834
|
+
},
|
|
4835
|
+
renderChildren: function renderChildren(children) {
|
|
4836
|
+
return {
|
|
4837
|
+
"default": function _default() {
|
|
4838
|
+
return children.filter(function (v) {
|
|
4839
|
+
return is.String(v);
|
|
4840
|
+
}).join('');
|
|
4841
|
+
}
|
|
4842
|
+
};
|
|
4843
|
+
}
|
|
4844
|
+
};
|
|
4845
|
+
|
|
4838
4846
|
function parseProp(name, id) {
|
|
4839
4847
|
var prop;
|
|
4840
4848
|
|
|
@@ -4863,8 +4871,10 @@
|
|
|
4863
4871
|
arrayAttrs.push.apply(arrayAttrs, _toConsumableArray(array));
|
|
4864
4872
|
normalAttrs.push.apply(normalAttrs, _toConsumableArray(normal));
|
|
4865
4873
|
appendProto([].concat(_toConsumableArray(key), _toConsumableArray(array), _toConsumableArray(normal)));
|
|
4866
|
-
}
|
|
4874
|
+
}
|
|
4867
4875
|
|
|
4876
|
+
var id = 1;
|
|
4877
|
+
var instance = {}; //todo 表单嵌套
|
|
4868
4878
|
|
|
4869
4879
|
function FormCreateFactory(config) {
|
|
4870
4880
|
var components = _defineProperty({}, fragment.name, fragment);
|
|
@@ -4872,6 +4882,7 @@
|
|
|
4872
4882
|
var parsers = {};
|
|
4873
4883
|
var directives = {};
|
|
4874
4884
|
var modelFields = {};
|
|
4885
|
+
var useApps = [];
|
|
4875
4886
|
var providers = {
|
|
4876
4887
|
fetch: $fetch
|
|
4877
4888
|
};
|
|
@@ -4883,6 +4894,14 @@
|
|
|
4883
4894
|
var CreateNode = CreateNodeFactory();
|
|
4884
4895
|
exportAttrs(config.attrs || {});
|
|
4885
4896
|
|
|
4897
|
+
function getApi(name) {
|
|
4898
|
+
return instance[name];
|
|
4899
|
+
}
|
|
4900
|
+
|
|
4901
|
+
function useApp(fn) {
|
|
4902
|
+
useApps.push(fn);
|
|
4903
|
+
}
|
|
4904
|
+
|
|
4886
4905
|
function directive() {
|
|
4887
4906
|
var data = nameProp.apply(void 0, arguments);
|
|
4888
4907
|
if (data.id && data.prop) directives[data.id] = data.prop;
|
|
@@ -4951,7 +4970,7 @@
|
|
|
4951
4970
|
}
|
|
4952
4971
|
|
|
4953
4972
|
function $vnode() {
|
|
4954
|
-
return
|
|
4973
|
+
return fragment;
|
|
4955
4974
|
} //todo 检查回调函数作用域
|
|
4956
4975
|
|
|
4957
4976
|
|
|
@@ -4962,7 +4981,11 @@
|
|
|
4962
4981
|
|
|
4963
4982
|
function create(rules, option) {
|
|
4964
4983
|
var app = createFormApp(rules, option || {});
|
|
4965
|
-
|
|
4984
|
+
useApps.forEach(function (v) {
|
|
4985
|
+
invoke(function () {
|
|
4986
|
+
return v(create, app);
|
|
4987
|
+
});
|
|
4988
|
+
});
|
|
4966
4989
|
var div = document.createElement('div');
|
|
4967
4990
|
((option === null || option === void 0 ? void 0 : option.el) || document.body).appendChild(div);
|
|
4968
4991
|
var vm = app.mount(div);
|
|
@@ -4981,6 +5004,7 @@
|
|
|
4981
5004
|
var _this = this;
|
|
4982
5005
|
|
|
4983
5006
|
extend(this, {
|
|
5007
|
+
id: id++,
|
|
4984
5008
|
create: create,
|
|
4985
5009
|
vm: vm,
|
|
4986
5010
|
manager: createManager(config.manager),
|
|
@@ -4988,6 +5012,7 @@
|
|
|
4988
5012
|
providers: providers,
|
|
4989
5013
|
modelFields: modelFields,
|
|
4990
5014
|
rules: vm.props.rule,
|
|
5015
|
+
name: vm.props.name,
|
|
4991
5016
|
prop: {
|
|
4992
5017
|
components: components,
|
|
4993
5018
|
directives: directives
|
|
@@ -5012,6 +5037,10 @@
|
|
|
5012
5037
|
extend(vm.appContext.components, components);
|
|
5013
5038
|
extend(vm.appContext.directives, directives);
|
|
5014
5039
|
this.$handle = new Handler(this);
|
|
5040
|
+
|
|
5041
|
+
if (this.name) {
|
|
5042
|
+
instance[this.name] = this.api();
|
|
5043
|
+
}
|
|
5015
5044
|
}
|
|
5016
5045
|
|
|
5017
5046
|
extend(FormCreate.prototype, {
|
|
@@ -5077,6 +5106,10 @@
|
|
|
5077
5106
|
this.$handle.mounted();
|
|
5078
5107
|
},
|
|
5079
5108
|
unmount: function unmount() {
|
|
5109
|
+
if (this.name) {
|
|
5110
|
+
delete instance[this.name];
|
|
5111
|
+
}
|
|
5112
|
+
|
|
5080
5113
|
this.unwatch && this.unwatch();
|
|
5081
5114
|
this.$handle.reloadRule([]);
|
|
5082
5115
|
},
|
|
@@ -5110,17 +5143,19 @@
|
|
|
5110
5143
|
$form: $form,
|
|
5111
5144
|
parseFn: parseFn,
|
|
5112
5145
|
parseJson: parseJson,
|
|
5113
|
-
toJson: toJson
|
|
5146
|
+
toJson: toJson,
|
|
5147
|
+
useApp: useApp,
|
|
5148
|
+
getApi: getApi
|
|
5114
5149
|
});
|
|
5115
5150
|
}
|
|
5116
5151
|
|
|
5117
5152
|
function useStatic(formCreate) {
|
|
5118
5153
|
extend(formCreate, {
|
|
5119
5154
|
create: create,
|
|
5120
|
-
install: function install(
|
|
5155
|
+
install: function install(app, options) {
|
|
5121
5156
|
globalConfig = _objectSpread2(_objectSpread2({}, globalConfig), options || {});
|
|
5122
|
-
if (
|
|
5123
|
-
|
|
5157
|
+
if (app._installedFormCreate === true) return;
|
|
5158
|
+
app._installedFormCreate = true;
|
|
5124
5159
|
|
|
5125
5160
|
var $formCreate = function $formCreate(rules) {
|
|
5126
5161
|
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -5128,9 +5163,13 @@
|
|
|
5128
5163
|
};
|
|
5129
5164
|
|
|
5130
5165
|
useAttr($formCreate);
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5166
|
+
app.config.globalProperties.$formCreate = $formCreate;
|
|
5167
|
+
app.component('FormCreate', $form());
|
|
5168
|
+
useApps.forEach(function (v) {
|
|
5169
|
+
invoke(function () {
|
|
5170
|
+
return v(formCreate, app);
|
|
5171
|
+
});
|
|
5172
|
+
});
|
|
5134
5173
|
}
|
|
5135
5174
|
});
|
|
5136
5175
|
}
|
|
@@ -5140,7 +5179,13 @@
|
|
|
5140
5179
|
CreateNode.use({
|
|
5141
5180
|
fragment: 'fcFragment'
|
|
5142
5181
|
});
|
|
5143
|
-
|
|
5182
|
+
config.install && create.use(config);
|
|
5183
|
+
useApp(function (_, app) {
|
|
5184
|
+
app.mixin({
|
|
5185
|
+
props: ['formCreateInject']
|
|
5186
|
+
});
|
|
5187
|
+
});
|
|
5188
|
+
parser(html);
|
|
5144
5189
|
return create;
|
|
5145
5190
|
}
|
|
5146
5191
|
|
|
@@ -5285,7 +5330,7 @@
|
|
|
5285
5330
|
var PRE = 'el';
|
|
5286
5331
|
var alias = {
|
|
5287
5332
|
button: PRE + '-button',
|
|
5288
|
-
icon: '
|
|
5333
|
+
icon: PRE + '-icon',
|
|
5289
5334
|
slider: PRE + '-slider',
|
|
5290
5335
|
rate: PRE + '-rate',
|
|
5291
5336
|
upload: 'fc-upload',
|
|
@@ -5342,7 +5387,6 @@
|
|
|
5342
5387
|
type: 'default',
|
|
5343
5388
|
loading: false,
|
|
5344
5389
|
disabled: false,
|
|
5345
|
-
icon: 'el-icon-refresh',
|
|
5346
5390
|
innerText: '重置',
|
|
5347
5391
|
show: false,
|
|
5348
5392
|
col: undefined,
|
|
@@ -5432,7 +5476,7 @@
|
|
|
5432
5476
|
info: {
|
|
5433
5477
|
trigger: 'hover',
|
|
5434
5478
|
placement: 'top-start',
|
|
5435
|
-
icon:
|
|
5479
|
+
icon: true
|
|
5436
5480
|
},
|
|
5437
5481
|
title: {},
|
|
5438
5482
|
col: {
|
|
@@ -5548,10 +5592,16 @@
|
|
|
5548
5592
|
|
|
5549
5593
|
children[infoProp.align !== 'left' ? 'unshift' : 'push'](this.$r(mergeProps([infoProp, prop]), _defineProperty({}, titleProp.slot || (isTip ? 'default' : 'reference'), function () {
|
|
5550
5594
|
return _this4.$r({
|
|
5551
|
-
type: '
|
|
5552
|
-
|
|
5595
|
+
type: 'ElIcon',
|
|
5596
|
+
style: 'top:2px',
|
|
5553
5597
|
key: "".concat(uni, "i")
|
|
5554
|
-
}, {
|
|
5598
|
+
}, {
|
|
5599
|
+
"default": function _default() {
|
|
5600
|
+
return _this4.$r({
|
|
5601
|
+
type: infoProp.icon === true ? 'warning' : infoProp.icon
|
|
5602
|
+
});
|
|
5603
|
+
}
|
|
5604
|
+
}, true);
|
|
5555
5605
|
})));
|
|
5556
5606
|
}
|
|
5557
5607
|
|
|
@@ -5908,12 +5958,18 @@
|
|
|
5908
5958
|
Object.keys(maker$1).forEach(function (name) {
|
|
5909
5959
|
FormCreate.maker[name] = maker$1[name];
|
|
5910
5960
|
});
|
|
5961
|
+
|
|
5962
|
+
if (typeof window !== 'undefined' && window.ElementPlus) {
|
|
5963
|
+
FormCreate.useApp(function (_, app) {
|
|
5964
|
+
app.use(window.ElementPlus);
|
|
5965
|
+
});
|
|
5966
|
+
}
|
|
5911
5967
|
}
|
|
5912
5968
|
|
|
5913
5969
|
function elmFormCreate() {
|
|
5914
5970
|
return FormCreateFactory({
|
|
5915
5971
|
ui: 'element-ui',
|
|
5916
|
-
version: '3.0
|
|
5972
|
+
version: '3.1.0',
|
|
5917
5973
|
manager: manager,
|
|
5918
5974
|
extendApi: extendApi,
|
|
5919
5975
|
install: install,
|