@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.
package/assets/less/form.less
CHANGED
|
@@ -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:
|
|
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
|
-
},
|
|
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
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=
|
|
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
|
})}
|