@form-create/element-ui 3.1.27 → 3.1.29

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.
@@ -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)]);
@@ -134,7 +135,7 @@ export default {
134
135
  key: `${uni}fi`,
135
136
  ref: ctx.wrapRef,
136
137
  type: 'formItem',
137
- }]), {default: () => children, ...(isTitle ? {label: () => this.makeInfo(rule, uni)} : {})});
138
+ }]), {default: () => children, ...(isTitle ? {label: () => this.makeInfo(rule, uni, ctx)} : {})});
138
139
  return (inline === true || isFalse(_col) || isFalse(col.show)) ? item : this.makeCol(rule, uni, [item]);
139
140
  },
140
141
  isTitle(rule) {
@@ -142,12 +143,13 @@ export default {
142
143
  const title = rule.title;
143
144
  return !((!title.title && !title.native) || isFalse(title.show))
144
145
  },
145
- makeInfo(rule, uni) {
146
+ makeInfo(rule, uni, ctx) {
146
147
  const titleProp = {...rule.title};
147
148
  const infoProp = {...rule.info};
148
149
  const isTip = isTooltip(infoProp);
149
150
  const form = this.options.form;
150
- const children = [(titleProp.title || '') + (form.labelSuffix || form['label-suffix'] || '')];
151
+ const titleSlot = this.getSlot('title');
152
+ const children = [titleSlot ? titleSlot({title: titleProp.title || '', rule: ctx.rule, options: this.options}) : ((titleProp.title || '') + (form.labelSuffix || form['label-suffix'] || ''))];
151
153
 
152
154
  if (!isFalse(infoProp.show) && (infoProp.info || infoProp.native) && !isFalse(infoProp.icon)) {
153
155
  const prop = {
@@ -5,3 +5,7 @@
5
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
+ }