Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// get Dynamics attribute
const attribute = getAttribute(logicalName)
if (attribute) {
const token = ctx => onChangeHandler(logicalName, attribute.getValue())
attribute.addOnChange(token)
// set hasValue
const value = attribute.getValue()
const hasValue = attribute ? (value !== null) : false
return Maybe.Some({
name: logicalName, logicalName, attribute, hasValue, unregisterToken: token, value,
} as Attribute)
}
else {
// throw an error?
if (DEBUG) console.log("connect: Unable to connect:", logicalName)
return Maybe.None>()
}
}).filter(aOpt => aOpt.isSome()).map(aOpt => aOpt.some())
return { ...state, ...normalizeWith("logicalName", x) }
constructor(props) {
super(props)
this.state = {
items: [],
selected: Maybe.None(),
buffer: Maybe.None(),
changed: [],
}
this.selection = new Selection({
onSelectionChanged: this.onSelectionChanged,
// only used on setItems, so useless in restricting selection
//canSelectItem: this.canSelectItem,
})
}
private selection: ISelection
constructor(props) {
super(props)
this.state = {
items: [],
selected: Maybe.None(),
buffer: Maybe.None(),
changed: [],
}
this.selection = new Selection({
onSelectionChanged: this.onSelectionChanged,
// only used on setItems, so useless in restricting selection
//canSelectItem: this.canSelectItem,
})
}
private selection: ISelection
protected refresh = async () => {
return setStatePromise(this, {
buffer: Maybe.None(),
selected: Maybe.None(),
}).then(() => {
this.sorted = []
return this.getData(this.props.entityId)
})
}