Skip to content

Commit 9305b3e

Browse files
authored
Merge branch 'master' into ddincheva/fixToolbarHiding
2 parents a173357 + 47263ac commit 9305b3e

File tree

10 files changed

+88
-43
lines changed

10 files changed

+88
-43
lines changed

package-lock.json

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

projects/igniteui-angular/src/lib/chips/chips-area.component.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {
1+
import {
22
Component,
33
ContentChildren,
44
ChangeDetectorRef,
@@ -24,6 +24,7 @@ import {
2424
import { IDropBaseEventArgs, IDragBaseEventArgs } from '../directives/drag-drop/drag-drop.directive';
2525
import { takeUntil } from 'rxjs/operators';
2626
import { Subject } from 'rxjs';
27+
import { rem } from '../core/utils';
2728

2829
export interface IBaseChipsAreaEventArgs {
2930
originalEvent: IDragBaseEventArgs | IDropBaseEventArgs | KeyboardEvent | MouseEvent | TouchEvent;
@@ -112,25 +113,35 @@ export class IgxChipsAreaComponent implements DoCheck, AfterViewInit, OnDestroy
112113
*
113114
* @example
114115
* ```html
115-
* <igx-chips-area #chipsArea [width]="'300'" [height]="'10'" (onReorder)="chipsOrderChanged($event)"></igx-chips-area>
116+
* <igx-chips-area #chipsArea [width]="300" [height]="10" (onReorder)="chipsOrderChanged($event)"></igx-chips-area>
116117
* ```
117118
*/
118-
@HostBinding('style.width.px')
119119
@Input()
120120
public width: number;
121121

122+
/** @hidden @internal */
123+
@HostBinding('style.width.rem')
124+
public get _widthToRem() {
125+
return rem(this.width);
126+
}
127+
122128
/**
123129
* An @Input property that sets the height of the `IgxChipsAreaComponent`.
124130
*
125131
* @example
126132
* ```html
127-
* <igx-chips-area #chipsArea [width]="'300'" [height]="'10'" (onReorder)="chipsOrderChanged($event)"></igx-chips-area>
133+
* <igx-chips-area #chipsArea [width]="300" [height]="10" (onReorder)="chipsOrderChanged($event)"></igx-chips-area>
128134
* ```
129135
*/
130-
@HostBinding('style.height.px')
131136
@Input()
132137
public height: number;
133138

139+
/** @hidden @internal */
140+
@HostBinding('style.height.rem')
141+
public get _heightToRem() {
142+
return rem(this.height);
143+
}
144+
134145
/**
135146
* Emits an event when `IgxChipComponent`s in the `IgxChipsAreaComponent` should be reordered.
136147
* Returns an array of `IgxChipComponent`s.

projects/igniteui-angular/src/lib/combo/combo-item.component.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { IgxDropDownItemComponent } from '../drop-down/drop-down-item.component'
99
import { IGX_DROPDOWN_BASE, IDropDownBase, Navigate } from '../drop-down/drop-down.common';
1010
import { IgxComboAPIService } from './combo.api';
1111
import { IgxSelectionAPIService } from '../core/selection';
12+
import { rem } from '../core/utils';
1213

1314
/** @hidden */
1415
@Component({
@@ -23,9 +24,14 @@ export class IgxComboItemComponent extends IgxDropDownItemComponent {
2324
* @hidden
2425
*/
2526
@Input()
26-
@HostBinding('style.height.px')
2727
public itemHeight: string | number = '';
2828

29+
/** @hidden @internal */
30+
@HostBinding('style.height.rem')
31+
public get _itemHeightToRem() {
32+
return rem(this.itemHeight);
33+
}
34+
2935
@HostBinding('attr.aria-label')
3036
@Input()
3137
public get ariaLabel(): string {

projects/igniteui-angular/src/lib/combo/combo.common.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { noop, Subject } from 'rxjs';
2626
import { takeUntil } from 'rxjs/operators';
2727
import { DisplayDensityBase, DisplayDensityToken, IDisplayDensityOptions } from '../core/displayDensity';
2828
import { IgxSelectionAPIService } from '../core/selection';
29-
import { CancelableBrowserEventArgs, cloneArray, IBaseCancelableBrowserEventArgs, IBaseEventArgs, isNaNvalue } from '../core/utils';
29+
import { CancelableBrowserEventArgs, cloneArray, IBaseCancelableBrowserEventArgs, IBaseEventArgs, isNaNvalue, rem } from '../core/utils';
3030
import { SortingDirection } from '../data-operations/sorting-strategy';
3131
import { IForOfState, IgxForOfDirective } from '../directives/for-of/for_of.directive';
3232
import { IgxIconService } from '../icon/public_api';
@@ -237,6 +237,11 @@ export abstract class IgxComboBaseDirective extends DisplayDensityBase implement
237237
this._itemsMaxHeight = val;
238238
}
239239

240+
/** @hidden */
241+
public get itemsMaxHeightInRem() {
242+
return rem(this.itemsMaxHeight);
243+
}
244+
240245
/**
241246
* Configures the drop down list item height
242247
*

projects/igniteui-angular/src/lib/combo/combo.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
<ng-container *ngTemplateOutlet="headerTemplate">
5454
</ng-container>
5555
<div #dropdownItemContainer class="igx-combo__content" [style.overflow]="'hidden'"
56-
[style.maxHeight.px]="itemsMaxHeight" [igxDropDownItemNavigation]="dropdown" (focus)="dropdown.onFocus()"
56+
[style.maxHeight.rem]="itemsMaxHeightInRem" [igxDropDownItemNavigation]="dropdown" (focus)="dropdown.onFocus()"
5757
[tabindex]="dropdown.collapsed ? -1 : 0" [attr.id]="dropdown.id" aria-multiselectable="true"
5858
[attr.aria-activedescendant]="this.activeDescendant">
5959
<igx-combo-item [itemHeight]='itemHeight' *igxFor="let item of data

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

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,17 @@
9292
));
9393
}
9494

95+
@mixin _offset-sibling-elements($offset) {
96+
+ igx-grid-header-row,
97+
+ igx-grid-group-by-area {
98+
margin-top: $offset;
99+
}
100+
101+
+ igx-grid-group-by-area {
102+
height: auto;
103+
}
104+
}
105+
95106
/// @param {Map} $theme - The theme used to style the component.
96107
@mixin grid-toolbar($theme) {
97108
@include css-vars($theme);
@@ -121,6 +132,9 @@
121132
);
122133

123134
%igx-grid-toolbar {
135+
$height: map.get($grid-toolbar-height, 'comfortable');
136+
@include _offset-sibling-elements($height);
137+
124138
position: absolute;
125139
width: 100%;
126140
display: flex;
@@ -137,7 +151,7 @@
137151

138152
background: var-get($theme, 'background-color');
139153
height: auto;
140-
min-height: map.get($grid-toolbar-height, 'comfortable');
154+
min-height: $height;
141155
padding-block: 0;
142156
padding-inline: map.get($grid-toolbar-padding, 'comfortable');
143157

@@ -165,37 +179,30 @@
165179
}
166180
}
167181
}
168-
169-
+ igx-grid-header-row {
170-
margin-top: map.get($grid-toolbar-height, 'comfortable');
171-
}
172182
}
173183

174-
175184
%igx-grid-toolbar--cosy {
176-
min-height: map.get($grid-toolbar-height, 'cosy');
185+
$height: map.get($grid-toolbar-height, 'cosy');
186+
@include _offset-sibling-elements($height);
187+
188+
min-height: $height;
177189
padding-inline: map.get($grid-toolbar-padding, 'cosy');
178190

179191
[igxButton] {
180192
margin-inline-start: map.get($grid-toolbar-spacer, 'cosy');
181193
}
182-
183-
+ igx-grid-header-row {
184-
margin-top: map.get($grid-toolbar-height, 'cosy');
185-
}
186194
}
187195

188196
%igx-grid-toolbar--compact {
189-
min-height: map.get($grid-toolbar-height, 'compact');
197+
$height: map.get($grid-toolbar-height, 'compact');
198+
@include _offset-sibling-elements($height);
199+
200+
min-height: $height;
190201
padding-inline: map.get($grid-toolbar-padding, 'compact');
191202

192203
[igxButton] {
193204
margin-inline-start: map.get($grid-toolbar-spacer, 'compact');
194205
}
195-
196-
+ igx-grid-header-row {
197-
margin-top: map.get($grid-toolbar-height, 'compact');
198-
}
199206
}
200207

201208
%igx-grid-toolbar__title {

projects/igniteui-angular/src/lib/core/utils.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,3 +788,9 @@ export const formatDate = (value: string | number | Date, format: string, locale
788788
};
789789

790790
export const formatCurrency = new CurrencyPipe(undefined).transform;
791+
792+
/** Converts pixel values to their rem counterparts for a base value */
793+
export const rem = (value: number | string) => {
794+
const base = parseFloat(getComputedStyle(document.documentElement).getPropertyValue('font-size'))
795+
return Number(value) / base;
796+
}

projects/igniteui-angular/src/lib/list/list-item.component.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
1+
22
<div *ngIf="!isHeader && list.listItemLeftPanningTemplate" #leftPanningTmpl class="igx-list__item-right"
3-
[style.width.px]="this.element.offsetWidth" [style.height.px]="this.element.offsetHeight">
4-
<ng-container *ngTemplateOutlet="list.listItemLeftPanningTemplate.template; context: context">
3+
[style.width.rem]="offsetWidthInRem" [style.height.rem]="offsetHeightInRem">
4+
<ng-container *ngTemlateOutlet="list.listItemLeftPanningTemplate.template; context: context">
55
</ng-container>
66
</div>
77

88
<div *ngIf="!isHeader && list.listItemRightPanningTemplate" #rightPanningTmpl class="igx-list__item-left"
9-
[style.width.px]="this.element.offsetWidth" [style.height.px]="this.element.offsetHeight">
9+
[style.width.rem]="offsetWidthInRem" [style.height.rem]="offsetHeightInRem">
1010
<ng-container *ngTemplateOutlet="list.listItemRightPanningTemplate.template; context: context">
1111
</ng-container>
1212
</div>
@@ -33,7 +33,6 @@
3333
</div>
3434
</ng-template>
3535

36-
3736
<ng-container *ngIf="isHeader">
3837
<ng-container *ngTemplateOutlet="itemsContent"></ng-container>
3938
</ng-container>

projects/igniteui-angular/src/lib/list/list-item.component.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
} from './list.common';
1717

1818
import { HammerGesturesManager } from '../core/touch';
19+
import { rem } from '../core/utils';
1920

2021
/**
2122
* The Ignite UI List Item component is a container intended for row items in the Ignite UI for Angular List component.
@@ -241,6 +242,16 @@ export class IgxListItemComponent implements IListChild {
241242
return this.width;
242243
}
243244

245+
/** @hidden @internal */
246+
public get offsetWidthInRem() {
247+
return rem(this.element.offsetWidth);
248+
}
249+
250+
/** @hidden @internal */
251+
public get offsetHeightInRem() {
252+
return rem(this.element.offsetHeight);
253+
}
254+
244255
constructor(
245256
public list: IgxListBaseDirective,
246257
private elementRef: ElementRef,

projects/igniteui-angular/src/lib/simple-combo/simple-combo.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<ng-container *ngTemplateOutlet="headerTemplate">
5252
</ng-container>
5353
<div #dropdownItemContainer class="igx-combo__content" [style.overflow]="'hidden'"
54-
[style.maxHeight.px]="itemsMaxHeight" [igxDropDownItemNavigation]="dropdown"
54+
[style.maxHeight.rem]="itemsMaxHeightInRem" [igxDropDownItemNavigation]="dropdown"
5555
[tabindex]="dropdown.collapsed ? -1 : 0" [attr.id]="dropdown.id"
5656
[attr.aria-activedescendant]="this.activeDescendant"
5757
(focus)="dropdown.onFocus()" (keydown)="handleItemKeyDown($event)">

0 commit comments

Comments
 (0)