haya-select 1.0.3 → 1.0.6
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 +3 -7
package/package.json
CHANGED
package/src/select/index.jsx
CHANGED
|
@@ -15,15 +15,15 @@ const nameForComponentWithMultiple = (component) => {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
const presentOption = (currentValue) => {
|
|
18
|
-
if (currentValue
|
|
18
|
+
if ("text" in currentValue) return currentValue.text
|
|
19
19
|
|
|
20
|
-
if (currentValue
|
|
20
|
+
if ("html" in currentValue) {
|
|
21
21
|
return (
|
|
22
22
|
<div dangerouslySetInnerHTML={{__html: digg(currentValue, "html")}} />
|
|
23
23
|
)
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
throw new Error(
|
|
26
|
+
throw new Error(`Couldn't figure out how to present option from the given keys: ${Object.keys(currentValue, ", ")}`)
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
const LoadedOption = class LoadedOption extends BaseComponent {
|
|
@@ -172,15 +172,11 @@ export default class CustomSelect extends React.PureComponent {
|
|
|
172
172
|
defaultValues () {
|
|
173
173
|
const {attribute, defaultValuesFromOptions, model} = this.props
|
|
174
174
|
|
|
175
|
-
console.log("defaultValues")
|
|
176
|
-
|
|
177
175
|
if (defaultValuesFromOptions) return defaultValuesFromOptions
|
|
178
176
|
|
|
179
177
|
if (attribute && model) {
|
|
180
178
|
if (!(attribute in model)) throw new Error(`No such attribute on ${model.modelClassData().name}: ${attribute}`)
|
|
181
179
|
|
|
182
|
-
console.log(`Default value from ${attribute}: ${model[attribute]()}`)
|
|
183
|
-
|
|
184
180
|
return model[attribute]()
|
|
185
181
|
}
|
|
186
182
|
}
|