@form-create/element-ui 3.1.8 → 3.1.11

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.8
2
+ * @form-create/element-ui v3.1.11
3
3
  * (c) 2018-2022 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
@@ -259,7 +259,7 @@
259
259
  delete props.value;
260
260
  return vue.createVNode(Type, vue.mergeProps(props, {
261
261
  "label": value,
262
- "key": name + index + opt.value
262
+ "key": name + index + '-' + opt.value
263
263
  }), {
264
264
  "default": function _default() {
265
265
  return [props.label || props.value || ''];
@@ -996,7 +996,7 @@
996
996
  delete props.value;
997
997
  return vue.createVNode(Type, vue.mergeProps(props, {
998
998
  "label": value,
999
- "key": name + index + opt.value
999
+ "key": name + index + '-' + opt.value
1000
1000
  }), {
1001
1001
  "default": function _default() {
1002
1002
  return [props.label || props.value || ''];
@@ -1048,7 +1048,7 @@
1048
1048
  "default": function _default() {
1049
1049
  return [_this.options().map(function (props, index) {
1050
1050
  return vue.createVNode(vue.resolveComponent("ElOption"), vue.mergeProps(props, {
1051
- "key": '' + index + props.value
1051
+ "key": '' + index + '-' + props.value
1052
1052
  }), null);
1053
1053
  }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
1054
1054
  }
@@ -1506,14 +1506,22 @@
1506
1506
  Object.keys(this.cacheRule).forEach(function (v) {
1507
1507
  var item = _this.cacheRule[v];
1508
1508
 
1509
- if (n === o) {
1510
- deepExtend(item.rule, n);
1511
- } else {
1509
+ if (item.$f) {
1512
1510
  var val = item.$f.formData();
1513
- item.$f.once('reloading', function () {
1514
- item.$f.setValue(val);
1515
- });
1516
- item.rule = deepCopy(n);
1511
+
1512
+ if (n === o) {
1513
+ item.$f.deferSyncValue(function () {
1514
+ deepExtend(item.rule, n);
1515
+ item.$f.setValue(val);
1516
+ }, true);
1517
+ } else {
1518
+ var _val = item.$f.formData();
1519
+
1520
+ item.$f.once('reloading', function () {
1521
+ item.$f.setValue(_val);
1522
+ });
1523
+ item.rule = deepCopy(n);
1524
+ }
1517
1525
  }
1518
1526
  });
1519
1527
  },
@@ -2835,7 +2843,6 @@
2835
2843
  h.getCtxs(field).forEach(function (ctx) {
2836
2844
  h.$render.clearCache(ctx);
2837
2845
  ctx.rule.value = copy(ctx.defaultValue);
2838
- h.refreshControl(ctx);
2839
2846
  });
2840
2847
  });
2841
2848
  },
@@ -2886,6 +2893,9 @@
2886
2893
  h.nextRefresh();
2887
2894
  fn && invoke(fn);
2888
2895
  },
2896
+ deferSyncValue: function deferSyncValue(fn, sync) {
2897
+ h.deferSyncValue(fn, sync);
2898
+ },
2889
2899
  emit: function emit(name) {
2890
2900
  var _h$vm;
2891
2901
 
@@ -3187,7 +3197,7 @@
3187
3197
  }
3188
3198
  },
3189
3199
  getModelField: function getModelField(ctx) {
3190
- return ctx.rule.modelField || ctx.parser.modelField || this.fc.modelFields[this.vNode.aliasMap[ctx.field]] || this.fc.modelFields[ctx.field] || this.fc.modelFields[ctx.originType] || 'modelValue';
3200
+ return ctx.rule.modelField || ctx.parser.modelField || this.fc.modelFields[this.vNode.aliasMap[ctx.type]] || this.fc.modelFields[ctx.type] || this.fc.modelFields[ctx.originType] || 'modelValue';
3191
3201
  },
3192
3202
  display: function display(vn) {
3193
3203
  var _this5 = this;
@@ -4160,6 +4170,7 @@
4160
4170
  }
4161
4171
 
4162
4172
  if (!validate.length) return false;
4173
+ var hideLst = [];
4163
4174
  var flag = false;
4164
4175
  this.deferSyncValue(function () {
4165
4176
  validate.reverse().forEach(function (_ref) {
@@ -4177,7 +4188,7 @@
4177
4188
  children: rule,
4178
4189
  valid: valid
4179
4190
  }) : ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl), 1);
4180
- vue.nextTick(function () {
4191
+ hideLst[valid ? 'push' : 'unshift'](function () {
4181
4192
  _this7.api.hidden(!valid, rule);
4182
4193
  });
4183
4194
  return;
@@ -4210,6 +4221,11 @@
4210
4221
  }
4211
4222
  });
4212
4223
  });
4224
+ hideLst.length && vue.nextTick(function () {
4225
+ hideLst.forEach(function (v) {
4226
+ return v();
4227
+ });
4228
+ });
4213
4229
  this.vm.emit('control', ctx.origin, this.api);
4214
4230
  this.effect(ctx, 'control');
4215
4231
  return flag;
@@ -4679,9 +4695,13 @@
4679
4695
  $del(this.formData, id);
4680
4696
  $del(this.subForm, id);
4681
4697
  $del(this.vm.setupState.ctxInject, id);
4682
- input && $del(this.form, field);
4683
4698
  input && this.rmIdCtx(ctx, field, 'field');
4684
4699
  name && this.rmIdCtx(ctx, name, 'name');
4700
+
4701
+ if (input && !hasProperty(this.fieldCtx, field)) {
4702
+ $del(this.form, field);
4703
+ }
4704
+
4685
4705
  this.deferSyncValue(function () {
4686
4706
  if (!_this4.reloading) {
4687
4707
  if (ctx.parser.loadChildren !== false) {
@@ -6481,7 +6501,7 @@
6481
6501
  }, val);
6482
6502
 
6483
6503
  if (!validate.message) {
6484
- validate.message = rule.title + ' is required';
6504
+ validate.message = rule.title + '不能为空';
6485
6505
  }
6486
6506
 
6487
6507
  inject.getProp().validate = [validate];
@@ -6537,7 +6557,7 @@
6537
6557
  function elmFormCreate() {
6538
6558
  return FormCreateFactory({
6539
6559
  ui: 'element-ui',
6540
- version: '3.1.8',
6560
+ version: '3.1.11',
6541
6561
  manager: manager,
6542
6562
  extendApi: extendApi,
6543
6563
  install: install,