@form-create/element-ui 3.1.32 → 3.1.34
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 +217 -143
- package/dist/form-create.esm.min.js +2 -2
- package/dist/form-create.js +217 -143
- package/dist/form-create.min.js +2 -2
- package/package.json +5 -5
- package/src/core/api.js +2 -4
package/dist/form-create.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/element-ui v3.1.
|
|
2
|
+
* @form-create/element-ui v3.1.34
|
|
3
3
|
* (c) 2018-2024 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create
|
|
5
5
|
* Released under the MIT License.
|
|
@@ -1616,14 +1616,6 @@
|
|
|
1616
1616
|
},
|
|
1617
1617
|
deep: true
|
|
1618
1618
|
},
|
|
1619
|
-
disabled: function disabled(n) {
|
|
1620
|
-
if (this.syncDisabled) {
|
|
1621
|
-
var lst = this.cacheRule;
|
|
1622
|
-
Object.keys(lst).forEach(function (k) {
|
|
1623
|
-
lst[k].$f.disabled(n);
|
|
1624
|
-
});
|
|
1625
|
-
}
|
|
1626
|
-
},
|
|
1627
1619
|
expand: function expand(n) {
|
|
1628
1620
|
var d = n - this.modelValue.length;
|
|
1629
1621
|
|
|
@@ -1745,10 +1737,6 @@
|
|
|
1745
1737
|
|
|
1746
1738
|
this.cacheRule[key].$f = $f;
|
|
1747
1739
|
vue.nextTick(function () {
|
|
1748
|
-
if (_this5.syncDisabled) {
|
|
1749
|
-
$f.disabled(_this5.disabled);
|
|
1750
|
-
}
|
|
1751
|
-
|
|
1752
1740
|
_this5.$emit('itemMounted', $f, Object.keys(_this5.cacheRule).indexOf(key));
|
|
1753
1741
|
});
|
|
1754
1742
|
},
|
|
@@ -1919,6 +1907,7 @@
|
|
|
1919
1907
|
}, [vue.createVNode(Type, vue.mergeProps({
|
|
1920
1908
|
"key": key
|
|
1921
1909
|
}, {
|
|
1910
|
+
disabled: disabled,
|
|
1922
1911
|
'onUpdate:modelValue': function onUpdateModelValue(formData) {
|
|
1923
1912
|
return _this12.formData(key, formData);
|
|
1924
1913
|
},
|
|
@@ -1989,9 +1978,6 @@
|
|
|
1989
1978
|
},
|
|
1990
1979
|
emits: ['fc:subform', 'update:modelValue', 'change', 'itemMounted'],
|
|
1991
1980
|
watch: {
|
|
1992
|
-
disabled: function disabled(n) {
|
|
1993
|
-
this.syncDisabled && this.subApi.disabled(n);
|
|
1994
|
-
},
|
|
1995
1981
|
modelValue: function modelValue(n) {
|
|
1996
1982
|
this.setValue(n);
|
|
1997
1983
|
}
|
|
@@ -2017,8 +2003,6 @@
|
|
|
2017
2003
|
|
|
2018
2004
|
this.subApi = api;
|
|
2019
2005
|
vue.nextTick(function () {
|
|
2020
|
-
_this.syncDisabled && api.disabled(_this.disabled);
|
|
2021
|
-
|
|
2022
2006
|
_this.$emit('itemMounted', api);
|
|
2023
2007
|
});
|
|
2024
2008
|
}
|
|
@@ -2026,6 +2010,7 @@
|
|
|
2026
2010
|
render: function render() {
|
|
2027
2011
|
var Type = this.form;
|
|
2028
2012
|
return vue.createVNode(Type, {
|
|
2013
|
+
"disabled": this.disabled,
|
|
2029
2014
|
"onUpdate:modelValue": this.formData,
|
|
2030
2015
|
"modelValue": this.modelValue,
|
|
2031
2016
|
"onEmit-event": this.$emit,
|
|
@@ -2238,6 +2223,10 @@
|
|
|
2238
2223
|
type: Boolean,
|
|
2239
2224
|
"default": undefined
|
|
2240
2225
|
},
|
|
2226
|
+
preview: {
|
|
2227
|
+
type: Boolean,
|
|
2228
|
+
"default": undefined
|
|
2229
|
+
},
|
|
2241
2230
|
api: Object,
|
|
2242
2231
|
name: String,
|
|
2243
2232
|
subForm: {
|
|
@@ -2374,7 +2363,7 @@
|
|
|
2374
2363
|
deep: true
|
|
2375
2364
|
});
|
|
2376
2365
|
vue.watch(function () {
|
|
2377
|
-
return props.disabled;
|
|
2366
|
+
return [props.disabled, props.preview];
|
|
2378
2367
|
}, function () {
|
|
2379
2368
|
fapi.refresh();
|
|
2380
2369
|
});
|
|
@@ -2653,6 +2642,64 @@
|
|
|
2653
2642
|
return o;
|
|
2654
2643
|
}
|
|
2655
2644
|
|
|
2645
|
+
var changeType = function changeType(a, b) {
|
|
2646
|
+
if (typeof a === 'string') {
|
|
2647
|
+
return String(b);
|
|
2648
|
+
} else if (typeof a === 'number') {
|
|
2649
|
+
return Number(b);
|
|
2650
|
+
}
|
|
2651
|
+
|
|
2652
|
+
return b;
|
|
2653
|
+
};
|
|
2654
|
+
|
|
2655
|
+
var condition = {
|
|
2656
|
+
'==': function _(a, b) {
|
|
2657
|
+
return JSON.stringify(a) === JSON.stringify(changeType(a, b));
|
|
2658
|
+
},
|
|
2659
|
+
'!=': function _(a, b) {
|
|
2660
|
+
return !condition['=='](a, b);
|
|
2661
|
+
},
|
|
2662
|
+
'>': function _(a, b) {
|
|
2663
|
+
return a > b;
|
|
2664
|
+
},
|
|
2665
|
+
'>=': function _(a, b) {
|
|
2666
|
+
return a >= b;
|
|
2667
|
+
},
|
|
2668
|
+
'<': function _(a, b) {
|
|
2669
|
+
return a < b;
|
|
2670
|
+
},
|
|
2671
|
+
'<=': function _(a, b) {
|
|
2672
|
+
return a <= b;
|
|
2673
|
+
},
|
|
2674
|
+
on: function on(a, b) {
|
|
2675
|
+
return a && a.indexOf && a.indexOf(changeType(a[0], b)) > -1;
|
|
2676
|
+
},
|
|
2677
|
+
notOn: function notOn(a, b) {
|
|
2678
|
+
return !condition.on(a, b);
|
|
2679
|
+
},
|
|
2680
|
+
"in": function _in(a, b) {
|
|
2681
|
+
return b && b.indexOf && b.indexOf(a) > -1;
|
|
2682
|
+
},
|
|
2683
|
+
notIn: function notIn(a, b) {
|
|
2684
|
+
return !condition["in"](a, b);
|
|
2685
|
+
},
|
|
2686
|
+
between: function between(a, b) {
|
|
2687
|
+
return a > b[0] && a < b[1];
|
|
2688
|
+
},
|
|
2689
|
+
notBetween: function notBetween(a, b) {
|
|
2690
|
+
return a < b[0] || a > b[1];
|
|
2691
|
+
},
|
|
2692
|
+
empty: function empty(a) {
|
|
2693
|
+
return is.empty(a);
|
|
2694
|
+
},
|
|
2695
|
+
notEmpty: function notEmpty(a) {
|
|
2696
|
+
return !is.empty(a);
|
|
2697
|
+
},
|
|
2698
|
+
pattern: function pattern(a, b) {
|
|
2699
|
+
return new RegExp(b, 'g').test(a);
|
|
2700
|
+
}
|
|
2701
|
+
};
|
|
2702
|
+
|
|
2656
2703
|
function baseRule() {
|
|
2657
2704
|
return {
|
|
2658
2705
|
props: {},
|
|
@@ -2905,7 +2952,7 @@
|
|
|
2905
2952
|
if (!ctx) return initial;
|
|
2906
2953
|
initial[ctx.field] = copy(ctx.rule.value);
|
|
2907
2954
|
return initial;
|
|
2908
|
-
}, {});
|
|
2955
|
+
}, h.options.appendValue !== false ? copy(h.appendData) : {});
|
|
2909
2956
|
},
|
|
2910
2957
|
getValue: function getValue(field) {
|
|
2911
2958
|
var ctx = h.getFieldCtx(field);
|
|
@@ -3321,10 +3368,7 @@
|
|
|
3321
3368
|
|
|
3322
3369
|
if (config.type === 'fetch') {
|
|
3323
3370
|
api.fetch(config).then(function (res) {
|
|
3324
|
-
resolve(
|
|
3325
|
-
res: res,
|
|
3326
|
-
config: config
|
|
3327
|
-
});
|
|
3371
|
+
resolve(res);
|
|
3328
3372
|
})["catch"](inject);
|
|
3329
3373
|
} else {
|
|
3330
3374
|
resolve(config.data);
|
|
@@ -3353,12 +3397,17 @@
|
|
|
3353
3397
|
},
|
|
3354
3398
|
bus: h.bus,
|
|
3355
3399
|
fetch: function fetch(opt) {
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3400
|
+
return new Promise(function (resolve, reject) {
|
|
3401
|
+
h.beforeFetch(opt).then(function () {
|
|
3402
|
+
return asyncFetch(opt).then(resolve)["catch"](reject);
|
|
3359
3403
|
});
|
|
3360
3404
|
});
|
|
3361
|
-
|
|
3405
|
+
},
|
|
3406
|
+
getData: function getData(id, def) {
|
|
3407
|
+
return h.fc.getData(id, def);
|
|
3408
|
+
},
|
|
3409
|
+
setData: function setData(id, data) {
|
|
3410
|
+
return h.fc.setData(id, data);
|
|
3362
3411
|
},
|
|
3363
3412
|
helper: {
|
|
3364
3413
|
tidyFields: tidyFields,
|
|
@@ -3568,7 +3617,7 @@
|
|
|
3568
3617
|
this.setOptions(ctx);
|
|
3569
3618
|
this.ctxProp(ctx);
|
|
3570
3619
|
var prop = ctx.prop;
|
|
3571
|
-
prop.preview = !!(
|
|
3620
|
+
prop.preview = !!(prop.preview != null ? prop.preview : this.vm.props.preview !== undefined ? this.vm.props.preview : this.options.preview || false);
|
|
3572
3621
|
prop.props.formCreateInject = this.injectProp(ctx);
|
|
3573
3622
|
var cacheFlag = prop.cache !== false;
|
|
3574
3623
|
var preview = prop.preview;
|
|
@@ -3760,8 +3809,8 @@
|
|
|
3760
3809
|
}];
|
|
3761
3810
|
|
|
3762
3811
|
if (ctx.input) {
|
|
3763
|
-
if (this.vm.props.disabled
|
|
3764
|
-
ctx.prop.props.disabled =
|
|
3812
|
+
if (this.vm.props.disabled === true) {
|
|
3813
|
+
ctx.prop.props.disabled = true;
|
|
3765
3814
|
}
|
|
3766
3815
|
|
|
3767
3816
|
var field = this.getModelField(ctx);
|
|
@@ -4296,14 +4345,31 @@
|
|
|
4296
4345
|
var _this4 = this;
|
|
4297
4346
|
|
|
4298
4347
|
return toArray(this.prop.validate).map(function (item) {
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4348
|
+
if (is.Function(item.validator)) {
|
|
4349
|
+
var temp = _objectSpread2({}, item);
|
|
4350
|
+
|
|
4351
|
+
var that = _this4;
|
|
4352
|
+
|
|
4353
|
+
temp.validator = function () {
|
|
4354
|
+
var _item$validator;
|
|
4355
|
+
|
|
4356
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
4357
|
+
args[_key] = arguments[_key];
|
|
4358
|
+
}
|
|
4359
|
+
|
|
4360
|
+
return (_item$validator = item.validator).call.apply(_item$validator, [{
|
|
4361
|
+
that: this,
|
|
4362
|
+
id: that.id,
|
|
4363
|
+
field: that.field,
|
|
4364
|
+
rule: that.rule,
|
|
4365
|
+
api: that.$handle.api
|
|
4366
|
+
}].concat(args));
|
|
4367
|
+
};
|
|
4368
|
+
|
|
4369
|
+
return temp;
|
|
4370
|
+
}
|
|
4371
|
+
|
|
4372
|
+
return item;
|
|
4307
4373
|
});
|
|
4308
4374
|
},
|
|
4309
4375
|
check: function check(handle) {
|
|
@@ -4412,73 +4478,6 @@
|
|
|
4412
4478
|
}
|
|
4413
4479
|
});
|
|
4414
4480
|
|
|
4415
|
-
var condition = {
|
|
4416
|
-
'==': function _(b) {
|
|
4417
|
-
return function (a) {
|
|
4418
|
-
return a === b;
|
|
4419
|
-
};
|
|
4420
|
-
},
|
|
4421
|
-
'!=': function _(b) {
|
|
4422
|
-
return function (a) {
|
|
4423
|
-
return a !== b;
|
|
4424
|
-
};
|
|
4425
|
-
},
|
|
4426
|
-
'<>': function _(b) {
|
|
4427
|
-
return function (a) {
|
|
4428
|
-
return a !== b;
|
|
4429
|
-
};
|
|
4430
|
-
},
|
|
4431
|
-
'>': function _(b) {
|
|
4432
|
-
return function (a) {
|
|
4433
|
-
return a > b;
|
|
4434
|
-
};
|
|
4435
|
-
},
|
|
4436
|
-
'>=': function _(b) {
|
|
4437
|
-
return function (a) {
|
|
4438
|
-
return a >= b;
|
|
4439
|
-
};
|
|
4440
|
-
},
|
|
4441
|
-
'<': function _(b) {
|
|
4442
|
-
return function (a) {
|
|
4443
|
-
return a < b;
|
|
4444
|
-
};
|
|
4445
|
-
},
|
|
4446
|
-
'<=': function _(b) {
|
|
4447
|
-
return function (a) {
|
|
4448
|
-
return a <= b;
|
|
4449
|
-
};
|
|
4450
|
-
},
|
|
4451
|
-
'in': function _in(b) {
|
|
4452
|
-
return function (a) {
|
|
4453
|
-
return b && b.indexOf && b.indexOf(a) > -1;
|
|
4454
|
-
};
|
|
4455
|
-
},
|
|
4456
|
-
'on': function on(b) {
|
|
4457
|
-
return function (a) {
|
|
4458
|
-
return a && a.indexOf && a.indexOf(b) > -1;
|
|
4459
|
-
};
|
|
4460
|
-
},
|
|
4461
|
-
'notIn': function notIn(b) {
|
|
4462
|
-
return function (a) {
|
|
4463
|
-
return !condition["in"](b)(a);
|
|
4464
|
-
};
|
|
4465
|
-
},
|
|
4466
|
-
'notOn': function notOn(b) {
|
|
4467
|
-
return function (a) {
|
|
4468
|
-
return !condition.on(b)(a);
|
|
4469
|
-
};
|
|
4470
|
-
},
|
|
4471
|
-
'between': function between(b) {
|
|
4472
|
-
return function (a) {
|
|
4473
|
-
return a > b[0] && a < b[1];
|
|
4474
|
-
};
|
|
4475
|
-
},
|
|
4476
|
-
'notBetween': function notBetween(b) {
|
|
4477
|
-
return function (a) {
|
|
4478
|
-
return a < b[0] || a > b[1];
|
|
4479
|
-
};
|
|
4480
|
-
}
|
|
4481
|
-
};
|
|
4482
4481
|
function useLoader(Handler) {
|
|
4483
4482
|
extend(Handler.prototype, {
|
|
4484
4483
|
nextRefresh: function nextRefresh(fn) {
|
|
@@ -4668,7 +4667,7 @@
|
|
|
4668
4667
|
if (!ctx) {
|
|
4669
4668
|
var _rule2 = _this6.parseRule(_rule);
|
|
4670
4669
|
|
|
4671
|
-
ctx = new RuleContext(_this6, _rule2,
|
|
4670
|
+
ctx = new RuleContext(_this6, _rule2, defaultValue);
|
|
4672
4671
|
|
|
4673
4672
|
_this6.bindParser(ctx);
|
|
4674
4673
|
} else {
|
|
@@ -4751,7 +4750,10 @@
|
|
|
4751
4750
|
|
|
4752
4751
|
var _loop = function _loop(i) {
|
|
4753
4752
|
var control = controls[i],
|
|
4754
|
-
handleFn = control.handle ||
|
|
4753
|
+
handleFn = control.handle || function (val) {
|
|
4754
|
+
return (condition[control.condition || '=='] || condition['=='])(val, control.value);
|
|
4755
|
+
};
|
|
4756
|
+
|
|
4755
4757
|
if (!is.trueArray(control.rule)) return "continue";
|
|
4756
4758
|
|
|
4757
4759
|
var data = _objectSpread2(_objectSpread2({}, control), {}, {
|
|
@@ -5019,7 +5021,7 @@
|
|
|
5019
5021
|
return this.deferSyncFn.sync = true;
|
|
5020
5022
|
}
|
|
5021
5023
|
|
|
5022
|
-
this.vm.setupState.updateValue(_objectSpread2({}, this.form));
|
|
5024
|
+
this.vm.setupState.updateValue(_objectSpread2(_objectSpread2({}, this.options.appendValue !== false ? this.appendData : {}), this.form));
|
|
5023
5025
|
},
|
|
5024
5026
|
isChange: function isChange(ctx, value) {
|
|
5025
5027
|
return JSON.stringify(this.getFormData(ctx), strFn) !== JSON.stringify(value, strFn);
|
|
@@ -5273,15 +5275,56 @@
|
|
|
5273
5275
|
if (!item) return undefined;
|
|
5274
5276
|
var fn;
|
|
5275
5277
|
|
|
5276
|
-
if (
|
|
5278
|
+
if (_typeof(item) === 'object') {
|
|
5279
|
+
var group = ctx.getParentGroup();
|
|
5280
|
+
|
|
5281
|
+
var checkCondition = function checkCondition(item) {
|
|
5282
|
+
item = Array.isArray(item) ? {
|
|
5283
|
+
mode: 'AND',
|
|
5284
|
+
group: item
|
|
5285
|
+
} : item;
|
|
5286
|
+
|
|
5287
|
+
if (!is.trueArray(item.group)) {
|
|
5288
|
+
return true;
|
|
5289
|
+
}
|
|
5290
|
+
|
|
5291
|
+
var or = item.mode === 'OR';
|
|
5292
|
+
var valid = true;
|
|
5293
|
+
|
|
5294
|
+
for (var i = 0; i < item.group.length; i++) {
|
|
5295
|
+
var one = item.group[i];
|
|
5296
|
+
var flag = void 0;
|
|
5297
|
+
|
|
5298
|
+
if (one.mode) {
|
|
5299
|
+
flag = checkCondition(one);
|
|
5300
|
+
} else if (!condition[one.condition]) {
|
|
5301
|
+
flag = false;
|
|
5302
|
+
} else {
|
|
5303
|
+
flag = new Function('_$', '_$val', 'top', 'group', "with(top){with(this){with(group){ return _$['".concat(one.condition, "'](").concat(one.field, ", ").concat(one.compare ? one.compare : '_$val', "); }}}")).call(_this.api.form, condition, one.value, _this.api.top.form, group ? _this.subRuleData[group.id] || {} : {});
|
|
5304
|
+
}
|
|
5305
|
+
|
|
5306
|
+
if (or && flag) {
|
|
5307
|
+
return true;
|
|
5308
|
+
}
|
|
5309
|
+
|
|
5310
|
+
if (!or) {
|
|
5311
|
+
valid = valid && flag;
|
|
5312
|
+
}
|
|
5313
|
+
}
|
|
5314
|
+
|
|
5315
|
+
return or ? false : valid;
|
|
5316
|
+
};
|
|
5317
|
+
|
|
5318
|
+
return checkCondition(item);
|
|
5319
|
+
} else if (is.Function(item)) {
|
|
5277
5320
|
fn = function fn() {
|
|
5278
5321
|
return item(_this.api.form, _this.api);
|
|
5279
5322
|
};
|
|
5280
5323
|
} else {
|
|
5281
|
-
var
|
|
5324
|
+
var _group = ctx.getParentGroup();
|
|
5282
5325
|
|
|
5283
5326
|
fn = function fn() {
|
|
5284
|
-
return new Function('formulas', 'top', 'group', '$rule', '$api', "with(top){with(this){with(group){with(formulas){ return ".concat(item, " }}}}")).call(_this.api.form, _this.fc.formulas, _this.api.top.form,
|
|
5327
|
+
return new Function('formulas', 'top', 'group', '$rule', '$api', "with(top){with(this){with(group){with(formulas){ return ".concat(item, " }}}}")).call(_this.api.form, _this.fc.formulas, _this.api.top.form, _group ? _this.subRuleData[_group.id] || {} : {}, ctx.rule, _this.api);
|
|
5285
5328
|
};
|
|
5286
5329
|
}
|
|
5287
5330
|
|
|
@@ -5634,7 +5677,11 @@
|
|
|
5634
5677
|
this.initData(fc.rules);
|
|
5635
5678
|
this.$manager = new fc.manager(this);
|
|
5636
5679
|
this.$render = new Render(this);
|
|
5637
|
-
this.api = fc.
|
|
5680
|
+
this.api = fc.extendApiFn.reduce(function (api, fn) {
|
|
5681
|
+
return _objectSpread2(_objectSpread2({}, api), invoke(function () {
|
|
5682
|
+
return fn(_objectSpread2({}, api), _this);
|
|
5683
|
+
}, {}));
|
|
5684
|
+
}, Api(this));
|
|
5638
5685
|
}
|
|
5639
5686
|
extend(Handler.prototype, {
|
|
5640
5687
|
initData: function initData(rules) {
|
|
@@ -5658,6 +5705,23 @@
|
|
|
5658
5705
|
},
|
|
5659
5706
|
isBreakWatch: function isBreakWatch() {
|
|
5660
5707
|
return this.loading || this.noWatchFn || this.reloading;
|
|
5708
|
+
},
|
|
5709
|
+
beforeFetch: function beforeFetch(opt) {
|
|
5710
|
+
var _this2 = this;
|
|
5711
|
+
|
|
5712
|
+
return new Promise(function (resolve) {
|
|
5713
|
+
var source = _this2.options.beforeFetch && invoke(function () {
|
|
5714
|
+
return _this2.options.beforeFetch(opt, {
|
|
5715
|
+
api: _this2.api
|
|
5716
|
+
});
|
|
5717
|
+
});
|
|
5718
|
+
|
|
5719
|
+
if (source && is.Function(source.then)) {
|
|
5720
|
+
source.then(resolve);
|
|
5721
|
+
} else {
|
|
5722
|
+
resolve();
|
|
5723
|
+
}
|
|
5724
|
+
});
|
|
5661
5725
|
}
|
|
5662
5726
|
});
|
|
5663
5727
|
useInject(Handler);
|
|
@@ -5872,7 +5936,7 @@
|
|
|
5872
5936
|
if (attr.attr) {
|
|
5873
5937
|
value = fc.loadData[attr.attr] || attr["default"];
|
|
5874
5938
|
|
|
5875
|
-
if (attr.copy) {
|
|
5939
|
+
if (attr.copy !== false) {
|
|
5876
5940
|
value = deepCopy(value);
|
|
5877
5941
|
}
|
|
5878
5942
|
}
|
|
@@ -5972,6 +6036,8 @@
|
|
|
5972
6036
|
return;
|
|
5973
6037
|
}
|
|
5974
6038
|
|
|
6039
|
+
option = deepCopy(option);
|
|
6040
|
+
|
|
5975
6041
|
if (!option.to) {
|
|
5976
6042
|
option.to = 'options';
|
|
5977
6043
|
}
|
|
@@ -6009,7 +6075,7 @@
|
|
|
6009
6075
|
if (check()) return;
|
|
6010
6076
|
|
|
6011
6077
|
var fn = function fn(v) {
|
|
6012
|
-
return flag ? v : v.data;
|
|
6078
|
+
return flag ? v : hasProperty(v, 'data') ? v.data : v;
|
|
6013
6079
|
};
|
|
6014
6080
|
|
|
6015
6081
|
var parse = parseFn(option.parse);
|
|
@@ -6040,27 +6106,25 @@
|
|
|
6040
6106
|
}
|
|
6041
6107
|
});
|
|
6042
6108
|
|
|
6043
|
-
fc.$handle.
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
});
|
|
6056
|
-
return;
|
|
6057
|
-
}
|
|
6109
|
+
fc.$handle.beforeFetch(config, {
|
|
6110
|
+
rule: rule,
|
|
6111
|
+
api: api
|
|
6112
|
+
}).then(function () {
|
|
6113
|
+
if (is.Function(option.action)) {
|
|
6114
|
+
option.action(rule, api).then(function (val) {
|
|
6115
|
+
config.onSuccess(val, true);
|
|
6116
|
+
})["catch"](function (e) {
|
|
6117
|
+
config.onError(e);
|
|
6118
|
+
});
|
|
6119
|
+
return;
|
|
6120
|
+
}
|
|
6058
6121
|
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6122
|
+
invoke(function () {
|
|
6123
|
+
return fc.create.fetch(config, {
|
|
6124
|
+
inject: inject,
|
|
6125
|
+
rule: rule,
|
|
6126
|
+
api: api
|
|
6127
|
+
});
|
|
6064
6128
|
});
|
|
6065
6129
|
});
|
|
6066
6130
|
}
|
|
@@ -6141,6 +6205,7 @@
|
|
|
6141
6205
|
var directives = {};
|
|
6142
6206
|
var modelFields = {};
|
|
6143
6207
|
var useApps = [];
|
|
6208
|
+
var extendApiFn = [config.extendApi];
|
|
6144
6209
|
|
|
6145
6210
|
var providers = _objectSpread2({}, $provider);
|
|
6146
6211
|
|
|
@@ -6148,7 +6213,7 @@
|
|
|
6148
6213
|
var globalConfig = {
|
|
6149
6214
|
global: {}
|
|
6150
6215
|
};
|
|
6151
|
-
var loadData = {};
|
|
6216
|
+
var loadData = vue.reactive({});
|
|
6152
6217
|
var CreateNode = CreateNodeFactory();
|
|
6153
6218
|
var formulas = {};
|
|
6154
6219
|
exportAttrs(config.attrs || {});
|
|
@@ -6310,6 +6375,14 @@
|
|
|
6310
6375
|
_emitData(id);
|
|
6311
6376
|
}
|
|
6312
6377
|
|
|
6378
|
+
function getData(id, def) {
|
|
6379
|
+
return hasProperty(loadData, id) ? loadData[id] : def;
|
|
6380
|
+
}
|
|
6381
|
+
|
|
6382
|
+
function extendApi(fn) {
|
|
6383
|
+
extendApiFn.push(fn);
|
|
6384
|
+
}
|
|
6385
|
+
|
|
6313
6386
|
function removeData(id) {
|
|
6314
6387
|
delete loadData[id];
|
|
6315
6388
|
|
|
@@ -6335,14 +6408,14 @@
|
|
|
6335
6408
|
components: components,
|
|
6336
6409
|
directives: directives
|
|
6337
6410
|
},
|
|
6411
|
+
setData: setData,
|
|
6412
|
+
getData: getData,
|
|
6338
6413
|
loadData: loadData,
|
|
6339
6414
|
CreateNode: CreateNode,
|
|
6340
6415
|
bus: new Mitt(),
|
|
6341
6416
|
unwatch: null,
|
|
6342
6417
|
options: vue.ref({}),
|
|
6343
|
-
|
|
6344
|
-
return api;
|
|
6345
|
-
}
|
|
6418
|
+
extendApiFn: extendApiFn
|
|
6346
6419
|
});
|
|
6347
6420
|
vue.nextTick(function () {
|
|
6348
6421
|
vue.watch(_this.options, function () {
|
|
@@ -6460,6 +6533,8 @@
|
|
|
6460
6533
|
extend(formCreate, {
|
|
6461
6534
|
version: config.version,
|
|
6462
6535
|
ui: config.ui,
|
|
6536
|
+
extendApi: extendApi,
|
|
6537
|
+
getData: getData,
|
|
6463
6538
|
setData: setData,
|
|
6464
6539
|
removeData: removeData,
|
|
6465
6540
|
maker: maker,
|
|
@@ -7177,7 +7252,7 @@
|
|
|
7177
7252
|
}
|
|
7178
7253
|
|
|
7179
7254
|
function extendApi(api, h) {
|
|
7180
|
-
|
|
7255
|
+
return {
|
|
7181
7256
|
formEl: function formEl() {
|
|
7182
7257
|
return h.$manager.form();
|
|
7183
7258
|
},
|
|
@@ -7336,8 +7411,7 @@
|
|
|
7336
7411
|
});
|
|
7337
7412
|
});
|
|
7338
7413
|
}
|
|
7339
|
-
}
|
|
7340
|
-
return api;
|
|
7414
|
+
};
|
|
7341
7415
|
}
|
|
7342
7416
|
|
|
7343
7417
|
var required = {
|
|
@@ -7418,7 +7492,7 @@
|
|
|
7418
7492
|
function elmFormCreate() {
|
|
7419
7493
|
return FormCreateFactory({
|
|
7420
7494
|
ui: 'element-ui',
|
|
7421
|
-
version: '3.1.
|
|
7495
|
+
version: '3.1.34',
|
|
7422
7496
|
manager: manager,
|
|
7423
7497
|
extendApi: extendApi,
|
|
7424
7498
|
install: install,
|