Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(props: {}) {
super(props);
this._hasMounted = false;
// Memoizing this means that given the same parameters, it will return the same array of command objects
// (performance optimization)
this._getCommandItems = memoizeFunction(this._getCommandItems);
this.state = {
items: createListItems(ITEM_COUNT),
selection: new Selection({ onSelectionChanged: this._onSelectionChanged }),
selectionMode: SelectionMode.multiple,
canSelect: 'all'
};
this.state.selection.setItems(this.state.items, false);
}
openHotKey={KeyCodes.enter}
/>
)}
);
}
private _log(text: string): () => void {
return (): void => {
console.log(text);
};
}
}
export class HoverCardTargetExample extends React.Component<{}, {}> {
private _items: IExampleItem[] = createListItems(10);
private _columns: IColumn[] = this._buildColumns();
public render() {
return (
<p>
Hover over the <i>key</i> cell of a row item to see the card or use the keyboard to navigate to it by tabbing to a row and hitting
the right arrow key.
</p>
<p>
When using the keyboard to navigate, open the card with the hotKey and it will automatically focus the first focusable element in
the card allowing further navigation inside the card. The hotKey is defined by the hotKey prop and is defined as 'enter' in the
following example.
</p>
constructor(props: {}) {
super(props);
this._getCommandItems = memoizeFunction(this._getCommandItems);
this._allItems = createListItems(ITEMS_COUNT);
this._selection = new Selection({
onSelectionChanged: this._onItemsSelectionChanged
});
this._selection.setItems(this._allItems, false);
this.state = {
items: this._allItems,
selectionCount: 0,
groups: undefined,
groupItemLimit: DEFAULT_ITEM_LIMIT,
layoutMode: DetailsListLayoutMode.justified,
constrainMode: ConstrainMode.horizontalConstrained,
selectionMode: SelectionMode.multiple,
canResizeColumns: true,
checkboxVisibility: CheckboxVisibility.onHover,
columns: this._buildColumns(this._allItems, true, this._onColumnClick, '', undefined, undefined, this._onColumnContextMenu),
private _onAddRow = (): void => {
this.setState({
items: createListItems(1).concat(this.state.items)
});
};