@form-create/element-ui 3.2.27 → 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.27
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.
@@ -2927,7 +2927,8 @@
2927
2927
  fc.initOptions();
2928
2928
  fapi.refresh();
2929
2929
  }, {
2930
- deep: true
2930
+ deep: true,
2931
+ flush: 'sync'
2931
2932
  });
2932
2933
  vue.watch(function () {
2933
2934
  return _toConsumableArray(rule.value);
@@ -3596,6 +3597,28 @@
3596
3597
  return origin ? ctx.origin : ctx.rule;
3597
3598
  }
3598
3599
  },
3600
+ findType: function findType(type, origin) {
3601
+ var rule = undefined;
3602
+ Object.keys(h.ctxs).forEach(function (k) {
3603
+ var ctx = h.ctxs[k];
3604
+
3605
+ if (ctx.rule.type === type) {
3606
+ rule = origin ? ctx.origin : ctx.rule;
3607
+ }
3608
+ });
3609
+ return rule;
3610
+ },
3611
+ findTypes: function findTypes(type, origin) {
3612
+ var rules = [];
3613
+ Object.keys(h.ctxs).forEach(function (k) {
3614
+ var ctx = h.ctxs[k];
3615
+
3616
+ if (ctx.rule.type === type) {
3617
+ rules.push(origin ? ctx.origin : ctx.rule);
3618
+ }
3619
+ });
3620
+ return rules;
3621
+ },
3599
3622
  getRenderRule: function getRenderRule(id) {
3600
3623
  var ctx = h.getCtx(id);
3601
3624
 
@@ -3854,6 +3877,11 @@
3854
3877
  (_h$vm = h.vm).emit.apply(_h$vm, [name].concat(args));
3855
3878
  },
3856
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
+ },
3857
3885
  fetch: function fetch(opt) {
3858
3886
  return new Promise(function (resolve, reject) {
3859
3887
  opt = deepCopy(opt);
@@ -4531,7 +4559,7 @@
4531
4559
  fc: handle.fc,
4532
4560
  vm: handle.vm,
4533
4561
  $manager: handle.$manager,
4534
- vNode: new handle.fc.CreateNode(handle.vm),
4562
+ vNode: new handle.fc.CreateNode(handle),
4535
4563
  force: false,
4536
4564
  tmpInput: null,
4537
4565
  id: id$1++
@@ -6194,7 +6222,7 @@
6194
6222
 
6195
6223
  var value = _this.compute(ctx, item);
6196
6224
 
6197
- if (item.linkage && value === oldValueTag) {
6225
+ if ((item.linkage || item.linkageVariable) && value === oldValueTag) {
6198
6226
  return oldValueTag;
6199
6227
  }
6200
6228
 
@@ -6541,7 +6569,7 @@
6541
6569
  var field = null;
6542
6570
 
6543
6571
  if (one.variable) {
6544
- field = JSON.stringify(_this4.fc.getLoadData(one.variable) || '');
6572
+ field = JSON.stringify(_this4.fc.getLoadData(one.variable)) || '';
6545
6573
  } else if (one.field) {
6546
6574
  field = convertFieldToConditions(one.field || '');
6547
6575
  } else if (!one.mode) {
@@ -6597,6 +6625,10 @@
6597
6625
  return val ? invoke(function () {
6598
6626
  return _this4.computeValue(item.linkage, ctx, group);
6599
6627
  }, undefined) : oldValueTag;
6628
+ } else if (item.linkageVariable) {
6629
+ return val ? invoke(function () {
6630
+ return _this4.fc.getLoadData(item.linkageVariable);
6631
+ }, undefined) : oldValueTag;
6600
6632
  }
6601
6633
 
6602
6634
  return val;
@@ -6822,12 +6854,12 @@
6822
6854
 
6823
6855
  prop._c = getComponent(prop);
6824
6856
 
6825
- _this.onEffect(prop);
6857
+ _this.onEffect(prop, k);
6826
6858
 
6827
6859
  _this.providers[k] = prop;
6828
6860
  });
6829
6861
  },
6830
- onEffect: function onEffect(provider) {
6862
+ onEffect: function onEffect(provider, key) {
6831
6863
  var _this2 = this;
6832
6864
 
6833
6865
  var used = [];
@@ -6836,7 +6868,7 @@
6836
6868
  if (used.indexOf(type) > -1) return;
6837
6869
  used.push(type);
6838
6870
 
6839
- _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) {
6840
6872
  provider[event] && provider[event].apply(provider, _toConsumableArray(args));
6841
6873
  });
6842
6874
  });
@@ -7162,8 +7194,9 @@
7162
7194
  function CreateNodeFactory() {
7163
7195
  var aliasMap = {};
7164
7196
 
7165
- function CreateNode(vm) {
7166
- this.vm = vm;
7197
+ function CreateNode(handle) {
7198
+ this.vm = handle.vm;
7199
+ this.handle = handle;
7167
7200
  }
7168
7201
 
7169
7202
  extend(CreateNode.prototype, {
@@ -7181,13 +7214,14 @@
7181
7214
  h: function h(tag, data, children) {
7182
7215
  var vm = this.vm || vue.getCurrentInstance();
7183
7216
  var isNativeTag = vm.appContext.config.isNativeTag(tag);
7217
+ var component = this.handle.fc.prop.components[tag];
7184
7218
 
7185
- if (isNativeTag) {
7219
+ if (!component && isNativeTag) {
7186
7220
  delete data.formCreateInject;
7187
7221
  }
7188
7222
 
7189
7223
  try {
7190
- return vue.createVNode(isNativeTag ? tag : vue.resolveComponent(tag), data, children);
7224
+ return vue.createVNode(component || (isNativeTag ? tag : vue.resolveComponent(tag)), data, children);
7191
7225
  } catch (e) {
7192
7226
  console.error(e);
7193
7227
  return vue.createVNode('');
@@ -7205,11 +7239,10 @@
7205
7239
  var line = toLine(k);
7206
7240
  var lower = toString(k).toLocaleLowerCase();
7207
7241
  var v = nodes[k];
7242
+ CreateNode.alias(k, v);
7208
7243
  [k, line, lower].forEach(function (n) {
7209
- CreateNode.alias(k, v);
7210
-
7211
7244
  CreateNode.prototype[n] = function (data, children) {
7212
- return this.make(v, data, children);
7245
+ return this.make(aliasMap[k] || n, data, children);
7213
7246
  };
7214
7247
  });
7215
7248
  });
@@ -7572,22 +7605,6 @@
7572
7605
  option.to = 'options';
7573
7606
  }
7574
7607
 
7575
- if (option.key) {
7576
- var item = fc.$handle.options.globalData[option.key];
7577
-
7578
- if (!item) {
7579
- set(undefined);
7580
- return;
7581
- }
7582
-
7583
- if (item.type === 'static') {
7584
- set(item.data);
7585
- return;
7586
- } else {
7587
- option = _objectSpread2(_objectSpread2({}, option), item);
7588
- }
7589
- }
7590
-
7591
7608
  var _onError = option.onError;
7592
7609
 
7593
7610
  var check = function check() {
@@ -7603,6 +7620,17 @@
7603
7620
  return fetchAttr._fn[inject.id]();
7604
7621
  }
7605
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
+
7606
7634
  var _option = fc.$handle.loadFetchVar(deepCopy(option), get, rule);
7607
7635
 
7608
7636
  var config = _objectSpread2(_objectSpread2({
@@ -8207,7 +8235,8 @@
8207
8235
 
8208
8236
  _this2.$handle.api.refresh();
8209
8237
  }, {
8210
- deep: true
8238
+ deep: true,
8239
+ flush: 'sync'
8211
8240
  }));
8212
8241
  }
8213
8242
 
@@ -8227,12 +8256,15 @@
8227
8256
  this.$handle.init();
8228
8257
  },
8229
8258
  targetFormDriver: function targetFormDriver(method) {
8230
- var _this3 = this;
8259
+ var _this$bus,
8260
+ _this3 = this;
8231
8261
 
8232
8262
  for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
8233
8263
  args[_key2 - 1] = arguments[_key2];
8234
8264
  }
8235
8265
 
8266
+ (_this$bus = this.bus).$emit.apply(_this$bus, [method].concat(args));
8267
+
8236
8268
  if (this.renderDriver && this.renderDriver[method]) {
8237
8269
  return invoke(function () {
8238
8270
  var _this3$renderDriver;
@@ -8335,6 +8367,11 @@
8335
8367
  };
8336
8368
 
8337
8369
  var unwatch = this.watchLoadData(callback);
8370
+
8371
+ if (option.watch === false) {
8372
+ unwatch();
8373
+ }
8374
+
8338
8375
  this.unwatch.push(unwatch);
8339
8376
  return val;
8340
8377
  }
@@ -8393,17 +8430,11 @@
8393
8430
  var handle = is.Function(option) ? option : parseFn(option.handle);
8394
8431
 
8395
8432
  if (handle) {
8396
- var val;
8397
- var unwatch = this.watchLoadData(function (get, flag) {
8398
- if (flag) {
8399
- _this5.bus.$emit('$loadData.$var.' + key);
8433
+ var val = handle(function () {
8434
+ var _this5$$handle$api;
8400
8435
 
8401
- unwatch();
8402
- } else {
8403
- val = handle(get, _this5.$handle.api);
8404
- }
8405
- });
8406
- this.unwatch.push(unwatch);
8436
+ return (_this5$$handle$api = _this5.$handle.api).getData.apply(_this5$$handle$api, arguments);
8437
+ }, this.$handle.api);
8407
8438
  return deepGet(val, split);
8408
8439
  }
8409
8440
  }
@@ -8558,11 +8589,18 @@
8558
8589
  globalData: {}
8559
8590
  }, deepCopy(globalConfig));
8560
8591
 
8561
- if (this.isSub()) {
8592
+ var isSubForm = this.isSub();
8593
+
8594
+ if (isSubForm) {
8562
8595
  options = this.mergeOptions(options, this.vm.setupState.parent.setupState.fc.options.value || {}, true);
8563
8596
  }
8564
8597
 
8565
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
+ });
8566
8604
  this.updateOptions(options);
8567
8605
  },
8568
8606
  mergeOptions: function mergeOptions(target, opt, parent) {
@@ -9420,6 +9458,9 @@
9420
9458
  h.vm.emit('validate-fail', e, {
9421
9459
  api: api
9422
9460
  });
9461
+ h.emitEvent('validate-fail', e, {
9462
+ api: api
9463
+ });
9423
9464
  });
9424
9465
  });
9425
9466
  },
@@ -9653,7 +9694,7 @@
9653
9694
  function elmFormCreate() {
9654
9695
  return FormCreateFactory({
9655
9696
  ui: 'element-ui',
9656
- version: '3.2.27',
9697
+ version: '3.2.29',
9657
9698
  manager: manager,
9658
9699
  extendApi: extendApi,
9659
9700
  install: install,