• 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

1.72
/projects/igniteui-angular/src/lib/action-strip/grid-actions/grid-editing-actions.component.ts
1
import { Component, HostBinding, Input, booleanAttribute } from '@angular/core';
2
import { IgxGridActionsBaseDirective } from './grid-actions-base.directive';
3
import { showMessage } from '../../core/utils';
4
import { addRow, addChild } from '@igniteui/material-icons-extended';
5
import { IgxGridActionButtonComponent } from './grid-action-button.component';
6
import { NgIf } from '@angular/common';
7

8

9
/* blazorElement */
10
/* wcElementTag: igc-grid-editing-actions */
11
/* blazorIndirectRender */
12
/* singleInstanceIdentifier */
13
/**
14
 * Grid Editing Actions for the Action Strip
15
 *
16
 * @igxParent IgxActionStripComponent
17
 */
18
@Component({
19
    selector: 'igx-grid-editing-actions',
20
    templateUrl: 'grid-editing-actions.component.html',
21
    providers: [{ provide: IgxGridActionsBaseDirective, useExisting: IgxGridEditingActionsComponent }],
22
    imports: [NgIf, IgxGridActionButtonComponent]
23
})
24

25
export class IgxGridEditingActionsComponent extends IgxGridActionsBaseDirective {
2✔
26

27
    /**
28
     * Host `class.igx-action-strip` binding.
29
     *
30
     * @hidden
31
     * @internal
32
     */
33
    @HostBinding('class.igx-action-strip__editing-actions')
UNCOV
34
    public cssClass = 'igx-action-strip__editing-actions';
×
35

36
    /**
37
     * An input to enable/disable action strip row adding button
38
     */
39
    @Input({ transform: booleanAttribute })
40
    public set addRow(value: boolean) {
UNCOV
41
        this._addRow = value;
×
42
    }
43
    public get addRow(): boolean {
UNCOV
44
        if (!this.iconsRendered) {
×
UNCOV
45
            this.registerIcons();
×
UNCOV
46
            this.iconsRendered = true;
×
47
        }
UNCOV
48
        return this._addRow;
×
49
    }
50

51
    /**
52
     * An input to enable/disable action strip row editing button
53
     */
54
    @Input({ transform: booleanAttribute })
UNCOV
55
    public editRow = true;
×
56

57
    /**
58
    * An input to enable/disable action strip row deleting button
59
    */
60
    @Input({ transform: booleanAttribute })
UNCOV
61
    public deleteRow = true;
×
62

63
    /**
64
     * Getter if the row is disabled
65
     *
66
     * @hidden
67
     * @internal
68
     */
69
    public get disabled(): boolean {
UNCOV
70
        if (!this.isRow(this.strip.context)) {
×
71
            return;
×
72
        }
UNCOV
73
        return this.strip.context.disabled;
×
74
    }
75

76
    /**
77
     * Getter if the row is root.
78
     *
79
     * @hidden
80
     * @internal
81
     */
82
    public get isRootRow(): boolean {
UNCOV
83
        if (!this.isRow(this.strip.context)) {
×
84
            return false;
×
85
        }
UNCOV
86
        return this.strip.context.isRoot;
×
87
    }
88

89
    public get hasChildren(): boolean {
UNCOV
90
        if (!this.isRow(this.strip.context)) {
×
91
            return false;
×
92
        }
UNCOV
93
        return this.strip.context.hasChildren;
×
94
    }
95

96
    /**
97
     * An input to enable/disable action strip child row adding button
98
     */
99
    @Input({ transform: booleanAttribute })
UNCOV
100
    public addChild = false;
×
101

UNCOV
102
    private isMessageShown = false;
×
UNCOV
103
    private _addRow = false;
×
UNCOV
104
    private iconsRendered = false;
×
105

106
    /**
107
     * Enter row or cell edit mode depending the grid rowEditable option
108
     *
109
     * @example
110
     * ```typescript
111
     * this.gridEditingActions.startEdit();
112
     * ```
113
     */
114
    public startEdit(event?): void {
UNCOV
115
        if (event) {
×
UNCOV
116
            event.stopPropagation();
×
117
        }
UNCOV
118
        if (!this.isRow(this.strip.context)) {
×
119
            return;
×
120
        }
UNCOV
121
        const row = this.strip.context;
×
UNCOV
122
        const firstEditable = row.cells.filter(cell => cell.editable)[0];
×
UNCOV
123
        const grid = row.grid;
×
UNCOV
124
        if (!grid.hasEditableColumns) {
×
125
            this.isMessageShown = showMessage(
×
126
                'The grid should be editable in order to use IgxGridEditingActionsComponent',
127
                this.isMessageShown);
128
            return;
×
129
        }
130
        // be sure row is in view
UNCOV
131
        if (grid.rowList.filter(r => r === row).length !== 0) {
×
UNCOV
132
            grid.gridAPI.crudService.enterEditMode(firstEditable, event);
×
UNCOV
133
            if (!grid.gridAPI.crudService.nonEditable) {
×
UNCOV
134
                firstEditable.activate(event);
×
135
            }
136
        }
UNCOV
137
        this.strip.hide();
×
138
    }
139

140
    /** @hidden @internal **/
141
    public deleteRowHandler(event?): void {
UNCOV
142
        if (event) {
×
UNCOV
143
            event.stopPropagation();
×
144
        }
UNCOV
145
        if (!this.isRow(this.strip.context)) {
×
146
            return;
×
147
        }
UNCOV
148
        const context = this.strip.context;
×
UNCOV
149
        const grid = context.grid;
×
UNCOV
150
        grid.deleteRow(context.key);
×
151

UNCOV
152
        this.strip.hide();
×
153
    }
154

155
    /** @hidden @internal **/
156
    public addRowHandler(event?, asChild?: boolean): void {
UNCOV
157
        if (event) {
×
UNCOV
158
            event.stopPropagation();
×
159
        }
UNCOV
160
        if (!this.isRow(this.strip.context)) {
×
161
            return;
×
162
        }
UNCOV
163
        const context = this.strip.context;
×
UNCOV
164
        const grid = context.grid;
×
UNCOV
165
        if (!grid.rowEditable) {
×
166
            console.warn('The grid must use row edit mode to perform row adding! Please set rowEditable to true.');
×
167
            return;
×
168
        }
UNCOV
169
        grid.gridAPI.crudService.enterAddRowMode(context, asChild, event);
×
UNCOV
170
        this.strip.hide();
×
171
    }
172

173
    /**
174
     * @hidden
175
     * @internal
176
     */
177
    private registerIcons() {
UNCOV
178
        this.iconService.addSvgIconFromText(addRow.name, addRow.value, 'imx-icons', true,);
×
UNCOV
179
        this.iconService.addSvgIconFromText(addChild.name, addChild.value, 'imx-icons', true);
×
180
    }
181
}
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