• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IgniteUI / igniteui-angular / 13331632524

14 Feb 2025 02:51PM CUT coverage: 22.015% (-69.6%) from 91.622%
13331632524

Pull #15372

github

web-flow
Merge d52d57714 into bcb78ae0a
Pull Request #15372: chore(*): test ci passing

1990 of 15592 branches covered (12.76%)

431 of 964 new or added lines in 18 files covered. (44.71%)

19956 existing lines in 307 files now uncovered.

6452 of 29307 relevant lines covered (22.02%)

249.17 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

11.11
/projects/igniteui-angular/src/lib/grids/state.directive.ts
1
import { Directive, EventEmitter, Input, Output } from '@angular/core';
2
import { GridFeatures, IGridState, IGridStateOptions, IgxGridStateBaseDirective } from './state-base.directive';
3

4
@Directive({
5
    selector: '[igxGridState]',
6
    standalone: true
7
})
8
export class IgxGridStateDirective extends IgxGridStateBaseDirective {
2✔
9
    private static ngAcceptInputType_options: IGridStateOptions | '';
10

11
    /**
12
     *  An object with options determining if a certain feature state should be saved.
13
     * ```html
14
     * <igx-grid [igxGridState]="options"></igx-grid>
15
     * ```
16
     * ```typescript
17
     * public options = {selection: false, advancedFiltering: false};
18
     * ```
19
     */
20
    @Input('igxGridState')
21
    public override get options(): IGridStateOptions {
UNCOV
22
        return super.options;
×
23
    }
24

25
    public override set options(value: IGridStateOptions) {
UNCOV
26
        super.options = value;
×
27
    }
28

29
    /**
30
     * Gets the state of a feature or states of all grid features, unless a certain feature is disabled through the `options` property.
31
     *
32
     * @param `serialize` determines whether the returned object will be serialized to JSON string. Default value is true.
33
     * @param `feature` string or array of strings determining the features to be added in the state. If skipped, all features are added.
34
     * @returns Returns the serialized to JSON string IGridState object, or the non-serialized IGridState object.
35
     * ```html
36
     * <igx-grid [igxGridState]="options"></igx-grid>
37
     * ```
38
     * ```typescript
39
     * @ViewChild(IgxGridStateDirective, { static: true }) public state;
40
     * let state = this.state.getState(); // returns string
41
     * let state = this.state(false) // returns `IGridState` object
42
     * ```
43
     */
44
    public getState(serialize = true, features?: GridFeatures | GridFeatures[]): IGridState | string  {
×
UNCOV
45
        return super.getStateInternal(serialize, features);
×
46
    }
47

48
    /* blazorSuppress */
49
    /**
50
     * Restores grid features' state based on the IGridState object passed as an argument.
51
     *
52
     * @param IGridState object to restore state from.
53
     * @returns
54
     * ```html
55
     * <igx-grid [igxGridState]="options"></igx-grid>
56
     * ```
57
     * ```typescript
58
     * @ViewChild(IgxGridStateDirective, { static: true }) public state;
59
     * this.state.setState(gridState);
60
     * ```
61
     */
62
    public setState(state: IGridState | string, features?: GridFeatures | GridFeatures[]) {
UNCOV
63
        if (typeof state === 'string') {
×
UNCOV
64
            state = JSON.parse(state) as IGridState;
×
UNCOV
65
            this.stateParsed.emit(state)
×
66
        }
UNCOV
67
        return super.setStateInternal(state, features);
×
68
    }
69

70
    /**
71
     *  Event emitted when set state is called with a string.
72
     * Returns the parsed state object so that it can be further modified before applying to the grid.
73
     * ```typescript
74
     * this.state.stateParsed.subscribe(parsedState => parsedState.sorting.forEach(x => x.strategy = NoopSortingStrategy.instance()});
75
     * ```
76
     */
77
    @Output()
UNCOV
78
    public stateParsed = new EventEmitter<IGridState>();
×
79
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc