@form-create/element-ui 2.5.11 → 2.5.12
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/dist/form-create.js +46 -27
- package/dist/form-create.min.js +2 -2
- package/dist/form-create.min.js.map +1 -1
- package/package.json +8 -8
- package/src/core/manager.js +2 -1
package/dist/form-create.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/element-ui v2.5.
|
|
2
|
+
* @form-create/element-ui v2.5.12
|
|
3
3
|
* (c) 2018-2021 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create
|
|
5
5
|
* Released under the MIT License.
|
|
@@ -277,9 +277,15 @@
|
|
|
277
277
|
trueValue: []
|
|
278
278
|
};
|
|
279
279
|
},
|
|
280
|
+
computed: {
|
|
281
|
+
options: function options() {
|
|
282
|
+
var opt = this.formCreateInject.options;
|
|
283
|
+
return Array.isArray(opt) ? opt : [];
|
|
284
|
+
}
|
|
285
|
+
},
|
|
280
286
|
methods: {
|
|
281
287
|
onInput: function onInput(n) {
|
|
282
|
-
this.$emit('input', this.
|
|
288
|
+
this.$emit('input', this.options.filter(function (opt) {
|
|
283
289
|
return n.indexOf(opt.label) !== -1;
|
|
284
290
|
}).map(function (opt) {
|
|
285
291
|
return opt.value;
|
|
@@ -290,7 +296,7 @@
|
|
|
290
296
|
update: function update() {
|
|
291
297
|
var _this = this;
|
|
292
298
|
|
|
293
|
-
this.trueValue = this.value ? this.
|
|
299
|
+
this.trueValue = this.value ? this.options.filter(function (opt) {
|
|
294
300
|
return _this.value.indexOf(opt.value) !== -1;
|
|
295
301
|
}).map(function (option) {
|
|
296
302
|
return option.label;
|
|
@@ -311,7 +317,7 @@
|
|
|
311
317
|
"on": {
|
|
312
318
|
"input": this.onInput
|
|
313
319
|
}
|
|
314
|
-
}]), [this.
|
|
320
|
+
}]), [this.options.map(function (opt, index) {
|
|
315
321
|
var props = _objectSpread2({}, opt);
|
|
316
322
|
|
|
317
323
|
var Type = _this2.type === 'button' ? 'ElCheckboxButton' : 'ElCheckbox';
|
|
@@ -864,9 +870,15 @@
|
|
|
864
870
|
trueValue: []
|
|
865
871
|
};
|
|
866
872
|
},
|
|
873
|
+
computed: {
|
|
874
|
+
options: function options() {
|
|
875
|
+
var opt = this.formCreateInject.options;
|
|
876
|
+
return Array.isArray(opt) ? opt : [];
|
|
877
|
+
}
|
|
878
|
+
},
|
|
867
879
|
methods: {
|
|
868
880
|
onInput: function onInput(n) {
|
|
869
|
-
this.$emit('input', this.
|
|
881
|
+
this.$emit('input', this.options.filter(function (opt) {
|
|
870
882
|
return opt.label === n;
|
|
871
883
|
}).reduce(function (initial, opt) {
|
|
872
884
|
return opt.value;
|
|
@@ -875,7 +887,7 @@
|
|
|
875
887
|
update: function update() {
|
|
876
888
|
var _this = this;
|
|
877
889
|
|
|
878
|
-
this.trueValue = this.
|
|
890
|
+
this.trueValue = this.options.filter(function (opt) {
|
|
879
891
|
return opt.value === _this.value;
|
|
880
892
|
}).reduce(function (initial, opt) {
|
|
881
893
|
return opt.label;
|
|
@@ -896,7 +908,7 @@
|
|
|
896
908
|
"on": {
|
|
897
909
|
"input": this.onInput
|
|
898
910
|
}
|
|
899
|
-
}]), [this.
|
|
911
|
+
}]), [this.options.map(function (opt, index) {
|
|
900
912
|
var props = _objectSpread2({}, opt);
|
|
901
913
|
|
|
902
914
|
var Type = _this2.type === 'button' ? 'ElRadioButton' : 'ElRadio';
|
|
@@ -943,7 +955,8 @@
|
|
|
943
955
|
}
|
|
944
956
|
},
|
|
945
957
|
render: function render(h, ctx) {
|
|
946
|
-
|
|
958
|
+
var options = ctx.props.formCreateInject.options;
|
|
959
|
+
return h("ElSelect", helper([{}, ctx.data]), [(Array.isArray(options) ? options : []).map(function (props, index) {
|
|
947
960
|
var slot = props.slot;
|
|
948
961
|
return h("ElOption", {
|
|
949
962
|
"props": _objectSpread2({}, props),
|
|
@@ -1350,7 +1363,8 @@
|
|
|
1350
1363
|
return {
|
|
1351
1364
|
len: 0,
|
|
1352
1365
|
cacheRule: {},
|
|
1353
|
-
cacheValue: {}
|
|
1366
|
+
cacheValue: {},
|
|
1367
|
+
type: undefined
|
|
1354
1368
|
};
|
|
1355
1369
|
},
|
|
1356
1370
|
computed: {
|
|
@@ -1522,7 +1536,7 @@
|
|
|
1522
1536
|
this.addRule(i, true);
|
|
1523
1537
|
},
|
|
1524
1538
|
del: function del(index, key) {
|
|
1525
|
-
if (this.disabled || false === this.onBeforeRemove(this.value)) {
|
|
1539
|
+
if (this.disabled || false === this.onBeforeRemove(this.value, index)) {
|
|
1526
1540
|
return;
|
|
1527
1541
|
}
|
|
1528
1542
|
|
|
@@ -1591,6 +1605,7 @@
|
|
|
1591
1605
|
}
|
|
1592
1606
|
},
|
|
1593
1607
|
created: function created() {
|
|
1608
|
+
this.type = this.formCreateInject.form.$form();
|
|
1594
1609
|
var d = (this.expand || 0) - this.value.length;
|
|
1595
1610
|
|
|
1596
1611
|
if (d > 0) {
|
|
@@ -1607,6 +1622,7 @@
|
|
|
1607
1622
|
var h = arguments[0];
|
|
1608
1623
|
var keys = Object.keys(this.cacheRule);
|
|
1609
1624
|
var button = this.button;
|
|
1625
|
+
var Type = this.type;
|
|
1610
1626
|
return keys.length === 0 ? this.$scopedSlots["default"] ? this.$scopedSlots["default"]({
|
|
1611
1627
|
vm: this,
|
|
1612
1628
|
add: this.add
|
|
@@ -1634,7 +1650,7 @@
|
|
|
1634
1650
|
"attrs": {
|
|
1635
1651
|
"span": button ? 20 : 24
|
|
1636
1652
|
}
|
|
1637
|
-
}, [h("ElFormItem", [h(
|
|
1653
|
+
}, [h("ElFormItem", [h(Type, helper([{
|
|
1638
1654
|
"key": key
|
|
1639
1655
|
}, {
|
|
1640
1656
|
"on": {
|
|
@@ -1666,9 +1682,6 @@
|
|
|
1666
1682
|
}
|
|
1667
1683
|
}, [_this9.makeIcon(keys.length, index, key)]) : null]);
|
|
1668
1684
|
})]);
|
|
1669
|
-
},
|
|
1670
|
-
beforeMount: function beforeMount() {
|
|
1671
|
-
this.$options.components.FormCreate = this.formCreateInject.form.$form();
|
|
1672
1685
|
}
|
|
1673
1686
|
};
|
|
1674
1687
|
|
|
@@ -1700,7 +1713,8 @@
|
|
|
1700
1713
|
data: function data() {
|
|
1701
1714
|
return {
|
|
1702
1715
|
cacheRule: {},
|
|
1703
|
-
cacheValue: {}
|
|
1716
|
+
cacheValue: {},
|
|
1717
|
+
type: undefined
|
|
1704
1718
|
};
|
|
1705
1719
|
},
|
|
1706
1720
|
watch: {
|
|
@@ -1762,13 +1776,15 @@
|
|
|
1762
1776
|
},
|
|
1763
1777
|
created: function created() {
|
|
1764
1778
|
this.addRule();
|
|
1779
|
+
this.type = this.formCreateInject.form.$form();
|
|
1765
1780
|
},
|
|
1766
1781
|
render: function render() {
|
|
1767
1782
|
var h = arguments[0];
|
|
1768
1783
|
var _this$cacheRule = this.cacheRule,
|
|
1769
1784
|
rule = _this$cacheRule.rule,
|
|
1770
1785
|
options = _this$cacheRule.options;
|
|
1771
|
-
|
|
1786
|
+
var Type = this.type;
|
|
1787
|
+
return h(Type, helper([{}, {
|
|
1772
1788
|
"on": {
|
|
1773
1789
|
'update:value': this.formData,
|
|
1774
1790
|
'emit-event': this.emitEvent,
|
|
@@ -1781,9 +1797,6 @@
|
|
|
1781
1797
|
"extendOption": true
|
|
1782
1798
|
}
|
|
1783
1799
|
}]));
|
|
1784
|
-
},
|
|
1785
|
-
beforeMount: function beforeMount() {
|
|
1786
|
-
this.$options.components.FormCreate = this.formCreateInject.form.$form();
|
|
1787
1800
|
}
|
|
1788
1801
|
};
|
|
1789
1802
|
|
|
@@ -3045,6 +3058,9 @@
|
|
|
3045
3058
|
on: {
|
|
3046
3059
|
'hook:mounted': function hookMounted() {
|
|
3047
3060
|
_this8.onMounted(ctx);
|
|
3061
|
+
},
|
|
3062
|
+
'fc.sub-form': function fcSubForm(subForm) {
|
|
3063
|
+
_this8.$handle.addSubForm(ctx, subForm);
|
|
3048
3064
|
}
|
|
3049
3065
|
}
|
|
3050
3066
|
}];
|
|
@@ -4922,9 +4938,7 @@
|
|
|
4922
4938
|
|
|
4923
4939
|
|
|
4924
4940
|
function FormCreateFactory(config) {
|
|
4925
|
-
var
|
|
4926
|
-
|
|
4927
|
-
var components = _defineProperty({}, fragment.name, _fragment);
|
|
4941
|
+
var components = _defineProperty({}, fragment.name, fragment);
|
|
4928
4942
|
|
|
4929
4943
|
var parsers = {};
|
|
4930
4944
|
var directives = {};
|
|
@@ -4989,6 +5003,10 @@
|
|
|
4989
5003
|
|
|
4990
5004
|
function $form() {
|
|
4991
5005
|
return _vue.extend($FormCreate(FormCreate));
|
|
5006
|
+
}
|
|
5007
|
+
|
|
5008
|
+
function $vnode() {
|
|
5009
|
+
return _vue.extend(fragment);
|
|
4992
5010
|
} //todo 检查回调函数作用域
|
|
4993
5011
|
|
|
4994
5012
|
|
|
@@ -5131,7 +5149,7 @@
|
|
|
5131
5149
|
component: component,
|
|
5132
5150
|
directive: directive,
|
|
5133
5151
|
register: register,
|
|
5134
|
-
|
|
5152
|
+
$vnode: $vnode,
|
|
5135
5153
|
parser: parser,
|
|
5136
5154
|
use: use,
|
|
5137
5155
|
factory: factory,
|
|
@@ -5185,7 +5203,7 @@
|
|
|
5185
5203
|
useAttr($formCreate);
|
|
5186
5204
|
Vue.prototype.$formCreate = $formCreate;
|
|
5187
5205
|
Vue.component('FormCreate', $form());
|
|
5188
|
-
Vue.component('FcFragment',
|
|
5206
|
+
Vue.component('FcFragment', $vnode());
|
|
5189
5207
|
}
|
|
5190
5208
|
});
|
|
5191
5209
|
}
|
|
@@ -5534,7 +5552,8 @@
|
|
|
5534
5552
|
_col = _this$rule$props.col;
|
|
5535
5553
|
var item = isFalse(rule.wrap.show) ? children : this.$r(mergeProps([rule.wrap, {
|
|
5536
5554
|
props: _objectSpread2(_objectSpread2({
|
|
5537
|
-
labelWidth: labelWidth === void 0 ? labelWidth : toString(labelWidth)
|
|
5555
|
+
labelWidth: labelWidth === void 0 ? labelWidth : toString(labelWidth),
|
|
5556
|
+
label: isTitle ? rule.title.title : undefined
|
|
5538
5557
|
}, rule.wrap || {}), {}, {
|
|
5539
5558
|
prop: ctx.id,
|
|
5540
5559
|
rules: rule.validate
|
|
@@ -5558,7 +5577,7 @@
|
|
|
5558
5577
|
var infoProp = rule.info;
|
|
5559
5578
|
var isTip = isTooltip(infoProp);
|
|
5560
5579
|
var form = this.options.form;
|
|
5561
|
-
var children = [titleProp.title + (form.labelSuffix || form['label-suffix'] || '')];
|
|
5580
|
+
var children = [(titleProp.title || '') + (form.labelSuffix || form['label-suffix'] || '')];
|
|
5562
5581
|
|
|
5563
5582
|
var titleFn = function titleFn(pop) {
|
|
5564
5583
|
return _this.$r(mergeProps([titleProp, {
|
|
@@ -6004,7 +6023,7 @@
|
|
|
6004
6023
|
function elmFormCreate() {
|
|
6005
6024
|
return FormCreateFactory({
|
|
6006
6025
|
ui: "".concat("element-ui"),
|
|
6007
|
-
version: "".concat("2.5.
|
|
6026
|
+
version: "".concat("2.5.12"),
|
|
6008
6027
|
manager: manager,
|
|
6009
6028
|
extendApi: extendApi,
|
|
6010
6029
|
install: install,
|