@form-create/element-ui 3.1.28 → 3.1.30

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.
@@ -44,8 +44,8 @@ export default {
44
44
  return new Promise((resolve, reject) => {
45
45
  const form = this.form();
46
46
  if (form) {
47
- form.validateField(field, (res) => {
48
- res ? reject(res) : resolve(null);
47
+ form.validateField(field, (res, err) => {
48
+ err ? reject(err) : resolve(res);
49
49
  });
50
50
  } else {
51
51
  resolve();
@@ -59,7 +59,7 @@ export default {
59
59
  }
60
60
  },
61
61
  tidyOptions(options) {
62
- ['submitBtn', 'resetBtn', 'row', 'info', 'wrap', 'col'].forEach(name => {
62
+ ['submitBtn', 'resetBtn', 'row', 'info', 'wrap', 'col', 'title'].forEach(name => {
63
63
  tidyBool(options, name);
64
64
  })
65
65
  return options;
@@ -74,6 +74,7 @@ export default {
74
74
  info: this.options.info || {},
75
75
  wrap: this.options.wrap || {},
76
76
  col: this.options.col || {},
77
+ title: this.options.title || {},
77
78
  }, ctx.prop], {
78
79
  info: {
79
80
  trigger: 'hover',
@@ -97,7 +98,7 @@ export default {
97
98
  e.preventDefault();
98
99
  }
99
100
  },
100
- class: [form.className, form.class, 'form-create'],
101
+ class: [form.className, form.class, 'form-create', this.options.preview ? 'is-preview' : ''],
101
102
  style: form.style,
102
103
  type: 'form',
103
104
  };
@@ -110,7 +111,7 @@ export default {
110
111
  });
111
112
  },
112
113
  render(children) {
113
- if (children.slotLen()) {
114
+ if (children.slotLen() && !this.options.preview) {
114
115
  children.setSlot(undefined, () => this.makeFormBtn());
115
116
  }
116
117
  return this.$r(this.rule, isFalse(this.options.row.show) ? children.getSlots() : [this.makeRow(children)]);
@@ -128,7 +129,7 @@ export default {
128
129
  label: isTitle ? rule.title.title : undefined,
129
130
  ...tidyRule(rule.wrap || {}),
130
131
  prop: ctx.id,
131
- rules: rule.validate,
132
+ rules: ctx.injectValidate(),
132
133
  },
133
134
  class: rule.className,
134
135
  key: `${uni}fi`,
@@ -6,6 +6,7 @@ const required = {
6
6
  const val = parseVal(inject.getValue());
7
7
  if (val.required === false) {
8
8
  inject.clearProp();
9
+ api.clearValidateState([rule.field]);
9
10
  } else {
10
11
  const validate = {
11
12
  required: true,
@@ -2,6 +2,14 @@
2
2
  margin-bottom: 22px;
3
3
  }
4
4
 
5
- .form-create{
5
+ .form-create {
6
6
  width: 100%;
7
7
  }
8
+
9
+ .form-create.is-preview .fc-clock, .form-create .fc-none {
10
+ display: none !important;
11
+ }
12
+
13
+ .form-create.is-preview .el-form-item.is-required > .el-form-item__label-wrap > .el-form-item__label:before, .form-create.is-preview .el-form-item.is-required > .el-form-item__label:before {
14
+ content: "" !important;
15
+ }