1 | // Type definitions for ag-grid v18.1.2
|
2 | // Project: http://www.ag-grid.com/
|
3 | // Definitions by: Niall Crosby <https://github.com/ag-grid/>
|
4 | import { GridOptions } from "../../entities/gridOptions";
|
5 | import { IComponent } from "../../interfaces/iComponent";
|
6 | import { ColDef, ColGroupDef } from "../../entities/colDef";
|
7 | import { Promise } from "../../utils";
|
8 | import { AgGridRegisteredComponentInput } from "./componentProvider";
|
9 | import { ISetFilterParams } from "../../interfaces/iSetFilterParams";
|
10 | import { IRichCellEditorParams } from "../../interfaces/iRichCellEditorParams";
|
11 | import { RowNode } from "../../entities/rowNode";
|
12 | import { Column } from "../../entities/column";
|
13 | import { GridApi } from "../../gridApi";
|
14 | import { ColumnApi } from "../../columnController/columnApi";
|
15 | export declare type ComponentHolder = GridOptions | ColDef | ColGroupDef | ISetFilterParams | IRichCellEditorParams;
|
16 | export declare type AgComponentPropertyInput<A extends IComponent<any>> = AgGridRegisteredComponentInput<A> | string;
|
17 | export declare enum ComponentType {
|
18 | AG_GRID = 0,
|
19 | FRAMEWORK = 1,
|
20 | }
|
21 | export declare enum ComponentSource {
|
22 | DEFAULT = 0,
|
23 | REGISTERED_BY_NAME = 1,
|
24 | HARDCODED = 2,
|
25 | }
|
26 | export interface DynamicComponentParams {
|
27 | data?: any;
|
28 | node?: RowNode;
|
29 | colDef?: ColDef;
|
30 | column?: Column;
|
31 | $scope?: any;
|
32 | rowIndex?: number;
|
33 | api: GridApi;
|
34 | columnApi: ColumnApi;
|
35 | }
|
36 | export interface DynamicComponentDef {
|
37 | component?: string;
|
38 | params?: any;
|
39 | }
|
40 | /**
|
41 | * B the business interface (ie IHeader)
|
42 | * A the agGridComponent interface (ie IHeaderComp). The final object acceptable by ag-grid
|
43 | */
|
44 | export interface ResolvedComponent<A extends IComponent<any> & B, B> {
|
45 | component: {
|
46 | new (): A;
|
47 | } | {
|
48 | new (): B;
|
49 | };
|
50 | type: ComponentType;
|
51 | source: ComponentSource;
|
52 | dynamicParams: any;
|
53 | }
|
54 | export declare class ComponentResolver {
|
55 | private gridOptions;
|
56 | private gridOptionsWrapper;
|
57 | private context;
|
58 | private agComponentUtils;
|
59 | private componentMetadataProvider;
|
60 | private componentProvider;
|
61 | private frameworkComponentWrapper;
|
62 | /**
|
63 | * This method returns the underlying representation of the component to be created. ie for Javascript the
|
64 | * underlying function where we should be calling new into. In case of the frameworks, the framework class
|
65 | * object that represents the component to be created.
|
66 | *
|
67 | * This method is handy for different reasons, for example if you want to check if a component has a particular
|
68 | * method implemented without having to create the component, just by inspecting the source component
|
69 | *
|
70 | * It takes
|
71 | * @param holder: This is the context for which this component needs to be created, it can be gridOptions
|
72 | * (global) or columnDef mostly.
|
73 | * @param propertyName: The name of the property used in ag-grid as a convention to refer to the component, it can be:
|
74 | * 'floatingFilter', 'cellRenderer', is used to find if the user is specifying a custom component
|
75 | * @param dynamicComponentParams: Params to be passed to the dynamic component function in case it needs to be
|
76 | * invoked
|
77 | * @param defaultComponentName: The name of the component to load if there is no component specified
|
78 | */
|
79 | getComponentToUse<A extends IComponent<any> & B, B>(holder: ComponentHolder, propertyName: string, dynamicComponentParams: DynamicComponentParams, defaultComponentName?: string): ResolvedComponent<A, B>;
|
80 | private resolveByName<A, B>(propertyName, componentNameOpt?);
|
81 | /**
|
82 | * Useful to check what would be the resultant params for a given object
|
83 | * @param holder: This is the context for which this component needs to be created, it can be gridOptions
|
84 | * (global) or columnDef mostly.
|
85 | * @param propertyName: The name of the property used in ag-grid as a convention to refer to the component, it can be:
|
86 | * 'floatingFilter', 'cellRenderer', is used to find if the user is specifying a custom component
|
87 | * @param agGridParams: Params to be passed to the component and passed by ag-Grid. This will get merged with any params
|
88 | * specified by the user in the configuration
|
89 | * @returns {any} It merges the user agGridParams with the actual params specified by the user.
|
90 | */
|
91 | mergeParams(holder: ComponentHolder, propertyName: string, agGridParams: any, dynamicCustomParams: any, dynamicParams?: any): any;
|
92 | /**
|
93 | * This method creates a component given everything needed to guess what sort of component needs to be instantiated
|
94 | * It takes
|
95 | * @param holderOpt: This is the context for which this component needs to be created, it can be gridOptions
|
96 | * (global) or columnDef mostly.
|
97 | * @param agGridParams: Params to be passed to the component and passed by ag-Grid. This will get merged with any params
|
98 | * specified by the user in the configuration
|
99 | * @param propertyName: The name of the property used in ag-grid as a convention to refer to the component, it can be:
|
100 | * 'floatingFilter', 'cellRenderer', is used to find if the user is specifying a custom component
|
101 | * @param dynamicComponentParams: Params to be passed to the dynamic component function in case it needs to be
|
102 | * invoked
|
103 | * @param defaultComponentName: The actual name of the component to instantiate, this is usually the same as propertyName, but in
|
104 | * some cases is not, like floatingFilter, if it is the same is not necessary to specify
|
105 | * @param mandatory: Handy method to tell if this should return a component ALWAYS. if that is the case, but there is no
|
106 | * component found, it throws an error, by default all components are MANDATORY
|
107 | * @param customInitParamsCb: A chance to customise the params passed to the init method. It receives what the current
|
108 | * params are and the component that init is about to get called for
|
109 | */
|
110 | createAgGridComponent<A extends IComponent<any>>(holderOpt: ComponentHolder, agGridParams: any, propertyName: string, dynamicComponentParams: DynamicComponentParams, defaultComponentName?: string, mandatory?: boolean, customInitParamsCb?: (params: any, component: A) => any): Promise<A>;
|
111 | /**
|
112 | * This method creates a component given everything needed to guess what sort of component needs to be instantiated
|
113 | * It takes
|
114 | * @param clazz: The class to instantiate,
|
115 | * @param agGridParams: Params to be passed to the component and passed by ag-Grid. This will get merged with any params
|
116 | * specified by the user in the configuration
|
117 | * @param customInitParamsCb: A chance to customise the params passed to the init method. It receives what the current
|
118 | * params are and the component that init is about to get called for
|
119 | */
|
120 | createInternalAgGridComponent<A extends IComponent<any>>(clazz: {
|
121 | new (): A;
|
122 | }, agGridParams: any, customInitParamsCb?: (params: any, component: A) => any): A;
|
123 | private newAgGridComponent<A, B>(holder, propertyName, dynamicComponentParams, defaultComponentName?, mandatory?);
|
124 | private initialiseComponent<A>(component, agGridParams, customInitParamsCb?);
|
125 | }
|
126 |
|
\ | No newline at end of file |