Skip to content

Commit ff46d52

Browse files
authored
feat(dropdown, combo, select) adding extra span to enable ellipsis by default #7190 (#7329)
1 parent ec7edc1 commit ff46d52

File tree

9 files changed

+24
-30
lines changed

9 files changed

+24
-30
lines changed

CHANGELOG.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes for each version of this project will be documented in this file.
44

5+
## 10.0
6+
7+
### General
8+
- `igx-select`, `igx-combo`, `igx-drop-down`
9+
- **Behavioral Change** - The select, combo, and dropdown items now have display block and text-overflow ellipsis enabled by default.
10+
511
## 9.1.1
612

713
### General
@@ -129,11 +135,11 @@ All notable changes for each version of this project will be documented in this
129135
```typescript
130136
public pinningConfiguration: IPinningConfig = { columns: ColumnPinningPosition.End };
131137
```
132-
- Added new properties for paging:
133-
- `totalRecords` set to alter the pages count based on total remote records. Keep in mind that If you are using paging and all the data is passed to the grid, the value of totalRecords property will be set by default to the length of the provided data source. If totalRecords is set, it will take precedent over the default length based on the data source.
134-
- `pagingMode` - accepts `GridPagingMode` enumeration. If the paging mode is set to remote the grid will not paginate the passed data source, if the paging mode is set to local (which is the default value) the grid will paginate the data source based on the page, perPage and totalRecords values.
138+
- Added new properties for paging:
139+
- `totalRecords` set to alter the pages count based on total remote records. Keep in mind that If you are using paging and all the data is passed to the grid, the value of totalRecords property will be set by default to the length of the provided data source. If totalRecords is set, it will take precedent over the default length based on the data source.
140+
- `pagingMode` - accepts `GridPagingMode` enumeration. If the paging mode is set to remote the grid will not paginate the passed data source, if the paging mode is set to local (which is the default value) the grid will paginate the data source based on the page, perPage and totalRecords values.
135141
- Added functionality for column selection.
136-
- `columnSelection` property has been added. It accepts GridSelection mode enumeration. Grid selection mode could be none, single or multiple.
142+
- `columnSelection` property has been added. It accepts GridSelection mode enumeration. Grid selection mode could be none, single or multiple.
137143
- `selected` property has been added to the IgxColumnComponent; Allows you to set whether the column is selected.
138144
- `selectable` property has been added to the IgxColumnComponent; Allows you to set whether the column is selectable.
139145
- `onColumnSelectionChange` event is added for the `IgxGrid`. It is emitted when the column selection is changed.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<ng-container *ngIf="!isHeader">
22
<igx-checkbox [checked]="selected" disableRipple="true" [disableTransitions]="disableTransitions" [tabindex]="-1" (click)="disableCheck($event)" class="igx-combo__checkbox"></igx-checkbox>
33
</ng-container>
4-
<ng-content></ng-content>
4+
<span class="igx-drop-down__inner"><ng-content></ng-content></span>

projects/igniteui-angular/src/lib/core/styles/components/drop-down/_drop-down-component.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
@extend %igx-drop-down__item !optional;
2626
}
2727

28+
@include e(inner) {
29+
@extend %igx-drop-down__inner !optional;
30+
}
31+
2832
@include e(item, $m: cosy) {
2933
@extend %igx-drop-down__item--cosy !optional;
3034
}

projects/igniteui-angular/src/lib/core/styles/components/drop-down/_drop-down-theme.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,11 @@
271271
}
272272
}
273273

274+
%igx-drop-down__inner {
275+
display: block;
276+
@include ellipsis();
277+
}
278+
274279
%igx-drop-down__item--cosy {
275280
height: map-get($item-height, 'cosy');
276281
padding: map-get($item-padding, 'cosy');
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<ng-content></ng-content>
1+
<span class="igx-drop-down__inner"><ng-content></ng-content></span>

projects/igniteui-angular/src/lib/drop-down/drop-down.component.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const CSS_CLASS_DROP_DOWN_BASE = 'igx-drop-down';
2121
const CSS_CLASS_LIST = 'igx-drop-down__list';
2222
const CSS_CLASS_SCROLL = 'igx-drop-down__list-scroll';
2323
const CSS_CLASS_ITEM = 'igx-drop-down__item';
24+
const CSS_CLASS_INNER_SPAN = 'igx-drop-down__inner';
2425
const CSS_CLASS_GROUP_ITEM = 'igx-drop-down__group';
2526
const CSS_CLASS_ITEM_COSY = 'igx-drop-down__item--cosy';
2627
const CSS_CLASS_ITEM_COMPACT = 'igx-drop-down__item--compact';
@@ -977,7 +978,7 @@ describe('IgxDropDown ', () => {
977978
dropdown.toggle();
978979
fixture.detectChanges();
979980
expect(dropdown.collapsed).toBeFalsy();
980-
const dropdownItems = document.querySelectorAll(`.${CSS_CLASS_ITEM}`);
981+
const dropdownItems = document.querySelectorAll(`.${CSS_CLASS_INNER_SPAN}`);
981982
expect(dropdownItems.length).toEqual(9);
982983
expect(dropdown.items.length).toEqual(9);
983984
for (let i = 0; i < dropdownItems.length; i++) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Component, DoCheck, Input } from '@angular/core';
33

44
@Component({
55
selector: 'igx-select-item',
6-
template: '<ng-content></ng-content>'
6+
template: '<span class="igx-drop-down__inner"><ng-content></ng-content></span>'
77
})
88
export class IgxSelectItemComponent extends IgxDropDownItemComponent implements DoCheck {
99

src/app/drop-down/drop-down.sample.html

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,33 +29,25 @@ <h5>Density types</h5>
2929
<igx-drop-down #dropdown1 (onSelection)="onSelection($event)" (onOpening)="onOpening($event)">
3030
<igx-drop-down-item *ngFor="let item of items" [disabled]="item.disabled" [isHeader]="item.header"
3131
[selected]="item.selected">
32-
<div class="igx-drop-down__item-template">
3332
{{ item.field }}
34-
</div>
3533
</igx-drop-down-item>
3634
</igx-drop-down>
3735

3836
<igx-drop-down #dropdown2 (onSelection)="onSelection($event)" (onOpening)="onOpening($event)" height='400px'>
3937
<igx-drop-down-item *ngFor="let item of items" [disabled]="item.disabled" [isHeader]="item.header">
40-
<div class="igx-drop-down__item-template">
4138
{{ item.field }}
42-
</div>
4339
</igx-drop-down-item>
4440
</igx-drop-down>
4541

4642
<div igxToggle #toggle="toggle" style="height: 300px; overflow: auto">
4743
<div *ngFor="let item of items">
48-
<div class="igx-drop-down__item-template">
4944
{{ item.field }}
50-
</div>
5145
</div>
5246
</div>
5347

5448
<igx-drop-down #menu (onSelection)="onSelectionMenu($event)" height='400px'>
5549
<igx-drop-down-item *ngFor="let item of items" [disabled]="item.disabled" [isHeader]="item.header">
56-
<div class="igx-drop-down__item-template">
5750
{{ item.field }}
58-
</div>
5951
</igx-drop-down-item>
6052
</igx-drop-down>
6153

@@ -93,9 +85,7 @@ <h5>Density types</h5>
9385
<igx-drop-down #dropdown3 (onOpening)="onOpening($event)" (onSelection)="onSelectionLogger($event)" height='400px'>
9486
<igx-drop-down-item *ngFor="let item of items" [value]="item" [disabled]="item.disabled"
9587
[isHeader]="item.header">
96-
<div class="igx-drop-down__item-template">
9788
{{ item.field }}
98-
</div>
9989
</igx-drop-down-item>
10090
</igx-drop-down>
10191
<button igxButton="raised" igxRipple (click)="clearSelection()" style="display: block">

src/app/drop-down/drop-down.sample.scss

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
.igx-drop-down__item-template {
2-
-webkit-user-select: none; /* Chrome all / Safari all */
3-
-moz-user-select: none; /* Firefox all */
4-
-ms-user-select: none; /* IE 10+ */
5-
user-select: none; /* Likely future */
6-
7-
overflow: hidden;
8-
text-overflow: ellipsis;
9-
white-space: nowrap;
10-
width: 100%
11-
}
12-
131
.sample-button-group {
142
display: flex;
153
flex-direction: column;

0 commit comments

Comments
 (0)