haya-select 1.0.7 → 1.0.8

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.
@@ -0,0 +1,9 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: npm
4
+ directory: "/"
5
+ schedule:
6
+ interval: weekly
7
+ time: "01:00"
8
+ timezone: Europe/Copenhagen
9
+ open-pull-requests-limit: 99
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haya-select",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -12,5 +12,9 @@
12
12
  "classnames": "^2.3.1",
13
13
  "debounce": "^1.2.1",
14
14
  "diggerize": "^1.0.4"
15
+ },
16
+ "peerDependencies": {
17
+ "prop-types": ">= 15.7.2",
18
+ "react": ">= 16.0.0"
15
19
  }
16
20
  }
@@ -79,9 +79,9 @@ export default class CustomSelect extends React.PureComponent {
79
79
  }
80
80
 
81
81
  componentDidMount() {
82
- const {attribute, defaultValuesFromOptions, model, options} = this.props
82
+ const {attribute, defaultValue, defaultValuesFromOptions, model, options} = this.props
83
83
 
84
- if ((defaultValuesFromOptions || (attribute && model)) && typeof options == "function") {
84
+ if (((defaultValue || defaultValuesFromOptions) || (attribute && model)) && typeof options == "function") {
85
85
  this.loadDefaultValuesFromOptionsCallback()
86
86
  }
87
87
  }
@@ -143,9 +143,10 @@ export default class CustomSelect extends React.PureComponent {
143
143
  }
144
144
 
145
145
  defaultValues () {
146
- const {attribute, defaultValuesFromOptions, model} = this.props
146
+ const {attribute, defaultValue, defaultValuesFromOptions, model} = this.props
147
147
 
148
148
  if (defaultValuesFromOptions) return defaultValuesFromOptions
149
+ if (defaultValue) return defaultValue
149
150
 
150
151
  if (attribute && model) {
151
152
  if (!(attribute in model)) throw new Error(`No such attribute on ${model.modelClassData().name}: ${attribute}`)