@form-create/element-ui 2.5.22 → 2.5.25

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 v2.5.22
2
+ * @form-create/element-ui v2.5.25
3
3
  * (c) 2018-2022 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
@@ -307,10 +307,11 @@
307
307
  render: function render() {
308
308
  var _this2 = this;
309
309
  var h = arguments[0];
310
- return h("ElCheckboxGroup", helper([{}, this.formCreateInject.prop, {
311
- "attrs": {
312
- "value": this.trueValue
313
- },
310
+ return h("ElCheckboxGroup", helper([{}, this.formCreateInject.prop, {}, {
311
+ "props": {
312
+ value: this.trueValue
313
+ }
314
+ }, {
314
315
  "on": {
315
316
  "input": this.onInput
316
317
  }
@@ -318,10 +319,11 @@
318
319
  var props = _objectSpread2({}, opt);
319
320
  var Type = _this2.type === 'button' ? 'ElCheckboxButton' : 'ElCheckbox';
320
321
  delete props.value;
321
- return h(Type, {
322
- "props": _objectSpread2({}, props),
323
- "key": Type + index + opt.value
324
- });
322
+ return h(Type, helper([{}, {
323
+ "props": props
324
+ }, {
325
+ "key": Type + index + '-' + opt.value
326
+ }]));
325
327
  }), getSlot(this.$slots)]);
326
328
  }
327
329
  };
@@ -762,36 +764,37 @@
762
764
  });
763
765
  return h("div", {
764
766
  "class": "_fc-frame"
765
- }, [node, h("el-dialog", {
766
- "attrs": {
767
- "appendToBody": true,
768
- "modal": this.previewMask,
769
- "title": modalTitle,
770
- "visible": this.previewVisible
771
- },
767
+ }, [node, h("el-dialog", helper([{}, {
768
+ "props": {
769
+ appendToBody: true,
770
+ modal: this.previewMask,
771
+ title: modalTitle,
772
+ visible: this.previewVisible
773
+ }
774
+ }, {
772
775
  "on": {
773
776
  "close": this.handleCancel
774
777
  }
775
- }, [h("img", {
778
+ }]), [h("img", {
776
779
  "style": "width: 100%",
777
780
  "attrs": {
778
781
  "src": this.previewImage
779
782
  }
780
- })]), h("el-dialog", {
781
- "attrs": {
782
- "appendToBody": true,
783
- "visible": this.frameVisible
784
- },
785
- "props": _objectSpread2({}, _objectSpread2({
783
+ })]), h("el-dialog", helper([{}, {
784
+ "props": _objectSpread2(_objectSpread2({
786
785
  width: width,
787
- title: title
788
- }, this.modal)),
786
+ title: title,
787
+ appendToBody: true
788
+ }, this.modal), {}, {
789
+ visible: this.frameVisible
790
+ })
791
+ }, {
789
792
  "on": {
790
793
  "close": function close() {
791
794
  return _this9.closeModel(true);
792
795
  }
793
796
  }
794
- }, [this.frameVisible || !this.reload ? h("iframe", {
797
+ }]), [this.frameVisible || !this.reload ? h("iframe", {
795
798
  "ref": "frame",
796
799
  "attrs": {
797
800
  "src": src,
@@ -863,10 +866,11 @@
863
866
  render: function render() {
864
867
  var _this2 = this;
865
868
  var h = arguments[0];
866
- return h("ElRadioGroup", helper([{}, this.formCreateInject.prop, {
867
- "attrs": {
868
- "value": this.trueValue
869
- },
869
+ return h("ElRadioGroup", helper([{}, this.formCreateInject.prop, {}, {
870
+ "props": {
871
+ value: this.trueValue
872
+ }
873
+ }, {
870
874
  "on": {
871
875
  "input": this.onInput
872
876
  }
@@ -874,10 +878,11 @@
874
878
  var props = _objectSpread2({}, opt);
875
879
  var Type = _this2.type === 'button' ? 'ElRadioButton' : 'ElRadio';
876
880
  delete props.value;
877
- return h(Type, {
878
- "props": _objectSpread2({}, props),
879
- "key": Type + index + opt.value
880
- });
881
+ return h(Type, helper([{}, {
882
+ "props": props
883
+ }, {
884
+ "key": Type + index + '-' + opt.value
885
+ }]));
881
886
  }), getSlot(this.$slots)]);
882
887
  }
883
888
  };
@@ -936,10 +941,11 @@
936
941
  var options = ctx.props.formCreateInject.options;
937
942
  return h("ElSelect", helper([{}, ctx.data]), [(Array.isArray(options) ? options : []).map(function (props, index) {
938
943
  var slot = props.slot;
939
- return h("ElOption", {
940
- "props": _objectSpread2({}, props),
941
- "key": '' + index + props.value
942
- }, [slot ? h("template", {
944
+ return h("ElOption", helper([{}, {
945
+ "props": props
946
+ }, {
947
+ "key": '' + index + '-' + props.value
948
+ }]), [slot ? h("template", {
943
949
  "slot": props.slotName || 'default'
944
950
  }, [is.Function(slot) ? props.slot(h) : slot]) : null]);
945
951
  }), ctx.children]);
@@ -1240,17 +1246,18 @@
1240
1246
  }
1241
1247
  return h("div", {
1242
1248
  "class": '_fc-upload'
1243
- }, [[this.formCreateInject.prop.props.showFileList ? [] : this.makeFiles(), this.makeUpload()], h("el-dialog", {
1244
- "attrs": {
1245
- "appendToBody": true,
1246
- "modal": this.previewMask,
1247
- "title": this.modalTitle,
1248
- "visible": this.previewVisible
1249
- },
1249
+ }, [[this.formCreateInject.prop.props.showFileList ? [] : this.makeFiles(), this.makeUpload()], h("el-dialog", helper([{}, {
1250
+ "props": {
1251
+ appendToBody: true,
1252
+ modal: this.previewMask,
1253
+ title: this.modalTitle,
1254
+ visible: this.previewVisible
1255
+ }
1256
+ }, {
1250
1257
  "on": {
1251
1258
  "close": this.handleCancel
1252
1259
  }
1253
- }, [h("img", {
1260
+ }]), [h("img", {
1254
1261
  "attrs": {
1255
1262
  "alt": "example",
1256
1263
  "src": this.previewImage
@@ -1670,10 +1677,7 @@
1670
1677
  "span": button ? 20 : 24
1671
1678
  }
1672
1679
  }, [h("ElFormItem", [h(Type, helper([{
1673
- "key": key,
1674
- "attrs": {
1675
- "inFor": true
1676
- }
1680
+ "key": key
1677
1681
  }, {
1678
1682
  "on": {
1679
1683
  'update:value': function updateValue(formData) {
@@ -1689,20 +1693,21 @@
1689
1693
  return _this9.add$f(index, key, $f);
1690
1694
  }
1691
1695
  }
1692
- }, {
1693
- "attrs": {
1694
- "value": _this9.field ? _defineProperty({}, _this9.field, _this9._value(_this9.value[index])) : _this9.value[index],
1695
- "rule": rule,
1696
- "option": options,
1697
- "extendOption": true
1696
+ }, {}, {
1697
+ "props": {
1698
+ value: _this9.field ? _defineProperty({}, _this9.field, _this9._value(_this9.value[index])) : _this9.value[index],
1699
+ rule: rule,
1700
+ option: options,
1701
+ extendOption: true,
1702
+ inFor: true
1698
1703
  }
1699
- }]))])]), button ? h("ElCol", {
1700
- "attrs": {
1701
- "span": 2,
1702
- "pull": 1,
1703
- "push": 1
1704
+ }]))])]), button ? h("ElCol", helper([{}, {
1705
+ "props": {
1706
+ span: 2,
1707
+ pull: 1,
1708
+ push: 1
1704
1709
  }
1705
- }, [_this9.makeIcon(keys.length, index, key)]) : null]);
1710
+ }]), [_this9.makeIcon(keys.length, index, key)]) : null]);
1706
1711
  })]);
1707
1712
  }
1708
1713
  };
@@ -1803,11 +1808,11 @@
1803
1808
  'emit-event': this.emitEvent,
1804
1809
  input: this.add$f
1805
1810
  }
1806
- }, {
1807
- "attrs": {
1808
- "rule": rule,
1809
- "option": options,
1810
- "extendOption": true
1811
+ }, {}, {
1812
+ "props": {
1813
+ rule: rule,
1814
+ option: options,
1815
+ extendOption: true
1811
1816
  }
1812
1817
  }]));
1813
1818
  }
@@ -2560,7 +2565,6 @@
2560
2565
  h.getCtxs(field).forEach(function (ctx) {
2561
2566
  h.$render.clearCache(ctx);
2562
2567
  ctx.rule.value = copy(ctx.defaultValue);
2563
- h.refreshControl(ctx);
2564
2568
  });
2565
2569
  });
2566
2570
  },
@@ -2664,8 +2668,11 @@
2664
2668
  },
2665
2669
  getCache: function getCache(ctx) {
2666
2670
  var cache = this.cache[ctx.id];
2667
- cache.use = true;
2668
- return cache.vnode;
2671
+ if (cache) {
2672
+ cache.use = true;
2673
+ return cache.vnode;
2674
+ }
2675
+ return undefined;
2669
2676
  }
2670
2677
  });
2671
2678
  }
@@ -3697,6 +3704,7 @@
3697
3704
  if (_ret === "continue") continue;
3698
3705
  }
3699
3706
  if (!validate.length) return false;
3707
+ var hideLst = [];
3700
3708
  var flag = false;
3701
3709
  this.deferSyncValue(function () {
3702
3710
  validate.reverse().forEach(function (_ref) {
@@ -3713,7 +3721,7 @@
3713
3721
  children: rule,
3714
3722
  valid: valid
3715
3723
  }) : ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl), 1);
3716
- _this7.vm.$nextTick(function () {
3724
+ hideLst[valid ? 'push' : 'unshift'](function () {
3717
3725
  _this7.api.hidden(!valid, rule);
3718
3726
  });
3719
3727
  return;
@@ -3743,6 +3751,11 @@
3743
3751
  }
3744
3752
  });
3745
3753
  });
3754
+ hideLst.length && this.vm.$nextTick(function () {
3755
+ hideLst.forEach(function (v) {
3756
+ return v();
3757
+ });
3758
+ });
3746
3759
  this.vm.$emit('control', ctx.origin, this.api);
3747
3760
  this.effect(ctx, 'control');
3748
3761
  return flag;
@@ -4128,9 +4141,11 @@
4128
4141
  $del(this.formData, id);
4129
4142
  $del(this.subForm, id);
4130
4143
  $del(ctx, 'cacheValue');
4131
- input && $del(this.form, field);
4132
4144
  input && this.rmIdCtx(ctx, field, 'field');
4133
4145
  name && this.rmIdCtx(ctx, name, 'name');
4146
+ if (input && !hasProperty(this.fieldCtx, field)) {
4147
+ $del(this.form, field);
4148
+ }
4134
4149
  this.deferSyncValue(function () {
4135
4150
  if (!_this3.reloading) {
4136
4151
  if (ctx.parser.loadChildren !== false) {
@@ -4591,7 +4606,8 @@
4591
4606
  }
4592
4607
  }, val);
4593
4608
  if (!validate.message) {
4594
- validate.message = rule.title + ' is required';
4609
+ var title = rule.title || '';
4610
+ validate.message = ((_typeof(title) === 'object' ? title.title : title) || '') + '不能为空';
4595
4611
  }
4596
4612
  inject.getProp().validate = [validate];
4597
4613
  }
@@ -4661,9 +4677,13 @@
4661
4677
  return fetch(_objectSpread2(_objectSpread2({}, option), {}, {
4662
4678
  onSuccess: function onSuccess(body) {
4663
4679
  if (check()) return;
4664
- set((option.parse || function (v) {
4680
+ var fn = function fn(v) {
4665
4681
  return v.data;
4666
- })(body, rule, api));
4682
+ };
4683
+ if (is.Function(option.parse)) {
4684
+ fn = option.parse;
4685
+ }
4686
+ set(fn(body, rule, api));
4667
4687
  api.sync(rule);
4668
4688
  },
4669
4689
  onError: function onError(e) {
@@ -5787,7 +5807,7 @@
5787
5807
  function elmFormCreate() {
5788
5808
  return FormCreateFactory({
5789
5809
  ui: "".concat("element-ui"),
5790
- version: "".concat("2.5.22"),
5810
+ version: "".concat("2.5.25"),
5791
5811
  manager: manager,
5792
5812
  extendApi: extendApi,
5793
5813
  install: install,