@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.
@@ -3549,7 +3549,17 @@ function Api(h) {
3549
3549
  opt = deepCopy(opt);
3550
3550
  opt = h.loadFetchVar(opt);
3551
3551
  h.beforeFetch(opt).then(function () {
3552
- return asyncFetch(opt, h.fc.create.fetch).then(resolve)["catch"](reject);
3552
+ return asyncFetch(opt, h.fc.create.fetch).then(function (res) {
3553
+ invoke(function () {
3554
+ return opt.onSuccess && opt.onSuccess(res);
3555
+ });
3556
+ resolve(res);
3557
+ })["catch"](function (e) {
3558
+ invoke(function () {
3559
+ return opt.onError && opt.onError(e);
3560
+ });
3561
+ reject(e);
3562
+ });
3553
3563
  });
3554
3564
  });
3555
3565
  },
@@ -3560,8 +3570,14 @@ function Api(h) {
3560
3570
  _opt = h.loadFetchVar(_opt, get);
3561
3571
  h.beforeFetch(_opt).then(function () {
3562
3572
  return asyncFetch(_opt, h.fc.create.fetch).then(function (res) {
3573
+ invoke(function () {
3574
+ return _opt.onSuccess && _opt.onSuccess(res);
3575
+ });
3563
3576
  callback && callback(res, change);
3564
3577
  })["catch"](function (e) {
3578
+ invoke(function () {
3579
+ return _opt.onError && _opt.onError(e);
3580
+ });
3565
3581
  error && error(e);
3566
3582
  });
3567
3583
  });
@@ -5670,10 +5686,30 @@ function useContext(Handler) {
5670
5686
  return item(_this2.api.form, _this2.api);
5671
5687
  };
5672
5688
  } else {
5689
+ var that = this;
5690
+ var formulas = Object.keys(this.fc.formulas).reduce(function (obj, k) {
5691
+ obj[k] = function () {
5692
+ var _that$fc$formulas$k;
5693
+
5694
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
5695
+ args[_key] = arguments[_key];
5696
+ }
5697
+
5698
+ return (_that$fc$formulas$k = that.fc.formulas[k]).call.apply(_that$fc$formulas$k, [{
5699
+ that: this,
5700
+ rule: ctx.rule,
5701
+ api: that.api,
5702
+ fc: that.fc
5703
+ }].concat(args));
5704
+ };
5705
+
5706
+ return obj;
5707
+ }, {});
5708
+
5673
5709
  var _group = ctx.getParentGroup();
5674
5710
 
5675
5711
  fn = function fn() {
5676
- 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);
5712
+ 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);
5677
5713
  };
5678
5714
  }
5679
5715
 
@@ -5984,7 +6020,7 @@ function Handler(fc) {
5984
6020
  return fc.bus;
5985
6021
  },
5986
6022
  preview: function preview() {
5987
- return fc.vm.props.preview != null ? fc.vm.props.preview : this.options.preview || false;
6023
+ return fc.vm.props.preview != null ? fc.vm.props.preview : fc.options.value.preview || false;
5988
6024
  }
5989
6025
  });
5990
6026
  extend(this, {
@@ -7168,14 +7204,10 @@ function FormCreateFactory(config) {
7168
7204
  var key = split.shift();
7169
7205
  var key2 = split.shift() || '';
7170
7206
  var callback = debounce(function () {
7171
- if (key !== id) {
7172
- var temp = _this6.getLoadData(id, def);
7207
+ var temp = _this6.getLoadData(id, def);
7173
7208
 
7174
- if (JSON.stringify(temp) !== JSON.stringify(unwatch[id].val)) {
7175
- unwatch[id].val = temp;
7176
- run(true);
7177
- }
7178
- } else {
7209
+ if (JSON.stringify(temp) !== JSON.stringify(unwatch[id].val)) {
7210
+ unwatch[id].val = temp;
7179
7211
  run(true);
7180
7212
  }
7181
7213
  }, 0);
@@ -7730,7 +7762,7 @@ var manager = {
7730
7762
  ref: ref
7731
7763
  });
7732
7764
  extend(this.rule.props, {
7733
- model: $handle.formData
7765
+ model: _objectSpread2({}, $handle.formData)
7734
7766
  });
7735
7767
  },
7736
7768
  render: function render(children) {
@@ -8279,7 +8311,7 @@ function install(FormCreate) {
8279
8311
  function elmFormCreate() {
8280
8312
  return FormCreateFactory({
8281
8313
  ui: 'element-ui',
8282
- version: '3.2.9',
8314
+ version: '3.2.10',
8283
8315
  manager: manager,
8284
8316
  extendApi: extendApi,
8285
8317
  install: install,