iCellEditor.d.ts 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import { Column } from "../entities/column";
  2. import { RowNode } from "../entities/rowNode";
  3. import { GridApi } from "../gridApi";
  4. import { ColumnApi } from "../columnController/columnApi";
  5. import { ColDef } from "../entities/colDef";
  6. import { IPopupComponent } from "./iPopupComponent";
  7. export interface ICellEditor {
  8. /**
  9. * Return the final value - called by the grid once after editing is complete
  10. */
  11. getValue(): any;
  12. /** Gets called once after initialised. If you return true, the editor will
  13. * appear in a popup, so is not constrained to the boundaries of the cell.
  14. * This is great if you want to, for example, provide you own custom dropdown list
  15. * for selection. Default is false (ie if you don't provide the method).
  16. */
  17. isPopup?(): boolean;
  18. /** Gets called once, only if isPopup() returns true. Return "over" if the popup
  19. * should cover the cell, or "under" if it should be positioned below leaving the
  20. * cell value visible. If this method is not present, the default is "over".
  21. */
  22. getPopupPosition?(): string;
  23. /** Gets called once after initialised. If you return true, the editor will not be
  24. * used and the grid will continue editing. Use this to make a decision on editing
  25. * inside the init() function, eg maybe you want to only start editing if the user
  26. * hits a numeric key, but not a letter, if the editor is for numbers.
  27. */
  28. isCancelBeforeStart?(): boolean;
  29. /** Gets called once after editing is complete. If your return true, then the new
  30. * value will not be used. The editing will have no impact on the record. Use this
  31. * if you do not want a new value from your gui, i.e. you want to cancel the editing.
  32. */
  33. isCancelAfterEnd?(): boolean;
  34. /**
  35. * If doing full line edit, then gets called when focus should be put into the editor
  36. */
  37. focusIn?(): void;
  38. /**
  39. * If doing full line edit, then gets called when focus is leaving the editor
  40. */
  41. focusOut?(): void;
  42. /** If using a framework this returns the underlying component instance, so you can call
  43. * methods on it if you want.
  44. */
  45. getFrameworkComponentInstance?(): any;
  46. }
  47. export interface ICellEditorParams {
  48. value: any;
  49. keyPress: number | null;
  50. charPress: string | null;
  51. column: Column;
  52. colDef: ColDef;
  53. node: RowNode;
  54. data: any;
  55. rowIndex: number;
  56. api: GridApi | null | undefined;
  57. columnApi: ColumnApi | null | undefined;
  58. cellStartedEdit: boolean;
  59. context: any;
  60. $scope: any;
  61. onKeyDown: (event: KeyboardEvent) => void;
  62. stopEditing: (suppressNavigateAfterEdit?: boolean) => void;
  63. eGridCell: HTMLElement;
  64. parseValue: (value: any) => any;
  65. formatValue: (value: any) => any;
  66. }
  67. export interface ICellEditorComp extends ICellEditor, IPopupComponent<ICellEditorParams> {
  68. }