@woosmap/ui 4.31.2 → 4.31.4
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/package.json
CHANGED
|
@@ -222,9 +222,10 @@ export default class LanguageSelect extends Component {
|
|
|
222
222
|
constructor(props) {
|
|
223
223
|
super(props);
|
|
224
224
|
const { defaultValue } = props;
|
|
225
|
-
const defaultLanguage =
|
|
225
|
+
const defaultLanguage =
|
|
226
|
+
defaultValue && defaultValue.map((language) => languageOptions.find((item) => item.value === language));
|
|
226
227
|
this.state = {
|
|
227
|
-
languages:
|
|
228
|
+
languages: defaultLanguage,
|
|
228
229
|
};
|
|
229
230
|
}
|
|
230
231
|
|
|
@@ -239,19 +240,16 @@ export default class LanguageSelect extends Component {
|
|
|
239
240
|
};
|
|
240
241
|
|
|
241
242
|
onChange = (newValue, actionMeta) => {
|
|
242
|
-
const { minimumLength, isMulti } = this.props;
|
|
243
|
+
const { minimumLength, isMulti, onChange } = this.props;
|
|
243
244
|
const newLanguages = newValue;
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
break;
|
|
251
|
-
default:
|
|
252
|
-
break;
|
|
245
|
+
if (
|
|
246
|
+
(actionMeta.action === 'remove-value' || actionMeta.action === 'pop-value') &&
|
|
247
|
+
newValue.length < minimumLength &&
|
|
248
|
+
isMulti
|
|
249
|
+
) {
|
|
250
|
+
return;
|
|
253
251
|
}
|
|
254
|
-
|
|
252
|
+
if (onChange !== null) onChange(newValue);
|
|
255
253
|
this.setState({ languages: newLanguages });
|
|
256
254
|
};
|
|
257
255
|
|
|
@@ -263,7 +261,7 @@ export default class LanguageSelect extends Component {
|
|
|
263
261
|
return (
|
|
264
262
|
<Select
|
|
265
263
|
isMulti={isMulti}
|
|
266
|
-
className="select__item"
|
|
264
|
+
className="select__item select__item--language"
|
|
267
265
|
classNamePrefix="select"
|
|
268
266
|
options={this.getOptions()}
|
|
269
267
|
components={{ MultiValueLabel, MultiValueRemove, Option }}
|
|
@@ -322,7 +320,7 @@ LanguageSelect.propTypes = {
|
|
|
322
320
|
isMulti: PropTypes.bool,
|
|
323
321
|
placeholder: PropTypes.string,
|
|
324
322
|
value: PropTypes.string,
|
|
325
|
-
defaultValue: PropTypes.
|
|
323
|
+
defaultValue: PropTypes.arrayOf(PropTypes.oneOf(languageOptions.map((x) => x.value))),
|
|
326
324
|
minimumLength: PropTypes.number,
|
|
327
325
|
onChange: PropTypes.func,
|
|
328
326
|
className: PropTypes.string,
|
|
@@ -33,6 +33,9 @@
|
|
|
33
33
|
fill $secondary
|
|
34
34
|
&__value-container
|
|
35
35
|
padding-left 1rem !important
|
|
36
|
+
.select__item--language &
|
|
37
|
+
overflow-y auto !important
|
|
38
|
+
max-height 7rem
|
|
36
39
|
&__single-value
|
|
37
40
|
color $secondary !important
|
|
38
41
|
&__indicator
|
|
@@ -84,6 +87,8 @@
|
|
|
84
87
|
&__label
|
|
85
88
|
padding-right .2rem !important
|
|
86
89
|
color $light !important
|
|
90
|
+
&:only-child
|
|
91
|
+
margin-right .3rem !important
|
|
87
92
|
&__remove
|
|
88
93
|
cursor pointer
|
|
89
94
|
svg
|