@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.
@@ -3877,6 +3877,11 @@
3877
3877
  (_h$vm = h.vm).emit.apply(_h$vm, [name].concat(args));
3878
3878
  },
3879
3879
  bus: h.bus,
3880
+ getCurrentFormRule: function getCurrentFormRule() {
3881
+ var _h$vm$setupState$getG;
3882
+
3883
+ return (_h$vm$setupState$getG = h.vm.setupState.getGroupInject()) === null || _h$vm$setupState$getG === void 0 ? void 0 : _h$vm$setupState$getG.rule;
3884
+ },
3880
3885
  fetch: function fetch(opt) {
3881
3886
  return new Promise(function (resolve, reject) {
3882
3887
  opt = deepCopy(opt);
@@ -4554,7 +4559,7 @@
4554
4559
  fc: handle.fc,
4555
4560
  vm: handle.vm,
4556
4561
  $manager: handle.$manager,
4557
- vNode: new handle.fc.CreateNode(handle.vm),
4562
+ vNode: new handle.fc.CreateNode(handle),
4558
4563
  force: false,
4559
4564
  tmpInput: null,
4560
4565
  id: id$1++
@@ -6217,7 +6222,7 @@
6217
6222
 
6218
6223
  var value = _this.compute(ctx, item);
6219
6224
 
6220
- if (item.linkage && value === oldValueTag) {
6225
+ if ((item.linkage || item.linkageVariable) && value === oldValueTag) {
6221
6226
  return oldValueTag;
6222
6227
  }
6223
6228
 
@@ -6564,7 +6569,7 @@
6564
6569
  var field = null;
6565
6570
 
6566
6571
  if (one.variable) {
6567
- field = JSON.stringify(_this4.fc.getLoadData(one.variable) || '');
6572
+ field = JSON.stringify(_this4.fc.getLoadData(one.variable)) || '';
6568
6573
  } else if (one.field) {
6569
6574
  field = convertFieldToConditions(one.field || '');
6570
6575
  } else if (!one.mode) {
@@ -6620,6 +6625,10 @@
6620
6625
  return val ? invoke(function () {
6621
6626
  return _this4.computeValue(item.linkage, ctx, group);
6622
6627
  }, undefined) : oldValueTag;
6628
+ } else if (item.linkageVariable) {
6629
+ return val ? invoke(function () {
6630
+ return _this4.fc.getLoadData(item.linkageVariable);
6631
+ }, undefined) : oldValueTag;
6623
6632
  }
6624
6633
 
6625
6634
  return val;
@@ -6845,12 +6854,12 @@
6845
6854
 
6846
6855
  prop._c = getComponent(prop);
6847
6856
 
6848
- _this.onEffect(prop);
6857
+ _this.onEffect(prop, k);
6849
6858
 
6850
6859
  _this.providers[k] = prop;
6851
6860
  });
6852
6861
  },
6853
- onEffect: function onEffect(provider) {
6862
+ onEffect: function onEffect(provider, key) {
6854
6863
  var _this2 = this;
6855
6864
 
6856
6865
  var used = [];
@@ -6859,7 +6868,7 @@
6859
6868
  if (used.indexOf(type) > -1) return;
6860
6869
  used.push(type);
6861
6870
 
6862
- _this2.bus.$on("p:".concat(provider.name, ":").concat(type, ":").concat(provider.input ? 1 : 0), function (event, args) {
6871
+ _this2.bus.$on("p:".concat(key || provider.name, ":").concat(type, ":").concat(provider.input ? 1 : 0), function (event, args) {
6863
6872
  provider[event] && provider[event].apply(provider, _toConsumableArray(args));
6864
6873
  });
6865
6874
  });
@@ -7185,8 +7194,9 @@
7185
7194
  function CreateNodeFactory() {
7186
7195
  var aliasMap = {};
7187
7196
 
7188
- function CreateNode(vm) {
7189
- this.vm = vm;
7197
+ function CreateNode(handle) {
7198
+ this.vm = handle.vm;
7199
+ this.handle = handle;
7190
7200
  }
7191
7201
 
7192
7202
  extend(CreateNode.prototype, {
@@ -7204,13 +7214,14 @@
7204
7214
  h: function h(tag, data, children) {
7205
7215
  var vm = this.vm || vue.getCurrentInstance();
7206
7216
  var isNativeTag = vm.appContext.config.isNativeTag(tag);
7217
+ var component = this.handle.fc.prop.components[tag];
7207
7218
 
7208
- if (isNativeTag) {
7219
+ if (!component && isNativeTag) {
7209
7220
  delete data.formCreateInject;
7210
7221
  }
7211
7222
 
7212
7223
  try {
7213
- return vue.createVNode(isNativeTag ? tag : vue.resolveComponent(tag), data, children);
7224
+ return vue.createVNode(component || (isNativeTag ? tag : vue.resolveComponent(tag)), data, children);
7214
7225
  } catch (e) {
7215
7226
  console.error(e);
7216
7227
  return vue.createVNode('');
@@ -7228,11 +7239,10 @@
7228
7239
  var line = toLine(k);
7229
7240
  var lower = toString(k).toLocaleLowerCase();
7230
7241
  var v = nodes[k];
7242
+ CreateNode.alias(k, v);
7231
7243
  [k, line, lower].forEach(function (n) {
7232
- CreateNode.alias(k, v);
7233
-
7234
7244
  CreateNode.prototype[n] = function (data, children) {
7235
- return this.make(v, data, children);
7245
+ return this.make(aliasMap[k] || n, data, children);
7236
7246
  };
7237
7247
  });
7238
7248
  });
@@ -7595,22 +7605,6 @@
7595
7605
  option.to = 'options';
7596
7606
  }
7597
7607
 
7598
- if (option.key) {
7599
- var item = fc.$handle.options.globalData[option.key];
7600
-
7601
- if (!item) {
7602
- set(undefined);
7603
- return;
7604
- }
7605
-
7606
- if (item.type === 'static') {
7607
- set(item.data);
7608
- return;
7609
- } else {
7610
- option = _objectSpread2(_objectSpread2({}, option), item);
7611
- }
7612
- }
7613
-
7614
7608
  var _onError = option.onError;
7615
7609
 
7616
7610
  var check = function check() {
@@ -7626,6 +7620,17 @@
7626
7620
  return fetchAttr._fn[inject.id]();
7627
7621
  }
7628
7622
 
7623
+ if (option.key) {
7624
+ var res = get('$globalData.' + option.key);
7625
+
7626
+ if (res) {
7627
+ if (check()) return;
7628
+ set(res);
7629
+ }
7630
+
7631
+ return;
7632
+ }
7633
+
7629
7634
  var _option = fc.$handle.loadFetchVar(deepCopy(option), get, rule);
7630
7635
 
7631
7636
  var config = _objectSpread2(_objectSpread2({
@@ -8251,12 +8256,15 @@
8251
8256
  this.$handle.init();
8252
8257
  },
8253
8258
  targetFormDriver: function targetFormDriver(method) {
8254
- var _this3 = this;
8259
+ var _this$bus,
8260
+ _this3 = this;
8255
8261
 
8256
8262
  for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
8257
8263
  args[_key2 - 1] = arguments[_key2];
8258
8264
  }
8259
8265
 
8266
+ (_this$bus = this.bus).$emit.apply(_this$bus, [method].concat(args));
8267
+
8260
8268
  if (this.renderDriver && this.renderDriver[method]) {
8261
8269
  return invoke(function () {
8262
8270
  var _this3$renderDriver;
@@ -8359,6 +8367,11 @@
8359
8367
  };
8360
8368
 
8361
8369
  var unwatch = this.watchLoadData(callback);
8370
+
8371
+ if (option.watch === false) {
8372
+ unwatch();
8373
+ }
8374
+
8362
8375
  this.unwatch.push(unwatch);
8363
8376
  return val;
8364
8377
  }
@@ -8576,11 +8589,18 @@
8576
8589
  globalData: {}
8577
8590
  }, deepCopy(globalConfig));
8578
8591
 
8579
- if (this.isSub()) {
8592
+ var isSubForm = this.isSub();
8593
+
8594
+ if (isSubForm) {
8580
8595
  options = this.mergeOptions(options, this.vm.setupState.parent.setupState.fc.options.value || {}, true);
8581
8596
  }
8582
8597
 
8583
8598
  options = this.mergeOptions(options, this.vm.props.option);
8599
+ var api = this.api();
8600
+ this.targetFormDriver('initOptions', options, {
8601
+ api: api,
8602
+ isSubForm: isSubForm
8603
+ });
8584
8604
  this.updateOptions(options);
8585
8605
  },
8586
8606
  mergeOptions: function mergeOptions(target, opt, parent) {
@@ -9674,7 +9694,7 @@
9674
9694
  function elmFormCreate() {
9675
9695
  return FormCreateFactory({
9676
9696
  ui: 'element-ui',
9677
- version: '3.2.28',
9697
+ version: '3.2.29',
9678
9698
  manager: manager,
9679
9699
  extendApi: extendApi,
9680
9700
  install: install,