@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,10 +1,10 @@
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.
6
6
  */
7
- import { defineComponent, toRef, ref, watch, createVNode, resolveComponent, mergeProps as mergeProps$1, openBlock, createElementBlock, createElementVNode, isVNode, nextTick, Fragment, markRaw, reactive, getCurrentInstance, provide, inject, toRefs, onBeforeMount, onMounted, onBeforeUnmount, onUpdated, computed, withDirectives, resolveDirective, createApp, h } from 'vue';
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.previewImage = file.url;
1372
- this.previewVisible = true;
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(Fragment, null, [createVNode(resolveComponent("ElUpload"), mergeProps$1({
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 [((_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)) || createVNode(resolveComponent("ElIcon"), null, {
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 _this$vm$props = this.vm.props,
4143
- option = _this$vm$props.option,
4144
- rule = _this$vm$props.rule;
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) {
@@ -5652,6 +5673,7 @@ function useLifecycle(Handler) {
5652
5673
  }
5653
5674
  },
5654
5675
  lifecycle: function lifecycle(name) {
5676
+ this.fc.targetFormDriver(name, this.api, this.fc);
5655
5677
  this.vm.emit(name, this.api);
5656
5678
  this.emitEvent(name, this.api);
5657
5679
  },
@@ -6104,17 +6126,10 @@ extend(Manager.prototype, {
6104
6126
  }), opt, this.mergeOptionsRule);
6105
6127
  },
6106
6128
  updateOptions: function updateOptions(options) {
6107
- var _this3 = this;
6108
-
6109
- if (this.$handle.fc.renderDriver && this.$handle.fc.renderDriver.updateOptions) {
6110
- invoke(function () {
6111
- _this3.$handle.fc.renderDriver.updateOptions(options, {
6112
- handle: _this3.$handle,
6113
- api: _this3.$handle.api
6114
- });
6115
- });
6116
- }
6117
-
6129
+ this.$handle.fc.targetFormDriver('updateOptions', options, {
6130
+ handle: this.$handle,
6131
+ api: this.$handle.api
6132
+ });
6118
6133
  this.options = this.mergeOptions([options], this.getDefaultOptions());
6119
6134
  this.update();
6120
6135
  },
@@ -6824,14 +6839,39 @@ function FormCreateFactory(config) {
6824
6839
  }));
6825
6840
  }
6826
6841
 
6827
- var driver = this.vm.setupState.parent ? this.vm.setupState.parent.setupState.fc.renderDriver : this.vm.props.driver;
6828
- this.renderDriver = this.drivers[driver];
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
+
6829
6854
  this.initOptions();
6830
6855
  this.$handle.init();
6831
6856
  },
6832
- globalDataDriver: function globalDataDriver(id) {
6857
+ targetFormDriver: function targetFormDriver(method) {
6833
6858
  var _this3 = this;
6834
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
+
6835
6875
  var split = id.split('.');
6836
6876
  var key = split.shift();
6837
6877
  var option = this.options.value.globalData && this.options.value.globalData[key];
@@ -6863,28 +6903,28 @@ function FormCreateFactory(config) {
6863
6903
  var reload = debounce(function () {
6864
6904
  unwatch();
6865
6905
 
6866
- var res = _this3.fetchCache.get(option);
6906
+ var res = _this4.fetchCache.get(option);
6867
6907
 
6868
- if (_this3.options.value.globalData && Object.values(_this3.options.value.globalData).indexOf(option) !== -1) {
6908
+ if (_this4.options.value.globalData && Object.values(_this4.options.value.globalData).indexOf(option) !== -1) {
6869
6909
  if (res) {
6870
6910
  res.loading = true;
6871
6911
 
6872
- _this3.fetchCache.set(option, res);
6912
+ _this4.fetchCache.set(option, res);
6873
6913
  }
6874
6914
 
6875
- _this3.bus.$emit('$loadData.$globalData.' + key);
6915
+ _this4.bus.$emit('$loadData.$globalData.' + key);
6876
6916
  } else {
6877
- _this3.fetchCache["delete"](option);
6917
+ _this4.fetchCache["delete"](option);
6878
6918
  }
6879
6919
  }, option.wait || 600);
6880
6920
 
6881
6921
  var _emit = function _emit(data) {
6882
- _this3.fetchCache.set(option, {
6922
+ _this4.fetchCache.set(option, {
6883
6923
  status: true,
6884
6924
  data: data
6885
6925
  });
6886
6926
 
6887
- _this3.bus.$emit('$loadData.$globalData.' + key);
6927
+ _this4.bus.$emit('$loadData.$globalData.' + key);
6888
6928
  };
6889
6929
 
6890
6930
  var callback = function callback(get, change) {
@@ -6897,9 +6937,9 @@ function FormCreateFactory(config) {
6897
6937
  return;
6898
6938
  }
6899
6939
 
6900
- var options = _this3.$handle.loadFetchVar(copy$1(option), get);
6940
+ var options = _this4.$handle.loadFetchVar(copy$1(option), get);
6901
6941
 
6902
- _this3.$handle.api.fetch(options).then(function (res) {
6942
+ _this4.$handle.api.fetch(options).then(function (res) {
6903
6943
  _emit(res);
6904
6944
  })["catch"](function (e) {
6905
6945
  _emit(null);
@@ -6913,7 +6953,7 @@ function FormCreateFactory(config) {
6913
6953
  }
6914
6954
  },
6915
6955
  globalVarDriver: function globalVarDriver(id) {
6916
- var _this4 = this;
6956
+ var _this5 = this;
6917
6957
 
6918
6958
  var split = id.split('.');
6919
6959
  var key = split.shift();
@@ -6928,11 +6968,11 @@ function FormCreateFactory(config) {
6928
6968
  if (change) {
6929
6969
  unwatch();
6930
6970
 
6931
- _this4.bus.$emit('$loadData.$var.' + key);
6971
+ _this5.bus.$emit('$loadData.$var.' + key);
6932
6972
  }
6933
6973
 
6934
6974
  val = invoke(function () {
6935
- return handle(get, _this4.$handle.api);
6975
+ return handle(get, _this5.$handle.api);
6936
6976
  });
6937
6977
  });
6938
6978
  this.unwatch.push(unwatch);
@@ -6972,7 +7012,7 @@ function FormCreateFactory(config) {
6972
7012
  return val == null || val === '' ? def : val;
6973
7013
  },
6974
7014
  watchLoadData: function watchLoadData(fn) {
6975
- var _this5 = this;
7015
+ var _this6 = this;
6976
7016
 
6977
7017
  var unwatch = {};
6978
7018
 
@@ -6987,14 +7027,14 @@ function FormCreateFactory(config) {
6987
7027
  return unwatch[id].val;
6988
7028
  }
6989
7029
 
6990
- var val = _this5.getLoadData(id, def);
7030
+ var val = _this6.getLoadData(id, def);
6991
7031
 
6992
7032
  var split = id.split('.');
6993
7033
  var key = split.shift();
6994
7034
  var key2 = split.shift() || '';
6995
7035
  var callback = debounce(function () {
6996
7036
  if (key !== id) {
6997
- var temp = _this5.getLoadData(id, def);
7037
+ var temp = _this6.getLoadData(id, def);
6998
7038
 
6999
7039
  if (JSON.stringify(temp) !== JSON.stringify(unwatch[id].val)) {
7000
7040
  unwatch[id].val = temp;
@@ -7005,18 +7045,18 @@ function FormCreateFactory(config) {
7005
7045
  }
7006
7046
  }, 0);
7007
7047
 
7008
- _this5.bus.$on('$loadData.' + key, callback);
7048
+ _this6.bus.$on('$loadData.' + key, callback);
7009
7049
 
7010
7050
  if (key2) {
7011
- _this5.bus.$on('$loadData.' + key + '.' + key2, callback);
7051
+ _this6.bus.$on('$loadData.' + key + '.' + key2, callback);
7012
7052
  }
7013
7053
 
7014
7054
  unwatch[id] = {
7015
7055
  fn: function fn() {
7016
- _this5.bus.$off('$loadData.' + key, callback);
7056
+ _this6.bus.$off('$loadData.' + key, callback);
7017
7057
 
7018
7058
  if (key2) {
7019
- _this5.bus.$off('$loadData.' + key + '.' + key2, callback);
7059
+ _this6.bus.$off('$loadData.' + key + '.' + key2, callback);
7020
7060
  }
7021
7061
  },
7022
7062
  val: val
@@ -7086,7 +7126,7 @@ function FormCreateFactory(config) {
7086
7126
  this.$handle.mounted();
7087
7127
  },
7088
7128
  unmount: function unmount() {
7089
- var _this6 = this;
7129
+ var _this7 = this;
7090
7130
 
7091
7131
  if (this.name) {
7092
7132
  if (this.inFor) {
@@ -7098,7 +7138,7 @@ function FormCreateFactory(config) {
7098
7138
  }
7099
7139
 
7100
7140
  listener.forEach(function (item) {
7101
- _this6.bus.$off(item.name, item.callback);
7141
+ _this7.bus.$off(item.name, item.callback);
7102
7142
  });
7103
7143
  this.unwatch.forEach(function (fn) {
7104
7144
  return fn();
@@ -7107,10 +7147,10 @@ function FormCreateFactory(config) {
7107
7147
  this.$handle.reloadRule([]);
7108
7148
  },
7109
7149
  updated: function updated() {
7110
- var _this7 = this;
7150
+ var _this8 = this;
7111
7151
 
7112
7152
  this.$handle.bindNextTick(function () {
7113
- return _this7.bus.$emit('next-tick', _this7.$handle.api);
7153
+ return _this8.bus.$emit('next-tick', _this8.$handle.api);
7114
7154
  });
7115
7155
  }
7116
7156
  });
@@ -8102,7 +8142,7 @@ function install(FormCreate) {
8102
8142
  function elmFormCreate() {
8103
8143
  return FormCreateFactory({
8104
8144
  ui: 'element-ui',
8105
- version: '3.2.5',
8145
+ version: '3.2.6',
8106
8146
  manager: manager,
8107
8147
  extendApi: extendApi,
8108
8148
  install: install,