@form-create/element-ui 2.5.27 → 2.5.29
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 +221 -112
- package/dist/form-create.min.js +3 -3
- package/dist/form-create.min.js.map +1 -1
- package/package.json +6 -6
- package/src/core/api.js +33 -66
- package/src/core/manager.js +16 -4
- package/types/config.d.ts +2 -2
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.29
|
|
3
|
+
* (c) 2018-2023 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create
|
|
5
5
|
* Released under the MIT License.
|
|
6
6
|
*/
|
|
@@ -293,19 +293,19 @@
|
|
|
293
293
|
}));
|
|
294
294
|
},
|
|
295
295
|
update: function update() {
|
|
296
|
-
var
|
|
297
|
-
this.trueValue = this.
|
|
298
|
-
return
|
|
296
|
+
var checked = Array.isArray(this.value) ? this.value : [this.value];
|
|
297
|
+
this.trueValue = this.options().filter(function (opt) {
|
|
298
|
+
return checked.indexOf(opt.value) !== -1;
|
|
299
299
|
}).map(function (option) {
|
|
300
300
|
return option.label;
|
|
301
|
-
})
|
|
301
|
+
});
|
|
302
302
|
}
|
|
303
303
|
},
|
|
304
304
|
created: function created() {
|
|
305
305
|
this.update();
|
|
306
306
|
},
|
|
307
307
|
render: function render() {
|
|
308
|
-
var
|
|
308
|
+
var _this = this;
|
|
309
309
|
var h = arguments[0];
|
|
310
310
|
return h("ElCheckboxGroup", helper([{}, this.formCreateInject.prop, {}, {
|
|
311
311
|
"props": {
|
|
@@ -317,7 +317,7 @@
|
|
|
317
317
|
}
|
|
318
318
|
}]), [this.options().map(function (opt, index) {
|
|
319
319
|
var props = _objectSpread2({}, opt);
|
|
320
|
-
var Type =
|
|
320
|
+
var Type = _this.type === 'button' ? 'ElCheckboxButton' : 'ElCheckbox';
|
|
321
321
|
delete props.value;
|
|
322
322
|
return h(Type, helper([{}, {
|
|
323
323
|
"props": props
|
|
@@ -1227,7 +1227,7 @@
|
|
|
1227
1227
|
}).filter(function (url) {
|
|
1228
1228
|
return url !== undefined;
|
|
1229
1229
|
});
|
|
1230
|
-
if (this.cacheFiles.length !== files.length) {
|
|
1230
|
+
if (this.cacheFiles.length !== files.length || !files.length) {
|
|
1231
1231
|
this.cacheFiles = _toConsumableArray(files);
|
|
1232
1232
|
this.$emit('input', this.limit === 1 ? files[0] || '' : files);
|
|
1233
1233
|
}
|
|
@@ -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;
|
|
@@ -2755,11 +2759,16 @@
|
|
|
2755
2759
|
clearOrgChildren: function clearOrgChildren() {
|
|
2756
2760
|
this.orgChildren = {};
|
|
2757
2761
|
},
|
|
2758
|
-
getTypeSlot: function getTypeSlot(
|
|
2759
|
-
var name = 'type-' + toLine(type);
|
|
2762
|
+
getTypeSlot: function getTypeSlot(ctx) {
|
|
2760
2763
|
var _fn = function _fn(vm) {
|
|
2761
2764
|
if (vm) {
|
|
2762
|
-
var slot =
|
|
2765
|
+
var slot = undefined;
|
|
2766
|
+
if (ctx.rule.field) {
|
|
2767
|
+
slot = vm.$scopedSlots['field-' + toLine(ctx.rule.field)] || vm.$scopedSlots['field-' + ctx.rule.field];
|
|
2768
|
+
}
|
|
2769
|
+
if (!slot) {
|
|
2770
|
+
slot = vm.$scopedSlots['type-' + toLine(ctx.type)] || vm.$scopedSlots['type-' + ctx.type];
|
|
2771
|
+
}
|
|
2763
2772
|
if (slot) {
|
|
2764
2773
|
return slot;
|
|
2765
2774
|
}
|
|
@@ -2880,12 +2889,16 @@
|
|
|
2880
2889
|
vn.data.key = key;
|
|
2881
2890
|
return vn;
|
|
2882
2891
|
},
|
|
2883
|
-
parseSide: function parseSide(side) {
|
|
2884
|
-
return is.Object(side) ? mergeRule({
|
|
2892
|
+
parseSide: function parseSide(side, ctx) {
|
|
2893
|
+
return is.Object(side) ? mergeRule({
|
|
2894
|
+
props: {
|
|
2895
|
+
formCreateInject: ctx.prop.props.formCreateInject
|
|
2896
|
+
}
|
|
2897
|
+
}, side) : side;
|
|
2885
2898
|
},
|
|
2886
2899
|
renderSides: function renderSides(vn, ctx, temp) {
|
|
2887
2900
|
var prop = ctx[temp ? 'rule' : 'prop'];
|
|
2888
|
-
return [this.renderRule(this.parseSide(prop.prefix)), vn, this.renderRule(this.parseSide(prop.suffix))];
|
|
2901
|
+
return [this.renderRule(this.parseSide(prop.prefix, ctx)), vn, this.renderRule(this.parseSide(prop.suffix, ctx))];
|
|
2889
2902
|
},
|
|
2890
2903
|
renderSlot: function renderSlot(ctx, slot) {
|
|
2891
2904
|
return ctx.rule.slot === slot ? this.renderCtx(ctx) : undefined;
|
|
@@ -2938,7 +2951,7 @@
|
|
|
2938
2951
|
} else if (ctx.parser.loadChildren !== false) {
|
|
2939
2952
|
children = this.renderChildren(ctx);
|
|
2940
2953
|
}
|
|
2941
|
-
var slot = this.getTypeSlot(ctx
|
|
2954
|
+
var slot = this.getTypeSlot(ctx);
|
|
2942
2955
|
if (slot) {
|
|
2943
2956
|
vn = slot({
|
|
2944
2957
|
rule: rule,
|
|
@@ -3414,7 +3427,7 @@
|
|
|
3414
3427
|
var _this = this;
|
|
3415
3428
|
var rule = _objectSpread2({}, this.rule);
|
|
3416
3429
|
delete rule.children;
|
|
3417
|
-
this.prop =
|
|
3430
|
+
this.prop = mergeRule({}, [rule].concat(_toConsumableArray(Object.keys(this.payload).map(function (k) {
|
|
3418
3431
|
return _this.payload[k];
|
|
3419
3432
|
})), [this.computed]));
|
|
3420
3433
|
},
|
|
@@ -3506,6 +3519,73 @@
|
|
|
3506
3519
|
}
|
|
3507
3520
|
});
|
|
3508
3521
|
|
|
3522
|
+
var condition = {
|
|
3523
|
+
'==': function _(b) {
|
|
3524
|
+
return function (a) {
|
|
3525
|
+
return a === b;
|
|
3526
|
+
};
|
|
3527
|
+
},
|
|
3528
|
+
'!=': function _(b) {
|
|
3529
|
+
return function (a) {
|
|
3530
|
+
return a !== b;
|
|
3531
|
+
};
|
|
3532
|
+
},
|
|
3533
|
+
'<>': function _(b) {
|
|
3534
|
+
return function (a) {
|
|
3535
|
+
return a !== b;
|
|
3536
|
+
};
|
|
3537
|
+
},
|
|
3538
|
+
'>': function _(b) {
|
|
3539
|
+
return function (a) {
|
|
3540
|
+
return a > b;
|
|
3541
|
+
};
|
|
3542
|
+
},
|
|
3543
|
+
'>=': function _(b) {
|
|
3544
|
+
return function (a) {
|
|
3545
|
+
return a >= b;
|
|
3546
|
+
};
|
|
3547
|
+
},
|
|
3548
|
+
'<': function _(b) {
|
|
3549
|
+
return function (a) {
|
|
3550
|
+
return a < b;
|
|
3551
|
+
};
|
|
3552
|
+
},
|
|
3553
|
+
'<=': function _(b) {
|
|
3554
|
+
return function (a) {
|
|
3555
|
+
return a <= b;
|
|
3556
|
+
};
|
|
3557
|
+
},
|
|
3558
|
+
'in': function _in(b) {
|
|
3559
|
+
return function (a) {
|
|
3560
|
+
return b && b.indexOf && b.indexOf(a) > -1;
|
|
3561
|
+
};
|
|
3562
|
+
},
|
|
3563
|
+
'on': function on(b) {
|
|
3564
|
+
return function (a) {
|
|
3565
|
+
return a && a.indexOf && a.indexOf(b) > -1;
|
|
3566
|
+
};
|
|
3567
|
+
},
|
|
3568
|
+
'notIn': function notIn(b) {
|
|
3569
|
+
return function (a) {
|
|
3570
|
+
return !condition["in"](b)(a);
|
|
3571
|
+
};
|
|
3572
|
+
},
|
|
3573
|
+
'notOn': function notOn(b) {
|
|
3574
|
+
return function (a) {
|
|
3575
|
+
return !condition.on(b)(a);
|
|
3576
|
+
};
|
|
3577
|
+
},
|
|
3578
|
+
'between': function between(b) {
|
|
3579
|
+
return function (a) {
|
|
3580
|
+
return a > b[0] && a < b[1];
|
|
3581
|
+
};
|
|
3582
|
+
},
|
|
3583
|
+
'notBetween': function notBetween(b) {
|
|
3584
|
+
return function (a) {
|
|
3585
|
+
return a < b[0] || a > b[1];
|
|
3586
|
+
};
|
|
3587
|
+
}
|
|
3588
|
+
};
|
|
3509
3589
|
function useLoader(Handler) {
|
|
3510
3590
|
extend(Handler.prototype, {
|
|
3511
3591
|
nextRefresh: function nextRefresh(fn) {
|
|
@@ -3613,7 +3693,7 @@
|
|
|
3613
3693
|
}
|
|
3614
3694
|
};
|
|
3615
3695
|
rules.map(function (_rule, index) {
|
|
3616
|
-
if (parent &&
|
|
3696
|
+
if (parent && !is.Object(_rule)) return;
|
|
3617
3697
|
if (!_this6.pageEnd && !parent && index >= _this6.first) return;
|
|
3618
3698
|
if (_rule.__fc__ && _rule.__fc__.root === rules && _this6.ctxs[_rule.__fc__.id]) {
|
|
3619
3699
|
loadChildren(_rule.__fc__.rule.children, _rule.__fc__);
|
|
@@ -3688,7 +3768,7 @@
|
|
|
3688
3768
|
ctx.updated = true;
|
|
3689
3769
|
if (is.Function(r.update)) {
|
|
3690
3770
|
_this6.bus.$once('load-end', function () {
|
|
3691
|
-
_this6.refreshUpdate(ctx, r.value);
|
|
3771
|
+
_this6.refreshUpdate(ctx, r.value, 'init');
|
|
3692
3772
|
});
|
|
3693
3773
|
}
|
|
3694
3774
|
_this6.effect(ctx, 'loaded');
|
|
@@ -3709,9 +3789,7 @@
|
|
|
3709
3789
|
if (!controls.length) return false;
|
|
3710
3790
|
var _loop = function _loop(i) {
|
|
3711
3791
|
var control = controls[i],
|
|
3712
|
-
handleFn = control.handle ||
|
|
3713
|
-
return val === control.value;
|
|
3714
|
-
};
|
|
3792
|
+
handleFn = control.handle || (condition[control.condition || '=='] || condition['=='])(control.value);
|
|
3715
3793
|
if (!is.trueArray(control.rule)) return "continue";
|
|
3716
3794
|
var data = _objectSpread2(_objectSpread2({}, control), {}, {
|
|
3717
3795
|
valid: invoke(function () {
|
|
@@ -3738,7 +3816,8 @@
|
|
|
3738
3816
|
prepend = _ref.prepend,
|
|
3739
3817
|
append = _ref.append,
|
|
3740
3818
|
child = _ref.child,
|
|
3741
|
-
ctrl = _ref.ctrl
|
|
3819
|
+
ctrl = _ref.ctrl,
|
|
3820
|
+
method = _ref.method;
|
|
3742
3821
|
if (isHidden) {
|
|
3743
3822
|
valid ? ctx.ctrlRule.push({
|
|
3744
3823
|
__ctrl: true,
|
|
@@ -3746,7 +3825,20 @@
|
|
|
3746
3825
|
valid: valid
|
|
3747
3826
|
}) : ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl), 1);
|
|
3748
3827
|
hideLst[valid ? 'push' : 'unshift'](function () {
|
|
3749
|
-
|
|
3828
|
+
if (method === 'disabled') {
|
|
3829
|
+
_this7.api.disabled(!valid, rule);
|
|
3830
|
+
} else if (method === 'display') {
|
|
3831
|
+
_this7.api.display(valid, rule);
|
|
3832
|
+
} else if (method === 'required') {
|
|
3833
|
+
rule.forEach(function (item) {
|
|
3834
|
+
_this7.api.setEffect(item, 'required', valid);
|
|
3835
|
+
});
|
|
3836
|
+
if (!valid) {
|
|
3837
|
+
_this7.api.clearValidateState(rule);
|
|
3838
|
+
}
|
|
3839
|
+
} else {
|
|
3840
|
+
_this7.api.hidden(!valid, rule);
|
|
3841
|
+
}
|
|
3750
3842
|
});
|
|
3751
3843
|
return;
|
|
3752
3844
|
}
|
|
@@ -3955,11 +4047,13 @@
|
|
|
3955
4047
|
isQuote: function isQuote(ctx, value) {
|
|
3956
4048
|
return (is.Object(value) || Array.isArray(value)) && value === ctx.rule.value;
|
|
3957
4049
|
},
|
|
3958
|
-
refreshUpdate: function refreshUpdate(ctx, val) {
|
|
4050
|
+
refreshUpdate: function refreshUpdate(ctx, val, origin) {
|
|
3959
4051
|
var _this4 = this;
|
|
3960
4052
|
if (is.Function(ctx.rule.update)) {
|
|
3961
4053
|
var state = invoke(function () {
|
|
3962
|
-
return ctx.rule.update(val, ctx.origin, _this4.api
|
|
4054
|
+
return ctx.rule.update(val, ctx.origin, _this4.api, {
|
|
4055
|
+
origin: origin || 'change'
|
|
4056
|
+
});
|
|
3963
4057
|
});
|
|
3964
4058
|
if (state === undefined) return;
|
|
3965
4059
|
ctx.rule.hidden = state === true;
|
|
@@ -3969,21 +4063,21 @@
|
|
|
3969
4063
|
this.refreshRule(ctx, val);
|
|
3970
4064
|
this.bus.$emit('change-' + ctx.field, val);
|
|
3971
4065
|
},
|
|
3972
|
-
refreshRule: function refreshRule(ctx, val) {
|
|
4066
|
+
refreshRule: function refreshRule(ctx, val, origin) {
|
|
3973
4067
|
if (this.refreshControl(ctx)) {
|
|
3974
4068
|
this.$render.clearCacheAll();
|
|
3975
4069
|
this.loadRule();
|
|
3976
4070
|
this.vm.$emit('update', this.api);
|
|
3977
4071
|
this.refresh();
|
|
3978
4072
|
}
|
|
3979
|
-
this.refreshUpdate(ctx, val);
|
|
4073
|
+
this.refreshUpdate(ctx, val, origin);
|
|
3980
4074
|
},
|
|
3981
4075
|
appendLink: function appendLink(ctx) {
|
|
3982
4076
|
var _this5 = this;
|
|
3983
4077
|
var link = ctx.rule.link;
|
|
3984
4078
|
is.trueArray(link) && link.forEach(function (field) {
|
|
3985
4079
|
var fn = function fn() {
|
|
3986
|
-
return _this5.refreshRule(ctx, ctx.rule.value);
|
|
4080
|
+
return _this5.refreshRule(ctx, ctx.rule.value, 'link');
|
|
3987
4081
|
};
|
|
3988
4082
|
_this5.bus.$on('change-' + field, fn);
|
|
3989
4083
|
ctx.linkOn.push(function () {
|
|
@@ -4255,7 +4349,12 @@
|
|
|
4255
4349
|
watchEffect: function watchEffect(ctx) {
|
|
4256
4350
|
var _this3 = this;
|
|
4257
4351
|
var vm = this.vm;
|
|
4258
|
-
var effect = {
|
|
4352
|
+
var effect = {
|
|
4353
|
+
required: function required() {
|
|
4354
|
+
var _ctx$rule, _ctx$rule$effect;
|
|
4355
|
+
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;
|
|
4356
|
+
}
|
|
4357
|
+
};
|
|
4259
4358
|
Object.keys(ctx.rule.effect || {}).forEach(function (k) {
|
|
4260
4359
|
effect[k] = function () {
|
|
4261
4360
|
return ctx.rule.effect[k];
|
|
@@ -4338,7 +4437,7 @@
|
|
|
4338
4437
|
return ctx.clearEffectData(attr);
|
|
4339
4438
|
};
|
|
4340
4439
|
data.mergeProp = function (prop) {
|
|
4341
|
-
return
|
|
4440
|
+
return mergeRule(data.getProp(), [prop]);
|
|
4342
4441
|
};
|
|
4343
4442
|
}
|
|
4344
4443
|
_this4.bus.$emit("p:".concat(attr, ":").concat(_type, ":").concat(p.input ? 1 : 0), event, [data, rule, _this4.api]);
|
|
@@ -4608,6 +4707,35 @@
|
|
|
4608
4707
|
render: function render(children) {}
|
|
4609
4708
|
});
|
|
4610
4709
|
|
|
4710
|
+
var componentValidate = {
|
|
4711
|
+
name: 'componentValidate',
|
|
4712
|
+
load: function load(attr, rule, api) {
|
|
4713
|
+
var method = attr.getValue();
|
|
4714
|
+
if (!method) {
|
|
4715
|
+
attr.clearProp();
|
|
4716
|
+
api.clearValidateState([rule.field]);
|
|
4717
|
+
} else {
|
|
4718
|
+
attr.getProp().validate = [{
|
|
4719
|
+
validator: function validator() {
|
|
4720
|
+
var ctx = byCtx(rule);
|
|
4721
|
+
if (ctx) {
|
|
4722
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
4723
|
+
args[_key] = arguments[_key];
|
|
4724
|
+
}
|
|
4725
|
+
return api.exec.apply(api, [ctx.id, method === true ? 'formCreateValidate' : method].concat(args, [{
|
|
4726
|
+
attr: attr,
|
|
4727
|
+
rule: rule,
|
|
4728
|
+
api: api
|
|
4729
|
+
}]));
|
|
4730
|
+
}
|
|
4731
|
+
}
|
|
4732
|
+
}];
|
|
4733
|
+
}
|
|
4734
|
+
},
|
|
4735
|
+
watch: function watch() {
|
|
4736
|
+
componentValidate.load.apply(componentValidate, arguments);
|
|
4737
|
+
}
|
|
4738
|
+
};
|
|
4611
4739
|
var fetch$1 = function fetch(fc) {
|
|
4612
4740
|
function parseOpt(option) {
|
|
4613
4741
|
if (is.String(option)) {
|
|
@@ -4721,6 +4849,10 @@
|
|
|
4721
4849
|
return {
|
|
4722
4850
|
message: val
|
|
4723
4851
|
};
|
|
4852
|
+
} else if (is.Undef(val)) {
|
|
4853
|
+
return {
|
|
4854
|
+
required: false
|
|
4855
|
+
};
|
|
4724
4856
|
} else if (is.Function(val)) {
|
|
4725
4857
|
return {
|
|
4726
4858
|
validator: val
|
|
@@ -4733,7 +4865,8 @@
|
|
|
4733
4865
|
}
|
|
4734
4866
|
var $provider = {
|
|
4735
4867
|
fetch: fetch$1,
|
|
4736
|
-
required: $required
|
|
4868
|
+
required: $required,
|
|
4869
|
+
componentValidate: componentValidate
|
|
4737
4870
|
};
|
|
4738
4871
|
|
|
4739
4872
|
var name = 'html';
|
|
@@ -5322,11 +5455,27 @@
|
|
|
5322
5455
|
}
|
|
5323
5456
|
}
|
|
5324
5457
|
var manager = {
|
|
5325
|
-
validate: function validate(
|
|
5326
|
-
this.form()
|
|
5458
|
+
validate: function validate() {
|
|
5459
|
+
var form = this.form();
|
|
5460
|
+
if (form) {
|
|
5461
|
+
return form.validate();
|
|
5462
|
+
}
|
|
5463
|
+
return new Promise(function (v) {
|
|
5464
|
+
return v();
|
|
5465
|
+
});
|
|
5327
5466
|
},
|
|
5328
|
-
validateField: function validateField(field
|
|
5329
|
-
this.form()
|
|
5467
|
+
validateField: function validateField(field) {
|
|
5468
|
+
var form = this.form();
|
|
5469
|
+
if (form) {
|
|
5470
|
+
return new Promise(function (resolve, reject) {
|
|
5471
|
+
form.validateField(field, function (e) {
|
|
5472
|
+
e ? reject(e) : resolve(null);
|
|
5473
|
+
});
|
|
5474
|
+
});
|
|
5475
|
+
}
|
|
5476
|
+
return new Promise(function (v) {
|
|
5477
|
+
return v();
|
|
5478
|
+
});
|
|
5330
5479
|
},
|
|
5331
5480
|
clearValidateState: function clearValidateState(ctx) {
|
|
5332
5481
|
var fItem = this.vm.$refs[ctx.wrapRef];
|
|
@@ -5640,87 +5789,47 @@
|
|
|
5640
5789
|
function extendApi(api, h) {
|
|
5641
5790
|
extend(api, {
|
|
5642
5791
|
validate: function validate(callback) {
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
5649
|
-
args[_key] = arguments[_key];
|
|
5650
|
-
}
|
|
5651
|
-
if (!args[0] || !flag) {
|
|
5652
|
-
flag = args;
|
|
5653
|
-
}
|
|
5654
|
-
callback && callback.apply(void 0, _toConsumableArray(flag));
|
|
5655
|
-
});
|
|
5656
|
-
};
|
|
5657
|
-
var validFn = function validFn(args) {
|
|
5658
|
-
setTimeout(function () {
|
|
5659
|
-
if (!args[0]) {
|
|
5660
|
-
if (!flag) {
|
|
5661
|
-
flag = args;
|
|
5662
|
-
}
|
|
5663
|
-
}
|
|
5664
|
-
if (! --len) {
|
|
5665
|
-
validate();
|
|
5666
|
-
}
|
|
5792
|
+
return new Promise(function (resolve, reject) {
|
|
5793
|
+
var forms = api.children;
|
|
5794
|
+
var all = [h.$manager.validate()];
|
|
5795
|
+
forms.forEach(function (v) {
|
|
5796
|
+
all.push(v.validate());
|
|
5667
5797
|
});
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5798
|
+
Promise.all(all).then(function () {
|
|
5799
|
+
resolve(true);
|
|
5800
|
+
callback && callback(true);
|
|
5801
|
+
})["catch"](function (e) {
|
|
5802
|
+
reject(e);
|
|
5803
|
+
callback && callback(e);
|
|
5804
|
+
h.vm.$emit('validate-fail', e, {
|
|
5805
|
+
api: api
|
|
5806
|
+
});
|
|
5675
5807
|
});
|
|
5676
5808
|
});
|
|
5677
|
-
if (!len) {
|
|
5678
|
-
validate();
|
|
5679
|
-
}
|
|
5680
5809
|
},
|
|
5681
5810
|
validateField: function validateField(field, callback) {
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
}
|
|
5692
|
-
if (args[0]) {
|
|
5693
|
-
flag = args;
|
|
5694
|
-
} else if (flag) {
|
|
5695
|
-
return callback && callback('子表单验证未通过', flag[1]);
|
|
5696
|
-
}
|
|
5697
|
-
callback && callback.apply(void 0, _toConsumableArray(flag || args));
|
|
5698
|
-
});
|
|
5699
|
-
};
|
|
5700
|
-
var validFn = function validFn(args) {
|
|
5701
|
-
setTimeout(function () {
|
|
5702
|
-
if (!args[0]) {
|
|
5703
|
-
if (!flag) {
|
|
5704
|
-
flag = args;
|
|
5705
|
-
}
|
|
5706
|
-
}
|
|
5707
|
-
if (! --len) {
|
|
5708
|
-
validate();
|
|
5709
|
-
}
|
|
5811
|
+
return new Promise(function (resolve, reject) {
|
|
5812
|
+
var ctx = h.getFieldCtx(field);
|
|
5813
|
+
if (!ctx) return;
|
|
5814
|
+
var sub = h.subForm[ctx.id];
|
|
5815
|
+
var all = [h.$manager.validateField(ctx.id)];
|
|
5816
|
+
toArray(sub).forEach(function (v) {
|
|
5817
|
+
all.push(v.validate()["catch"](function () {
|
|
5818
|
+
return Promise.reject('子表单验证未通过');
|
|
5819
|
+
}));
|
|
5710
5820
|
});
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5821
|
+
Promise.all(all).then(function () {
|
|
5822
|
+
resolve(null);
|
|
5823
|
+
callback && callback(null);
|
|
5824
|
+
})["catch"](function (e) {
|
|
5825
|
+
reject(e);
|
|
5826
|
+
callback && callback(e);
|
|
5827
|
+
h.vm.$emit('validate-field-fail', e, {
|
|
5828
|
+
field: field,
|
|
5829
|
+
api: api
|
|
5830
|
+
});
|
|
5719
5831
|
});
|
|
5720
5832
|
});
|
|
5721
|
-
if (!len) {
|
|
5722
|
-
validate();
|
|
5723
|
-
}
|
|
5724
5833
|
},
|
|
5725
5834
|
clearValidateState: function clearValidateState(fields) {
|
|
5726
5835
|
var _this = this;
|
|
@@ -5841,7 +5950,7 @@
|
|
|
5841
5950
|
function elmFormCreate() {
|
|
5842
5951
|
return FormCreateFactory({
|
|
5843
5952
|
ui: "".concat("element-ui"),
|
|
5844
|
-
version: "".concat("2.5.
|
|
5953
|
+
version: "".concat("2.5.29"),
|
|
5845
5954
|
manager: manager,
|
|
5846
5955
|
extendApi: extendApi,
|
|
5847
5956
|
install: install,
|