@form-create/element-ui 3.1.17 → 3.1.19
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.esm.js +122 -25
- package/dist/form-create.esm.min.js +3 -3
- package/dist/form-create.js +122 -25
- package/dist/form-create.min.js +3 -3
- package/package.json +7 -7
- package/src/core/provider.js +2 -0
- package/types/config.d.ts +1 -1
package/dist/form-create.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/element-ui v3.1.
|
|
3
|
-
* (c) 2018-
|
|
2
|
+
* @form-create/element-ui v3.1.19
|
|
3
|
+
* (c) 2018-2023 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create
|
|
5
5
|
* Released under the MIT License.
|
|
6
6
|
*/
|
|
@@ -1157,6 +1157,14 @@ var NAME$4 = 'fcUpload';
|
|
|
1157
1157
|
var Upload = defineComponent({
|
|
1158
1158
|
name: NAME$4,
|
|
1159
1159
|
inheritAttrs: false,
|
|
1160
|
+
formCreateParser: {
|
|
1161
|
+
toFormValue: function toFormValue(value) {
|
|
1162
|
+
return toArray(value);
|
|
1163
|
+
},
|
|
1164
|
+
toValue: function toValue(formValue, ctx) {
|
|
1165
|
+
return ctx.prop.props.limit === 1 ? formValue[0] || '' : formValue;
|
|
1166
|
+
}
|
|
1167
|
+
},
|
|
1160
1168
|
props: {
|
|
1161
1169
|
previewMask: undefined,
|
|
1162
1170
|
onPreview: Function,
|
|
@@ -1177,11 +1185,6 @@ var Upload = defineComponent({
|
|
|
1177
1185
|
watch: {
|
|
1178
1186
|
modelValue: function modelValue(n) {
|
|
1179
1187
|
this.fileList = toArray(n).map(parseFile);
|
|
1180
|
-
},
|
|
1181
|
-
limit: function limit(n, o) {
|
|
1182
|
-
if (o === 1 || n === 1) {
|
|
1183
|
-
this.update();
|
|
1184
|
-
}
|
|
1185
1188
|
}
|
|
1186
1189
|
},
|
|
1187
1190
|
methods: {
|
|
@@ -1199,7 +1202,7 @@ var Upload = defineComponent({
|
|
|
1199
1202
|
}).filter(function (url) {
|
|
1200
1203
|
return url !== undefined;
|
|
1201
1204
|
});
|
|
1202
|
-
this.$emit('update:modelValue',
|
|
1205
|
+
this.$emit('update:modelValue', files);
|
|
1203
1206
|
},
|
|
1204
1207
|
handleCancel: function handleCancel() {
|
|
1205
1208
|
this.previewVisible = false;
|
|
@@ -1734,7 +1737,7 @@ var Group = defineComponent({
|
|
|
1734
1737
|
return [this.max !== 0 && total >= this.max ? null : this.addIcon(key), this.min === 0 || total > this.min ? this.delIcon(index, key) : null];
|
|
1735
1738
|
}
|
|
1736
1739
|
|
|
1737
|
-
if (
|
|
1740
|
+
if (total > this.min) {
|
|
1738
1741
|
return this.delIcon(index, key);
|
|
1739
1742
|
}
|
|
1740
1743
|
},
|
|
@@ -1776,6 +1779,7 @@ var Group = defineComponent({
|
|
|
1776
1779
|
return [createVNode(script$2, null, null)];
|
|
1777
1780
|
}
|
|
1778
1781
|
}) : createVNode("div", {
|
|
1782
|
+
"style": "width: 100%;",
|
|
1779
1783
|
"key": 2
|
|
1780
1784
|
}, [keys.map(function (key, index) {
|
|
1781
1785
|
var _slot;
|
|
@@ -1785,7 +1789,6 @@ var Group = defineComponent({
|
|
|
1785
1789
|
options = _this9$cacheRule$key.options;
|
|
1786
1790
|
return createVNode(resolveComponent("ElRow"), {
|
|
1787
1791
|
"align": "middle",
|
|
1788
|
-
"type": "flex",
|
|
1789
1792
|
"key": key,
|
|
1790
1793
|
"style": "border-bottom:1px dashed #DCDFE6;margin-bottom:10px;"
|
|
1791
1794
|
}, {
|
|
@@ -1949,8 +1952,8 @@ var getRuleInject = function getRuleInject(vm, parent) {
|
|
|
1949
1952
|
return;
|
|
1950
1953
|
}
|
|
1951
1954
|
|
|
1952
|
-
if (vm.
|
|
1953
|
-
return vm.
|
|
1955
|
+
if (vm.props.formCreateInject) {
|
|
1956
|
+
return vm.props.formCreateInject;
|
|
1954
1957
|
}
|
|
1955
1958
|
|
|
1956
1959
|
if (vm.parent) {
|
|
@@ -2949,6 +2952,10 @@ function useCache(Render) {
|
|
|
2949
2952
|
this.clearCacheAll();
|
|
2950
2953
|
},
|
|
2951
2954
|
clearCache: function clearCache(ctx) {
|
|
2955
|
+
if (ctx.rule.cache) {
|
|
2956
|
+
return;
|
|
2957
|
+
}
|
|
2958
|
+
|
|
2952
2959
|
if (!this.cache[ctx.id]) {
|
|
2953
2960
|
ctx.parent && this.clearCache(ctx.parent);
|
|
2954
2961
|
return;
|
|
@@ -3813,7 +3820,7 @@ extend(RuleContext.prototype, {
|
|
|
3813
3820
|
var rule = _objectSpread2({}, this.rule);
|
|
3814
3821
|
|
|
3815
3822
|
delete rule.children;
|
|
3816
|
-
this.prop =
|
|
3823
|
+
this.prop = mergeRule({}, [rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
|
|
3817
3824
|
return _this3.payload[k];
|
|
3818
3825
|
})), [this.computed]));
|
|
3819
3826
|
},
|
|
@@ -3919,6 +3926,73 @@ extend(RuleContext.prototype, {
|
|
|
3919
3926
|
}
|
|
3920
3927
|
});
|
|
3921
3928
|
|
|
3929
|
+
var condition = {
|
|
3930
|
+
'==': function _(b) {
|
|
3931
|
+
return function (a) {
|
|
3932
|
+
return a === b;
|
|
3933
|
+
};
|
|
3934
|
+
},
|
|
3935
|
+
'!=': function _(b) {
|
|
3936
|
+
return function (a) {
|
|
3937
|
+
return a !== b;
|
|
3938
|
+
};
|
|
3939
|
+
},
|
|
3940
|
+
'<>': function _(b) {
|
|
3941
|
+
return function (a) {
|
|
3942
|
+
return a !== b;
|
|
3943
|
+
};
|
|
3944
|
+
},
|
|
3945
|
+
'>': function _(b) {
|
|
3946
|
+
return function (a) {
|
|
3947
|
+
return a > b;
|
|
3948
|
+
};
|
|
3949
|
+
},
|
|
3950
|
+
'>=': function _(b) {
|
|
3951
|
+
return function (a) {
|
|
3952
|
+
return a >= b;
|
|
3953
|
+
};
|
|
3954
|
+
},
|
|
3955
|
+
'<': function _(b) {
|
|
3956
|
+
return function (a) {
|
|
3957
|
+
return a < b;
|
|
3958
|
+
};
|
|
3959
|
+
},
|
|
3960
|
+
'<=': function _(b) {
|
|
3961
|
+
return function (a) {
|
|
3962
|
+
return a <= b;
|
|
3963
|
+
};
|
|
3964
|
+
},
|
|
3965
|
+
'in': function _in(b) {
|
|
3966
|
+
return function (a) {
|
|
3967
|
+
return b && b.indexOf && b.indexOf(a) > -1;
|
|
3968
|
+
};
|
|
3969
|
+
},
|
|
3970
|
+
'on': function on(b) {
|
|
3971
|
+
return function (a) {
|
|
3972
|
+
return a && a.indexOf && a.indexOf(b) > -1;
|
|
3973
|
+
};
|
|
3974
|
+
},
|
|
3975
|
+
'notIn': function notIn(b) {
|
|
3976
|
+
return function (a) {
|
|
3977
|
+
return !condition["in"](b)(a);
|
|
3978
|
+
};
|
|
3979
|
+
},
|
|
3980
|
+
'notOn': function notOn(b) {
|
|
3981
|
+
return function (a) {
|
|
3982
|
+
return !condition.on(b)(a);
|
|
3983
|
+
};
|
|
3984
|
+
},
|
|
3985
|
+
'between': function between(b) {
|
|
3986
|
+
return function (a) {
|
|
3987
|
+
return a > b[0] && a < b[1];
|
|
3988
|
+
};
|
|
3989
|
+
},
|
|
3990
|
+
'notBetween': function notBetween(b) {
|
|
3991
|
+
return function (a) {
|
|
3992
|
+
return a < b[0] || a > b[1];
|
|
3993
|
+
};
|
|
3994
|
+
}
|
|
3995
|
+
};
|
|
3922
3996
|
function useLoader(Handler) {
|
|
3923
3997
|
extend(Handler.prototype, {
|
|
3924
3998
|
nextRefresh: function nextRefresh(fn) {
|
|
@@ -4052,7 +4126,7 @@ function useLoader(Handler) {
|
|
|
4052
4126
|
};
|
|
4053
4127
|
|
|
4054
4128
|
rules.map(function (_rule, index) {
|
|
4055
|
-
if (parent &&
|
|
4129
|
+
if (parent && !is.Object(_rule)) return;
|
|
4056
4130
|
if (!_this6.pageEnd && !parent && index >= _this6.first) return;
|
|
4057
4131
|
|
|
4058
4132
|
if (_rule.__fc__ && _rule.__fc__.root === rules && _this6.ctxs[_rule.__fc__.id]) {
|
|
@@ -4179,10 +4253,7 @@ function useLoader(Handler) {
|
|
|
4179
4253
|
|
|
4180
4254
|
var _loop = function _loop(i) {
|
|
4181
4255
|
var control = controls[i],
|
|
4182
|
-
handleFn = control.handle ||
|
|
4183
|
-
return val === control.value;
|
|
4184
|
-
};
|
|
4185
|
-
|
|
4256
|
+
handleFn = control.handle || (condition[control.condition || '=='] || condition['=='])(control.value);
|
|
4186
4257
|
if (!is.trueArray(control.rule)) return "continue";
|
|
4187
4258
|
|
|
4188
4259
|
var data = _objectSpread2(_objectSpread2({}, control), {}, {
|
|
@@ -4214,7 +4285,8 @@ function useLoader(Handler) {
|
|
|
4214
4285
|
prepend = _ref.prepend,
|
|
4215
4286
|
append = _ref.append,
|
|
4216
4287
|
child = _ref.child,
|
|
4217
|
-
ctrl = _ref.ctrl
|
|
4288
|
+
ctrl = _ref.ctrl,
|
|
4289
|
+
method = _ref.method;
|
|
4218
4290
|
|
|
4219
4291
|
if (isHidden) {
|
|
4220
4292
|
valid ? ctx.ctrlRule.push({
|
|
@@ -4223,7 +4295,21 @@ function useLoader(Handler) {
|
|
|
4223
4295
|
valid: valid
|
|
4224
4296
|
}) : ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl), 1);
|
|
4225
4297
|
hideLst[valid ? 'push' : 'unshift'](function () {
|
|
4226
|
-
|
|
4298
|
+
if (method === 'disabled') {
|
|
4299
|
+
_this7.api.disabled(!valid, rule);
|
|
4300
|
+
} else if (method === 'display') {
|
|
4301
|
+
_this7.api.display(valid, rule);
|
|
4302
|
+
} else if (method === 'required') {
|
|
4303
|
+
rule.forEach(function (item) {
|
|
4304
|
+
_this7.api.setEffect(item, 'required', valid);
|
|
4305
|
+
});
|
|
4306
|
+
|
|
4307
|
+
if (!valid) {
|
|
4308
|
+
_this7.api.clearValidateState(rule);
|
|
4309
|
+
}
|
|
4310
|
+
} else {
|
|
4311
|
+
_this7.api.hidden(!valid, rule);
|
|
4312
|
+
}
|
|
4227
4313
|
});
|
|
4228
4314
|
return;
|
|
4229
4315
|
}
|
|
@@ -4837,7 +4923,13 @@ function useEffect(Handler) {
|
|
|
4837
4923
|
watchEffect: function watchEffect(ctx) {
|
|
4838
4924
|
var _this3 = this;
|
|
4839
4925
|
|
|
4840
|
-
var effect = {
|
|
4926
|
+
var effect = {
|
|
4927
|
+
required: function required() {
|
|
4928
|
+
var _ctx$rule, _ctx$rule$effect;
|
|
4929
|
+
|
|
4930
|
+
return (hasProperty(ctx.rule, '$required') ? ctx.rule['$required'] : (_ctx$rule = ctx.rule) === null || _ctx$rule === void 0 ? void 0 : (_ctx$rule$effect = _ctx$rule.effect) === null || _ctx$rule$effect === void 0 ? void 0 : _ctx$rule$effect.required) || false;
|
|
4931
|
+
}
|
|
4932
|
+
};
|
|
4841
4933
|
Object.keys(ctx.rule.effect || {}).forEach(function (k) {
|
|
4842
4934
|
effect[k] = function () {
|
|
4843
4935
|
return ctx.rule.effect[k];
|
|
@@ -4929,7 +5021,7 @@ function useEffect(Handler) {
|
|
|
4929
5021
|
};
|
|
4930
5022
|
|
|
4931
5023
|
data.mergeProp = function (prop) {
|
|
4932
|
-
return
|
|
5024
|
+
return mergeRule(data.getProp(), [prop]);
|
|
4933
5025
|
};
|
|
4934
5026
|
}
|
|
4935
5027
|
|
|
@@ -5468,18 +5560,19 @@ function FormCreateFactory(config) {
|
|
|
5468
5560
|
var name;
|
|
5469
5561
|
|
|
5470
5562
|
if (is.String(id)) {
|
|
5471
|
-
name =
|
|
5563
|
+
name = id;
|
|
5472
5564
|
|
|
5473
5565
|
if (component === undefined) {
|
|
5474
5566
|
return components[name];
|
|
5475
5567
|
}
|
|
5476
5568
|
} else {
|
|
5477
|
-
name =
|
|
5569
|
+
name = id.displayName || id.name;
|
|
5478
5570
|
component = id;
|
|
5479
5571
|
}
|
|
5480
5572
|
|
|
5481
5573
|
if (!name || !component) return;
|
|
5482
5574
|
components[name] = component;
|
|
5575
|
+
components[toCase(name)] = component;
|
|
5483
5576
|
if (component.formCreateParser) parser(name, component.formCreateParser);
|
|
5484
5577
|
}
|
|
5485
5578
|
|
|
@@ -6584,6 +6677,10 @@ function parseVal(val) {
|
|
|
6584
6677
|
return {
|
|
6585
6678
|
message: val
|
|
6586
6679
|
};
|
|
6680
|
+
} else if (is.Undef(val)) {
|
|
6681
|
+
return {
|
|
6682
|
+
required: false
|
|
6683
|
+
};
|
|
6587
6684
|
} else if (is.Function(val)) {
|
|
6588
6685
|
return {
|
|
6589
6686
|
validator: val
|
|
@@ -6618,7 +6715,7 @@ function install(FormCreate) {
|
|
|
6618
6715
|
function elmFormCreate() {
|
|
6619
6716
|
return FormCreateFactory({
|
|
6620
6717
|
ui: 'element-ui',
|
|
6621
|
-
version: '3.1.
|
|
6718
|
+
version: '3.1.19',
|
|
6622
6719
|
manager: manager,
|
|
6623
6720
|
extendApi: extendApi,
|
|
6624
6721
|
install: install,
|