@form-create/element-ui 2.5.27 → 2.5.28
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 +106 -14
- package/dist/form-create.min.js +3 -3
- package/dist/form-create.min.js.map +1 -1
- package/package.json +4 -4
package/dist/form-create.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/element-ui v2.5.
|
|
3
|
-
* (c) 2018-
|
|
2
|
+
* @form-create/element-ui v2.5.28
|
|
3
|
+
* (c) 2018-2023 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create
|
|
5
5
|
* Released under the MIT License.
|
|
6
6
|
*/
|
|
@@ -1620,7 +1620,7 @@
|
|
|
1620
1620
|
if (index === 0) {
|
|
1621
1621
|
return [this.max !== 0 && total >= this.max ? null : this.addIcon(key), this.min === 0 || total > this.min ? this.delIcon(index, key) : null];
|
|
1622
1622
|
}
|
|
1623
|
-
if (
|
|
1623
|
+
if (total > this.min) {
|
|
1624
1624
|
return this.delIcon(index, key);
|
|
1625
1625
|
}
|
|
1626
1626
|
},
|
|
@@ -2187,6 +2187,7 @@
|
|
|
2187
2187
|
on: {},
|
|
2188
2188
|
options: [],
|
|
2189
2189
|
children: [],
|
|
2190
|
+
effect: {},
|
|
2190
2191
|
hidden: false,
|
|
2191
2192
|
display: true,
|
|
2192
2193
|
value: undefined
|
|
@@ -2545,7 +2546,7 @@
|
|
|
2545
2546
|
$set(ctx.rule, '$' + attr, value);
|
|
2546
2547
|
}
|
|
2547
2548
|
if (!hasProperty(ctx.rule, 'effect')) {
|
|
2548
|
-
ctx.rule
|
|
2549
|
+
$set(ctx.rule, 'effect', {});
|
|
2549
2550
|
}
|
|
2550
2551
|
$set(ctx.rule.effect, attr, value);
|
|
2551
2552
|
}
|
|
@@ -2662,6 +2663,9 @@
|
|
|
2662
2663
|
this.clearCacheAll();
|
|
2663
2664
|
},
|
|
2664
2665
|
clearCache: function clearCache(ctx) {
|
|
2666
|
+
if (ctx.rule.cache) {
|
|
2667
|
+
return;
|
|
2668
|
+
}
|
|
2665
2669
|
if (!this.cache[ctx.id]) {
|
|
2666
2670
|
ctx.parent && this.clearCache(ctx.parent);
|
|
2667
2671
|
return;
|
|
@@ -3414,7 +3418,7 @@
|
|
|
3414
3418
|
var _this = this;
|
|
3415
3419
|
var rule = _objectSpread2({}, this.rule);
|
|
3416
3420
|
delete rule.children;
|
|
3417
|
-
this.prop =
|
|
3421
|
+
this.prop = mergeRule({}, [rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
|
|
3418
3422
|
return _this.payload[k];
|
|
3419
3423
|
})), [this.computed]));
|
|
3420
3424
|
},
|
|
@@ -3506,6 +3510,73 @@
|
|
|
3506
3510
|
}
|
|
3507
3511
|
});
|
|
3508
3512
|
|
|
3513
|
+
var condition = {
|
|
3514
|
+
'==': function _(b) {
|
|
3515
|
+
return function (a) {
|
|
3516
|
+
return a === b;
|
|
3517
|
+
};
|
|
3518
|
+
},
|
|
3519
|
+
'!=': function _(b) {
|
|
3520
|
+
return function (a) {
|
|
3521
|
+
return a !== b;
|
|
3522
|
+
};
|
|
3523
|
+
},
|
|
3524
|
+
'<>': function _(b) {
|
|
3525
|
+
return function (a) {
|
|
3526
|
+
return a !== b;
|
|
3527
|
+
};
|
|
3528
|
+
},
|
|
3529
|
+
'>': function _(b) {
|
|
3530
|
+
return function (a) {
|
|
3531
|
+
return a > b;
|
|
3532
|
+
};
|
|
3533
|
+
},
|
|
3534
|
+
'>=': function _(b) {
|
|
3535
|
+
return function (a) {
|
|
3536
|
+
return a >= b;
|
|
3537
|
+
};
|
|
3538
|
+
},
|
|
3539
|
+
'<': function _(b) {
|
|
3540
|
+
return function (a) {
|
|
3541
|
+
return a < b;
|
|
3542
|
+
};
|
|
3543
|
+
},
|
|
3544
|
+
'<=': function _(b) {
|
|
3545
|
+
return function (a) {
|
|
3546
|
+
return a <= b;
|
|
3547
|
+
};
|
|
3548
|
+
},
|
|
3549
|
+
'in': function _in(b) {
|
|
3550
|
+
return function (a) {
|
|
3551
|
+
return b && b.indexOf && b.indexOf(a) > -1;
|
|
3552
|
+
};
|
|
3553
|
+
},
|
|
3554
|
+
'on': function on(b) {
|
|
3555
|
+
return function (a) {
|
|
3556
|
+
return a && a.indexOf && a.indexOf(b) > -1;
|
|
3557
|
+
};
|
|
3558
|
+
},
|
|
3559
|
+
'notIn': function notIn(b) {
|
|
3560
|
+
return function (a) {
|
|
3561
|
+
return !condition["in"](b)(a);
|
|
3562
|
+
};
|
|
3563
|
+
},
|
|
3564
|
+
'notOn': function notOn(b) {
|
|
3565
|
+
return function (a) {
|
|
3566
|
+
return !condition.on(b)(a);
|
|
3567
|
+
};
|
|
3568
|
+
},
|
|
3569
|
+
'between': function between(b) {
|
|
3570
|
+
return function (a) {
|
|
3571
|
+
return a > b[0] && a < b[1];
|
|
3572
|
+
};
|
|
3573
|
+
},
|
|
3574
|
+
'notBetween': function notBetween(b) {
|
|
3575
|
+
return function (a) {
|
|
3576
|
+
return a < b[0] || a > b[1];
|
|
3577
|
+
};
|
|
3578
|
+
}
|
|
3579
|
+
};
|
|
3509
3580
|
function useLoader(Handler) {
|
|
3510
3581
|
extend(Handler.prototype, {
|
|
3511
3582
|
nextRefresh: function nextRefresh(fn) {
|
|
@@ -3613,7 +3684,7 @@
|
|
|
3613
3684
|
}
|
|
3614
3685
|
};
|
|
3615
3686
|
rules.map(function (_rule, index) {
|
|
3616
|
-
if (parent &&
|
|
3687
|
+
if (parent && !is.Object(_rule)) return;
|
|
3617
3688
|
if (!_this6.pageEnd && !parent && index >= _this6.first) return;
|
|
3618
3689
|
if (_rule.__fc__ && _rule.__fc__.root === rules && _this6.ctxs[_rule.__fc__.id]) {
|
|
3619
3690
|
loadChildren(_rule.__fc__.rule.children, _rule.__fc__);
|
|
@@ -3709,9 +3780,7 @@
|
|
|
3709
3780
|
if (!controls.length) return false;
|
|
3710
3781
|
var _loop = function _loop(i) {
|
|
3711
3782
|
var control = controls[i],
|
|
3712
|
-
handleFn = control.handle ||
|
|
3713
|
-
return val === control.value;
|
|
3714
|
-
};
|
|
3783
|
+
handleFn = control.handle || (condition[control.condition || '=='] || condition['=='])(control.value);
|
|
3715
3784
|
if (!is.trueArray(control.rule)) return "continue";
|
|
3716
3785
|
var data = _objectSpread2(_objectSpread2({}, control), {}, {
|
|
3717
3786
|
valid: invoke(function () {
|
|
@@ -3738,7 +3807,8 @@
|
|
|
3738
3807
|
prepend = _ref.prepend,
|
|
3739
3808
|
append = _ref.append,
|
|
3740
3809
|
child = _ref.child,
|
|
3741
|
-
ctrl = _ref.ctrl
|
|
3810
|
+
ctrl = _ref.ctrl,
|
|
3811
|
+
method = _ref.method;
|
|
3742
3812
|
if (isHidden) {
|
|
3743
3813
|
valid ? ctx.ctrlRule.push({
|
|
3744
3814
|
__ctrl: true,
|
|
@@ -3746,7 +3816,20 @@
|
|
|
3746
3816
|
valid: valid
|
|
3747
3817
|
}) : ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl), 1);
|
|
3748
3818
|
hideLst[valid ? 'push' : 'unshift'](function () {
|
|
3749
|
-
|
|
3819
|
+
if (method === 'disabled') {
|
|
3820
|
+
_this7.api.disabled(!valid, rule);
|
|
3821
|
+
} else if (method === 'display') {
|
|
3822
|
+
_this7.api.display(valid, rule);
|
|
3823
|
+
} else if (method === 'required') {
|
|
3824
|
+
rule.forEach(function (item) {
|
|
3825
|
+
_this7.api.setEffect(item, 'required', valid);
|
|
3826
|
+
});
|
|
3827
|
+
if (!valid) {
|
|
3828
|
+
_this7.api.clearValidateState(rule);
|
|
3829
|
+
}
|
|
3830
|
+
} else {
|
|
3831
|
+
_this7.api.hidden(!valid, rule);
|
|
3832
|
+
}
|
|
3750
3833
|
});
|
|
3751
3834
|
return;
|
|
3752
3835
|
}
|
|
@@ -4255,7 +4338,12 @@
|
|
|
4255
4338
|
watchEffect: function watchEffect(ctx) {
|
|
4256
4339
|
var _this3 = this;
|
|
4257
4340
|
var vm = this.vm;
|
|
4258
|
-
var effect = {
|
|
4341
|
+
var effect = {
|
|
4342
|
+
required: function required() {
|
|
4343
|
+
var _ctx$rule, _ctx$rule$effect;
|
|
4344
|
+
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;
|
|
4345
|
+
}
|
|
4346
|
+
};
|
|
4259
4347
|
Object.keys(ctx.rule.effect || {}).forEach(function (k) {
|
|
4260
4348
|
effect[k] = function () {
|
|
4261
4349
|
return ctx.rule.effect[k];
|
|
@@ -4338,7 +4426,7 @@
|
|
|
4338
4426
|
return ctx.clearEffectData(attr);
|
|
4339
4427
|
};
|
|
4340
4428
|
data.mergeProp = function (prop) {
|
|
4341
|
-
return
|
|
4429
|
+
return mergeRule(data.getProp(), [prop]);
|
|
4342
4430
|
};
|
|
4343
4431
|
}
|
|
4344
4432
|
_this4.bus.$emit("p:".concat(attr, ":").concat(_type, ":").concat(p.input ? 1 : 0), event, [data, rule, _this4.api]);
|
|
@@ -4721,6 +4809,10 @@
|
|
|
4721
4809
|
return {
|
|
4722
4810
|
message: val
|
|
4723
4811
|
};
|
|
4812
|
+
} else if (is.Undef(val)) {
|
|
4813
|
+
return {
|
|
4814
|
+
required: false
|
|
4815
|
+
};
|
|
4724
4816
|
} else if (is.Function(val)) {
|
|
4725
4817
|
return {
|
|
4726
4818
|
validator: val
|
|
@@ -5841,7 +5933,7 @@
|
|
|
5841
5933
|
function elmFormCreate() {
|
|
5842
5934
|
return FormCreateFactory({
|
|
5843
5935
|
ui: "".concat("element-ui"),
|
|
5844
|
-
version: "".concat("2.5.
|
|
5936
|
+
version: "".concat("2.5.28"),
|
|
5845
5937
|
manager: manager,
|
|
5846
5938
|
extendApi: extendApi,
|
|
5847
5939
|
install: install,
|