Skip to content

Commit 79c2746

Browse files
authored
Merge branch '15.0.x' into vkombov/fix-12391-15.0.x
2 parents f8e25e9 + 31df26d commit 79c2746

File tree

10 files changed

+130
-16
lines changed

10 files changed

+130
-16
lines changed

projects/igniteui-angular/src/lib/core/styles/components/button/_button-theme.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,9 @@
258258
$button-icon-padding: 0;
259259

260260
$button-padding-material: (
261-
comfortable: rem(9px, 16px) rem(16px, 16px),
262-
cosy: rem(6px, 16px) rem(16px, 16px),
263-
compact: rem(3px, 16px) rem(16px, 16px)
261+
comfortable: rem(7px, 16px) rem(16px, 16px),
262+
cosy: rem(4px, 16px) rem(16px, 16px),
263+
compact: rem(1px, 16px) rem(16px, 16px)
264264
);
265265

266266
$outlined-button-padding-material: (

projects/igniteui-angular/src/lib/core/styles/components/grid-toolbar/_grid-toolbar-theme.scss

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@
121121
);
122122

123123
%igx-grid-toolbar {
124+
position: absolute;
125+
width: 100%;
124126
display: flex;
125127
align-items: center;
126128
justify-content: space-between;
@@ -136,7 +138,6 @@
136138
background: var-get($theme, 'background-color');
137139
height: auto;
138140
min-height: map.get($grid-toolbar-height, 'comfortable');
139-
position: relative;
140141
padding-block: 0;
141142
padding-inline: map.get($grid-toolbar-padding, 'comfortable');
142143

@@ -164,15 +165,24 @@
164165
}
165166
}
166167
}
168+
169+
+ igx-grid-header-row {
170+
margin-top: map.get($grid-toolbar-height, 'comfortable');
171+
}
167172
}
168173

174+
169175
%igx-grid-toolbar--cosy {
170176
min-height: map.get($grid-toolbar-height, 'cosy');
171177
padding-inline: map.get($grid-toolbar-padding, 'cosy');
172178

173179
[igxButton] {
174180
margin-inline-start: map.get($grid-toolbar-spacer, 'cosy');
175181
}
182+
183+
+ igx-grid-header-row {
184+
margin-top: map.get($grid-toolbar-height, 'cosy');
185+
}
176186
}
177187

178188
%igx-grid-toolbar--compact {
@@ -182,6 +192,10 @@
182192
[igxButton] {
183193
margin-inline-start: map.get($grid-toolbar-spacer, 'compact');
184194
}
195+
196+
+ igx-grid-header-row {
197+
margin-top: map.get($grid-toolbar-height, 'compact');
198+
}
185199
}
186200

187201
%igx-grid-toolbar__title {

projects/igniteui-angular/src/lib/core/styles/components/radio/_radio-theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
@include css-vars($theme);
7878
@include scale-in-out($start-scale: .9);
7979

80-
$label-margin: rem(8px);
80+
$label-margin: rem(6px);
8181

8282
$variant: map.get($theme, variant);
8383
$bootstrap-theme: $variant == 'bootstrap';

projects/igniteui-angular/src/lib/core/styles/themes/schemas/dark/_dialog.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ $dark-dialog: extend($light-dialog, $base-dark-dialog);
2525
/// Generates a dark fluent dialog schema.
2626
/// @type {Map}
2727
/// @requires $fluent-dialog
28-
/// @requires $base-dark-dialog
29-
$dark-fluent-dialog: extend($fluent-dialog, $base-dark-dialog);
28+
$dark-fluent-dialog: extend($fluent-dialog);
3029

3130
/// Generates a dark bootstrap dialog schema.
3231
/// @type {Map}

projects/igniteui-angular/src/lib/core/styles/themes/schemas/light/_dialog.scss

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/// @type {Map}
1212
/// @prop {Map} background [color: 'surface'] - The dialog background color.
1313
/// @prop {Map} title-color [contrast-color: 'surface'] - The dialog title text color.
14-
/// @prop {Map} message-color [color: 'surface', text-contrast: (), rgba: .6] - The dialog message text color.
14+
/// @prop {Map} message-color [color: ('gray', 600),] - The dialog message text color.
1515
/// @prop {map} border-color [color: ('gray', 300)] - The border color for dialog component.
1616
/// @prop {Number} elevation [24] - The elevation level, between 0-24, to be used for the dialog.
1717
/// @prop {Number} border-radius [4px] - The border radius used for dialog. Can be a fraction between 0 and 1, pixels, or percent.
@@ -42,13 +42,18 @@ $light-dialog: extend(
4242
/// Generates a fluent dialog schema.
4343
/// @type {Map}
4444
/// @prop {Number} border-radius [2px] - The border radius used for dialog. Can be a fraction between 0 and 1, pixels, or percent.
45+
/// @prop {Map} message-color [color: ('gray', 700),] - The dialog message text color.
4546
/// @requires {Map} $light-dialog
4647
$fluent-dialog: extend(
4748
$light-dialog,
4849
(
4950
variant: 'fluent',
5051

51-
border-radius: rem(2px)
52+
border-radius: rem(2px),
53+
54+
message-color: (
55+
color: ('gray', 700),
56+
),
5257
)
5358
);
5459

projects/igniteui-angular/src/lib/core/styles/themes/schemas/light/_tabs.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ $fluent-tabs: extend(
159159
),
160160

161161
button-disabled-color: (
162-
color: ('gray', 500)
162+
color: ('gray', 400)
163163
),
164164
)
165165
);

projects/igniteui-angular/src/lib/grids/common/crud.service.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,9 @@ export class IgxGridCRUDService extends IgxRowAddCrudState {
641641

642642
this.grid.navigateTo(this.row.index, -1);
643643
// when selecting the dummy row we need to adjust for top pinned rows
644-
const indexAdjust = this.grid.isRowPinningToTop && !this.addRowParent.isPinned ? this.grid.pinnedRows.length : 0;
644+
const indexAdjust = this.grid.isRowPinningToTop ?
645+
(!this.addRowParent.isPinned ? this.grid.pinnedRows.length : 0) :
646+
(!this.addRowParent.isPinned ? 0 : this.grid.unpinnedRecords.length);
645647

646648
// TODO: Type this without shoving a bunch of internal properties in the row type
647649
const dummyRow = this.grid.gridAPI.get_row_by_index(this.row.index + indexAdjust) as any;

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-add-row-ui.spec.ts

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { TestBed, fakeAsync, waitForAsync } from '@angular/core/testing';
33
import { By } from '@angular/platform-browser';
44
import { IgxTreeGridModule, IgxTreeGridComponent } from './public_api';
5-
import { IgxTreeGridEditActionsComponent } from '../../test-utils/tree-grid-components.spec';
5+
import { IgxTreeGridEditActionsComponent, IgxTreeGridEditActionsPinningComponent } from '../../test-utils/tree-grid-components.spec';
66
import { configureTestSuite } from '../../test-utils/configure-suite';
77
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
88
import { IgxActionStripModule, IgxActionStripComponent } from '../../action-strip/public_api';
@@ -24,7 +24,8 @@ describe('IgxTreeGrid - Add Row UI #tGrid', () => {
2424
beforeAll(waitForAsync(() => {
2525
TestBed.configureTestingModule({
2626
declarations: [
27-
IgxTreeGridEditActionsComponent
27+
IgxTreeGridEditActionsComponent,
28+
IgxTreeGridEditActionsPinningComponent
2829
],
2930
imports: [IgxTreeGridModule, NoopAnimationsModule, IgxActionStripModule]
3031
})
@@ -128,5 +129,70 @@ describe('IgxTreeGrid - Add Row UI #tGrid', () => {
128129

129130
expect(treeGrid.rowList.length).toBe(1);
130131
});
132+
133+
it('should add row on correct position and enter edit mode from pinned row - pinning position: Top', () => {
134+
fix = TestBed.createComponent(IgxTreeGridEditActionsPinningComponent);
135+
fix.detectChanges();
136+
treeGrid = fix.componentInstance.treeGrid;
137+
actionStrip = fix.componentInstance.actionStrip;
138+
139+
treeGrid.pinRow(1);
140+
treeGrid.pinRow(6);
141+
142+
expect(treeGrid.getRowByKey(1).pinned).toBeTrue();
143+
expect(treeGrid.getRowByKey(6).pinned).toBeTrue();
144+
145+
actionStrip.show(treeGrid.rowList.toArray()[1]);
146+
fix.detectChanges();
147+
148+
const editActions = fix.debugElement.queryAll(By.css(`igx-grid-action-button`));
149+
150+
expect(editActions[3].componentInstance.iconName).toBe('add-row');
151+
const addRowBtn = editActions[3].componentInstance;
152+
addRowBtn.actionClick.emit();
153+
fix.detectChanges();
154+
endTransition();
155+
156+
let addRow = treeGrid.gridAPI.get_row_by_index(2);
157+
expect(addRow.addRowUI).toBeTrue();
158+
expect(addRow.inEditMode).toBeTrue();
159+
160+
treeGrid.gridAPI.crudService.endEdit(true);
161+
fix.detectChanges();
162+
});
163+
164+
it('should add row on correct position and enter edit mode from pinned row - pinning position: Bottom', () => {
165+
fix = TestBed.createComponent(IgxTreeGridEditActionsPinningComponent);
166+
fix.detectChanges();
167+
treeGrid = fix.componentInstance.treeGrid;
168+
actionStrip = fix.componentInstance.actionStrip;
169+
170+
treeGrid.pinning = fix.componentInstance.pinningConfig;
171+
fix.detectChanges();
172+
173+
treeGrid.pinRow(1);
174+
treeGrid.pinRow(6);
175+
176+
expect(treeGrid.getRowByKey(1).pinned).toBeTrue();
177+
expect(treeGrid.getRowByKey(6).pinned).toBeTrue();
178+
179+
actionStrip.show(treeGrid.rowList.last);
180+
fix.detectChanges();
181+
182+
const editActions = fix.debugElement.queryAll(By.css(`igx-grid-action-button`));
183+
184+
expect(editActions[3].componentInstance.iconName).toBe('add-row');
185+
const addRowBtn = editActions[3].componentInstance;
186+
addRowBtn.actionClick.emit();
187+
fix.detectChanges();
188+
endTransition();
189+
190+
let addRow = treeGrid.gridAPI.get_row_by_index(10);
191+
expect(addRow.addRowUI).toBeTrue();
192+
expect(addRow.inEditMode).toBeTrue();
193+
194+
treeGrid.gridAPI.crudService.endEdit(true);
195+
fix.detectChanges();
196+
});
131197
});
132198
});

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid.pipes.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,12 @@ export class IgxTreeGridAddRowPipe implements PipeTransform {
315315
}
316316
const copy = collection.slice(0);
317317
const rec = (this.grid.crudService.row as IgxAddRow).recordRef;
318-
copy.splice(this.grid.crudService.row.index, 0, rec);
318+
if (this.grid.crudService.addRowParent.isPinned) {
319+
const parentRowIndex = copy.findIndex(record => record.rowID === this.grid.crudService.addRowParent.rowID);
320+
copy.splice(parentRowIndex + 1, 0, rec);
321+
} else {
322+
copy.splice(this.grid.crudService.row.index, 0, rec);
323+
}
319324
this.grid.records.set(rec.key, rec);
320325
return copy;
321326
}

projects/igniteui-angular/src/lib/test-utils/tree-grid-components.spec.ts

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { Component, ViewChild, OnInit } from '@angular/core';
22
import { IgxTreeGridComponent } from '../grids/tree-grid/tree-grid.component';
33
import { SampleTestData } from './sample-test-data.spec';
4-
import { IgxSummaryOperand, IgxNumberSummaryOperand, IgxSummaryResult } from '../grids/public_api';
4+
import { IgxSummaryOperand, IgxNumberSummaryOperand, IgxSummaryResult, IPinningConfig } from '../grids/public_api';
55
import { DisplayDensity } from '../core/displayDensity';
66
import { IgxActionStripComponent } from '../action-strip/action-strip.component';
7-
import { DefaultSortingStrategy } from 'igniteui-angular';
7+
import { DefaultSortingStrategy, RowPinningPosition } from 'igniteui-angular';
88
import { IGroupingExpression } from '../data-operations/grouping-expression.interface';
99
import { IgxTreeGridGroupByAreaComponent } from '../grids/grouping/tree-grid-group-by-area.component';
1010

@@ -1025,3 +1025,26 @@ export class IgxTreeGridPrimaryForeignKeyCascadeSelectionComponent {
10251025
public actionStrip: IgxActionStripComponent;
10261026
public data = SampleTestData.employeeSmallPrimaryForeignKeyTreeData();
10271027
}
1028+
1029+
@Component({
1030+
template: `
1031+
<igx-tree-grid #treeGrid [data]="data" primaryKey="ID" foreignKey="ParentID" width="900px" height="600px" [rowEditable]="true">
1032+
<igx-column [field]="'ID'" dataType="number"></igx-column>
1033+
<igx-column [field]="'ParentID'" dataType="number"></igx-column>
1034+
<igx-column [field]="'Name'" dataType="string"></igx-column>
1035+
<igx-column [field]="'JobTitle'" dataType="string"></igx-column>
1036+
<igx-column [field]="'Age'" dataType="number"></igx-column>
1037+
<igx-action-strip #actionStrip>
1038+
<igx-grid-pinning-actions></igx-grid-pinning-actions>
1039+
<igx-grid-editing-actions [addRow]="true"></igx-grid-editing-actions>
1040+
</igx-action-strip>
1041+
</igx-tree-grid>
1042+
`
1043+
})
1044+
export class IgxTreeGridEditActionsPinningComponent {
1045+
@ViewChild(IgxTreeGridComponent, { static: true }) public treeGrid: IgxTreeGridComponent;
1046+
@ViewChild('actionStrip', { read: IgxActionStripComponent, static: true })
1047+
public actionStrip: IgxActionStripComponent;
1048+
public data = SampleTestData.employeePrimaryForeignKeyTreeData();
1049+
public pinningConfig: IPinningConfig = { rows: RowPinningPosition.Bottom };
1050+
}

0 commit comments

Comments
 (0)