@form-create/element-ui 3.2.28 → 3.2.30

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.30
3
3
  * (c) 2018-2025 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
@@ -3201,7 +3201,7 @@
3201
3201
  };
3202
3202
  }
3203
3203
 
3204
- resolve(fn(res, undefined, api));
3204
+ resolve(fn(res, config.targetRule, api));
3205
3205
  },
3206
3206
  onError: function onError(err) {
3207
3207
  reject(err);
@@ -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,19 @@
7626
7620
  return fetchAttr._fn[inject.id]();
7627
7621
  }
7628
7622
 
7623
+ if (option.key) {
7624
+ fc.targetRule = rule;
7625
+ var res = get('$globalData.' + option.key);
7626
+ delete fc.targetRule;
7627
+
7628
+ if (res) {
7629
+ if (check()) return;
7630
+ set(res);
7631
+ }
7632
+
7633
+ return;
7634
+ }
7635
+
7629
7636
  var _option = fc.$handle.loadFetchVar(deepCopy(option), get, rule);
7630
7637
 
7631
7638
  var config = _objectSpread2(_objectSpread2({
@@ -8251,12 +8258,15 @@
8251
8258
  this.$handle.init();
8252
8259
  },
8253
8260
  targetFormDriver: function targetFormDriver(method) {
8254
- var _this3 = this;
8261
+ var _this$bus,
8262
+ _this3 = this;
8255
8263
 
8256
8264
  for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
8257
8265
  args[_key2 - 1] = arguments[_key2];
8258
8266
  }
8259
8267
 
8268
+ (_this$bus = this.bus).$emit.apply(_this$bus, [method].concat(args));
8269
+
8260
8270
  if (this.renderDriver && this.renderDriver[method]) {
8261
8271
  return invoke(function () {
8262
8272
  var _this3$renderDriver;
@@ -8351,6 +8361,8 @@
8351
8361
 
8352
8362
  var options = _this4.$handle.loadFetchVar(copy$1(option), get);
8353
8363
 
8364
+ options.targetRule = _this4.targetRule;
8365
+
8354
8366
  _this4.$handle.api.fetch(options).then(function (res) {
8355
8367
  _emit(res);
8356
8368
  })["catch"](function (e) {
@@ -8359,6 +8371,11 @@
8359
8371
  };
8360
8372
 
8361
8373
  var unwatch = this.watchLoadData(callback);
8374
+
8375
+ if (option.watch === false) {
8376
+ unwatch();
8377
+ }
8378
+
8362
8379
  this.unwatch.push(unwatch);
8363
8380
  return val;
8364
8381
  }
@@ -8576,11 +8593,18 @@
8576
8593
  globalData: {}
8577
8594
  }, deepCopy(globalConfig));
8578
8595
 
8579
- if (this.isSub()) {
8596
+ var isSubForm = this.isSub();
8597
+
8598
+ if (isSubForm) {
8580
8599
  options = this.mergeOptions(options, this.vm.setupState.parent.setupState.fc.options.value || {}, true);
8581
8600
  }
8582
8601
 
8583
8602
  options = this.mergeOptions(options, this.vm.props.option);
8603
+ var api = this.api();
8604
+ this.targetFormDriver('initOptions', options, {
8605
+ api: api,
8606
+ isSubForm: isSubForm
8607
+ });
8584
8608
  this.updateOptions(options);
8585
8609
  },
8586
8610
  mergeOptions: function mergeOptions(target, opt, parent) {
@@ -9674,7 +9698,7 @@
9674
9698
  function elmFormCreate() {
9675
9699
  return FormCreateFactory({
9676
9700
  ui: 'element-ui',
9677
- version: '3.2.28',
9701
+ version: '3.2.30',
9678
9702
  manager: manager,
9679
9703
  extendApi: extendApi,
9680
9704
  install: install,