@form-create/element-ui 2.5.23 → 2.5.26
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 +202 -150
- package/dist/form-create.min.js +2 -2
- package/dist/form-create.min.js.map +1 -1
- package/package.json +11 -12
- package/types/config.d.ts +8 -12
package/dist/form-create.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/element-ui v2.5.
|
|
2
|
+
* @form-create/element-ui v2.5.26
|
|
3
3
|
* (c) 2018-2022 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create
|
|
5
5
|
* Released under the MIT License.
|
|
@@ -307,10 +307,11 @@
|
|
|
307
307
|
render: function render() {
|
|
308
308
|
var _this2 = this;
|
|
309
309
|
var h = arguments[0];
|
|
310
|
-
return h("ElCheckboxGroup", helper([{}, this.formCreateInject.prop, {
|
|
311
|
-
"
|
|
312
|
-
|
|
313
|
-
}
|
|
310
|
+
return h("ElCheckboxGroup", helper([{}, this.formCreateInject.prop, {}, {
|
|
311
|
+
"props": {
|
|
312
|
+
value: this.trueValue
|
|
313
|
+
}
|
|
314
|
+
}, {
|
|
314
315
|
"on": {
|
|
315
316
|
"input": this.onInput
|
|
316
317
|
}
|
|
@@ -318,10 +319,11 @@
|
|
|
318
319
|
var props = _objectSpread2({}, opt);
|
|
319
320
|
var Type = _this2.type === 'button' ? 'ElCheckboxButton' : 'ElCheckbox';
|
|
320
321
|
delete props.value;
|
|
321
|
-
return h(Type, {
|
|
322
|
-
"props":
|
|
322
|
+
return h(Type, helper([{}, {
|
|
323
|
+
"props": props
|
|
324
|
+
}, {
|
|
323
325
|
"key": Type + index + '-' + opt.value
|
|
324
|
-
});
|
|
326
|
+
}]));
|
|
325
327
|
}), getSlot(this.$slots)]);
|
|
326
328
|
}
|
|
327
329
|
};
|
|
@@ -762,36 +764,37 @@
|
|
|
762
764
|
});
|
|
763
765
|
return h("div", {
|
|
764
766
|
"class": "_fc-frame"
|
|
765
|
-
}, [node, h("el-dialog", {
|
|
766
|
-
"
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
}
|
|
767
|
+
}, [node, h("el-dialog", helper([{}, {
|
|
768
|
+
"props": {
|
|
769
|
+
appendToBody: true,
|
|
770
|
+
modal: this.previewMask,
|
|
771
|
+
title: modalTitle,
|
|
772
|
+
visible: this.previewVisible
|
|
773
|
+
}
|
|
774
|
+
}, {
|
|
772
775
|
"on": {
|
|
773
776
|
"close": this.handleCancel
|
|
774
777
|
}
|
|
775
|
-
}, [h("img", {
|
|
778
|
+
}]), [h("img", {
|
|
776
779
|
"style": "width: 100%",
|
|
777
780
|
"attrs": {
|
|
778
781
|
"src": this.previewImage
|
|
779
782
|
}
|
|
780
|
-
})]), h("el-dialog", {
|
|
781
|
-
"
|
|
782
|
-
"appendToBody": true,
|
|
783
|
-
"visible": this.frameVisible
|
|
784
|
-
},
|
|
785
|
-
"props": _objectSpread2({}, _objectSpread2({
|
|
783
|
+
})]), h("el-dialog", helper([{}, {
|
|
784
|
+
"props": _objectSpread2(_objectSpread2({
|
|
786
785
|
width: width,
|
|
787
|
-
title: title
|
|
788
|
-
|
|
786
|
+
title: title,
|
|
787
|
+
appendToBody: true
|
|
788
|
+
}, this.modal), {}, {
|
|
789
|
+
visible: this.frameVisible
|
|
790
|
+
})
|
|
791
|
+
}, {
|
|
789
792
|
"on": {
|
|
790
793
|
"close": function close() {
|
|
791
794
|
return _this9.closeModel(true);
|
|
792
795
|
}
|
|
793
796
|
}
|
|
794
|
-
}, [this.frameVisible || !this.reload ? h("iframe", {
|
|
797
|
+
}]), [this.frameVisible || !this.reload ? h("iframe", {
|
|
795
798
|
"ref": "frame",
|
|
796
799
|
"attrs": {
|
|
797
800
|
"src": src,
|
|
@@ -863,10 +866,11 @@
|
|
|
863
866
|
render: function render() {
|
|
864
867
|
var _this2 = this;
|
|
865
868
|
var h = arguments[0];
|
|
866
|
-
return h("ElRadioGroup", helper([{}, this.formCreateInject.prop, {
|
|
867
|
-
"
|
|
868
|
-
|
|
869
|
-
}
|
|
869
|
+
return h("ElRadioGroup", helper([{}, this.formCreateInject.prop, {}, {
|
|
870
|
+
"props": {
|
|
871
|
+
value: this.trueValue
|
|
872
|
+
}
|
|
873
|
+
}, {
|
|
870
874
|
"on": {
|
|
871
875
|
"input": this.onInput
|
|
872
876
|
}
|
|
@@ -874,10 +878,11 @@
|
|
|
874
878
|
var props = _objectSpread2({}, opt);
|
|
875
879
|
var Type = _this2.type === 'button' ? 'ElRadioButton' : 'ElRadio';
|
|
876
880
|
delete props.value;
|
|
877
|
-
return h(Type, {
|
|
878
|
-
"props":
|
|
881
|
+
return h(Type, helper([{}, {
|
|
882
|
+
"props": props
|
|
883
|
+
}, {
|
|
879
884
|
"key": Type + index + '-' + opt.value
|
|
880
|
-
});
|
|
885
|
+
}]));
|
|
881
886
|
}), getSlot(this.$slots)]);
|
|
882
887
|
}
|
|
883
888
|
};
|
|
@@ -936,10 +941,11 @@
|
|
|
936
941
|
var options = ctx.props.formCreateInject.options;
|
|
937
942
|
return h("ElSelect", helper([{}, ctx.data]), [(Array.isArray(options) ? options : []).map(function (props, index) {
|
|
938
943
|
var slot = props.slot;
|
|
939
|
-
return h("ElOption", {
|
|
940
|
-
"props":
|
|
944
|
+
return h("ElOption", helper([{}, {
|
|
945
|
+
"props": props
|
|
946
|
+
}, {
|
|
941
947
|
"key": '' + index + '-' + props.value
|
|
942
|
-
}, [slot ? h("template", {
|
|
948
|
+
}]), [slot ? h("template", {
|
|
943
949
|
"slot": props.slotName || 'default'
|
|
944
950
|
}, [is.Function(slot) ? props.slot(h) : slot]) : null]);
|
|
945
951
|
}), ctx.children]);
|
|
@@ -1240,17 +1246,18 @@
|
|
|
1240
1246
|
}
|
|
1241
1247
|
return h("div", {
|
|
1242
1248
|
"class": '_fc-upload'
|
|
1243
|
-
}, [[this.formCreateInject.prop.props.showFileList ? [] : this.makeFiles(), this.makeUpload()], h("el-dialog", {
|
|
1244
|
-
"
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
}
|
|
1249
|
+
}, [[this.formCreateInject.prop.props.showFileList ? [] : this.makeFiles(), this.makeUpload()], h("el-dialog", helper([{}, {
|
|
1250
|
+
"props": {
|
|
1251
|
+
appendToBody: true,
|
|
1252
|
+
modal: this.previewMask,
|
|
1253
|
+
title: this.modalTitle,
|
|
1254
|
+
visible: this.previewVisible
|
|
1255
|
+
}
|
|
1256
|
+
}, {
|
|
1250
1257
|
"on": {
|
|
1251
1258
|
"close": this.handleCancel
|
|
1252
1259
|
}
|
|
1253
|
-
}, [h("img", {
|
|
1260
|
+
}]), [h("img", {
|
|
1254
1261
|
"attrs": {
|
|
1255
1262
|
"alt": "example",
|
|
1256
1263
|
"src": this.previewImage
|
|
@@ -1669,11 +1676,8 @@
|
|
|
1669
1676
|
"attrs": {
|
|
1670
1677
|
"span": button ? 20 : 24
|
|
1671
1678
|
}
|
|
1672
|
-
}, [h(
|
|
1673
|
-
"key": key
|
|
1674
|
-
"attrs": {
|
|
1675
|
-
"inFor": true
|
|
1676
|
-
}
|
|
1679
|
+
}, [h(Type, helper([{
|
|
1680
|
+
"key": key
|
|
1677
1681
|
}, {
|
|
1678
1682
|
"on": {
|
|
1679
1683
|
'update:value': function updateValue(formData) {
|
|
@@ -1689,20 +1693,21 @@
|
|
|
1689
1693
|
return _this9.add$f(index, key, $f);
|
|
1690
1694
|
}
|
|
1691
1695
|
}
|
|
1692
|
-
}, {
|
|
1693
|
-
"
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1696
|
+
}, {}, {
|
|
1697
|
+
"props": {
|
|
1698
|
+
value: _this9.field ? _defineProperty({}, _this9.field, _this9._value(_this9.value[index])) : _this9.value[index],
|
|
1699
|
+
rule: rule,
|
|
1700
|
+
option: options,
|
|
1701
|
+
extendOption: true,
|
|
1702
|
+
inFor: true
|
|
1698
1703
|
}
|
|
1699
|
-
}]))])
|
|
1700
|
-
"
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
+
}]))]), button ? h("ElCol", helper([{}, {
|
|
1705
|
+
"props": {
|
|
1706
|
+
span: 2,
|
|
1707
|
+
pull: 1,
|
|
1708
|
+
push: 1
|
|
1704
1709
|
}
|
|
1705
|
-
}, [_this9.makeIcon(keys.length, index, key)]) : null]);
|
|
1710
|
+
}]), [_this9.makeIcon(keys.length, index, key)]) : null]);
|
|
1706
1711
|
})]);
|
|
1707
1712
|
}
|
|
1708
1713
|
};
|
|
@@ -1803,11 +1808,11 @@
|
|
|
1803
1808
|
'emit-event': this.emitEvent,
|
|
1804
1809
|
input: this.add$f
|
|
1805
1810
|
}
|
|
1806
|
-
}, {
|
|
1807
|
-
"
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
+
}, {}, {
|
|
1812
|
+
"props": {
|
|
1813
|
+
rule: rule,
|
|
1814
|
+
option: options,
|
|
1815
|
+
extendOption: true
|
|
1811
1816
|
}
|
|
1812
1817
|
}]));
|
|
1813
1818
|
}
|
|
@@ -1899,7 +1904,7 @@
|
|
|
1899
1904
|
value: {
|
|
1900
1905
|
handler: function handler(n) {
|
|
1901
1906
|
if (JSON.stringify(n || {}) === this.updateValue) return;
|
|
1902
|
-
this.$f.setValue(n || {});
|
|
1907
|
+
this.$f.config.forceCoverValue ? this.$f.coverValue(n || {}) : this.$f.setValue(n || {});
|
|
1903
1908
|
},
|
|
1904
1909
|
deep: true
|
|
1905
1910
|
},
|
|
@@ -2139,7 +2144,11 @@
|
|
|
2139
2144
|
return rule;
|
|
2140
2145
|
}
|
|
2141
2146
|
function getRule(rule) {
|
|
2142
|
-
|
|
2147
|
+
var r = is.Function(rule.getRule) ? rule.getRule() : rule;
|
|
2148
|
+
if (!r.type) {
|
|
2149
|
+
r.type = 'input';
|
|
2150
|
+
}
|
|
2151
|
+
return r;
|
|
2143
2152
|
}
|
|
2144
2153
|
function mergeGlobal(target, merge) {
|
|
2145
2154
|
if (!target) return merge;
|
|
@@ -2309,15 +2318,19 @@
|
|
|
2309
2318
|
return copy(ctx.rule.value);
|
|
2310
2319
|
},
|
|
2311
2320
|
coverValue: function coverValue(formData) {
|
|
2321
|
+
var data = _objectSpread2({}, formData || {});
|
|
2312
2322
|
h.deferSyncValue(function () {
|
|
2313
2323
|
api.fields().forEach(function (key) {
|
|
2314
2324
|
var ctxs = h.fieldCtx[key];
|
|
2315
|
-
if (
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2325
|
+
if (ctxs) {
|
|
2326
|
+
var flag = hasProperty(data, key);
|
|
2327
|
+
ctxs.forEach(function (ctx) {
|
|
2328
|
+
ctx.rule.value = flag ? data[key] : undefined;
|
|
2329
|
+
});
|
|
2330
|
+
delete data[key];
|
|
2331
|
+
}
|
|
2320
2332
|
});
|
|
2333
|
+
extend(h.appendData, data);
|
|
2321
2334
|
});
|
|
2322
2335
|
},
|
|
2323
2336
|
setValue: function setValue(field) {
|
|
@@ -2537,6 +2550,16 @@
|
|
|
2537
2550
|
$set(ctx.rule.effect, attr, value);
|
|
2538
2551
|
}
|
|
2539
2552
|
},
|
|
2553
|
+
clearEffectData: function clearEffectData(id, attr) {
|
|
2554
|
+
var ctx = h.getCtx(id);
|
|
2555
|
+
if (ctx) {
|
|
2556
|
+
if (attr && attr[0] === '$') {
|
|
2557
|
+
attr = attr.substr(1);
|
|
2558
|
+
}
|
|
2559
|
+
ctx.clearEffectData(attr);
|
|
2560
|
+
api.sync(id);
|
|
2561
|
+
}
|
|
2562
|
+
},
|
|
2540
2563
|
updateValidate: function updateValidate(id, validate, merge) {
|
|
2541
2564
|
if (merge) {
|
|
2542
2565
|
api.mergeRule(id, {
|
|
@@ -2663,8 +2686,11 @@
|
|
|
2663
2686
|
},
|
|
2664
2687
|
getCache: function getCache(ctx) {
|
|
2665
2688
|
var cache = this.cache[ctx.id];
|
|
2666
|
-
cache
|
|
2667
|
-
|
|
2689
|
+
if (cache) {
|
|
2690
|
+
cache.use = true;
|
|
2691
|
+
return cache.vnode;
|
|
2692
|
+
}
|
|
2693
|
+
return undefined;
|
|
2668
2694
|
}
|
|
2669
2695
|
});
|
|
2670
2696
|
}
|
|
@@ -3330,7 +3356,7 @@
|
|
|
3330
3356
|
__fc__: enumerable(ctx, true)
|
|
3331
3357
|
});
|
|
3332
3358
|
}
|
|
3333
|
-
function RuleContext(handle, rule) {
|
|
3359
|
+
function RuleContext(handle, rule, defaultValue) {
|
|
3334
3360
|
var id = uniqueId();
|
|
3335
3361
|
extend(this, {
|
|
3336
3362
|
id: id,
|
|
@@ -3350,7 +3376,7 @@
|
|
|
3350
3376
|
payload: {},
|
|
3351
3377
|
input: !!rule.field,
|
|
3352
3378
|
el: undefined,
|
|
3353
|
-
defaultValue: rule.field ? deepCopy(
|
|
3379
|
+
defaultValue: rule.field ? deepCopy(defaultValue) : undefined,
|
|
3354
3380
|
field: rule.field || undefined
|
|
3355
3381
|
});
|
|
3356
3382
|
this.updateType();
|
|
@@ -3366,7 +3392,11 @@
|
|
|
3366
3392
|
return this.payload[name];
|
|
3367
3393
|
},
|
|
3368
3394
|
clearEffectData: function clearEffectData(name) {
|
|
3369
|
-
|
|
3395
|
+
if (name === undefined) {
|
|
3396
|
+
this.payload = {};
|
|
3397
|
+
} else {
|
|
3398
|
+
delete this.payload[name];
|
|
3399
|
+
}
|
|
3370
3400
|
},
|
|
3371
3401
|
updateKey: function updateKey(flag) {
|
|
3372
3402
|
this.key = uniqueId();
|
|
@@ -3585,7 +3615,6 @@
|
|
|
3585
3615
|
rules.map(function (_rule, index) {
|
|
3586
3616
|
if (parent && (is.String(_rule) || is.Undef(_rule))) return;
|
|
3587
3617
|
if (!_this6.pageEnd && !parent && index >= _this6.first) return;
|
|
3588
|
-
if (!is.Object(_rule) || !getRule(_rule).type) return err('未定义生成规则的 type 字段', _rule);
|
|
3589
3618
|
if (_rule.__fc__ && _rule.__fc__.root === rules && _this6.ctxs[_rule.__fc__.id]) {
|
|
3590
3619
|
loadChildren(_rule.__fc__.rule.children, _rule.__fc__);
|
|
3591
3620
|
return _rule.__fc__;
|
|
@@ -3603,8 +3632,10 @@
|
|
|
3603
3632
|
var ctx;
|
|
3604
3633
|
var isCopy = false;
|
|
3605
3634
|
var isInit = !!_rule.__fc__;
|
|
3635
|
+
var defaultValue = rule.value;
|
|
3606
3636
|
if (isInit) {
|
|
3607
3637
|
ctx = _rule.__fc__;
|
|
3638
|
+
defaultValue = ctx.defaultValue;
|
|
3608
3639
|
var check = !ctx.check(_this6);
|
|
3609
3640
|
if (ctx.deleted) {
|
|
3610
3641
|
if (check) {
|
|
@@ -3625,7 +3656,8 @@
|
|
|
3625
3656
|
}
|
|
3626
3657
|
}
|
|
3627
3658
|
if (!ctx) {
|
|
3628
|
-
|
|
3659
|
+
var _rule2 = _this6.parseRule(_rule);
|
|
3660
|
+
ctx = new RuleContext(_this6, _rule2, isInit ? defaultValue : _rule2.value);
|
|
3629
3661
|
_this6.bindParser(ctx);
|
|
3630
3662
|
} else {
|
|
3631
3663
|
if (ctx.originType !== ctx.rule.type) {
|
|
@@ -3696,6 +3728,7 @@
|
|
|
3696
3728
|
if (_ret === "continue") continue;
|
|
3697
3729
|
}
|
|
3698
3730
|
if (!validate.length) return false;
|
|
3731
|
+
var hideLst = [];
|
|
3699
3732
|
var flag = false;
|
|
3700
3733
|
this.deferSyncValue(function () {
|
|
3701
3734
|
validate.reverse().forEach(function (_ref) {
|
|
@@ -3712,7 +3745,7 @@
|
|
|
3712
3745
|
children: rule,
|
|
3713
3746
|
valid: valid
|
|
3714
3747
|
}) : ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl), 1);
|
|
3715
|
-
|
|
3748
|
+
hideLst[valid ? 'push' : 'unshift'](function () {
|
|
3716
3749
|
_this7.api.hidden(!valid, rule);
|
|
3717
3750
|
});
|
|
3718
3751
|
return;
|
|
@@ -3742,6 +3775,11 @@
|
|
|
3742
3775
|
}
|
|
3743
3776
|
});
|
|
3744
3777
|
});
|
|
3778
|
+
hideLst.length && this.vm.$nextTick(function () {
|
|
3779
|
+
hideLst.forEach(function (v) {
|
|
3780
|
+
return v();
|
|
3781
|
+
});
|
|
3782
|
+
});
|
|
3745
3783
|
this.vm.$emit('control', ctx.origin, this.api);
|
|
3746
3784
|
this.effect(ctx, 'control');
|
|
3747
3785
|
return flag;
|
|
@@ -3909,7 +3947,7 @@
|
|
|
3909
3947
|
if (this.deferSyncFn) {
|
|
3910
3948
|
return this.deferSyncFn.sync = true;
|
|
3911
3949
|
}
|
|
3912
|
-
this.vm._updateValue(_objectSpread2({}, this.form));
|
|
3950
|
+
this.vm._updateValue(_objectSpread2(_objectSpread2({}, this.options.appendValue ? this.appendData : {}), this.form));
|
|
3913
3951
|
},
|
|
3914
3952
|
isChange: function isChange(ctx, value) {
|
|
3915
3953
|
return JSON.stringify(ctx.rule.value, strFn) !== JSON.stringify(value === null ? undefined : value, strFn);
|
|
@@ -4192,6 +4230,9 @@
|
|
|
4192
4230
|
var ps = this.fc.providers;
|
|
4193
4231
|
Object.keys(ps).forEach(function (k) {
|
|
4194
4232
|
var prop = ps[k];
|
|
4233
|
+
if (is.Function(prop)) {
|
|
4234
|
+
prop = prop(_this.fc);
|
|
4235
|
+
}
|
|
4195
4236
|
prop._c = getComponent(prop);
|
|
4196
4237
|
_this.onEffect(prop);
|
|
4197
4238
|
_this.providers[k] = prop;
|
|
@@ -4566,17 +4607,84 @@
|
|
|
4566
4607
|
render: function render(children) {}
|
|
4567
4608
|
});
|
|
4568
4609
|
|
|
4569
|
-
var $
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
inject.clearProp();
|
|
4577
|
-
api.sync(rule);
|
|
4610
|
+
var fetch$1 = function fetch(fc) {
|
|
4611
|
+
function parseOpt(option) {
|
|
4612
|
+
if (is.String(option)) {
|
|
4613
|
+
option = {
|
|
4614
|
+
action: option,
|
|
4615
|
+
to: 'options'
|
|
4616
|
+
};
|
|
4578
4617
|
}
|
|
4618
|
+
return option;
|
|
4579
4619
|
}
|
|
4620
|
+
function run(inject, rule, api) {
|
|
4621
|
+
var option = inject.value;
|
|
4622
|
+
if (is.Function(option)) {
|
|
4623
|
+
option = option(rule, api);
|
|
4624
|
+
}
|
|
4625
|
+
option = parseOpt(option);
|
|
4626
|
+
if (!option || !option.action) {
|
|
4627
|
+
return false;
|
|
4628
|
+
}
|
|
4629
|
+
if (!option.to) {
|
|
4630
|
+
option.to = 'options';
|
|
4631
|
+
}
|
|
4632
|
+
var _onError = option.onError;
|
|
4633
|
+
var check = function check() {
|
|
4634
|
+
if (!inject.getValue()) {
|
|
4635
|
+
inject.clearProp();
|
|
4636
|
+
api.sync(rule);
|
|
4637
|
+
return true;
|
|
4638
|
+
}
|
|
4639
|
+
};
|
|
4640
|
+
var set = function set(val) {
|
|
4641
|
+
if (val === undefined) {
|
|
4642
|
+
inject.clearProp();
|
|
4643
|
+
api.sync(rule);
|
|
4644
|
+
} else {
|
|
4645
|
+
deepSet(inject.getProp(), option.to, val);
|
|
4646
|
+
}
|
|
4647
|
+
};
|
|
4648
|
+
invoke(function () {
|
|
4649
|
+
return fc.create.fetch(_objectSpread2(_objectSpread2({}, option), {}, {
|
|
4650
|
+
onSuccess: function onSuccess(body) {
|
|
4651
|
+
if (check()) return;
|
|
4652
|
+
var fn = function fn(v) {
|
|
4653
|
+
return v.data;
|
|
4654
|
+
};
|
|
4655
|
+
if (is.Function(option.parse)) {
|
|
4656
|
+
fn = option.parse;
|
|
4657
|
+
}
|
|
4658
|
+
set(fn(body, rule, api));
|
|
4659
|
+
api.sync(rule);
|
|
4660
|
+
},
|
|
4661
|
+
onError: function onError(e) {
|
|
4662
|
+
set(undefined);
|
|
4663
|
+
if (check()) return;
|
|
4664
|
+
(_onError || function (e) {
|
|
4665
|
+
return err(e.message || 'fetch fail ' + option.action);
|
|
4666
|
+
})(e, rule, api);
|
|
4667
|
+
}
|
|
4668
|
+
}), {
|
|
4669
|
+
inject: inject,
|
|
4670
|
+
rule: rule,
|
|
4671
|
+
api: api
|
|
4672
|
+
});
|
|
4673
|
+
});
|
|
4674
|
+
return true;
|
|
4675
|
+
}
|
|
4676
|
+
return {
|
|
4677
|
+
name: 'fetch',
|
|
4678
|
+
loaded: function loaded() {
|
|
4679
|
+
run.apply(void 0, arguments);
|
|
4680
|
+
},
|
|
4681
|
+
watch: function watch(inject, rule, api) {
|
|
4682
|
+
if (!run(inject, rule, api)) {
|
|
4683
|
+
inject.clearProp();
|
|
4684
|
+
api.sync(rule);
|
|
4685
|
+
}
|
|
4686
|
+
}
|
|
4687
|
+
};
|
|
4580
4688
|
};
|
|
4581
4689
|
var $required = {
|
|
4582
4690
|
name: 'required',
|
|
@@ -4592,7 +4700,8 @@
|
|
|
4592
4700
|
}
|
|
4593
4701
|
}, val);
|
|
4594
4702
|
if (!validate.message) {
|
|
4595
|
-
|
|
4703
|
+
var title = rule.title || '';
|
|
4704
|
+
validate.message = ((_typeof(title) === 'object' ? title.title : title) || '') + '不能为空';
|
|
4596
4705
|
}
|
|
4597
4706
|
inject.getProp().validate = [validate];
|
|
4598
4707
|
}
|
|
@@ -4621,65 +4730,8 @@
|
|
|
4621
4730
|
return val;
|
|
4622
4731
|
}
|
|
4623
4732
|
}
|
|
4624
|
-
function parseOpt(option) {
|
|
4625
|
-
if (is.String(option)) {
|
|
4626
|
-
option = {
|
|
4627
|
-
action: option,
|
|
4628
|
-
to: 'options'
|
|
4629
|
-
};
|
|
4630
|
-
}
|
|
4631
|
-
return option;
|
|
4632
|
-
}
|
|
4633
|
-
function run(inject, rule, api) {
|
|
4634
|
-
var option = inject.value;
|
|
4635
|
-
if (is.Function(option)) {
|
|
4636
|
-
option = option(rule, api);
|
|
4637
|
-
}
|
|
4638
|
-
option = parseOpt(option);
|
|
4639
|
-
if (!option || !option.action) {
|
|
4640
|
-
return false;
|
|
4641
|
-
}
|
|
4642
|
-
if (!option.to) {
|
|
4643
|
-
option.to = 'options';
|
|
4644
|
-
}
|
|
4645
|
-
var _onError = option.onError;
|
|
4646
|
-
var check = function check() {
|
|
4647
|
-
if (!inject.getValue()) {
|
|
4648
|
-
inject.clearProp();
|
|
4649
|
-
api.sync(rule);
|
|
4650
|
-
return true;
|
|
4651
|
-
}
|
|
4652
|
-
};
|
|
4653
|
-
var set = function set(val) {
|
|
4654
|
-
if (val === undefined) {
|
|
4655
|
-
inject.clearProp();
|
|
4656
|
-
api.sync(rule);
|
|
4657
|
-
} else {
|
|
4658
|
-
deepSet(inject.getProp(), option.to, val);
|
|
4659
|
-
}
|
|
4660
|
-
};
|
|
4661
|
-
invoke(function () {
|
|
4662
|
-
return fetch(_objectSpread2(_objectSpread2({}, option), {}, {
|
|
4663
|
-
onSuccess: function onSuccess(body) {
|
|
4664
|
-
if (check()) return;
|
|
4665
|
-
set((option.parse || function (v) {
|
|
4666
|
-
return v.data;
|
|
4667
|
-
})(body, rule, api));
|
|
4668
|
-
api.sync(rule);
|
|
4669
|
-
},
|
|
4670
|
-
onError: function onError(e) {
|
|
4671
|
-
set(undefined);
|
|
4672
|
-
if (check()) return;
|
|
4673
|
-
(_onError || function (e) {
|
|
4674
|
-
return err(e.message || 'fetch fail ' + option.action);
|
|
4675
|
-
})(e, rule, api);
|
|
4676
|
-
}
|
|
4677
|
-
}));
|
|
4678
|
-
});
|
|
4679
|
-
return true;
|
|
4680
|
-
}
|
|
4681
4733
|
var $provider = {
|
|
4682
|
-
fetch: $
|
|
4734
|
+
fetch: fetch$1,
|
|
4683
4735
|
required: $required
|
|
4684
4736
|
};
|
|
4685
4737
|
|
|
@@ -5788,7 +5840,7 @@
|
|
|
5788
5840
|
function elmFormCreate() {
|
|
5789
5841
|
return FormCreateFactory({
|
|
5790
5842
|
ui: "".concat("element-ui"),
|
|
5791
|
-
version: "".concat("2.5.
|
|
5843
|
+
version: "".concat("2.5.26"),
|
|
5792
5844
|
manager: manager,
|
|
5793
5845
|
extendApi: extendApi,
|
|
5794
5846
|
install: install,
|