@awsui/components-react
Version:
AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A
22 lines (21 loc) • 833 B
JavaScript
import { fireNonCancelableEvent, fireCancelableEvent } from '../internal/events/index';
export function useRowEvents(_a) {
var onRowClick = _a.onRowClick, onRowContextMenu = _a.onRowContextMenu;
var onRowClickHandler = function (rowIndex, item) {
var details = { rowIndex: rowIndex, item: item };
fireNonCancelableEvent(onRowClick, details);
};
var onRowContextMenuHandler = function (rowIndex, item, event) {
var details = {
rowIndex: rowIndex,
item: item,
clientX: event.clientX,
clientY: event.clientY
};
fireCancelableEvent(onRowContextMenu, details, event);
};
return {
onRowClickHandler: onRowClick && onRowClickHandler,
onRowContextMenuHandler: onRowContextMenu && onRowContextMenuHandler
};
}