haya-select 1.0.43 → 1.0.44

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haya-select",
3
- "version": "1.0.43",
3
+ "version": "1.0.44",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -39,6 +39,7 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
39
39
  multiple: PropTypes.bool.isRequired,
40
40
  name: PropTypes.string,
41
41
  onChange: PropTypes.func,
42
+ onChangeValue: PropTypes.func,
42
43
  onOptionsClosed: PropTypes.func,
43
44
  options: PropTypes.oneOfType([PropTypes.array, PropTypes.func]).isRequired,
44
45
  placeholder: PropTypes.node,
@@ -646,14 +647,28 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
646
647
  }
647
648
  }
648
649
 
650
+ const options = newState.currentOptions || currentOptions
651
+
649
652
  if (onChange) {
650
653
  onChange({
651
654
  event,
652
- options: newState.currentOptions || currentOptions,
655
+ options,
653
656
  toggles: newToggled
654
657
  })
655
658
  }
656
659
 
660
+ if (this.props.onChangeValue) {
661
+ let optionValue
662
+
663
+ if (multiple) {
664
+ optionValue = options.map((option) => option.value)
665
+ } else {
666
+ optionValue = dig(options, 0, "value")
667
+ }
668
+
669
+ this.p.onChangeValue(optionValue)
670
+ }
671
+
657
672
  if (!multiple) this.closeOptions()
658
673
  this.setState(newState)
659
674
  }