Skip to content

Commit 2eff952

Browse files
IvayloGLipata
authored andcommitted
fix(select): Remove displayDensity Input. #5843
Add displayDensity sample.
1 parent e36abe9 commit 2eff952

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,16 +160,6 @@ export class IgxSelectComponent extends IgxDropDownComponent implements IgxSelec
160160
@Input()
161161
public type = 'line';
162162

163-
/**
164-
* An @Input property that sets what display density to be used for the input group.
165-
* The allowed values are `compact`, `cosy` and `comfortable`. The default is `comfortable`.
166-
* ```html
167-
*<igx-select [displayDensity]="'compact'"></igx-select>
168-
* ```
169-
*/
170-
@Input()
171-
public displayDensity = 'comfortable';
172-
173163
/**
174164
* The custom template, if any, that should be used when rendering the select TOGGLE(open/close) button
175165
*

src/app/select/select.sample.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<div class="sampleWrapper">
66
<h4 class="sample-title">Select with ngModel, set items OnInit</h4>
7-
<igx-select #select1
7+
<igx-select #displayDensitySelect
88
[required]="true"
99
[placeholder]="'Pick One'"
1010
[(ngModel)]="value"
@@ -13,7 +13,8 @@ <h4 class="sample-title">Select with ngModel, set items OnInit</h4>
1313
(onClosing)="testOnClosing($event)"
1414
(onClosed)="testOnClosed()"
1515
(onSelection)="testOnSelection($event)"
16-
[disabled]="false">
16+
[disabled]="false"
17+
[displayDensity]="'cosy'">
1718
<label igxLabel>Sample Label</label>
1819
<igx-prefix igxPrefix>
1920
<igx-icon fontSet="material">alarm</igx-icon>
@@ -24,6 +25,13 @@ <h4 class="sample-title">Select with ngModel, set items OnInit</h4>
2425
</igx-select-item>
2526
</igx-select>
2627

28+
<div>
29+
<h4>Display Density</h4>
30+
<button igxButton="raised" [disabled]="selectDisplayDensity.displayDensity === compact" (click)="setDensity(compact)">Compact</button>
31+
<button igxButton="raised" [disabled]="selectDisplayDensity.displayDensity === cosy" (click)="setDensity(cosy)">Cosy</button>
32+
<button igxButton="raised" [disabled]="selectDisplayDensity.displayDensity === comfortable" (click)="setDensity(comfortable)">Comfortable</button>
33+
</div>
34+
2735
<h4 class="sample-title">Select - declare items in html template</h4>
2836
<igx-select #select2
2937
[placeholder]="'Pick One'"

src/app/select/select.sample.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import {
44
ISelectionEventArgs, CancelableEventArgs, OverlaySettings,
55
HorizontalAlignment, VerticalAlignment, scaleInTop, scaleOutBottom, ConnectedPositioningStrategy,
66
AbsoluteScrollStrategy,
7-
IgxSelectComponent
7+
IgxSelectComponent,
8+
DisplayDensity
89
} from 'igniteui-angular';
910

1011
@Component({
@@ -19,7 +20,12 @@ export class SelectSampleComponent implements OnInit {
1920
public select: IgxSelectComponent;
2021
@ViewChild('model', { read: IgxSelectComponent, static: true })
2122
public selectFruits: IgxSelectComponent;
23+
@ViewChild('displayDensitySelect', { read: IgxSelectComponent, static: true })
24+
public selectDisplayDensity: IgxSelectComponent;
2225

26+
public comfortable = DisplayDensity.comfortable;
27+
public cosy = DisplayDensity.cosy;
28+
public compact = DisplayDensity.compact;
2329

2430
constructor(fb: FormBuilder) {
2531
this.reactiveForm = fb.group({
@@ -137,4 +143,8 @@ export class SelectSampleComponent implements OnInit {
137143
this.selectComponents.first.open(customOverlaySettings);
138144
}
139145
}
146+
147+
setDensity(density: DisplayDensity) {
148+
this.selectDisplayDensity.displayDensity = density;
149+
}
140150
}

0 commit comments

Comments
 (0)