@subiz/widget-v4 4.1.140 → 4.1.142

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.
@@ -8,6 +8,7 @@ var _common = require("../common.js");
8
8
  var _preact = require("preact");
9
9
  var _index = _interopRequireDefault(require("../util/index.js"));
10
10
  var _block = _interopRequireDefault(require("../chatbox/block.js"));
11
+ var _ratingStars = _interopRequireDefault(require("./rating-stars.js"));
11
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
13
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
13
14
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
@@ -63,7 +64,7 @@ class Form2 extends _common.Com {
63
64
  class: "label"
64
65
  }, com.label, " ", com.is_required && (0, _preact.h)("span", {
65
66
  class: "red"
66
- }, "*")), com.input_type === 'text' && this.renderFieldTextInput(com, idx), com.input_type === 'textarea' && this.renderFieldTextareaInput(com, idx), com.input_type === 'date' && this.renderFieldDateInput(com, idx), com.input_type === 'radio' && this.renderFieldRadioInput(com, idx), com.input_type === 'checkbox' && this.renderFieldCheckboxInput(com, idx), (com.input_type === 'dropdown' || com.input_type === 'select') && this.renderFieldDropdownInput(com, idx), errorMsg && (0, _preact.h)("div", {
67
+ }, "*")), com.input_type === 'text' && this.renderFieldTextInput(com, idx), com.input_type === 'textarea' && this.renderFieldTextareaInput(com, idx), com.input_type === 'date' && this.renderFieldDateInput(com, idx), com.input_type === 'radio' && this.renderFieldRadioInput(com, idx), com.input_type === 'checkbox' && this.renderFieldCheckboxInput(com, idx), (com.input_type === 'dropdown' || com.input_type === 'select') && this.renderFieldDropdownInput(com, idx), com.input_type === 'rating' && this.renderFieldRatingInput(com, idx), errorMsg && (0, _preact.h)("div", {
67
68
  class: "form-control--valid-input--error"
68
69
  }, errorMsg));
69
70
  });
@@ -106,7 +107,11 @@ class Form2 extends _common.Com {
106
107
  let val = _index.default.find(this.props.submission.values, f => f.key === com.key) || {};
107
108
  val = val.value || '""';
108
109
  val = _index.default.parseJSON(val);
109
- return _index.default.map(com.input_options, (option, oidx) => {
110
+ let wrappercls = 'form-radios-wrapper';
111
+ if (_index.default.size(com.input_options) >= 3 && this.props.mode !== 'attachment') wrappercls += ' horizontal';
112
+ return (0, _preact.h)("div", {
113
+ class: wrappercls
114
+ }, _index.default.map(com.input_options, (option, oidx) => {
110
115
  let id = com.key + '_' + oidx;
111
116
  return (0, _preact.h)("div", {
112
117
  class: "radio"
@@ -122,13 +127,17 @@ class Form2 extends _common.Com {
122
127
  }, option.label), (0, _preact.h)("div", {
123
128
  class: "radio--check"
124
129
  }));
125
- });
130
+ }));
126
131
  });
127
132
  _defineProperty(this, "renderFieldCheckboxInput", (com, idx) => {
128
133
  let val = _index.default.find(this.props.submission.values, f => f.key === com.key) || {};
129
134
  val = val.value || '[]';
130
135
  val = _index.default.parseJSON(val);
131
- return _index.default.map(com.input_options, (option, oidx) => {
136
+ let wrappercls = 'form-checkboxes-wrapper';
137
+ if (_index.default.size(com.input_options) >= 3 && this.props.mode !== 'attachment') wrappercls += ' horizontal';
138
+ return (0, _preact.h)("div", {
139
+ class: wrappercls
140
+ }, _index.default.map(com.input_options, (option, oidx) => {
132
141
  let id = com.key + '_' + oidx;
133
142
  return (0, _preact.h)("div", {
134
143
  class: "checkbox"
@@ -144,7 +153,7 @@ class Form2 extends _common.Com {
144
153
  }, option.label), (0, _preact.h)("div", {
145
154
  class: "checkbox--check"
146
155
  }));
147
- });
156
+ }));
148
157
  });
149
158
  _defineProperty(this, "renderFieldDropdownInput", (com, idx) => {
150
159
  let val = _index.default.find(this.props.submission.values, f => f.key === com.key) || {};
@@ -183,6 +192,11 @@ class Form2 extends _common.Com {
183
192
  placeholder: com.placeholder
184
193
  });
185
194
  });
195
+ _defineProperty(this, "renderFieldRatingInput", (com, idx) => {
196
+ return (0, _preact.h)(_ratingStars.default, {
197
+ onChange: v => this.onChangeValue(com.key, v)
198
+ });
199
+ });
186
200
  _defineProperty(this, "onSubmit", e => {
187
201
  e.preventDefault();
188
202
  if (!this.validateForm()) return;
@@ -263,6 +277,43 @@ class Form2 extends _common.Com {
263
277
  errorFields: errors
264
278
  });
265
279
  });
280
+ _defineProperty(this, "renderFormHeader", () => {
281
+ let title = _index.default.get(this.props.formSetting, 'title') || '';
282
+ let desc = _index.default.get(this.props.formSetting, 'description') || '';
283
+ if (this.props.mode === 'attachment') {
284
+ if (title.trim() || desc.trim()) {
285
+ return (0, _preact.h)("div", {
286
+ class: "form-component form-component-block"
287
+ }, title && (0, _preact.h)("div", null, title), desc && (0, _preact.h)("div", {
288
+ class: "text-sm text-muted"
289
+ }, desc));
290
+ }
291
+ }
292
+ let brandLogo = _index.default.get(this.props.formSetting, 'logo.url');
293
+ let brandUrl = _index.default.get(this.props.formSetting, 'brand_url');
294
+ let $logo = null;
295
+ if (brandLogo) {
296
+ $logo = (0, _preact.h)("div", {
297
+ class: "form-page-logo-wrapper"
298
+ }, (0, _preact.h)("a", {
299
+ href: brandUrl || 'javascript:;'
300
+ }, (0, _preact.h)("img", {
301
+ src: brandLogo,
302
+ class: "form-page-logo"
303
+ })));
304
+ }
305
+ let $header = null;
306
+ if (title.trim() || desc.trim()) {
307
+ $header = (0, _preact.h)("div", {
308
+ class: "form-page-header"
309
+ }, (0, _preact.h)("div", {
310
+ class: "form-page-title"
311
+ }, title), desc && (0, _preact.h)("div", {
312
+ class: "form-page-desc"
313
+ }, desc));
314
+ }
315
+ return (0, _preact.h)(_preact.Fragment, null, $logo, $header);
316
+ });
266
317
  let _components = _index.default.get(this.props.formSetting, 'components') || [];
267
318
  _index.default.each(_components, com => {
268
319
  if (com.type === 'input' && com.input_type !== 'checkbox' && com.input_type !== 'radio') {
@@ -298,11 +349,7 @@ class Form2 extends _common.Com {
298
349
  class: "form-component"
299
350
  }, this.props.t('you_have_submitted_info_successfully')), (0, _preact.h)("form", {
300
351
  onSubmit: this.onSubmit
301
- }, this.props.mode === 'attachment' && (title || desc) && (0, _preact.h)("div", {
302
- class: "form-component form-component-block"
303
- }, title && (0, _preact.h)("div", null, title), desc && (0, _preact.h)("div", {
304
- class: "text-sm text-muted"
305
- }, desc)), _index.default.map(components, this.renderFormComponent)));
352
+ }, this.renderFormHeader(), _index.default.map(components, this.renderFormComponent)));
306
353
  }
307
354
  }
308
355
  exports.default = Form2;
@@ -197,29 +197,20 @@ class FormPage extends _common.Com {
197
197
  }, this.props.t('try_again'))));
198
198
  }
199
199
  let brandLogo = _index.default.get(formSetting, 'logo.url');
200
+ let coverUrl = _index.default.get(formSetting, 'cover_image.url');
201
+ let wrappercls = 'form-page';
202
+ if (coverUrl) wrappercls += ' sketch';
200
203
  return (0, _preact.h)("div", {
201
204
  class: "form-page-body",
202
205
  key: "form"
203
206
  }, this.props.previewJson && (0, _preact.h)("div", {
204
207
  class: "form-page-preview-noti"
205
- }, 'Form ở trạng thái xem thử, không ghi nhận phản hồi'), (0, _preact.h)("div", {
206
- class: "form-page"
207
- }, (0, _preact.h)("div", {
208
- class: "form-page-logo-wrapper"
209
- }, (0, _preact.h)("a", {
210
- href: formSetting.brand_url || 'javascript:;'
211
- }, brandLogo ? (0, _preact.h)("img", {
212
- src: brandLogo,
213
- class: "form-page-logo"
214
- }) : (0, _preact.h)("div", {
215
- class: "form-page-logo-text"
216
- }, _index.default.get(this.props.store.matchAccount(), 'name')))), (formSetting.title || formSetting.description) && (0, _preact.h)("div", {
217
- class: "form-page-header"
218
- }, (0, _preact.h)("div", {
219
- class: "form-page-title"
220
- }, formSetting.title), formSetting.description && (0, _preact.h)("div", {
221
- class: "form-page-desc"
222
- }, formSetting.description)), (0, _preact.h)(_Form.default, {
208
+ }, 'Form ở trạng thái xem thử, không ghi nhận phản hồi'), coverUrl && (0, _preact.h)("div", {
209
+ class: "form-page-header-bg",
210
+ style: `background: url(${coverUrl}); background-size: cover;`
211
+ }), (0, _preact.h)("div", {
212
+ class: wrappercls
213
+ }, (0, _preact.h)(_Form.default, {
223
214
  store: this.props.store,
224
215
  formSetting: formSetting,
225
216
  t: this.props.t,
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _common = require("../common.js");
8
+ var _preact = require("preact");
9
+ var _index = _interopRequireDefault(require("../util/index.js"));
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
12
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
13
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
14
+ class Form2 extends _common.Com {
15
+ constructor(props) {
16
+ super(props);
17
+ _defineProperty(this, "state", {
18
+ hovering: 0,
19
+ selected: 0
20
+ });
21
+ _defineProperty(this, "onMouseEnter", v => {
22
+ let {
23
+ selected,
24
+ hovering
25
+ } = this.state;
26
+ if (v <= selected) {
27
+ this.setState({
28
+ hovering: selected
29
+ });
30
+ return;
31
+ }
32
+ this.setState({
33
+ hovering: v
34
+ });
35
+ });
36
+ _defineProperty(this, "onMouseLeave", () => {
37
+ let {
38
+ selected,
39
+ hovering
40
+ } = this.state;
41
+ this.setState({
42
+ hovering: 0
43
+ });
44
+ });
45
+ }
46
+ onToggleValue(v) {
47
+ let {
48
+ selected
49
+ } = this.state;
50
+ let newVal = v;
51
+ if (v === selected) newVal = 0;
52
+ this.setState({
53
+ selected: newVal,
54
+ hovering: newVal
55
+ });
56
+ this.props.onChange(newVal);
57
+ }
58
+ render() {
59
+ let {
60
+ selected,
61
+ hovering
62
+ } = this.state;
63
+ let star1Cls = 'star-wrapper';
64
+ if (selected >= 1) {
65
+ star1Cls += ' selected';
66
+ } else if (hovering >= 1) {
67
+ star1Cls += ' hovering';
68
+ }
69
+ let star2Cls = 'star-wrapper';
70
+ if (selected >= 2) {
71
+ star2Cls += ' selected';
72
+ } else if (hovering >= 2) {
73
+ star2Cls += ' hovering';
74
+ }
75
+ let star3Cls = 'star-wrapper';
76
+ if (selected >= 3) {
77
+ star3Cls += ' selected';
78
+ } else if (hovering >= 3) {
79
+ star3Cls += ' hovering';
80
+ }
81
+ let star4Cls = 'star-wrapper';
82
+ if (selected >= 4) {
83
+ star4Cls += ' selected';
84
+ } else if (hovering >= 4) {
85
+ star4Cls += ' hovering';
86
+ }
87
+ let star5Cls = 'star-wrapper';
88
+ if (selected >= 5) {
89
+ star5Cls += ' selected';
90
+ } else if (hovering >= 5) {
91
+ star5Cls += ' hovering';
92
+ }
93
+ return (0, _preact.h)("div", {
94
+ class: "form-ratings-wrapper",
95
+ onMouseLeave: () => this.onMouseLeave()
96
+ }, (0, _preact.h)("div", {
97
+ class: star1Cls,
98
+ onClick: () => this.onToggleValue(1),
99
+ onMouseEnter: () => this.onMouseEnter(1)
100
+ }, (0, _preact.h)("div", {
101
+ class: "star"
102
+ })), (0, _preact.h)("div", {
103
+ class: star2Cls,
104
+ onClick: () => this.onToggleValue(2),
105
+ onMouseEnter: () => this.onMouseEnter(2)
106
+ }, (0, _preact.h)("div", {
107
+ class: "star"
108
+ })), (0, _preact.h)("div", {
109
+ class: star3Cls,
110
+ onClick: () => this.onToggleValue(3),
111
+ onMouseEnter: () => this.onMouseEnter(3)
112
+ }, (0, _preact.h)("div", {
113
+ class: "star"
114
+ })), (0, _preact.h)("div", {
115
+ class: star4Cls,
116
+ onClick: () => this.onToggleValue(4),
117
+ onMouseEnter: () => this.onMouseEnter(4)
118
+ }, (0, _preact.h)("div", {
119
+ class: "star"
120
+ })), (0, _preact.h)("div", {
121
+ class: star5Cls,
122
+ onClick: () => this.onToggleValue(5),
123
+ onMouseEnter: () => this.onMouseEnter(5)
124
+ }, (0, _preact.h)("div", {
125
+ class: "star"
126
+ })));
127
+ }
128
+ }
129
+ exports.default = Form2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@subiz/widget-v4",
3
- "version": "4.1.140",
3
+ "version": "4.1.142",
4
4
  "main": "./compiled_src/lib.js",
5
5
  "scripts": {
6
6
  "dev": "npx webpack serve --config webpack.dev.js",
@@ -31,6 +31,89 @@ export default class FormAttachment extends Com {
31
31
  let formSetting = formAttachment.form || {}
32
32
  let submission = formAttachment.form_submission || {}
33
33
  let isSubmited = sb.size(submission) > 0
34
+ //if (this.props.ev.id === 'evshwmvhbthkrvbceozazgxno') {
35
+ //formSetting = {
36
+ //id: 'atshrpqxzuufzzdkzquz_dlbgwyib',
37
+ //title: 'Đặt lịch khám',
38
+ //components: [
39
+ //{
40
+ //type: 'input',
41
+ //label: 'Họ và tên',
42
+ //input_type: 'text',
43
+ //is_required: true,
44
+ //key: 'fullname',
45
+ //},
46
+ //{
47
+ //type: 'input',
48
+ //label: 'SĐT',
49
+ //input_type: 'text',
50
+ //is_required: true,
51
+ //key: 'phone',
52
+ //},
53
+ //{
54
+ //type: 'input',
55
+ //label: 'Chọn ca',
56
+ //input_type: 'radio',
57
+ //is_required: true,
58
+ //key: 'shift',
59
+ //input_options: [
60
+ //{
61
+ //label: 'Buổi sáng',
62
+ //value: 'Buổi sáng',
63
+ //},
64
+ //{
65
+ //label: 'Buổi chiều',
66
+ //value: 'Buổi chiều',
67
+ //},
68
+ //{
69
+ //label: 'Buổi toi',
70
+ //value: 'Buổi toi',
71
+ //},
72
+ //{
73
+ //label: 'Buổi dem ',
74
+ //value: 'Buổi dem',
75
+ //},
76
+ //{
77
+ //label: 'Other',
78
+ //value: 'Other',
79
+ //},
80
+ //],
81
+ //},
82
+ //{
83
+ //type: 'input',
84
+ //label: 'Chọn ngày',
85
+ //input_type: 'date',
86
+ //is_required: true,
87
+ //key: 'schedule',
88
+ //},
89
+ //{
90
+ //type: 'input',
91
+ //label: 'Đánh giá',
92
+ //label_description: 'Chọn theo thang điểm 1-5',
93
+ //input_type: 'rating',
94
+ //key: 'rating',
95
+ //},
96
+ //{
97
+ //type: 'button',
98
+ //label: 'Đặt lịch',
99
+ //},
100
+ //],
101
+ //primary_color: 'rgb(224, 31, 111)',
102
+ //header_style: {
103
+ //font_family: 'Roboto',
104
+ //font_size: '20',
105
+ //},
106
+ //text_style: {
107
+ //font_family: 'Yeseva One',
108
+ //font_size: '16',
109
+ //},
110
+ //input_style: {
111
+ //font_family: 'Dancing Script',
112
+ //font_size: '18',
113
+ //},
114
+
115
+ //}
116
+ //}
34
117
  this.setState({formSetting, submission, isSubmited})
35
118
  }
36
119
 
package/src/form/Form.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import {Com} from '../common.js'
2
- import {h, createRef} from 'preact'
2
+ import {h, createRef, Fragment} from 'preact'
3
3
  import sb from '../util/index.js'
4
4
  import Block from '../chatbox/block.js'
5
+ import RatingStars from './rating-stars.js'
5
6
 
6
7
  export default class Form2 extends Com {
7
8
  state = {
@@ -71,6 +72,7 @@ export default class Form2 extends Com {
71
72
  {com.input_type === 'radio' && this.renderFieldRadioInput(com, idx)}
72
73
  {com.input_type === 'checkbox' && this.renderFieldCheckboxInput(com, idx)}
73
74
  {(com.input_type === 'dropdown' || com.input_type === 'select') && this.renderFieldDropdownInput(com, idx)}
75
+ {com.input_type === 'rating' && this.renderFieldRatingInput(com, idx)}
74
76
  {errorMsg && <div class='form-control--valid-input--error'>{errorMsg}</div>}
75
77
  </div>
76
78
  )
@@ -121,48 +123,60 @@ export default class Form2 extends Com {
121
123
  let val = sb.find(this.props.submission.values, (f) => f.key === com.key) || {}
122
124
  val = val.value || '""'
123
125
  val = sb.parseJSON(val)
124
- return sb.map(com.input_options, (option, oidx) => {
125
- let id = com.key + '_' + oidx
126
- return (
127
- <div class='radio'>
128
- <input
129
- type='radio'
130
- name={com.key}
131
- id={id}
132
- checked={option.value === val}
133
- onChange={() => this.toggleRadioField(com.key, option.value)}
134
- />
135
- <label class='radio--label' for={id}>
136
- {option.label}
137
- </label>
138
- <div class='radio--check' />
139
- </div>
140
- )
141
- })
126
+ let wrappercls = 'form-radios-wrapper'
127
+ if (sb.size(com.input_options) >= 3 && this.props.mode !== 'attachment') wrappercls += ' horizontal'
128
+ return (
129
+ <div class={wrappercls}>
130
+ {sb.map(com.input_options, (option, oidx) => {
131
+ let id = com.key + '_' + oidx
132
+ return (
133
+ <div class='radio'>
134
+ <input
135
+ type='radio'
136
+ name={com.key}
137
+ id={id}
138
+ checked={option.value === val}
139
+ onChange={() => this.toggleRadioField(com.key, option.value)}
140
+ />
141
+ <label class='radio--label' for={id}>
142
+ {option.label}
143
+ </label>
144
+ <div class='radio--check' />
145
+ </div>
146
+ )
147
+ })}
148
+ </div>
149
+ )
142
150
  }
143
151
 
144
152
  renderFieldCheckboxInput = (com, idx) => {
145
153
  let val = sb.find(this.props.submission.values, (f) => f.key === com.key) || {}
146
154
  val = val.value || '[]'
147
155
  val = sb.parseJSON(val)
148
- return sb.map(com.input_options, (option, oidx) => {
149
- let id = com.key + '_' + oidx
150
- return (
151
- <div class='checkbox'>
152
- <input
153
- type='checkbox'
154
- name={com.key}
155
- id={id}
156
- checked={val.includes(option.value)}
157
- onChange={() => this.toggleCheckboxField(com.key, option.value)}
158
- />
159
- <label class='checkbox--label' for={id}>
160
- {option.label}
161
- </label>
162
- <div class='checkbox--check' />
163
- </div>
164
- )
165
- })
156
+ let wrappercls = 'form-checkboxes-wrapper'
157
+ if (sb.size(com.input_options) >= 3 && this.props.mode !== 'attachment') wrappercls += ' horizontal'
158
+ return (
159
+ <div class={wrappercls}>
160
+ {sb.map(com.input_options, (option, oidx) => {
161
+ let id = com.key + '_' + oidx
162
+ return (
163
+ <div class='checkbox'>
164
+ <input
165
+ type='checkbox'
166
+ name={com.key}
167
+ id={id}
168
+ checked={val.includes(option.value)}
169
+ onChange={() => this.toggleCheckboxField(com.key, option.value)}
170
+ />
171
+ <label class='checkbox--label' for={id}>
172
+ {option.label}
173
+ </label>
174
+ <div class='checkbox--check' />
175
+ </div>
176
+ )
177
+ })}
178
+ </div>
179
+ )
166
180
  }
167
181
 
168
182
  renderFieldDropdownInput = (com, idx) => {
@@ -207,6 +221,10 @@ export default class Form2 extends Com {
207
221
  )
208
222
  }
209
223
 
224
+ renderFieldRatingInput = (com, idx) => {
225
+ return <RatingStars onChange={(v) => this.onChangeValue(com.key, v)} />
226
+ }
227
+
210
228
  onSubmit = (e) => {
211
229
  e.preventDefault()
212
230
  if (!this.validateForm()) return
@@ -303,6 +321,51 @@ export default class Form2 extends Com {
303
321
  this.setState({errorFields: errors})
304
322
  }
305
323
 
324
+ renderFormHeader = () => {
325
+ let title = sb.get(this.props.formSetting, 'title') || ''
326
+ let desc = sb.get(this.props.formSetting, 'description') || ''
327
+
328
+ if (this.props.mode === 'attachment') {
329
+ if (title.trim() || desc.trim()) {
330
+ return (
331
+ <div class='form-component form-component-block'>
332
+ {title && <div>{title}</div>}
333
+ {desc && <div class='text-sm text-muted'>{desc}</div>}
334
+ </div>
335
+ )
336
+ }
337
+ }
338
+
339
+ let brandLogo = sb.get(this.props.formSetting, 'logo.url')
340
+ let brandUrl = sb.get(this.props.formSetting, 'brand_url')
341
+ let $logo = null
342
+ if (brandLogo) {
343
+ $logo = (
344
+ <div class='form-page-logo-wrapper'>
345
+ <a href={brandUrl || 'javascript:;'}>
346
+ <img src={brandLogo} class='form-page-logo' />
347
+ </a>
348
+ </div>
349
+ )
350
+ }
351
+ let $header = null
352
+ if (title.trim() || desc.trim()) {
353
+ $header = (
354
+ <div class='form-page-header'>
355
+ <div class='form-page-title'>{title}</div>
356
+ {desc && <div class='form-page-desc'>{desc}</div>}
357
+ </div>
358
+ )
359
+ }
360
+
361
+ return (
362
+ <Fragment>
363
+ {$logo}
364
+ {$header}
365
+ </Fragment>
366
+ )
367
+ }
368
+
306
369
  render() {
307
370
  let components = sb.get(this.props.formSetting, 'components') || []
308
371
  let title = sb.get(this.props.formSetting, 'title') || ''
@@ -315,12 +378,7 @@ export default class Form2 extends Com {
315
378
  <div class='form-component'>{this.props.t('you_have_submitted_info_successfully')}</div>
316
379
  )}
317
380
  <form onSubmit={this.onSubmit}>
318
- {this.props.mode === 'attachment' && (title || desc) && (
319
- <div class='form-component form-component-block'>
320
- {title && <div>{title}</div>}
321
- {desc && <div class='text-sm text-muted'>{desc}</div>}
322
- </div>
323
- )}
381
+ {this.renderFormHeader()}
324
382
  {sb.map(components, this.renderFormComponent)}
325
383
  </form>
326
384
  </div>