Skip to content

Commit 7ea9235

Browse files
authored
Merge branch 'master' into badge-shadow
2 parents 7c975de + 3f7c777 commit 7ea9235

23 files changed

+299
-94
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ For more information about the theming please read our [documentation](https://w
7979
- **Breaking Change** `onRowSelectionChange` event arguments are changed. The `row` property has been removed and the properties `added`, `removed` and `cancel` are newly added.
8080
- **Breaking Change** `igxExcelStylePinningTemplate` directive is renamed to `igxExcelStylePinning`.
8181
- **Breaking Change** `onRowDragEnd` and `onRowDragStart` event arguments are changed - `owner` now holds reference to the grid component instance, while `dragDirective` hold reference to the drag directive.
82+
- **Behavioral Change** The behavior of the `isLoading` input no longer depends on the state of the data the grid binds to. Setting it to `true` now shows a loading indicator until it is disabled by the user.
8283
- `IgxCombo`
8384
- Combo selection is now consistent when `valueKey` is defined. When `valueKey` is specified, selection is based on the value keys of the items. For example:
8485
```html

projects/igniteui-angular/src/lib/core/styles/components/checkbox/_checkbox-theme.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@
8585

8686
@include scale-in-out($start-scale: .9);
8787

88+
// If updating the WIDTH of the checkbox here, please update it in the grid theme as well.
89+
// It is under the name of $cbx-size
8890
$size: em(20px);
8991
$checkbox-radius: $size / 2;
9092

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,10 @@
331331
@extend %grid-cell-text !optional;
332332
}
333333

334+
@include e(cbx-padding) {
335+
@extend %cbx-padding !optional;
336+
}
337+
334338
@include e(cbx-selection) {
335339
@extend %grid__cbx-selection !optional;
336340
}
@@ -427,6 +431,10 @@
427431
@extend %igx-grid__outlet !optional;
428432
}
429433

434+
@include e(loading-outlet) {
435+
@extend %igx-grid__loading-outlet !optional;
436+
}
437+
430438
@include e(row-editing-outlet) {
431439
@extend %igx-grid__row-editing-outlet !optional;
432440
}
@@ -519,8 +527,8 @@
519527
@extend %igx-grid__drag-indicator--cosy !optional;
520528
}
521529

522-
@include e(cbx-selection) {
523-
@extend %grid__cbx-selection--cosy !optional;
530+
@include e(cbx-padding) {
531+
@extend %cbx-padding--cosy !optional;
524532
}
525533

526534
@include e(cbx-selection, $m: push) {
@@ -619,8 +627,8 @@
619627
@extend %igx-grid__drag-indicator--compact !optional;
620628
}
621629

622-
@include e(cbx-selection) {
623-
@extend %grid__cbx-selection--compact !optional;
630+
@include e(cbx-padding) {
631+
@extend %cbx-padding--compact !optional;
624632
}
625633

626634
@include e(cbx-selection, $m: push) {

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

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@
503503
@include igx-root-css-vars($theme);
504504

505505
$palette: map-get($theme, 'palette');
506-
506+
$cbx-size: rem(20px);
507507
$grid-shadow: --var($theme, 'grid-shadow');
508508

509509
$grid-caption-fs: rem(20px);
@@ -534,6 +534,16 @@
534534
compact: 0 rem(12px)
535535
);
536536

537+
$grid-cbx-padding: (
538+
comfortable: rem(24px),
539+
cosy: rem(16px),
540+
compact: rem(12px)
541+
);
542+
543+
$cbx-padding: map-get($grid-cbx-padding, 'comfortable');
544+
$cbx-padding-cosy: map-get($grid-cbx-padding, 'cosy');
545+
$cbx-padding-compact: map-get($grid-cbx-padding, 'compact');
546+
537547
$grid-header-height: (
538548
comfortable: rem(50px),
539549
cosy: rem(40px),
@@ -1379,20 +1389,27 @@
13791389
display: flex;
13801390
justify-content: center;
13811391
align-items: center;
1382-
padding: map-get($grid-header-padding, 'comfortable');
13831392
border-right: --var($theme, 'header-border-width')
13841393
--var($theme, 'header-border-style')
13851394
--var($theme, 'header-border-color');
13861395
background: inherit;
13871396
z-index: 4;
13881397
}
13891398

1390-
%grid__cbx-selection--cosy {
1391-
padding: map-get($grid-header-padding, 'cosy');
1399+
%cbx-padding {
1400+
display: flex;
1401+
align-items: center;
1402+
justify-content: center;
1403+
// The min-width here plays the role of padding because of IE11
1404+
min-width: calc(#{$cbx-size} + (#{$cbx-padding} * 2));
13921405
}
13931406

1394-
%grid__cbx-selection--compact {
1395-
padding: map-get($grid-header-padding, 'compact');
1407+
%cbx-padding--cosy {
1408+
min-width: calc(#{$cbx-size} + (#{$cbx-padding-cosy} * 2));
1409+
}
1410+
1411+
%cbx-padding--compact {
1412+
min-width: calc(#{$cbx-size} + (#{$cbx-padding-compact} * 2));
13961413
}
13971414

13981415
%grid__resize-handle {
@@ -1975,6 +1992,15 @@
19751992
position: fixed;
19761993
}
19771994

1995+
%igx-grid__loading-outlet {
1996+
z-index: 10003;
1997+
1998+
%circular-display {
1999+
width: rem(50);
2000+
height: rem(50);
2001+
}
2002+
}
2003+
19782004
%igx-grid__row-editing-outlet {
19792005
z-index: 10000;
19802006
position: absolute;

projects/igniteui-angular/src/lib/date-picker/date-picker.component.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
<igx-icon>today</igx-icon>
1616
</igx-prefix>
1717
<label *ngIf="labelVisibility" igxLabel>{{label}}</label>
18-
<input #editableInput class="igx-date-picker__input-date" igxInput type="text" [value]="transformedDate"
18+
<input #editableInput class="igx-date-picker__input-date" igxInput [igxTextSelection]="true"
19+
type="text" [value]="transformedDate"
1920
[igxMask]="inputMask" [placeholder]="mask" [disabled]="disabled" [displayValuePipe]="displayValuePipe"
2021
[focusedValuePipe]="inputValuePipe" (blur)="onBlur($event)" (wheel)="onWheel($event)"
2122
(input)="onInput($event)" (focus)="onFocus()" />
@@ -25,4 +26,4 @@
2526
</igx-input-group>
2627
</ng-template>
2728

28-
<ng-container *ngTemplateOutlet="template; context: context"></ng-container>
29+
<ng-container *ngTemplateOutlet="template; context: context"></ng-container>

projects/igniteui-angular/src/lib/date-picker/date-picker.component.spec.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { IgxLabelDirective } from '../directives/label/label.directive';
88
import { IgxInputDirective } from '../directives/input/input.directive';
99
import { UIInteractions, wait } from '../test-utils/ui-interactions.spec';
1010
import { IgxInputGroupModule } from '../input-group';
11-
11+
import { IgxTextSelectionModule } from '../directives/text-selection/text-selection.directive';
1212
import { configureTestSuite } from '../test-utils/configure-suite';
1313
import { DateRangeType } from 'igniteui-angular';
1414
import { IgxButtonModule } from '../directives/button/button.directive';
@@ -32,7 +32,8 @@ describe('IgxDatePicker', () => {
3232
IgxDropDownDatePickerRetemplatedComponent,
3333
IgxDatePickerOpeningComponent
3434
],
35-
imports: [IgxDatePickerModule, FormsModule, NoopAnimationsModule, IgxInputGroupModule, IgxCalendarModule, IgxButtonModule]
35+
imports: [IgxDatePickerModule, FormsModule, NoopAnimationsModule, IgxInputGroupModule, IgxCalendarModule,
36+
IgxButtonModule, IgxTextSelectionModule]
3637
})
3738
.compileComponents();
3839
}));
@@ -1089,6 +1090,29 @@ describe('IgxDatePicker', () => {
10891090
expect(instance.getEditElement()).toBe(editElement);
10901091
});
10911092
});
1093+
1094+
describe('Drop-down mode select all text on focus', () => {
1095+
let fixture: ComponentFixture<IgxDatePickerEditableComponent>;
1096+
let datePicker: IgxDatePickerComponent;
1097+
1098+
beforeEach(() => {
1099+
fixture = TestBed.createComponent(IgxDatePickerEditableComponent);
1100+
datePicker = fixture.componentInstance.datePicker;
1101+
fixture.detectChanges();
1102+
});
1103+
1104+
it('Should select all input text on input focus', fakeAsync(() => {
1105+
const input = fixture.debugElement.query(By.directive(IgxInputDirective)).nativeElement;
1106+
input.focus();
1107+
fixture.detectChanges();
1108+
tick(100);
1109+
1110+
expect(input).toEqual(document.activeElement);
1111+
expect(input.selectionEnd).toEqual(input.value.length);
1112+
expect(input.selectionStart).toEqual(0);
1113+
expect(input.value.substring(input.selectionStart, input.selectionEnd)).toEqual(input.value);
1114+
}));
1115+
});
10921116
});
10931117

10941118
@Component({

projects/igniteui-angular/src/lib/date-picker/date-picker.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import { IgxInputGroupModule, IgxInputDirective, IgxInputGroupComponent } from '
3232
import { Subject, fromEvent, animationFrameScheduler, interval } from 'rxjs';
3333
import { filter, takeUntil, throttle } from 'rxjs/operators';
3434
import { IgxOverlayOutletDirective } from '../directives/toggle/toggle.directive';
35+
import { IgxTextSelectionModule} from '../directives/text-selection/text-selection.directive';
3536
import {
3637
OverlaySettings,
3738
IgxOverlayService,
@@ -1379,7 +1380,8 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
13791380
IgxDatePickerTemplateDirective, DatePickerDisplayValuePipe, DatePickerInputValuePipe],
13801381
exports: [IgxDatePickerComponent, IgxDatePickerTemplateDirective, IgxDatePickerActionsDirective,
13811382
DatePickerDisplayValuePipe, DatePickerInputValuePipe],
1382-
imports: [CommonModule, IgxIconModule, IgxInputGroupModule, IgxCalendarModule, IgxButtonModule, IgxRippleModule, IgxMaskModule],
1383+
imports: [CommonModule, IgxIconModule, IgxInputGroupModule, IgxCalendarModule, IgxButtonModule,
1384+
IgxRippleModule, IgxMaskModule, IgxTextSelectionModule],
13831385
entryComponents: [IgxCalendarContainerComponent]
13841386
})
13851387
export class IgxDatePickerModule { }

projects/igniteui-angular/src/lib/expansion-panel/expansion-panel.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ describe('igxExpansionPanel', () => {
10101010
expect(grid.attributes.getNamedItem('ng-reflect-auto-generate').nodeValue).toEqual('true');
10111011
expect(grid.attributes.getNamedItem('ng-reflect-width').nodeValue).toEqual(fixture.componentInstance.width);
10121012
expect(grid.attributes.getNamedItem('ng-reflect-height').nodeValue).toEqual(fixture.componentInstance.height);
1013-
expect(grid.childElementCount).toEqual(6);
1013+
expect(grid.childElementCount).toEqual(7);
10141014
}));
10151015
it('Should apply all appropriate classes on combo initialization_image + text content', fakeAsync(() => {
10161016
const fixture: ComponentFixture<IgxExpansionPanelImageComponent> = TestBed.createComponent(IgxExpansionPanelImageComponent);

projects/igniteui-angular/src/lib/grids/grid-base.component.ts

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ import {
4646
IgxOverlayService,
4747
OverlaySettings,
4848
PositionSettings,
49-
ConnectedPositioningStrategy
49+
ConnectedPositioningStrategy,
50+
ContainerPositionStrategy
5051
} from '../services/index';
5152
import { GridBaseAPIService } from './api.service';
5253
import { IgxGridCellComponent } from './cell.component';
@@ -845,9 +846,13 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
845846
* ```
846847
* @memberof IgxGridBaseComponent
847848
*/
849+
@WatchChanges()
848850
@Input()
849851
set isLoading(value: boolean) {
850-
this._isLoading = value;
852+
if (this._isLoading !== value) {
853+
this._isLoading = value;
854+
this.evaluateLoadingState();
855+
}
851856
this.notifyChanges();
852857
}
853858

@@ -1650,6 +1655,18 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
16501655
@ViewChild(IgxGridColumnResizerComponent, { static: false })
16511656
public resizeLine: IgxGridColumnResizerComponent;
16521657

1658+
/**
1659+
* @hidden
1660+
*/
1661+
@ViewChild('loadingOverlay', { static: true })
1662+
public loadingOverlay: ElementRef;
1663+
1664+
/**
1665+
* @hidden
1666+
*/
1667+
@ViewChild('igxLoadingOverlayOutlet', { read: IgxOverlayOutletDirective, static: true })
1668+
public loadingOutlet: IgxOverlayOutletDirective;
1669+
16531670
/**
16541671
* @hidden
16551672
*/
@@ -2728,6 +2745,7 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
27282745
protected _baseFontSize: number;
27292746
private _horizontalForOfs: Array<IgxGridForOfDirective<any>> = [];
27302747
private _multiRowLayoutRowSize = 1;
2748+
protected _loadingId;
27312749

27322750
// Caches
27332751
private _totalWidth = NaN;
@@ -2927,6 +2945,7 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
29272945
this.verticalScrollContainer.onDataChanging.pipe(destructor, filter(() => !this._init)).subscribe(($event) => {
29282946
this.calculateGridHeight();
29292947
$event.containerSize = this.calcHeight;
2948+
this.evaluateLoadingState();
29302949
this.notifyChanges(true);
29312950
});
29322951

@@ -5642,6 +5661,30 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
56425661
}
56435662
}
56445663

5664+
/**
5665+
* Should be called when data and/or isLoading input changes so that the overlay can be
5666+
* hidden/shown based on the current value of shouldOverlayLoading
5667+
*/
5668+
protected evaluateLoadingState() {
5669+
if (this.shouldOverlayLoading) {
5670+
// a new overlay should be shown
5671+
const overlaySettings: OverlaySettings = {
5672+
outlet: this.loadingOutlet,
5673+
closeOnOutsideClick: false,
5674+
positionStrategy: new ContainerPositionStrategy()
5675+
};
5676+
if (!this._loadingId) {
5677+
this._loadingId = this.overlayService.attach(this.loadingOverlay, overlaySettings);
5678+
this.overlayService.show(this._loadingId, overlaySettings);
5679+
}
5680+
} else {
5681+
if (this._loadingId) {
5682+
this.overlayService.hide(this._loadingId);
5683+
this._loadingId = null;
5684+
}
5685+
}
5686+
}
5687+
56455688
openRowOverlay(id) {
56465689
this.configureRowEditingOverlay(id, this.rowList.length <= MIN_ROW_EDITING_COUNT_THRESHOLD);
56475690

@@ -5829,6 +5872,13 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
58295872
return this._exportCsv;
58305873
}
58315874

5875+
/**
5876+
* @hidden
5877+
*/
5878+
get shouldOverlayLoading(): boolean {
5879+
return this.isLoading && this.data && this.data.length > 0;
5880+
}
5881+
58325882
/**
58335883
* @hidden
58345884
*/
@@ -5890,9 +5940,13 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
58905940
(this as any).rootGrid ? (this as any).rootGrid.nativeElement : this.nativeElement;
58915941
this._advancedFilteringOverlaySettings.outlet = this.outletDirective;
58925942

5893-
this._advancedFilteringOverlayId =
5894-
this.overlayService.attach(IgxAdvancedFilteringDialogComponent, this._advancedFilteringOverlaySettings);
5895-
// , this._moduleRef);
5943+
this._advancedFilteringOverlayId = this.overlayService.attach(
5944+
IgxAdvancedFilteringDialogComponent,
5945+
this._advancedFilteringOverlaySettings,
5946+
{
5947+
injector: this.viewRef.injector,
5948+
componentFactoryResolver: this.resolver
5949+
});
58965950
this.overlayService.show(this._advancedFilteringOverlayId, this._advancedFilteringOverlaySettings);
58975951
}
58985952
}

projects/igniteui-angular/src/lib/grids/grid/grid-row.component.html

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<ng-template *ngTemplateOutlet="
1212
this.grid.rowSelectorTemplate ? this.grid.rowSelectorTemplate : rowSelectorBaseTemplate;
1313
context: { $implicit: {
14-
index: this.grid.groupingExpressions.length > 0 ? this.grid.filteredSortedData.indexOf(this.rowData) :
14+
index: this.grid.groupingExpressions.length > 0 ? this.grid.filteredSortedData.indexOf(this.rowData) :
1515
this.index + this.grid.page * this.grid.perPage,
1616
rowID: rowID, selected: selected }}">
1717
</ng-template>
@@ -112,12 +112,14 @@
112112
</ng-container>
113113

114114
<ng-template #rowSelectorBaseTemplate>
115-
<igx-checkbox
116-
[checked]="selected"
117-
[readonly]="true"
118-
[disabled]="deleted"
119-
disableRipple="true"
120-
[disableTransitions]="grid.disableTransitions"
121-
[aria-label]="rowCheckboxAriaLabel">
122-
</igx-checkbox>
115+
<div class="igx-grid__cbx-padding">
116+
<igx-checkbox
117+
[checked]="selected"
118+
[readonly]="true"
119+
[disabled]="deleted"
120+
disableRipple="true"
121+
[disableTransitions]="grid.disableTransitions"
122+
[aria-label]="rowCheckboxAriaLabel">
123+
</igx-checkbox>
124+
</div>
123125
</ng-template>

0 commit comments

Comments
 (0)