@form-create/iview 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 +43 -25
- package/dist/form-create.min.js +2 -2
- package/dist/form-create.min.js.map +1 -1
- package/package.json +8 -8
package/dist/form-create.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/iview v2.5.
|
|
2
|
+
* @form-create/iview 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.
|
|
@@ -276,9 +276,15 @@
|
|
|
276
276
|
trueValue: []
|
|
277
277
|
};
|
|
278
278
|
},
|
|
279
|
+
computed: {
|
|
280
|
+
options: function options() {
|
|
281
|
+
var opt = this.formCreateInject.options;
|
|
282
|
+
return Array.isArray(opt) ? opt : [];
|
|
283
|
+
}
|
|
284
|
+
},
|
|
279
285
|
methods: {
|
|
280
286
|
onInput: function onInput(n) {
|
|
281
|
-
this.$emit('input', this.
|
|
287
|
+
this.$emit('input', this.options.filter(function (opt) {
|
|
282
288
|
return n.indexOf(opt.label) !== -1;
|
|
283
289
|
}).map(function (opt) {
|
|
284
290
|
return opt.value;
|
|
@@ -289,7 +295,7 @@
|
|
|
289
295
|
update: function update() {
|
|
290
296
|
var _this = this;
|
|
291
297
|
|
|
292
|
-
this.trueValue = this.value ? this.
|
|
298
|
+
this.trueValue = this.value ? this.options.filter(function (opt) {
|
|
293
299
|
return _this.value.indexOf(opt.value) !== -1;
|
|
294
300
|
}).map(function (option) {
|
|
295
301
|
return option.label;
|
|
@@ -308,7 +314,7 @@
|
|
|
308
314
|
"on": {
|
|
309
315
|
"input": this.onInput
|
|
310
316
|
}
|
|
311
|
-
}]), [this.
|
|
317
|
+
}]), [this.options.map(function (opt, index) {
|
|
312
318
|
var props = _objectSpread2({}, opt);
|
|
313
319
|
|
|
314
320
|
delete props.value;
|
|
@@ -840,9 +846,15 @@
|
|
|
840
846
|
trueValue: []
|
|
841
847
|
};
|
|
842
848
|
},
|
|
849
|
+
computed: {
|
|
850
|
+
options: function options() {
|
|
851
|
+
var opt = this.formCreateInject.options;
|
|
852
|
+
return Array.isArray(opt) ? opt : [];
|
|
853
|
+
}
|
|
854
|
+
},
|
|
843
855
|
methods: {
|
|
844
856
|
onInput: function onInput(n) {
|
|
845
|
-
this.$emit('input', this.
|
|
857
|
+
this.$emit('input', this.options.filter(function (opt) {
|
|
846
858
|
return opt.label === n;
|
|
847
859
|
}).reduce(function (initial, opt) {
|
|
848
860
|
return opt.value;
|
|
@@ -851,7 +863,7 @@
|
|
|
851
863
|
update: function update() {
|
|
852
864
|
var _this = this;
|
|
853
865
|
|
|
854
|
-
this.trueValue = this.
|
|
866
|
+
this.trueValue = this.options.filter(function (opt) {
|
|
855
867
|
return opt.value === _this.value;
|
|
856
868
|
}).reduce(function (initial, opt) {
|
|
857
869
|
return opt.label;
|
|
@@ -870,7 +882,7 @@
|
|
|
870
882
|
"on": {
|
|
871
883
|
"input": this.onInput
|
|
872
884
|
}
|
|
873
|
-
}]), [this.
|
|
885
|
+
}]), [this.options.map(function (opt, index) {
|
|
874
886
|
var props = _objectSpread2({}, opt);
|
|
875
887
|
|
|
876
888
|
delete props.value;
|
|
@@ -916,7 +928,8 @@
|
|
|
916
928
|
}
|
|
917
929
|
},
|
|
918
930
|
render: function render(h, ctx) {
|
|
919
|
-
|
|
931
|
+
var options = ctx.props.formCreateInject.options;
|
|
932
|
+
return h("Select", helper([{}, ctx.data]), [(Array.isArray(options) ? options : []).map(function (props, index) {
|
|
920
933
|
var slot = props.slot;
|
|
921
934
|
return h("Option", {
|
|
922
935
|
"props": _objectSpread2({}, props),
|
|
@@ -1320,7 +1333,8 @@
|
|
|
1320
1333
|
return {
|
|
1321
1334
|
len: 0,
|
|
1322
1335
|
cacheRule: {},
|
|
1323
|
-
cacheValue: {}
|
|
1336
|
+
cacheValue: {},
|
|
1337
|
+
type: undefined
|
|
1324
1338
|
};
|
|
1325
1339
|
},
|
|
1326
1340
|
computed: {
|
|
@@ -1492,7 +1506,7 @@
|
|
|
1492
1506
|
this.addRule(i, true);
|
|
1493
1507
|
},
|
|
1494
1508
|
del: function del(index, key) {
|
|
1495
|
-
if (this.disabled || false === this.onBeforeRemove(this.value)) {
|
|
1509
|
+
if (this.disabled || false === this.onBeforeRemove(this.value, index)) {
|
|
1496
1510
|
return;
|
|
1497
1511
|
}
|
|
1498
1512
|
|
|
@@ -1565,6 +1579,7 @@
|
|
|
1565
1579
|
}
|
|
1566
1580
|
},
|
|
1567
1581
|
created: function created() {
|
|
1582
|
+
this.type = this.formCreateInject.form.$form();
|
|
1568
1583
|
var d = (this.expand || 0) - this.value.length;
|
|
1569
1584
|
|
|
1570
1585
|
if (d > 0) {
|
|
@@ -1581,6 +1596,7 @@
|
|
|
1581
1596
|
var h = arguments[0];
|
|
1582
1597
|
var keys = Object.keys(this.cacheRule);
|
|
1583
1598
|
var button = this.button;
|
|
1599
|
+
var Type = this.type;
|
|
1584
1600
|
return keys.length === 0 ? this.$scopedSlots["default"] ? this.$scopedSlots["default"]({
|
|
1585
1601
|
vm: this,
|
|
1586
1602
|
add: this.add
|
|
@@ -1610,7 +1626,7 @@
|
|
|
1610
1626
|
"attrs": {
|
|
1611
1627
|
"span": button ? 20 : 24
|
|
1612
1628
|
}
|
|
1613
|
-
}, [h("FormItem", [h(
|
|
1629
|
+
}, [h("FormItem", [h(Type, helper([{
|
|
1614
1630
|
"key": key
|
|
1615
1631
|
}, {
|
|
1616
1632
|
"on": {
|
|
@@ -1642,9 +1658,6 @@
|
|
|
1642
1658
|
}
|
|
1643
1659
|
}, [_this9.makeIcon(keys.length, index, key)]) : null]);
|
|
1644
1660
|
})]);
|
|
1645
|
-
},
|
|
1646
|
-
beforeMount: function beforeMount() {
|
|
1647
|
-
this.$options.components.FormCreate = this.formCreateInject.form.$form();
|
|
1648
1661
|
}
|
|
1649
1662
|
};
|
|
1650
1663
|
}
|
|
@@ -1686,7 +1699,8 @@
|
|
|
1686
1699
|
data: function data() {
|
|
1687
1700
|
return {
|
|
1688
1701
|
cacheRule: {},
|
|
1689
|
-
cacheValue: {}
|
|
1702
|
+
cacheValue: {},
|
|
1703
|
+
type: undefined
|
|
1690
1704
|
};
|
|
1691
1705
|
},
|
|
1692
1706
|
watch: {
|
|
@@ -1748,13 +1762,15 @@
|
|
|
1748
1762
|
},
|
|
1749
1763
|
created: function created() {
|
|
1750
1764
|
this.addRule();
|
|
1765
|
+
this.type = this.formCreateInject.form.$form();
|
|
1751
1766
|
},
|
|
1752
1767
|
render: function render() {
|
|
1753
1768
|
var h = arguments[0];
|
|
1754
1769
|
var _this$cacheRule = this.cacheRule,
|
|
1755
1770
|
rule = _this$cacheRule.rule,
|
|
1756
1771
|
options = _this$cacheRule.options;
|
|
1757
|
-
|
|
1772
|
+
var Type = this.type;
|
|
1773
|
+
return h(Type, helper([{}, {
|
|
1758
1774
|
"on": {
|
|
1759
1775
|
'update:value': this.formData,
|
|
1760
1776
|
'emit-event': this.emitEvent,
|
|
@@ -1767,9 +1783,6 @@
|
|
|
1767
1783
|
"extendOption": true
|
|
1768
1784
|
}
|
|
1769
1785
|
}]));
|
|
1770
|
-
},
|
|
1771
|
-
beforeMount: function beforeMount() {
|
|
1772
|
-
this.$options.components.FormCreate = this.formCreateInject.form.$form();
|
|
1773
1786
|
}
|
|
1774
1787
|
};
|
|
1775
1788
|
|
|
@@ -3031,6 +3044,9 @@
|
|
|
3031
3044
|
on: {
|
|
3032
3045
|
'hook:mounted': function hookMounted() {
|
|
3033
3046
|
_this8.onMounted(ctx);
|
|
3047
|
+
},
|
|
3048
|
+
'fc.sub-form': function fcSubForm(subForm) {
|
|
3049
|
+
_this8.$handle.addSubForm(ctx, subForm);
|
|
3034
3050
|
}
|
|
3035
3051
|
}
|
|
3036
3052
|
}];
|
|
@@ -4908,9 +4924,7 @@
|
|
|
4908
4924
|
|
|
4909
4925
|
|
|
4910
4926
|
function FormCreateFactory(config) {
|
|
4911
|
-
var
|
|
4912
|
-
|
|
4913
|
-
var components = _defineProperty({}, fragment.name, _fragment);
|
|
4927
|
+
var components = _defineProperty({}, fragment.name, fragment);
|
|
4914
4928
|
|
|
4915
4929
|
var parsers = {};
|
|
4916
4930
|
var directives = {};
|
|
@@ -4975,6 +4989,10 @@
|
|
|
4975
4989
|
|
|
4976
4990
|
function $form() {
|
|
4977
4991
|
return _vue.extend($FormCreate(FormCreate));
|
|
4992
|
+
}
|
|
4993
|
+
|
|
4994
|
+
function $vnode() {
|
|
4995
|
+
return _vue.extend(fragment);
|
|
4978
4996
|
} //todo 检查回调函数作用域
|
|
4979
4997
|
|
|
4980
4998
|
|
|
@@ -5117,7 +5135,7 @@
|
|
|
5117
5135
|
component: component,
|
|
5118
5136
|
directive: directive,
|
|
5119
5137
|
register: register,
|
|
5120
|
-
|
|
5138
|
+
$vnode: $vnode,
|
|
5121
5139
|
parser: parser,
|
|
5122
5140
|
use: use,
|
|
5123
5141
|
factory: factory,
|
|
@@ -5171,7 +5189,7 @@
|
|
|
5171
5189
|
useAttr($formCreate);
|
|
5172
5190
|
Vue.prototype.$formCreate = $formCreate;
|
|
5173
5191
|
Vue.component('FormCreate', $form());
|
|
5174
|
-
Vue.component('FcFragment',
|
|
5192
|
+
Vue.component('FcFragment', $vnode());
|
|
5175
5193
|
}
|
|
5176
5194
|
});
|
|
5177
5195
|
}
|
|
@@ -6033,7 +6051,7 @@
|
|
|
6033
6051
|
function ivuFormCreate() {
|
|
6034
6052
|
return FormCreateFactory({
|
|
6035
6053
|
ui: "".concat("iview"),
|
|
6036
|
-
version: "".concat("2.5.
|
|
6054
|
+
version: "".concat("2.5.12"),
|
|
6037
6055
|
manager: manager,
|
|
6038
6056
|
install: install,
|
|
6039
6057
|
extendApi: extendApi,
|