@form-create/element-ui 3.2.2 → 3.2.4

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.2
2
+ * @form-create/element-ui v3.2.4
3
3
  * (c) 2018-2024 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
@@ -1628,7 +1628,7 @@
1628
1628
  var _this2 = this;
1629
1629
 
1630
1630
  n = n || [];
1631
- var keys = Object.keys(this.sort),
1631
+ var keys = this.sort,
1632
1632
  total = keys.length,
1633
1633
  len = total - n.length;
1634
1634
 
@@ -2278,7 +2278,13 @@
2278
2278
  });
2279
2279
  vue.watch(modelValue, function (n) {
2280
2280
  if (JSON.stringify(n || {}) === data.updateValue) return;
2281
- fapi.config.forceCoverValue ? fapi.coverValue(n || {}) : fapi.setValue(n || {});
2281
+
2282
+ if (fapi.config.forceCoverValue) {
2283
+ fc.$handle.appendData = {};
2284
+ fapi.coverValue(n || {});
2285
+ } else {
2286
+ fapi.setValue(n || {});
2287
+ }
2282
2288
  }, {
2283
2289
  deep: true
2284
2290
  });
@@ -2648,6 +2654,7 @@
2648
2654
  prop.key = rule.key;
2649
2655
  prop.ref = rule.ref;
2650
2656
  prop["class"] = rule["class"];
2657
+ prop.id = rule.id;
2651
2658
  prop.style = rule.style;
2652
2659
  if (prop.slot) delete prop.slot;
2653
2660
  return prop;
@@ -2880,9 +2887,9 @@
2880
2887
  });
2881
2888
  xhr.send(formData);
2882
2889
  }
2883
- function asyncFetch(config) {
2890
+ function asyncFetch(config, _fetch) {
2884
2891
  return new Promise(function (resolve, reject) {
2885
- fetch$1(_objectSpread2(_objectSpread2({}, config), {}, {
2892
+ (_fetch || fetch$1)(_objectSpread2(_objectSpread2({}, config), {}, {
2886
2893
  onSuccess: function onSuccess(res) {
2887
2894
  var fn = function fn(v) {
2888
2895
  return v;
@@ -3443,8 +3450,24 @@
3443
3450
  bus: h.bus,
3444
3451
  fetch: function fetch(opt) {
3445
3452
  return new Promise(function (resolve, reject) {
3453
+ opt = deepCopy(opt);
3454
+ opt = h.loadFetchVar(opt);
3446
3455
  h.beforeFetch(opt).then(function () {
3447
- return asyncFetch(opt).then(resolve)["catch"](reject);
3456
+ return asyncFetch(opt, h.fc.create.fetch).then(resolve)["catch"](reject);
3457
+ });
3458
+ });
3459
+ },
3460
+ watchFetch: function watchFetch(opt, callback, error) {
3461
+ return h.fc.watchLoadData(function (get, change) {
3462
+ var _opt = deepCopy(opt);
3463
+
3464
+ _opt = h.loadFetchVar(_opt, get);
3465
+ h.beforeFetch(_opt).then(function () {
3466
+ return asyncFetch(_opt, h.fc.create.fetch).then(function (res) {
3467
+ callback && callback(res, change);
3468
+ })["catch"](function (e) {
3469
+ error && error(e);
3470
+ });
3448
3471
  });
3449
3472
  });
3450
3473
  },
@@ -4536,7 +4559,6 @@
4536
4559
  this.$handle.watchCtx(this);
4537
4560
  },
4538
4561
  "delete": function _delete() {
4539
- var undef = void 0;
4540
4562
  this.unwatch();
4541
4563
  this.unlink();
4542
4564
  this.rmCtrl();
@@ -4547,13 +4569,7 @@
4547
4569
 
4548
4570
  extend(this, {
4549
4571
  deleted: true,
4550
- prop: _objectSpread2({}, this.rule),
4551
4572
  computed: {},
4552
- el: undef,
4553
- $handle: undef,
4554
- $api: undef,
4555
- vm: undef,
4556
- vNode: undef,
4557
4573
  parent: null,
4558
4574
  children: [],
4559
4575
  cacheConfig: null,
@@ -4780,18 +4796,15 @@
4780
4796
  if (isInit) {
4781
4797
  ctx = _rule.__fc__;
4782
4798
  defaultValue = ctx.defaultValue;
4783
- var check = !ctx.check(_this6);
4784
4799
 
4785
4800
  if (ctx.deleted) {
4786
- if (check) {
4787
- if (isCtrl(ctx)) {
4788
- return;
4789
- }
4790
-
4791
- ctx.update(_this6);
4801
+ if (isCtrl(ctx)) {
4802
+ return;
4792
4803
  }
4804
+
4805
+ ctx.update(_this6);
4793
4806
  } else {
4794
- if (check) {
4807
+ if (!ctx.check(_this6)) {
4795
4808
  if (isCtrl(ctx)) {
4796
4809
  return;
4797
4810
  }
@@ -5463,6 +5476,8 @@
5463
5476
  }
5464
5477
 
5465
5478
  Object.keys(computed).forEach(function (k) {
5479
+ var _val = deepGet(ctx.rule, k);
5480
+
5466
5481
  ctx.watch.push(vue.watch(function () {
5467
5482
  var item = computed[k];
5468
5483
  if (!item) return undefined;
@@ -5493,7 +5508,7 @@
5493
5508
  } else if (!condition[one.condition]) {
5494
5509
  flag = false;
5495
5510
  } else {
5496
- flag = new Function('_$', '_$val', 'top', 'group', "with(top){with(this){with(group){ return _$['".concat(one.condition, "'](").concat(one.field, ", ").concat(one.compare ? one.compare : '_$val', "); }}}")).call(_this.api.form, condition, one.value, _this.api.top.form, group ? _this.subRuleData[group.id] || {} : {});
5511
+ flag = new Function('_$', '_$val', '$form', '_group', "with($form){with(this){with(_group){ return _$['".concat(one.condition, "'](").concat(one.field, ", ").concat(one.compare ? one.compare : '_$val', "); }}}")).call(_this.api.form, condition, one.value, _this.api.top.form, group ? _this.subRuleData[group.id] || {} : {});
5497
5512
  }
5498
5513
 
5499
5514
  if (or && flag) {
@@ -5517,7 +5532,7 @@
5517
5532
  var _group = ctx.getParentGroup();
5518
5533
 
5519
5534
  fn = function fn() {
5520
- return new Function('formulas', 'top', 'group', '$rule', '$api', "with(top){with(this){with(group){with(formulas){ return ".concat(item, " }}}}")).call(_this.api.form, _this.fc.formulas, _this.api.top.form, _group ? _this.subRuleData[_group.id] || {} : {}, ctx.rule, _this.api);
5535
+ return new Function('_formulas', '$form', '_group', '$rule', '$api', "with($form){with(this){with(_group){with(_formulas){ return ".concat(item, " }}}}")).call(_this.api.form, _this.fc.formulas, _this.api.top.form, _group ? _this.subRuleData[_group.id] || {} : {}, ctx.rule, _this.api);
5521
5536
  };
5522
5537
  }
5523
5538
 
@@ -5533,7 +5548,7 @@
5533
5548
  }
5534
5549
  });
5535
5550
  }, {
5536
- immediate: true
5551
+ immediate: _val == null || _val === ''
5537
5552
  }));
5538
5553
  });
5539
5554
  });
@@ -6657,14 +6672,19 @@
6657
6672
  }
6658
6673
 
6659
6674
  function setDriver(name, driver) {
6675
+ var parent = drivers[name] || {};
6676
+ var parsers = parent.parsers || {};
6677
+
6660
6678
  if (driver.parsers) {
6661
6679
  Object.keys(driver.parsers).forEach(function (k) {
6662
- driver.parsers[k] = setPrototypeOf(driver.parsers[k], BaseParser);
6680
+ parsers[k] = setPrototypeOf(driver.parsers[k], BaseParser);
6663
6681
  });
6664
6682
  }
6665
6683
 
6666
6684
  driver.name = name;
6667
- drivers[name] = driver;
6685
+ drivers[name] = _objectSpread2(_objectSpread2(_objectSpread2({}, parent), driver), {}, {
6686
+ parsers: parsers
6687
+ });
6668
6688
  }
6669
6689
 
6670
6690
  function refreshData(id) {
@@ -7194,6 +7214,16 @@
7194
7214
 
7195
7215
  var FcComponent = $form();
7196
7216
  setPrototypeOf(FcComponent, create);
7217
+ Object.defineProperties(FcComponent, {
7218
+ fetch: {
7219
+ get: function get() {
7220
+ return create.fetch;
7221
+ },
7222
+ set: function set(val) {
7223
+ create.fetch = val;
7224
+ }
7225
+ }
7226
+ });
7197
7227
  FcComponent.util = create;
7198
7228
  return FcComponent;
7199
7229
  }
@@ -8078,7 +8108,7 @@
8078
8108
  function elmFormCreate() {
8079
8109
  return FormCreateFactory({
8080
8110
  ui: 'element-ui',
8081
- version: '3.2.2',
8111
+ version: '3.2.4',
8082
8112
  manager: manager,
8083
8113
  extendApi: extendApi,
8084
8114
  install: install,