@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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @form-create/element-ui v3.2.4
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) {
@@ -5476,8 +5497,6 @@
5476
5497
  }
5477
5498
 
5478
5499
  Object.keys(computed).forEach(function (k) {
5479
- var _val = deepGet(ctx.rule, k);
5480
-
5481
5500
  ctx.watch.push(vue.watch(function () {
5482
5501
  var item = computed[k];
5483
5502
  if (!item) return undefined;
@@ -5548,7 +5567,7 @@
5548
5567
  }
5549
5568
  });
5550
5569
  }, {
5551
- immediate: _val == null || _val === ''
5570
+ immediate: k === 'value' ? [undefined, null, ''].indexOf(ctx.rule.value) > -1 : true
5552
5571
  }));
5553
5572
  });
5554
5573
  });
@@ -5658,6 +5677,7 @@
5658
5677
  }
5659
5678
  },
5660
5679
  lifecycle: function lifecycle(name) {
5680
+ this.fc.targetFormDriver(name, this.api, this.fc);
5661
5681
  this.vm.emit(name, this.api);
5662
5682
  this.emitEvent(name, this.api);
5663
5683
  },
@@ -6110,17 +6130,10 @@
6110
6130
  }), opt, this.mergeOptionsRule);
6111
6131
  },
6112
6132
  updateOptions: function updateOptions(options) {
6113
- var _this3 = this;
6114
-
6115
- if (this.$handle.fc.renderDriver && this.$handle.fc.renderDriver.updateOptions) {
6116
- invoke(function () {
6117
- _this3.$handle.fc.renderDriver.updateOptions(options, {
6118
- handle: _this3.$handle,
6119
- api: _this3.$handle.api
6120
- });
6121
- });
6122
- }
6123
-
6133
+ this.$handle.fc.targetFormDriver('updateOptions', options, {
6134
+ handle: this.$handle,
6135
+ api: this.$handle.api
6136
+ });
6124
6137
  this.options = this.mergeOptions([options], this.getDefaultOptions());
6125
6138
  this.update();
6126
6139
  },
@@ -6830,14 +6843,39 @@
6830
6843
  }));
6831
6844
  }
6832
6845
 
6833
- var driver = this.vm.setupState.parent ? this.vm.setupState.parent.setupState.fc.renderDriver : this.vm.props.driver;
6834
- 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
+
6835
6858
  this.initOptions();
6836
6859
  this.$handle.init();
6837
6860
  },
6838
- globalDataDriver: function globalDataDriver(id) {
6861
+ targetFormDriver: function targetFormDriver(method) {
6839
6862
  var _this3 = this;
6840
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
+
6841
6879
  var split = id.split('.');
6842
6880
  var key = split.shift();
6843
6881
  var option = this.options.value.globalData && this.options.value.globalData[key];
@@ -6869,28 +6907,28 @@
6869
6907
  var reload = debounce(function () {
6870
6908
  unwatch();
6871
6909
 
6872
- var res = _this3.fetchCache.get(option);
6910
+ var res = _this4.fetchCache.get(option);
6873
6911
 
6874
- 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) {
6875
6913
  if (res) {
6876
6914
  res.loading = true;
6877
6915
 
6878
- _this3.fetchCache.set(option, res);
6916
+ _this4.fetchCache.set(option, res);
6879
6917
  }
6880
6918
 
6881
- _this3.bus.$emit('$loadData.$globalData.' + key);
6919
+ _this4.bus.$emit('$loadData.$globalData.' + key);
6882
6920
  } else {
6883
- _this3.fetchCache["delete"](option);
6921
+ _this4.fetchCache["delete"](option);
6884
6922
  }
6885
6923
  }, option.wait || 600);
6886
6924
 
6887
6925
  var _emit = function _emit(data) {
6888
- _this3.fetchCache.set(option, {
6926
+ _this4.fetchCache.set(option, {
6889
6927
  status: true,
6890
6928
  data: data
6891
6929
  });
6892
6930
 
6893
- _this3.bus.$emit('$loadData.$globalData.' + key);
6931
+ _this4.bus.$emit('$loadData.$globalData.' + key);
6894
6932
  };
6895
6933
 
6896
6934
  var callback = function callback(get, change) {
@@ -6903,9 +6941,9 @@
6903
6941
  return;
6904
6942
  }
6905
6943
 
6906
- var options = _this3.$handle.loadFetchVar(copy$1(option), get);
6944
+ var options = _this4.$handle.loadFetchVar(copy$1(option), get);
6907
6945
 
6908
- _this3.$handle.api.fetch(options).then(function (res) {
6946
+ _this4.$handle.api.fetch(options).then(function (res) {
6909
6947
  _emit(res);
6910
6948
  })["catch"](function (e) {
6911
6949
  _emit(null);
@@ -6919,7 +6957,7 @@
6919
6957
  }
6920
6958
  },
6921
6959
  globalVarDriver: function globalVarDriver(id) {
6922
- var _this4 = this;
6960
+ var _this5 = this;
6923
6961
 
6924
6962
  var split = id.split('.');
6925
6963
  var key = split.shift();
@@ -6934,11 +6972,11 @@
6934
6972
  if (change) {
6935
6973
  unwatch();
6936
6974
 
6937
- _this4.bus.$emit('$loadData.$var.' + key);
6975
+ _this5.bus.$emit('$loadData.$var.' + key);
6938
6976
  }
6939
6977
 
6940
6978
  val = invoke(function () {
6941
- return handle(get, _this4.$handle.api);
6979
+ return handle(get, _this5.$handle.api);
6942
6980
  });
6943
6981
  });
6944
6982
  this.unwatch.push(unwatch);
@@ -6978,7 +7016,7 @@
6978
7016
  return val == null || val === '' ? def : val;
6979
7017
  },
6980
7018
  watchLoadData: function watchLoadData(fn) {
6981
- var _this5 = this;
7019
+ var _this6 = this;
6982
7020
 
6983
7021
  var unwatch = {};
6984
7022
 
@@ -6993,14 +7031,14 @@
6993
7031
  return unwatch[id].val;
6994
7032
  }
6995
7033
 
6996
- var val = _this5.getLoadData(id, def);
7034
+ var val = _this6.getLoadData(id, def);
6997
7035
 
6998
7036
  var split = id.split('.');
6999
7037
  var key = split.shift();
7000
7038
  var key2 = split.shift() || '';
7001
7039
  var callback = debounce(function () {
7002
7040
  if (key !== id) {
7003
- var temp = _this5.getLoadData(id, def);
7041
+ var temp = _this6.getLoadData(id, def);
7004
7042
 
7005
7043
  if (JSON.stringify(temp) !== JSON.stringify(unwatch[id].val)) {
7006
7044
  unwatch[id].val = temp;
@@ -7011,18 +7049,18 @@
7011
7049
  }
7012
7050
  }, 0);
7013
7051
 
7014
- _this5.bus.$on('$loadData.' + key, callback);
7052
+ _this6.bus.$on('$loadData.' + key, callback);
7015
7053
 
7016
7054
  if (key2) {
7017
- _this5.bus.$on('$loadData.' + key + '.' + key2, callback);
7055
+ _this6.bus.$on('$loadData.' + key + '.' + key2, callback);
7018
7056
  }
7019
7057
 
7020
7058
  unwatch[id] = {
7021
7059
  fn: function fn() {
7022
- _this5.bus.$off('$loadData.' + key, callback);
7060
+ _this6.bus.$off('$loadData.' + key, callback);
7023
7061
 
7024
7062
  if (key2) {
7025
- _this5.bus.$off('$loadData.' + key + '.' + key2, callback);
7063
+ _this6.bus.$off('$loadData.' + key + '.' + key2, callback);
7026
7064
  }
7027
7065
  },
7028
7066
  val: val
@@ -7092,7 +7130,7 @@
7092
7130
  this.$handle.mounted();
7093
7131
  },
7094
7132
  unmount: function unmount() {
7095
- var _this6 = this;
7133
+ var _this7 = this;
7096
7134
 
7097
7135
  if (this.name) {
7098
7136
  if (this.inFor) {
@@ -7104,7 +7142,7 @@
7104
7142
  }
7105
7143
 
7106
7144
  listener.forEach(function (item) {
7107
- _this6.bus.$off(item.name, item.callback);
7145
+ _this7.bus.$off(item.name, item.callback);
7108
7146
  });
7109
7147
  this.unwatch.forEach(function (fn) {
7110
7148
  return fn();
@@ -7113,10 +7151,10 @@
7113
7151
  this.$handle.reloadRule([]);
7114
7152
  },
7115
7153
  updated: function updated() {
7116
- var _this7 = this;
7154
+ var _this8 = this;
7117
7155
 
7118
7156
  this.$handle.bindNextTick(function () {
7119
- return _this7.bus.$emit('next-tick', _this7.$handle.api);
7157
+ return _this8.bus.$emit('next-tick', _this8.$handle.api);
7120
7158
  });
7121
7159
  }
7122
7160
  });
@@ -8108,7 +8146,7 @@
8108
8146
  function elmFormCreate() {
8109
8147
  return FormCreateFactory({
8110
8148
  ui: 'element-ui',
8111
- version: '3.2.4',
8149
+ version: '3.2.6',
8112
8150
  manager: manager,
8113
8151
  extendApi: extendApi,
8114
8152
  install: install,