@form-create/element-ui 3.2.8 → 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.8
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.
@@ -1286,7 +1286,7 @@ var Tree = defineComponent({
1286
1286
  return createVNode(resolveComponent("ElTree"), mergeProps$1(this.$attrs, {
1287
1287
  "ref": "tree",
1288
1288
  "onCheck": this.updateValue,
1289
- "onNode-click": this.updateValue
1289
+ "onNodeClick": this.updateValue
1290
1290
  }), this.$slots);
1291
1291
  },
1292
1292
  mounted: function mounted() {
@@ -1414,7 +1414,7 @@ var Upload = defineComponent({
1414
1414
  }, [createVNode(resolveComponent("ElUpload"), mergeProps$1({
1415
1415
  "key": len
1416
1416
  }, this.$attrs, {
1417
- "list-type": this.listType || 'picture-card',
1417
+ "listType": this.listType || 'picture-card',
1418
1418
  "class": {
1419
1419
  '_fc-exceed': this.$attrs.limit ? this.$attrs.limit <= len : false
1420
1420
  },
@@ -2149,6 +2149,15 @@ function $FormCreate(FormCreate, components, directives) {
2149
2149
  var vm = getCurrentInstance();
2150
2150
  provide('parentFC', vm);
2151
2151
  var parent = inject('parentFC', null);
2152
+ var top = parent;
2153
+
2154
+ if (parent) {
2155
+ while (top.setupState.parent) {
2156
+ top = top.setupState.parent;
2157
+ }
2158
+ } else {
2159
+ top = vm;
2160
+ }
2152
2161
 
2153
2162
  var _toRefs = toRefs(props),
2154
2163
  rule = _toRefs.rule,
@@ -2281,6 +2290,7 @@ function $FormCreate(FormCreate, components, directives) {
2281
2290
  if (fc.$handle.isBreakWatch() || n.length === data.renderRule.length && n.every(function (v) {
2282
2291
  return data.renderRule.indexOf(v) > -1;
2283
2292
  })) return;
2293
+ fc.$handle.updateAppendData();
2284
2294
  fc.$handle.reloadRule(rule.value);
2285
2295
  vm.setupState.renderRule();
2286
2296
  });
@@ -2306,12 +2316,14 @@ function $FormCreate(FormCreate, components, directives) {
2306
2316
  fapi.setValue(n || {});
2307
2317
  }
2308
2318
  }, {
2309
- deep: true
2319
+ deep: true,
2320
+ flush: 'post'
2310
2321
  });
2311
2322
  watch(function () {
2312
2323
  return props.index;
2313
2324
  }, function () {
2314
2325
  fapi.coverValue({});
2326
+ fc.$handle.updateAppendData();
2315
2327
  nextTick(function () {
2316
2328
  nextTick(function () {
2317
2329
  fapi.clearValidateState();
@@ -2323,6 +2335,7 @@ function $FormCreate(FormCreate, components, directives) {
2323
2335
  return _objectSpread2(_objectSpread2({
2324
2336
  fc: markRaw(fc),
2325
2337
  parent: parent ? markRaw(parent) : parent,
2338
+ top: markRaw(top),
2326
2339
  fapi: markRaw(fapi)
2327
2340
  }, toRefs(data)), {}, {
2328
2341
  getGroupInject: function getGroupInject() {
@@ -2449,6 +2462,16 @@ function logError(e) {
2449
2462
  console.error(e);
2450
2463
  }
2451
2464
 
2465
+ function toCase(str) {
2466
+ var to = str.replace(/(-[a-z])/g, function (v) {
2467
+ return v.replace('-', '').toLocaleUpperCase();
2468
+ });
2469
+ return lower(to);
2470
+ }
2471
+ function lower(str) {
2472
+ return str.replace(str[0], str[0].toLowerCase());
2473
+ }
2474
+
2452
2475
  var PREFIX = '[[FORM-CREATE-PREFIX-';
2453
2476
  var SUFFIX = '-FORM-CREATE-SUFFIX]]';
2454
2477
  var $T = '$FN:';
@@ -2676,6 +2699,10 @@ function toProps(rule) {
2676
2699
  var prop = _objectSpread2({}, rule.props || {});
2677
2700
 
2678
2701
  Object.keys(rule.on || {}).forEach(function (k) {
2702
+ if (k.indexOf('-') > 0) {
2703
+ k = toCase(k);
2704
+ }
2705
+
2679
2706
  var name = "on".concat(upper(k));
2680
2707
 
2681
2708
  if (Array.isArray(prop[name])) {
@@ -3365,7 +3392,7 @@ function Api(h) {
3365
3392
  },
3366
3393
  method: function method(id, name) {
3367
3394
  var el = api.el(id);
3368
- if (!el || !el[name]) throw new Error(format('err', "".concat(name, "\u65B9\u6CD5\u4E0D\u5B58\u5728")));
3395
+ if (!el || !el[name]) throw new Error(format('err', "".concat(name, " \u65B9\u6CD5\u4E0D\u5B58\u5728")));
3369
3396
  return function () {
3370
3397
  return el[name].apply(el, arguments);
3371
3398
  };
@@ -3430,6 +3457,11 @@ function Api(h) {
3430
3457
  findRules(ctx ? ctx.loadChildrenPending() : rule.children);
3431
3458
  return rules;
3432
3459
  },
3460
+ getParentRule: function getParentRule(id) {
3461
+ var flag = _typeof(id) === 'object';
3462
+ var ctx = flag ? byCtx(id) : h.getCtx(id);
3463
+ return ctx.parent.rule;
3464
+ },
3433
3465
  getParentSubRule: function getParentSubRule(id) {
3434
3466
  var flag = _typeof(id) === 'object';
3435
3467
  var ctx = flag ? byCtx(id) : h.getCtx(id);
@@ -3517,7 +3549,17 @@ function Api(h) {
3517
3549
  opt = deepCopy(opt);
3518
3550
  opt = h.loadFetchVar(opt);
3519
3551
  h.beforeFetch(opt).then(function () {
3520
- 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
+ });
3521
3563
  });
3522
3564
  });
3523
3565
  },
@@ -3528,8 +3570,14 @@ function Api(h) {
3528
3570
  _opt = h.loadFetchVar(_opt, get);
3529
3571
  h.beforeFetch(_opt).then(function () {
3530
3572
  return asyncFetch(_opt, h.fc.create.fetch).then(function (res) {
3573
+ invoke(function () {
3574
+ return _opt.onSuccess && _opt.onSuccess(res);
3575
+ });
3531
3576
  callback && callback(res, change);
3532
3577
  })["catch"](function (e) {
3578
+ invoke(function () {
3579
+ return _opt.onError && _opt.onError(e);
3580
+ });
3533
3581
  error && error(e);
3534
3582
  });
3535
3583
  });
@@ -3538,8 +3586,8 @@ function Api(h) {
3538
3586
  getData: function getData(id, def) {
3539
3587
  return h.fc.getLoadData(id, def);
3540
3588
  },
3541
- setData: function setData(id, data) {
3542
- return h.fc.setData(id, data);
3589
+ setData: function setData(id, data, isGlobal) {
3590
+ return h.fc.setData(id, data, isGlobal);
3543
3591
  },
3544
3592
  refreshData: function refreshData(id) {
3545
3593
  return h.fc.refreshData(id);
@@ -3612,16 +3660,6 @@ function useCache(Render) {
3612
3660
  });
3613
3661
  }
3614
3662
 
3615
- function toCase(str) {
3616
- var to = str.replace(/(-[a-z])/g, function (v) {
3617
- return v.replace('-', '').toLocaleUpperCase();
3618
- });
3619
- return lower(to);
3620
- }
3621
- function lower(str) {
3622
- return str.replace(str[0], str[0].toLowerCase());
3623
- }
3624
-
3625
3663
  function toString(val) {
3626
3664
  return val == null ? '' : _typeof(val) === 'object' ? JSON.stringify(val, null, 2) : String(val);
3627
3665
  }
@@ -3780,7 +3818,7 @@ function useRender$1(Render) {
3780
3818
  this.setOptions(ctx);
3781
3819
  this.ctxProp(ctx);
3782
3820
  var prop = ctx.prop;
3783
- prop.preview = !!(prop.preview != null ? prop.preview : this.vm.props.preview !== undefined ? this.vm.props.preview : this.options.preview || false);
3821
+ prop.preview = !!(prop.preview != null ? prop.preview : this.$handle.preview);
3784
3822
  prop.props.formCreateInject = this.injectProp(ctx);
3785
3823
  var cacheFlag = prop.cache !== false;
3786
3824
  var preview = prop.preview;
@@ -3933,7 +3971,10 @@ function useRender$1(Render) {
3933
3971
  id: ctx.id,
3934
3972
  field: ctx.field,
3935
3973
  rule: ctx.rule,
3936
- input: ctx.input
3974
+ input: ctx.input,
3975
+ updateValue: function updateValue(data) {
3976
+ _this6.$handle.onUpdateValue(ctx, data);
3977
+ }
3937
3978
  };
3938
3979
  }
3939
3980
 
@@ -5066,11 +5107,23 @@ function useLoader(Handler) {
5066
5107
  }
5067
5108
  });
5068
5109
  });
5069
- hideLst.length && nextTick(function () {
5070
- hideLst.forEach(function (v) {
5071
- return v();
5072
- });
5073
- });
5110
+
5111
+ if (hideLst.length) {
5112
+ if (this.loading) {
5113
+ hideLst.length && this.bus.$once('load-end', function () {
5114
+ hideLst.forEach(function (v) {
5115
+ return v();
5116
+ });
5117
+ });
5118
+ } else {
5119
+ hideLst.length && nextTick(function () {
5120
+ hideLst.forEach(function (v) {
5121
+ return v();
5122
+ });
5123
+ });
5124
+ }
5125
+ }
5126
+
5074
5127
  this.vm.emit('control', ctx.origin, this.api);
5075
5128
  this.effect(ctx, 'control');
5076
5129
  return flag;
@@ -5249,7 +5302,10 @@ function useInput(Handler) {
5249
5302
  this.syncValue();
5250
5303
  },
5251
5304
  appendValue: function appendValue(rule) {
5252
- if (!rule.field || !hasProperty(this.appendData, rule.field)) return;
5305
+ if ((!rule.field || !hasProperty(this.appendData, rule.field)) && !this.options.forceCoverValue) {
5306
+ return;
5307
+ }
5308
+
5253
5309
  rule.value = this.appendData[rule.field];
5254
5310
  delete this.appendData[rule.field];
5255
5311
  },
@@ -5536,123 +5592,155 @@ function useContext(Handler) {
5536
5592
  }
5537
5593
 
5538
5594
  this.bus.$once('load-end', function () {
5539
- var computed = ctx.rule.computed;
5595
+ var computedRule = ctx.rule.computed;
5540
5596
 
5541
- if (!computed) {
5597
+ if (!computedRule) {
5542
5598
  return;
5543
5599
  }
5544
5600
 
5545
- if (_typeof(computed) !== 'object') {
5546
- computed = {
5547
- value: computed
5601
+ if (_typeof(computedRule) !== 'object') {
5602
+ computedRule = {
5603
+ value: computedRule
5548
5604
  };
5549
5605
  }
5550
5606
 
5551
- Object.keys(computed).forEach(function (k) {
5552
- ctx.watch.push(watch(function () {
5553
- var item = computed[k];
5607
+ Object.keys(computedRule).forEach(function (k) {
5608
+ var computedValue = computed(function () {
5609
+ var item = computedRule[k];
5554
5610
  if (!item) return undefined;
5555
- var fn;
5556
-
5557
- if (_typeof(item) === 'object') {
5558
- var group = ctx.getParentGroup();
5611
+ return _this.compute(ctx, item);
5612
+ });
5559
5613
 
5560
- var checkCondition = function checkCondition(item) {
5561
- item = Array.isArray(item) ? {
5562
- mode: 'AND',
5563
- group: item
5564
- } : item;
5614
+ var callback = function callback(n) {
5615
+ if (k === 'value') {
5616
+ _this.onInput(ctx, n);
5617
+ } else if (k[0] === '$') {
5618
+ _this.api.setEffect(ctx.id, k, n);
5619
+ } else {
5620
+ deepSet(ctx.rule, k, n);
5621
+ }
5622
+ };
5565
5623
 
5566
- if (!is.trueArray(item.group)) {
5567
- return true;
5568
- }
5624
+ if (k === 'value' ? [undefined, null, ''].indexOf(ctx.rule.value) > -1 : computedValue.value !== deepGet(ctx.rule, k)) {
5625
+ callback(computedValue.value);
5626
+ }
5569
5627
 
5570
- var or = item.mode === 'OR';
5571
- var valid = true;
5628
+ ctx.watch.push(watch(computedValue, function (n) {
5629
+ setTimeout(function () {
5630
+ callback(n);
5631
+ });
5632
+ }));
5633
+ });
5634
+ });
5635
+ this.watchEffect(ctx);
5636
+ },
5637
+ compute: function compute(ctx, item) {
5638
+ var _this2 = this;
5572
5639
 
5573
- for (var i = 0; i < item.group.length; i++) {
5574
- var one = item.group[i];
5575
- var flag = void 0;
5640
+ var fn;
5576
5641
 
5577
- if (one.mode) {
5578
- flag = checkCondition(one);
5579
- } else if (!condition[one.condition]) {
5580
- flag = false;
5581
- } else {
5582
- 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] || {} : {});
5583
- }
5642
+ if (_typeof(item) === 'object') {
5643
+ var group = ctx.getParentGroup();
5584
5644
 
5585
- if (or && flag) {
5586
- return true;
5587
- }
5645
+ var checkCondition = function checkCondition(item) {
5646
+ item = Array.isArray(item) ? {
5647
+ mode: 'AND',
5648
+ group: item
5649
+ } : item;
5588
5650
 
5589
- if (!or) {
5590
- valid = valid && flag;
5591
- }
5592
- }
5651
+ if (!is.trueArray(item.group)) {
5652
+ return true;
5653
+ }
5593
5654
 
5594
- return or ? false : valid;
5595
- };
5655
+ var or = item.mode === 'OR';
5656
+ var valid = true;
5596
5657
 
5597
- var _val = checkCondition(item);
5658
+ for (var i = 0; i < item.group.length; i++) {
5659
+ var one = item.group[i];
5660
+ var flag = void 0;
5598
5661
 
5599
- return item.invert === true ? !_val : _val;
5600
- } else if (is.Function(item)) {
5601
- fn = function fn() {
5602
- return item(_this.api.form, _this.api);
5603
- };
5662
+ if (one.mode) {
5663
+ flag = checkCondition(one);
5664
+ } else if (!condition[one.condition]) {
5665
+ flag = false;
5604
5666
  } else {
5605
- var _group = ctx.getParentGroup();
5667
+ flag = new Function('$condition', '$val', '$form', '$group', "with($form){with(this){with($group){ return $condition['".concat(one.condition, "'](").concat(one.field, ", ").concat(one.compare ? one.compare : '$val', "); }}}")).call(_this2.api.form, condition, one.value, _this2.api.top.form, group ? _this2.subRuleData[group.id] || {} : {});
5668
+ }
5606
5669
 
5607
- fn = function fn() {
5608
- 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);
5609
- };
5670
+ if (or && flag) {
5671
+ return true;
5610
5672
  }
5611
5673
 
5612
- return invoke(fn, undefined);
5613
- }, function (n) {
5614
- setTimeout(function () {
5615
- if (k === 'value') {
5616
- _this.onInput(ctx, n);
5617
- } else if (k[0] === '$') {
5618
- _this.api.setEffect(ctx.id, k, n);
5619
- } else {
5620
- deepSet(ctx.rule, k, n);
5621
- }
5622
- });
5623
- }, {
5624
- immediate: k === 'value' ? [undefined, null, ''].indexOf(ctx.rule.value) > -1 : true
5625
- }));
5626
- });
5627
- });
5628
- this.watchEffect(ctx);
5674
+ if (!or) {
5675
+ valid = valid && flag;
5676
+ }
5677
+ }
5678
+
5679
+ return or ? false : valid;
5680
+ };
5681
+
5682
+ var val = checkCondition(item);
5683
+ return item.invert === true ? !val : val;
5684
+ } else if (is.Function(item)) {
5685
+ fn = function fn() {
5686
+ return item(_this2.api.form, _this2.api);
5687
+ };
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
+
5709
+ var _group = ctx.getParentGroup();
5710
+
5711
+ fn = function fn() {
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);
5713
+ };
5714
+ }
5715
+
5716
+ return invoke(fn, undefined);
5629
5717
  },
5630
5718
  updateChildren: function updateChildren(ctx, n, o) {
5631
- var _this2 = this;
5719
+ var _this3 = this;
5632
5720
 
5633
5721
  this.deferSyncValue(function () {
5634
5722
  o && o.forEach(function (child) {
5635
5723
  if ((n || []).indexOf(child) === -1 && child && !is.String(child) && child.__fc__ && child.__fc__.parent === ctx) {
5636
- _this2.rmCtx(child.__fc__);
5724
+ _this3.rmCtx(child.__fc__);
5637
5725
  }
5638
5726
  });
5639
5727
 
5640
5728
  if (is.trueArray(n)) {
5641
- _this2.loadChildren(n, ctx);
5729
+ _this3.loadChildren(n, ctx);
5642
5730
 
5643
- _this2.bus.$emit('update', _this2.api);
5731
+ _this3.bus.$emit('update', _this3.api);
5644
5732
  }
5645
5733
  });
5646
5734
  },
5647
5735
  rmSub: function rmSub(sub) {
5648
- var _this3 = this;
5736
+ var _this4 = this;
5649
5737
 
5650
5738
  is.trueArray(sub) && sub.forEach(function (r) {
5651
- r && r.__fc__ && _this3.rmCtx(r.__fc__);
5739
+ r && r.__fc__ && _this4.rmCtx(r.__fc__);
5652
5740
  });
5653
5741
  },
5654
5742
  rmCtx: function rmCtx(ctx) {
5655
- var _this4 = this;
5743
+ var _this5 = this;
5656
5744
 
5657
5745
  if (ctx.deleted) return;
5658
5746
  var id = ctx.id,
@@ -5681,19 +5769,19 @@ function useContext(Handler) {
5681
5769
  }
5682
5770
 
5683
5771
  this.deferSyncValue(function () {
5684
- if (!_this4.reloading) {
5772
+ if (!_this5.reloading) {
5685
5773
  if (ctx.parser.loadChildren !== false) {
5686
5774
  var children = ctx.getPending('children', ctx.rule.children);
5687
5775
 
5688
5776
  if (is.trueArray(children)) {
5689
5777
  children.forEach(function (h) {
5690
- return h.__fc__ && _this4.rmCtx(h.__fc__);
5778
+ return h.__fc__ && _this5.rmCtx(h.__fc__);
5691
5779
  });
5692
5780
  }
5693
5781
  }
5694
5782
 
5695
- if (ctx.root === _this4.rules) {
5696
- _this4.vm.setupState.renderRule();
5783
+ if (ctx.root === _this5.rules) {
5784
+ _this5.vm.setupState.renderRule();
5697
5785
  }
5698
5786
  }
5699
5787
  }, input);
@@ -5930,6 +6018,9 @@ function Handler(fc) {
5930
6018
  },
5931
6019
  bus: function bus() {
5932
6020
  return fc.bus;
6021
+ },
6022
+ preview: function preview() {
6023
+ return fc.vm.props.preview != null ? fc.vm.props.preview : fc.options.value.preview || false;
5933
6024
  }
5934
6025
  });
5935
6026
  extend(this, {
@@ -5977,7 +6068,7 @@ extend(Handler.prototype, {
5977
6068
  });
5978
6069
  },
5979
6070
  init: function init() {
5980
- this.appendData = _objectSpread2(_objectSpread2(_objectSpread2({}, this.options.formData || {}), this.fc.vm.props.modelValue || {}), this.appendData);
6071
+ this.updateAppendData();
5981
6072
  this.useProvider();
5982
6073
  this.usePage();
5983
6074
  this.loadRule();
@@ -5986,6 +6077,9 @@ extend(Handler.prototype, {
5986
6077
 
5987
6078
  this.lifecycle('created');
5988
6079
  },
6080
+ updateAppendData: function updateAppendData() {
6081
+ this.appendData = _objectSpread2(_objectSpread2(_objectSpread2({}, this.options.formData || {}), this.fc.vm.props.modelValue || {}), this.appendData);
6082
+ },
5989
6083
  isBreakWatch: function isBreakWatch() {
5990
6084
  return this.loading || this.noWatchFn || this.reloading;
5991
6085
  },
@@ -6266,13 +6360,21 @@ var loadData = function loadData(fc) {
6266
6360
  var componentValidate = {
6267
6361
  name: 'componentValidate',
6268
6362
  load: function load(attr, rule, api) {
6269
- var method = attr.getValue();
6363
+ var options = attr.getValue();
6270
6364
 
6271
- if (!method) {
6365
+ if (!options || options.method === false) {
6272
6366
  attr.clearProp();
6273
6367
  api.clearValidateState([rule.field]);
6274
6368
  } else {
6275
- attr.getProp().validate = [{
6369
+ if (!is.Object(options)) {
6370
+ options = {
6371
+ method: options
6372
+ };
6373
+ }
6374
+
6375
+ var method = options.method;
6376
+ delete options.method;
6377
+ attr.getProp().validate = [_objectSpread2(_objectSpread2({}, options), {}, {
6276
6378
  validator: function validator() {
6277
6379
  var ctx = byCtx(rule);
6278
6380
 
@@ -6281,14 +6383,14 @@ var componentValidate = {
6281
6383
  args[_key] = arguments[_key];
6282
6384
  }
6283
6385
 
6284
- return api.exec.apply(api, [ctx.id, method === true ? 'formCreateValidate' : method].concat(args, [{
6386
+ return api.exec.apply(api, [ctx.id, is.String(method) ? method : 'formCreateValidate'].concat(args, [{
6285
6387
  attr: attr,
6286
6388
  rule: rule,
6287
6389
  api: api
6288
6390
  }]));
6289
6391
  }
6290
6392
  }
6291
- }];
6393
+ })];
6292
6394
  }
6293
6395
  },
6294
6396
  watch: function watch() {
@@ -6619,7 +6721,7 @@ function FormCreateFactory(config) {
6619
6721
 
6620
6722
  function register() {
6621
6723
  var data = nameProp.apply(void 0, arguments);
6622
- if (data.id && data.prop) providers[data.id] = _objectSpread2(_objectSpread2({}, data.prop), {}, {
6724
+ if (data.id && data.prop) providers[data.id] = is.Function(data.prop) ? data.prop : _objectSpread2(_objectSpread2({}, data.prop), {}, {
6623
6725
  name: data.id
6624
6726
  });
6625
6727
  }
@@ -6765,8 +6867,8 @@ function FormCreateFactory(config) {
6765
6867
  }
6766
6868
  }
6767
6869
 
6768
- function setData(id, data) {
6769
- loadData[id] = data;
6870
+ function _setData(id, data) {
6871
+ deepSet(loadData, id, data);
6770
6872
  refreshData(id);
6771
6873
  }
6772
6874
 
@@ -6782,7 +6884,8 @@ function FormCreateFactory(config) {
6782
6884
  };
6783
6885
 
6784
6886
  callback._driver = true;
6785
- setData(id, callback);
6887
+
6888
+ _setData(id, callback);
6786
6889
  }
6787
6890
 
6788
6891
  function getData(id, def) {
@@ -6843,8 +6946,6 @@ function FormCreateFactory(config) {
6843
6946
  },
6844
6947
  drivers: drivers,
6845
6948
  renderDriver: null,
6846
- setData: setData,
6847
- getData: getData,
6848
6949
  refreshData: refreshData,
6849
6950
  loadData: loadData,
6850
6951
  CreateNode: CreateNode,
@@ -6852,7 +6953,8 @@ function FormCreateFactory(config) {
6852
6953
  unwatch: [],
6853
6954
  options: ref({}),
6854
6955
  extendApiFn: extendApiFn,
6855
- fetchCache: new WeakMap()
6956
+ fetchCache: new WeakMap(),
6957
+ tmpData: {}
6856
6958
  });
6857
6959
  listener.forEach(function (item) {
6858
6960
  _this.bus.$on(item.name, item.callback);
@@ -7040,6 +7142,14 @@ function FormCreateFactory(config) {
7040
7142
  }
7041
7143
  }
7042
7144
  },
7145
+ setData: function setData(id, data, isGlobal) {
7146
+ if (!isGlobal) {
7147
+ deepSet(this.vm.setupState.top.setupState.fc.tmpData, id, data);
7148
+ this.bus.$emit('$loadData.' + id);
7149
+ } else {
7150
+ _setData(id, data);
7151
+ }
7152
+ },
7043
7153
  getLoadData: function getLoadData(id, def) {
7044
7154
  var val = null;
7045
7155
 
@@ -7060,11 +7170,12 @@ function FormCreateFactory(config) {
7060
7170
  val = this.globalVarDriver(split.join('.'));
7061
7171
  split = [];
7062
7172
  } else {
7063
- val = getData(id, def);
7173
+ var tmpData = this.vm.setupState.top.setupState.fc.tmpData;
7174
+ val = hasProperty(tmpData, key) ? deepGet(tmpData, id) : getData(key);
7064
7175
  split = [];
7065
7176
  }
7066
7177
 
7067
- if (split.length) {
7178
+ if (val && split.length) {
7068
7179
  val = deepGet(val, split);
7069
7180
  }
7070
7181
  }
@@ -7093,14 +7204,10 @@ function FormCreateFactory(config) {
7093
7204
  var key = split.shift();
7094
7205
  var key2 = split.shift() || '';
7095
7206
  var callback = debounce(function () {
7096
- if (key !== id) {
7097
- var temp = _this6.getLoadData(id, def);
7207
+ var temp = _this6.getLoadData(id, def);
7098
7208
 
7099
- if (JSON.stringify(temp) !== JSON.stringify(unwatch[id].val)) {
7100
- unwatch[id].val = temp;
7101
- run(true);
7102
- }
7103
- } else {
7209
+ if (JSON.stringify(temp) !== JSON.stringify(unwatch[id].val)) {
7210
+ unwatch[id].val = temp;
7104
7211
  run(true);
7105
7212
  }
7106
7213
  }, 0);
@@ -7200,6 +7307,7 @@ function FormCreateFactory(config) {
7200
7307
  listener.forEach(function (item) {
7201
7308
  _this7.bus.$off(item.name, item.callback);
7202
7309
  });
7310
+ this.tmpData = {};
7203
7311
  this.unwatch.forEach(function (fn) {
7204
7312
  return fn();
7205
7313
  });
@@ -7222,7 +7330,7 @@ function FormCreateFactory(config) {
7222
7330
  extendApi: extendApi,
7223
7331
  getData: getData,
7224
7332
  setDataDriver: setDataDriver,
7225
- setData: setData,
7333
+ setData: _setData,
7226
7334
  removeData: removeData,
7227
7335
  refreshData: refreshData,
7228
7336
  maker: maker,
@@ -7640,7 +7748,7 @@ var manager = {
7640
7748
  e.preventDefault();
7641
7749
  }
7642
7750
  },
7643
- "class": [form.className, form["class"], 'form-create', this.options.preview ? 'is-preview' : ''],
7751
+ "class": [form.className, form["class"], 'form-create', this.$handle.preview ? 'is-preview' : ''],
7644
7752
  style: form.style,
7645
7753
  type: 'form'
7646
7754
  };
@@ -7654,13 +7762,13 @@ var manager = {
7654
7762
  ref: ref
7655
7763
  });
7656
7764
  extend(this.rule.props, {
7657
- model: $handle.formData
7765
+ model: _objectSpread2({}, $handle.formData)
7658
7766
  });
7659
7767
  },
7660
7768
  render: function render(children) {
7661
7769
  var _this2 = this;
7662
7770
 
7663
- if (children.slotLen() && !this.options.preview) {
7771
+ if (children.slotLen() && !this.$handle.preview) {
7664
7772
  children.setSlot(undefined, function () {
7665
7773
  return _this2.makeFormBtn();
7666
7774
  });
@@ -8203,7 +8311,7 @@ function install(FormCreate) {
8203
8311
  function elmFormCreate() {
8204
8312
  return FormCreateFactory({
8205
8313
  ui: 'element-ui',
8206
- version: '3.2.8',
8314
+ version: '3.2.10',
8207
8315
  manager: manager,
8208
8316
  extendApi: extendApi,
8209
8317
  install: install,