@form-create/iview 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/iview v2.5.22
2
+ * @form-create/iview 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.
@@ -305,20 +305,22 @@
305
305
  },
306
306
  render: function render() {
307
307
  var h = arguments[0];
308
- return h("CheckboxGroup", helper([{}, this.formCreateInject.prop, {
309
- "attrs": {
310
- "value": this.trueValue
311
- },
308
+ return h("CheckboxGroup", helper([{}, this.formCreateInject.prop, {}, {
309
+ "props": {
310
+ value: this.trueValue
311
+ }
312
+ }, {
312
313
  "on": {
313
314
  "input": this.onInput
314
315
  }
315
316
  }]), [this.options().map(function (opt, index) {
316
317
  var props = _objectSpread2({}, opt);
317
318
  delete props.value;
318
- return h("Checkbox", {
319
- "props": _objectSpread2({}, props),
320
- "key": '' + index + opt.value
321
- });
319
+ return h("Checkbox", helper([{}, {
320
+ "props": props
321
+ }, {
322
+ "key": '' + index + '-' + opt.value
323
+ }]));
322
324
  }), getSlot(this.$slots)]);
323
325
  }
324
326
  };
@@ -738,28 +740,30 @@
738
740
  });
739
741
  return h("div", {
740
742
  "class": "_fc-frame"
741
- }, [node, h("Modal", {
742
- "attrs": {
743
- "mask": this.previewMask,
744
- "title": modalTitle,
745
- "footerHide": true
746
- },
743
+ }, [node, h("Modal", helper([{}, {
744
+ "props": {
745
+ mask: this.previewMask,
746
+ title: modalTitle,
747
+ footerHide: true
748
+ }
749
+ }, {
747
750
  "model": {
748
751
  value: _this9.previewVisible,
749
752
  callback: function callback($$v) {
750
753
  _this9.previewVisible = $$v;
751
754
  }
752
755
  }
753
- }, [h("img", {
756
+ }]), [h("img", {
754
757
  "style": "width: 100%",
755
758
  "attrs": {
756
759
  "src": this.previewImage
757
760
  }
758
- })]), h("Modal", {
759
- "props": _objectSpread2({}, _objectSpread2({
761
+ })]), h("Modal", helper([{}, {
762
+ "props": _objectSpread2({
760
763
  width: width,
761
764
  title: title
762
- }, this.modal)),
765
+ }, this.modal)
766
+ }, {
763
767
  "on": {
764
768
  "on-cancel": function onCancel() {
765
769
  return _this9.closeModel(true);
@@ -771,7 +775,7 @@
771
775
  _this9.frameVisible = $$v;
772
776
  }
773
777
  }
774
- }, [this.frameVisible || !this.reload ? h("iframe", {
778
+ }]), [this.frameVisible || !this.reload ? h("iframe", {
775
779
  "ref": "frame",
776
780
  "attrs": {
777
781
  "src": src,
@@ -853,20 +857,22 @@
853
857
  },
854
858
  render: function render() {
855
859
  var h = arguments[0];
856
- return h("RadioGroup", helper([{}, this.formCreateInject.prop, {
857
- "attrs": {
858
- "value": this.trueValue
859
- },
860
+ return h("RadioGroup", helper([{}, this.formCreateInject.prop, {}, {
861
+ "props": {
862
+ value: this.trueValue
863
+ }
864
+ }, {
860
865
  "on": {
861
866
  "input": this.onInput
862
867
  }
863
868
  }]), [this.options().map(function (opt, index) {
864
869
  var props = _objectSpread2({}, opt);
865
870
  delete props.value;
866
- return h("Radio", {
867
- "props": _objectSpread2({}, props),
868
- "key": '' + index + opt.value
869
- });
871
+ return h("Radio", helper([{}, {
872
+ "props": props
873
+ }, {
874
+ "key": '' + index + '-' + opt.value
875
+ }]));
870
876
  }), getSlot(this.$slots)]);
871
877
  }
872
878
  };
@@ -925,10 +931,11 @@
925
931
  var options = ctx.props.formCreateInject.options;
926
932
  return h("Select", helper([{}, ctx.data]), [(Array.isArray(options) ? options : []).map(function (props, index) {
927
933
  var slot = props.slot;
928
- return h("Option", {
929
- "props": _objectSpread2({}, props),
930
- "key": '' + index + props.value
931
- }, [slot ? h("template", {
934
+ return h("Option", helper([{}, {
935
+ "props": props
936
+ }, {
937
+ "key": '' + index + '-' + props.value
938
+ }]), [slot ? h("template", {
932
939
  "slot": props.slotName || 'default'
933
940
  }, [is.Function(slot) ? props.slot(h) : slot]) : null]);
934
941
  }), ctx.children]);
@@ -1218,18 +1225,19 @@
1218
1225
  }
1219
1226
  return h("div", {
1220
1227
  "class": "_fc-upload"
1221
- }, [[this.formCreateInject.prop.props.showUploadList ? [] : this.makeFiles(), this.makeUpload()], h("Modal", {
1222
- "attrs": {
1223
- "title": this.modalTitle,
1224
- "footerHide": true
1225
- },
1228
+ }, [[this.formCreateInject.prop.props.showUploadList ? [] : this.makeFiles(), this.makeUpload()], h("Modal", helper([{}, {
1229
+ "props": {
1230
+ title: this.modalTitle,
1231
+ footerHide: true
1232
+ }
1233
+ }, {
1226
1234
  "model": {
1227
1235
  value: _this4.previewVisible,
1228
1236
  callback: function callback($$v) {
1229
1237
  _this4.previewVisible = $$v;
1230
1238
  }
1231
1239
  }
1232
- }, [h("img", {
1240
+ }]), [h("img", {
1233
1241
  "attrs": {
1234
1242
  "alt": "example",
1235
1243
  "src": this.previewImage
@@ -1666,10 +1674,7 @@
1666
1674
  "span": button ? 20 : 24
1667
1675
  }
1668
1676
  }, [h("FormItem", [h(Type, helper([{
1669
- "key": key,
1670
- "attrs": {
1671
- "inFor": true
1672
- }
1677
+ "key": key
1673
1678
  }, {
1674
1679
  "on": {
1675
1680
  'update:value': function updateValue(formData) {
@@ -1685,20 +1690,21 @@
1685
1690
  return _this9.add$f(index, key, $f);
1686
1691
  }
1687
1692
  }
1688
- }, {
1689
- "attrs": {
1690
- "value": _this9.field ? _defineProperty({}, _this9.field, _this9._value(_this9.value[index])) : _this9.value[index],
1691
- "rule": rule,
1692
- "option": options,
1693
- "extendOption": true
1693
+ }, {}, {
1694
+ "props": {
1695
+ value: _this9.field ? _defineProperty({}, _this9.field, _this9._value(_this9.value[index])) : _this9.value[index],
1696
+ rule: rule,
1697
+ option: options,
1698
+ extendOption: true,
1699
+ inFor: true
1694
1700
  }
1695
- }]))])]), button ? h("Col", {
1696
- "attrs": {
1697
- "span": 2,
1698
- "pull": 1,
1699
- "push": 1
1701
+ }]))])]), button ? h("Col", helper([{}, {
1702
+ "props": {
1703
+ span: 2,
1704
+ pull: 1,
1705
+ push: 1
1700
1706
  }
1701
- }, [_this9.makeIcon(keys.length, index, key)]) : null]);
1707
+ }]), [_this9.makeIcon(keys.length, index, key)]) : null]);
1702
1708
  })]);
1703
1709
  }
1704
1710
  };
@@ -1809,11 +1815,11 @@
1809
1815
  'emit-event': this.emitEvent,
1810
1816
  input: this.add$f
1811
1817
  }
1812
- }, {
1813
- "attrs": {
1814
- "rule": rule,
1815
- "option": options,
1816
- "extendOption": true
1818
+ }, {}, {
1819
+ "props": {
1820
+ rule: rule,
1821
+ option: options,
1822
+ extendOption: true
1817
1823
  }
1818
1824
  }]));
1819
1825
  }
@@ -2566,7 +2572,6 @@
2566
2572
  h.getCtxs(field).forEach(function (ctx) {
2567
2573
  h.$render.clearCache(ctx);
2568
2574
  ctx.rule.value = copy(ctx.defaultValue);
2569
- h.refreshControl(ctx);
2570
2575
  });
2571
2576
  });
2572
2577
  },
@@ -2670,8 +2675,11 @@
2670
2675
  },
2671
2676
  getCache: function getCache(ctx) {
2672
2677
  var cache = this.cache[ctx.id];
2673
- cache.use = true;
2674
- return cache.vnode;
2678
+ if (cache) {
2679
+ cache.use = true;
2680
+ return cache.vnode;
2681
+ }
2682
+ return undefined;
2675
2683
  }
2676
2684
  });
2677
2685
  }
@@ -3703,6 +3711,7 @@
3703
3711
  if (_ret === "continue") continue;
3704
3712
  }
3705
3713
  if (!validate.length) return false;
3714
+ var hideLst = [];
3706
3715
  var flag = false;
3707
3716
  this.deferSyncValue(function () {
3708
3717
  validate.reverse().forEach(function (_ref) {
@@ -3719,7 +3728,7 @@
3719
3728
  children: rule,
3720
3729
  valid: valid
3721
3730
  }) : ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl), 1);
3722
- _this7.vm.$nextTick(function () {
3731
+ hideLst[valid ? 'push' : 'unshift'](function () {
3723
3732
  _this7.api.hidden(!valid, rule);
3724
3733
  });
3725
3734
  return;
@@ -3749,6 +3758,11 @@
3749
3758
  }
3750
3759
  });
3751
3760
  });
3761
+ hideLst.length && this.vm.$nextTick(function () {
3762
+ hideLst.forEach(function (v) {
3763
+ return v();
3764
+ });
3765
+ });
3752
3766
  this.vm.$emit('control', ctx.origin, this.api);
3753
3767
  this.effect(ctx, 'control');
3754
3768
  return flag;
@@ -4134,9 +4148,11 @@
4134
4148
  $del(this.formData, id);
4135
4149
  $del(this.subForm, id);
4136
4150
  $del(ctx, 'cacheValue');
4137
- input && $del(this.form, field);
4138
4151
  input && this.rmIdCtx(ctx, field, 'field');
4139
4152
  name && this.rmIdCtx(ctx, name, 'name');
4153
+ if (input && !hasProperty(this.fieldCtx, field)) {
4154
+ $del(this.form, field);
4155
+ }
4140
4156
  this.deferSyncValue(function () {
4141
4157
  if (!_this3.reloading) {
4142
4158
  if (ctx.parser.loadChildren !== false) {
@@ -4597,7 +4613,8 @@
4597
4613
  }
4598
4614
  }, val);
4599
4615
  if (!validate.message) {
4600
- validate.message = rule.title + ' is required';
4616
+ var title = rule.title || '';
4617
+ validate.message = ((_typeof(title) === 'object' ? title.title : title) || '') + '不能为空';
4601
4618
  }
4602
4619
  inject.getProp().validate = [validate];
4603
4620
  }
@@ -4667,9 +4684,13 @@
4667
4684
  return fetch(_objectSpread2(_objectSpread2({}, option), {}, {
4668
4685
  onSuccess: function onSuccess(body) {
4669
4686
  if (check()) return;
4670
- set((option.parse || function (v) {
4687
+ var fn = function fn(v) {
4671
4688
  return v.data;
4672
- })(body, rule, api));
4689
+ };
4690
+ if (is.Function(option.parse)) {
4691
+ fn = option.parse;
4692
+ }
4693
+ set(fn(body, rule, api));
4673
4694
  api.sync(rule);
4674
4695
  },
4675
4696
  onError: function onError(e) {
@@ -5832,7 +5853,7 @@
5832
5853
  function ivuFormCreate() {
5833
5854
  return FormCreateFactory({
5834
5855
  ui: "".concat("iview"),
5835
- version: "".concat("2.5.22"),
5856
+ version: "".concat("2.5.25"),
5836
5857
  manager: manager,
5837
5858
  install: install,
5838
5859
  extendApi: extendApi,