1 | import { IProvidedFilter } from "../filter/provided/providedFilter";
|
2 | import { AgPromise } from "../utils";
|
3 | import { IFilter, IFilterComp, IFilterDef, IFilterParams, IFilterType, IFloatingFilterType, ProvidedFilterModel } from "./iFilter";
|
4 | /** Interface contract for the public aspects of the ProvidedFilter implementation(s). */
|
5 | export interface IMultiFilter extends IProvidedFilter {
|
6 | /** @returns the child filter instance at the given index. */
|
7 | getChildFilterInstance(index: number): IFilter | undefined;
|
8 | }
|
9 | export interface IMultiFilterDef extends IFilterDef {
|
10 | /**
|
11 | * Configures how the filter is shown in the Multi Filter.
|
12 | * Default: `inline`
|
13 | */
|
14 | display?: 'inline' | 'accordion' | 'subMenu';
|
15 | /** The title to be used when a filter is displayed inside a sub-menu or accordion. */
|
16 | title?: string;
|
17 | /** Child filter component to use inside the Multi Filter. */
|
18 | filter?: IFilterType;
|
19 | /** Child filter component to use inside the Multi Filter. */
|
20 | filterFramework?: any;
|
21 | /** Custom parameters to be passed to the child filter component. */
|
22 | filterParams?: any;
|
23 | /** Floating filter component to use for the child filter. */
|
24 | floatingFilterComponent?: IFloatingFilterType;
|
25 | /** Floating framework filter component to use for the child filter. */
|
26 | floatingFilterComponentFramework?: any;
|
27 | /** Custom parameters to be passed to the floating filter component. */
|
28 | floatingFilterComponentParams?: any;
|
29 | }
|
30 | export interface IMultiFilterParams extends IFilterParams {
|
31 | /** An array of filter definition objects. */
|
32 | filters?: IMultiFilterDef[];
|
33 | /**
|
34 | * If true, all UI inputs managed by this filter are for display only, and the filter can only
|
35 | * be affected by API calls. Does NOT affect child filters, they need to be individually
|
36 | * configured with `readOnly` where applicable.
|
37 | * Default: `false`
|
38 | */
|
39 | readOnly?: boolean;
|
40 | }
|
41 | export interface IMultiFilterModel {
|
42 | /** Multi filter type. */
|
43 | filterType?: 'multi';
|
44 | /**
|
45 | * Child filter models in the same order as the filters are specified in `filterParams`.
|
46 | */
|
47 | filterModels: any[] | null;
|
48 | }
|
49 | export interface IMultiFilterComp {
|
50 | /** Returns `true` if the filter is currently active, otherwise `false`. */
|
51 | isFilterActive(): boolean;
|
52 | /** Returns a model representing the current state of the filter, or `null` if the filter is not active. */
|
53 | getModel(): ProvidedFilterModel | null;
|
54 | /**
|
55 | * Sets the state of the child filters using the supplied models. Providing `null` will
|
56 | * de-activate all child filters.
|
57 | *
|
58 | * **Note:** if you are providing values asynchronously to a child Set Filter,
|
59 | * you need to wait for these changes to be applied before performing any further actions by
|
60 | * waiting on the returned grid promise, e.g.
|
61 | * `filter.setModel([null, { values: ['a', 'b'] }]).then(function() { gridApi.onFilterChanged(); });`
|
62 | */
|
63 | setModel(model: IMultiFilterModel | null): void | AgPromise<void>;
|
64 | /** Returns the child filter instance at the specified index or `undefined` for an invalid index. */
|
65 | getChildFilterInstance(index: number): IFilterComp | undefined;
|
66 | }
|