@form-create/element-ui 3.1.18 → 3.1.20
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 +119 -17
- package/dist/form-create.esm.min.js +2 -2
- package/dist/form-create.js +119 -17
- package/dist/form-create.min.js +2 -2
- 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,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/element-ui v3.1.
|
|
2
|
+
* @form-create/element-ui v3.1.20
|
|
3
3
|
* (c) 2018-2023 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create
|
|
5
5
|
* Released under the MIT License.
|
|
@@ -1737,7 +1737,7 @@ var Group = defineComponent({
|
|
|
1737
1737
|
return [this.max !== 0 && total >= this.max ? null : this.addIcon(key), this.min === 0 || total > this.min ? this.delIcon(index, key) : null];
|
|
1738
1738
|
}
|
|
1739
1739
|
|
|
1740
|
-
if (
|
|
1740
|
+
if (total > this.min) {
|
|
1741
1741
|
return this.delIcon(index, key);
|
|
1742
1742
|
}
|
|
1743
1743
|
},
|
|
@@ -1779,6 +1779,7 @@ var Group = defineComponent({
|
|
|
1779
1779
|
return [createVNode(script$2, null, null)];
|
|
1780
1780
|
}
|
|
1781
1781
|
}) : createVNode("div", {
|
|
1782
|
+
"style": "width: 100%;",
|
|
1782
1783
|
"key": 2
|
|
1783
1784
|
}, [keys.map(function (key, index) {
|
|
1784
1785
|
var _slot;
|
|
@@ -1788,7 +1789,6 @@ var Group = defineComponent({
|
|
|
1788
1789
|
options = _this9$cacheRule$key.options;
|
|
1789
1790
|
return createVNode(resolveComponent("ElRow"), {
|
|
1790
1791
|
"align": "middle",
|
|
1791
|
-
"type": "flex",
|
|
1792
1792
|
"key": key,
|
|
1793
1793
|
"style": "border-bottom:1px dashed #DCDFE6;margin-bottom:10px;"
|
|
1794
1794
|
}, {
|
|
@@ -2952,6 +2952,10 @@ function useCache(Render) {
|
|
|
2952
2952
|
this.clearCacheAll();
|
|
2953
2953
|
},
|
|
2954
2954
|
clearCache: function clearCache(ctx) {
|
|
2955
|
+
if (ctx.rule.cache) {
|
|
2956
|
+
return;
|
|
2957
|
+
}
|
|
2958
|
+
|
|
2955
2959
|
if (!this.cache[ctx.id]) {
|
|
2956
2960
|
ctx.parent && this.clearCache(ctx.parent);
|
|
2957
2961
|
return;
|
|
@@ -3219,7 +3223,15 @@ function useRender$1(Render) {
|
|
|
3219
3223
|
return function () {
|
|
3220
3224
|
var cache = _this4.getCache(ctx);
|
|
3221
3225
|
|
|
3222
|
-
|
|
3226
|
+
if (cache) {
|
|
3227
|
+
return cache.apply(void 0, arguments);
|
|
3228
|
+
}
|
|
3229
|
+
|
|
3230
|
+
var _vn = _this4.renderCtx(ctx, ctx.parent);
|
|
3231
|
+
|
|
3232
|
+
if (_vn) {
|
|
3233
|
+
return _vn();
|
|
3234
|
+
}
|
|
3223
3235
|
};
|
|
3224
3236
|
} catch (e) {
|
|
3225
3237
|
console.error(e);
|
|
@@ -3816,7 +3828,7 @@ extend(RuleContext.prototype, {
|
|
|
3816
3828
|
var rule = _objectSpread2({}, this.rule);
|
|
3817
3829
|
|
|
3818
3830
|
delete rule.children;
|
|
3819
|
-
this.prop =
|
|
3831
|
+
this.prop = mergeRule({}, [rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
|
|
3820
3832
|
return _this3.payload[k];
|
|
3821
3833
|
})), [this.computed]));
|
|
3822
3834
|
},
|
|
@@ -3922,6 +3934,73 @@ extend(RuleContext.prototype, {
|
|
|
3922
3934
|
}
|
|
3923
3935
|
});
|
|
3924
3936
|
|
|
3937
|
+
var condition = {
|
|
3938
|
+
'==': function _(b) {
|
|
3939
|
+
return function (a) {
|
|
3940
|
+
return a === b;
|
|
3941
|
+
};
|
|
3942
|
+
},
|
|
3943
|
+
'!=': function _(b) {
|
|
3944
|
+
return function (a) {
|
|
3945
|
+
return a !== b;
|
|
3946
|
+
};
|
|
3947
|
+
},
|
|
3948
|
+
'<>': function _(b) {
|
|
3949
|
+
return function (a) {
|
|
3950
|
+
return a !== b;
|
|
3951
|
+
};
|
|
3952
|
+
},
|
|
3953
|
+
'>': function _(b) {
|
|
3954
|
+
return function (a) {
|
|
3955
|
+
return a > b;
|
|
3956
|
+
};
|
|
3957
|
+
},
|
|
3958
|
+
'>=': function _(b) {
|
|
3959
|
+
return function (a) {
|
|
3960
|
+
return a >= b;
|
|
3961
|
+
};
|
|
3962
|
+
},
|
|
3963
|
+
'<': function _(b) {
|
|
3964
|
+
return function (a) {
|
|
3965
|
+
return a < b;
|
|
3966
|
+
};
|
|
3967
|
+
},
|
|
3968
|
+
'<=': function _(b) {
|
|
3969
|
+
return function (a) {
|
|
3970
|
+
return a <= b;
|
|
3971
|
+
};
|
|
3972
|
+
},
|
|
3973
|
+
'in': function _in(b) {
|
|
3974
|
+
return function (a) {
|
|
3975
|
+
return b && b.indexOf && b.indexOf(a) > -1;
|
|
3976
|
+
};
|
|
3977
|
+
},
|
|
3978
|
+
'on': function on(b) {
|
|
3979
|
+
return function (a) {
|
|
3980
|
+
return a && a.indexOf && a.indexOf(b) > -1;
|
|
3981
|
+
};
|
|
3982
|
+
},
|
|
3983
|
+
'notIn': function notIn(b) {
|
|
3984
|
+
return function (a) {
|
|
3985
|
+
return !condition["in"](b)(a);
|
|
3986
|
+
};
|
|
3987
|
+
},
|
|
3988
|
+
'notOn': function notOn(b) {
|
|
3989
|
+
return function (a) {
|
|
3990
|
+
return !condition.on(b)(a);
|
|
3991
|
+
};
|
|
3992
|
+
},
|
|
3993
|
+
'between': function between(b) {
|
|
3994
|
+
return function (a) {
|
|
3995
|
+
return a > b[0] && a < b[1];
|
|
3996
|
+
};
|
|
3997
|
+
},
|
|
3998
|
+
'notBetween': function notBetween(b) {
|
|
3999
|
+
return function (a) {
|
|
4000
|
+
return a < b[0] || a > b[1];
|
|
4001
|
+
};
|
|
4002
|
+
}
|
|
4003
|
+
};
|
|
3925
4004
|
function useLoader(Handler) {
|
|
3926
4005
|
extend(Handler.prototype, {
|
|
3927
4006
|
nextRefresh: function nextRefresh(fn) {
|
|
@@ -4055,7 +4134,7 @@ function useLoader(Handler) {
|
|
|
4055
4134
|
};
|
|
4056
4135
|
|
|
4057
4136
|
rules.map(function (_rule, index) {
|
|
4058
|
-
if (parent &&
|
|
4137
|
+
if (parent && !is.Object(_rule)) return;
|
|
4059
4138
|
if (!_this6.pageEnd && !parent && index >= _this6.first) return;
|
|
4060
4139
|
|
|
4061
4140
|
if (_rule.__fc__ && _rule.__fc__.root === rules && _this6.ctxs[_rule.__fc__.id]) {
|
|
@@ -4182,10 +4261,7 @@ function useLoader(Handler) {
|
|
|
4182
4261
|
|
|
4183
4262
|
var _loop = function _loop(i) {
|
|
4184
4263
|
var control = controls[i],
|
|
4185
|
-
handleFn = control.handle ||
|
|
4186
|
-
return val === control.value;
|
|
4187
|
-
};
|
|
4188
|
-
|
|
4264
|
+
handleFn = control.handle || (condition[control.condition || '=='] || condition['=='])(control.value);
|
|
4189
4265
|
if (!is.trueArray(control.rule)) return "continue";
|
|
4190
4266
|
|
|
4191
4267
|
var data = _objectSpread2(_objectSpread2({}, control), {}, {
|
|
@@ -4217,7 +4293,8 @@ function useLoader(Handler) {
|
|
|
4217
4293
|
prepend = _ref.prepend,
|
|
4218
4294
|
append = _ref.append,
|
|
4219
4295
|
child = _ref.child,
|
|
4220
|
-
ctrl = _ref.ctrl
|
|
4296
|
+
ctrl = _ref.ctrl,
|
|
4297
|
+
method = _ref.method;
|
|
4221
4298
|
|
|
4222
4299
|
if (isHidden) {
|
|
4223
4300
|
valid ? ctx.ctrlRule.push({
|
|
@@ -4226,7 +4303,21 @@ function useLoader(Handler) {
|
|
|
4226
4303
|
valid: valid
|
|
4227
4304
|
}) : ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl), 1);
|
|
4228
4305
|
hideLst[valid ? 'push' : 'unshift'](function () {
|
|
4229
|
-
|
|
4306
|
+
if (method === 'disabled') {
|
|
4307
|
+
_this7.api.disabled(!valid, rule);
|
|
4308
|
+
} else if (method === 'display') {
|
|
4309
|
+
_this7.api.display(valid, rule);
|
|
4310
|
+
} else if (method === 'required') {
|
|
4311
|
+
rule.forEach(function (item) {
|
|
4312
|
+
_this7.api.setEffect(item, 'required', valid);
|
|
4313
|
+
});
|
|
4314
|
+
|
|
4315
|
+
if (!valid) {
|
|
4316
|
+
_this7.api.clearValidateState(rule);
|
|
4317
|
+
}
|
|
4318
|
+
} else {
|
|
4319
|
+
_this7.api.hidden(!valid, rule);
|
|
4320
|
+
}
|
|
4230
4321
|
});
|
|
4231
4322
|
return;
|
|
4232
4323
|
}
|
|
@@ -4840,7 +4931,13 @@ function useEffect(Handler) {
|
|
|
4840
4931
|
watchEffect: function watchEffect(ctx) {
|
|
4841
4932
|
var _this3 = this;
|
|
4842
4933
|
|
|
4843
|
-
var effect = {
|
|
4934
|
+
var effect = {
|
|
4935
|
+
required: function required() {
|
|
4936
|
+
var _ctx$rule, _ctx$rule$effect;
|
|
4937
|
+
|
|
4938
|
+
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;
|
|
4939
|
+
}
|
|
4940
|
+
};
|
|
4844
4941
|
Object.keys(ctx.rule.effect || {}).forEach(function (k) {
|
|
4845
4942
|
effect[k] = function () {
|
|
4846
4943
|
return ctx.rule.effect[k];
|
|
@@ -4932,7 +5029,7 @@ function useEffect(Handler) {
|
|
|
4932
5029
|
};
|
|
4933
5030
|
|
|
4934
5031
|
data.mergeProp = function (prop) {
|
|
4935
|
-
return
|
|
5032
|
+
return mergeRule(data.getProp(), [prop]);
|
|
4936
5033
|
};
|
|
4937
5034
|
}
|
|
4938
5035
|
|
|
@@ -5471,18 +5568,19 @@ function FormCreateFactory(config) {
|
|
|
5471
5568
|
var name;
|
|
5472
5569
|
|
|
5473
5570
|
if (is.String(id)) {
|
|
5474
|
-
name =
|
|
5571
|
+
name = id;
|
|
5475
5572
|
|
|
5476
5573
|
if (component === undefined) {
|
|
5477
5574
|
return components[name];
|
|
5478
5575
|
}
|
|
5479
5576
|
} else {
|
|
5480
|
-
name =
|
|
5577
|
+
name = id.displayName || id.name;
|
|
5481
5578
|
component = id;
|
|
5482
5579
|
}
|
|
5483
5580
|
|
|
5484
5581
|
if (!name || !component) return;
|
|
5485
5582
|
components[name] = component;
|
|
5583
|
+
components[toCase(name)] = component;
|
|
5486
5584
|
if (component.formCreateParser) parser(name, component.formCreateParser);
|
|
5487
5585
|
}
|
|
5488
5586
|
|
|
@@ -6587,6 +6685,10 @@ function parseVal(val) {
|
|
|
6587
6685
|
return {
|
|
6588
6686
|
message: val
|
|
6589
6687
|
};
|
|
6688
|
+
} else if (is.Undef(val)) {
|
|
6689
|
+
return {
|
|
6690
|
+
required: false
|
|
6691
|
+
};
|
|
6590
6692
|
} else if (is.Function(val)) {
|
|
6591
6693
|
return {
|
|
6592
6694
|
validator: val
|
|
@@ -6621,7 +6723,7 @@ function install(FormCreate) {
|
|
|
6621
6723
|
function elmFormCreate() {
|
|
6622
6724
|
return FormCreateFactory({
|
|
6623
6725
|
ui: 'element-ui',
|
|
6624
|
-
version: '3.1.
|
|
6726
|
+
version: '3.1.20',
|
|
6625
6727
|
manager: manager,
|
|
6626
6728
|
extendApi: extendApi,
|
|
6627
6729
|
install: install,
|