@form-create/element-ui 3.1.9 → 3.1.12

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.9
2
+ * @form-create/element-ui v3.1.12
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
  }
@@ -2079,7 +2079,9 @@
2079
2079
  fc.$handle.reloadRule(rule.value);
2080
2080
  vm.setupState.renderRule();
2081
2081
  });
2082
- vue.watch(props.option, function (n) {
2082
+ vue.watch(function () {
2083
+ return props.option;
2084
+ }, function (n) {
2083
2085
  fc.initOptions(n);
2084
2086
  fapi.refresh();
2085
2087
  });
@@ -2843,7 +2845,6 @@
2843
2845
  h.getCtxs(field).forEach(function (ctx) {
2844
2846
  h.$render.clearCache(ctx);
2845
2847
  ctx.rule.value = copy(ctx.defaultValue);
2846
- h.refreshControl(ctx);
2847
2848
  });
2848
2849
  });
2849
2850
  },
@@ -2954,8 +2955,13 @@
2954
2955
  },
2955
2956
  getCache: function getCache(ctx) {
2956
2957
  var cache = this.cache[ctx.id];
2957
- cache.use = true;
2958
- return cache.vnode;
2958
+
2959
+ if (cache) {
2960
+ cache.use = true;
2961
+ return cache.vnode;
2962
+ }
2963
+
2964
+ return undefined;
2959
2965
  }
2960
2966
  });
2961
2967
  }
@@ -4171,6 +4177,7 @@
4171
4177
  }
4172
4178
 
4173
4179
  if (!validate.length) return false;
4180
+ var hideLst = [];
4174
4181
  var flag = false;
4175
4182
  this.deferSyncValue(function () {
4176
4183
  validate.reverse().forEach(function (_ref) {
@@ -4188,7 +4195,7 @@
4188
4195
  children: rule,
4189
4196
  valid: valid
4190
4197
  }) : ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl), 1);
4191
- vue.nextTick(function () {
4198
+ hideLst[valid ? 'push' : 'unshift'](function () {
4192
4199
  _this7.api.hidden(!valid, rule);
4193
4200
  });
4194
4201
  return;
@@ -4221,6 +4228,11 @@
4221
4228
  }
4222
4229
  });
4223
4230
  });
4231
+ hideLst.length && vue.nextTick(function () {
4232
+ hideLst.forEach(function (v) {
4233
+ return v();
4234
+ });
4235
+ });
4224
4236
  this.vm.emit('control', ctx.origin, this.api);
4225
4237
  this.effect(ctx, 'control');
4226
4238
  return flag;
@@ -4690,9 +4702,13 @@
4690
4702
  $del(this.formData, id);
4691
4703
  $del(this.subForm, id);
4692
4704
  $del(this.vm.setupState.ctxInject, id);
4693
- input && $del(this.form, field);
4694
4705
  input && this.rmIdCtx(ctx, field, 'field');
4695
4706
  name && this.rmIdCtx(ctx, name, 'name');
4707
+
4708
+ if (input && !hasProperty(this.fieldCtx, field)) {
4709
+ $del(this.form, field);
4710
+ }
4711
+
4696
4712
  this.deferSyncValue(function () {
4697
4713
  if (!_this4.reloading) {
4698
4714
  if (ctx.parser.loadChildren !== false) {
@@ -5273,9 +5289,16 @@
5273
5289
  return fetch(_objectSpread2(_objectSpread2({}, option), {}, {
5274
5290
  onSuccess: function onSuccess(body) {
5275
5291
  if (check()) return;
5276
- set((option.parse || function (v) {
5292
+
5293
+ var fn = function fn(v) {
5277
5294
  return v.data;
5278
- })(body, rule, api));
5295
+ };
5296
+
5297
+ if (is.Function(option.parse)) {
5298
+ fn = option.parse;
5299
+ }
5300
+
5301
+ set(fn(body, rule, api));
5279
5302
  api.sync(rule);
5280
5303
  },
5281
5304
  onError: function onError(e) {
@@ -6492,7 +6515,8 @@
6492
6515
  }, val);
6493
6516
 
6494
6517
  if (!validate.message) {
6495
- validate.message = rule.title + ' is required';
6518
+ var title = rule.title || '';
6519
+ validate.message = ((_typeof(title) === 'object' ? title.title : title) || '') + '不能为空';
6496
6520
  }
6497
6521
 
6498
6522
  inject.getProp().validate = [validate];
@@ -6548,7 +6572,7 @@
6548
6572
  function elmFormCreate() {
6549
6573
  return FormCreateFactory({
6550
6574
  ui: 'element-ui',
6551
- version: '3.1.9',
6575
+ version: '3.1.12',
6552
6576
  manager: manager,
6553
6577
  extendApi: extendApi,
6554
6578
  install: install,