@form-create/element-ui 3.1.5 → 3.1.8

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.1.4
2
+ * @form-create/element-ui v3.1.8
3
3
  * (c) 2018-2022 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
@@ -1499,6 +1499,26 @@
1499
1499
  },
1500
1500
  emits: ['update:modelValue', 'change', 'itemMounted', 'remove'],
1501
1501
  watch: {
1502
+ rule: {
1503
+ handler: function handler(n, o) {
1504
+ var _this = this;
1505
+
1506
+ Object.keys(this.cacheRule).forEach(function (v) {
1507
+ var item = _this.cacheRule[v];
1508
+
1509
+ if (n === o) {
1510
+ deepExtend(item.rule, n);
1511
+ } else {
1512
+ var val = item.$f.formData();
1513
+ item.$f.once('reloading', function () {
1514
+ item.$f.setValue(val);
1515
+ });
1516
+ item.rule = deepCopy(n);
1517
+ }
1518
+ });
1519
+ },
1520
+ deep: true
1521
+ },
1502
1522
  disabled: function disabled(n) {
1503
1523
  if (this.syncDisabled) {
1504
1524
  var lst = this.cacheRule;
@@ -1516,7 +1536,7 @@
1516
1536
  },
1517
1537
  modelValue: {
1518
1538
  handler: function handler(n) {
1519
- var _this = this;
1539
+ var _this2 = this;
1520
1540
 
1521
1541
  n = n || [];
1522
1542
  var keys = Object.keys(this.cacheRule),
@@ -1539,7 +1559,7 @@
1539
1559
  }
1540
1560
 
1541
1561
  n.forEach(function (val, i) {
1542
- _this.setValue(keys[i], n[i]);
1562
+ _this2.setValue(keys[i], n[i]);
1543
1563
  });
1544
1564
  }
1545
1565
  },
@@ -1558,7 +1578,7 @@
1558
1578
  this.$emit('change', value);
1559
1579
  },
1560
1580
  formData: function formData(key, _formData) {
1561
- var _this2 = this;
1581
+ var _this3 = this;
1562
1582
 
1563
1583
  var cacheRule = this.cacheRule;
1564
1584
  var keys = Object.keys(cacheRule);
@@ -1570,10 +1590,10 @@
1570
1590
  }
1571
1591
 
1572
1592
  var value = keys.map(function (k) {
1573
- var data = key === k ? _formData : _objectSpread2({}, _this2.cacheRule[k].$f.form);
1574
- var value = _this2.field ? data[_this2.field] || null : data;
1593
+ var data = key === k ? _formData : _objectSpread2({}, _this3.cacheRule[k].$f.form);
1594
+ var value = _this3.field ? data[_this3.field] || null : data;
1575
1595
 
1576
- _this2.cache(k, value);
1596
+ _this3.cache(k, value);
1577
1597
 
1578
1598
  return value;
1579
1599
  });
@@ -1593,7 +1613,7 @@
1593
1613
  this.cache(key, value);
1594
1614
  },
1595
1615
  addRule: function addRule(i, emit) {
1596
- var _this3 = this;
1616
+ var _this4 = this;
1597
1617
 
1598
1618
  var rule = this.formCreateInject.form.copyRules(this.rule || []);
1599
1619
  var options = this.options ? _objectSpread2({}, this.options) : {
@@ -1614,25 +1634,25 @@
1614
1634
 
1615
1635
  if (emit) {
1616
1636
  vue.nextTick(function () {
1617
- return _this3.$emit('add', rule, Object.keys(_this3.cacheRule).length - 1);
1637
+ return _this4.$emit('add', rule, Object.keys(_this4.cacheRule).length - 1);
1618
1638
  });
1619
1639
  }
1620
1640
  },
1621
1641
  add$f: function add$f(i, key, $f) {
1622
- var _this4 = this;
1642
+ var _this5 = this;
1623
1643
 
1624
1644
  this.cacheRule[key].$f = $f;
1625
1645
  this.formData(key, $f.formData());
1626
1646
  vue.nextTick(function () {
1627
- if (_this4.syncDisabled) {
1628
- $f.disabled(_this4.disabled);
1647
+ if (_this5.syncDisabled) {
1648
+ $f.disabled(_this5.disabled);
1629
1649
  }
1630
1650
 
1631
- _this4.$emit('itemMounted', $f, Object.keys(_this4.cacheRule).indexOf(key));
1651
+ _this5.$emit('itemMounted', $f, Object.keys(_this5.cacheRule).indexOf(key));
1632
1652
  });
1633
1653
  },
1634
1654
  removeRule: function removeRule(key, emit) {
1635
- var _this5 = this;
1655
+ var _this6 = this;
1636
1656
 
1637
1657
  var index = Object.keys(this.cacheRule).indexOf(key);
1638
1658
  delete this.cacheRule[key];
@@ -1640,7 +1660,7 @@
1640
1660
 
1641
1661
  if (emit) {
1642
1662
  vue.nextTick(function () {
1643
- return _this5.$emit('remove', index);
1663
+ return _this6.$emit('remove', index);
1644
1664
  });
1645
1665
  }
1646
1666
  },
@@ -1673,14 +1693,14 @@
1673
1693
  });
1674
1694
  },
1675
1695
  delIcon: function delIcon(index, key) {
1676
- var _this6 = this;
1696
+ var _this7 = this;
1677
1697
 
1678
1698
  return vue.createVNode(vue.resolveComponent("ElIcon"), {
1679
1699
  "key": "d".concat(key),
1680
1700
  "class": "el-icon-remove-outline",
1681
1701
  "style": "font-size:".concat(this.fontSize, "px;cursor:").concat(this.disabled ? 'not-allowed;color:#c9cdd4' : 'pointer;color:#606266', ";"),
1682
1702
  "onClick": function onClick() {
1683
- return _this6.del(index, key);
1703
+ return _this7.del(index, key);
1684
1704
  }
1685
1705
  }, {
1686
1706
  "default": function _default() {
@@ -1689,7 +1709,7 @@
1689
1709
  });
1690
1710
  },
1691
1711
  makeIcon: function makeIcon(total, index, key) {
1692
- var _this7 = this;
1712
+ var _this8 = this;
1693
1713
 
1694
1714
  if (this.$slots.button) {
1695
1715
  return this.$slots.button({
@@ -1698,7 +1718,7 @@
1698
1718
  vm: this,
1699
1719
  key: key,
1700
1720
  del: function del() {
1701
- return _this7.del(index, key);
1721
+ return _this8.del(index, key);
1702
1722
  },
1703
1723
  add: this.add
1704
1724
  });
@@ -1733,7 +1753,7 @@
1733
1753
  }
1734
1754
  },
1735
1755
  render: function render() {
1736
- var _this8 = this;
1756
+ var _this9 = this;
1737
1757
 
1738
1758
  var keys = Object.keys(this.cacheRule);
1739
1759
  var button = this.button;
@@ -1754,9 +1774,9 @@
1754
1774
  }, [keys.map(function (key, index) {
1755
1775
  var _slot;
1756
1776
 
1757
- var _this8$cacheRule$key = _this8.cacheRule[key],
1758
- rule = _this8$cacheRule$key.rule,
1759
- options = _this8$cacheRule$key.options;
1777
+ var _this9$cacheRule$key = _this9.cacheRule[key],
1778
+ rule = _this9$cacheRule$key.rule,
1779
+ options = _this9$cacheRule$key.options;
1760
1780
  return vue.createVNode(vue.resolveComponent("ElRow"), {
1761
1781
  "align": "middle",
1762
1782
  "type": "flex",
@@ -1774,18 +1794,18 @@
1774
1794
  "key": key,
1775
1795
  "inFor": true,
1776
1796
  "onUpdate:modelValue": function onUpdateModelValue(formData) {
1777
- return _this8.formData(key, formData);
1797
+ return _this9.formData(key, formData);
1778
1798
  },
1779
- "modelValue": _this8.field ? _defineProperty({}, _this8.field, _this8._value(_this8.modelValue[index])) : _this8.modelValue[index],
1799
+ "modelValue": _this9.field ? _defineProperty({}, _this9.field, _this9._value(_this9.modelValue[index])) : _this9.modelValue[index],
1780
1800
  "onEmit-event": function onEmitEvent(name) {
1781
1801
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1782
1802
  args[_key - 1] = arguments[_key];
1783
1803
  }
1784
1804
 
1785
- return _this8.emitEvent(name, args, index, key);
1805
+ return _this9.emitEvent(name, args, index, key);
1786
1806
  },
1787
1807
  "onUpdate:api": function onUpdateApi($f) {
1788
- return _this8.add$f(index, key, $f);
1808
+ return _this9.add$f(index, key, $f);
1789
1809
  },
1790
1810
  "rule": rule,
1791
1811
  "option": options,
@@ -1798,7 +1818,7 @@
1798
1818
  "span": 2,
1799
1819
  "pull": 1,
1800
1820
  "push": 1
1801
- }, _isSlot(_slot = _this8.makeIcon(keys.length, index, key)) ? _slot : {
1821
+ }, _isSlot(_slot = _this9.makeIcon(keys.length, index, key)) ? _slot : {
1802
1822
  "default": function _default() {
1803
1823
  return [_slot];
1804
1824
  }
@@ -1923,7 +1943,7 @@
1923
1943
  var NAME$1 = 'FormCreate';
1924
1944
 
1925
1945
  var getRuleInject = function getRuleInject(vm, parent) {
1926
- if (vm === parent) {
1946
+ if (!vm || vm === parent) {
1927
1947
  return;
1928
1948
  }
1929
1949
 
@@ -1984,7 +2004,7 @@
1984
2004
  isShow: true,
1985
2005
  unique: 1,
1986
2006
  renderRule: _toConsumableArray(rule.value || []),
1987
- updateValue: JSON.stringify(modelValue)
2007
+ updateValue: JSON.stringify(modelValue || {})
1988
2008
  });
1989
2009
  var fc = new FormCreate(vm);
1990
2010
  var fapi = fc.api();
@@ -2156,7 +2176,7 @@
2156
2176
  };
2157
2177
  };
2158
2178
 
2159
- var keyAttrs = ['type', 'slot', 'emitPrefix', 'value', 'name', 'native', 'hidden', 'display', 'inject', 'options', 'emit', 'link', 'prefix', 'suffix', 'update', 'sync', 'optionsTo', 'key', 'slotUpdate'];
2179
+ var keyAttrs = ['type', 'slot', 'emitPrefix', 'value', 'name', 'native', 'hidden', 'display', 'inject', 'options', 'emit', 'link', 'prefix', 'suffix', 'update', 'sync', 'optionsTo', 'key', 'slotUpdate', 'computed', 'preview', 'component', 'cache'];
2160
2180
  var arrayAttrs = ['validate', 'children', 'control'];
2161
2181
  var normalAttrs = ['effect'];
2162
2182
  function attrs() {
@@ -2544,7 +2564,7 @@
2544
2564
  if (!ctx) return initial;
2545
2565
  initial[ctx.field] = copy(ctx.rule.value);
2546
2566
  return initial;
2547
- }, copy(h.appendData));
2567
+ }, {});
2548
2568
  },
2549
2569
  getValue: function getValue(field) {
2550
2570
  var ctx = h.getFieldCtx(field);
@@ -3075,7 +3095,6 @@
3075
3095
  try {
3076
3096
  if (ctx.type === 'hidden') return;
3077
3097
  var rule = ctx.rule;
3078
- var preview = this.options.preview || false;
3079
3098
 
3080
3099
  if (!this.cache[ctx.id] || this.cache[ctx.id].slot !== rule.slot) {
3081
3100
  var vn;
@@ -3087,7 +3106,10 @@
3087
3106
  this.setOptions(ctx);
3088
3107
  this.ctxProp(ctx);
3089
3108
  var prop = ctx.prop;
3109
+ prop.preview = !!(hasProperty(prop, 'preview') ? prop.preview : this.options.preview || false);
3090
3110
  prop.props.formCreateInject = this.injectProp(ctx);
3111
+ var cacheFlag = prop.cache !== false;
3112
+ var preview = prop.preview;
3091
3113
 
3092
3114
  if (prop.hidden) {
3093
3115
  this.setCache(ctx, undefined, parent);
@@ -3145,18 +3167,20 @@
3145
3167
  _vn = _this4.display(_vn);
3146
3168
  }
3147
3169
 
3148
- _this4.setCache(ctx, function () {
3170
+ cacheFlag && _this4.setCache(ctx, function () {
3149
3171
  return _vn;
3150
3172
  }, parent);
3151
-
3152
3173
  return _vn;
3153
3174
  };
3154
3175
 
3155
3176
  this.setCache(ctx, vn, parent);
3156
- return vn;
3157
3177
  }
3158
3178
 
3159
- return this.getCache(ctx);
3179
+ return function () {
3180
+ var cache = _this4.getCache(ctx);
3181
+
3182
+ return cache && cache.apply(void 0, arguments);
3183
+ };
3160
3184
  } catch (e) {
3161
3185
  console.error(e);
3162
3186
  return;
@@ -3223,7 +3247,7 @@
3223
3247
 
3224
3248
  var inject = state.ctxInject[ctx.id];
3225
3249
  extend(inject, {
3226
- preview: this.options.preview || false,
3250
+ preview: ctx.prop.preview,
3227
3251
  options: ctx.prop.options,
3228
3252
  children: ctx.loadChildrenPending()
3229
3253
  });
@@ -3301,6 +3325,7 @@
3301
3325
  },
3302
3326
  defaultRender: function defaultRender(ctx, children) {
3303
3327
  var prop = ctx.prop;
3328
+ if (prop.component) return this.vNode.makeComponent(prop.component, prop, children);
3304
3329
  if (this.vNode[ctx.type]) return this.vNode[ctx.type](prop, children);
3305
3330
  if (this.vNode[ctx.originType]) return this.vNode[ctx.originType](prop, children);
3306
3331
  return this.vNode.make(lower(ctx.originType), prop, children);
@@ -3775,11 +3800,7 @@
3775
3800
  this.$handle.appendLink(this);
3776
3801
  },
3777
3802
  watchTo: function watchTo() {
3778
- var _this4 = this;
3779
-
3780
- vue.nextTick(function () {
3781
- _this4.$handle && _this4.$handle.watchCtx(_this4);
3782
- });
3803
+ this.$handle.watchCtx(this);
3783
3804
  },
3784
3805
  "delete": function _delete() {
3785
3806
  var undef = void 0;
@@ -3808,15 +3829,15 @@
3808
3829
  this.ctrlRule = [];
3809
3830
  },
3810
3831
  rm: function rm() {
3811
- var _this5 = this;
3832
+ var _this4 = this;
3812
3833
 
3813
3834
  var _rm = function _rm() {
3814
- var index = _this5.root.indexOf(_this5.origin);
3835
+ var index = _this4.root.indexOf(_this4.origin);
3815
3836
 
3816
3837
  if (index > -1) {
3817
- _this5.root.splice(index, 1);
3838
+ _this4.root.splice(index, 1);
3818
3839
 
3819
- _this5.$handle && _this5.$handle.refresh();
3840
+ _this4.$handle && _this4.$handle.refresh();
3820
3841
  }
3821
3842
  };
3822
3843
 
@@ -3827,17 +3848,17 @@
3827
3848
  }
3828
3849
 
3829
3850
  this.$handle.noWatch(function () {
3830
- _this5.$handle.deferSyncValue(function () {
3831
- _this5.rmCtrl();
3851
+ _this4.$handle.deferSyncValue(function () {
3852
+ _this4.rmCtrl();
3832
3853
 
3833
3854
  _rm();
3834
3855
 
3835
- _this5.$handle.rmCtx(_this5);
3856
+ _this4.$handle.rmCtx(_this4);
3836
3857
 
3837
- extend(_this5, {
3858
+ extend(_this4, {
3838
3859
  root: []
3839
3860
  });
3840
- }, _this5.input);
3861
+ }, _this4.input);
3841
3862
  });
3842
3863
  },
3843
3864
  update: function update(handle, init) {
@@ -3941,13 +3962,13 @@
3941
3962
  return _this5.loadRule();
3942
3963
  }
3943
3964
 
3965
+ _this5.syncForm();
3966
+
3944
3967
  if (_this5.pageEnd) {
3945
3968
  _this5.bus.$emit('load-end');
3946
3969
  }
3947
3970
 
3948
3971
  _this5.vm.setupState.renderRule();
3949
-
3950
- _this5.syncForm();
3951
3972
  });
3952
3973
  },
3953
3974
  loadChildren: function loadChildren(children, parent) {
@@ -3962,8 +3983,8 @@
3962
3983
  if (this.cycleLoad) {
3963
3984
  return this.loadRule();
3964
3985
  } else {
3965
- this.bus.$emit('load-end');
3966
3986
  this.syncForm();
3987
+ this.bus.$emit('load-end');
3967
3988
  }
3968
3989
 
3969
3990
  this.$render.clearCache(parent);
@@ -4207,19 +4228,27 @@
4207
4228
  this.clearNextTick();
4208
4229
  this.initData(rules);
4209
4230
  this.fc.rules = rules;
4210
- this.bus.$once('load-end', function () {
4211
- Object.keys(ctxs).filter(function (id) {
4212
- return _this8.ctxs[id] === undefined;
4213
- }).forEach(function (id) {
4214
- return _this8.rmCtx(ctxs[id]);
4231
+ this.deferSyncValue(function () {
4232
+ _this8.bus.$once('load-end', function () {
4233
+ Object.keys(ctxs).filter(function (id) {
4234
+ return _this8.ctxs[id] === undefined;
4235
+ }).forEach(function (id) {
4236
+ return _this8.rmCtx(ctxs[id]);
4237
+ });
4238
+
4239
+ _this8.$render.clearCacheAll();
4215
4240
  });
4216
4241
 
4217
- _this8.$render.clearCacheAll();
4242
+ _this8.reloading = true;
4243
+
4244
+ _this8.loadRule();
4245
+
4246
+ _this8.reloading = false;
4247
+
4248
+ _this8.refresh();
4249
+
4250
+ _this8.bus.$emit('reloading', _this8.api);
4218
4251
  });
4219
- this.reloading = true;
4220
- this.loadRule();
4221
- this.reloading = false;
4222
- this.refresh();
4223
4252
  this.bus.$off('next-tick', this.nextReload);
4224
4253
  this.bus.$once('next-tick', this.nextReload);
4225
4254
  this.bus.$emit('update', this.api);
@@ -4285,28 +4314,14 @@
4285
4314
  syncForm: function syncForm() {
4286
4315
  var _this = this;
4287
4316
 
4317
+ var data = vue.reactive({});
4288
4318
  this.fields().reduce(function (initial, field) {
4289
4319
  var ctx = _this.getCtx(field);
4290
4320
 
4291
4321
  initial[field] = vue.toRef(ctx.rule, 'value');
4292
4322
  return initial;
4293
- }, Object.keys(this.appendData).reduce(function (initial, field) {
4294
- initial[field] = vue.customRef(function (track, trigger) {
4295
- return {
4296
- get: function get() {
4297
- track();
4298
- return _this.appendData[field];
4299
- },
4300
- set: function set(val) {
4301
- trigger();
4302
- _this.appendData[field] = val;
4303
-
4304
- _this.syncValue();
4305
- }
4306
- };
4307
- });
4308
- return initial;
4309
- }, this.form));
4323
+ }, data);
4324
+ this.form = data;
4310
4325
  this.syncValue();
4311
4326
  },
4312
4327
  appendValue: function appendValue(rule) {
@@ -4413,11 +4428,46 @@
4413
4428
  return ctx.$render.defaultRender(ctx, children);
4414
4429
  },
4415
4430
  preview: function preview(children, ctx) {
4416
- return ctx.$render.defaultRender(ctx, children);
4431
+ return this.render(children, ctx);
4417
4432
  },
4418
4433
  mergeProp: function mergeProp(ctx) {}
4419
4434
  };
4420
4435
 
4436
+ var _ = {
4437
+ sum: function sum(arr) {
4438
+ if (Array.isArray(arr)) {
4439
+ var val = 0;
4440
+ arr.map(function (v) {
4441
+ return val += v || 0;
4442
+ });
4443
+ return val;
4444
+ }
4445
+ },
4446
+ column: function column(arr, field) {
4447
+ if (Array.isArray(arr)) {
4448
+ return arr.map(function (v) {
4449
+ return v[field];
4450
+ });
4451
+ }
4452
+
4453
+ return [];
4454
+ },
4455
+ get: function get(obj, field, def) {
4456
+ var lst = field.split('.');
4457
+ var val = obj;
4458
+
4459
+ for (var i = 0; i < lst.length; i++) {
4460
+ if (hasProperty(val, lst[i])) {
4461
+ val = val[lst[i]];
4462
+ } else {
4463
+ return def === undefined ? 0 : def;
4464
+ }
4465
+ }
4466
+
4467
+ return val;
4468
+ }
4469
+ };
4470
+ var noneKey = ['field', 'value', 'vm', 'template', 'name', 'config', 'control', 'inject', 'sync', 'payload', 'optionsTo', 'update', 'slotUpdate', 'computed', 'component', 'cache'];
4421
4471
  function useContext(Handler) {
4422
4472
  extend(Handler.prototype, {
4423
4473
  getCtx: function getCtx(id) {
@@ -4494,10 +4544,9 @@
4494
4544
  watchCtx: function watchCtx(ctx) {
4495
4545
  var _this = this;
4496
4546
 
4497
- var none = ['field', 'value', 'vm', 'template', 'name', 'config', 'control', 'inject', 'sync', 'payload', 'optionsTo', 'update', 'slotUpdate'];
4498
4547
  var all = attrs();
4499
4548
  all.filter(function (k) {
4500
- return k[0] !== '_' && k[0] !== '$' && none.indexOf(k) === -1;
4549
+ return k[0] !== '_' && k[0] !== '$' && noneKey.indexOf(k) === -1;
4501
4550
  }).forEach(function (key) {
4502
4551
  var ref = vue.toRef(ctx.rule, key);
4503
4552
  var flag = key === 'children';
@@ -4560,11 +4609,36 @@
4560
4609
  return val.value;
4561
4610
  }, function () {
4562
4611
  var formValue = ctx.parser.toFormValue(val.value, ctx);
4612
+ formValue = formValue === null ? undefined : formValue;
4563
4613
 
4564
4614
  if (_this.isChange(ctx, formValue)) {
4565
4615
  _this.setValue(ctx, val.value, formValue, true);
4566
4616
  }
4567
4617
  }));
4618
+ this.bus.$once('load-end', function () {
4619
+ var computedRef = vue.toRef(ctx.rule, 'computed');
4620
+ ctx.watch.push(vue.watch(function () {
4621
+ var computed = computedRef.value;
4622
+ if (!computed) return undefined;
4623
+ var fn;
4624
+
4625
+ if (is.Function(computed)) {
4626
+ fn = function fn() {
4627
+ return computed(_this.api.form, _this.api);
4628
+ };
4629
+ } else {
4630
+ fn = function fn() {
4631
+ return new Function('_', "with(this){ return ".concat(computed, " }")).call(_this.api.form, _);
4632
+ };
4633
+ }
4634
+
4635
+ return invoke(fn, undefined);
4636
+ }, function (n) {
4637
+ val.value = n;
4638
+ }, {
4639
+ immediate: !!computedRef.value
4640
+ }));
4641
+ });
4568
4642
  }
4569
4643
 
4570
4644
  this.watchEffect(ctx);
@@ -4605,6 +4679,7 @@
4605
4679
  $del(this.formData, id);
4606
4680
  $del(this.subForm, id);
4607
4681
  $del(this.vm.setupState.ctxInject, id);
4682
+ input && $del(this.form, field);
4608
4683
  input && this.rmIdCtx(ctx, field, 'field');
4609
4684
  name && this.rmIdCtx(ctx, name, 'name');
4610
4685
  this.deferSyncValue(function () {
@@ -5001,6 +5076,14 @@
5001
5076
  make: function make(tag, data, children) {
5002
5077
  return makeDirective(data, this.h(tag, toProps(data), children));
5003
5078
  },
5079
+ makeComponent: function makeComponent(type, data, children) {
5080
+ try {
5081
+ return makeDirective(data, vue.createVNode(type, toProps(data), children));
5082
+ } catch (e) {
5083
+ console.error(e);
5084
+ return vue.createVNode('');
5085
+ }
5086
+ },
5004
5087
  h: function h(tag, data, children) {
5005
5088
  var isNativeTag = vue.getCurrentInstance().appContext.config.isNativeTag(tag);
5006
5089
 
@@ -5417,7 +5500,7 @@
5417
5500
  CreateNode: CreateNode,
5418
5501
  bus: new Mitt(),
5419
5502
  unwatch: null,
5420
- options: vue.ref({}),
5503
+ options: vue.ref(vm.props.option || {}),
5421
5504
  extendApi: config.extendApi || function (api) {
5422
5505
  return api;
5423
5506
  }
@@ -5461,7 +5544,7 @@
5461
5544
  });
5462
5545
  }
5463
5546
 
5464
- this.initOptions(this.vm.props.option || {});
5547
+ this.initOptions(this.options.value);
5465
5548
  this.$handle.init();
5466
5549
  },
5467
5550
  isSub: function isSub() {
@@ -5989,8 +6072,10 @@
5989
6072
  makeInfo: function makeInfo(rule, uni) {
5990
6073
  var _this4 = this;
5991
6074
 
5992
- var titleProp = rule.title;
5993
- var infoProp = rule.info;
6075
+ var titleProp = _objectSpread2({}, rule.title);
6076
+
6077
+ var infoProp = _objectSpread2({}, rule.info);
6078
+
5994
6079
  var isTip = isTooltip(infoProp);
5995
6080
  var form = this.options.form;
5996
6081
  var children = [(titleProp.title || '') + (form.labelSuffix || form['label-suffix'] || '')];
@@ -6004,6 +6089,8 @@
6004
6089
  delete prop.props.icon;
6005
6090
  delete prop.props.show;
6006
6091
  delete prop.props.info;
6092
+ delete prop.props.align;
6093
+ delete prop.props["native"];
6007
6094
  var field = 'content';
6008
6095
 
6009
6096
  if (infoProp.info && !hasProperty(prop.props, field)) {
@@ -6025,11 +6112,16 @@
6025
6112
  })));
6026
6113
  }
6027
6114
 
6028
- return this.$r(mergeProps([titleProp, {
6115
+ var _prop = mergeProps([titleProp, {
6029
6116
  props: titleProp,
6030
6117
  key: "".concat(uni, "tit"),
6031
6118
  type: titleProp.type || 'span'
6032
- }]), children);
6119
+ }]);
6120
+
6121
+ delete _prop.props.show;
6122
+ delete _prop.props.title;
6123
+ delete _prop.props["native"];
6124
+ return this.$r(_prop, children);
6033
6125
  },
6034
6126
  makeCol: function makeCol(rule, uni, children) {
6035
6127
  var col = rule.col;
@@ -6085,6 +6177,9 @@
6085
6177
 
6086
6178
  var innerText = resetBtn.innerText;
6087
6179
  delete resetBtn.innerText;
6180
+ delete resetBtn.click;
6181
+ delete resetBtn.col;
6182
+ delete resetBtn.show;
6088
6183
  return this.$r({
6089
6184
  type: 'button',
6090
6185
  props: resetBtn,
@@ -6094,7 +6189,7 @@
6094
6189
  on: {
6095
6190
  click: function click() {
6096
6191
  var fApi = _this5.$handle.api;
6097
- resetBtn.click ? resetBtn.click(fApi) : fApi.resetFields();
6192
+ _this5.options.resetBtn.click ? _this5.options.resetBtn.click(fApi) : fApi.resetFields();
6098
6193
  }
6099
6194
  },
6100
6195
  key: "".concat(this.key, "b2")
@@ -6107,6 +6202,9 @@
6107
6202
 
6108
6203
  var innerText = submitBtn.innerText;
6109
6204
  delete submitBtn.innerText;
6205
+ delete submitBtn.click;
6206
+ delete submitBtn.col;
6207
+ delete submitBtn.show;
6110
6208
  return this.$r({
6111
6209
  type: 'button',
6112
6210
  props: submitBtn,
@@ -6116,7 +6214,7 @@
6116
6214
  on: {
6117
6215
  click: function click() {
6118
6216
  var fApi = _this6.$handle.api;
6119
- submitBtn.click ? submitBtn.click(fApi) : fApi.submit();
6217
+ _this6.options.submitBtn.click ? _this6.options.submitBtn.click(fApi) : fApi.submit();
6120
6218
  }
6121
6219
  },
6122
6220
  key: "".concat(this.key, "b1")
@@ -6370,17 +6468,17 @@
6370
6468
  var required = {
6371
6469
  name: 'required',
6372
6470
  load: function load(inject, rule, api) {
6373
- var val = parseVa(inject.getValue());
6471
+ var val = parseVal(inject.getValue());
6374
6472
 
6375
6473
  if (val.required === false) {
6376
6474
  inject.clearProp();
6377
6475
  } else {
6378
- var validate = _objectSpread2(_objectSpread2({}, val), {}, {
6476
+ var validate = _objectSpread2({
6379
6477
  required: true,
6380
6478
  validator: function validator(_, v, call) {
6381
6479
  is.empty(v) ? call(validate.message) : call();
6382
6480
  }
6383
- });
6481
+ }, val);
6384
6482
 
6385
6483
  if (!validate.message) {
6386
6484
  validate.message = rule.title + ' is required';
@@ -6396,7 +6494,7 @@
6396
6494
  }
6397
6495
  };
6398
6496
 
6399
- function parseVa(val) {
6497
+ function parseVal(val) {
6400
6498
  if (is.Boolean(val)) {
6401
6499
  return {
6402
6500
  required: val
@@ -6405,6 +6503,10 @@
6405
6503
  return {
6406
6504
  message: val
6407
6505
  };
6506
+ } else if (is.Function(val)) {
6507
+ return {
6508
+ validator: val
6509
+ };
6408
6510
  } else if (!is.Object(val)) {
6409
6511
  return {};
6410
6512
  } else {
@@ -6435,7 +6537,7 @@
6435
6537
  function elmFormCreate() {
6436
6538
  return FormCreateFactory({
6437
6539
  ui: 'element-ui',
6438
- version: '3.1.4',
6540
+ version: '3.1.8',
6439
6541
  manager: manager,
6440
6542
  extendApi: extendApi,
6441
6543
  install: install,