@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.
@@ -2923,7 +2923,8 @@ function $FormCreate(FormCreate, components, directives) {
2923
2923
  fc.initOptions();
2924
2924
  fapi.refresh();
2925
2925
  }, {
2926
- deep: true
2926
+ deep: true,
2927
+ flush: 'sync'
2927
2928
  });
2928
2929
  watch(function () {
2929
2930
  return _toConsumableArray(rule.value);
@@ -3592,6 +3593,28 @@ function Api(h) {
3592
3593
  return origin ? ctx.origin : ctx.rule;
3593
3594
  }
3594
3595
  },
3596
+ findType: function findType(type, origin) {
3597
+ var rule = undefined;
3598
+ Object.keys(h.ctxs).forEach(function (k) {
3599
+ var ctx = h.ctxs[k];
3600
+
3601
+ if (ctx.rule.type === type) {
3602
+ rule = origin ? ctx.origin : ctx.rule;
3603
+ }
3604
+ });
3605
+ return rule;
3606
+ },
3607
+ findTypes: function findTypes(type, origin) {
3608
+ var rules = [];
3609
+ Object.keys(h.ctxs).forEach(function (k) {
3610
+ var ctx = h.ctxs[k];
3611
+
3612
+ if (ctx.rule.type === type) {
3613
+ rules.push(origin ? ctx.origin : ctx.rule);
3614
+ }
3615
+ });
3616
+ return rules;
3617
+ },
3595
3618
  getRenderRule: function getRenderRule(id) {
3596
3619
  var ctx = h.getCtx(id);
3597
3620
 
@@ -3850,6 +3873,11 @@ function Api(h) {
3850
3873
  (_h$vm = h.vm).emit.apply(_h$vm, [name].concat(args));
3851
3874
  },
3852
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
+ },
3853
3881
  fetch: function fetch(opt) {
3854
3882
  return new Promise(function (resolve, reject) {
3855
3883
  opt = deepCopy(opt);
@@ -4527,7 +4555,7 @@ function Render(handle) {
4527
4555
  fc: handle.fc,
4528
4556
  vm: handle.vm,
4529
4557
  $manager: handle.$manager,
4530
- vNode: new handle.fc.CreateNode(handle.vm),
4558
+ vNode: new handle.fc.CreateNode(handle),
4531
4559
  force: false,
4532
4560
  tmpInput: null,
4533
4561
  id: id$1++
@@ -6190,7 +6218,7 @@ function useContext(Handler) {
6190
6218
 
6191
6219
  var value = _this.compute(ctx, item);
6192
6220
 
6193
- if (item.linkage && value === oldValueTag) {
6221
+ if ((item.linkage || item.linkageVariable) && value === oldValueTag) {
6194
6222
  return oldValueTag;
6195
6223
  }
6196
6224
 
@@ -6537,7 +6565,7 @@ function useContext(Handler) {
6537
6565
  var field = null;
6538
6566
 
6539
6567
  if (one.variable) {
6540
- field = JSON.stringify(_this4.fc.getLoadData(one.variable) || '');
6568
+ field = JSON.stringify(_this4.fc.getLoadData(one.variable)) || '';
6541
6569
  } else if (one.field) {
6542
6570
  field = convertFieldToConditions(one.field || '');
6543
6571
  } else if (!one.mode) {
@@ -6593,6 +6621,10 @@ function useContext(Handler) {
6593
6621
  return val ? invoke(function () {
6594
6622
  return _this4.computeValue(item.linkage, ctx, group);
6595
6623
  }, undefined) : oldValueTag;
6624
+ } else if (item.linkageVariable) {
6625
+ return val ? invoke(function () {
6626
+ return _this4.fc.getLoadData(item.linkageVariable);
6627
+ }, undefined) : oldValueTag;
6596
6628
  }
6597
6629
 
6598
6630
  return val;
@@ -6818,12 +6850,12 @@ function useEffect(Handler) {
6818
6850
 
6819
6851
  prop._c = getComponent(prop);
6820
6852
 
6821
- _this.onEffect(prop);
6853
+ _this.onEffect(prop, k);
6822
6854
 
6823
6855
  _this.providers[k] = prop;
6824
6856
  });
6825
6857
  },
6826
- onEffect: function onEffect(provider) {
6858
+ onEffect: function onEffect(provider, key) {
6827
6859
  var _this2 = this;
6828
6860
 
6829
6861
  var used = [];
@@ -6832,7 +6864,7 @@ function useEffect(Handler) {
6832
6864
  if (used.indexOf(type) > -1) return;
6833
6865
  used.push(type);
6834
6866
 
6835
- _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) {
6836
6868
  provider[event] && provider[event].apply(provider, _toConsumableArray(args));
6837
6869
  });
6838
6870
  });
@@ -7158,8 +7190,9 @@ function makeDirective(data, vn) {
7158
7190
  function CreateNodeFactory() {
7159
7191
  var aliasMap = {};
7160
7192
 
7161
- function CreateNode(vm) {
7162
- this.vm = vm;
7193
+ function CreateNode(handle) {
7194
+ this.vm = handle.vm;
7195
+ this.handle = handle;
7163
7196
  }
7164
7197
 
7165
7198
  extend(CreateNode.prototype, {
@@ -7177,13 +7210,14 @@ function CreateNodeFactory() {
7177
7210
  h: function h(tag, data, children) {
7178
7211
  var vm = this.vm || getCurrentInstance();
7179
7212
  var isNativeTag = vm.appContext.config.isNativeTag(tag);
7213
+ var component = this.handle.fc.prop.components[tag];
7180
7214
 
7181
- if (isNativeTag) {
7215
+ if (!component && isNativeTag) {
7182
7216
  delete data.formCreateInject;
7183
7217
  }
7184
7218
 
7185
7219
  try {
7186
- return createVNode(isNativeTag ? tag : resolveComponent(tag), data, children);
7220
+ return createVNode(component || (isNativeTag ? tag : resolveComponent(tag)), data, children);
7187
7221
  } catch (e) {
7188
7222
  console.error(e);
7189
7223
  return createVNode('');
@@ -7201,11 +7235,10 @@ function CreateNodeFactory() {
7201
7235
  var line = toLine(k);
7202
7236
  var lower = toString(k).toLocaleLowerCase();
7203
7237
  var v = nodes[k];
7238
+ CreateNode.alias(k, v);
7204
7239
  [k, line, lower].forEach(function (n) {
7205
- CreateNode.alias(k, v);
7206
-
7207
7240
  CreateNode.prototype[n] = function (data, children) {
7208
- return this.make(v, data, children);
7241
+ return this.make(aliasMap[k] || n, data, children);
7209
7242
  };
7210
7243
  });
7211
7244
  });
@@ -7568,22 +7601,6 @@ var fetch = function fetch(fc) {
7568
7601
  option.to = 'options';
7569
7602
  }
7570
7603
 
7571
- if (option.key) {
7572
- var item = fc.$handle.options.globalData[option.key];
7573
-
7574
- if (!item) {
7575
- set(undefined);
7576
- return;
7577
- }
7578
-
7579
- if (item.type === 'static') {
7580
- set(item.data);
7581
- return;
7582
- } else {
7583
- option = _objectSpread2(_objectSpread2({}, option), item);
7584
- }
7585
- }
7586
-
7587
7604
  var _onError = option.onError;
7588
7605
 
7589
7606
  var check = function check() {
@@ -7599,6 +7616,17 @@ var fetch = function fetch(fc) {
7599
7616
  return fetchAttr._fn[inject.id]();
7600
7617
  }
7601
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
+
7602
7630
  var _option = fc.$handle.loadFetchVar(deepCopy(option), get, rule);
7603
7631
 
7604
7632
  var config = _objectSpread2(_objectSpread2({
@@ -8203,7 +8231,8 @@ function FormCreateFactory(config) {
8203
8231
 
8204
8232
  _this2.$handle.api.refresh();
8205
8233
  }, {
8206
- deep: true
8234
+ deep: true,
8235
+ flush: 'sync'
8207
8236
  }));
8208
8237
  }
8209
8238
 
@@ -8223,12 +8252,15 @@ function FormCreateFactory(config) {
8223
8252
  this.$handle.init();
8224
8253
  },
8225
8254
  targetFormDriver: function targetFormDriver(method) {
8226
- var _this3 = this;
8255
+ var _this$bus,
8256
+ _this3 = this;
8227
8257
 
8228
8258
  for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
8229
8259
  args[_key2 - 1] = arguments[_key2];
8230
8260
  }
8231
8261
 
8262
+ (_this$bus = this.bus).$emit.apply(_this$bus, [method].concat(args));
8263
+
8232
8264
  if (this.renderDriver && this.renderDriver[method]) {
8233
8265
  return invoke(function () {
8234
8266
  var _this3$renderDriver;
@@ -8331,6 +8363,11 @@ function FormCreateFactory(config) {
8331
8363
  };
8332
8364
 
8333
8365
  var unwatch = this.watchLoadData(callback);
8366
+
8367
+ if (option.watch === false) {
8368
+ unwatch();
8369
+ }
8370
+
8334
8371
  this.unwatch.push(unwatch);
8335
8372
  return val;
8336
8373
  }
@@ -8389,17 +8426,11 @@ function FormCreateFactory(config) {
8389
8426
  var handle = is.Function(option) ? option : parseFn(option.handle);
8390
8427
 
8391
8428
  if (handle) {
8392
- var val;
8393
- var unwatch = this.watchLoadData(function (get, flag) {
8394
- if (flag) {
8395
- _this5.bus.$emit('$loadData.$var.' + key);
8429
+ var val = handle(function () {
8430
+ var _this5$$handle$api;
8396
8431
 
8397
- unwatch();
8398
- } else {
8399
- val = handle(get, _this5.$handle.api);
8400
- }
8401
- });
8402
- this.unwatch.push(unwatch);
8432
+ return (_this5$$handle$api = _this5.$handle.api).getData.apply(_this5$$handle$api, arguments);
8433
+ }, this.$handle.api);
8403
8434
  return deepGet(val, split);
8404
8435
  }
8405
8436
  }
@@ -8554,11 +8585,18 @@ function FormCreateFactory(config) {
8554
8585
  globalData: {}
8555
8586
  }, deepCopy(globalConfig));
8556
8587
 
8557
- if (this.isSub()) {
8588
+ var isSubForm = this.isSub();
8589
+
8590
+ if (isSubForm) {
8558
8591
  options = this.mergeOptions(options, this.vm.setupState.parent.setupState.fc.options.value || {}, true);
8559
8592
  }
8560
8593
 
8561
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
+ });
8562
8600
  this.updateOptions(options);
8563
8601
  },
8564
8602
  mergeOptions: function mergeOptions(target, opt, parent) {
@@ -9416,6 +9454,9 @@ function extendApi(api, h) {
9416
9454
  h.vm.emit('validate-fail', e, {
9417
9455
  api: api
9418
9456
  });
9457
+ h.emitEvent('validate-fail', e, {
9458
+ api: api
9459
+ });
9419
9460
  });
9420
9461
  });
9421
9462
  },
@@ -9649,7 +9690,7 @@ function install(FormCreate) {
9649
9690
  function elmFormCreate() {
9650
9691
  return FormCreateFactory({
9651
9692
  ui: 'element-ui',
9652
- version: '3.2.27',
9693
+ version: '3.2.29',
9653
9694
  manager: manager,
9654
9695
  extendApi: extendApi,
9655
9696
  install: install,