@form-create/element-ui 3.2.9 → 3.2.10

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.9
2
+ * @form-create/element-ui v3.2.10
3
3
  * (c) 2018-2024 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
@@ -3553,7 +3553,17 @@
3553
3553
  opt = deepCopy(opt);
3554
3554
  opt = h.loadFetchVar(opt);
3555
3555
  h.beforeFetch(opt).then(function () {
3556
- return asyncFetch(opt, h.fc.create.fetch).then(resolve)["catch"](reject);
3556
+ return asyncFetch(opt, h.fc.create.fetch).then(function (res) {
3557
+ invoke(function () {
3558
+ return opt.onSuccess && opt.onSuccess(res);
3559
+ });
3560
+ resolve(res);
3561
+ })["catch"](function (e) {
3562
+ invoke(function () {
3563
+ return opt.onError && opt.onError(e);
3564
+ });
3565
+ reject(e);
3566
+ });
3557
3567
  });
3558
3568
  });
3559
3569
  },
@@ -3564,8 +3574,14 @@
3564
3574
  _opt = h.loadFetchVar(_opt, get);
3565
3575
  h.beforeFetch(_opt).then(function () {
3566
3576
  return asyncFetch(_opt, h.fc.create.fetch).then(function (res) {
3577
+ invoke(function () {
3578
+ return _opt.onSuccess && _opt.onSuccess(res);
3579
+ });
3567
3580
  callback && callback(res, change);
3568
3581
  })["catch"](function (e) {
3582
+ invoke(function () {
3583
+ return _opt.onError && _opt.onError(e);
3584
+ });
3569
3585
  error && error(e);
3570
3586
  });
3571
3587
  });
@@ -5674,10 +5690,30 @@
5674
5690
  return item(_this2.api.form, _this2.api);
5675
5691
  };
5676
5692
  } else {
5693
+ var that = this;
5694
+ var formulas = Object.keys(this.fc.formulas).reduce(function (obj, k) {
5695
+ obj[k] = function () {
5696
+ var _that$fc$formulas$k;
5697
+
5698
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
5699
+ args[_key] = arguments[_key];
5700
+ }
5701
+
5702
+ return (_that$fc$formulas$k = that.fc.formulas[k]).call.apply(_that$fc$formulas$k, [{
5703
+ that: this,
5704
+ rule: ctx.rule,
5705
+ api: that.api,
5706
+ fc: that.fc
5707
+ }].concat(args));
5708
+ };
5709
+
5710
+ return obj;
5711
+ }, {});
5712
+
5677
5713
  var _group = ctx.getParentGroup();
5678
5714
 
5679
5715
  fn = function fn() {
5680
- return new Function('$formulas', '$form', '$group', '$rule', '$api', "with($form){with(this){with($group){with($formulas){ return ".concat(item, " }}}}")).call(_this2.api.form, _this2.fc.formulas, _this2.api.top.form, _group ? _this2.subRuleData[_group.id] || {} : {}, ctx.rule, _this2.api);
5716
+ return new Function('$formulas', '$form', '$group', '$rule', '$api', "with($form){with(this){with($group){with($formulas){ return ".concat(item, " }}}}")).call(_this2.api.form, formulas, _this2.api.top.form, _group ? _this2.subRuleData[_group.id] || {} : {}, ctx.rule, _this2.api);
5681
5717
  };
5682
5718
  }
5683
5719
 
@@ -5988,7 +6024,7 @@
5988
6024
  return fc.bus;
5989
6025
  },
5990
6026
  preview: function preview() {
5991
- return fc.vm.props.preview != null ? fc.vm.props.preview : this.options.preview || false;
6027
+ return fc.vm.props.preview != null ? fc.vm.props.preview : fc.options.value.preview || false;
5992
6028
  }
5993
6029
  });
5994
6030
  extend(this, {
@@ -7172,14 +7208,10 @@
7172
7208
  var key = split.shift();
7173
7209
  var key2 = split.shift() || '';
7174
7210
  var callback = debounce(function () {
7175
- if (key !== id) {
7176
- var temp = _this6.getLoadData(id, def);
7211
+ var temp = _this6.getLoadData(id, def);
7177
7212
 
7178
- if (JSON.stringify(temp) !== JSON.stringify(unwatch[id].val)) {
7179
- unwatch[id].val = temp;
7180
- run(true);
7181
- }
7182
- } else {
7213
+ if (JSON.stringify(temp) !== JSON.stringify(unwatch[id].val)) {
7214
+ unwatch[id].val = temp;
7183
7215
  run(true);
7184
7216
  }
7185
7217
  }, 0);
@@ -7734,7 +7766,7 @@
7734
7766
  ref: ref
7735
7767
  });
7736
7768
  extend(this.rule.props, {
7737
- model: $handle.formData
7769
+ model: _objectSpread2({}, $handle.formData)
7738
7770
  });
7739
7771
  },
7740
7772
  render: function render(children) {
@@ -8283,7 +8315,7 @@
8283
8315
  function elmFormCreate() {
8284
8316
  return FormCreateFactory({
8285
8317
  ui: 'element-ui',
8286
- version: '3.2.9',
8318
+ version: '3.2.10',
8287
8319
  manager: manager,
8288
8320
  extendApi: extendApi,
8289
8321
  install: install,