From 8093f71e55644e52669fcef31a0ea65adc1c04cb Mon Sep 17 00:00:00 2001 From: Christian Crowhurst Date: Sun, 9 Oct 2016 17:51:33 +0100 Subject: [PATCH] Add ng-table to the notNeededPackages list (#11856) * Add ng-table to the notNeededPackages list * Delete old ng-table external type declarations --- ng-table/index.d.ts | 838 ------------------------------------- ng-table/ng-table-tests.ts | 114 ----- ng-table/tsconfig.json | 19 - notNeededPackages.json | 6 + 4 files changed, 6 insertions(+), 971 deletions(-) delete mode 100644 ng-table/index.d.ts delete mode 100644 ng-table/ng-table-tests.ts delete mode 100644 ng-table/tsconfig.json diff --git a/ng-table/index.d.ts b/ng-table/index.d.ts deleted file mode 100644 index e079977db9..0000000000 --- a/ng-table/index.d.ts +++ /dev/null @@ -1,838 +0,0 @@ -// Type definitions for ng-table -// Project: https://github.com/esvit/ng-table -// Definitions by: Christian Crowhurst -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -/** - * Parameters manager for an ngTable directive - */ -declare class NgTableParams { - /** - * The page of data rows currently being displayed in the table - */ - data: T[]; - - constructor(baseParameters?: NgTable.IParamValues, baseSettings?: NgTable.ISettings) - - /** - * Returns the number of data rows per page - */ - count(): number - /** - * Sets the number of data rows per page. - * Changes to count will cause `isDataReloadRequired` to return true - */ - count(count: number): NgTableParams - - /** - * Returns the current filter values used to restrict the set of data rows. - * @param trim supply true to return the current filter minus any insignificant values - * (null, undefined and empty string) - */ - filter(trim?: boolean): NgTable.IFilterValues - /** - * Sets filter values to the `filter` supplied; any existing filter will be removed - * Changes to filter will cause `isDataReloadRequired` to return true and the current `page` to be set to 1 - */ - filter(filter: NgTable.IFilterValues): NgTableParams - /** - * Generate array of pages. - * When no arguments supplied, the current parameter state of this `NgTableParams` instance will be used - */ - generatePagesArray(currentPage?: number, totalItems?: number, pageSize?: number, maxBlocks?: number): NgTable.IPageButton[] - /** - * Returns the current grouping used to group the data rows - */ - group(): NgTable.Grouping - /** - * Sets grouping to the `field` and `sortDirection` supplied; any existing grouping will be removed - * Changes to group will cause `isDataReloadRequired` to return true and the current `page` to be set to 1 - */ - group(field: string, sortDirection?: string): NgTableParams - /** - * Sets grouping to the `group` supplied; any existing grouping will be removed. - * Changes to group will cause `isDataReloadRequired` to return true and the current `page` to be set to 1 - */ - group(group: NgTable.Grouping): NgTableParams - /** - * Returns true when an attempt to `reload` the current `parameter` values have resulted in a failure. - * This method will continue to return true until the `reload` is successfully called or when the - * `parameter` values have changed - */ - hasErrorState(): boolean - /** - * Returns true if `filter` has significant filter value(s) (any value except null, undefined, or empty string), - * otherwise false - */ - hasFilter(): boolean - /** - * Return true when a change to `filters` require the `reload` method - * to be run so as to ensure the data presented to the user reflects these filters - */ - hasFilterChanges(): boolean - /** - * Returns true when at least one group has been set - */ - hasGroup(): boolean - /** - * Returns true when the `group` and when supplied, the `sortDirection` matches an existing group - */ - hasGroup(group: string | NgTable.IGroupingFunc, sortDirection?: string): boolean - /** - * Return true when a change to this instance should require the `reload` method - * to be run so as to ensure the data rows presented to the user reflects the current state. - * - * Note that this method will return false when the `reload` method has run but fails. In this case - * `hasErrorState` will return true. - * - * The built-in `ngTable` directives will watch for when this function returns true and will then call - * the `reload` method to load its data rows - */ - isDataReloadRequired(): boolean - /** - * Returns sorting values in a format that can be consumed by the angular `$orderBy` filter service - */ - orderBy(): string[] - /** - * Trigger a reload of the data rows - */ - reload>(): ng.IPromise - /** - * Returns the settings for the table. - */ - settings(): NgTable.ISettings - /** - * Sets the settings for the table; new setting values will be merged with the existing settings. - * Supplying a new `dataset` will cause `isDataReloadRequired` to return true and the `ngTableEventsChannel` - * to fire its `datasetChanged` event - */ - settings(newSettings: NgTable.ISettings): NgTableParams - /** - * Returns the current sorting used to order the data rows. - * Changes to sorting will cause `isDataReloadRequired` to return true - */ - sorting(): NgTable.ISortingValues - /** - * Sets sorting values to the `sorting` supplied; any existing sorting will be removed. - * Changes to sorting will cause `isDataReloadRequired` to return true - */ - sorting(sorting: NgTable.ISortingValues): NgTableParams - /** - * Sets sorting to the `field` and `direction` supplied; any existing sorting will be removed - */ - sorting(field: string, direction: string): NgTableParams - /** - * Returns the index of the current "slice" of data rows - */ - page(): number - /** - * Sets the index of the current "slice" of data rows. The index starts at 1. - * Changing the page number will cause `isDataReloadRequired` to return true - */ - page(page: number): NgTableParams - /** - * Returns the count of the data rows that match the current `filter` - */ - total(): number - /** - * Sets `settings().total` to the value supplied. - * Typically you will need to set a `total` in the body of any custom `getData` function - * you supply as a setting value to this instance. - * @example - * var tp = new NgTableParams({}, { getData: customGetData }) - * function customGetData(params) { - * var queryResult = /* code to fetch current data rows and total *\/ - * params.total(queryResult.total); - * return queryResult.dataRowsPage; - * } - */ - total(total: number): NgTableParams - /** - * Returns the current parameter values uri-encoded. Set `asString` to - * true for the parameters to be returned as an array of strings of the form 'paramName=value' - * otherwise parameters returned as a key-value object - */ - url(asString?: boolean): { [name: string]: string } | string[] -} - -declare namespace NgTable { - - interface IDataSettings { - applyPaging?: boolean; - } - - /** - * An angular value object that allow for overriding of the initial default values used when constructing - * an instance of `NgTableParams` - */ - interface IDefaults { - params?: IParamValues; - settings?: ISettings - } - - /** - * Map of the names of fields declared on a data row and the corrosponding filter value - */ - interface IFilterValues { [name: string]: any } - - /** - * Map of the names of fields on a data row and the corrosponding sort direction; - * Set the value of a key to undefined to let value of `ISettings.defaultSort` apply - */ - interface ISortingValues { [name: string]: string } - - type Grouping = IGroupValues | IGroupingFunc; - - /** - * Map of the names of fields on a data row and the corrosponding sort direction - */ - interface IGroupValues { [name: string]: string } - - /** - * Signature of a function that should return the name of the group - * that the `item` should be placed within - */ - interface IGroupingFunc { - (item: T): string; - /** - * 'asc' or 'desc'; leave undefined to let the value of `ISettings.groupOptions.defaultSort` apply - */ - sortDirection?: string - } - - /** - * The runtime values for `NgTableParams` that determine the set of data rows and - * how they are to be displayed in a table - */ - interface IParamValues { - /** - * The index of the "slice" of data rows, starting at 1, to be displayed by the table. - */ - page?: number; - /** - * The number of data rows per page - */ - count?: number; - /** - * The filter that should be applied to restrict the set of data rows - */ - filter?: IFilterValues; - /** - * The sort order that should be applied to the data rows. - */ - sorting?: ISortingValues; - /** - * The grouping that should be applied to the data rows - */ - group?: string | Grouping; - } - - - type FilterComparator = boolean | IFilterComparatorFunc; - - interface IFilterComparatorFunc { - (actual: T, expected: T): boolean; - } - - interface IFilterFunc { - (data: T[], filter: IFilterValues, filterComparator: FilterComparator): T[] - } - - - interface IFilterSettings { - /** - * Use this to determine how items are matched against the filter values. - * This setting is identical to the `comparator` parameter supported by the angular - * `$filter` filter service - * - * Defaults to `undefined` which will result in a case insensitive susbstring match when - * `IDefaultGetData` service is supplying the implementation for the - * `ISettings.getData` function - */ - filterComparator?: FilterComparator; - /** - * A duration to wait for the user to stop typing before applying the filter. - * - Defaults to 0 for small managed inmemory arrays ie where a `ISettings.dataset` argument is - * supplied to `NgTableParams.settings`. - * - Defaults to 500 milliseconds otherwise. - */ - filterDelay?: number; - /** - * The number of elements up to which a managed inmemory array is considered small. Defaults to 10000. - */ - filterDelayThreshold?: number; - /** - * Overrides `IDefaultGetDataProvider.filterFilterName`. - * The value supplied should be the name of the angular `$filter` service that will be selected to perform - * the actual filter logic. - * Defaults to 'filter'. - */ - filterFilterName?: string; - /** - * Tells `IDefaultGetData` to use this function supplied to perform the filtering instead of selecting an angular $filter. - */ - filterFn?: IFilterFunc; - /** - * The layout to use when multiple html templates are to rendered in a single table header column. - * Available values: - * - stack (the default) - * - horizontal - */ - filterLayout?: string - } - - interface IGroupSettings { - /** - * The default sort direction that will be used whenever a group is supplied that - * does not define its own sort direction - */ - defaultSort?: string; - /** - * Determines whether groups should be displayed expanded to show their items. Defaults to true - */ - isExpanded?: boolean; - } - - /** - * Definition of the buttons rendered by the data row pager directive - */ - interface IPageButton { - type: string; - number?: number; - active: boolean; - current?: boolean; - } - - /** - * Configuration settings for `NgTableParams` - */ - interface ISettings { - /** - * Returns true whenever a call to `getData` is in progress - */ - $loading?: boolean; - /** - * An array that contains all the data rows that NgTable should manage. - * The `gateData` function will be used to manage the data rows - * that ultimately will be displayed. - */ - dataset?: T[]; - dataOptions?: {}; - /** - * The total number of data rows before paging has been applied. - * Typically you will not need to supply this yourself - */ - total?: number; - /** - * The default sort direction that will be used whenever a sorting is supplied that - * does not define its own sort direction - */ - defaultSort?: string; - filterOptions?: IFilterSettings; - groupOptions?: IGroupSettings; - /** - * The page size buttons that should be displayed. Each value defined in the array - * determines the possible values that can be supplied to `NgTableParams.page()` - */ - counts?: number[]; - /** - * The collection of interceptors that should apply to the results of a call to - * the `getData` function before the data rows are displayed in the table - */ - interceptors?: IInterceptor[]; - /** - * Configuration for the template that will display the page size buttons - */ - paginationMaxBlocks?: number; - /** - * Configuration for the template that will display the page size buttons - */ - paginationMinBlocks?: number; - /** - * The html tag that will be used to display the sorting indicator in the table header - */ - sortingIndicator?: string; - /** - * The function that will be used fetch data rows. Leave undefined to let the `IDefaultGetData` - * service provide a default implementation that will work with the `dataset` array you supply. - * - * Typically you will supply a custom function when you need to execute filtering, paging and sorting - * on the server - */ - getData?: Data.IGetDataFunc | Data.IInterceptableGetDataFunc; - /** - * The function that will be used group data rows according to the groupings returned by `NgTableParams.group()` - */ - getGroups?: Data.IGetGroupFunc; - } - - /** - * Configuration values that determine the behaviour of the `ngTableFilterConfig` service - */ - interface IFilterConfigValues { - /** - * The default base url to use when deriving the url for a filter template given just an alias name - * Defaults to 'ng-table/filters/' - */ - defaultBaseUrl?: string; - /** - * The extension to use when deriving the url of a filter template when given just an alias name - */ - defaultExt?: string; - /** - * A map of alias names and their corrosponding urls. A lookup against this map will be used - * to find the url matching an alias name. - * If no match is found then a url will be derived using the following pattern `${defaultBaseUrl}${aliasName}.${defaultExt}` - */ - aliasUrls?: { [name: string]: string }; - } - - /** - * The angular provider used to configure the behaviour of the `ngTableFilterConfig` service - */ - interface IFilterConfigProvider { - $get: IFilterConfig; - /** - * Reset back to factory defaults the config values that `ngTableFilterConfig` service will use - */ - resetConfigs(): void; - /** - * Set the config values used by `ngTableFilterConfig` service - */ - setConfig(customConfig: IFilterConfigValues): void; - } - - /** - * A key value-pair map where the key is the name of a field in a data row and the value is the definition - * for the template used to render a filter cell in the header of a html table. - * Where the value is supplied as a string this should either be url to a html template or an alias to a url registered - * using the `ngTableFilterConfigProvider` - * @example - * vm.ageFilter = { "age": "number" } - * @example - * vm.ageFilter = { "age": "my/custom/ageTemplate.html" } - * @example - * vm.ageFilter = { "age": { id: "number", placeholder: "Age of person"} } - */ - interface IFilterTemplateDefMap { - [name: string]: string | IFilterTemplateDef - } - - /** - * A fully qualified template definition for a single filter - */ - interface IFilterTemplateDef { - /** - * A url to a html template of an alias to a url registered using the `ngTableFilterConfigProvider` - */ - id: string, - /** - * The text that should be rendered as a prompt to assist the user when entering a filter value - */ - placeholder: string - } - - /** - * Exposes configuration values and methods used to return the location of the html - * templates used to render the filter row of an ng-table directive - */ - interface IFilterConfig { - /** - * Readonly copy of the final values used to configure the service. - */ - config: IFilterConfigValues, - /** - * Return the url of the html filter template for the supplied definition and key. - * For more information see the documentation for `IFilterTemplateMap` - */ - getTemplateUrl(filterDef: string | IFilterTemplateDef, filterKey?: string): string, - /** - * Return the url of the html filter template registered with the alias supplied - */ - getUrlForAlias(aliasName: string, filterKey?: string): string - } - - interface InternalTableParams extends NgTableParams { - isNullInstance: boolean - } - - /** - * A custom object that can be registered with an NgTableParams instance that can be used - * to post-process the results (and failures) returned by its `getData` function - */ - interface IInterceptor { - response?: (data: TData, params: NgTableParams) => TData; - responseError?: (reason: any, params: NgTableParams) => any; - } - - type SelectData = ISelectOption[] | ISelectDataFunc - - interface ISelectOption { - id: string | number; - title: string; - } - - interface ISelectDataFunc { - (): ISelectOption[] | ng.IPromise - } - - /** - * Definition of the constructor function that will construct new instances of `NgTableParams`. - * On construction of `NgTableParams` the `ngTableEventsChannel` will fire its `afterCreated` event. - */ - interface ITableParamsConstructor { - new (baseParameters?: IParamValues, baseSettings?: ISettings): NgTableParams - } - - - namespace Data { - - type DataResult = T | IDataRowGroup; - - interface IDataRowGroup { - data: T[]; - $hideRows: boolean; - value: string; - } - - /** - * A default implementation of the getData function that will apply the `filter`, `orderBy` and - * paging values from the `NgTableParams` instance supplied to the data array supplied. - * - * A call to this function will: - * - return the resulting array - * - assign the total item count after filtering to the `total` of the `NgTableParams` instance supplied - */ - interface IDefaultGetData { - (data: T[], params: NgTableParams): T[]; - /** - * Convenience function that this service will use to apply paging to the data rows. - * - * Returns a slice of rows from the `data` array supplied and sets the `NgTableParams.total()` - * on the `params` instance supplied to `data.length` - */ - applyPaging(data: T[], params: NgTableParams): T[], - /** - * Returns a reference to the function that this service will use to filter data rows - */ - getFilterFn(params: NgTableParams): IFilterFunc, - /** - * Returns a reference to the function that this service will use to sort data rows - */ - getOrderByFn(params?: NgTableParams): void - } - - /** - * Allows for the configuration of the ngTableDefaultGetData service. - */ - interface IDefaultGetDataProvider { - $get(): IDefaultGetData; - /** - * The name of a angular filter that knows how to apply the values returned by - * `NgTableParams.filter()` to restrict an array of data. - * (defaults to the angular `filter` filter service) - */ - filterFilterName: string, - /** - * The name of a angular filter that knows how to apply the values returned by - * `NgTableParams.orderBy()` to sort an array of data. - * (defaults to the angular `orderBy` filter service) - */ - sortingFilterName: string - } - - interface IGetDataBcShimFunc { - (originalFunc: ILegacyGetDataFunc): { (params: NgTableParams): ng.IPromise } - } - - /** - * Signature of a function that will called whenever NgTable requires to load data rows - * into the table. - * `params` is the table requesting the data rows - */ - interface IGetDataFunc { - (params: NgTableParams): T[] | ng.IPromise; - } - - interface IGetGroupFunc { - (params: NgTableParams): { [name: string]: IDataRowGroup[] } - } - - /** - * Variation of the `IGetDataFunc` function signature that allows for flexibility for - * the shape of the return value. - * Typcially you will use this function signature when you want to configure `NgTableParams` with - * interceptors that will return the final data rows array. - */ - interface IInterceptableGetDataFunc { - (params: NgTableParams): TResult; - } - - interface ILegacyGetDataFunc { - ($defer: ng.IDeferred, params: NgTableParams): void - } - } - - namespace Events { - interface IEventSelectorFunc { - (publisher: NgTableParams): boolean - } - - type EventSelector = NgTableParams | IEventSelectorFunc - - interface IDatasetChangedListener { - (publisher: NgTableParams, newDataset: T[], oldDataset: T[]): any - } - interface IAfterCreatedListener { - (publisher: NgTableParams): any - } - interface IAfterReloadDataListener { - (publisher: NgTableParams, newData: NgTable.Data.DataResult[], oldData: NgTable.Data.DataResult[]): any - } - interface IPagesChangedListener { - (publisher: NgTableParams, newPages: NgTable.IPageButton[], oldPages: NgTable.IPageButton[]): any - } - - interface IUnregistrationFunc { - (): void - } - - interface IEventsChannel { - /** - * Subscribe to receive notification whenever a new `NgTableParams` instance has finished being constructed. - * Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called. Supply a - * `scope` to have angular automatically unregister the listener when the `scope` is destroyed. - * - * @param listener the function that will be called when the event fires - * @param scope the angular `$scope` that will limit the lifetime of the event subscription - * @param eventFilter a predicate function that should return true to receive the event - * @return a unregistration function that when called will unregister the `listener` - */ - onAfterCreated(listener: Events.IAfterCreatedListener, scope: ng.IScope, eventFilter?: Events.IEventSelectorFunc): IUnregistrationFunc; - /** - * Subscribe to receive notification whenever a new `NgTableParams` instance has finished being constructed. - * Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called. - * - * @param listener the function that will be called when the event fires - * @param eventFilter a predicate function that should return true to receive the event - * @return a unregistration function that when called will unregister the `listener` - */ - onAfterCreated(listener: Events.IAfterCreatedListener, eventFilter?: Events.IEventSelectorFunc): IUnregistrationFunc; - /** - * Subscribe to receive notification whenever the `reload` method of an `NgTableParams` instance has successfully executed - * Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called. Supply a - * `scope` to have angular automatically unregister the listener when the `scope` is destroyed. - * - * @param listener the function that will be called when the event fires - * @param scope the angular `$scope` that will limit the lifetime of the event subscription - * @param eventFilter either the specific `NgTableParams` instance you want to receive events for or a predicate function that should return true to receive the event - * @return a unregistration function that when called will unregister the `listener` - */ - onAfterReloadData(listener: Events.IAfterReloadDataListener, scope: ng.IScope, eventFilter?: Events.EventSelector): IUnregistrationFunc; - /** - * Subscribe to receive notification whenever the `reload` method of an `NgTableParams` instance has successfully executed - * Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called. - * - * @param listener the function that will be called when the event fires - * @param eventFilter a predicate function that should return true to receive the event - * @return a unregistration function that when called will unregister the `listener` - */ - onAfterReloadData(listener: Events.IAfterReloadDataListener, eventFilter?: Events.EventSelector): IUnregistrationFunc; - - /** - * Subscribe to receive notification whenever a new data rows *array* is supplied as a `settings` value to a `NgTableParams` instance. - * Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called. Supply a - * `scope` to have angular automatically unregister the listener when the `scope` is destroyed. - * - * @param listener the function that will be called when the event fires - * @param scope the angular `$scope` that will limit the lifetime of the event subscription - * @param eventFilter either the specific `NgTableParams` instance you want to receive events for or a predicate function that should return true to receive the event - * @return a unregistration function that when called will unregister the `listener` - */ - onDatasetChanged(listener: Events.IDatasetChangedListener, scope: ng.IScope, eventFilter?: Events.EventSelector): IUnregistrationFunc; - /** - * Subscribe to receive notification whenever a new data rows *array* is supplied as a `settings` value to a `NgTableParams` instance. - * Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called. - * - * @param listener the function that will be called when the event fires - * @param eventFilter either the specific `NgTableParams` instance you want to receive events for or a predicate function that should return true to receive the event - * @return a unregistration function that when called will unregister the `listener` - */ - onDatasetChanged(listener: Events.IDatasetChangedListener, eventFilter?: Events.EventSelector): IUnregistrationFunc; - - /** - * Subscribe to receive notification whenever the paging buttons for an `NgTableParams` instance change - * Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called. Supply a - * `scope` to have angular automatically unregister the listener when the `scope` is destroyed. - * - * @param listener the function that will be called when the event fires - * @param scope the angular `$scope` that will limit the lifetime of the event subscription - * @param eventFilter either the specific `NgTableParams` instance you want to receive events for or a predicate function that should return true to receive the event - * @return a unregistration function that when called will unregister the `listener` - */ - onPagesChanged(listener: Events.IPagesChangedListener, scope: ng.IScope, eventFilter?: Events.EventSelector): IUnregistrationFunc; - /** - * Subscribe to receive notification whenever the paging buttons for an `NgTableParams` instance change - * Optionally supply an `eventFilter` to restrict which events that should trigger the `listener` to be called. - * - * @param listener the function that will be called when the event fires - * @param eventFilter either the specific `NgTableParams` instance you want to receive events for or a predicate function that should return true to receive the event - * @return a unregistration function that when called will unregister the `listener` - */ - onPagesChanged(listener: Events.IPagesChangedListener, eventFilter?: Events.EventSelector): IUnregistrationFunc; - - publishAfterCreated(publisher: NgTableParams): void; - publishAfterReloadData(publisher: NgTableParams, newData: T[], oldData: T[]): void; - publishDatasetChanged(publisher: NgTableParams, newDataset: T[], oldDataset: T[]): void; - publishPagesChanged(publisher: NgTableParams, newPages: NgTable.IPageButton[], oldPages: NgTable.IPageButton[]): void; - } - } - - namespace Columns { - - type ColumnFieldContext = ng.IScope & { - $column: IColumnDef; - $columns: IColumnDef[]; - } - - interface IColumnField { - (context?: ColumnFieldContext): T; - assign($scope: ng.IScope, value: T): void; - } - - /** - * The definition of the column within a ngTable. - * When using `ng-table` directive a column definition will be parsed from each `td` tag found in the - * `tr` data row tag. - * - * @example - * - * - * - * - */ - interface IColumnDef { - /** - * Custom CSS class that should be added to the `th` tag(s) of this column in the table header - * - * To set this on the `td` tag of a html table use the attribute `header-class` or `data-header-class` - */ - class: IColumnField; - /** - * The `ISelectOption`s that can be used in a html filter template for this colums. - */ - data?: SelectData; - /** - * The index position of this column within the `$columns` container array - */ - id: number; - /** - * The definition of 0 or more html filter templates that should be rendered for this column in - * the table header - */ - filter: IColumnField; - /** - * Supplies the `ISelectOption`s that can be used in a html filter template for this colums. - * At the creation of the `NgTableParams` this field will be called and the result then assigned - * to the `data` field of this column. - */ - filterData: IColumnField | SelectData>; - /** - * The name of the data row field that will be used to group on, or false when this column - * does not support grouping - */ - groupable: IColumnField; - /** - * The url of a custom html template that should be used to render a table header for this column - * - * To set this on the `td` tag for a html table use the attribute `header` or `data-header` - */ - headerTemplateURL: IColumnField; - /** - * The text that should be used as a tooltip for this column in the table header - */ - headerTitle: IColumnField; - /** - * Determines whether this column should be displayed in the table - * - * To set this on the `td` tag for a html table use the attribute `ng-if` - */ - show: IColumnField; - /** - * The name of the data row field that will be used to sort on, or false when this column - * does not support sorting - */ - sortable: IColumnField; - /** - * The title of this column that should be displayed in the table header - */ - title: IColumnField; - /** - * An alternate column title. Typically this can be used for responsive table layouts - * where the titleAlt should be used for small screen sizes - */ - titleAlt: IColumnField; - } - - type DynamicTableColField = IDynamicTableColFieldFunc | T; - - interface IDynamicTableColFieldFunc { - (context: ColumnFieldContext): T; - } - - /** - * The definition of the column supplied to a ngTableDynamic directive. - */ - interface IDynamicTableColDef { - /** - * Custom CSS class that should be added to the `th` tag(s) of this column in the table header - */ - class?: DynamicTableColField; - /** - * The definition of 0 or more html filter templates that should be rendered for this column in - * the table header - */ - filter?: DynamicTableColField; - /** - * Supplies the `ISelectOption`s that can be used in a html filter template for this colums. - * At the creation of the `NgTableParams` this field will be called and the result then assigned - * to the `data` field of this column. - */ - filterData?: DynamicTableColField | SelectData>; - /** - * The name of the data row field that will be used to group on, or false when this column - * does not support grouping - */ - groupable?: DynamicTableColField; - /** - * The url of a custom html template that should be used to render a table header for this column - */ - headerTemplateURL?: DynamicTableColField; - /** - * The text that should be used as a tooltip for this column in the table header - */ - headerTitle?: DynamicTableColField; - /** - * Determines whether this column should be displayed in the table - */ - show?: DynamicTableColField; - /** - * The name of the data row field that will be used to sort on, or false when this column - * does not support sorting - */ - sortable?: DynamicTableColField; - /** - * The title of this column that should be displayed in the table header - */ - title?: DynamicTableColField; - /** - * An alternate column title. Typically this can be used for responsive table layouts - * where the titleAlt should be used for small screen sizes - */ - titleAlt?: DynamicTableColField; - } - } -} - diff --git a/ng-table/ng-table-tests.ts b/ng-table/ng-table-tests.ts deleted file mode 100644 index e8c9c44e4d..0000000000 --- a/ng-table/ng-table-tests.ts +++ /dev/null @@ -1,114 +0,0 @@ - - -interface IPerson { - age: number; - name: string; -} - -function printPerson(p: IPerson) { - console.log('age: ' + p.age); - console.log('name: ' + p.name); -} - -// NgTableParams signature tests -namespace NgTableParamsTests { - - let initialParams: NgTable.IParamValues = { - filter: { name: 'Christian' }, - sorting: { age: 'asc' } - }; - let settings: NgTable.ISettings = { - dataset: [{ age: 1, name: 'Christian' }, { age: 2, name: 'Lee' }, { age: 40, name: 'Christian' }], - filterOptions: { - filterComparator: true, - filterDelay: 100 - }, - counts: [10, 20, 50] - }; - - export let tableParams = new NgTableParams(initialParams, settings); - - // modify parameters - tableParams.filter({ name: 'Lee' }); - tableParams.sorting('age', 'desc'); - tableParams.count(10); - tableParams.group(item => (item.age * 10).toString()); - - // modify settings at runtime - tableParams.settings({ - dataset: [{ age: 1, name: 'Brandon' }, { age: 2, name: 'Lee' }] - }); - - tableParams.reload().then(rows => { - rows.forEach(printPerson); - }); -} - -// Dynamic table column signature tests -namespace ColumnTests { - interface ICustomColFields { - field: string; - } - let dynamicCols: (NgTable.Columns.IDynamicTableColDef & ICustomColFields)[]; - - dynamicCols.push({ - class: () => 'table', - field: 'age', - filter: { age: 'number' }, - sortable: true, - show: true, - title: 'Age of Person', - titleAlt: 'Age' - }); -} - -namespace EventsTests { - declare let events: NgTable.Events.IEventsChannel; - - let unregistrationFuncs: NgTable.Events.IUnregistrationFunc[] = []; - let x: NgTable.Events.IUnregistrationFunc; - - x = events.onAfterCreated(params => { - // do stuff - }); - unregistrationFuncs.push(x); - - x = events.onAfterReloadData((params, newData, oldData) => { - newData.forEach(row => { - if (isDataGroup(row)) { - row.data.forEach(printPerson) - } else { - printPerson(row); - } - }); - }, NgTableParamsTests.tableParams); - unregistrationFuncs.push(x); - - x = events.onDatasetChanged((params, newDataset, oldDataset) => { - if (newDataset != null) { - newDataset.forEach(printPerson); - } - }, NgTableParamsTests.tableParams); - unregistrationFuncs.push(x); - - x = events.onPagesChanged((params, newButtons, oldButtons) => { - newButtons.forEach(printPageButton); - }, NgTableParamsTests.tableParams); - unregistrationFuncs.push(x); - - unregistrationFuncs.forEach(f => { - f(); - }); - - - function printPageButton(btn: NgTable.IPageButton) { - console.log('type: ' + btn.type); - console.log('number: ' + btn['number']); - console.log('current: ' + btn.current); - console.log('active: ' + btn.active); - } - - function isDataGroup(row: any): row is NgTable.Data.IDataRowGroup { - return ('$hideRows' in row); - } -} \ No newline at end of file diff --git a/ng-table/tsconfig.json b/ng-table/tsconfig.json deleted file mode 100644 index c310ef4ece..0000000000 --- a/ng-table/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "ng-table-tests.ts" - ] -} \ No newline at end of file diff --git a/notNeededPackages.json b/notNeededPackages.json index 625683156e..88ede42075 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -10,6 +10,12 @@ "typingsPackageName": "moment", "sourceRepoURL": "https://github.com/moment/moment", "asOfVersion": "2.13.0" + }, + { + "libraryName": "ng-table", + "typingsPackageName": "ng-table", + "sourceRepoURL": "https://github.com/esvit/ng-table", + "asOfVersion": "2.0.1" } ] }