@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.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # @form-create/element-ui
2
- **form-create 是一个可以通过 JSON 生成具有动态渲染、数据收集、验证和提交功能的表单生成组件。支持3个UI框架,并且支持生成任何 Vue 组件。内置20种常用表单组件和自定义组件,再复杂的表单都可以轻松搞定。**
2
+ **form-create 是一个可以通过 JSON 生成具有动态渲染、数据收集、验证和提交功能的表单生成组件。支持5个UI框架,并且支持生成任何 Vue 组件。内置20种常用表单组件和自定义组件,再复杂的表单都可以轻松搞定。**
3
3
 
4
- form-create is a form generation component that can generate dynamic rendering, data collection, verification and submission functions through JSON. Supports 3 UI frameworks, and supports the generation of any Vue components. Built-in 20 kinds of commonly used form components and custom components, no matter how complex forms can be easily handled.
4
+ form-create is a form generation component that can generate dynamic rendering, data collection, verification and submission functions through JSON. Supports 5 UI frameworks, and supports the generation of any Vue components. Built-in 20 kinds of commonly used form components and custom components, no matter how complex forms can be easily handled.
5
5
 
6
6
  > form-create element-ui 动态表单组件
7
7
  >
@@ -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.
@@ -255,7 +255,7 @@ var Checkbox = defineComponent({
255
255
  delete props.value;
256
256
  return createVNode(Type, mergeProps$1(props, {
257
257
  "label": value,
258
- "key": name + index + opt.value
258
+ "key": name + index + '-' + opt.value
259
259
  }), {
260
260
  "default": function _default() {
261
261
  return [props.label || props.value || ''];
@@ -992,7 +992,7 @@ var Radio = defineComponent({
992
992
  delete props.value;
993
993
  return createVNode(Type, mergeProps$1(props, {
994
994
  "label": value,
995
- "key": name + index + opt.value
995
+ "key": name + index + '-' + opt.value
996
996
  }), {
997
997
  "default": function _default() {
998
998
  return [props.label || props.value || ''];
@@ -1044,7 +1044,7 @@ var Select = defineComponent({
1044
1044
  "default": function _default() {
1045
1045
  return [_this.options().map(function (props, index) {
1046
1046
  return createVNode(resolveComponent("ElOption"), mergeProps$1(props, {
1047
- "key": '' + index + props.value
1047
+ "key": '' + index + '-' + props.value
1048
1048
  }), null);
1049
1049
  }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
1050
1050
  }
@@ -2075,7 +2075,9 @@ function $FormCreate(FormCreate) {
2075
2075
  fc.$handle.reloadRule(rule.value);
2076
2076
  vm.setupState.renderRule();
2077
2077
  });
2078
- watch(props.option, function (n) {
2078
+ watch(function () {
2079
+ return props.option;
2080
+ }, function (n) {
2079
2081
  fc.initOptions(n);
2080
2082
  fapi.refresh();
2081
2083
  });
@@ -2839,7 +2841,6 @@ function Api(h) {
2839
2841
  h.getCtxs(field).forEach(function (ctx) {
2840
2842
  h.$render.clearCache(ctx);
2841
2843
  ctx.rule.value = copy(ctx.defaultValue);
2842
- h.refreshControl(ctx);
2843
2844
  });
2844
2845
  });
2845
2846
  },
@@ -2950,8 +2951,13 @@ function useCache(Render) {
2950
2951
  },
2951
2952
  getCache: function getCache(ctx) {
2952
2953
  var cache = this.cache[ctx.id];
2953
- cache.use = true;
2954
- return cache.vnode;
2954
+
2955
+ if (cache) {
2956
+ cache.use = true;
2957
+ return cache.vnode;
2958
+ }
2959
+
2960
+ return undefined;
2955
2961
  }
2956
2962
  });
2957
2963
  }
@@ -4167,6 +4173,7 @@ function useLoader(Handler) {
4167
4173
  }
4168
4174
 
4169
4175
  if (!validate.length) return false;
4176
+ var hideLst = [];
4170
4177
  var flag = false;
4171
4178
  this.deferSyncValue(function () {
4172
4179
  validate.reverse().forEach(function (_ref) {
@@ -4184,7 +4191,7 @@ function useLoader(Handler) {
4184
4191
  children: rule,
4185
4192
  valid: valid
4186
4193
  }) : ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl), 1);
4187
- nextTick(function () {
4194
+ hideLst[valid ? 'push' : 'unshift'](function () {
4188
4195
  _this7.api.hidden(!valid, rule);
4189
4196
  });
4190
4197
  return;
@@ -4217,6 +4224,11 @@ function useLoader(Handler) {
4217
4224
  }
4218
4225
  });
4219
4226
  });
4227
+ hideLst.length && nextTick(function () {
4228
+ hideLst.forEach(function (v) {
4229
+ return v();
4230
+ });
4231
+ });
4220
4232
  this.vm.emit('control', ctx.origin, this.api);
4221
4233
  this.effect(ctx, 'control');
4222
4234
  return flag;
@@ -4686,9 +4698,13 @@ function useContext(Handler) {
4686
4698
  $del(this.formData, id);
4687
4699
  $del(this.subForm, id);
4688
4700
  $del(this.vm.setupState.ctxInject, id);
4689
- input && $del(this.form, field);
4690
4701
  input && this.rmIdCtx(ctx, field, 'field');
4691
4702
  name && this.rmIdCtx(ctx, name, 'name');
4703
+
4704
+ if (input && !hasProperty(this.fieldCtx, field)) {
4705
+ $del(this.form, field);
4706
+ }
4707
+
4692
4708
  this.deferSyncValue(function () {
4693
4709
  if (!_this4.reloading) {
4694
4710
  if (ctx.parser.loadChildren !== false) {
@@ -5269,9 +5285,16 @@ function run(inject, rule, api) {
5269
5285
  return fetch(_objectSpread2(_objectSpread2({}, option), {}, {
5270
5286
  onSuccess: function onSuccess(body) {
5271
5287
  if (check()) return;
5272
- set((option.parse || function (v) {
5288
+
5289
+ var fn = function fn(v) {
5273
5290
  return v.data;
5274
- })(body, rule, api));
5291
+ };
5292
+
5293
+ if (is.Function(option.parse)) {
5294
+ fn = option.parse;
5295
+ }
5296
+
5297
+ set(fn(body, rule, api));
5275
5298
  api.sync(rule);
5276
5299
  },
5277
5300
  onError: function onError(e) {
@@ -6488,7 +6511,8 @@ var required = {
6488
6511
  }, val);
6489
6512
 
6490
6513
  if (!validate.message) {
6491
- validate.message = rule.title + ' is required';
6514
+ var title = rule.title || '';
6515
+ validate.message = ((_typeof(title) === 'object' ? title.title : title) || '') + '不能为空';
6492
6516
  }
6493
6517
 
6494
6518
  inject.getProp().validate = [validate];
@@ -6544,7 +6568,7 @@ function install(FormCreate) {
6544
6568
  function elmFormCreate() {
6545
6569
  return FormCreateFactory({
6546
6570
  ui: 'element-ui',
6547
- version: '3.1.9',
6571
+ version: '3.1.12',
6548
6572
  manager: manager,
6549
6573
  extendApi: extendApi,
6550
6574
  install: install,