@form-create/element-ui 3.2.5 → 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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @form-create/element-ui v3.2.5
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.
@@ -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 = {
@@ -1372,8 +1372,12 @@
1372
1372
  if (this.onPreview) {
1373
1373
  this.onPreview.apply(this, arguments);
1374
1374
  } else {
1375
- this.previewImage = file.url;
1376
- this.previewVisible = true;
1375
+ if ('text' === this.$attrs.listType) {
1376
+ window.open(file.url);
1377
+ } else {
1378
+ this.previewImage = file.url;
1379
+ this.previewVisible = true;
1380
+ }
1377
1381
  }
1378
1382
  },
1379
1383
  update: function update(fileList) {
@@ -1405,7 +1409,9 @@
1405
1409
  _this = this;
1406
1410
 
1407
1411
  var len = toArray(this.modelValue).length;
1408
- return vue.createVNode(vue.Fragment, null, [vue.createVNode(vue.resolveComponent("ElUpload"), vue.mergeProps({
1412
+ return vue.createVNode("div", {
1413
+ "class": "_fc-upload"
1414
+ }, [vue.createVNode(vue.resolveComponent("ElUpload"), vue.mergeProps({
1409
1415
  "key": len,
1410
1416
  "list-type": "picture-card"
1411
1417
  }, this.$attrs, {
@@ -1419,10 +1425,16 @@
1419
1425
  "ref": "upload"
1420
1426
  }), _objectSpread2({
1421
1427
  "default": function _default() {
1422
- return [((_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)) || vue.createVNode(vue.resolveComponent("ElIcon"), null, {
1428
+ 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 ? vue.createVNode(vue.resolveComponent("ElIcon"), null, {
1423
1429
  "default": function _default() {
1424
1430
  return [vue.createVNode(script$1, null, null)];
1425
1431
  }
1432
+ }) : vue.createVNode(vue.resolveComponent("ElButton"), {
1433
+ "type": "primary"
1434
+ }, {
1435
+ "default": function _default() {
1436
+ return [vue.createTextVNode("\u70B9\u51FB\u4E0A\u4F20")];
1437
+ }
1426
1438
  })];
1427
1439
  }
1428
1440
  }, getSlot(this.$slots, ['default']))), vue.createVNode(vue.resolveComponent("ElDialog"), {
@@ -3770,6 +3782,8 @@
3770
3782
  _vn = _this4.renderSides(_vn, ctx);
3771
3783
 
3772
3784
  if (!(!ctx.input && is.Undef(prop["native"])) && prop["native"] !== true) {
3785
+ _this4.fc.targetFormDriver('updateWrap', ctx);
3786
+
3773
3787
  _vn = _this4.$manager.makeWrap(ctx, _vn);
3774
3788
  }
3775
3789
 
@@ -4143,12 +4157,14 @@
4143
4157
  return event;
4144
4158
  },
4145
4159
  getInjectData: function getInjectData(self, inject) {
4146
- var _this$vm$props = this.vm.props,
4147
- option = _this$vm$props.option,
4148
- rule = _this$vm$props.rule;
4160
+ var $api = self.__fc__ && self.__fc__.$api;
4161
+ var vm = self.__fc__ && self.__fc__.$handle.vm || this.vm.props;
4162
+ var _vm$props = vm.props,
4163
+ option = _vm$props.option,
4164
+ rule = _vm$props.rule;
4149
4165
  return {
4150
- $f: this.api,
4151
- api: this.api,
4166
+ $f: $api || this.api,
4167
+ api: $api || this.api,
4152
4168
  rule: rule,
4153
4169
  self: self.__origin__,
4154
4170
  option: option,
@@ -4780,6 +4796,11 @@
4780
4796
  return !!(rule.field && _this6.fieldCtx[rule.field] && _this6.fieldCtx[rule.field][0] !== _rule.__fc__);
4781
4797
  };
4782
4798
 
4799
+ _this6.fc.targetFormDriver('loadRule', {
4800
+ rule: rule,
4801
+ api: _this6.api
4802
+ }, _this6.fc);
4803
+
4783
4804
  _this6.ruleEffect(rule, 'init', {
4784
4805
  repeat: isRepeat()
4785
4806
  });
@@ -4825,10 +4846,10 @@
4825
4846
  } else {
4826
4847
  if (ctx.originType !== ctx.rule.type) {
4827
4848
  ctx.updateType();
4828
-
4829
- _this6.bindParser(ctx);
4830
4849
  }
4831
4850
 
4851
+ _this6.bindParser(ctx);
4852
+
4832
4853
  _this6.appendValue(ctx.rule);
4833
4854
 
4834
4855
  if (ctx.parent && ctx.parent !== parent) {
@@ -5656,6 +5677,7 @@
5656
5677
  }
5657
5678
  },
5658
5679
  lifecycle: function lifecycle(name) {
5680
+ this.fc.targetFormDriver(name, this.api, this.fc);
5659
5681
  this.vm.emit(name, this.api);
5660
5682
  this.emitEvent(name, this.api);
5661
5683
  },
@@ -6108,17 +6130,10 @@
6108
6130
  }), opt, this.mergeOptionsRule);
6109
6131
  },
6110
6132
  updateOptions: function updateOptions(options) {
6111
- var _this3 = this;
6112
-
6113
- if (this.$handle.fc.renderDriver && this.$handle.fc.renderDriver.updateOptions) {
6114
- invoke(function () {
6115
- _this3.$handle.fc.renderDriver.updateOptions(options, {
6116
- handle: _this3.$handle,
6117
- api: _this3.$handle.api
6118
- });
6119
- });
6120
- }
6121
-
6133
+ this.$handle.fc.targetFormDriver('updateOptions', options, {
6134
+ handle: this.$handle,
6135
+ api: this.$handle.api
6136
+ });
6122
6137
  this.options = this.mergeOptions([options], this.getDefaultOptions());
6123
6138
  this.update();
6124
6139
  },
@@ -6828,14 +6843,39 @@
6828
6843
  }));
6829
6844
  }
6830
6845
 
6831
- var driver = this.vm.setupState.parent ? this.vm.setupState.parent.setupState.fc.renderDriver : this.vm.props.driver;
6832
- this.renderDriver = this.drivers[driver];
6846
+ if (this.vm.props.driver) {
6847
+ this.renderDriver = this.drivers[this.vm.props.driver];
6848
+ }
6849
+
6850
+ if (!this.renderDriver && this.vm.setupState.parent) {
6851
+ this.renderDriver = this.vm.setupState.parent.setupState.fc.renderDriver;
6852
+ }
6853
+
6854
+ if (!this.renderDriver) {
6855
+ this.renderDriver = this.drivers["default"];
6856
+ }
6857
+
6833
6858
  this.initOptions();
6834
6859
  this.$handle.init();
6835
6860
  },
6836
- globalDataDriver: function globalDataDriver(id) {
6861
+ targetFormDriver: function targetFormDriver(method) {
6837
6862
  var _this3 = this;
6838
6863
 
6864
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
6865
+ args[_key2 - 1] = arguments[_key2];
6866
+ }
6867
+
6868
+ if (this.renderDriver && this.renderDriver[method]) {
6869
+ return invoke(function () {
6870
+ var _this3$renderDriver;
6871
+
6872
+ return (_this3$renderDriver = _this3.renderDriver)[method].apply(_this3$renderDriver, args);
6873
+ });
6874
+ }
6875
+ },
6876
+ globalDataDriver: function globalDataDriver(id) {
6877
+ var _this4 = this;
6878
+
6839
6879
  var split = id.split('.');
6840
6880
  var key = split.shift();
6841
6881
  var option = this.options.value.globalData && this.options.value.globalData[key];
@@ -6867,28 +6907,28 @@
6867
6907
  var reload = debounce(function () {
6868
6908
  unwatch();
6869
6909
 
6870
- var res = _this3.fetchCache.get(option);
6910
+ var res = _this4.fetchCache.get(option);
6871
6911
 
6872
- if (_this3.options.value.globalData && Object.values(_this3.options.value.globalData).indexOf(option) !== -1) {
6912
+ if (_this4.options.value.globalData && Object.values(_this4.options.value.globalData).indexOf(option) !== -1) {
6873
6913
  if (res) {
6874
6914
  res.loading = true;
6875
6915
 
6876
- _this3.fetchCache.set(option, res);
6916
+ _this4.fetchCache.set(option, res);
6877
6917
  }
6878
6918
 
6879
- _this3.bus.$emit('$loadData.$globalData.' + key);
6919
+ _this4.bus.$emit('$loadData.$globalData.' + key);
6880
6920
  } else {
6881
- _this3.fetchCache["delete"](option);
6921
+ _this4.fetchCache["delete"](option);
6882
6922
  }
6883
6923
  }, option.wait || 600);
6884
6924
 
6885
6925
  var _emit = function _emit(data) {
6886
- _this3.fetchCache.set(option, {
6926
+ _this4.fetchCache.set(option, {
6887
6927
  status: true,
6888
6928
  data: data
6889
6929
  });
6890
6930
 
6891
- _this3.bus.$emit('$loadData.$globalData.' + key);
6931
+ _this4.bus.$emit('$loadData.$globalData.' + key);
6892
6932
  };
6893
6933
 
6894
6934
  var callback = function callback(get, change) {
@@ -6901,9 +6941,9 @@
6901
6941
  return;
6902
6942
  }
6903
6943
 
6904
- var options = _this3.$handle.loadFetchVar(copy$1(option), get);
6944
+ var options = _this4.$handle.loadFetchVar(copy$1(option), get);
6905
6945
 
6906
- _this3.$handle.api.fetch(options).then(function (res) {
6946
+ _this4.$handle.api.fetch(options).then(function (res) {
6907
6947
  _emit(res);
6908
6948
  })["catch"](function (e) {
6909
6949
  _emit(null);
@@ -6917,7 +6957,7 @@
6917
6957
  }
6918
6958
  },
6919
6959
  globalVarDriver: function globalVarDriver(id) {
6920
- var _this4 = this;
6960
+ var _this5 = this;
6921
6961
 
6922
6962
  var split = id.split('.');
6923
6963
  var key = split.shift();
@@ -6932,11 +6972,11 @@
6932
6972
  if (change) {
6933
6973
  unwatch();
6934
6974
 
6935
- _this4.bus.$emit('$loadData.$var.' + key);
6975
+ _this5.bus.$emit('$loadData.$var.' + key);
6936
6976
  }
6937
6977
 
6938
6978
  val = invoke(function () {
6939
- return handle(get, _this4.$handle.api);
6979
+ return handle(get, _this5.$handle.api);
6940
6980
  });
6941
6981
  });
6942
6982
  this.unwatch.push(unwatch);
@@ -6976,7 +7016,7 @@
6976
7016
  return val == null || val === '' ? def : val;
6977
7017
  },
6978
7018
  watchLoadData: function watchLoadData(fn) {
6979
- var _this5 = this;
7019
+ var _this6 = this;
6980
7020
 
6981
7021
  var unwatch = {};
6982
7022
 
@@ -6991,14 +7031,14 @@
6991
7031
  return unwatch[id].val;
6992
7032
  }
6993
7033
 
6994
- var val = _this5.getLoadData(id, def);
7034
+ var val = _this6.getLoadData(id, def);
6995
7035
 
6996
7036
  var split = id.split('.');
6997
7037
  var key = split.shift();
6998
7038
  var key2 = split.shift() || '';
6999
7039
  var callback = debounce(function () {
7000
7040
  if (key !== id) {
7001
- var temp = _this5.getLoadData(id, def);
7041
+ var temp = _this6.getLoadData(id, def);
7002
7042
 
7003
7043
  if (JSON.stringify(temp) !== JSON.stringify(unwatch[id].val)) {
7004
7044
  unwatch[id].val = temp;
@@ -7009,18 +7049,18 @@
7009
7049
  }
7010
7050
  }, 0);
7011
7051
 
7012
- _this5.bus.$on('$loadData.' + key, callback);
7052
+ _this6.bus.$on('$loadData.' + key, callback);
7013
7053
 
7014
7054
  if (key2) {
7015
- _this5.bus.$on('$loadData.' + key + '.' + key2, callback);
7055
+ _this6.bus.$on('$loadData.' + key + '.' + key2, callback);
7016
7056
  }
7017
7057
 
7018
7058
  unwatch[id] = {
7019
7059
  fn: function fn() {
7020
- _this5.bus.$off('$loadData.' + key, callback);
7060
+ _this6.bus.$off('$loadData.' + key, callback);
7021
7061
 
7022
7062
  if (key2) {
7023
- _this5.bus.$off('$loadData.' + key + '.' + key2, callback);
7063
+ _this6.bus.$off('$loadData.' + key + '.' + key2, callback);
7024
7064
  }
7025
7065
  },
7026
7066
  val: val
@@ -7090,7 +7130,7 @@
7090
7130
  this.$handle.mounted();
7091
7131
  },
7092
7132
  unmount: function unmount() {
7093
- var _this6 = this;
7133
+ var _this7 = this;
7094
7134
 
7095
7135
  if (this.name) {
7096
7136
  if (this.inFor) {
@@ -7102,7 +7142,7 @@
7102
7142
  }
7103
7143
 
7104
7144
  listener.forEach(function (item) {
7105
- _this6.bus.$off(item.name, item.callback);
7145
+ _this7.bus.$off(item.name, item.callback);
7106
7146
  });
7107
7147
  this.unwatch.forEach(function (fn) {
7108
7148
  return fn();
@@ -7111,10 +7151,10 @@
7111
7151
  this.$handle.reloadRule([]);
7112
7152
  },
7113
7153
  updated: function updated() {
7114
- var _this7 = this;
7154
+ var _this8 = this;
7115
7155
 
7116
7156
  this.$handle.bindNextTick(function () {
7117
- return _this7.bus.$emit('next-tick', _this7.$handle.api);
7157
+ return _this8.bus.$emit('next-tick', _this8.$handle.api);
7118
7158
  });
7119
7159
  }
7120
7160
  });
@@ -8106,7 +8146,7 @@
8106
8146
  function elmFormCreate() {
8107
8147
  return FormCreateFactory({
8108
8148
  ui: 'element-ui',
8109
- version: '3.2.5',
8149
+ version: '3.2.6',
8110
8150
  manager: manager,
8111
8151
  extendApi: extendApi,
8112
8152
  install: install,