@form-create/view-design 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 +195 -142
- package/dist/form-create.min.js +2 -2
- package/dist/form-create.min.js.map +1 -1
- package/package.json +4 -5
- package/types/config.d.ts +9 -13
package/dist/form-create.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/view-design v2.5.
|
|
2
|
+
* @form-create/view-design 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.
|
|
@@ -305,20 +305,22 @@
|
|
|
305
305
|
},
|
|
306
306
|
render: function render() {
|
|
307
307
|
var h = arguments[0];
|
|
308
|
-
return h("CheckboxGroup", helper([{}, this.formCreateInject.prop, {
|
|
309
|
-
"
|
|
310
|
-
|
|
311
|
-
}
|
|
308
|
+
return h("CheckboxGroup", helper([{}, this.formCreateInject.prop, {}, {
|
|
309
|
+
"props": {
|
|
310
|
+
value: this.trueValue
|
|
311
|
+
}
|
|
312
|
+
}, {
|
|
312
313
|
"on": {
|
|
313
314
|
"input": this.onInput
|
|
314
315
|
}
|
|
315
316
|
}]), [this.options().map(function (opt, index) {
|
|
316
317
|
var props = _objectSpread2({}, opt);
|
|
317
318
|
delete props.value;
|
|
318
|
-
return h("Checkbox", {
|
|
319
|
-
"props":
|
|
319
|
+
return h("Checkbox", helper([{}, {
|
|
320
|
+
"props": props
|
|
321
|
+
}, {
|
|
320
322
|
"key": '' + index + '-' + opt.value
|
|
321
|
-
});
|
|
323
|
+
}]));
|
|
322
324
|
}), getSlot(this.$slots)]);
|
|
323
325
|
}
|
|
324
326
|
};
|
|
@@ -738,28 +740,30 @@
|
|
|
738
740
|
});
|
|
739
741
|
return h("div", {
|
|
740
742
|
"class": "_fc-frame"
|
|
741
|
-
}, [node, h("Modal", {
|
|
742
|
-
"
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
}
|
|
743
|
+
}, [node, h("Modal", helper([{}, {
|
|
744
|
+
"props": {
|
|
745
|
+
mask: this.previewMask,
|
|
746
|
+
title: modalTitle,
|
|
747
|
+
footerHide: true
|
|
748
|
+
}
|
|
749
|
+
}, {
|
|
747
750
|
"model": {
|
|
748
751
|
value: _this9.previewVisible,
|
|
749
752
|
callback: function callback($$v) {
|
|
750
753
|
_this9.previewVisible = $$v;
|
|
751
754
|
}
|
|
752
755
|
}
|
|
753
|
-
}, [h("img", {
|
|
756
|
+
}]), [h("img", {
|
|
754
757
|
"style": "width: 100%",
|
|
755
758
|
"attrs": {
|
|
756
759
|
"src": this.previewImage
|
|
757
760
|
}
|
|
758
|
-
})]), h("Modal", {
|
|
759
|
-
"props": _objectSpread2({
|
|
761
|
+
})]), h("Modal", helper([{}, {
|
|
762
|
+
"props": _objectSpread2({
|
|
760
763
|
width: width,
|
|
761
764
|
title: title
|
|
762
|
-
}, this.modal)
|
|
765
|
+
}, this.modal)
|
|
766
|
+
}, {
|
|
763
767
|
"on": {
|
|
764
768
|
"on-cancel": function onCancel() {
|
|
765
769
|
return _this9.closeModel(true);
|
|
@@ -771,7 +775,7 @@
|
|
|
771
775
|
_this9.frameVisible = $$v;
|
|
772
776
|
}
|
|
773
777
|
}
|
|
774
|
-
}, [this.frameVisible || !this.reload ? h("iframe", {
|
|
778
|
+
}]), [this.frameVisible || !this.reload ? h("iframe", {
|
|
775
779
|
"ref": "frame",
|
|
776
780
|
"attrs": {
|
|
777
781
|
"src": src,
|
|
@@ -853,20 +857,22 @@
|
|
|
853
857
|
},
|
|
854
858
|
render: function render() {
|
|
855
859
|
var h = arguments[0];
|
|
856
|
-
return h("RadioGroup", helper([{}, this.formCreateInject.prop, {
|
|
857
|
-
"
|
|
858
|
-
|
|
859
|
-
}
|
|
860
|
+
return h("RadioGroup", helper([{}, this.formCreateInject.prop, {}, {
|
|
861
|
+
"props": {
|
|
862
|
+
value: this.trueValue
|
|
863
|
+
}
|
|
864
|
+
}, {
|
|
860
865
|
"on": {
|
|
861
866
|
"input": this.onInput
|
|
862
867
|
}
|
|
863
868
|
}]), [this.options().map(function (opt, index) {
|
|
864
869
|
var props = _objectSpread2({}, opt);
|
|
865
870
|
delete props.value;
|
|
866
|
-
return h("Radio", {
|
|
867
|
-
"props":
|
|
871
|
+
return h("Radio", helper([{}, {
|
|
872
|
+
"props": props
|
|
873
|
+
}, {
|
|
868
874
|
"key": '' + index + '-' + opt.value
|
|
869
|
-
});
|
|
875
|
+
}]));
|
|
870
876
|
}), getSlot(this.$slots)]);
|
|
871
877
|
}
|
|
872
878
|
};
|
|
@@ -925,10 +931,11 @@
|
|
|
925
931
|
var options = ctx.props.formCreateInject.options;
|
|
926
932
|
return h("Select", helper([{}, ctx.data]), [(Array.isArray(options) ? options : []).map(function (props, index) {
|
|
927
933
|
var slot = props.slot;
|
|
928
|
-
return h("Option", {
|
|
929
|
-
"props":
|
|
934
|
+
return h("Option", helper([{}, {
|
|
935
|
+
"props": props
|
|
936
|
+
}, {
|
|
930
937
|
"key": '' + index + '-' + props.value
|
|
931
|
-
}, [slot ? h("template", {
|
|
938
|
+
}]), [slot ? h("template", {
|
|
932
939
|
"slot": props.slotName || 'default'
|
|
933
940
|
}, [is.Function(slot) ? props.slot(h) : slot]) : null]);
|
|
934
941
|
}), ctx.children]);
|
|
@@ -1218,18 +1225,19 @@
|
|
|
1218
1225
|
}
|
|
1219
1226
|
return h("div", {
|
|
1220
1227
|
"class": "_fc-upload"
|
|
1221
|
-
}, [[this.formCreateInject.prop.props.showUploadList ? [] : this.makeFiles(), this.makeUpload()], h("Modal", {
|
|
1222
|
-
"
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
}
|
|
1228
|
+
}, [[this.formCreateInject.prop.props.showUploadList ? [] : this.makeFiles(), this.makeUpload()], h("Modal", helper([{}, {
|
|
1229
|
+
"props": {
|
|
1230
|
+
title: this.modalTitle,
|
|
1231
|
+
footerHide: true
|
|
1232
|
+
}
|
|
1233
|
+
}, {
|
|
1226
1234
|
"model": {
|
|
1227
1235
|
value: _this4.previewVisible,
|
|
1228
1236
|
callback: function callback($$v) {
|
|
1229
1237
|
_this4.previewVisible = $$v;
|
|
1230
1238
|
}
|
|
1231
1239
|
}
|
|
1232
|
-
}, [h("img", {
|
|
1240
|
+
}]), [h("img", {
|
|
1233
1241
|
"attrs": {
|
|
1234
1242
|
"alt": "example",
|
|
1235
1243
|
"src": this.previewImage
|
|
@@ -1665,11 +1673,8 @@
|
|
|
1665
1673
|
"attrs": {
|
|
1666
1674
|
"span": button ? 20 : 24
|
|
1667
1675
|
}
|
|
1668
|
-
}, [h(
|
|
1669
|
-
"key": key
|
|
1670
|
-
"attrs": {
|
|
1671
|
-
"inFor": true
|
|
1672
|
-
}
|
|
1676
|
+
}, [h(Type, helper([{
|
|
1677
|
+
"key": key
|
|
1673
1678
|
}, {
|
|
1674
1679
|
"on": {
|
|
1675
1680
|
'update:value': function updateValue(formData) {
|
|
@@ -1685,20 +1690,21 @@
|
|
|
1685
1690
|
return _this9.add$f(index, key, $f);
|
|
1686
1691
|
}
|
|
1687
1692
|
}
|
|
1688
|
-
}, {
|
|
1689
|
-
"
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1693
|
+
}, {}, {
|
|
1694
|
+
"props": {
|
|
1695
|
+
value: _this9.field ? _defineProperty({}, _this9.field, _this9._value(_this9.value[index])) : _this9.value[index],
|
|
1696
|
+
rule: rule,
|
|
1697
|
+
option: options,
|
|
1698
|
+
extendOption: true,
|
|
1699
|
+
inFor: true
|
|
1694
1700
|
}
|
|
1695
|
-
}]))])
|
|
1696
|
-
"
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1701
|
+
}]))]), button ? h("Col", helper([{}, {
|
|
1702
|
+
"props": {
|
|
1703
|
+
span: 2,
|
|
1704
|
+
pull: 1,
|
|
1705
|
+
push: 1
|
|
1700
1706
|
}
|
|
1701
|
-
}, [_this9.makeIcon(keys.length, index, key)]) : null]);
|
|
1707
|
+
}]), [_this9.makeIcon(keys.length, index, key)]) : null]);
|
|
1702
1708
|
})]);
|
|
1703
1709
|
}
|
|
1704
1710
|
};
|
|
@@ -1809,11 +1815,11 @@
|
|
|
1809
1815
|
'emit-event': this.emitEvent,
|
|
1810
1816
|
input: this.add$f
|
|
1811
1817
|
}
|
|
1812
|
-
}, {
|
|
1813
|
-
"
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1818
|
+
}, {}, {
|
|
1819
|
+
"props": {
|
|
1820
|
+
rule: rule,
|
|
1821
|
+
option: options,
|
|
1822
|
+
extendOption: true
|
|
1817
1823
|
}
|
|
1818
1824
|
}]));
|
|
1819
1825
|
}
|
|
@@ -1905,7 +1911,7 @@
|
|
|
1905
1911
|
value: {
|
|
1906
1912
|
handler: function handler(n) {
|
|
1907
1913
|
if (JSON.stringify(n || {}) === this.updateValue) return;
|
|
1908
|
-
this.$f.setValue(n || {});
|
|
1914
|
+
this.$f.config.forceCoverValue ? this.$f.coverValue(n || {}) : this.$f.setValue(n || {});
|
|
1909
1915
|
},
|
|
1910
1916
|
deep: true
|
|
1911
1917
|
},
|
|
@@ -2145,7 +2151,11 @@
|
|
|
2145
2151
|
return rule;
|
|
2146
2152
|
}
|
|
2147
2153
|
function getRule(rule) {
|
|
2148
|
-
|
|
2154
|
+
var r = is.Function(rule.getRule) ? rule.getRule() : rule;
|
|
2155
|
+
if (!r.type) {
|
|
2156
|
+
r.type = 'input';
|
|
2157
|
+
}
|
|
2158
|
+
return r;
|
|
2149
2159
|
}
|
|
2150
2160
|
function mergeGlobal(target, merge) {
|
|
2151
2161
|
if (!target) return merge;
|
|
@@ -2315,15 +2325,19 @@
|
|
|
2315
2325
|
return copy(ctx.rule.value);
|
|
2316
2326
|
},
|
|
2317
2327
|
coverValue: function coverValue(formData) {
|
|
2328
|
+
var data = _objectSpread2({}, formData || {});
|
|
2318
2329
|
h.deferSyncValue(function () {
|
|
2319
2330
|
api.fields().forEach(function (key) {
|
|
2320
2331
|
var ctxs = h.fieldCtx[key];
|
|
2321
|
-
if (
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2332
|
+
if (ctxs) {
|
|
2333
|
+
var flag = hasProperty(data, key);
|
|
2334
|
+
ctxs.forEach(function (ctx) {
|
|
2335
|
+
ctx.rule.value = flag ? data[key] : undefined;
|
|
2336
|
+
});
|
|
2337
|
+
delete data[key];
|
|
2338
|
+
}
|
|
2326
2339
|
});
|
|
2340
|
+
extend(h.appendData, data);
|
|
2327
2341
|
});
|
|
2328
2342
|
},
|
|
2329
2343
|
setValue: function setValue(field) {
|
|
@@ -2543,6 +2557,16 @@
|
|
|
2543
2557
|
$set(ctx.rule.effect, attr, value);
|
|
2544
2558
|
}
|
|
2545
2559
|
},
|
|
2560
|
+
clearEffectData: function clearEffectData(id, attr) {
|
|
2561
|
+
var ctx = h.getCtx(id);
|
|
2562
|
+
if (ctx) {
|
|
2563
|
+
if (attr && attr[0] === '$') {
|
|
2564
|
+
attr = attr.substr(1);
|
|
2565
|
+
}
|
|
2566
|
+
ctx.clearEffectData(attr);
|
|
2567
|
+
api.sync(id);
|
|
2568
|
+
}
|
|
2569
|
+
},
|
|
2546
2570
|
updateValidate: function updateValidate(id, validate, merge) {
|
|
2547
2571
|
if (merge) {
|
|
2548
2572
|
api.mergeRule(id, {
|
|
@@ -2669,8 +2693,11 @@
|
|
|
2669
2693
|
},
|
|
2670
2694
|
getCache: function getCache(ctx) {
|
|
2671
2695
|
var cache = this.cache[ctx.id];
|
|
2672
|
-
cache
|
|
2673
|
-
|
|
2696
|
+
if (cache) {
|
|
2697
|
+
cache.use = true;
|
|
2698
|
+
return cache.vnode;
|
|
2699
|
+
}
|
|
2700
|
+
return undefined;
|
|
2674
2701
|
}
|
|
2675
2702
|
});
|
|
2676
2703
|
}
|
|
@@ -3336,7 +3363,7 @@
|
|
|
3336
3363
|
__fc__: enumerable(ctx, true)
|
|
3337
3364
|
});
|
|
3338
3365
|
}
|
|
3339
|
-
function RuleContext(handle, rule) {
|
|
3366
|
+
function RuleContext(handle, rule, defaultValue) {
|
|
3340
3367
|
var id = uniqueId();
|
|
3341
3368
|
extend(this, {
|
|
3342
3369
|
id: id,
|
|
@@ -3356,7 +3383,7 @@
|
|
|
3356
3383
|
payload: {},
|
|
3357
3384
|
input: !!rule.field,
|
|
3358
3385
|
el: undefined,
|
|
3359
|
-
defaultValue: rule.field ? deepCopy(
|
|
3386
|
+
defaultValue: rule.field ? deepCopy(defaultValue) : undefined,
|
|
3360
3387
|
field: rule.field || undefined
|
|
3361
3388
|
});
|
|
3362
3389
|
this.updateType();
|
|
@@ -3372,7 +3399,11 @@
|
|
|
3372
3399
|
return this.payload[name];
|
|
3373
3400
|
},
|
|
3374
3401
|
clearEffectData: function clearEffectData(name) {
|
|
3375
|
-
|
|
3402
|
+
if (name === undefined) {
|
|
3403
|
+
this.payload = {};
|
|
3404
|
+
} else {
|
|
3405
|
+
delete this.payload[name];
|
|
3406
|
+
}
|
|
3376
3407
|
},
|
|
3377
3408
|
updateKey: function updateKey(flag) {
|
|
3378
3409
|
this.key = uniqueId();
|
|
@@ -3591,7 +3622,6 @@
|
|
|
3591
3622
|
rules.map(function (_rule, index) {
|
|
3592
3623
|
if (parent && (is.String(_rule) || is.Undef(_rule))) return;
|
|
3593
3624
|
if (!_this6.pageEnd && !parent && index >= _this6.first) return;
|
|
3594
|
-
if (!is.Object(_rule) || !getRule(_rule).type) return err('未定义生成规则的 type 字段', _rule);
|
|
3595
3625
|
if (_rule.__fc__ && _rule.__fc__.root === rules && _this6.ctxs[_rule.__fc__.id]) {
|
|
3596
3626
|
loadChildren(_rule.__fc__.rule.children, _rule.__fc__);
|
|
3597
3627
|
return _rule.__fc__;
|
|
@@ -3609,8 +3639,10 @@
|
|
|
3609
3639
|
var ctx;
|
|
3610
3640
|
var isCopy = false;
|
|
3611
3641
|
var isInit = !!_rule.__fc__;
|
|
3642
|
+
var defaultValue = rule.value;
|
|
3612
3643
|
if (isInit) {
|
|
3613
3644
|
ctx = _rule.__fc__;
|
|
3645
|
+
defaultValue = ctx.defaultValue;
|
|
3614
3646
|
var check = !ctx.check(_this6);
|
|
3615
3647
|
if (ctx.deleted) {
|
|
3616
3648
|
if (check) {
|
|
@@ -3631,7 +3663,8 @@
|
|
|
3631
3663
|
}
|
|
3632
3664
|
}
|
|
3633
3665
|
if (!ctx) {
|
|
3634
|
-
|
|
3666
|
+
var _rule2 = _this6.parseRule(_rule);
|
|
3667
|
+
ctx = new RuleContext(_this6, _rule2, isInit ? defaultValue : _rule2.value);
|
|
3635
3668
|
_this6.bindParser(ctx);
|
|
3636
3669
|
} else {
|
|
3637
3670
|
if (ctx.originType !== ctx.rule.type) {
|
|
@@ -3702,6 +3735,7 @@
|
|
|
3702
3735
|
if (_ret === "continue") continue;
|
|
3703
3736
|
}
|
|
3704
3737
|
if (!validate.length) return false;
|
|
3738
|
+
var hideLst = [];
|
|
3705
3739
|
var flag = false;
|
|
3706
3740
|
this.deferSyncValue(function () {
|
|
3707
3741
|
validate.reverse().forEach(function (_ref) {
|
|
@@ -3718,7 +3752,7 @@
|
|
|
3718
3752
|
children: rule,
|
|
3719
3753
|
valid: valid
|
|
3720
3754
|
}) : ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl), 1);
|
|
3721
|
-
|
|
3755
|
+
hideLst[valid ? 'push' : 'unshift'](function () {
|
|
3722
3756
|
_this7.api.hidden(!valid, rule);
|
|
3723
3757
|
});
|
|
3724
3758
|
return;
|
|
@@ -3748,6 +3782,11 @@
|
|
|
3748
3782
|
}
|
|
3749
3783
|
});
|
|
3750
3784
|
});
|
|
3785
|
+
hideLst.length && this.vm.$nextTick(function () {
|
|
3786
|
+
hideLst.forEach(function (v) {
|
|
3787
|
+
return v();
|
|
3788
|
+
});
|
|
3789
|
+
});
|
|
3751
3790
|
this.vm.$emit('control', ctx.origin, this.api);
|
|
3752
3791
|
this.effect(ctx, 'control');
|
|
3753
3792
|
return flag;
|
|
@@ -3915,7 +3954,7 @@
|
|
|
3915
3954
|
if (this.deferSyncFn) {
|
|
3916
3955
|
return this.deferSyncFn.sync = true;
|
|
3917
3956
|
}
|
|
3918
|
-
this.vm._updateValue(_objectSpread2({}, this.form));
|
|
3957
|
+
this.vm._updateValue(_objectSpread2(_objectSpread2({}, this.options.appendValue ? this.appendData : {}), this.form));
|
|
3919
3958
|
},
|
|
3920
3959
|
isChange: function isChange(ctx, value) {
|
|
3921
3960
|
return JSON.stringify(ctx.rule.value, strFn) !== JSON.stringify(value === null ? undefined : value, strFn);
|
|
@@ -4198,6 +4237,9 @@
|
|
|
4198
4237
|
var ps = this.fc.providers;
|
|
4199
4238
|
Object.keys(ps).forEach(function (k) {
|
|
4200
4239
|
var prop = ps[k];
|
|
4240
|
+
if (is.Function(prop)) {
|
|
4241
|
+
prop = prop(_this.fc);
|
|
4242
|
+
}
|
|
4201
4243
|
prop._c = getComponent(prop);
|
|
4202
4244
|
_this.onEffect(prop);
|
|
4203
4245
|
_this.providers[k] = prop;
|
|
@@ -4572,17 +4614,84 @@
|
|
|
4572
4614
|
render: function render(children) {}
|
|
4573
4615
|
});
|
|
4574
4616
|
|
|
4575
|
-
var $
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
inject.clearProp();
|
|
4583
|
-
api.sync(rule);
|
|
4617
|
+
var fetch$1 = function fetch(fc) {
|
|
4618
|
+
function parseOpt(option) {
|
|
4619
|
+
if (is.String(option)) {
|
|
4620
|
+
option = {
|
|
4621
|
+
action: option,
|
|
4622
|
+
to: 'options'
|
|
4623
|
+
};
|
|
4584
4624
|
}
|
|
4625
|
+
return option;
|
|
4585
4626
|
}
|
|
4627
|
+
function run(inject, rule, api) {
|
|
4628
|
+
var option = inject.value;
|
|
4629
|
+
if (is.Function(option)) {
|
|
4630
|
+
option = option(rule, api);
|
|
4631
|
+
}
|
|
4632
|
+
option = parseOpt(option);
|
|
4633
|
+
if (!option || !option.action) {
|
|
4634
|
+
return false;
|
|
4635
|
+
}
|
|
4636
|
+
if (!option.to) {
|
|
4637
|
+
option.to = 'options';
|
|
4638
|
+
}
|
|
4639
|
+
var _onError = option.onError;
|
|
4640
|
+
var check = function check() {
|
|
4641
|
+
if (!inject.getValue()) {
|
|
4642
|
+
inject.clearProp();
|
|
4643
|
+
api.sync(rule);
|
|
4644
|
+
return true;
|
|
4645
|
+
}
|
|
4646
|
+
};
|
|
4647
|
+
var set = function set(val) {
|
|
4648
|
+
if (val === undefined) {
|
|
4649
|
+
inject.clearProp();
|
|
4650
|
+
api.sync(rule);
|
|
4651
|
+
} else {
|
|
4652
|
+
deepSet(inject.getProp(), option.to, val);
|
|
4653
|
+
}
|
|
4654
|
+
};
|
|
4655
|
+
invoke(function () {
|
|
4656
|
+
return fc.create.fetch(_objectSpread2(_objectSpread2({}, option), {}, {
|
|
4657
|
+
onSuccess: function onSuccess(body) {
|
|
4658
|
+
if (check()) return;
|
|
4659
|
+
var fn = function fn(v) {
|
|
4660
|
+
return v.data;
|
|
4661
|
+
};
|
|
4662
|
+
if (is.Function(option.parse)) {
|
|
4663
|
+
fn = option.parse;
|
|
4664
|
+
}
|
|
4665
|
+
set(fn(body, rule, api));
|
|
4666
|
+
api.sync(rule);
|
|
4667
|
+
},
|
|
4668
|
+
onError: function onError(e) {
|
|
4669
|
+
set(undefined);
|
|
4670
|
+
if (check()) return;
|
|
4671
|
+
(_onError || function (e) {
|
|
4672
|
+
return err(e.message || 'fetch fail ' + option.action);
|
|
4673
|
+
})(e, rule, api);
|
|
4674
|
+
}
|
|
4675
|
+
}), {
|
|
4676
|
+
inject: inject,
|
|
4677
|
+
rule: rule,
|
|
4678
|
+
api: api
|
|
4679
|
+
});
|
|
4680
|
+
});
|
|
4681
|
+
return true;
|
|
4682
|
+
}
|
|
4683
|
+
return {
|
|
4684
|
+
name: 'fetch',
|
|
4685
|
+
loaded: function loaded() {
|
|
4686
|
+
run.apply(void 0, arguments);
|
|
4687
|
+
},
|
|
4688
|
+
watch: function watch(inject, rule, api) {
|
|
4689
|
+
if (!run(inject, rule, api)) {
|
|
4690
|
+
inject.clearProp();
|
|
4691
|
+
api.sync(rule);
|
|
4692
|
+
}
|
|
4693
|
+
}
|
|
4694
|
+
};
|
|
4586
4695
|
};
|
|
4587
4696
|
var $required = {
|
|
4588
4697
|
name: 'required',
|
|
@@ -4598,7 +4707,8 @@
|
|
|
4598
4707
|
}
|
|
4599
4708
|
}, val);
|
|
4600
4709
|
if (!validate.message) {
|
|
4601
|
-
|
|
4710
|
+
var title = rule.title || '';
|
|
4711
|
+
validate.message = ((_typeof(title) === 'object' ? title.title : title) || '') + '不能为空';
|
|
4602
4712
|
}
|
|
4603
4713
|
inject.getProp().validate = [validate];
|
|
4604
4714
|
}
|
|
@@ -4627,65 +4737,8 @@
|
|
|
4627
4737
|
return val;
|
|
4628
4738
|
}
|
|
4629
4739
|
}
|
|
4630
|
-
function parseOpt(option) {
|
|
4631
|
-
if (is.String(option)) {
|
|
4632
|
-
option = {
|
|
4633
|
-
action: option,
|
|
4634
|
-
to: 'options'
|
|
4635
|
-
};
|
|
4636
|
-
}
|
|
4637
|
-
return option;
|
|
4638
|
-
}
|
|
4639
|
-
function run(inject, rule, api) {
|
|
4640
|
-
var option = inject.value;
|
|
4641
|
-
if (is.Function(option)) {
|
|
4642
|
-
option = option(rule, api);
|
|
4643
|
-
}
|
|
4644
|
-
option = parseOpt(option);
|
|
4645
|
-
if (!option || !option.action) {
|
|
4646
|
-
return false;
|
|
4647
|
-
}
|
|
4648
|
-
if (!option.to) {
|
|
4649
|
-
option.to = 'options';
|
|
4650
|
-
}
|
|
4651
|
-
var _onError = option.onError;
|
|
4652
|
-
var check = function check() {
|
|
4653
|
-
if (!inject.getValue()) {
|
|
4654
|
-
inject.clearProp();
|
|
4655
|
-
api.sync(rule);
|
|
4656
|
-
return true;
|
|
4657
|
-
}
|
|
4658
|
-
};
|
|
4659
|
-
var set = function set(val) {
|
|
4660
|
-
if (val === undefined) {
|
|
4661
|
-
inject.clearProp();
|
|
4662
|
-
api.sync(rule);
|
|
4663
|
-
} else {
|
|
4664
|
-
deepSet(inject.getProp(), option.to, val);
|
|
4665
|
-
}
|
|
4666
|
-
};
|
|
4667
|
-
invoke(function () {
|
|
4668
|
-
return fetch(_objectSpread2(_objectSpread2({}, option), {}, {
|
|
4669
|
-
onSuccess: function onSuccess(body) {
|
|
4670
|
-
if (check()) return;
|
|
4671
|
-
set((option.parse || function (v) {
|
|
4672
|
-
return v.data;
|
|
4673
|
-
})(body, rule, api));
|
|
4674
|
-
api.sync(rule);
|
|
4675
|
-
},
|
|
4676
|
-
onError: function onError(e) {
|
|
4677
|
-
set(undefined);
|
|
4678
|
-
if (check()) return;
|
|
4679
|
-
(_onError || function (e) {
|
|
4680
|
-
return err(e.message || 'fetch fail ' + option.action);
|
|
4681
|
-
})(e, rule, api);
|
|
4682
|
-
}
|
|
4683
|
-
}));
|
|
4684
|
-
});
|
|
4685
|
-
return true;
|
|
4686
|
-
}
|
|
4687
4740
|
var $provider = {
|
|
4688
|
-
fetch: $
|
|
4741
|
+
fetch: fetch$1,
|
|
4689
4742
|
required: $required
|
|
4690
4743
|
};
|
|
4691
4744
|
|
|
@@ -5833,7 +5886,7 @@
|
|
|
5833
5886
|
function ivuFormCreate() {
|
|
5834
5887
|
return FormCreateFactory({
|
|
5835
5888
|
ui: "".concat("view-design"),
|
|
5836
|
-
version: "".concat("2.5.
|
|
5889
|
+
version: "".concat("2.5.26"),
|
|
5837
5890
|
manager: manager,
|
|
5838
5891
|
install: install,
|
|
5839
5892
|
extendApi: extendApi,
|