@form-create/element-ui 3.0.0-alpha.2 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/auto-import.js +83 -0
- package/dist/form-create.esm.js +664 -521
- package/dist/form-create.esm.min.js +3 -3
- package/dist/form-create.js +667 -527
- package/dist/form-create.min.js +3 -3
- package/package.json +19 -15
- package/src/core/alias.js +1 -1
- package/src/core/config.js +0 -1
- package/src/core/index.js +7 -7
- package/src/core/maker.js +3 -3
- package/src/core/manager.js +42 -27
- package/src/style/index.css +1 -1
- package/types/config.d.ts +144 -0
- package/types/index.d.ts +28 -0
- package/types/maker.d.ts +14 -0
package/dist/form-create.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/element-ui v3.
|
|
3
|
-
* (c) 2018-
|
|
2
|
+
* @form-create/element-ui v3.1.0
|
|
3
|
+
* (c) 2018-2022 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create
|
|
5
5
|
* Released under the MIT License.
|
|
6
6
|
*/
|
|
7
7
|
(function (global, factory) {
|
|
8
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')
|
|
9
|
-
typeof define === 'function' && define.amd ? define(['exports', 'vue'
|
|
10
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.formCreate = {}, global.Vue
|
|
11
|
-
})(this, (function (exports, vue
|
|
12
|
-
|
|
13
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
|
-
|
|
15
|
-
var ElementPlus__default = /*#__PURE__*/_interopDefaultLegacy(ElementPlus);
|
|
8
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) :
|
|
9
|
+
typeof define === 'function' && define.amd ? define(['exports', 'vue'], factory) :
|
|
10
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.formCreate = {}, global.Vue));
|
|
11
|
+
})(this, (function (exports, vue) { 'use strict';
|
|
16
12
|
|
|
17
13
|
function ownKeys(object, enumerableOnly) {
|
|
18
14
|
var keys = Object.keys(object);
|
|
@@ -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,46 +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
|
-
var _options =
|
|
238
|
-
return Array.isArray(options) ? options : [];
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
var update = function update() {
|
|
242
|
-
trueValue.value = value.value ? _options.value.filter(function (opt) {
|
|
243
|
-
return value.value.indexOf(opt.value) !== -1;
|
|
244
|
-
}).map(function (option) {
|
|
245
|
-
return option.label;
|
|
246
|
-
}) : [];
|
|
231
|
+
var _options = function _options() {
|
|
232
|
+
return Array.isArray(options.value) ? options.value : [];
|
|
247
233
|
};
|
|
248
234
|
|
|
249
|
-
update();
|
|
250
235
|
return {
|
|
251
236
|
options: _options,
|
|
252
|
-
trueValue: trueValue,
|
|
253
237
|
value: value,
|
|
254
238
|
onInput: function onInput(n) {
|
|
255
|
-
_.emit('update:modelValue',
|
|
256
|
-
|
|
257
|
-
}).map(function (opt) {
|
|
258
|
-
return opt.value;
|
|
259
|
-
}).filter(function (v) {
|
|
260
|
-
return v !== undefined;
|
|
261
|
-
}));
|
|
262
|
-
},
|
|
263
|
-
update: update
|
|
239
|
+
_.emit('update:modelValue', n);
|
|
240
|
+
}
|
|
264
241
|
};
|
|
265
242
|
},
|
|
266
|
-
watch: {
|
|
267
|
-
modelValue: function modelValue() {
|
|
268
|
-
this.update();
|
|
269
|
-
}
|
|
270
|
-
},
|
|
271
243
|
render: function render() {
|
|
272
244
|
var _this$$slots$default,
|
|
273
245
|
_this$$slots,
|
|
@@ -276,17 +248,23 @@
|
|
|
276
248
|
var name = this.type === 'button' ? 'ElCheckboxButton' : 'ElCheckbox';
|
|
277
249
|
var Type = vue.resolveComponent(name);
|
|
278
250
|
return vue.createVNode(vue.resolveComponent("ElCheckboxGroup"), vue.mergeProps(this.$attrs, {
|
|
279
|
-
"modelValue": this.
|
|
251
|
+
"modelValue": this.value,
|
|
280
252
|
"onUpdate:modelValue": this.onInput
|
|
281
253
|
}), _objectSpread2({
|
|
282
254
|
"default": function _default() {
|
|
283
|
-
return [_this.options.map(function (opt, index) {
|
|
255
|
+
return [_this.options().map(function (opt, index) {
|
|
284
256
|
var props = _objectSpread2({}, opt);
|
|
285
257
|
|
|
258
|
+
var value = props.value;
|
|
286
259
|
delete props.value;
|
|
287
260
|
return vue.createVNode(Type, vue.mergeProps(props, {
|
|
261
|
+
"label": value,
|
|
288
262
|
"key": name + index + opt.value
|
|
289
|
-
}),
|
|
263
|
+
}), {
|
|
264
|
+
"default": function _default() {
|
|
265
|
+
return [props.label || props.value || ''];
|
|
266
|
+
}
|
|
267
|
+
});
|
|
290
268
|
}), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
|
|
291
269
|
}
|
|
292
270
|
}, getSlot(this.$slots, ['default'])));
|
|
@@ -368,16 +346,16 @@
|
|
|
368
346
|
}
|
|
369
347
|
}
|
|
370
348
|
|
|
371
|
-
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}";
|
|
372
350
|
styleInject(css_248z$2);
|
|
373
351
|
|
|
374
352
|
function _isSlot$1(s) {
|
|
375
353
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
376
354
|
}
|
|
377
355
|
|
|
378
|
-
var NAME$
|
|
356
|
+
var NAME$8 = 'fcFrame';
|
|
379
357
|
var Frame = vue.defineComponent({
|
|
380
|
-
name: NAME$
|
|
358
|
+
name: NAME$8,
|
|
381
359
|
props: {
|
|
382
360
|
type: {
|
|
383
361
|
type: String,
|
|
@@ -398,7 +376,7 @@
|
|
|
398
376
|
},
|
|
399
377
|
icon: {
|
|
400
378
|
type: String,
|
|
401
|
-
"default": '
|
|
379
|
+
"default": 'upload'
|
|
402
380
|
},
|
|
403
381
|
width: {
|
|
404
382
|
type: String,
|
|
@@ -421,7 +399,10 @@
|
|
|
421
399
|
"default": '关闭'
|
|
422
400
|
},
|
|
423
401
|
modalTitle: String,
|
|
424
|
-
handleIcon:
|
|
402
|
+
handleIcon: {
|
|
403
|
+
type: [String, Boolean],
|
|
404
|
+
"default": undefined
|
|
405
|
+
},
|
|
425
406
|
title: String,
|
|
426
407
|
allowRemove: {
|
|
427
408
|
type: Boolean,
|
|
@@ -476,9 +457,9 @@
|
|
|
476
457
|
okBtn: {
|
|
477
458
|
type: Boolean,
|
|
478
459
|
"default": true
|
|
479
|
-
}
|
|
460
|
+
},
|
|
461
|
+
formCreateInject: Object
|
|
480
462
|
},
|
|
481
|
-
inject: ['formCreateInject'],
|
|
482
463
|
emits: ['update:modelValue', 'change'],
|
|
483
464
|
data: function data() {
|
|
484
465
|
return {
|
|
@@ -495,9 +476,6 @@
|
|
|
495
476
|
}
|
|
496
477
|
},
|
|
497
478
|
methods: {
|
|
498
|
-
key: function key(unique) {
|
|
499
|
-
return unique;
|
|
500
|
-
},
|
|
501
479
|
close: function close() {
|
|
502
480
|
this.closeModel(true);
|
|
503
481
|
},
|
|
@@ -537,7 +515,7 @@
|
|
|
537
515
|
}).toString(),
|
|
538
516
|
readonly: true
|
|
539
517
|
}, {
|
|
540
|
-
"key":
|
|
518
|
+
"key": 1
|
|
541
519
|
}), {
|
|
542
520
|
append: function append() {
|
|
543
521
|
return vue.createVNode(vue.resolveComponent("ElButton"), {
|
|
@@ -548,14 +526,18 @@
|
|
|
548
526
|
}, null);
|
|
549
527
|
},
|
|
550
528
|
suffix: function suffix() {
|
|
551
|
-
return _this.fileList.length ? vue.createVNode("
|
|
552
|
-
"class": "el-input__icon
|
|
529
|
+
return _this.fileList.length ? vue.createVNode(vue.resolveComponent("ElIcon"), {
|
|
530
|
+
"class": "el-input__icon",
|
|
553
531
|
"onClick": function onClick() {
|
|
554
532
|
_this.fileList = [];
|
|
555
533
|
|
|
556
534
|
_this.input();
|
|
557
535
|
}
|
|
558
|
-
},
|
|
536
|
+
}, {
|
|
537
|
+
"default": function _default() {
|
|
538
|
+
return [vue.createVNode(vue.resolveComponent("CircleClose"), null, null)];
|
|
539
|
+
}
|
|
540
|
+
}) : null;
|
|
559
541
|
}
|
|
560
542
|
});
|
|
561
543
|
},
|
|
@@ -565,13 +547,13 @@
|
|
|
565
547
|
}
|
|
566
548
|
|
|
567
549
|
return vue.createVNode("div", {
|
|
568
|
-
"key":
|
|
550
|
+
"key": 2
|
|
569
551
|
}, [children]);
|
|
570
552
|
},
|
|
571
553
|
makeItem: function makeItem(index, children) {
|
|
572
554
|
return vue.createVNode("div", {
|
|
573
|
-
"class": "
|
|
574
|
-
"key":
|
|
555
|
+
"class": "_fc-files",
|
|
556
|
+
"key": '3' + index
|
|
575
557
|
}, [children]);
|
|
576
558
|
},
|
|
577
559
|
valid: function valid(f) {
|
|
@@ -594,43 +576,53 @@
|
|
|
594
576
|
}
|
|
595
577
|
|
|
596
578
|
return vue.createVNode("div", {
|
|
597
|
-
"class": "
|
|
598
|
-
"key":
|
|
579
|
+
"class": "_fc-upload-cover",
|
|
580
|
+
"key": 4
|
|
599
581
|
}, [icons]);
|
|
600
582
|
}
|
|
601
583
|
},
|
|
602
584
|
makeHandleIcon: function makeHandleIcon(val, index) {
|
|
603
585
|
var _this2 = this;
|
|
604
586
|
|
|
605
|
-
|
|
606
|
-
|
|
587
|
+
var Type = vue.resolveComponent(this.handleIcon === true || this.handleIcon === undefined ? 'view' : this.handleIcon);
|
|
588
|
+
return vue.createVNode(vue.resolveComponent("ElIcon"), {
|
|
607
589
|
"onClick": function onClick() {
|
|
608
590
|
return _this2.handleClick(val);
|
|
609
591
|
},
|
|
610
|
-
"key":
|
|
611
|
-
},
|
|
592
|
+
"key": '5' + index
|
|
593
|
+
}, {
|
|
594
|
+
"default": function _default() {
|
|
595
|
+
return [vue.createVNode(Type, null, null)];
|
|
596
|
+
}
|
|
597
|
+
});
|
|
612
598
|
},
|
|
613
599
|
makeRemoveIcon: function makeRemoveIcon(val, index) {
|
|
614
600
|
var _this3 = this;
|
|
615
601
|
|
|
616
|
-
return vue.createVNode("
|
|
617
|
-
"class": "el-icon-delete",
|
|
602
|
+
return vue.createVNode(vue.resolveComponent("ElIcon"), {
|
|
618
603
|
"onClick": function onClick() {
|
|
619
604
|
return _this3.handleRemove(val);
|
|
620
605
|
},
|
|
621
|
-
"key":
|
|
622
|
-
},
|
|
606
|
+
"key": '6' + index
|
|
607
|
+
}, {
|
|
608
|
+
"default": function _default() {
|
|
609
|
+
return [vue.createVNode(vue.resolveComponent("delete"), null, null)];
|
|
610
|
+
}
|
|
611
|
+
});
|
|
623
612
|
},
|
|
624
613
|
makeFiles: function makeFiles() {
|
|
625
614
|
var _this4 = this;
|
|
626
615
|
|
|
627
616
|
return this.makeGroup(this.fileList.map(function (src, index) {
|
|
628
|
-
return _this4.makeItem(index, [vue.createVNode("
|
|
629
|
-
"class": "el-icon-tickets",
|
|
617
|
+
return _this4.makeItem(index, [vue.createVNode(vue.resolveComponent("ElIcon"), {
|
|
630
618
|
"onClick": function onClick() {
|
|
631
619
|
return _this4.handleClick(src);
|
|
632
620
|
}
|
|
633
|
-
},
|
|
621
|
+
}, {
|
|
622
|
+
"default": function _default() {
|
|
623
|
+
return [vue.createVNode(vue.resolveComponent("document"), null, null)];
|
|
624
|
+
}
|
|
625
|
+
}), _this4.makeIcons(src, index)]);
|
|
634
626
|
}));
|
|
635
627
|
},
|
|
636
628
|
makeImages: function makeImages() {
|
|
@@ -645,15 +637,18 @@
|
|
|
645
637
|
makeBtn: function makeBtn() {
|
|
646
638
|
var _this6 = this;
|
|
647
639
|
|
|
640
|
+
var Type = vue.resolveComponent(this.icon);
|
|
648
641
|
return vue.createVNode("div", {
|
|
649
|
-
"class": "
|
|
642
|
+
"class": "_fc-upload-btn",
|
|
650
643
|
"onClick": function onClick() {
|
|
651
644
|
return _this6.showModel();
|
|
652
645
|
},
|
|
653
|
-
"key":
|
|
654
|
-
}, [vue.createVNode("
|
|
655
|
-
"
|
|
656
|
-
|
|
646
|
+
"key": 7
|
|
647
|
+
}, [vue.createVNode(vue.resolveComponent("ElIcon"), null, {
|
|
648
|
+
"default": function _default() {
|
|
649
|
+
return [vue.createVNode(Type, null, null)];
|
|
650
|
+
}
|
|
651
|
+
})]);
|
|
657
652
|
},
|
|
658
653
|
handleClick: function handleClick(src) {
|
|
659
654
|
if (this.onHandle) {
|
|
@@ -783,7 +778,6 @@
|
|
|
783
778
|
}, {
|
|
784
779
|
"default": function _default() {
|
|
785
780
|
return [vue.createVNode("img", {
|
|
786
|
-
"alt": "example",
|
|
787
781
|
"style": "width: 100%",
|
|
788
782
|
"src": _this9.previewImage
|
|
789
783
|
}, null)];
|
|
@@ -805,7 +799,7 @@
|
|
|
805
799
|
"src": src,
|
|
806
800
|
"frameBorder": "0",
|
|
807
801
|
"style": {
|
|
808
|
-
|
|
802
|
+
height: height,
|
|
809
803
|
'border': '0 none',
|
|
810
804
|
'width': '100%'
|
|
811
805
|
}
|
|
@@ -834,59 +828,35 @@
|
|
|
834
828
|
}
|
|
835
829
|
});
|
|
836
830
|
|
|
837
|
-
var NAME$
|
|
831
|
+
var NAME$7 = 'fcRadio';
|
|
838
832
|
var Radio = vue.defineComponent({
|
|
839
|
-
name: NAME$
|
|
833
|
+
name: NAME$7,
|
|
840
834
|
inheritAttrs: false,
|
|
841
835
|
props: {
|
|
836
|
+
formCreateInject: Object,
|
|
842
837
|
modelValue: {
|
|
843
|
-
type: [String, Number],
|
|
844
|
-
"default":
|
|
845
|
-
return [];
|
|
846
|
-
}
|
|
838
|
+
type: [String, Number, Boolean],
|
|
839
|
+
"default": ''
|
|
847
840
|
},
|
|
848
841
|
type: String
|
|
849
842
|
},
|
|
850
843
|
emits: ['update:modelValue'],
|
|
851
844
|
setup: function setup(props, _) {
|
|
852
|
-
var
|
|
853
|
-
options = _toRefs.options;
|
|
854
|
-
|
|
855
|
-
var trueValue = vue.ref([]);
|
|
845
|
+
var options = vue.toRef(props.formCreateInject, 'options', []);
|
|
856
846
|
var value = vue.toRef(props, 'modelValue');
|
|
857
847
|
|
|
858
|
-
var _options =
|
|
859
|
-
return Array.isArray(options) ? options : [];
|
|
860
|
-
});
|
|
861
|
-
|
|
862
|
-
var update = function update() {
|
|
863
|
-
trueValue.value = _options.value.filter(function (opt) {
|
|
864
|
-
return opt.value === value.value;
|
|
865
|
-
}).reduce(function (initial, opt) {
|
|
866
|
-
return opt.label;
|
|
867
|
-
}, '');
|
|
848
|
+
var _options = function _options() {
|
|
849
|
+
return Array.isArray(options.value) ? options.value : [];
|
|
868
850
|
};
|
|
869
851
|
|
|
870
|
-
update();
|
|
871
852
|
return {
|
|
872
853
|
options: _options,
|
|
873
|
-
trueValue: trueValue,
|
|
874
854
|
value: value,
|
|
875
855
|
onInput: function onInput(n) {
|
|
876
|
-
_.emit('update:modelValue',
|
|
877
|
-
|
|
878
|
-
}).reduce(function (initial, opt) {
|
|
879
|
-
return opt.value;
|
|
880
|
-
}, ''));
|
|
881
|
-
},
|
|
882
|
-
update: update
|
|
856
|
+
_.emit('update:modelValue', n);
|
|
857
|
+
}
|
|
883
858
|
};
|
|
884
859
|
},
|
|
885
|
-
watch: {
|
|
886
|
-
modelValue: function modelValue() {
|
|
887
|
-
this.update();
|
|
888
|
-
}
|
|
889
|
-
},
|
|
890
860
|
render: function render() {
|
|
891
861
|
var _this$$slots$default,
|
|
892
862
|
_this$$slots,
|
|
@@ -895,46 +865,49 @@
|
|
|
895
865
|
var name = this.type === 'button' ? 'ElRadioButton' : 'ElRadio';
|
|
896
866
|
var Type = vue.resolveComponent(name);
|
|
897
867
|
return vue.createVNode(vue.resolveComponent("ElRadioGroup"), vue.mergeProps(this.$attrs, {
|
|
898
|
-
"modelValue": this.
|
|
868
|
+
"modelValue": this.value,
|
|
899
869
|
"onUpdate:modelValue": this.onInput
|
|
900
870
|
}), _objectSpread2({
|
|
901
871
|
"default": function _default() {
|
|
902
|
-
return [_this.options.map(function (opt, index) {
|
|
872
|
+
return [_this.options().map(function (opt, index) {
|
|
903
873
|
var props = _objectSpread2({}, opt);
|
|
904
874
|
|
|
875
|
+
var value = props.value;
|
|
905
876
|
delete props.value;
|
|
906
877
|
return vue.createVNode(Type, vue.mergeProps(props, {
|
|
878
|
+
"label": value,
|
|
907
879
|
"key": name + index + opt.value
|
|
908
|
-
}),
|
|
880
|
+
}), {
|
|
881
|
+
"default": function _default() {
|
|
882
|
+
return [props.label || props.value || ''];
|
|
883
|
+
}
|
|
884
|
+
});
|
|
909
885
|
}), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
|
|
910
886
|
}
|
|
911
887
|
}, getSlot(this.$slots, ['default'])));
|
|
912
888
|
}
|
|
913
889
|
});
|
|
914
890
|
|
|
915
|
-
var NAME$
|
|
891
|
+
var NAME$6 = 'fcSelect';
|
|
916
892
|
var Select = vue.defineComponent({
|
|
917
|
-
name: NAME$
|
|
893
|
+
name: NAME$6,
|
|
918
894
|
inheritAttrs: false,
|
|
919
895
|
props: {
|
|
896
|
+
formCreateInject: Object,
|
|
920
897
|
modelValue: {
|
|
921
|
-
type: Array,
|
|
922
|
-
"default":
|
|
923
|
-
return [];
|
|
924
|
-
}
|
|
898
|
+
type: [Array, String, Number, Boolean, Object],
|
|
899
|
+
"default": undefined
|
|
925
900
|
},
|
|
926
901
|
type: String
|
|
927
902
|
},
|
|
928
903
|
emits: ['update:modelValue'],
|
|
929
904
|
setup: function setup(props) {
|
|
930
|
-
var
|
|
931
|
-
options = _toRefs.options;
|
|
932
|
-
|
|
905
|
+
var options = vue.toRef(props.formCreateInject, 'options', []);
|
|
933
906
|
var value = vue.toRef(props, 'modelValue');
|
|
934
907
|
|
|
935
|
-
var _options =
|
|
936
|
-
return Array.isArray(options) ? options : [];
|
|
937
|
-
}
|
|
908
|
+
var _options = function _options() {
|
|
909
|
+
return Array.isArray(options.value) ? options.value : [];
|
|
910
|
+
};
|
|
938
911
|
|
|
939
912
|
return {
|
|
940
913
|
options: _options,
|
|
@@ -953,7 +926,7 @@
|
|
|
953
926
|
}
|
|
954
927
|
}), _objectSpread2({
|
|
955
928
|
"default": function _default() {
|
|
956
|
-
return [_this.options.map(function (props, index) {
|
|
929
|
+
return [_this.options().map(function (props, index) {
|
|
957
930
|
return vue.createVNode(vue.resolveComponent("ElOption"), vue.mergeProps(props, {
|
|
958
931
|
"key": '' + index + props.value
|
|
959
932
|
}), null);
|
|
@@ -963,9 +936,9 @@
|
|
|
963
936
|
}
|
|
964
937
|
});
|
|
965
938
|
|
|
966
|
-
var NAME$
|
|
939
|
+
var NAME$5 = 'fcTree';
|
|
967
940
|
var Tree = vue.defineComponent({
|
|
968
|
-
name: NAME$
|
|
941
|
+
name: NAME$5,
|
|
969
942
|
inheritAttrs: false,
|
|
970
943
|
formCreateParser: {
|
|
971
944
|
mergeProp: function mergeProp(ctx) {
|
|
@@ -1027,7 +1000,7 @@
|
|
|
1027
1000
|
}
|
|
1028
1001
|
});
|
|
1029
1002
|
|
|
1030
|
-
var css_248z$1 = "._fc-
|
|
1003
|
+
var css_248z$1 = "._fc-exceed .el-upload{display:none}";
|
|
1031
1004
|
styleInject(css_248z$1);
|
|
1032
1005
|
|
|
1033
1006
|
function parseFile(file, i) {
|
|
@@ -1042,33 +1015,18 @@
|
|
|
1042
1015
|
return ('' + file).split('/').pop();
|
|
1043
1016
|
}
|
|
1044
1017
|
|
|
1045
|
-
var NAME$
|
|
1018
|
+
var NAME$4 = 'fcUpload';
|
|
1046
1019
|
var Upload = vue.defineComponent({
|
|
1047
|
-
name: NAME$
|
|
1020
|
+
name: NAME$4,
|
|
1048
1021
|
inheritAttrs: false,
|
|
1049
1022
|
props: {
|
|
1050
|
-
onHandle: Function,
|
|
1051
|
-
uploadType: {
|
|
1052
|
-
type: String,
|
|
1053
|
-
"default": 'file'
|
|
1054
|
-
},
|
|
1055
|
-
limit: {
|
|
1056
|
-
type: Number,
|
|
1057
|
-
"default": 0
|
|
1058
|
-
},
|
|
1059
|
-
allowRemove: {
|
|
1060
|
-
type: Boolean,
|
|
1061
|
-
"default": true
|
|
1062
|
-
},
|
|
1063
1023
|
previewMask: undefined,
|
|
1064
1024
|
modalTitle: String,
|
|
1065
|
-
handleIcon: [String, Boolean],
|
|
1066
1025
|
modelValue: [Array, String]
|
|
1067
1026
|
},
|
|
1068
|
-
emits: ['update:modelValue'],
|
|
1027
|
+
emits: ['update:modelValue', 'change', 'remove'],
|
|
1069
1028
|
data: function data() {
|
|
1070
1029
|
return {
|
|
1071
|
-
uploadList: [],
|
|
1072
1030
|
previewVisible: false,
|
|
1073
1031
|
previewImage: '',
|
|
1074
1032
|
fileList: []
|
|
@@ -1079,13 +1037,6 @@
|
|
|
1079
1037
|
},
|
|
1080
1038
|
watch: {
|
|
1081
1039
|
modelValue: function modelValue(n) {
|
|
1082
|
-
if (this.$refs.upload.uploadFiles.every(function (file) {
|
|
1083
|
-
return !file.status || file.status === 'success';
|
|
1084
|
-
})) {
|
|
1085
|
-
this.$refs.upload.uploadFiles = toArray(n).map(parseFile);
|
|
1086
|
-
this.uploadList = this.$refs.upload.uploadFiles;
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
1040
|
this.fileList = toArray(n).map(parseFile);
|
|
1090
1041
|
},
|
|
1091
1042
|
limit: function limit(n, o) {
|
|
@@ -1095,121 +1046,16 @@
|
|
|
1095
1046
|
}
|
|
1096
1047
|
},
|
|
1097
1048
|
methods: {
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
isDisabled: function isDisabled() {
|
|
1102
|
-
return this.$attrs.disabled === true;
|
|
1103
|
-
},
|
|
1104
|
-
onRemove: function onRemove(file) {
|
|
1105
|
-
if (this.isDisabled()) {
|
|
1106
|
-
return;
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
|
-
this.$refs.upload.handleRemove(file);
|
|
1110
|
-
},
|
|
1111
|
-
handleClick: function handleClick(file) {
|
|
1112
|
-
if (this.onHandle) {
|
|
1113
|
-
return this.onHandle(file);
|
|
1049
|
+
handlePreview: function handlePreview(file) {
|
|
1050
|
+
if (this.onPreview) {
|
|
1051
|
+
this.onPreview.apply(this, arguments);
|
|
1114
1052
|
} else {
|
|
1115
1053
|
this.previewImage = file.url;
|
|
1116
1054
|
this.previewVisible = true;
|
|
1117
1055
|
}
|
|
1118
1056
|
},
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
"src": file.url,
|
|
1122
|
-
"key": this.key('img' + index)
|
|
1123
|
-
}, null) : vue.createVNode("i", {
|
|
1124
|
-
"class": "el-icon-document",
|
|
1125
|
-
"key": this.key('i' + index)
|
|
1126
|
-
}, null);
|
|
1127
|
-
},
|
|
1128
|
-
makeRemoveIcon: function makeRemoveIcon(file, index) {
|
|
1129
|
-
var _this = this;
|
|
1130
|
-
|
|
1131
|
-
return vue.createVNode("i", {
|
|
1132
|
-
"class": "el-icon-delete",
|
|
1133
|
-
"onClick": function onClick() {
|
|
1134
|
-
return _this.onRemove(file);
|
|
1135
|
-
},
|
|
1136
|
-
"key": this.key('ri' + index)
|
|
1137
|
-
}, null);
|
|
1138
|
-
},
|
|
1139
|
-
makeHandleIcon: function makeHandleIcon(file, index) {
|
|
1140
|
-
var _this2 = this;
|
|
1141
|
-
|
|
1142
|
-
return vue.createVNode("i", {
|
|
1143
|
-
"class": this.handleIcon === true || this.handleIcon === undefined ? 'el-icon-view' : this.handleIcon,
|
|
1144
|
-
"onClick": function onClick() {
|
|
1145
|
-
return _this2.handleClick(file);
|
|
1146
|
-
},
|
|
1147
|
-
"key": this.key('hi' + index)
|
|
1148
|
-
}, null);
|
|
1149
|
-
},
|
|
1150
|
-
makeProgress: function makeProgress(file, index) {
|
|
1151
|
-
return vue.createVNode(vue.resolveComponent("ElProgress"), vue.mergeProps({
|
|
1152
|
-
percentage: file.percentage,
|
|
1153
|
-
type: 'circle',
|
|
1154
|
-
width: 52
|
|
1155
|
-
}, {
|
|
1156
|
-
"style": "margin-top:2px;",
|
|
1157
|
-
"key": this.key('pg' + index)
|
|
1158
|
-
}), null);
|
|
1159
|
-
},
|
|
1160
|
-
makeIcons: function makeIcons(file, index) {
|
|
1161
|
-
var icons = [];
|
|
1162
|
-
|
|
1163
|
-
if (this.allowRemove || this.handleIcon !== false) {
|
|
1164
|
-
if (this.uploadType !== 'file' && this.handleIcon !== false || this.uploadType === 'file' && this.handleIcon) {
|
|
1165
|
-
icons.push(this.makeHandleIcon(file, index));
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
|
-
if (this.allowRemove) {
|
|
1169
|
-
icons.push(this.makeRemoveIcon(file, index));
|
|
1170
|
-
}
|
|
1171
|
-
|
|
1172
|
-
return vue.createVNode("div", {
|
|
1173
|
-
"class": 'fc-upload-cover'
|
|
1174
|
-
}, [icons]);
|
|
1175
|
-
}
|
|
1176
|
-
},
|
|
1177
|
-
makeFiles: function makeFiles() {
|
|
1178
|
-
var _this3 = this;
|
|
1179
|
-
|
|
1180
|
-
return this.uploadList.map(function (file, index) {
|
|
1181
|
-
return vue.createVNode("div", {
|
|
1182
|
-
"key": _this3.key(index),
|
|
1183
|
-
"class": 'fc-files'
|
|
1184
|
-
}, [file.percentage !== undefined && file.status !== 'success' ? _this3.makeProgress(file, index) : [_this3.makeItem(file, index), _this3.makeIcons(file, index)]]);
|
|
1185
|
-
});
|
|
1186
|
-
},
|
|
1187
|
-
makeUpload: function makeUpload() {
|
|
1188
|
-
var _this$$slots$default,
|
|
1189
|
-
_this$$slots,
|
|
1190
|
-
_this4 = this;
|
|
1191
|
-
|
|
1192
|
-
var isShow = !this.limit || this.limit > this.uploadList.length;
|
|
1193
|
-
return vue.createVNode(vue.resolveComponent("ElUpload"), vue.mergeProps(this.$attrs, {
|
|
1194
|
-
"showFileList": false,
|
|
1195
|
-
"fileList": this.fileList,
|
|
1196
|
-
"ref": "upload",
|
|
1197
|
-
"style": {
|
|
1198
|
-
display: 'inline-block'
|
|
1199
|
-
},
|
|
1200
|
-
"key": this.key('upload')
|
|
1201
|
-
}), _objectSpread2({
|
|
1202
|
-
"default": function _default() {
|
|
1203
|
-
return [isShow ? ((_this$$slots$default = (_this$$slots = _this4.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)) || vue.createVNode("div", {
|
|
1204
|
-
"class": 'fc-upload-btn'
|
|
1205
|
-
}, [vue.createVNode("i", {
|
|
1206
|
-
"class": "el-icon-upload2"
|
|
1207
|
-
}, null)]) : undefined];
|
|
1208
|
-
}
|
|
1209
|
-
}, getSlot(this.$slots, ['default'])));
|
|
1210
|
-
},
|
|
1211
|
-
update: function update() {
|
|
1212
|
-
var files = this.$refs.upload.uploadFiles.map(function (file) {
|
|
1057
|
+
update: function update(fileList) {
|
|
1058
|
+
var files = fileList.map(function (file) {
|
|
1213
1059
|
return file.url;
|
|
1214
1060
|
}).filter(function (url) {
|
|
1215
1061
|
return url !== undefined;
|
|
@@ -1218,14 +1064,44 @@
|
|
|
1218
1064
|
},
|
|
1219
1065
|
handleCancel: function handleCancel() {
|
|
1220
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);
|
|
1221
1078
|
}
|
|
1222
1079
|
},
|
|
1223
1080
|
render: function render() {
|
|
1224
|
-
var
|
|
1081
|
+
var _this$$slots$default,
|
|
1082
|
+
_this$$slots,
|
|
1083
|
+
_this = this;
|
|
1225
1084
|
|
|
1226
|
-
return vue.createVNode("
|
|
1227
|
-
"
|
|
1228
|
-
|
|
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"), {
|
|
1229
1105
|
"appendToBody": true,
|
|
1230
1106
|
"modal": this.previewMask,
|
|
1231
1107
|
"title": this.modalTitle,
|
|
@@ -1234,24 +1110,11 @@
|
|
|
1234
1110
|
}, {
|
|
1235
1111
|
"default": function _default() {
|
|
1236
1112
|
return [vue.createVNode("img", {
|
|
1237
|
-
"alt": "example",
|
|
1238
1113
|
"style": "width: 100%",
|
|
1239
|
-
"src":
|
|
1114
|
+
"src": _this.previewImage
|
|
1240
1115
|
}, null)];
|
|
1241
1116
|
}
|
|
1242
1117
|
})]);
|
|
1243
|
-
},
|
|
1244
|
-
mounted: function mounted() {
|
|
1245
|
-
var _this6 = this;
|
|
1246
|
-
|
|
1247
|
-
this.uploadList = this.$refs.upload.uploadFiles;
|
|
1248
|
-
this.$watch(function () {
|
|
1249
|
-
return _this6.$refs.upload.uploadFiles;
|
|
1250
|
-
}, function () {
|
|
1251
|
-
_this6.update();
|
|
1252
|
-
}, {
|
|
1253
|
-
deep: true
|
|
1254
|
-
});
|
|
1255
1118
|
}
|
|
1256
1119
|
});
|
|
1257
1120
|
|
|
@@ -1282,9 +1145,9 @@
|
|
|
1282
1145
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
1283
1146
|
}
|
|
1284
1147
|
|
|
1285
|
-
var NAME$
|
|
1148
|
+
var NAME$3 = 'fcGroup';
|
|
1286
1149
|
var Group = vue.defineComponent({
|
|
1287
|
-
name: NAME$
|
|
1150
|
+
name: NAME$3,
|
|
1288
1151
|
props: {
|
|
1289
1152
|
field: String,
|
|
1290
1153
|
rule: Array,
|
|
@@ -1327,9 +1190,9 @@
|
|
|
1327
1190
|
onBeforeAdd: {
|
|
1328
1191
|
type: Function,
|
|
1329
1192
|
"default": function _default() {}
|
|
1330
|
-
}
|
|
1193
|
+
},
|
|
1194
|
+
formCreateInject: Object
|
|
1331
1195
|
},
|
|
1332
|
-
inject: ['formCreateInject'],
|
|
1333
1196
|
data: function data() {
|
|
1334
1197
|
return {
|
|
1335
1198
|
len: 0,
|
|
@@ -1386,7 +1249,8 @@
|
|
|
1386
1249
|
});
|
|
1387
1250
|
}
|
|
1388
1251
|
},
|
|
1389
|
-
deep: true
|
|
1252
|
+
deep: true,
|
|
1253
|
+
flush: 'post'
|
|
1390
1254
|
}
|
|
1391
1255
|
},
|
|
1392
1256
|
methods: {
|
|
@@ -1506,24 +1370,31 @@
|
|
|
1506
1370
|
this.input(this.modelValue);
|
|
1507
1371
|
},
|
|
1508
1372
|
addIcon: function addIcon(key) {
|
|
1509
|
-
return vue.createVNode("
|
|
1373
|
+
return vue.createVNode(vue.resolveComponent("el-icon"), {
|
|
1510
1374
|
"key": "a".concat(key),
|
|
1511
|
-
"class": "el-icon-circle-plus-outline",
|
|
1512
1375
|
"style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer', ";"),
|
|
1513
1376
|
"onClick": this.add
|
|
1514
|
-
},
|
|
1377
|
+
}, {
|
|
1378
|
+
"default": function _default() {
|
|
1379
|
+
return [vue.createVNode(vue.resolveComponent("circle-plus"), null, null)];
|
|
1380
|
+
}
|
|
1381
|
+
});
|
|
1515
1382
|
},
|
|
1516
1383
|
delIcon: function delIcon(index, key) {
|
|
1517
1384
|
var _this7 = this;
|
|
1518
1385
|
|
|
1519
|
-
return vue.createVNode("
|
|
1386
|
+
return vue.createVNode(vue.resolveComponent("ElIcon"), {
|
|
1520
1387
|
"key": "d".concat(key),
|
|
1521
1388
|
"class": "el-icon-remove-outline",
|
|
1522
1389
|
"style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer;color:#606266', ";"),
|
|
1523
1390
|
"onClick": function onClick() {
|
|
1524
1391
|
return _this7.del(index, key);
|
|
1525
1392
|
}
|
|
1526
|
-
},
|
|
1393
|
+
}, {
|
|
1394
|
+
"default": function _default() {
|
|
1395
|
+
return [vue.createVNode(vue.resolveComponent("remove"), null, null)];
|
|
1396
|
+
}
|
|
1397
|
+
});
|
|
1527
1398
|
},
|
|
1528
1399
|
makeIcon: function makeIcon(total, index, key) {
|
|
1529
1400
|
var _this8 = this;
|
|
@@ -1561,13 +1432,13 @@
|
|
|
1561
1432
|
created: function created() {
|
|
1562
1433
|
var d = (this.expand || 0) - this.modelValue.length;
|
|
1563
1434
|
|
|
1564
|
-
if (d > 0) {
|
|
1565
|
-
this.expandRule(d);
|
|
1566
|
-
}
|
|
1567
|
-
|
|
1568
1435
|
for (var i = 0; i < this.modelValue.length; i++) {
|
|
1569
1436
|
this.addRule(i);
|
|
1570
1437
|
}
|
|
1438
|
+
|
|
1439
|
+
if (d > 0) {
|
|
1440
|
+
this.expandRule(d);
|
|
1441
|
+
}
|
|
1571
1442
|
},
|
|
1572
1443
|
render: function render() {
|
|
1573
1444
|
var _this9 = this;
|
|
@@ -1579,12 +1450,12 @@
|
|
|
1579
1450
|
vm: this,
|
|
1580
1451
|
add: this.add
|
|
1581
1452
|
}) : vue.createVNode("i", {
|
|
1582
|
-
"key":
|
|
1453
|
+
"key": 1,
|
|
1583
1454
|
"class": "el-icon-circle-plus-outline",
|
|
1584
1455
|
"style": "font-size:".concat(this.fontSize, "px;vertical-align:middle;color:").concat(this.disabled ? '#c9cdd4;cursor: not-allowed' : '#606266;cursor:pointer', ";"),
|
|
1585
1456
|
"onClick": this.add
|
|
1586
1457
|
}, null) : vue.createVNode("div", {
|
|
1587
|
-
"key":
|
|
1458
|
+
"key": 2
|
|
1588
1459
|
}, [keys.map(function (key, index) {
|
|
1589
1460
|
var _slot;
|
|
1590
1461
|
|
|
@@ -1642,9 +1513,9 @@
|
|
|
1642
1513
|
}
|
|
1643
1514
|
});
|
|
1644
1515
|
|
|
1645
|
-
var NAME$
|
|
1516
|
+
var NAME$2 = 'fcSubForm';
|
|
1646
1517
|
var Sub = vue.defineComponent({
|
|
1647
|
-
name: NAME$
|
|
1518
|
+
name: NAME$2,
|
|
1648
1519
|
props: {
|
|
1649
1520
|
rule: Array,
|
|
1650
1521
|
options: {
|
|
@@ -1669,9 +1540,9 @@
|
|
|
1669
1540
|
syncDisabled: {
|
|
1670
1541
|
type: Boolean,
|
|
1671
1542
|
"default": true
|
|
1672
|
-
}
|
|
1543
|
+
},
|
|
1544
|
+
formCreateInject: Object
|
|
1673
1545
|
},
|
|
1674
|
-
inject: ['formCreateInject'],
|
|
1675
1546
|
data: function data() {
|
|
1676
1547
|
return {
|
|
1677
1548
|
cacheValue: {},
|
|
@@ -1732,10 +1603,10 @@
|
|
|
1732
1603
|
|
|
1733
1604
|
var components = [Checkbox, Frame, Radio, Select, Tree, Upload, Group, Sub];
|
|
1734
1605
|
|
|
1735
|
-
var NAME$
|
|
1606
|
+
var NAME$1 = 'FormCreate';
|
|
1736
1607
|
function $FormCreate(FormCreate) {
|
|
1737
1608
|
return vue.defineComponent({
|
|
1738
|
-
name: NAME$
|
|
1609
|
+
name: NAME$1,
|
|
1739
1610
|
props: {
|
|
1740
1611
|
rule: {
|
|
1741
1612
|
type: Array,
|
|
@@ -1752,22 +1623,24 @@
|
|
|
1752
1623
|
},
|
|
1753
1624
|
extendOption: Boolean,
|
|
1754
1625
|
modelValue: Object,
|
|
1755
|
-
api: Object
|
|
1626
|
+
api: Object,
|
|
1627
|
+
name: String
|
|
1756
1628
|
},
|
|
1757
|
-
emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync'],
|
|
1629
|
+
emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync', 'reload', 'repeat-field', 'update'],
|
|
1758
1630
|
render: function render() {
|
|
1759
1631
|
return this.fc.render();
|
|
1760
1632
|
},
|
|
1761
1633
|
setup: function setup(props) {
|
|
1762
1634
|
var vm = vue.getCurrentInstance();
|
|
1763
1635
|
vue.provide('parentFC', vm);
|
|
1764
|
-
var parent = vue.inject('parentFC');
|
|
1636
|
+
var parent = vue.inject('parentFC', null);
|
|
1765
1637
|
|
|
1766
1638
|
var _toRefs = vue.toRefs(props),
|
|
1767
1639
|
rule = _toRefs.rule,
|
|
1768
1640
|
modelValue = _toRefs.modelValue;
|
|
1769
1641
|
|
|
1770
1642
|
var data = vue.reactive({
|
|
1643
|
+
ctxInject: {},
|
|
1771
1644
|
destroyed: false,
|
|
1772
1645
|
isShow: true,
|
|
1773
1646
|
unique: 1,
|
|
@@ -1956,14 +1829,18 @@
|
|
|
1956
1829
|
}
|
|
1957
1830
|
|
|
1958
1831
|
origin[key] = deepExtend(origin[key], clone, mode);
|
|
1959
|
-
} else if (is.Undef(clone)) {
|
|
1960
|
-
$set(origin, key, clone);
|
|
1961
|
-
} else if (clone.__json !== undefined) {
|
|
1962
|
-
$set(origin, key, clone.__json);
|
|
1963
|
-
} else if (clone.__origin !== undefined) {
|
|
1964
|
-
$set(origin, key, clone.__origin);
|
|
1965
1832
|
} else {
|
|
1966
1833
|
$set(origin, key, clone);
|
|
1834
|
+
|
|
1835
|
+
if (!is.Undef(clone)) {
|
|
1836
|
+
if (!is.Undef(clone.__json)) {
|
|
1837
|
+
origin[key].__json = clone.__json;
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
if (!is.Undef(clone.__origin)) {
|
|
1841
|
+
origin[key].__origin = clone.__origin;
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1967
1844
|
}
|
|
1968
1845
|
}
|
|
1969
1846
|
}
|
|
@@ -2011,7 +1888,7 @@
|
|
|
2011
1888
|
return val;
|
|
2012
1889
|
}
|
|
2013
1890
|
|
|
2014
|
-
if (
|
|
1891
|
+
if (val.__json) {
|
|
2015
1892
|
return val.__json;
|
|
2016
1893
|
}
|
|
2017
1894
|
|
|
@@ -2212,33 +2089,6 @@
|
|
|
2212
2089
|
return prop;
|
|
2213
2090
|
}
|
|
2214
2091
|
|
|
2215
|
-
function toString(val) {
|
|
2216
|
-
return val == null ? '' : _typeof(val) === 'object' ? JSON.stringify(val, null, 2) : String(val);
|
|
2217
|
-
}
|
|
2218
|
-
|
|
2219
|
-
var id$1 = 0;
|
|
2220
|
-
function uniqueId() {
|
|
2221
|
-
return Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now()).concat(++id$1)).toString(36);
|
|
2222
|
-
}
|
|
2223
|
-
|
|
2224
|
-
function deepSet(data, idx, val) {
|
|
2225
|
-
var _data = data,
|
|
2226
|
-
to;
|
|
2227
|
-
(idx || '').split('.').forEach(function (v) {
|
|
2228
|
-
if (to) {
|
|
2229
|
-
if (!_data[to] || _typeof(_data[to]) != 'object') {
|
|
2230
|
-
_data[to] = {};
|
|
2231
|
-
}
|
|
2232
|
-
|
|
2233
|
-
_data = _data[to];
|
|
2234
|
-
}
|
|
2235
|
-
|
|
2236
|
-
to = v;
|
|
2237
|
-
});
|
|
2238
|
-
_data[to] = val;
|
|
2239
|
-
return _data;
|
|
2240
|
-
}
|
|
2241
|
-
|
|
2242
2092
|
function baseRule() {
|
|
2243
2093
|
return {
|
|
2244
2094
|
props: {},
|
|
@@ -2344,11 +2194,6 @@
|
|
|
2344
2194
|
}
|
|
2345
2195
|
|
|
2346
2196
|
var api = {
|
|
2347
|
-
helper: {
|
|
2348
|
-
tidyFields: tidyFields,
|
|
2349
|
-
props: props
|
|
2350
|
-
},
|
|
2351
|
-
|
|
2352
2197
|
get config() {
|
|
2353
2198
|
return h.options;
|
|
2354
2199
|
},
|
|
@@ -2444,7 +2289,8 @@
|
|
|
2444
2289
|
|
|
2445
2290
|
if (ctx) {
|
|
2446
2291
|
if (child) {
|
|
2447
|
-
rules = ctx.rule.children;
|
|
2292
|
+
rules = ctx.getPending('children', ctx.rule.children);
|
|
2293
|
+
if (!Array.isArray(rules)) return;
|
|
2448
2294
|
index = ctx.rule.children.length - 1;
|
|
2449
2295
|
} else {
|
|
2450
2296
|
index = ctx.root.indexOf(ctx.origin);
|
|
@@ -2461,7 +2307,8 @@
|
|
|
2461
2307
|
|
|
2462
2308
|
if (ctx) {
|
|
2463
2309
|
if (child) {
|
|
2464
|
-
rules = ctx.rule.children;
|
|
2310
|
+
rules = ctx.getPending('children', ctx.rule.children);
|
|
2311
|
+
if (!Array.isArray(rules)) return;
|
|
2465
2312
|
} else {
|
|
2466
2313
|
index = ctx.root.indexOf(ctx.origin);
|
|
2467
2314
|
rules = ctx.root;
|
|
@@ -2496,6 +2343,12 @@
|
|
|
2496
2343
|
});
|
|
2497
2344
|
h.refresh();
|
|
2498
2345
|
},
|
|
2346
|
+
all: function all(origin) {
|
|
2347
|
+
return Object.keys(h.ctxs).map(function (k) {
|
|
2348
|
+
var ctx = h.ctxs[k];
|
|
2349
|
+
return origin ? ctx.origin : ctx.rule;
|
|
2350
|
+
});
|
|
2351
|
+
},
|
|
2499
2352
|
model: function model(origin) {
|
|
2500
2353
|
return h.fields().reduce(function (initial, key) {
|
|
2501
2354
|
var ctx = h.fieldCtx[key][0];
|
|
@@ -2681,6 +2534,19 @@
|
|
|
2681
2534
|
nextRefresh: function nextRefresh(fn) {
|
|
2682
2535
|
h.nextRefresh();
|
|
2683
2536
|
fn && invoke(fn);
|
|
2537
|
+
},
|
|
2538
|
+
emit: function emit(name) {
|
|
2539
|
+
var _h$vm;
|
|
2540
|
+
|
|
2541
|
+
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
2542
|
+
args[_key3 - 1] = arguments[_key3];
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
(_h$vm = h.vm).emit.apply(_h$vm, [name].concat(args));
|
|
2546
|
+
},
|
|
2547
|
+
helper: {
|
|
2548
|
+
tidyFields: tidyFields,
|
|
2549
|
+
props: props
|
|
2684
2550
|
}
|
|
2685
2551
|
};
|
|
2686
2552
|
['on', 'once', 'off', 'set'].forEach(function (n) {
|
|
@@ -2742,11 +2608,55 @@
|
|
|
2742
2608
|
return str.replace(str[0], str[0].toLowerCase());
|
|
2743
2609
|
}
|
|
2744
2610
|
|
|
2611
|
+
function toString(val) {
|
|
2612
|
+
return val == null ? '' : _typeof(val) === 'object' ? JSON.stringify(val, null, 2) : String(val);
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2615
|
+
var id$2 = 0;
|
|
2616
|
+
function uniqueId() {
|
|
2617
|
+
return Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now()).concat(++id$2)).toString(36);
|
|
2618
|
+
}
|
|
2619
|
+
|
|
2620
|
+
function deepSet(data, idx, val) {
|
|
2621
|
+
var _data = data,
|
|
2622
|
+
to;
|
|
2623
|
+
(idx || '').split('.').forEach(function (v) {
|
|
2624
|
+
if (to) {
|
|
2625
|
+
if (!_data[to] || _typeof(_data[to]) != 'object') {
|
|
2626
|
+
_data[to] = {};
|
|
2627
|
+
}
|
|
2628
|
+
|
|
2629
|
+
_data = _data[to];
|
|
2630
|
+
}
|
|
2631
|
+
|
|
2632
|
+
to = v;
|
|
2633
|
+
});
|
|
2634
|
+
_data[to] = val;
|
|
2635
|
+
return _data;
|
|
2636
|
+
}
|
|
2637
|
+
|
|
2745
2638
|
function useRender$1(Render) {
|
|
2746
2639
|
extend(Render.prototype, {
|
|
2747
2640
|
initRender: function initRender() {
|
|
2748
2641
|
this.cacheConfig = {};
|
|
2749
2642
|
},
|
|
2643
|
+
getTypeSlot: function getTypeSlot(type) {
|
|
2644
|
+
var name = 'type-' + toLine(type);
|
|
2645
|
+
|
|
2646
|
+
var _fn = function _fn(vm) {
|
|
2647
|
+
if (vm) {
|
|
2648
|
+
var slot = vm.slots[name] || vm.slots['type-' + type];
|
|
2649
|
+
|
|
2650
|
+
if (slot) {
|
|
2651
|
+
return slot;
|
|
2652
|
+
}
|
|
2653
|
+
|
|
2654
|
+
return _fn(vm.setupState.parent);
|
|
2655
|
+
}
|
|
2656
|
+
};
|
|
2657
|
+
|
|
2658
|
+
return _fn(this.vm);
|
|
2659
|
+
},
|
|
2750
2660
|
render: function render() {
|
|
2751
2661
|
var _this = this;
|
|
2752
2662
|
|
|
@@ -2767,7 +2677,7 @@
|
|
|
2767
2677
|
ctx.initProp();
|
|
2768
2678
|
this.mergeGlobal(ctx);
|
|
2769
2679
|
ctx.initNone();
|
|
2770
|
-
var slots = this.renderChildren(ctx);
|
|
2680
|
+
var slots = this.renderChildren(ctx.loadChildrenPending(), ctx);
|
|
2771
2681
|
var def = slots["default"];
|
|
2772
2682
|
def && slotBag.setSlot(ctx.rule.slot, function () {
|
|
2773
2683
|
return def();
|
|
@@ -2794,8 +2704,15 @@
|
|
|
2794
2704
|
ctx.prop = mergeRule({}, [this.cacheConfig[ctx.trueType].value, ctx.prop]);
|
|
2795
2705
|
},
|
|
2796
2706
|
setOptions: function setOptions(ctx) {
|
|
2797
|
-
|
|
2798
|
-
|
|
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);
|
|
2799
2716
|
}
|
|
2800
2717
|
},
|
|
2801
2718
|
deepSet: function deepSet$1(ctx) {
|
|
@@ -2824,49 +2741,54 @@
|
|
|
2824
2741
|
renderCtx: function renderCtx(ctx, parent) {
|
|
2825
2742
|
var _this4 = this;
|
|
2826
2743
|
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
ctx.
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
this.
|
|
2843
|
-
|
|
2844
|
-
|
|
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
|
+
}
|
|
2845
2765
|
|
|
2846
|
-
|
|
2847
|
-
return _this4.item(ctx, function () {
|
|
2766
|
+
vn = function vn() {
|
|
2848
2767
|
var children = {};
|
|
2849
2768
|
|
|
2769
|
+
var _load = ctx.loadChildrenPending();
|
|
2770
|
+
|
|
2850
2771
|
if (ctx.parser.renderChildren) {
|
|
2851
|
-
children = ctx.parser.renderChildren(ctx);
|
|
2772
|
+
children = ctx.parser.renderChildren(_load, ctx);
|
|
2852
2773
|
} else if (ctx.parser.loadChildren !== false) {
|
|
2853
|
-
children = _this4.renderChildren(ctx);
|
|
2774
|
+
children = _this4.renderChildren(_load, ctx);
|
|
2854
2775
|
}
|
|
2855
2776
|
|
|
2856
|
-
var slot =
|
|
2777
|
+
var slot = _this4.getTypeSlot(ctx.type);
|
|
2857
2778
|
|
|
2858
2779
|
var _vn;
|
|
2859
2780
|
|
|
2860
|
-
if (
|
|
2861
|
-
_vn =
|
|
2781
|
+
if (slot) {
|
|
2782
|
+
_vn = slot({
|
|
2862
2783
|
rule: rule,
|
|
2863
2784
|
prop: prop,
|
|
2785
|
+
preview: preview,
|
|
2864
2786
|
children: children,
|
|
2865
2787
|
api: _this4.$handle.api,
|
|
2866
2788
|
model: prop.model || {}
|
|
2867
2789
|
});
|
|
2868
2790
|
} else {
|
|
2869
|
-
_vn = ctx.parser.
|
|
2791
|
+
_vn = preview ? ctx.parser.preview(children, ctx) : ctx.parser.render(children, ctx);
|
|
2870
2792
|
}
|
|
2871
2793
|
|
|
2872
2794
|
_vn = _this4.renderSides(_vn, ctx);
|
|
@@ -2879,16 +2801,22 @@
|
|
|
2879
2801
|
_vn = _this4.display(_vn);
|
|
2880
2802
|
}
|
|
2881
2803
|
|
|
2804
|
+
_this4.setCache(ctx, function () {
|
|
2805
|
+
return _vn;
|
|
2806
|
+
}, parent);
|
|
2807
|
+
|
|
2882
2808
|
return _vn;
|
|
2883
|
-
}
|
|
2884
|
-
};
|
|
2809
|
+
};
|
|
2885
2810
|
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
}
|
|
2811
|
+
this.setCache(ctx, vn, parent);
|
|
2812
|
+
return vn;
|
|
2813
|
+
}
|
|
2890
2814
|
|
|
2891
|
-
|
|
2815
|
+
return this.getCache(ctx);
|
|
2816
|
+
} catch (e) {
|
|
2817
|
+
console.error(e);
|
|
2818
|
+
return;
|
|
2819
|
+
}
|
|
2892
2820
|
},
|
|
2893
2821
|
getModelField: function getModelField(ctx) {
|
|
2894
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';
|
|
@@ -2922,29 +2850,36 @@
|
|
|
2922
2850
|
return vn;
|
|
2923
2851
|
}
|
|
2924
2852
|
},
|
|
2925
|
-
item: function item(ctx, vn) {
|
|
2926
|
-
return this.vNode.h('FcFragment', {
|
|
2927
|
-
key: ctx.prop.key,
|
|
2928
|
-
formCreateInject: this.injectProp(ctx)
|
|
2929
|
-
}, vn);
|
|
2930
|
-
},
|
|
2931
2853
|
isFragment: function isFragment(ctx) {
|
|
2932
2854
|
return ctx.type === 'fragment' || ctx.type === 'template';
|
|
2933
2855
|
},
|
|
2934
2856
|
injectProp: function injectProp(ctx) {
|
|
2935
2857
|
var _this6 = this;
|
|
2936
2858
|
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
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, {
|
|
2878
|
+
preview: this.options.preview || false,
|
|
2879
|
+
options: ctx.prop.options,
|
|
2880
|
+
children: ctx.loadChildrenPending()
|
|
2881
|
+
});
|
|
2882
|
+
return inject;
|
|
2948
2883
|
},
|
|
2949
2884
|
ctxProp: function ctxProp(ctx, custom) {
|
|
2950
2885
|
var _this7 = this;
|
|
@@ -2988,10 +2923,9 @@
|
|
|
2988
2923
|
onInput: function onInput(ctx, value) {
|
|
2989
2924
|
this.$handle.onInput(ctx, value);
|
|
2990
2925
|
},
|
|
2991
|
-
renderChildren: function renderChildren(ctx) {
|
|
2926
|
+
renderChildren: function renderChildren(children, ctx) {
|
|
2992
2927
|
var _this8 = this;
|
|
2993
2928
|
|
|
2994
|
-
var children = ctx.rule.children;
|
|
2995
2929
|
if (!is.trueArray(children)) return {};
|
|
2996
2930
|
var slotBag = makeSlotBag();
|
|
2997
2931
|
children.map(function (child) {
|
|
@@ -3048,12 +2982,16 @@
|
|
|
3048
2982
|
});
|
|
3049
2983
|
}
|
|
3050
2984
|
|
|
3051
|
-
|
|
2985
|
+
var props = _objectSpread2({}, rule);
|
|
2986
|
+
|
|
2987
|
+
delete props.type;
|
|
2988
|
+
delete props.is;
|
|
2989
|
+
return this.vNode.make(type, props, slotBag.mergeBag(children).getSlots());
|
|
3052
2990
|
}
|
|
3053
2991
|
});
|
|
3054
2992
|
}
|
|
3055
2993
|
|
|
3056
|
-
var id = 1;
|
|
2994
|
+
var id$1 = 1;
|
|
3057
2995
|
function Render(handle) {
|
|
3058
2996
|
extend(this, {
|
|
3059
2997
|
$handle: handle,
|
|
@@ -3061,7 +2999,7 @@
|
|
|
3061
2999
|
vm: handle.vm,
|
|
3062
3000
|
$manager: handle.$manager,
|
|
3063
3001
|
vNode: new handle.fc.CreateNode(handle.vm),
|
|
3064
|
-
id: id++
|
|
3002
|
+
id: id$1++
|
|
3065
3003
|
});
|
|
3066
3004
|
funcProxy(this, {
|
|
3067
3005
|
options: function options() {
|
|
@@ -3309,6 +3247,7 @@
|
|
|
3309
3247
|
rule: rule,
|
|
3310
3248
|
origin: rule.__origin__ || rule,
|
|
3311
3249
|
name: rule.name,
|
|
3250
|
+
pending: {},
|
|
3312
3251
|
none: false,
|
|
3313
3252
|
watch: [],
|
|
3314
3253
|
linkOn: [],
|
|
@@ -3331,6 +3270,102 @@
|
|
|
3331
3270
|
this.update(handle, true);
|
|
3332
3271
|
}
|
|
3333
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
|
+
},
|
|
3334
3369
|
effectData: function effectData(name) {
|
|
3335
3370
|
if (!this.payload[name]) {
|
|
3336
3371
|
this.payload[name] = {};
|
|
@@ -3354,13 +3389,13 @@
|
|
|
3354
3389
|
parser.init(this);
|
|
3355
3390
|
},
|
|
3356
3391
|
initProp: function initProp() {
|
|
3357
|
-
var
|
|
3392
|
+
var _this3 = this;
|
|
3358
3393
|
|
|
3359
3394
|
var rule = _objectSpread2({}, this.rule);
|
|
3360
3395
|
|
|
3361
3396
|
delete rule.children;
|
|
3362
3397
|
this.prop = mergeProps([rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
|
|
3363
|
-
return
|
|
3398
|
+
return _this3.payload[k];
|
|
3364
3399
|
})), [this.computed]));
|
|
3365
3400
|
},
|
|
3366
3401
|
initNone: function initNone() {
|
|
@@ -3387,10 +3422,10 @@
|
|
|
3387
3422
|
this.$handle.appendLink(this);
|
|
3388
3423
|
},
|
|
3389
3424
|
watchTo: function watchTo() {
|
|
3390
|
-
var
|
|
3425
|
+
var _this4 = this;
|
|
3391
3426
|
|
|
3392
3427
|
vue.nextTick(function () {
|
|
3393
|
-
|
|
3428
|
+
_this4.$handle && _this4.$handle.watchCtx(_this4);
|
|
3394
3429
|
});
|
|
3395
3430
|
},
|
|
3396
3431
|
"delete": function _delete() {
|
|
@@ -3420,15 +3455,15 @@
|
|
|
3420
3455
|
this.ctrlRule = [];
|
|
3421
3456
|
},
|
|
3422
3457
|
rm: function rm() {
|
|
3423
|
-
var
|
|
3458
|
+
var _this5 = this;
|
|
3424
3459
|
|
|
3425
3460
|
var _rm = function _rm() {
|
|
3426
|
-
var index =
|
|
3461
|
+
var index = _this5.root.indexOf(_this5.origin);
|
|
3427
3462
|
|
|
3428
3463
|
if (index > -1) {
|
|
3429
|
-
|
|
3464
|
+
_this5.root.splice(index, 1);
|
|
3430
3465
|
|
|
3431
|
-
|
|
3466
|
+
_this5.$handle && _this5.$handle.refresh();
|
|
3432
3467
|
}
|
|
3433
3468
|
};
|
|
3434
3469
|
|
|
@@ -3439,17 +3474,17 @@
|
|
|
3439
3474
|
}
|
|
3440
3475
|
|
|
3441
3476
|
this.$handle.noWatch(function () {
|
|
3442
|
-
|
|
3443
|
-
|
|
3477
|
+
_this5.$handle.deferSyncValue(function () {
|
|
3478
|
+
_this5.rmCtrl();
|
|
3444
3479
|
|
|
3445
3480
|
_rm();
|
|
3446
3481
|
|
|
3447
|
-
|
|
3482
|
+
_this5.$handle.rmCtx(_this5);
|
|
3448
3483
|
|
|
3449
|
-
extend(
|
|
3484
|
+
extend(_this5, {
|
|
3450
3485
|
root: []
|
|
3451
3486
|
});
|
|
3452
|
-
},
|
|
3487
|
+
}, _this5.input);
|
|
3453
3488
|
});
|
|
3454
3489
|
},
|
|
3455
3490
|
update: function update(handle, init) {
|
|
@@ -3488,7 +3523,6 @@
|
|
|
3488
3523
|
});
|
|
3489
3524
|
fullRule(rule);
|
|
3490
3525
|
this.appendValue(rule);
|
|
3491
|
-
rule.options = Array.isArray(rule.options) ? rule.options : [];
|
|
3492
3526
|
[rule, rule['prefix'], rule['suffix']].forEach(function (item) {
|
|
3493
3527
|
if (!item) {
|
|
3494
3528
|
return;
|
|
@@ -3608,7 +3642,7 @@
|
|
|
3608
3642
|
if (!is.Object(_rule) || !getRule(_rule).type) return err('未定义生成规则的 type 字段', _rule);
|
|
3609
3643
|
|
|
3610
3644
|
if (_rule.__fc__ && _rule.__fc__.root === rules && _this6.ctxs[_rule.__fc__.id]) {
|
|
3611
|
-
loadChildren(_rule.__fc__.
|
|
3645
|
+
loadChildren(_rule.__fc__.loadChildrenPending(), _rule.__fc__);
|
|
3612
3646
|
return _rule.__fc__;
|
|
3613
3647
|
}
|
|
3614
3648
|
|
|
@@ -3679,7 +3713,10 @@
|
|
|
3679
3713
|
_this6.setCtx(ctx);
|
|
3680
3714
|
|
|
3681
3715
|
!isCopy && !isInit && _this6.effect(ctx, 'load');
|
|
3682
|
-
|
|
3716
|
+
|
|
3717
|
+
var _load = ctx.loadChildrenPending();
|
|
3718
|
+
|
|
3719
|
+
ctx.parser.loadChildren === false || loadChildren(_load, ctx);
|
|
3683
3720
|
|
|
3684
3721
|
if (!parent) {
|
|
3685
3722
|
var _preIndex = preIndex(index);
|
|
@@ -3775,7 +3812,7 @@
|
|
|
3775
3812
|
if (valid) {
|
|
3776
3813
|
flag = true;
|
|
3777
3814
|
var ruleCon = {
|
|
3778
|
-
type: '
|
|
3815
|
+
type: 'fragment',
|
|
3779
3816
|
"native": true,
|
|
3780
3817
|
__ctrl: true,
|
|
3781
3818
|
children: rule
|
|
@@ -3832,6 +3869,7 @@
|
|
|
3832
3869
|
this.refresh();
|
|
3833
3870
|
this.bus.$off('next-tick', this.nextReload);
|
|
3834
3871
|
this.bus.$once('next-tick', this.nextReload);
|
|
3872
|
+
this.bus.$emit('update', this.api);
|
|
3835
3873
|
},
|
|
3836
3874
|
//todo 组件生成全部通过 alias
|
|
3837
3875
|
refresh: function refresh() {
|
|
@@ -3875,7 +3913,7 @@
|
|
|
3875
3913
|
this.setFormData(ctx, formValue);
|
|
3876
3914
|
this.syncValue();
|
|
3877
3915
|
this.valueChange(ctx, value);
|
|
3878
|
-
this.vm.emit('change', ctx.field, value, ctx.origin, this.api, setFlag);
|
|
3916
|
+
this.vm.emit('change', ctx.field, value, ctx.origin, this.api, setFlag || false);
|
|
3879
3917
|
this.effect(ctx, 'value');
|
|
3880
3918
|
},
|
|
3881
3919
|
onInput: function onInput(ctx, value) {
|
|
@@ -3886,7 +3924,7 @@
|
|
|
3886
3924
|
}
|
|
3887
3925
|
},
|
|
3888
3926
|
setFormData: function setFormData(ctx, value) {
|
|
3889
|
-
$set(this.formData, ctx.id, value);
|
|
3927
|
+
$set(this.formData, ctx.id, value === undefined ? null : value);
|
|
3890
3928
|
},
|
|
3891
3929
|
getFormData: function getFormData(ctx) {
|
|
3892
3930
|
return this.formData[ctx.id];
|
|
@@ -3955,7 +3993,7 @@
|
|
|
3955
3993
|
this.vm.setupState.updateValue(_objectSpread2({}, this.form));
|
|
3956
3994
|
},
|
|
3957
3995
|
isChange: function isChange(ctx, value) {
|
|
3958
|
-
return JSON.stringify(this.getFormData(ctx)) !== JSON.stringify(value);
|
|
3996
|
+
return JSON.stringify(this.getFormData(ctx), strFn) !== JSON.stringify(value, strFn);
|
|
3959
3997
|
},
|
|
3960
3998
|
isQuote: function isQuote(ctx, value) {
|
|
3961
3999
|
return (is.Object(value) || Array.isArray(value)) && value === ctx.rule.value;
|
|
@@ -3979,6 +4017,7 @@
|
|
|
3979
4017
|
if (this.refreshControl(ctx)) {
|
|
3980
4018
|
this.$render.clearCacheAll();
|
|
3981
4019
|
this.loadRule();
|
|
4020
|
+
this.bus.$emit('update', this.api);
|
|
3982
4021
|
this.refresh();
|
|
3983
4022
|
}
|
|
3984
4023
|
|
|
@@ -4006,6 +4045,10 @@
|
|
|
4006
4045
|
});
|
|
4007
4046
|
}
|
|
4008
4047
|
|
|
4048
|
+
function strFn(key, val) {
|
|
4049
|
+
return typeof val === 'function' ? '' + val : val;
|
|
4050
|
+
}
|
|
4051
|
+
|
|
4009
4052
|
var BaseParser = {
|
|
4010
4053
|
init: function init(ctx) {},
|
|
4011
4054
|
toFormValue: function toFormValue(value, ctx) {
|
|
@@ -4018,6 +4061,9 @@
|
|
|
4018
4061
|
render: function render(children, ctx) {
|
|
4019
4062
|
return ctx.$render.defaultRender(ctx, children);
|
|
4020
4063
|
},
|
|
4064
|
+
preview: function preview(children, ctx) {
|
|
4065
|
+
return ctx.$render.defaultRender(ctx, children);
|
|
4066
|
+
},
|
|
4021
4067
|
mergeProp: function mergeProp(ctx) {}
|
|
4022
4068
|
};
|
|
4023
4069
|
|
|
@@ -4100,13 +4146,13 @@
|
|
|
4100
4146
|
var none = ['field', 'value', 'vm', 'template', 'name', 'config', 'control', 'inject', 'sync', 'payload', 'optionsTo', 'update'];
|
|
4101
4147
|
var all = attrs();
|
|
4102
4148
|
all.filter(function (k) {
|
|
4103
|
-
return none.indexOf(k) === -1;
|
|
4149
|
+
return k[0] !== '_' && none.indexOf(k) === -1;
|
|
4104
4150
|
}).forEach(function (key) {
|
|
4105
4151
|
var ref = vue.toRef(ctx.rule, key);
|
|
4106
4152
|
var flag = key === 'children';
|
|
4107
4153
|
ctx.refRule[key] = ref;
|
|
4108
4154
|
ctx.watch.push(vue.watch(flag ? function () {
|
|
4109
|
-
return _toConsumableArray(ref.value || []);
|
|
4155
|
+
return is.Function(ref.value) ? ref.value : _toConsumableArray(ref.value || []);
|
|
4110
4156
|
} : function () {
|
|
4111
4157
|
return ref.value;
|
|
4112
4158
|
}, function (_, o) {
|
|
@@ -4136,15 +4182,16 @@
|
|
|
4136
4182
|
ctx.updateType();
|
|
4137
4183
|
|
|
4138
4184
|
_this.bindParser(ctx);
|
|
4139
|
-
} else if (
|
|
4140
|
-
|
|
4141
|
-
o
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4185
|
+
} else if (flag) {
|
|
4186
|
+
if (is.Function(o)) {
|
|
4187
|
+
o = ctx.getPending('children', []);
|
|
4188
|
+
}
|
|
4189
|
+
|
|
4190
|
+
if (is.Function(n)) {
|
|
4191
|
+
n = ctx.loadChildrenPending();
|
|
4192
|
+
}
|
|
4193
|
+
|
|
4194
|
+
_this.updateChildren(ctx, n, o);
|
|
4148
4195
|
}
|
|
4149
4196
|
|
|
4150
4197
|
_this.$render.clearCache(ctx);
|
|
@@ -4171,15 +4218,32 @@
|
|
|
4171
4218
|
|
|
4172
4219
|
this.watchEffect(ctx);
|
|
4173
4220
|
},
|
|
4174
|
-
|
|
4221
|
+
updateChildren: function updateChildren(ctx, n, o) {
|
|
4175
4222
|
var _this2 = this;
|
|
4176
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
|
+
|
|
4177
4241
|
is.trueArray(sub) && sub.forEach(function (r) {
|
|
4178
|
-
r && r.__fc__ &&
|
|
4242
|
+
r && r.__fc__ && _this3.rmCtx(r.__fc__);
|
|
4179
4243
|
});
|
|
4180
4244
|
},
|
|
4181
4245
|
rmCtx: function rmCtx(ctx) {
|
|
4182
|
-
var
|
|
4246
|
+
var _this4 = this;
|
|
4183
4247
|
|
|
4184
4248
|
if (ctx.deleted) return;
|
|
4185
4249
|
var id = ctx.id,
|
|
@@ -4189,20 +4253,23 @@
|
|
|
4189
4253
|
$del(this.ctxs, id);
|
|
4190
4254
|
$del(this.formData, id);
|
|
4191
4255
|
$del(this.subForm, id);
|
|
4256
|
+
$del(this.vm.setupState.ctxInject, id);
|
|
4192
4257
|
input && this.rmIdCtx(ctx, field, 'field');
|
|
4193
4258
|
name && this.rmIdCtx(ctx, name, 'name');
|
|
4194
4259
|
this.deferSyncValue(function () {
|
|
4195
|
-
if (!
|
|
4260
|
+
if (!_this4.reloading) {
|
|
4196
4261
|
if (ctx.parser.loadChildren !== false) {
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
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__);
|
|
4200
4267
|
});
|
|
4201
4268
|
}
|
|
4202
4269
|
}
|
|
4203
4270
|
|
|
4204
|
-
if (ctx.root ===
|
|
4205
|
-
|
|
4271
|
+
if (ctx.root === _this4.rules) {
|
|
4272
|
+
_this4.vm.setupState.renderRule();
|
|
4206
4273
|
}
|
|
4207
4274
|
}
|
|
4208
4275
|
}, input);
|
|
@@ -4215,8 +4282,8 @@
|
|
|
4215
4282
|
this.$render.clearCache(ctx);
|
|
4216
4283
|
ctx["delete"]();
|
|
4217
4284
|
this.effect(ctx, 'deleted');
|
|
4218
|
-
input && !this.fieldCtx[field] && this.vm.emit('
|
|
4219
|
-
ctx.rule.__ctrl || this.vm.emit('
|
|
4285
|
+
input && !this.fieldCtx[field] && this.vm.emit('remove-field', field, ctx.rule, this.api);
|
|
4286
|
+
ctx.rule.__ctrl || this.vm.emit('remove-rule', ctx.rule, this.api);
|
|
4220
4287
|
return ctx;
|
|
4221
4288
|
}
|
|
4222
4289
|
});
|
|
@@ -4284,7 +4351,6 @@
|
|
|
4284
4351
|
watchEffect: function watchEffect(ctx) {
|
|
4285
4352
|
var _this3 = this;
|
|
4286
4353
|
|
|
4287
|
-
this.vm;
|
|
4288
4354
|
Object.keys(ctx.rule.effect || {}).forEach(function (k) {
|
|
4289
4355
|
ctx.watch.push(vue.watch(function () {
|
|
4290
4356
|
return ctx.rule.effect[k];
|
|
@@ -4322,7 +4388,7 @@
|
|
|
4322
4388
|
input = _ref.input,
|
|
4323
4389
|
type = _ref.type,
|
|
4324
4390
|
custom = _ref.custom;
|
|
4325
|
-
if (!type ||
|
|
4391
|
+
if (!type || ['fcFragment', 'fragment'].indexOf(type) > -1) return;
|
|
4326
4392
|
var effect = custom ? custom : rule.effect || {};
|
|
4327
4393
|
Object.keys(effect).forEach(function (attr) {
|
|
4328
4394
|
var p = _this4.providers[attr];
|
|
@@ -4519,26 +4585,8 @@
|
|
|
4519
4585
|
xhr.send(formData);
|
|
4520
4586
|
}
|
|
4521
4587
|
|
|
4522
|
-
var NAME
|
|
4588
|
+
var NAME = 'fcFragment';
|
|
4523
4589
|
var fragment = vue.defineComponent({
|
|
4524
|
-
name: NAME$1,
|
|
4525
|
-
inheritAttrs: false,
|
|
4526
|
-
props: ['formCreateInject'],
|
|
4527
|
-
setup: function setup(props) {
|
|
4528
|
-
var data = vue.toRef(props, 'formCreateInject');
|
|
4529
|
-
var $inject = vue.reactive(_objectSpread2({}, data.value));
|
|
4530
|
-
vue.watch(data, function () {
|
|
4531
|
-
extend($inject, data.value);
|
|
4532
|
-
});
|
|
4533
|
-
vue.provide('formCreateInject', $inject);
|
|
4534
|
-
},
|
|
4535
|
-
render: function render() {
|
|
4536
|
-
return this.$slots["default"]();
|
|
4537
|
-
}
|
|
4538
|
-
});
|
|
4539
|
-
|
|
4540
|
-
var NAME = 'FcVnode';
|
|
4541
|
-
var vnode = vue.defineComponent({
|
|
4542
4590
|
name: NAME,
|
|
4543
4591
|
inheritAttrs: false,
|
|
4544
4592
|
props: ['vnode'],
|
|
@@ -4549,8 +4597,12 @@
|
|
|
4549
4597
|
|
|
4550
4598
|
function tidyDirectives(directives) {
|
|
4551
4599
|
return Object.keys(directives).map(function (n) {
|
|
4552
|
-
var
|
|
4553
|
-
|
|
4600
|
+
var data = directives[n];
|
|
4601
|
+
var directive = vue.resolveDirective(n);
|
|
4602
|
+
if (!directive) return;
|
|
4603
|
+
return [directive, data.value, data.arg, data.modifiers];
|
|
4604
|
+
}).filter(function (v) {
|
|
4605
|
+
return !!v;
|
|
4554
4606
|
});
|
|
4555
4607
|
}
|
|
4556
4608
|
|
|
@@ -4577,7 +4629,18 @@
|
|
|
4577
4629
|
return makeDirective(data, this.h(tag, toProps(data), children));
|
|
4578
4630
|
},
|
|
4579
4631
|
h: function h(tag, data, children) {
|
|
4580
|
-
|
|
4632
|
+
var isNativeTag = vue.getCurrentInstance().appContext.config.isNativeTag(tag);
|
|
4633
|
+
|
|
4634
|
+
if (isNativeTag) {
|
|
4635
|
+
delete data.formCreateInject;
|
|
4636
|
+
}
|
|
4637
|
+
|
|
4638
|
+
try {
|
|
4639
|
+
return vue.createVNode(isNativeTag ? tag : vue.resolveComponent(tag), data, children);
|
|
4640
|
+
} catch (e) {
|
|
4641
|
+
console.error(e);
|
|
4642
|
+
return vue.createVNode('');
|
|
4643
|
+
}
|
|
4581
4644
|
},
|
|
4582
4645
|
aliasMap: aliasMap
|
|
4583
4646
|
});
|
|
@@ -4705,6 +4768,11 @@
|
|
|
4705
4768
|
|
|
4706
4769
|
function run(inject, rule, api) {
|
|
4707
4770
|
var option = inject.value;
|
|
4771
|
+
|
|
4772
|
+
if (is.Function(option)) {
|
|
4773
|
+
option = option(rule, api);
|
|
4774
|
+
}
|
|
4775
|
+
|
|
4708
4776
|
option = parseOpt(option);
|
|
4709
4777
|
|
|
4710
4778
|
if (!option || !option.action) {
|
|
@@ -4756,6 +4824,25 @@
|
|
|
4756
4824
|
return true;
|
|
4757
4825
|
}
|
|
4758
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
|
+
|
|
4759
4846
|
function parseProp(name, id) {
|
|
4760
4847
|
var prop;
|
|
4761
4848
|
|
|
@@ -4784,8 +4871,10 @@
|
|
|
4784
4871
|
arrayAttrs.push.apply(arrayAttrs, _toConsumableArray(array));
|
|
4785
4872
|
normalAttrs.push.apply(normalAttrs, _toConsumableArray(normal));
|
|
4786
4873
|
appendProto([].concat(_toConsumableArray(key), _toConsumableArray(array), _toConsumableArray(normal)));
|
|
4787
|
-
}
|
|
4874
|
+
}
|
|
4788
4875
|
|
|
4876
|
+
var id = 1;
|
|
4877
|
+
var instance = {}; //todo 表单嵌套
|
|
4789
4878
|
|
|
4790
4879
|
function FormCreateFactory(config) {
|
|
4791
4880
|
var components = _defineProperty({}, fragment.name, fragment);
|
|
@@ -4793,6 +4882,7 @@
|
|
|
4793
4882
|
var parsers = {};
|
|
4794
4883
|
var directives = {};
|
|
4795
4884
|
var modelFields = {};
|
|
4885
|
+
var useApps = [];
|
|
4796
4886
|
var providers = {
|
|
4797
4887
|
fetch: $fetch
|
|
4798
4888
|
};
|
|
@@ -4804,6 +4894,14 @@
|
|
|
4804
4894
|
var CreateNode = CreateNodeFactory();
|
|
4805
4895
|
exportAttrs(config.attrs || {});
|
|
4806
4896
|
|
|
4897
|
+
function getApi(name) {
|
|
4898
|
+
return instance[name];
|
|
4899
|
+
}
|
|
4900
|
+
|
|
4901
|
+
function useApp(fn) {
|
|
4902
|
+
useApps.push(fn);
|
|
4903
|
+
}
|
|
4904
|
+
|
|
4807
4905
|
function directive() {
|
|
4808
4906
|
var data = nameProp.apply(void 0, arguments);
|
|
4809
4907
|
if (data.id && data.prop) directives[data.id] = data.prop;
|
|
@@ -4872,7 +4970,7 @@
|
|
|
4872
4970
|
}
|
|
4873
4971
|
|
|
4874
4972
|
function $vnode() {
|
|
4875
|
-
return
|
|
4973
|
+
return fragment;
|
|
4876
4974
|
} //todo 检查回调函数作用域
|
|
4877
4975
|
|
|
4878
4976
|
|
|
@@ -4883,7 +4981,11 @@
|
|
|
4883
4981
|
|
|
4884
4982
|
function create(rules, option) {
|
|
4885
4983
|
var app = createFormApp(rules, option || {});
|
|
4886
|
-
|
|
4984
|
+
useApps.forEach(function (v) {
|
|
4985
|
+
invoke(function () {
|
|
4986
|
+
return v(create, app);
|
|
4987
|
+
});
|
|
4988
|
+
});
|
|
4887
4989
|
var div = document.createElement('div');
|
|
4888
4990
|
((option === null || option === void 0 ? void 0 : option.el) || document.body).appendChild(div);
|
|
4889
4991
|
var vm = app.mount(div);
|
|
@@ -4902,6 +5004,7 @@
|
|
|
4902
5004
|
var _this = this;
|
|
4903
5005
|
|
|
4904
5006
|
extend(this, {
|
|
5007
|
+
id: id++,
|
|
4905
5008
|
create: create,
|
|
4906
5009
|
vm: vm,
|
|
4907
5010
|
manager: createManager(config.manager),
|
|
@@ -4909,6 +5012,7 @@
|
|
|
4909
5012
|
providers: providers,
|
|
4910
5013
|
modelFields: modelFields,
|
|
4911
5014
|
rules: vm.props.rule,
|
|
5015
|
+
name: vm.props.name,
|
|
4912
5016
|
prop: {
|
|
4913
5017
|
components: components,
|
|
4914
5018
|
directives: directives
|
|
@@ -4933,6 +5037,10 @@
|
|
|
4933
5037
|
extend(vm.appContext.components, components);
|
|
4934
5038
|
extend(vm.appContext.directives, directives);
|
|
4935
5039
|
this.$handle = new Handler(this);
|
|
5040
|
+
|
|
5041
|
+
if (this.name) {
|
|
5042
|
+
instance[this.name] = this.api();
|
|
5043
|
+
}
|
|
4936
5044
|
}
|
|
4937
5045
|
|
|
4938
5046
|
extend(FormCreate.prototype, {
|
|
@@ -4998,6 +5106,10 @@
|
|
|
4998
5106
|
this.$handle.mounted();
|
|
4999
5107
|
},
|
|
5000
5108
|
unmount: function unmount() {
|
|
5109
|
+
if (this.name) {
|
|
5110
|
+
delete instance[this.name];
|
|
5111
|
+
}
|
|
5112
|
+
|
|
5001
5113
|
this.unwatch && this.unwatch();
|
|
5002
5114
|
this.$handle.reloadRule([]);
|
|
5003
5115
|
},
|
|
@@ -5029,18 +5141,21 @@
|
|
|
5029
5141
|
copyRules: copyRules,
|
|
5030
5142
|
fetch: fetch,
|
|
5031
5143
|
$form: $form,
|
|
5144
|
+
parseFn: parseFn,
|
|
5032
5145
|
parseJson: parseJson,
|
|
5033
|
-
toJson: toJson
|
|
5146
|
+
toJson: toJson,
|
|
5147
|
+
useApp: useApp,
|
|
5148
|
+
getApi: getApi
|
|
5034
5149
|
});
|
|
5035
5150
|
}
|
|
5036
5151
|
|
|
5037
5152
|
function useStatic(formCreate) {
|
|
5038
5153
|
extend(formCreate, {
|
|
5039
5154
|
create: create,
|
|
5040
|
-
install: function install(
|
|
5155
|
+
install: function install(app, options) {
|
|
5041
5156
|
globalConfig = _objectSpread2(_objectSpread2({}, globalConfig), options || {});
|
|
5042
|
-
if (
|
|
5043
|
-
|
|
5157
|
+
if (app._installedFormCreate === true) return;
|
|
5158
|
+
app._installedFormCreate = true;
|
|
5044
5159
|
|
|
5045
5160
|
var $formCreate = function $formCreate(rules) {
|
|
5046
5161
|
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -5048,9 +5163,13 @@
|
|
|
5048
5163
|
};
|
|
5049
5164
|
|
|
5050
5165
|
useAttr($formCreate);
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
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
|
+
});
|
|
5054
5173
|
}
|
|
5055
5174
|
});
|
|
5056
5175
|
}
|
|
@@ -5060,7 +5179,13 @@
|
|
|
5060
5179
|
CreateNode.use({
|
|
5061
5180
|
fragment: 'fcFragment'
|
|
5062
5181
|
});
|
|
5063
|
-
|
|
5182
|
+
config.install && create.use(config);
|
|
5183
|
+
useApp(function (_, app) {
|
|
5184
|
+
app.mixin({
|
|
5185
|
+
props: ['formCreateInject']
|
|
5186
|
+
});
|
|
5187
|
+
});
|
|
5188
|
+
parser(html);
|
|
5064
5189
|
return create;
|
|
5065
5190
|
}
|
|
5066
5191
|
|
|
@@ -5205,7 +5330,7 @@
|
|
|
5205
5330
|
var PRE = 'el';
|
|
5206
5331
|
var alias = {
|
|
5207
5332
|
button: PRE + '-button',
|
|
5208
|
-
icon: '
|
|
5333
|
+
icon: PRE + '-icon',
|
|
5209
5334
|
slider: PRE + '-slider',
|
|
5210
5335
|
rate: PRE + '-rate',
|
|
5211
5336
|
upload: 'fc-upload',
|
|
@@ -5262,7 +5387,6 @@
|
|
|
5262
5387
|
type: 'default',
|
|
5263
5388
|
loading: false,
|
|
5264
5389
|
disabled: false,
|
|
5265
|
-
icon: 'el-icon-refresh',
|
|
5266
5390
|
innerText: '重置',
|
|
5267
5391
|
show: false,
|
|
5268
5392
|
col: undefined,
|
|
@@ -5299,15 +5423,29 @@
|
|
|
5299
5423
|
|
|
5300
5424
|
var manager = {
|
|
5301
5425
|
validate: function validate() {
|
|
5302
|
-
|
|
5426
|
+
var form = this.form();
|
|
5427
|
+
|
|
5428
|
+
if (form) {
|
|
5429
|
+
return form.validate();
|
|
5430
|
+
} else {
|
|
5431
|
+
return new Promise(function (v) {
|
|
5432
|
+
return v();
|
|
5433
|
+
});
|
|
5434
|
+
}
|
|
5303
5435
|
},
|
|
5304
5436
|
validateField: function validateField(field) {
|
|
5305
5437
|
var _this = this;
|
|
5306
5438
|
|
|
5307
5439
|
return new Promise(function (resolve, reject) {
|
|
5308
|
-
_this.form()
|
|
5309
|
-
|
|
5310
|
-
|
|
5440
|
+
var form = _this.form();
|
|
5441
|
+
|
|
5442
|
+
if (form) {
|
|
5443
|
+
form.validateField(field, function (res) {
|
|
5444
|
+
res ? reject(res) : resolve(null);
|
|
5445
|
+
});
|
|
5446
|
+
} else {
|
|
5447
|
+
resolve();
|
|
5448
|
+
}
|
|
5311
5449
|
});
|
|
5312
5450
|
},
|
|
5313
5451
|
clearValidateState: function clearValidateState(ctx) {
|
|
@@ -5338,7 +5476,7 @@
|
|
|
5338
5476
|
info: {
|
|
5339
5477
|
trigger: 'hover',
|
|
5340
5478
|
placement: 'top-start',
|
|
5341
|
-
icon:
|
|
5479
|
+
icon: true
|
|
5342
5480
|
},
|
|
5343
5481
|
title: {},
|
|
5344
5482
|
col: {
|
|
@@ -5437,40 +5575,41 @@
|
|
|
5437
5575
|
var form = this.options.form;
|
|
5438
5576
|
var children = [(titleProp.title || '') + (form.labelSuffix || form['label-suffix'] || '')];
|
|
5439
5577
|
|
|
5440
|
-
|
|
5441
|
-
return _this4.$r(mergeProps([titleProp, {
|
|
5442
|
-
props: titleProp,
|
|
5443
|
-
key: "".concat(uni, "tit"),
|
|
5444
|
-
type: titleProp.type || 'span'
|
|
5445
|
-
}]), children);
|
|
5446
|
-
};
|
|
5447
|
-
|
|
5448
|
-
if (!isFalse(infoProp.show) && (infoProp.info || infoProp["native"])) {
|
|
5449
|
-
if (infoProp.icon !== false) {
|
|
5450
|
-
children[infoProp.align !== 'left' ? 'unshift' : 'push'](this.$r({
|
|
5451
|
-
type: 'i',
|
|
5452
|
-
"class": infoProp.icon === true ? 'el-icon-warning' : infoProp.icon,
|
|
5453
|
-
key: "".concat(uni, "i")
|
|
5454
|
-
}, {}, true));
|
|
5455
|
-
}
|
|
5456
|
-
|
|
5578
|
+
if (!isFalse(infoProp.show) && (infoProp.info || infoProp["native"]) && !isFalse(infoProp.icon)) {
|
|
5457
5579
|
var prop = {
|
|
5458
5580
|
type: infoProp.type || 'popover',
|
|
5459
5581
|
props: _objectSpread2({}, infoProp),
|
|
5460
5582
|
key: "".concat(uni, "pop")
|
|
5461
5583
|
};
|
|
5584
|
+
delete prop.props.icon;
|
|
5585
|
+
delete prop.props.show;
|
|
5586
|
+
delete prop.props.info;
|
|
5462
5587
|
var field = 'content';
|
|
5463
5588
|
|
|
5464
5589
|
if (infoProp.info && !hasProperty(prop.props, field)) {
|
|
5465
5590
|
prop.props[field] = infoProp.info;
|
|
5466
5591
|
}
|
|
5467
5592
|
|
|
5468
|
-
|
|
5469
|
-
return
|
|
5470
|
-
|
|
5593
|
+
children[infoProp.align !== 'left' ? 'unshift' : 'push'](this.$r(mergeProps([infoProp, prop]), _defineProperty({}, titleProp.slot || (isTip ? 'default' : 'reference'), function () {
|
|
5594
|
+
return _this4.$r({
|
|
5595
|
+
type: 'ElIcon',
|
|
5596
|
+
style: 'top:2px',
|
|
5597
|
+
key: "".concat(uni, "i")
|
|
5598
|
+
}, {
|
|
5599
|
+
"default": function _default() {
|
|
5600
|
+
return _this4.$r({
|
|
5601
|
+
type: infoProp.icon === true ? 'warning' : infoProp.icon
|
|
5602
|
+
});
|
|
5603
|
+
}
|
|
5604
|
+
}, true);
|
|
5605
|
+
})));
|
|
5471
5606
|
}
|
|
5472
5607
|
|
|
5473
|
-
return
|
|
5608
|
+
return this.$r(mergeProps([titleProp, {
|
|
5609
|
+
props: titleProp,
|
|
5610
|
+
key: "".concat(uni, "tit"),
|
|
5611
|
+
type: titleProp.type || 'span'
|
|
5612
|
+
}]), children);
|
|
5474
5613
|
},
|
|
5475
5614
|
makeCol: function makeCol(rule, uni, children) {
|
|
5476
5615
|
var col = rule.col;
|
|
@@ -5524,7 +5663,7 @@
|
|
|
5524
5663
|
|
|
5525
5664
|
var resetBtn = _objectSpread2({}, this.options.resetBtn);
|
|
5526
5665
|
|
|
5527
|
-
var
|
|
5666
|
+
var innerText = resetBtn.innerText;
|
|
5528
5667
|
delete resetBtn.innerText;
|
|
5529
5668
|
return this.$r({
|
|
5530
5669
|
type: 'button',
|
|
@@ -5539,14 +5678,14 @@
|
|
|
5539
5678
|
}
|
|
5540
5679
|
},
|
|
5541
5680
|
key: "".concat(this.key, "b2")
|
|
5542
|
-
}, [
|
|
5681
|
+
}, [innerText]);
|
|
5543
5682
|
},
|
|
5544
5683
|
makeSubmitBtn: function makeSubmitBtn() {
|
|
5545
5684
|
var _this6 = this;
|
|
5546
5685
|
|
|
5547
5686
|
var submitBtn = _objectSpread2({}, this.options.submitBtn);
|
|
5548
5687
|
|
|
5549
|
-
var
|
|
5688
|
+
var innerText = submitBtn.innerText;
|
|
5550
5689
|
delete submitBtn.innerText;
|
|
5551
5690
|
return this.$r({
|
|
5552
5691
|
type: 'button',
|
|
@@ -5561,7 +5700,7 @@
|
|
|
5561
5700
|
}
|
|
5562
5701
|
},
|
|
5563
5702
|
key: "".concat(this.key, "b1")
|
|
5564
|
-
}, [
|
|
5703
|
+
}, [innerText]);
|
|
5565
5704
|
}
|
|
5566
5705
|
};
|
|
5567
5706
|
|
|
@@ -5647,7 +5786,7 @@
|
|
|
5647
5786
|
return maker;
|
|
5648
5787
|
}
|
|
5649
5788
|
|
|
5650
|
-
var css_248z = ".form-create .form-create .el-form-item{margin-bottom:22px}.form-create .form-create .el-form-item .el-form-item{margin-bottom:0}.form-create{
|
|
5789
|
+
var css_248z = ".form-create .form-create .el-form-item{margin-bottom:22px}.form-create .form-create .el-form-item .el-form-item{margin-bottom:0}.form-create{width:100%}";
|
|
5651
5790
|
styleInject(css_248z);
|
|
5652
5791
|
|
|
5653
5792
|
function tidyBtnProp(btn, def) {
|
|
@@ -5819,18 +5958,19 @@
|
|
|
5819
5958
|
Object.keys(maker$1).forEach(function (name) {
|
|
5820
5959
|
FormCreate.maker[name] = maker$1[name];
|
|
5821
5960
|
});
|
|
5822
|
-
}
|
|
5823
5961
|
|
|
5824
|
-
|
|
5825
|
-
|
|
5962
|
+
if (typeof window !== 'undefined' && window.ElementPlus) {
|
|
5963
|
+
FormCreate.useApp(function (_, app) {
|
|
5964
|
+
app.use(window.ElementPlus);
|
|
5965
|
+
});
|
|
5966
|
+
}
|
|
5826
5967
|
}
|
|
5827
5968
|
|
|
5828
5969
|
function elmFormCreate() {
|
|
5829
5970
|
return FormCreateFactory({
|
|
5830
5971
|
ui: 'element-ui',
|
|
5831
|
-
version: '3.
|
|
5972
|
+
version: '3.1.0',
|
|
5832
5973
|
manager: manager,
|
|
5833
|
-
appUse: appUse,
|
|
5834
5974
|
extendApi: extendApi,
|
|
5835
5975
|
install: install,
|
|
5836
5976
|
attrs: {
|