event.d.ts 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { GridOptionsWrapper } from '../gridOptionsWrapper';
  2. import { CellComp } from '../rendering/cellComp';
  3. import { IFrameworkOverrides } from '../interfaces/iFrameworkOverrides';
  4. /**
  5. * a user once raised an issue - they said that when you opened a popup (eg context menu)
  6. * and then clicked on a selection checkbox, the popup wasn't closed. this is because the
  7. * popup listens for clicks on the body, however ag-grid WAS stopping propagation on the
  8. * checkbox clicks (so the rows didn't pick them up as row selection selection clicks).
  9. * to get around this, we have a pattern to stop propagation for the purposes of ag-Grid,
  10. * but we still let the event pass back to the body.
  11. * @param {Event} event
  12. */
  13. export declare function stopPropagationForAgGrid(event: Event): void;
  14. export declare function isStopPropagationForAgGrid(event: Event): boolean;
  15. export declare const isEventSupported: (eventName: any) => boolean;
  16. export declare function getCellCompForEvent(gridOptionsWrapper: GridOptionsWrapper, event: Event): CellComp;
  17. /**
  18. * @deprecated
  19. * Adds all type of change listeners to an element, intended to be a text field
  20. * @param {HTMLElement} element
  21. * @param {EventListener} listener
  22. */
  23. export declare function addChangeListener(element: HTMLElement, listener: EventListener): void;
  24. /**
  25. * srcElement is only available in IE. In all other browsers it is target
  26. * http://stackoverflow.com/questions/5301643/how-can-i-make-event-srcelement-work-in-firefox-and-what-does-it-mean
  27. * @param {Event} event
  28. * @returns {Element}
  29. */
  30. export declare function getTarget(event: Event): Element;
  31. export declare function isElementInEventPath(element: HTMLElement, event: Event): boolean;
  32. export declare function createEventPath(event: Event): EventTarget[];
  33. /**
  34. * firefox doesn't have event.path set, or any alternative to it, so we hack
  35. * it in. this is needed as it's to late to work out the path when the item is
  36. * removed from the dom. used by MouseEventService, where it works out if a click
  37. * was from the current grid, or a detail grid (master / detail).
  38. * @param {Event} event
  39. */
  40. export declare function addAgGridEventPath(event: Event): void;
  41. /**
  42. * Gets the path for an Event.
  43. * https://stackoverflow.com/questions/39245488/event-path-undefined-with-firefox-and-vue-js
  44. * https://developer.mozilla.org/en-US/docs/Web/API/Event
  45. * @param {Event} event
  46. * @returns {EventTarget[]}
  47. */
  48. export declare function getEventPath(event: Event): EventTarget[];
  49. export declare function addSafePassiveEventListener(frameworkOverrides: IFrameworkOverrides, eElement: HTMLElement, event: string, listener: (event?: any) => void): void;