@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.
@@ -3197,7 +3197,7 @@ function asyncFetch(config, _fetch, api) {
3197
3197
  };
3198
3198
  }
3199
3199
 
3200
- resolve(fn(res, undefined, api));
3200
+ resolve(fn(res, config.targetRule, api));
3201
3201
  },
3202
3202
  onError: function onError(err) {
3203
3203
  reject(err);
@@ -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,19 @@ var fetch = function fetch(fc) {
7622
7616
  return fetchAttr._fn[inject.id]();
7623
7617
  }
7624
7618
 
7619
+ if (option.key) {
7620
+ fc.targetRule = rule;
7621
+ var res = get('$globalData.' + option.key);
7622
+ delete fc.targetRule;
7623
+
7624
+ if (res) {
7625
+ if (check()) return;
7626
+ set(res);
7627
+ }
7628
+
7629
+ return;
7630
+ }
7631
+
7625
7632
  var _option = fc.$handle.loadFetchVar(deepCopy(option), get, rule);
7626
7633
 
7627
7634
  var config = _objectSpread2(_objectSpread2({
@@ -8247,12 +8254,15 @@ function FormCreateFactory(config) {
8247
8254
  this.$handle.init();
8248
8255
  },
8249
8256
  targetFormDriver: function targetFormDriver(method) {
8250
- var _this3 = this;
8257
+ var _this$bus,
8258
+ _this3 = this;
8251
8259
 
8252
8260
  for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
8253
8261
  args[_key2 - 1] = arguments[_key2];
8254
8262
  }
8255
8263
 
8264
+ (_this$bus = this.bus).$emit.apply(_this$bus, [method].concat(args));
8265
+
8256
8266
  if (this.renderDriver && this.renderDriver[method]) {
8257
8267
  return invoke(function () {
8258
8268
  var _this3$renderDriver;
@@ -8347,6 +8357,8 @@ function FormCreateFactory(config) {
8347
8357
 
8348
8358
  var options = _this4.$handle.loadFetchVar(copy$1(option), get);
8349
8359
 
8360
+ options.targetRule = _this4.targetRule;
8361
+
8350
8362
  _this4.$handle.api.fetch(options).then(function (res) {
8351
8363
  _emit(res);
8352
8364
  })["catch"](function (e) {
@@ -8355,6 +8367,11 @@ function FormCreateFactory(config) {
8355
8367
  };
8356
8368
 
8357
8369
  var unwatch = this.watchLoadData(callback);
8370
+
8371
+ if (option.watch === false) {
8372
+ unwatch();
8373
+ }
8374
+
8358
8375
  this.unwatch.push(unwatch);
8359
8376
  return val;
8360
8377
  }
@@ -8572,11 +8589,18 @@ function FormCreateFactory(config) {
8572
8589
  globalData: {}
8573
8590
  }, deepCopy(globalConfig));
8574
8591
 
8575
- if (this.isSub()) {
8592
+ var isSubForm = this.isSub();
8593
+
8594
+ if (isSubForm) {
8576
8595
  options = this.mergeOptions(options, this.vm.setupState.parent.setupState.fc.options.value || {}, true);
8577
8596
  }
8578
8597
 
8579
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
+ });
8580
8604
  this.updateOptions(options);
8581
8605
  },
8582
8606
  mergeOptions: function mergeOptions(target, opt, parent) {
@@ -9670,7 +9694,7 @@ function install(FormCreate) {
9670
9694
  function elmFormCreate() {
9671
9695
  return FormCreateFactory({
9672
9696
  ui: 'element-ui',
9673
- version: '3.2.28',
9697
+ version: '3.2.30',
9674
9698
  manager: manager,
9675
9699
  extendApi: extendApi,
9676
9700
  install: install,