haya-select 1.0.17 → 1.0.18
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 +1 -1
- package/src/select/index.jsx +5 -1
package/package.json
CHANGED
package/src/select/index.jsx
CHANGED
|
@@ -37,6 +37,7 @@ export default class HayaSelect extends React.PureComponent {
|
|
|
37
37
|
model: PropTypes.object,
|
|
38
38
|
multiple: PropTypes.bool.isRequired,
|
|
39
39
|
onChange: PropTypes.func,
|
|
40
|
+
onOptionsClosed: PropTypes.func,
|
|
40
41
|
options: PropTypes.oneOfType([PropTypes.array, PropTypes.func]).isRequired,
|
|
41
42
|
placeholder: PropTypes.node,
|
|
42
43
|
search: PropTypes.bool.isRequired,
|
|
@@ -111,6 +112,7 @@ export default class HayaSelect extends React.PureComponent {
|
|
|
111
112
|
model,
|
|
112
113
|
multiple,
|
|
113
114
|
onChange,
|
|
115
|
+
onOptionsClosed,
|
|
114
116
|
options,
|
|
115
117
|
placeholder,
|
|
116
118
|
search,
|
|
@@ -266,6 +268,8 @@ export default class HayaSelect extends React.PureComponent {
|
|
|
266
268
|
loadedOptions: undefined,
|
|
267
269
|
opened: false
|
|
268
270
|
})
|
|
271
|
+
|
|
272
|
+
if (this.props.onOptionsClosed) this.props.onOptionsClosed()
|
|
269
273
|
}
|
|
270
274
|
|
|
271
275
|
openOptions() {
|
|
@@ -294,7 +298,7 @@ export default class HayaSelect extends React.PureComponent {
|
|
|
294
298
|
|
|
295
299
|
// If options are open and a click is made outside of the options container
|
|
296
300
|
if (opened && optionsContainerRef.current && !optionsContainerRef.current?.contains(e.target)) {
|
|
297
|
-
this.
|
|
301
|
+
this.closeOptions()
|
|
298
302
|
}
|
|
299
303
|
}
|
|
300
304
|
|