@form-create/element-ui 3.2.28 → 3.2.29

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.28
2
+ * @form-create/element-ui v3.2.29
3
3
  * (c) 2018-2025 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
@@ -3873,6 +3873,11 @@ function Api(h) {
3873
3873
  (_h$vm = h.vm).emit.apply(_h$vm, [name].concat(args));
3874
3874
  },
3875
3875
  bus: h.bus,
3876
+ getCurrentFormRule: function getCurrentFormRule() {
3877
+ var _h$vm$setupState$getG;
3878
+
3879
+ return (_h$vm$setupState$getG = h.vm.setupState.getGroupInject()) === null || _h$vm$setupState$getG === void 0 ? void 0 : _h$vm$setupState$getG.rule;
3880
+ },
3876
3881
  fetch: function fetch(opt) {
3877
3882
  return new Promise(function (resolve, reject) {
3878
3883
  opt = deepCopy(opt);
@@ -4550,7 +4555,7 @@ function Render(handle) {
4550
4555
  fc: handle.fc,
4551
4556
  vm: handle.vm,
4552
4557
  $manager: handle.$manager,
4553
- vNode: new handle.fc.CreateNode(handle.vm),
4558
+ vNode: new handle.fc.CreateNode(handle),
4554
4559
  force: false,
4555
4560
  tmpInput: null,
4556
4561
  id: id$1++
@@ -6213,7 +6218,7 @@ function useContext(Handler) {
6213
6218
 
6214
6219
  var value = _this.compute(ctx, item);
6215
6220
 
6216
- if (item.linkage && value === oldValueTag) {
6221
+ if ((item.linkage || item.linkageVariable) && value === oldValueTag) {
6217
6222
  return oldValueTag;
6218
6223
  }
6219
6224
 
@@ -6560,7 +6565,7 @@ function useContext(Handler) {
6560
6565
  var field = null;
6561
6566
 
6562
6567
  if (one.variable) {
6563
- field = JSON.stringify(_this4.fc.getLoadData(one.variable) || '');
6568
+ field = JSON.stringify(_this4.fc.getLoadData(one.variable)) || '';
6564
6569
  } else if (one.field) {
6565
6570
  field = convertFieldToConditions(one.field || '');
6566
6571
  } else if (!one.mode) {
@@ -6616,6 +6621,10 @@ function useContext(Handler) {
6616
6621
  return val ? invoke(function () {
6617
6622
  return _this4.computeValue(item.linkage, ctx, group);
6618
6623
  }, undefined) : oldValueTag;
6624
+ } else if (item.linkageVariable) {
6625
+ return val ? invoke(function () {
6626
+ return _this4.fc.getLoadData(item.linkageVariable);
6627
+ }, undefined) : oldValueTag;
6619
6628
  }
6620
6629
 
6621
6630
  return val;
@@ -6841,12 +6850,12 @@ function useEffect(Handler) {
6841
6850
 
6842
6851
  prop._c = getComponent(prop);
6843
6852
 
6844
- _this.onEffect(prop);
6853
+ _this.onEffect(prop, k);
6845
6854
 
6846
6855
  _this.providers[k] = prop;
6847
6856
  });
6848
6857
  },
6849
- onEffect: function onEffect(provider) {
6858
+ onEffect: function onEffect(provider, key) {
6850
6859
  var _this2 = this;
6851
6860
 
6852
6861
  var used = [];
@@ -6855,7 +6864,7 @@ function useEffect(Handler) {
6855
6864
  if (used.indexOf(type) > -1) return;
6856
6865
  used.push(type);
6857
6866
 
6858
- _this2.bus.$on("p:".concat(provider.name, ":").concat(type, ":").concat(provider.input ? 1 : 0), function (event, args) {
6867
+ _this2.bus.$on("p:".concat(key || provider.name, ":").concat(type, ":").concat(provider.input ? 1 : 0), function (event, args) {
6859
6868
  provider[event] && provider[event].apply(provider, _toConsumableArray(args));
6860
6869
  });
6861
6870
  });
@@ -7181,8 +7190,9 @@ function makeDirective(data, vn) {
7181
7190
  function CreateNodeFactory() {
7182
7191
  var aliasMap = {};
7183
7192
 
7184
- function CreateNode(vm) {
7185
- this.vm = vm;
7193
+ function CreateNode(handle) {
7194
+ this.vm = handle.vm;
7195
+ this.handle = handle;
7186
7196
  }
7187
7197
 
7188
7198
  extend(CreateNode.prototype, {
@@ -7200,13 +7210,14 @@ function CreateNodeFactory() {
7200
7210
  h: function h(tag, data, children) {
7201
7211
  var vm = this.vm || getCurrentInstance();
7202
7212
  var isNativeTag = vm.appContext.config.isNativeTag(tag);
7213
+ var component = this.handle.fc.prop.components[tag];
7203
7214
 
7204
- if (isNativeTag) {
7215
+ if (!component && isNativeTag) {
7205
7216
  delete data.formCreateInject;
7206
7217
  }
7207
7218
 
7208
7219
  try {
7209
- return createVNode(isNativeTag ? tag : resolveComponent(tag), data, children);
7220
+ return createVNode(component || (isNativeTag ? tag : resolveComponent(tag)), data, children);
7210
7221
  } catch (e) {
7211
7222
  console.error(e);
7212
7223
  return createVNode('');
@@ -7224,11 +7235,10 @@ function CreateNodeFactory() {
7224
7235
  var line = toLine(k);
7225
7236
  var lower = toString(k).toLocaleLowerCase();
7226
7237
  var v = nodes[k];
7238
+ CreateNode.alias(k, v);
7227
7239
  [k, line, lower].forEach(function (n) {
7228
- CreateNode.alias(k, v);
7229
-
7230
7240
  CreateNode.prototype[n] = function (data, children) {
7231
- return this.make(v, data, children);
7241
+ return this.make(aliasMap[k] || n, data, children);
7232
7242
  };
7233
7243
  });
7234
7244
  });
@@ -7591,22 +7601,6 @@ var fetch = function fetch(fc) {
7591
7601
  option.to = 'options';
7592
7602
  }
7593
7603
 
7594
- if (option.key) {
7595
- var item = fc.$handle.options.globalData[option.key];
7596
-
7597
- if (!item) {
7598
- set(undefined);
7599
- return;
7600
- }
7601
-
7602
- if (item.type === 'static') {
7603
- set(item.data);
7604
- return;
7605
- } else {
7606
- option = _objectSpread2(_objectSpread2({}, option), item);
7607
- }
7608
- }
7609
-
7610
7604
  var _onError = option.onError;
7611
7605
 
7612
7606
  var check = function check() {
@@ -7622,6 +7616,17 @@ var fetch = function fetch(fc) {
7622
7616
  return fetchAttr._fn[inject.id]();
7623
7617
  }
7624
7618
 
7619
+ if (option.key) {
7620
+ var res = get('$globalData.' + option.key);
7621
+
7622
+ if (res) {
7623
+ if (check()) return;
7624
+ set(res);
7625
+ }
7626
+
7627
+ return;
7628
+ }
7629
+
7625
7630
  var _option = fc.$handle.loadFetchVar(deepCopy(option), get, rule);
7626
7631
 
7627
7632
  var config = _objectSpread2(_objectSpread2({
@@ -8247,12 +8252,15 @@ function FormCreateFactory(config) {
8247
8252
  this.$handle.init();
8248
8253
  },
8249
8254
  targetFormDriver: function targetFormDriver(method) {
8250
- var _this3 = this;
8255
+ var _this$bus,
8256
+ _this3 = this;
8251
8257
 
8252
8258
  for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
8253
8259
  args[_key2 - 1] = arguments[_key2];
8254
8260
  }
8255
8261
 
8262
+ (_this$bus = this.bus).$emit.apply(_this$bus, [method].concat(args));
8263
+
8256
8264
  if (this.renderDriver && this.renderDriver[method]) {
8257
8265
  return invoke(function () {
8258
8266
  var _this3$renderDriver;
@@ -8355,6 +8363,11 @@ function FormCreateFactory(config) {
8355
8363
  };
8356
8364
 
8357
8365
  var unwatch = this.watchLoadData(callback);
8366
+
8367
+ if (option.watch === false) {
8368
+ unwatch();
8369
+ }
8370
+
8358
8371
  this.unwatch.push(unwatch);
8359
8372
  return val;
8360
8373
  }
@@ -8572,11 +8585,18 @@ function FormCreateFactory(config) {
8572
8585
  globalData: {}
8573
8586
  }, deepCopy(globalConfig));
8574
8587
 
8575
- if (this.isSub()) {
8588
+ var isSubForm = this.isSub();
8589
+
8590
+ if (isSubForm) {
8576
8591
  options = this.mergeOptions(options, this.vm.setupState.parent.setupState.fc.options.value || {}, true);
8577
8592
  }
8578
8593
 
8579
8594
  options = this.mergeOptions(options, this.vm.props.option);
8595
+ var api = this.api();
8596
+ this.targetFormDriver('initOptions', options, {
8597
+ api: api,
8598
+ isSubForm: isSubForm
8599
+ });
8580
8600
  this.updateOptions(options);
8581
8601
  },
8582
8602
  mergeOptions: function mergeOptions(target, opt, parent) {
@@ -9670,7 +9690,7 @@ function install(FormCreate) {
9670
9690
  function elmFormCreate() {
9671
9691
  return FormCreateFactory({
9672
9692
  ui: 'element-ui',
9673
- version: '3.2.28',
9693
+ version: '3.2.29',
9674
9694
  manager: manager,
9675
9695
  extendApi: extendApi,
9676
9696
  install: install,