@form-create/element-ui 3.1.33 → 3.1.35
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 +77 -57
- package/dist/form-create.esm.min.js +2 -2
- package/dist/form-create.js +77 -57
- 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.35
|
|
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,
|
|
@@ -2967,7 +2952,7 @@
|
|
|
2967
2952
|
if (!ctx) return initial;
|
|
2968
2953
|
initial[ctx.field] = copy(ctx.rule.value);
|
|
2969
2954
|
return initial;
|
|
2970
|
-
}, h.options.appendValue ? copy(h.appendData) : {});
|
|
2955
|
+
}, h.options.appendValue !== false ? copy(h.appendData) : {});
|
|
2971
2956
|
},
|
|
2972
2957
|
getValue: function getValue(field) {
|
|
2973
2958
|
var ctx = h.getFieldCtx(field);
|
|
@@ -3412,12 +3397,17 @@
|
|
|
3412
3397
|
},
|
|
3413
3398
|
bus: h.bus,
|
|
3414
3399
|
fetch: function fetch(opt) {
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3400
|
+
return new Promise(function (resolve, reject) {
|
|
3401
|
+
h.beforeFetch(opt).then(function () {
|
|
3402
|
+
return asyncFetch(opt).then(resolve)["catch"](reject);
|
|
3418
3403
|
});
|
|
3419
3404
|
});
|
|
3420
|
-
|
|
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);
|
|
3421
3411
|
},
|
|
3422
3412
|
helper: {
|
|
3423
3413
|
tidyFields: tidyFields,
|
|
@@ -3819,8 +3809,8 @@
|
|
|
3819
3809
|
}];
|
|
3820
3810
|
|
|
3821
3811
|
if (ctx.input) {
|
|
3822
|
-
if (this.vm.props.disabled
|
|
3823
|
-
ctx.prop.props.disabled =
|
|
3812
|
+
if (this.vm.props.disabled === true) {
|
|
3813
|
+
ctx.prop.props.disabled = true;
|
|
3824
3814
|
}
|
|
3825
3815
|
|
|
3826
3816
|
var field = this.getModelField(ctx);
|
|
@@ -5031,7 +5021,7 @@
|
|
|
5031
5021
|
return this.deferSyncFn.sync = true;
|
|
5032
5022
|
}
|
|
5033
5023
|
|
|
5034
|
-
this.vm.setupState.updateValue(_objectSpread2(_objectSpread2({}, this.options.appendValue ? this.appendData : {}), this.form));
|
|
5024
|
+
this.vm.setupState.updateValue(_objectSpread2(_objectSpread2({}, this.options.appendValue !== false ? this.appendData : {}), this.form));
|
|
5035
5025
|
},
|
|
5036
5026
|
isChange: function isChange(ctx, value) {
|
|
5037
5027
|
return JSON.stringify(this.getFormData(ctx), strFn) !== JSON.stringify(value, strFn);
|
|
@@ -5687,7 +5677,12 @@
|
|
|
5687
5677
|
this.initData(fc.rules);
|
|
5688
5678
|
this.$manager = new fc.manager(this);
|
|
5689
5679
|
this.$render = new Render(this);
|
|
5690
|
-
this.api = fc.
|
|
5680
|
+
this.api = fc.extendApiFn.reduce(function (api, fn) {
|
|
5681
|
+
extend(api, invoke(function () {
|
|
5682
|
+
return fn(api, _this);
|
|
5683
|
+
}, {}));
|
|
5684
|
+
return api;
|
|
5685
|
+
}, Api(this));
|
|
5691
5686
|
}
|
|
5692
5687
|
extend(Handler.prototype, {
|
|
5693
5688
|
initData: function initData(rules) {
|
|
@@ -5711,6 +5706,23 @@
|
|
|
5711
5706
|
},
|
|
5712
5707
|
isBreakWatch: function isBreakWatch() {
|
|
5713
5708
|
return this.loading || this.noWatchFn || this.reloading;
|
|
5709
|
+
},
|
|
5710
|
+
beforeFetch: function beforeFetch(opt) {
|
|
5711
|
+
var _this2 = this;
|
|
5712
|
+
|
|
5713
|
+
return new Promise(function (resolve) {
|
|
5714
|
+
var source = _this2.options.beforeFetch && invoke(function () {
|
|
5715
|
+
return _this2.options.beforeFetch(opt, {
|
|
5716
|
+
api: _this2.api
|
|
5717
|
+
});
|
|
5718
|
+
});
|
|
5719
|
+
|
|
5720
|
+
if (source && is.Function(source.then)) {
|
|
5721
|
+
source.then(resolve);
|
|
5722
|
+
} else {
|
|
5723
|
+
resolve();
|
|
5724
|
+
}
|
|
5725
|
+
});
|
|
5714
5726
|
}
|
|
5715
5727
|
});
|
|
5716
5728
|
useInject(Handler);
|
|
@@ -5925,7 +5937,7 @@
|
|
|
5925
5937
|
if (attr.attr) {
|
|
5926
5938
|
value = fc.loadData[attr.attr] || attr["default"];
|
|
5927
5939
|
|
|
5928
|
-
if (attr.copy) {
|
|
5940
|
+
if (attr.copy !== false) {
|
|
5929
5941
|
value = deepCopy(value);
|
|
5930
5942
|
}
|
|
5931
5943
|
}
|
|
@@ -6064,7 +6076,7 @@
|
|
|
6064
6076
|
if (check()) return;
|
|
6065
6077
|
|
|
6066
6078
|
var fn = function fn(v) {
|
|
6067
|
-
return flag ? v : v.data;
|
|
6079
|
+
return flag ? v : hasProperty(v, 'data') ? v.data : v;
|
|
6068
6080
|
};
|
|
6069
6081
|
|
|
6070
6082
|
var parse = parseFn(option.parse);
|
|
@@ -6095,27 +6107,25 @@
|
|
|
6095
6107
|
}
|
|
6096
6108
|
});
|
|
6097
6109
|
|
|
6098
|
-
fc.$handle.
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
});
|
|
6111
|
-
return;
|
|
6112
|
-
}
|
|
6110
|
+
fc.$handle.beforeFetch(config, {
|
|
6111
|
+
rule: rule,
|
|
6112
|
+
api: api
|
|
6113
|
+
}).then(function () {
|
|
6114
|
+
if (is.Function(option.action)) {
|
|
6115
|
+
option.action(rule, api).then(function (val) {
|
|
6116
|
+
config.onSuccess(val, true);
|
|
6117
|
+
})["catch"](function (e) {
|
|
6118
|
+
config.onError(e);
|
|
6119
|
+
});
|
|
6120
|
+
return;
|
|
6121
|
+
}
|
|
6113
6122
|
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6123
|
+
invoke(function () {
|
|
6124
|
+
return fc.create.fetch(config, {
|
|
6125
|
+
inject: inject,
|
|
6126
|
+
rule: rule,
|
|
6127
|
+
api: api
|
|
6128
|
+
});
|
|
6119
6129
|
});
|
|
6120
6130
|
});
|
|
6121
6131
|
}
|
|
@@ -6196,6 +6206,7 @@
|
|
|
6196
6206
|
var directives = {};
|
|
6197
6207
|
var modelFields = {};
|
|
6198
6208
|
var useApps = [];
|
|
6209
|
+
var extendApiFn = [config.extendApi];
|
|
6199
6210
|
|
|
6200
6211
|
var providers = _objectSpread2({}, $provider);
|
|
6201
6212
|
|
|
@@ -6203,7 +6214,7 @@
|
|
|
6203
6214
|
var globalConfig = {
|
|
6204
6215
|
global: {}
|
|
6205
6216
|
};
|
|
6206
|
-
var loadData = {};
|
|
6217
|
+
var loadData = vue.reactive({});
|
|
6207
6218
|
var CreateNode = CreateNodeFactory();
|
|
6208
6219
|
var formulas = {};
|
|
6209
6220
|
exportAttrs(config.attrs || {});
|
|
@@ -6365,6 +6376,14 @@
|
|
|
6365
6376
|
_emitData(id);
|
|
6366
6377
|
}
|
|
6367
6378
|
|
|
6379
|
+
function getData(id, def) {
|
|
6380
|
+
return hasProperty(loadData, id) ? loadData[id] : def;
|
|
6381
|
+
}
|
|
6382
|
+
|
|
6383
|
+
function extendApi(fn) {
|
|
6384
|
+
extendApiFn.push(fn);
|
|
6385
|
+
}
|
|
6386
|
+
|
|
6368
6387
|
function removeData(id) {
|
|
6369
6388
|
delete loadData[id];
|
|
6370
6389
|
|
|
@@ -6390,14 +6409,14 @@
|
|
|
6390
6409
|
components: components,
|
|
6391
6410
|
directives: directives
|
|
6392
6411
|
},
|
|
6412
|
+
setData: setData,
|
|
6413
|
+
getData: getData,
|
|
6393
6414
|
loadData: loadData,
|
|
6394
6415
|
CreateNode: CreateNode,
|
|
6395
6416
|
bus: new Mitt(),
|
|
6396
6417
|
unwatch: null,
|
|
6397
6418
|
options: vue.ref({}),
|
|
6398
|
-
|
|
6399
|
-
return api;
|
|
6400
|
-
}
|
|
6419
|
+
extendApiFn: extendApiFn
|
|
6401
6420
|
});
|
|
6402
6421
|
vue.nextTick(function () {
|
|
6403
6422
|
vue.watch(_this.options, function () {
|
|
@@ -6515,6 +6534,8 @@
|
|
|
6515
6534
|
extend(formCreate, {
|
|
6516
6535
|
version: config.version,
|
|
6517
6536
|
ui: config.ui,
|
|
6537
|
+
extendApi: extendApi,
|
|
6538
|
+
getData: getData,
|
|
6518
6539
|
setData: setData,
|
|
6519
6540
|
removeData: removeData,
|
|
6520
6541
|
maker: maker,
|
|
@@ -7232,7 +7253,7 @@
|
|
|
7232
7253
|
}
|
|
7233
7254
|
|
|
7234
7255
|
function extendApi(api, h) {
|
|
7235
|
-
|
|
7256
|
+
return {
|
|
7236
7257
|
formEl: function formEl() {
|
|
7237
7258
|
return h.$manager.form();
|
|
7238
7259
|
},
|
|
@@ -7391,8 +7412,7 @@
|
|
|
7391
7412
|
});
|
|
7392
7413
|
});
|
|
7393
7414
|
}
|
|
7394
|
-
}
|
|
7395
|
-
return api;
|
|
7415
|
+
};
|
|
7396
7416
|
}
|
|
7397
7417
|
|
|
7398
7418
|
var required = {
|
|
@@ -7473,7 +7493,7 @@
|
|
|
7473
7493
|
function elmFormCreate() {
|
|
7474
7494
|
return FormCreateFactory({
|
|
7475
7495
|
ui: 'element-ui',
|
|
7476
|
-
version: '3.1.
|
|
7496
|
+
version: '3.1.35',
|
|
7477
7497
|
manager: manager,
|
|
7478
7498
|
extendApi: extendApi,
|
|
7479
7499
|
install: install,
|