@form-create/element-ui 3.2.4 → 3.2.6
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 +93 -55
- package/dist/form-create.esm.min.js +2 -2
- package/dist/form-create.js +92 -54
- package/dist/form-create.min.js +2 -2
- package/package.json +4 -4
package/dist/form-create.esm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/element-ui v3.2.
|
|
2
|
+
* @form-create/element-ui v3.2.6
|
|
3
3
|
* (c) 2018-2024 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create
|
|
5
5
|
* Released under the MIT License.
|
|
6
6
|
*/
|
|
7
|
-
import { defineComponent, toRef, ref, watch, createVNode, resolveComponent, mergeProps as mergeProps$1, openBlock, createElementBlock, createElementVNode, isVNode, nextTick,
|
|
7
|
+
import { defineComponent, toRef, ref, watch, createVNode, resolveComponent, mergeProps as mergeProps$1, openBlock, createElementBlock, createElementVNode, isVNode, nextTick, createTextVNode, markRaw, reactive, getCurrentInstance, provide, inject, toRefs, onBeforeMount, onMounted, onBeforeUnmount, onUpdated, computed, withDirectives, resolveDirective, createApp, h } from 'vue';
|
|
8
8
|
|
|
9
9
|
function ownKeys(object, enumerableOnly) {
|
|
10
10
|
var keys = Object.keys(object);
|
|
@@ -1292,7 +1292,7 @@ var Tree = defineComponent({
|
|
|
1292
1292
|
}
|
|
1293
1293
|
});
|
|
1294
1294
|
|
|
1295
|
-
var css_248z$2 = "._fc-exceed .el-upload{display:none}.el-upload-list.is-disabled .el-upload{cursor:not-allowed!important}";
|
|
1295
|
+
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}";
|
|
1296
1296
|
styleInject(css_248z$2);
|
|
1297
1297
|
|
|
1298
1298
|
var script$1 = {
|
|
@@ -1368,8 +1368,12 @@ var Upload = defineComponent({
|
|
|
1368
1368
|
if (this.onPreview) {
|
|
1369
1369
|
this.onPreview.apply(this, arguments);
|
|
1370
1370
|
} else {
|
|
1371
|
-
this.
|
|
1372
|
-
|
|
1371
|
+
if ('text' === this.$attrs.listType) {
|
|
1372
|
+
window.open(file.url);
|
|
1373
|
+
} else {
|
|
1374
|
+
this.previewImage = file.url;
|
|
1375
|
+
this.previewVisible = true;
|
|
1376
|
+
}
|
|
1373
1377
|
}
|
|
1374
1378
|
},
|
|
1375
1379
|
update: function update(fileList) {
|
|
@@ -1401,7 +1405,9 @@ var Upload = defineComponent({
|
|
|
1401
1405
|
_this = this;
|
|
1402
1406
|
|
|
1403
1407
|
var len = toArray(this.modelValue).length;
|
|
1404
|
-
return createVNode(
|
|
1408
|
+
return createVNode("div", {
|
|
1409
|
+
"class": "_fc-upload"
|
|
1410
|
+
}, [createVNode(resolveComponent("ElUpload"), mergeProps$1({
|
|
1405
1411
|
"key": len,
|
|
1406
1412
|
"list-type": "picture-card"
|
|
1407
1413
|
}, this.$attrs, {
|
|
@@ -1415,10 +1421,16 @@ var Upload = defineComponent({
|
|
|
1415
1421
|
"ref": "upload"
|
|
1416
1422
|
}), _objectSpread2({
|
|
1417
1423
|
"default": function _default() {
|
|
1418
|
-
return [(
|
|
1424
|
+
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.$attrs.listType) === -1 ? createVNode(resolveComponent("ElIcon"), null, {
|
|
1419
1425
|
"default": function _default() {
|
|
1420
1426
|
return [createVNode(script$1, null, null)];
|
|
1421
1427
|
}
|
|
1428
|
+
}) : createVNode(resolveComponent("ElButton"), {
|
|
1429
|
+
"type": "primary"
|
|
1430
|
+
}, {
|
|
1431
|
+
"default": function _default() {
|
|
1432
|
+
return [createTextVNode("\u70B9\u51FB\u4E0A\u4F20")];
|
|
1433
|
+
}
|
|
1422
1434
|
})];
|
|
1423
1435
|
}
|
|
1424
1436
|
}, getSlot(this.$slots, ['default']))), createVNode(resolveComponent("ElDialog"), {
|
|
@@ -3766,6 +3778,8 @@ function useRender$1(Render) {
|
|
|
3766
3778
|
_vn = _this4.renderSides(_vn, ctx);
|
|
3767
3779
|
|
|
3768
3780
|
if (!(!ctx.input && is.Undef(prop["native"])) && prop["native"] !== true) {
|
|
3781
|
+
_this4.fc.targetFormDriver('updateWrap', ctx);
|
|
3782
|
+
|
|
3769
3783
|
_vn = _this4.$manager.makeWrap(ctx, _vn);
|
|
3770
3784
|
}
|
|
3771
3785
|
|
|
@@ -4139,12 +4153,14 @@ function useInject(Handler) {
|
|
|
4139
4153
|
return event;
|
|
4140
4154
|
},
|
|
4141
4155
|
getInjectData: function getInjectData(self, inject) {
|
|
4142
|
-
var
|
|
4143
|
-
|
|
4144
|
-
|
|
4156
|
+
var $api = self.__fc__ && self.__fc__.$api;
|
|
4157
|
+
var vm = self.__fc__ && self.__fc__.$handle.vm || this.vm.props;
|
|
4158
|
+
var _vm$props = vm.props,
|
|
4159
|
+
option = _vm$props.option,
|
|
4160
|
+
rule = _vm$props.rule;
|
|
4145
4161
|
return {
|
|
4146
|
-
$f: this.api,
|
|
4147
|
-
api: this.api,
|
|
4162
|
+
$f: $api || this.api,
|
|
4163
|
+
api: $api || this.api,
|
|
4148
4164
|
rule: rule,
|
|
4149
4165
|
self: self.__origin__,
|
|
4150
4166
|
option: option,
|
|
@@ -4776,6 +4792,11 @@ function useLoader(Handler) {
|
|
|
4776
4792
|
return !!(rule.field && _this6.fieldCtx[rule.field] && _this6.fieldCtx[rule.field][0] !== _rule.__fc__);
|
|
4777
4793
|
};
|
|
4778
4794
|
|
|
4795
|
+
_this6.fc.targetFormDriver('loadRule', {
|
|
4796
|
+
rule: rule,
|
|
4797
|
+
api: _this6.api
|
|
4798
|
+
}, _this6.fc);
|
|
4799
|
+
|
|
4779
4800
|
_this6.ruleEffect(rule, 'init', {
|
|
4780
4801
|
repeat: isRepeat()
|
|
4781
4802
|
});
|
|
@@ -4821,10 +4842,10 @@ function useLoader(Handler) {
|
|
|
4821
4842
|
} else {
|
|
4822
4843
|
if (ctx.originType !== ctx.rule.type) {
|
|
4823
4844
|
ctx.updateType();
|
|
4824
|
-
|
|
4825
|
-
_this6.bindParser(ctx);
|
|
4826
4845
|
}
|
|
4827
4846
|
|
|
4847
|
+
_this6.bindParser(ctx);
|
|
4848
|
+
|
|
4828
4849
|
_this6.appendValue(ctx.rule);
|
|
4829
4850
|
|
|
4830
4851
|
if (ctx.parent && ctx.parent !== parent) {
|
|
@@ -5472,8 +5493,6 @@ function useContext(Handler) {
|
|
|
5472
5493
|
}
|
|
5473
5494
|
|
|
5474
5495
|
Object.keys(computed).forEach(function (k) {
|
|
5475
|
-
var _val = deepGet(ctx.rule, k);
|
|
5476
|
-
|
|
5477
5496
|
ctx.watch.push(watch(function () {
|
|
5478
5497
|
var item = computed[k];
|
|
5479
5498
|
if (!item) return undefined;
|
|
@@ -5544,7 +5563,7 @@ function useContext(Handler) {
|
|
|
5544
5563
|
}
|
|
5545
5564
|
});
|
|
5546
5565
|
}, {
|
|
5547
|
-
immediate:
|
|
5566
|
+
immediate: k === 'value' ? [undefined, null, ''].indexOf(ctx.rule.value) > -1 : true
|
|
5548
5567
|
}));
|
|
5549
5568
|
});
|
|
5550
5569
|
});
|
|
@@ -5654,6 +5673,7 @@ function useLifecycle(Handler) {
|
|
|
5654
5673
|
}
|
|
5655
5674
|
},
|
|
5656
5675
|
lifecycle: function lifecycle(name) {
|
|
5676
|
+
this.fc.targetFormDriver(name, this.api, this.fc);
|
|
5657
5677
|
this.vm.emit(name, this.api);
|
|
5658
5678
|
this.emitEvent(name, this.api);
|
|
5659
5679
|
},
|
|
@@ -6106,17 +6126,10 @@ extend(Manager.prototype, {
|
|
|
6106
6126
|
}), opt, this.mergeOptionsRule);
|
|
6107
6127
|
},
|
|
6108
6128
|
updateOptions: function updateOptions(options) {
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
_this3.$handle.fc.renderDriver.updateOptions(options, {
|
|
6114
|
-
handle: _this3.$handle,
|
|
6115
|
-
api: _this3.$handle.api
|
|
6116
|
-
});
|
|
6117
|
-
});
|
|
6118
|
-
}
|
|
6119
|
-
|
|
6129
|
+
this.$handle.fc.targetFormDriver('updateOptions', options, {
|
|
6130
|
+
handle: this.$handle,
|
|
6131
|
+
api: this.$handle.api
|
|
6132
|
+
});
|
|
6120
6133
|
this.options = this.mergeOptions([options], this.getDefaultOptions());
|
|
6121
6134
|
this.update();
|
|
6122
6135
|
},
|
|
@@ -6826,14 +6839,39 @@ function FormCreateFactory(config) {
|
|
|
6826
6839
|
}));
|
|
6827
6840
|
}
|
|
6828
6841
|
|
|
6829
|
-
|
|
6830
|
-
|
|
6842
|
+
if (this.vm.props.driver) {
|
|
6843
|
+
this.renderDriver = this.drivers[this.vm.props.driver];
|
|
6844
|
+
}
|
|
6845
|
+
|
|
6846
|
+
if (!this.renderDriver && this.vm.setupState.parent) {
|
|
6847
|
+
this.renderDriver = this.vm.setupState.parent.setupState.fc.renderDriver;
|
|
6848
|
+
}
|
|
6849
|
+
|
|
6850
|
+
if (!this.renderDriver) {
|
|
6851
|
+
this.renderDriver = this.drivers["default"];
|
|
6852
|
+
}
|
|
6853
|
+
|
|
6831
6854
|
this.initOptions();
|
|
6832
6855
|
this.$handle.init();
|
|
6833
6856
|
},
|
|
6834
|
-
|
|
6857
|
+
targetFormDriver: function targetFormDriver(method) {
|
|
6835
6858
|
var _this3 = this;
|
|
6836
6859
|
|
|
6860
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
6861
|
+
args[_key2 - 1] = arguments[_key2];
|
|
6862
|
+
}
|
|
6863
|
+
|
|
6864
|
+
if (this.renderDriver && this.renderDriver[method]) {
|
|
6865
|
+
return invoke(function () {
|
|
6866
|
+
var _this3$renderDriver;
|
|
6867
|
+
|
|
6868
|
+
return (_this3$renderDriver = _this3.renderDriver)[method].apply(_this3$renderDriver, args);
|
|
6869
|
+
});
|
|
6870
|
+
}
|
|
6871
|
+
},
|
|
6872
|
+
globalDataDriver: function globalDataDriver(id) {
|
|
6873
|
+
var _this4 = this;
|
|
6874
|
+
|
|
6837
6875
|
var split = id.split('.');
|
|
6838
6876
|
var key = split.shift();
|
|
6839
6877
|
var option = this.options.value.globalData && this.options.value.globalData[key];
|
|
@@ -6865,28 +6903,28 @@ function FormCreateFactory(config) {
|
|
|
6865
6903
|
var reload = debounce(function () {
|
|
6866
6904
|
unwatch();
|
|
6867
6905
|
|
|
6868
|
-
var res =
|
|
6906
|
+
var res = _this4.fetchCache.get(option);
|
|
6869
6907
|
|
|
6870
|
-
if (
|
|
6908
|
+
if (_this4.options.value.globalData && Object.values(_this4.options.value.globalData).indexOf(option) !== -1) {
|
|
6871
6909
|
if (res) {
|
|
6872
6910
|
res.loading = true;
|
|
6873
6911
|
|
|
6874
|
-
|
|
6912
|
+
_this4.fetchCache.set(option, res);
|
|
6875
6913
|
}
|
|
6876
6914
|
|
|
6877
|
-
|
|
6915
|
+
_this4.bus.$emit('$loadData.$globalData.' + key);
|
|
6878
6916
|
} else {
|
|
6879
|
-
|
|
6917
|
+
_this4.fetchCache["delete"](option);
|
|
6880
6918
|
}
|
|
6881
6919
|
}, option.wait || 600);
|
|
6882
6920
|
|
|
6883
6921
|
var _emit = function _emit(data) {
|
|
6884
|
-
|
|
6922
|
+
_this4.fetchCache.set(option, {
|
|
6885
6923
|
status: true,
|
|
6886
6924
|
data: data
|
|
6887
6925
|
});
|
|
6888
6926
|
|
|
6889
|
-
|
|
6927
|
+
_this4.bus.$emit('$loadData.$globalData.' + key);
|
|
6890
6928
|
};
|
|
6891
6929
|
|
|
6892
6930
|
var callback = function callback(get, change) {
|
|
@@ -6899,9 +6937,9 @@ function FormCreateFactory(config) {
|
|
|
6899
6937
|
return;
|
|
6900
6938
|
}
|
|
6901
6939
|
|
|
6902
|
-
var options =
|
|
6940
|
+
var options = _this4.$handle.loadFetchVar(copy$1(option), get);
|
|
6903
6941
|
|
|
6904
|
-
|
|
6942
|
+
_this4.$handle.api.fetch(options).then(function (res) {
|
|
6905
6943
|
_emit(res);
|
|
6906
6944
|
})["catch"](function (e) {
|
|
6907
6945
|
_emit(null);
|
|
@@ -6915,7 +6953,7 @@ function FormCreateFactory(config) {
|
|
|
6915
6953
|
}
|
|
6916
6954
|
},
|
|
6917
6955
|
globalVarDriver: function globalVarDriver(id) {
|
|
6918
|
-
var
|
|
6956
|
+
var _this5 = this;
|
|
6919
6957
|
|
|
6920
6958
|
var split = id.split('.');
|
|
6921
6959
|
var key = split.shift();
|
|
@@ -6930,11 +6968,11 @@ function FormCreateFactory(config) {
|
|
|
6930
6968
|
if (change) {
|
|
6931
6969
|
unwatch();
|
|
6932
6970
|
|
|
6933
|
-
|
|
6971
|
+
_this5.bus.$emit('$loadData.$var.' + key);
|
|
6934
6972
|
}
|
|
6935
6973
|
|
|
6936
6974
|
val = invoke(function () {
|
|
6937
|
-
return handle(get,
|
|
6975
|
+
return handle(get, _this5.$handle.api);
|
|
6938
6976
|
});
|
|
6939
6977
|
});
|
|
6940
6978
|
this.unwatch.push(unwatch);
|
|
@@ -6974,7 +7012,7 @@ function FormCreateFactory(config) {
|
|
|
6974
7012
|
return val == null || val === '' ? def : val;
|
|
6975
7013
|
},
|
|
6976
7014
|
watchLoadData: function watchLoadData(fn) {
|
|
6977
|
-
var
|
|
7015
|
+
var _this6 = this;
|
|
6978
7016
|
|
|
6979
7017
|
var unwatch = {};
|
|
6980
7018
|
|
|
@@ -6989,14 +7027,14 @@ function FormCreateFactory(config) {
|
|
|
6989
7027
|
return unwatch[id].val;
|
|
6990
7028
|
}
|
|
6991
7029
|
|
|
6992
|
-
var val =
|
|
7030
|
+
var val = _this6.getLoadData(id, def);
|
|
6993
7031
|
|
|
6994
7032
|
var split = id.split('.');
|
|
6995
7033
|
var key = split.shift();
|
|
6996
7034
|
var key2 = split.shift() || '';
|
|
6997
7035
|
var callback = debounce(function () {
|
|
6998
7036
|
if (key !== id) {
|
|
6999
|
-
var temp =
|
|
7037
|
+
var temp = _this6.getLoadData(id, def);
|
|
7000
7038
|
|
|
7001
7039
|
if (JSON.stringify(temp) !== JSON.stringify(unwatch[id].val)) {
|
|
7002
7040
|
unwatch[id].val = temp;
|
|
@@ -7007,18 +7045,18 @@ function FormCreateFactory(config) {
|
|
|
7007
7045
|
}
|
|
7008
7046
|
}, 0);
|
|
7009
7047
|
|
|
7010
|
-
|
|
7048
|
+
_this6.bus.$on('$loadData.' + key, callback);
|
|
7011
7049
|
|
|
7012
7050
|
if (key2) {
|
|
7013
|
-
|
|
7051
|
+
_this6.bus.$on('$loadData.' + key + '.' + key2, callback);
|
|
7014
7052
|
}
|
|
7015
7053
|
|
|
7016
7054
|
unwatch[id] = {
|
|
7017
7055
|
fn: function fn() {
|
|
7018
|
-
|
|
7056
|
+
_this6.bus.$off('$loadData.' + key, callback);
|
|
7019
7057
|
|
|
7020
7058
|
if (key2) {
|
|
7021
|
-
|
|
7059
|
+
_this6.bus.$off('$loadData.' + key + '.' + key2, callback);
|
|
7022
7060
|
}
|
|
7023
7061
|
},
|
|
7024
7062
|
val: val
|
|
@@ -7088,7 +7126,7 @@ function FormCreateFactory(config) {
|
|
|
7088
7126
|
this.$handle.mounted();
|
|
7089
7127
|
},
|
|
7090
7128
|
unmount: function unmount() {
|
|
7091
|
-
var
|
|
7129
|
+
var _this7 = this;
|
|
7092
7130
|
|
|
7093
7131
|
if (this.name) {
|
|
7094
7132
|
if (this.inFor) {
|
|
@@ -7100,7 +7138,7 @@ function FormCreateFactory(config) {
|
|
|
7100
7138
|
}
|
|
7101
7139
|
|
|
7102
7140
|
listener.forEach(function (item) {
|
|
7103
|
-
|
|
7141
|
+
_this7.bus.$off(item.name, item.callback);
|
|
7104
7142
|
});
|
|
7105
7143
|
this.unwatch.forEach(function (fn) {
|
|
7106
7144
|
return fn();
|
|
@@ -7109,10 +7147,10 @@ function FormCreateFactory(config) {
|
|
|
7109
7147
|
this.$handle.reloadRule([]);
|
|
7110
7148
|
},
|
|
7111
7149
|
updated: function updated() {
|
|
7112
|
-
var
|
|
7150
|
+
var _this8 = this;
|
|
7113
7151
|
|
|
7114
7152
|
this.$handle.bindNextTick(function () {
|
|
7115
|
-
return
|
|
7153
|
+
return _this8.bus.$emit('next-tick', _this8.$handle.api);
|
|
7116
7154
|
});
|
|
7117
7155
|
}
|
|
7118
7156
|
});
|
|
@@ -8104,7 +8142,7 @@ function install(FormCreate) {
|
|
|
8104
8142
|
function elmFormCreate() {
|
|
8105
8143
|
return FormCreateFactory({
|
|
8106
8144
|
ui: 'element-ui',
|
|
8107
|
-
version: '3.2.
|
|
8145
|
+
version: '3.2.6',
|
|
8108
8146
|
manager: manager,
|
|
8109
8147
|
extendApi: extendApi,
|
|
8110
8148
|
install: install,
|