Advertisement
Guest User

ng-table.d.ts

a guest
Dec 22nd, 2014
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. declare module ngTable {
  2.    
  3.     interface IDefaultParams {
  4.         page?: number;
  5.         count?: number;
  6.         filter?: IFilterDef;
  7.         sorting?: ISortingDef;
  8.         group?: {};
  9.         groupBy?: any;
  10.     }
  11.  
  12.     interface IDefaultSettings {
  13.         total: number;
  14.         defaultSort?: string;
  15.         filterDelay?: number;
  16.         counts?: number[];
  17.         getGroups? ($defer: ng.IDeferred<any>, column: any): any;
  18.         getData($defer: ng.IDeferred<any>, params: IParams): any;
  19.     }
  20.    
  21.     interface ISortingDef {
  22.         [key: string]: string;
  23.     }
  24.  
  25.     interface IFilterDef {
  26.         [key: string]: string;
  27.     }
  28.  
  29.     interface IParams
  30.     {
  31.         /**
  32.         * Gets or sets the count of the result-set.
  33.         *
  34.         * @param count A number to set as the current resultset count. This is optional
  35.         */
  36.         count(count?: number): number;
  37.         /**
  38.         * Gets or sets the filter of the result-set.
  39.         *
  40.         * @param filter The filter definition as an object { fieldName:filterValue }. This is optional
  41.         */
  42.         filter(filter?: IFilterDef): any;
  43.         generatePagesArray(currentPage, totalItems, pageSize): any;
  44.         getData($defer: ng.IDeferred<any>, params: IParams): ng.IPromise<any>;
  45.         getGroups($defer: ng.IDeferred<any>, column): ng.IPromise<any>;
  46.         isSortBy(field: string, direction: string): boolean;
  47.         /**
  48.         * Return object of sorting parameters for angular filter.
  49.         *
  50.         * @returns Array like: [ '-name', '+age' ]
  51.         */
  52.         orderBy(): any[];
  53.         /**
  54.         * Gets or sets the current page postion.
  55.         *
  56.         * @param page The page number to go to. This is optional
  57.         */
  58.         page(page?: number): number;
  59.         /**
  60.         * Gets or sets the current parameters.
  61.         *
  62.         * @param newParameters The default params to alter. This is optional
  63.         * @param parseParamsFromUrl Define if the current url parameters chould be taken into account. This is optional
  64.         */
  65.         parameters(newParameters?: IDefaultParams, parseParamsFromUrl?: boolean): IParams;
  66.         reload(): Q.Promise<any>;
  67.         reloadPages(): void;
  68.         /**
  69.         * Gets or sets the current settings.
  70.         *
  71.         * @param newSettings The settings to alter. This is optional
  72.         * @returns current settings of the IParams object itself.
  73.         */
  74.         settings(newSettings?: IDefaultSettings): any;
  75.  
  76.         /**
  77.        * Gets or sets the current sorting field and direction.
  78.        *  
  79.        * @param sorting The new sorting definition. This is optional
  80.        */
  81.         sorting(sorting?: ISortingDef): ISortingDef;
  82.         /**
  83.         * Gets or sets the current sorting field and direction.
  84.         *  
  85.         * @param sorting The new sorting field. This is optional
  86.         * @param direction The new sorting direction. This is optional
  87.         */
  88.         sorting(sorting: any, direction?: string): ISortingDef;
  89.         /**
  90.         * Gets or sets the current total items count in the settings.
  91.         *
  92.         * @param total The new total number of reccords. This is optional
  93.         * @returns current number of total results or the IParams object itself.
  94.         */
  95.         total(total?: number): any;
  96.         /**
  97.         * Gets params for url maybe.
  98.         *
  99.         * @param asString flag indicates return array of string or object
  100.         * @returns If asString = true will be return array of url string parameters else key-value object.
  101.         */
  102.         url(asString: boolean): any;
  103.         /* original options */
  104.         $params: any;
  105.     }
  106.  
  107.     interface IParamsFactory {
  108.         new (params: IDefaultParams, settings?: IDefaultSettings): IParams;
  109.     }
  110.  
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement