@form-create/element-ui 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/element-ui v2.5.20
2
+ * @form-create/element-ui 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.
@@ -320,7 +320,7 @@
320
320
  delete props.value;
321
321
  return h(Type, {
322
322
  "props": _objectSpread2({}, props),
323
- "key": Type + index + opt.value
323
+ "key": Type + index + '-' + opt.value
324
324
  });
325
325
  }), getSlot(this.$slots)]);
326
326
  }
@@ -777,23 +777,21 @@
777
777
  "attrs": {
778
778
  "src": this.previewImage
779
779
  }
780
- })]), h("el-dialog", helper([{
781
- "attrs": {
782
- "appendToBody": true
783
- }
784
- }, _objectSpread2({
785
- width: width,
786
- title: title
787
- }, this.modal), {
780
+ })]), h("el-dialog", {
788
781
  "attrs": {
782
+ "appendToBody": true,
789
783
  "visible": this.frameVisible
790
784
  },
785
+ "props": _objectSpread2({}, _objectSpread2({
786
+ width: width,
787
+ title: title
788
+ }, this.modal)),
791
789
  "on": {
792
790
  "close": function close() {
793
791
  return _this9.closeModel(true);
794
792
  }
795
793
  }
796
- }]), [this.frameVisible || !this.reload ? h("iframe", {
794
+ }, [this.frameVisible || !this.reload ? h("iframe", {
797
795
  "ref": "frame",
798
796
  "attrs": {
799
797
  "src": src,
@@ -878,7 +876,7 @@
878
876
  delete props.value;
879
877
  return h(Type, {
880
878
  "props": _objectSpread2({}, props),
881
- "key": Type + index + opt.value
879
+ "key": Type + index + '-' + opt.value
882
880
  });
883
881
  }), getSlot(this.$slots)]);
884
882
  }
@@ -940,7 +938,7 @@
940
938
  var slot = props.slot;
941
939
  return h("ElOption", {
942
940
  "props": _objectSpread2({}, props),
943
- "key": '' + index + props.value
941
+ "key": '' + index + '-' + props.value
944
942
  }, [slot ? h("template", {
945
943
  "slot": props.slotName || 'default'
946
944
  }, [is.Function(slot) ? props.slot(h) : slot]) : null]);
@@ -1417,14 +1415,20 @@
1417
1415
  var _this = this;
1418
1416
  Object.keys(this.cacheRule).forEach(function (v) {
1419
1417
  var item = _this.cacheRule[v];
1420
- if (n === o) {
1421
- deepExtend(item.rule, n);
1422
- } else {
1418
+ if (item.$f) {
1423
1419
  var val = item.$f.formData();
1424
- item.$f.once('reload', function () {
1425
- item.$f.setValue(val);
1426
- });
1427
- item.rule = deepCopy(n);
1420
+ if (n === o) {
1421
+ item.$f.deferSyncValue(function () {
1422
+ deepExtend(item.rule, n);
1423
+ item.$f.setValue(val);
1424
+ }, true);
1425
+ } else {
1426
+ var _val = item.$f.formData();
1427
+ item.$f.once('reloading', function () {
1428
+ item.$f.setValue(_val);
1429
+ });
1430
+ item.rule = deepCopy(n);
1431
+ }
1428
1432
  }
1429
1433
  });
1430
1434
  },
@@ -2556,7 +2560,6 @@
2556
2560
  h.getCtxs(field).forEach(function (ctx) {
2557
2561
  h.$render.clearCache(ctx);
2558
2562
  ctx.rule.value = copy(ctx.defaultValue);
2559
- h.refreshControl(ctx);
2560
2563
  });
2561
2564
  });
2562
2565
  },
@@ -2612,6 +2615,9 @@
2612
2615
  }
2613
2616
  (_h$vm = h.vm).$emit.apply(_h$vm, [name].concat(args));
2614
2617
  },
2618
+ deferSyncValue: function deferSyncValue(fn, sync) {
2619
+ h.deferSyncValue(fn, sync);
2620
+ },
2615
2621
  helper: {
2616
2622
  tidyFields: tidyFields,
2617
2623
  props: props
@@ -2955,6 +2961,8 @@
2955
2961
  vn.data.style.push({
2956
2962
  display: 'none'
2957
2963
  });
2964
+ } else if (is.String(vn.data.style)) {
2965
+ vn.data.style += ';display:none;';
2958
2966
  } else {
2959
2967
  vn.data.style = [vn.data.style, {
2960
2968
  display: 'none'
@@ -3762,7 +3770,7 @@
3762
3770
  _this8.loadRule();
3763
3771
  _this8.reloading = false;
3764
3772
  _this8.refresh();
3765
- _this8.vm.$emit('reload', _this8.api);
3773
+ _this8.vm.$emit('reloading', _this8.api);
3766
3774
  });
3767
3775
  this.bus.$off('next-tick', this.nextReload);
3768
3776
  this.bus.$once('next-tick', this.nextReload);
@@ -4119,9 +4127,11 @@
4119
4127
  $del(this.formData, id);
4120
4128
  $del(this.subForm, id);
4121
4129
  $del(ctx, 'cacheValue');
4122
- input && $del(this.form, field);
4123
4130
  input && this.rmIdCtx(ctx, field, 'field');
4124
4131
  name && this.rmIdCtx(ctx, name, 'name');
4132
+ if (input && !hasProperty(this.fieldCtx, field)) {
4133
+ $del(this.form, field);
4134
+ }
4125
4135
  this.deferSyncValue(function () {
4126
4136
  if (!_this3.reloading) {
4127
4137
  if (ctx.parser.loadChildren !== false) {
@@ -4571,16 +4581,16 @@
4571
4581
  var $required = {
4572
4582
  name: 'required',
4573
4583
  load: function load(inject, rule, api) {
4574
- var val = parseVa(inject.getValue());
4584
+ var val = parseVal(inject.getValue());
4575
4585
  if (val.required === false) {
4576
4586
  inject.clearProp();
4577
4587
  } else {
4578
- var validate = _objectSpread2(_objectSpread2({}, val), {}, {
4588
+ var validate = _objectSpread2({
4579
4589
  required: true,
4580
4590
  validator: function validator(_, v, call) {
4581
4591
  is.empty(v) ? call(validate.message) : call();
4582
4592
  }
4583
- });
4593
+ }, val);
4584
4594
  if (!validate.message) {
4585
4595
  validate.message = rule.title + ' is required';
4586
4596
  }
@@ -4592,7 +4602,7 @@
4592
4602
  $required.load.apply($required, arguments);
4593
4603
  }
4594
4604
  };
4595
- function parseVa(val) {
4605
+ function parseVal(val) {
4596
4606
  if (is.Boolean(val)) {
4597
4607
  return {
4598
4608
  required: val
@@ -4601,6 +4611,10 @@
4601
4611
  return {
4602
4612
  message: val
4603
4613
  };
4614
+ } else if (is.Function(val)) {
4615
+ return {
4616
+ validator: val
4617
+ };
4604
4618
  } else if (!is.Object(val)) {
4605
4619
  return {};
4606
4620
  } else {
@@ -5774,7 +5788,7 @@
5774
5788
  function elmFormCreate() {
5775
5789
  return FormCreateFactory({
5776
5790
  ui: "".concat("element-ui"),
5777
- version: "".concat("2.5.20"),
5791
+ version: "".concat("2.5.23"),
5778
5792
  manager: manager,
5779
5793
  extendApi: extendApi,
5780
5794
  install: install,