@woosmap/ui 4.36.1 → 4.36.3
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,11 @@ export default class LanguageSelect extends Component {
|
|
|
222
222
|
constructor(props) {
|
|
223
223
|
super(props);
|
|
224
224
|
const { defaultValue } = props;
|
|
225
|
-
const
|
|
225
|
+
const defaultLanguages =
|
|
226
|
+
defaultValue &&
|
|
227
|
+
defaultValue.map((defaultLanguage) => languageOptions.find((item) => item.value === defaultLanguage));
|
|
226
228
|
this.state = {
|
|
227
|
-
languages:
|
|
229
|
+
languages: defaultLanguages,
|
|
228
230
|
};
|
|
229
231
|
}
|
|
230
232
|
|
|
@@ -239,19 +241,16 @@ export default class LanguageSelect extends Component {
|
|
|
239
241
|
};
|
|
240
242
|
|
|
241
243
|
onChange = (newValue, actionMeta) => {
|
|
242
|
-
const { minimumLength, isMulti } = this.props;
|
|
244
|
+
const { minimumLength, isMulti, onChange } = this.props;
|
|
243
245
|
const newLanguages = newValue;
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
break;
|
|
251
|
-
default:
|
|
252
|
-
break;
|
|
246
|
+
if (
|
|
247
|
+
(actionMeta.action === 'remove-value' || actionMeta.action === 'pop-value') &&
|
|
248
|
+
newValue.length < minimumLength &&
|
|
249
|
+
isMulti
|
|
250
|
+
) {
|
|
251
|
+
return;
|
|
253
252
|
}
|
|
254
|
-
|
|
253
|
+
if (onChange !== null) onChange(newValue);
|
|
255
254
|
this.setState({ languages: newLanguages });
|
|
256
255
|
};
|
|
257
256
|
|
|
@@ -263,7 +262,7 @@ export default class LanguageSelect extends Component {
|
|
|
263
262
|
return (
|
|
264
263
|
<Select
|
|
265
264
|
isMulti={isMulti}
|
|
266
|
-
className="select__item"
|
|
265
|
+
className="select__item select__item--language"
|
|
267
266
|
classNamePrefix="select"
|
|
268
267
|
options={this.getOptions()}
|
|
269
268
|
components={{ MultiValueLabel, MultiValueRemove, Option }}
|
|
@@ -322,7 +321,7 @@ LanguageSelect.propTypes = {
|
|
|
322
321
|
isMulti: PropTypes.bool,
|
|
323
322
|
placeholder: PropTypes.string,
|
|
324
323
|
value: PropTypes.string,
|
|
325
|
-
defaultValue: PropTypes.
|
|
324
|
+
defaultValue: PropTypes.arrayOf(PropTypes.oneOf(languageOptions.map((x) => x.value))),
|
|
326
325
|
minimumLength: PropTypes.number,
|
|
327
326
|
onChange: PropTypes.func,
|
|
328
327
|
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
|