@subiz/widget-v4 4.1.136 → 4.1.137

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.
@@ -302,5 +302,9 @@ body div#sbz92 {
302
302
  pointer-events: none;
303
303
  }
304
304
 
305
+ .form-wrapper.form select.form-control {
306
+ height: 40px;
307
+ }
308
+
305
309
  @import 'form.less';
306
310
  }
@@ -480,3 +480,7 @@ select {
480
480
  height: 36px;
481
481
  }
482
482
  }
483
+
484
+ select.form-control.form-control--empty {
485
+ .color(@text-muted);
486
+ }
@@ -150,14 +150,19 @@ class Form2 extends _common.Com {
150
150
  let val = _index.default.find(this.props.submission.values, f => f.key === com.key) || {};
151
151
  val = val.value || '""';
152
152
  val = _index.default.parseJSON(val);
153
+ let cls = 'form-control';
154
+ if (this.state.errorFields[com.key]) cls += ' input--error';
155
+ if (!val) cls += ' form-control--empty';
153
156
  return (0, _preact.h)("select", {
154
- class: "form-control",
157
+ class: cls,
155
158
  ref: this[`${com.key}_input`],
156
159
  onChange: e => {
157
160
  this.onChangeValue(com.key, e.target.value);
158
161
  this.clearError(com.key);
159
162
  }
160
- }, _index.default.map(com.input_options, option => {
163
+ }, (0, _preact.h)("option", {
164
+ value: ""
165
+ }, "-- ", this.props.t('no_select'), " --"), _index.default.map(com.input_options, option => {
161
166
  return (0, _preact.h)("option", {
162
167
  value: option.value
163
168
  }, option.label);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@subiz/widget-v4",
3
- "version": "4.1.136",
3
+ "version": "4.1.137",
4
4
  "main": "./compiled_src/lib.js",
5
5
  "scripts": {
6
6
  "dev": "npx webpack serve --config webpack.dev.js",
package/src/form/Form.js CHANGED
@@ -169,15 +169,19 @@ export default class Form2 extends Com {
169
169
  let val = sb.find(this.props.submission.values, (f) => f.key === com.key) || {}
170
170
  val = val.value || '""'
171
171
  val = sb.parseJSON(val)
172
+ let cls = 'form-control'
173
+ if (this.state.errorFields[com.key]) cls += ' input--error'
174
+ if (!val) cls += ' form-control--empty'
172
175
  return (
173
176
  <select
174
- class='form-control'
177
+ class={cls}
175
178
  ref={this[`${com.key}_input`]}
176
179
  onChange={(e) => {
177
180
  this.onChangeValue(com.key, e.target.value)
178
181
  this.clearError(com.key)
179
182
  }}
180
183
  >
184
+ <option value=''>-- {this.props.t('no_select')} --</option>
181
185
  {sb.map(com.input_options, (option) => {
182
186
  return <option value={option.value}>{option.label}</option>
183
187
  })}