@form-create/iview 2.5.20 → 2.5.23

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.20
2
+ * @form-create/iview v2.5.23
3
3
  * (c) 2018-2022 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
@@ -317,7 +317,7 @@
317
317
  delete props.value;
318
318
  return h("Checkbox", {
319
319
  "props": _objectSpread2({}, props),
320
- "key": '' + index + opt.value
320
+ "key": '' + index + '-' + opt.value
321
321
  });
322
322
  }), getSlot(this.$slots)]);
323
323
  }
@@ -755,10 +755,11 @@
755
755
  "attrs": {
756
756
  "src": this.previewImage
757
757
  }
758
- })]), h("Modal", helper([{}, _objectSpread2({
759
- width: width,
760
- title: title
761
- }, this.modal), {
758
+ })]), h("Modal", {
759
+ "props": _objectSpread2({}, _objectSpread2({
760
+ width: width,
761
+ title: title
762
+ }, this.modal)),
762
763
  "on": {
763
764
  "on-cancel": function onCancel() {
764
765
  return _this9.closeModel(true);
@@ -770,7 +771,7 @@
770
771
  _this9.frameVisible = $$v;
771
772
  }
772
773
  }
773
- }]), [this.frameVisible || !this.reload ? h("iframe", {
774
+ }, [this.frameVisible || !this.reload ? h("iframe", {
774
775
  "ref": "frame",
775
776
  "attrs": {
776
777
  "src": src,
@@ -864,7 +865,7 @@
864
865
  delete props.value;
865
866
  return h("Radio", {
866
867
  "props": _objectSpread2({}, props),
867
- "key": '' + index + opt.value
868
+ "key": '' + index + '-' + opt.value
868
869
  });
869
870
  }), getSlot(this.$slots)]);
870
871
  }
@@ -926,7 +927,7 @@
926
927
  var slot = props.slot;
927
928
  return h("Option", {
928
929
  "props": _objectSpread2({}, props),
929
- "key": '' + index + props.value
930
+ "key": '' + index + '-' + props.value
930
931
  }, [slot ? h("template", {
931
932
  "slot": props.slotName || 'default'
932
933
  }, [is.Function(slot) ? props.slot(h) : slot]) : null]);
@@ -1404,14 +1405,20 @@
1404
1405
  var _this = this;
1405
1406
  Object.keys(this.cacheRule).forEach(function (v) {
1406
1407
  var item = _this.cacheRule[v];
1407
- if (n === o) {
1408
- deepExtend(item.rule, n);
1409
- } else {
1408
+ if (item.$f) {
1410
1409
  var val = item.$f.formData();
1411
- item.$f.once('reload', function () {
1412
- item.$f.setValue(val);
1413
- });
1414
- item.rule = deepCopy(n);
1410
+ if (n === o) {
1411
+ item.$f.deferSyncValue(function () {
1412
+ deepExtend(item.rule, n);
1413
+ item.$f.setValue(val);
1414
+ }, true);
1415
+ } else {
1416
+ var _val = item.$f.formData();
1417
+ item.$f.once('reloading', function () {
1418
+ item.$f.setValue(_val);
1419
+ });
1420
+ item.rule = deepCopy(n);
1421
+ }
1415
1422
  }
1416
1423
  });
1417
1424
  },
@@ -2559,7 +2566,6 @@
2559
2566
  h.getCtxs(field).forEach(function (ctx) {
2560
2567
  h.$render.clearCache(ctx);
2561
2568
  ctx.rule.value = copy(ctx.defaultValue);
2562
- h.refreshControl(ctx);
2563
2569
  });
2564
2570
  });
2565
2571
  },
@@ -2615,6 +2621,9 @@
2615
2621
  }
2616
2622
  (_h$vm = h.vm).$emit.apply(_h$vm, [name].concat(args));
2617
2623
  },
2624
+ deferSyncValue: function deferSyncValue(fn, sync) {
2625
+ h.deferSyncValue(fn, sync);
2626
+ },
2618
2627
  helper: {
2619
2628
  tidyFields: tidyFields,
2620
2629
  props: props
@@ -2958,6 +2967,8 @@
2958
2967
  vn.data.style.push({
2959
2968
  display: 'none'
2960
2969
  });
2970
+ } else if (is.String(vn.data.style)) {
2971
+ vn.data.style += ';display:none;';
2961
2972
  } else {
2962
2973
  vn.data.style = [vn.data.style, {
2963
2974
  display: 'none'
@@ -3765,7 +3776,7 @@
3765
3776
  _this8.loadRule();
3766
3777
  _this8.reloading = false;
3767
3778
  _this8.refresh();
3768
- _this8.vm.$emit('reload', _this8.api);
3779
+ _this8.vm.$emit('reloading', _this8.api);
3769
3780
  });
3770
3781
  this.bus.$off('next-tick', this.nextReload);
3771
3782
  this.bus.$once('next-tick', this.nextReload);
@@ -4122,9 +4133,11 @@
4122
4133
  $del(this.formData, id);
4123
4134
  $del(this.subForm, id);
4124
4135
  $del(ctx, 'cacheValue');
4125
- input && $del(this.form, field);
4126
4136
  input && this.rmIdCtx(ctx, field, 'field');
4127
4137
  name && this.rmIdCtx(ctx, name, 'name');
4138
+ if (input && !hasProperty(this.fieldCtx, field)) {
4139
+ $del(this.form, field);
4140
+ }
4128
4141
  this.deferSyncValue(function () {
4129
4142
  if (!_this3.reloading) {
4130
4143
  if (ctx.parser.loadChildren !== false) {
@@ -4574,16 +4587,16 @@
4574
4587
  var $required = {
4575
4588
  name: 'required',
4576
4589
  load: function load(inject, rule, api) {
4577
- var val = parseVa(inject.getValue());
4590
+ var val = parseVal(inject.getValue());
4578
4591
  if (val.required === false) {
4579
4592
  inject.clearProp();
4580
4593
  } else {
4581
- var validate = _objectSpread2(_objectSpread2({}, val), {}, {
4594
+ var validate = _objectSpread2({
4582
4595
  required: true,
4583
4596
  validator: function validator(_, v, call) {
4584
4597
  is.empty(v) ? call(validate.message) : call();
4585
4598
  }
4586
- });
4599
+ }, val);
4587
4600
  if (!validate.message) {
4588
4601
  validate.message = rule.title + ' is required';
4589
4602
  }
@@ -4595,7 +4608,7 @@
4595
4608
  $required.load.apply($required, arguments);
4596
4609
  }
4597
4610
  };
4598
- function parseVa(val) {
4611
+ function parseVal(val) {
4599
4612
  if (is.Boolean(val)) {
4600
4613
  return {
4601
4614
  required: val
@@ -4604,6 +4617,10 @@
4604
4617
  return {
4605
4618
  message: val
4606
4619
  };
4620
+ } else if (is.Function(val)) {
4621
+ return {
4622
+ validator: val
4623
+ };
4607
4624
  } else if (!is.Object(val)) {
4608
4625
  return {};
4609
4626
  } else {
@@ -5816,7 +5833,7 @@
5816
5833
  function ivuFormCreate() {
5817
5834
  return FormCreateFactory({
5818
5835
  ui: "".concat("iview"),
5819
- version: "".concat("2.5.20"),
5836
+ version: "".concat("2.5.23"),
5820
5837
  manager: manager,
5821
5838
  install: install,
5822
5839
  extendApi: extendApi,