@form-create/element-ui 3.2.5 → 3.2.7
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 +113 -59
- package/dist/form-create.esm.min.js +2 -2
- package/dist/form-create.js +112 -58
- package/dist/form-create.min.js +2 -2
- package/package.json +4 -4
package/dist/form-create.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/element-ui v3.2.
|
|
2
|
+
* @form-create/element-ui v3.2.7
|
|
3
3
|
* (c) 2018-2024 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create
|
|
5
5
|
* Released under the MIT License.
|
|
@@ -1296,7 +1296,7 @@
|
|
|
1296
1296
|
}
|
|
1297
1297
|
});
|
|
1298
1298
|
|
|
1299
|
-
var css_248z$2 = "._fc-exceed .el-upload{display:none}.el-upload-list.is-disabled .el-upload{cursor:not-allowed!important}";
|
|
1299
|
+
var css_248z$2 = "._fc-upload{width:100%}._fc-exceed .el-upload{display:none}.el-upload-list.is-disabled .el-upload{cursor:not-allowed!important}";
|
|
1300
1300
|
styleInject(css_248z$2);
|
|
1301
1301
|
|
|
1302
1302
|
var script$1 = {
|
|
@@ -1349,6 +1349,7 @@
|
|
|
1349
1349
|
previewMask: undefined,
|
|
1350
1350
|
onPreview: Function,
|
|
1351
1351
|
modalTitle: String,
|
|
1352
|
+
listType: String,
|
|
1352
1353
|
modelValue: [Array, String]
|
|
1353
1354
|
},
|
|
1354
1355
|
emits: ['update:modelValue', 'change', 'remove', 'fc.el'],
|
|
@@ -1372,8 +1373,12 @@
|
|
|
1372
1373
|
if (this.onPreview) {
|
|
1373
1374
|
this.onPreview.apply(this, arguments);
|
|
1374
1375
|
} else {
|
|
1375
|
-
this.
|
|
1376
|
-
|
|
1376
|
+
if ('text' === this.listType) {
|
|
1377
|
+
window.open(file.url);
|
|
1378
|
+
} else {
|
|
1379
|
+
this.previewImage = file.url;
|
|
1380
|
+
this.previewVisible = true;
|
|
1381
|
+
}
|
|
1377
1382
|
}
|
|
1378
1383
|
},
|
|
1379
1384
|
update: function update(fileList) {
|
|
@@ -1405,10 +1410,12 @@
|
|
|
1405
1410
|
_this = this;
|
|
1406
1411
|
|
|
1407
1412
|
var len = toArray(this.modelValue).length;
|
|
1408
|
-
return vue.createVNode(
|
|
1409
|
-
"
|
|
1410
|
-
|
|
1413
|
+
return vue.createVNode("div", {
|
|
1414
|
+
"class": "_fc-upload"
|
|
1415
|
+
}, [vue.createVNode(vue.resolveComponent("ElUpload"), vue.mergeProps({
|
|
1416
|
+
"key": len
|
|
1411
1417
|
}, this.$attrs, {
|
|
1418
|
+
"list-type": this.listType || 'picture-card',
|
|
1412
1419
|
"class": {
|
|
1413
1420
|
'_fc-exceed': this.$attrs.limit ? this.$attrs.limit <= len : false
|
|
1414
1421
|
},
|
|
@@ -1419,10 +1426,16 @@
|
|
|
1419
1426
|
"ref": "upload"
|
|
1420
1427
|
}), _objectSpread2({
|
|
1421
1428
|
"default": function _default() {
|
|
1422
|
-
return [(
|
|
1429
|
+
return [(_this$$slots$default = (_this$$slots = _this.$slots)["default"]) !== null && _this$$slots$default !== void 0 && _this$$slots$default.call(_this$$slots) || ['text', 'picture'].indexOf(_this.listType) === -1 ? vue.createVNode(vue.resolveComponent("ElIcon"), null, {
|
|
1423
1430
|
"default": function _default() {
|
|
1424
1431
|
return [vue.createVNode(script$1, null, null)];
|
|
1425
1432
|
}
|
|
1433
|
+
}) : vue.createVNode(vue.resolveComponent("ElButton"), {
|
|
1434
|
+
"type": "primary"
|
|
1435
|
+
}, {
|
|
1436
|
+
"default": function _default() {
|
|
1437
|
+
return [vue.createTextVNode("\u70B9\u51FB\u4E0A\u4F20")];
|
|
1438
|
+
}
|
|
1426
1439
|
})];
|
|
1427
1440
|
}
|
|
1428
1441
|
}, getSlot(this.$slots, ['default']))), vue.createVNode(vue.resolveComponent("ElDialog"), {
|
|
@@ -2105,7 +2118,7 @@
|
|
|
2105
2118
|
}
|
|
2106
2119
|
},
|
|
2107
2120
|
extendOption: Boolean,
|
|
2108
|
-
driver: String,
|
|
2121
|
+
driver: [String, Object],
|
|
2109
2122
|
modelValue: Object,
|
|
2110
2123
|
disabled: {
|
|
2111
2124
|
type: Boolean,
|
|
@@ -2115,6 +2128,7 @@
|
|
|
2115
2128
|
type: Boolean,
|
|
2116
2129
|
"default": undefined
|
|
2117
2130
|
},
|
|
2131
|
+
index: [String, Number],
|
|
2118
2132
|
api: Object,
|
|
2119
2133
|
name: String,
|
|
2120
2134
|
subForm: {
|
|
@@ -2280,7 +2294,6 @@
|
|
|
2280
2294
|
if (JSON.stringify(n || {}) === data.updateValue) return;
|
|
2281
2295
|
|
|
2282
2296
|
if (fapi.config.forceCoverValue) {
|
|
2283
|
-
fc.$handle.appendData = {};
|
|
2284
2297
|
fapi.coverValue(n || {});
|
|
2285
2298
|
} else {
|
|
2286
2299
|
fapi.setValue(n || {});
|
|
@@ -2288,6 +2301,18 @@
|
|
|
2288
2301
|
}, {
|
|
2289
2302
|
deep: true
|
|
2290
2303
|
});
|
|
2304
|
+
vue.watch(function () {
|
|
2305
|
+
return props.index;
|
|
2306
|
+
}, function () {
|
|
2307
|
+
fapi.coverValue({});
|
|
2308
|
+
vue.nextTick(function () {
|
|
2309
|
+
vue.nextTick(function () {
|
|
2310
|
+
fapi.clearValidateState();
|
|
2311
|
+
});
|
|
2312
|
+
});
|
|
2313
|
+
}, {
|
|
2314
|
+
flush: 'sync'
|
|
2315
|
+
});
|
|
2291
2316
|
return _objectSpread2(_objectSpread2({
|
|
2292
2317
|
fc: vue.markRaw(fc),
|
|
2293
2318
|
parent: parent ? vue.markRaw(parent) : parent,
|
|
@@ -3001,6 +3026,7 @@
|
|
|
3001
3026
|
var data = _objectSpread2({}, formData || {});
|
|
3002
3027
|
|
|
3003
3028
|
h.deferSyncValue(function () {
|
|
3029
|
+
h.appendData = {};
|
|
3004
3030
|
api.fields().forEach(function (key) {
|
|
3005
3031
|
var ctxs = h.fieldCtx[key];
|
|
3006
3032
|
|
|
@@ -3013,7 +3039,7 @@
|
|
|
3013
3039
|
}
|
|
3014
3040
|
});
|
|
3015
3041
|
extend(h.appendData, data);
|
|
3016
|
-
});
|
|
3042
|
+
}, true);
|
|
3017
3043
|
},
|
|
3018
3044
|
setValue: function setValue(field) {
|
|
3019
3045
|
var formData = field;
|
|
@@ -3026,7 +3052,7 @@
|
|
|
3026
3052
|
ctx.rule.value = formData[key];
|
|
3027
3053
|
});
|
|
3028
3054
|
});
|
|
3029
|
-
});
|
|
3055
|
+
}, true);
|
|
3030
3056
|
},
|
|
3031
3057
|
removeField: function removeField(field) {
|
|
3032
3058
|
var ctx = h.getCtx(field);
|
|
@@ -3770,6 +3796,8 @@
|
|
|
3770
3796
|
_vn = _this4.renderSides(_vn, ctx);
|
|
3771
3797
|
|
|
3772
3798
|
if (!(!ctx.input && is.Undef(prop["native"])) && prop["native"] !== true) {
|
|
3799
|
+
_this4.fc.targetFormDriver('updateWrap', ctx);
|
|
3800
|
+
|
|
3773
3801
|
_vn = _this4.$manager.makeWrap(ctx, _vn);
|
|
3774
3802
|
}
|
|
3775
3803
|
|
|
@@ -4143,12 +4171,14 @@
|
|
|
4143
4171
|
return event;
|
|
4144
4172
|
},
|
|
4145
4173
|
getInjectData: function getInjectData(self, inject) {
|
|
4146
|
-
var
|
|
4147
|
-
|
|
4148
|
-
|
|
4174
|
+
var $api = self.__fc__ && self.__fc__.$api;
|
|
4175
|
+
var vm = self.__fc__ && self.__fc__.$handle.vm || this.vm.props;
|
|
4176
|
+
var _vm$props = vm.props,
|
|
4177
|
+
option = _vm$props.option,
|
|
4178
|
+
rule = _vm$props.rule;
|
|
4149
4179
|
return {
|
|
4150
|
-
$f: this.api,
|
|
4151
|
-
api: this.api,
|
|
4180
|
+
$f: $api || this.api,
|
|
4181
|
+
api: $api || this.api,
|
|
4152
4182
|
rule: rule,
|
|
4153
4183
|
self: self.__origin__,
|
|
4154
4184
|
option: option,
|
|
@@ -4780,6 +4810,11 @@
|
|
|
4780
4810
|
return !!(rule.field && _this6.fieldCtx[rule.field] && _this6.fieldCtx[rule.field][0] !== _rule.__fc__);
|
|
4781
4811
|
};
|
|
4782
4812
|
|
|
4813
|
+
_this6.fc.targetFormDriver('loadRule', {
|
|
4814
|
+
rule: rule,
|
|
4815
|
+
api: _this6.api
|
|
4816
|
+
}, _this6.fc);
|
|
4817
|
+
|
|
4783
4818
|
_this6.ruleEffect(rule, 'init', {
|
|
4784
4819
|
repeat: isRepeat()
|
|
4785
4820
|
});
|
|
@@ -4825,10 +4860,10 @@
|
|
|
4825
4860
|
} else {
|
|
4826
4861
|
if (ctx.originType !== ctx.rule.type) {
|
|
4827
4862
|
ctx.updateType();
|
|
4828
|
-
|
|
4829
|
-
_this6.bindParser(ctx);
|
|
4830
4863
|
}
|
|
4831
4864
|
|
|
4865
|
+
_this6.bindParser(ctx);
|
|
4866
|
+
|
|
4832
4867
|
_this6.appendValue(ctx.rule);
|
|
4833
4868
|
|
|
4834
4869
|
if (ctx.parent && ctx.parent !== parent) {
|
|
@@ -5198,7 +5233,7 @@
|
|
|
5198
5233
|
this.deferSyncFn = null;
|
|
5199
5234
|
|
|
5200
5235
|
if (fn.sync) {
|
|
5201
|
-
this.
|
|
5236
|
+
this.syncForm();
|
|
5202
5237
|
}
|
|
5203
5238
|
}
|
|
5204
5239
|
},
|
|
@@ -5656,6 +5691,7 @@
|
|
|
5656
5691
|
}
|
|
5657
5692
|
},
|
|
5658
5693
|
lifecycle: function lifecycle(name) {
|
|
5694
|
+
this.fc.targetFormDriver(name, this.api, this.fc);
|
|
5659
5695
|
this.vm.emit(name, this.api);
|
|
5660
5696
|
this.emitEvent(name, this.api);
|
|
5661
5697
|
},
|
|
@@ -6108,17 +6144,10 @@
|
|
|
6108
6144
|
}), opt, this.mergeOptionsRule);
|
|
6109
6145
|
},
|
|
6110
6146
|
updateOptions: function updateOptions(options) {
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
_this3.$handle.fc.renderDriver.updateOptions(options, {
|
|
6116
|
-
handle: _this3.$handle,
|
|
6117
|
-
api: _this3.$handle.api
|
|
6118
|
-
});
|
|
6119
|
-
});
|
|
6120
|
-
}
|
|
6121
|
-
|
|
6147
|
+
this.$handle.fc.targetFormDriver('updateOptions', options, {
|
|
6148
|
+
handle: this.$handle,
|
|
6149
|
+
api: this.$handle.api
|
|
6150
|
+
});
|
|
6122
6151
|
this.options = this.mergeOptions([options], this.getDefaultOptions());
|
|
6123
6152
|
this.update();
|
|
6124
6153
|
},
|
|
@@ -6828,14 +6857,39 @@
|
|
|
6828
6857
|
}));
|
|
6829
6858
|
}
|
|
6830
6859
|
|
|
6831
|
-
|
|
6832
|
-
|
|
6860
|
+
if (this.vm.props.driver) {
|
|
6861
|
+
this.renderDriver = _typeof(this.vm.props.driver) === 'object' ? this.vm.props.driver : this.drivers[this.vm.props.driver];
|
|
6862
|
+
}
|
|
6863
|
+
|
|
6864
|
+
if (!this.renderDriver && this.vm.setupState.parent) {
|
|
6865
|
+
this.renderDriver = this.vm.setupState.parent.setupState.fc.renderDriver;
|
|
6866
|
+
}
|
|
6867
|
+
|
|
6868
|
+
if (!this.renderDriver) {
|
|
6869
|
+
this.renderDriver = this.drivers["default"];
|
|
6870
|
+
}
|
|
6871
|
+
|
|
6833
6872
|
this.initOptions();
|
|
6834
6873
|
this.$handle.init();
|
|
6835
6874
|
},
|
|
6836
|
-
|
|
6875
|
+
targetFormDriver: function targetFormDriver(method) {
|
|
6837
6876
|
var _this3 = this;
|
|
6838
6877
|
|
|
6878
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
6879
|
+
args[_key2 - 1] = arguments[_key2];
|
|
6880
|
+
}
|
|
6881
|
+
|
|
6882
|
+
if (this.renderDriver && this.renderDriver[method]) {
|
|
6883
|
+
return invoke(function () {
|
|
6884
|
+
var _this3$renderDriver;
|
|
6885
|
+
|
|
6886
|
+
return (_this3$renderDriver = _this3.renderDriver)[method].apply(_this3$renderDriver, args);
|
|
6887
|
+
});
|
|
6888
|
+
}
|
|
6889
|
+
},
|
|
6890
|
+
globalDataDriver: function globalDataDriver(id) {
|
|
6891
|
+
var _this4 = this;
|
|
6892
|
+
|
|
6839
6893
|
var split = id.split('.');
|
|
6840
6894
|
var key = split.shift();
|
|
6841
6895
|
var option = this.options.value.globalData && this.options.value.globalData[key];
|
|
@@ -6867,28 +6921,28 @@
|
|
|
6867
6921
|
var reload = debounce(function () {
|
|
6868
6922
|
unwatch();
|
|
6869
6923
|
|
|
6870
|
-
var res =
|
|
6924
|
+
var res = _this4.fetchCache.get(option);
|
|
6871
6925
|
|
|
6872
|
-
if (
|
|
6926
|
+
if (_this4.options.value.globalData && Object.values(_this4.options.value.globalData).indexOf(option) !== -1) {
|
|
6873
6927
|
if (res) {
|
|
6874
6928
|
res.loading = true;
|
|
6875
6929
|
|
|
6876
|
-
|
|
6930
|
+
_this4.fetchCache.set(option, res);
|
|
6877
6931
|
}
|
|
6878
6932
|
|
|
6879
|
-
|
|
6933
|
+
_this4.bus.$emit('$loadData.$globalData.' + key);
|
|
6880
6934
|
} else {
|
|
6881
|
-
|
|
6935
|
+
_this4.fetchCache["delete"](option);
|
|
6882
6936
|
}
|
|
6883
6937
|
}, option.wait || 600);
|
|
6884
6938
|
|
|
6885
6939
|
var _emit = function _emit(data) {
|
|
6886
|
-
|
|
6940
|
+
_this4.fetchCache.set(option, {
|
|
6887
6941
|
status: true,
|
|
6888
6942
|
data: data
|
|
6889
6943
|
});
|
|
6890
6944
|
|
|
6891
|
-
|
|
6945
|
+
_this4.bus.$emit('$loadData.$globalData.' + key);
|
|
6892
6946
|
};
|
|
6893
6947
|
|
|
6894
6948
|
var callback = function callback(get, change) {
|
|
@@ -6901,9 +6955,9 @@
|
|
|
6901
6955
|
return;
|
|
6902
6956
|
}
|
|
6903
6957
|
|
|
6904
|
-
var options =
|
|
6958
|
+
var options = _this4.$handle.loadFetchVar(copy$1(option), get);
|
|
6905
6959
|
|
|
6906
|
-
|
|
6960
|
+
_this4.$handle.api.fetch(options).then(function (res) {
|
|
6907
6961
|
_emit(res);
|
|
6908
6962
|
})["catch"](function (e) {
|
|
6909
6963
|
_emit(null);
|
|
@@ -6917,7 +6971,7 @@
|
|
|
6917
6971
|
}
|
|
6918
6972
|
},
|
|
6919
6973
|
globalVarDriver: function globalVarDriver(id) {
|
|
6920
|
-
var
|
|
6974
|
+
var _this5 = this;
|
|
6921
6975
|
|
|
6922
6976
|
var split = id.split('.');
|
|
6923
6977
|
var key = split.shift();
|
|
@@ -6932,11 +6986,11 @@
|
|
|
6932
6986
|
if (change) {
|
|
6933
6987
|
unwatch();
|
|
6934
6988
|
|
|
6935
|
-
|
|
6989
|
+
_this5.bus.$emit('$loadData.$var.' + key);
|
|
6936
6990
|
}
|
|
6937
6991
|
|
|
6938
6992
|
val = invoke(function () {
|
|
6939
|
-
return handle(get,
|
|
6993
|
+
return handle(get, _this5.$handle.api);
|
|
6940
6994
|
});
|
|
6941
6995
|
});
|
|
6942
6996
|
this.unwatch.push(unwatch);
|
|
@@ -6976,7 +7030,7 @@
|
|
|
6976
7030
|
return val == null || val === '' ? def : val;
|
|
6977
7031
|
},
|
|
6978
7032
|
watchLoadData: function watchLoadData(fn) {
|
|
6979
|
-
var
|
|
7033
|
+
var _this6 = this;
|
|
6980
7034
|
|
|
6981
7035
|
var unwatch = {};
|
|
6982
7036
|
|
|
@@ -6991,14 +7045,14 @@
|
|
|
6991
7045
|
return unwatch[id].val;
|
|
6992
7046
|
}
|
|
6993
7047
|
|
|
6994
|
-
var val =
|
|
7048
|
+
var val = _this6.getLoadData(id, def);
|
|
6995
7049
|
|
|
6996
7050
|
var split = id.split('.');
|
|
6997
7051
|
var key = split.shift();
|
|
6998
7052
|
var key2 = split.shift() || '';
|
|
6999
7053
|
var callback = debounce(function () {
|
|
7000
7054
|
if (key !== id) {
|
|
7001
|
-
var temp =
|
|
7055
|
+
var temp = _this6.getLoadData(id, def);
|
|
7002
7056
|
|
|
7003
7057
|
if (JSON.stringify(temp) !== JSON.stringify(unwatch[id].val)) {
|
|
7004
7058
|
unwatch[id].val = temp;
|
|
@@ -7009,18 +7063,18 @@
|
|
|
7009
7063
|
}
|
|
7010
7064
|
}, 0);
|
|
7011
7065
|
|
|
7012
|
-
|
|
7066
|
+
_this6.bus.$on('$loadData.' + key, callback);
|
|
7013
7067
|
|
|
7014
7068
|
if (key2) {
|
|
7015
|
-
|
|
7069
|
+
_this6.bus.$on('$loadData.' + key + '.' + key2, callback);
|
|
7016
7070
|
}
|
|
7017
7071
|
|
|
7018
7072
|
unwatch[id] = {
|
|
7019
7073
|
fn: function fn() {
|
|
7020
|
-
|
|
7074
|
+
_this6.bus.$off('$loadData.' + key, callback);
|
|
7021
7075
|
|
|
7022
7076
|
if (key2) {
|
|
7023
|
-
|
|
7077
|
+
_this6.bus.$off('$loadData.' + key + '.' + key2, callback);
|
|
7024
7078
|
}
|
|
7025
7079
|
},
|
|
7026
7080
|
val: val
|
|
@@ -7090,7 +7144,7 @@
|
|
|
7090
7144
|
this.$handle.mounted();
|
|
7091
7145
|
},
|
|
7092
7146
|
unmount: function unmount() {
|
|
7093
|
-
var
|
|
7147
|
+
var _this7 = this;
|
|
7094
7148
|
|
|
7095
7149
|
if (this.name) {
|
|
7096
7150
|
if (this.inFor) {
|
|
@@ -7102,7 +7156,7 @@
|
|
|
7102
7156
|
}
|
|
7103
7157
|
|
|
7104
7158
|
listener.forEach(function (item) {
|
|
7105
|
-
|
|
7159
|
+
_this7.bus.$off(item.name, item.callback);
|
|
7106
7160
|
});
|
|
7107
7161
|
this.unwatch.forEach(function (fn) {
|
|
7108
7162
|
return fn();
|
|
@@ -7111,10 +7165,10 @@
|
|
|
7111
7165
|
this.$handle.reloadRule([]);
|
|
7112
7166
|
},
|
|
7113
7167
|
updated: function updated() {
|
|
7114
|
-
var
|
|
7168
|
+
var _this8 = this;
|
|
7115
7169
|
|
|
7116
7170
|
this.$handle.bindNextTick(function () {
|
|
7117
|
-
return
|
|
7171
|
+
return _this8.bus.$emit('next-tick', _this8.$handle.api);
|
|
7118
7172
|
});
|
|
7119
7173
|
}
|
|
7120
7174
|
});
|
|
@@ -8106,7 +8160,7 @@
|
|
|
8106
8160
|
function elmFormCreate() {
|
|
8107
8161
|
return FormCreateFactory({
|
|
8108
8162
|
ui: 'element-ui',
|
|
8109
|
-
version: '3.2.
|
|
8163
|
+
version: '3.2.7',
|
|
8110
8164
|
manager: manager,
|
|
8111
8165
|
extendApi: extendApi,
|
|
8112
8166
|
install: install,
|