Skip to content

Commit 99adc04

Browse files
committed
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular into rkaraivanov/toolbar-refactor
2 parents 7479c25 + 6c66976 commit 99adc04

File tree

13 files changed

+143
-29
lines changed

13 files changed

+143
-29
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ All notable changes for each version of this project will be documented in this
77
- `IgxInputGroup`
88
- **Breaking Chage** - Removed `fluent`, `fluent_search`, `bootstrap`, and `indigo` as possible values for the `type` input property.
99
- **Behavioral Change** - The styling of the input group is now dictated by the theme being used. The remaining `types` - `line`, `border`, and `box` will only have effect on the styling when used with the `material` theme. The `search` type will affect styling when used with all themes. Changing the theme at runtime will not change the styling of the input group, a page refresh is required.
10+
- `IgxSelect`
11+
- Added `aria-labelledby` property for the items list container(marked as `role="listbox"`). This will ensure the users of assistive technologies will also know what the list items container is used for, upon opening.
12+
- `IgxDatePicker`
13+
- **Breaking Change** - Deprecated the `label` and `labelVisibility` properties.
1014

1115
### New Features
1216
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
@@ -15,8 +19,11 @@ All notable changes for each version of this project will be documented in this
1519
- Allows for setting an input group `type` on a global level, so all input-group instances, including components using such an instance as a template will have their input group type set to the one specified by the token. It can be overridden on a component level by explicitly setting a `type`.
1620
- ` IgxExcelExporterService`
1721
- Added `worksheetName` property to the `IgxExcelExporterOptions`, that allows setting the name of the worksheet.
22+
- `IgxDatePicker`
23+
- The `labelVisibility` and the `label` property have been deprecated and now a custom label is set by nesting a <label igxLabel></label> inside the <igx-date-picker><igx-date-picker> tags.
1824
- `IgxTimePicker`
1925
- Added a custom label functionality.
26+
- `IgxCalendar` and `IgxDatePicker` - new `showWeekNumbers` input, that allows showing of the week number at left side of content area.
2027

2128
## 10.1.0
2229

projects/igniteui-angular/src/lib/avatar/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ A walkthrough of how to get started can be found [here](https://www.infragistics
55

66
# Usage
77
```html
8-
<igx-avatar roundShape="true" icon="person" bgColor="#0375be" data-init="SS">
8+
<igx-avatar [roundShape]="true" icon="person" bgColor="#0375be" data-init="SS">
99
</igx-avatar>
1010
```
1111

@@ -27,7 +27,7 @@ A walkthrough of how to get started can be found [here](https://www.infragistics
2727

2828
Using `igx-avatar` tag to include it into your app.
2929
```html
30-
<igx-avatar roundShape="true" icon="person" bgColor="#0375be" data-init="SS">
30+
<igx-avatar [roundShape]="true" icon="person" bgColor="#0375be" data-init="SS">
3131
</igx-avatar>
3232
```
3333

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export type IgxAvatarType = (typeof IgxAvatarType)[keyof typeof IgxAvatarType];
4747
*
4848
* @example
4949
* ```html
50-
* <igx-avatar initials="MS" roundShape="true" size="large">
50+
* <igx-avatar initials="MS" [roundShape]="true" size="large">
5151
* </igx-avatar>
5252
* ```
5353
*/
@@ -145,12 +145,12 @@ export class IgxAvatarComponent implements OnInit {
145145
public id = `igx-avatar-${NEXT_ID++}`;
146146

147147
/**
148-
* Sets a round shape to the avatar, if `roundShape` is set to `true`.
148+
* Sets a round shape to the avatar, if `[roundShape]` is set to `true`.
149149
* By default the shape of the avatar is a square.
150150
*
151151
* @example
152152
* ```html
153-
* <igx-avatar roundShape="true" ></igx-avatar>
153+
* <igx-avatar [roundShape]="true" ></igx-avatar>
154154
* ```
155155
*/
156156

projects/igniteui-angular/src/lib/core/styles/components/calendar/_calendar-theme.scss

+4-9
Original file line numberDiff line numberDiff line change
@@ -605,8 +605,7 @@
605605
}
606606

607607
%cal-value,
608-
%cal-value--label,
609-
{
608+
%cal-value--label {
610609
// 100 divided by the number of weekdays
611610
min-width: 14.28%;
612611

@@ -683,11 +682,7 @@
683682

684683
&::after {
685684
top: 100%;
686-
@if $not-bootstrap-theme{
687-
height: ($cal-row-padding / 2) + rem(2px);
688-
} @else {
689-
height: $cal-row-padding + rem(5px);
690-
}
685+
height: if($not-bootstrap-theme, ($cal-row-padding / 2) + rem(2px), $cal-row-padding + rem(5px));
691686
}
692687

693688
&::before {
@@ -718,7 +713,7 @@
718713
}
719714

720715
&:nth-child(2) {
721-
@if $not-bootstrap-theme{
716+
@if $not-bootstrap-theme {
722717
margin-top: 0;
723718
}
724719
}
@@ -733,7 +728,7 @@
733728
}
734729
}
735730

736-
@if $bootstrap-theme{
731+
@if $bootstrap-theme {
737732
margin-bottom: 0;
738733
}
739734
}

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

+12
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
igx-display-container {
3131
@extend %grid-display-container-thead !optional;
3232
}
33+
34+
&:focus {
35+
@extend %disable-focus-styles !optional;
36+
}
3337
}
3438

3539
@include e(thead-title) {
@@ -64,6 +68,10 @@
6468

6569
@include e(tbody-content) {
6670
@extend %grid-tbody !optional;
71+
72+
&:focus {
73+
@extend %disable-focus-styles !optional;
74+
}
6775
}
6876

6977
@include e(tbody-message) {
@@ -104,6 +112,10 @@
104112

105113
@include e(tfoot) {
106114
@extend %grid-tfoot !optional;
115+
116+
&:focus {
117+
@extend %disable-focus-styles !optional;
118+
}
107119
}
108120

109121
@include e(tfoot-thumb) {

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

+4
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,10 @@
696696
indigo-design: 600,
697697
), $variant);
698698

699+
%disable-focus-styles {
700+
outline: 0;
701+
}
702+
699703
%grid-display {
700704
position: relative;
701705
display: grid;

projects/igniteui-angular/src/lib/date-picker/README.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ DatePicker with cancel and today buttons
4141
</igx-date-picker>
4242
```
4343

44+
The DatePicker's custom label can be set in the way shown below. If `labelVisibility` is set to `false` and a custom label is not used, a default one will be set.
45+
````html
46+
<igx-date-picker>
47+
<label igxLabel>Custom label</label>
48+
</igx-date-picker>
49+
4450
You have also ability to disable the datePicker
4551
```html
4652
<igx-date-picker [disabled]="false">
@@ -123,8 +129,8 @@ The DatePicker action buttons could be retemplated.
123129
| `weekStart`| `Number \| WEEKDAYS` | Sets on which day will the week start. |
124130
| `locale` | `string` | Sets the locale used for formatting and displaying the dates in the calendar. For more information check out [this](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl) page for valid formats. |
125131
| `formatOptions` | `Object` | The format options passed along with the `locale` property used for formatting the dates. |
126-
| `label` | `string` | Configure the input label text. |
127-
| `labelVisibility` | `string` | Configure the input label text visibility. |
132+
| `label` | `string` | Deprecated. Configure the input label text. |
133+
| `labelVisibility` | `string` | Deprecated. Configure the input label text visibility. |
128134
| `format` | `string` | Configure the date display format when in edit mode. Accepts formats using the d, M and y symbols, custom separators and the following pre-defined format options - shortDate, mediumDate, longDate and fullDate. |
129135
| `mask` | `string` | Configure the date editor mask. Accepts the d, M and y symbols as mask - for example dd-MM-y. |
130136
| `disabledDates` | `DateRangeDescriptor[]` | Configure the disabled dates. |
@@ -154,4 +160,4 @@ The DatePicker action buttons could be retemplated.
154160
| `selectDate` | `date: Date` | `void` | Change the calendar selection. Calling this method will emit the `onSelection` event. |
155161
| `deselectDate` | `void` | Deselects the calendar date and clear input field value. |
156162
| `triggerTodaySelection` | `void` | Selects today's date in calendar and change the input field value. |
157-
| `openDialog` | `target?: HTMLElement` | `void` | Opens the dialog or drop down, depending on the mode. |
163+
| `openDialog` | `target?: HTMLElement` | `void` | Opens the dialog or drop down, depending on the mode. |

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

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
<ng-template #labelTemplate>
2+
<ng-content select="[igxLabel]"></ng-content>
3+
</ng-template>
4+
15
<ng-template #readOnlyDatePickerTemplate>
26
<igx-input-group (click)="openDialog()">
7+
<label igxLabel *ngIf="!labelDirective&&!labelVisibility">Date</label>
8+
<ng-container ngProjectAs="[igxLabel]" *ngTemplateOutlet="labelTemplate"></ng-container>
39
<igx-prefix>
410
<igx-icon>today</igx-icon>
511
</igx-prefix>
6-
<label *ngIf="labelVisibility" igxLabel>{{label}}</label>
12+
<label *ngIf="labelVisibility&&!labelDirective" igxLabel>{{label}}</label>
713
<input
814
class="igx-date-picker__input-date"
915
igxInput
@@ -18,10 +24,12 @@
1824

1925
<ng-template #editableDatePickerTemplate>
2026
<igx-input-group #editableInputGroup>
27+
<label igxLabel *ngIf="!labelDirective&&!labelVisibility">Date</label>
28+
<ng-container ngProjectAs="[igxLabel]" *ngTemplateOutlet="labelTemplate"></ng-container>
2129
<igx-prefix (click)="onOpenClick($event)">
2230
<igx-icon>today</igx-icon>
2331
</igx-prefix>
24-
<label *ngIf="labelVisibility" igxLabel>{{label}}</label>
32+
<label *ngIf="labelVisibility&&!labelDirective" igxLabel>{{label}}</label>
2533
<input
2634
class="igx-date-picker__input-date"
2735
igxInput

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

+48-4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ describe('IgxDatePicker', () => {
2727
TestBed.configureTestingModule({
2828
declarations: [
2929
IgxDatePickerTestComponent,
30+
IgxDatePickerProjectedLabelTestComponent,
3031
IgxDatePickerWithWeekStartComponent,
3132
IgxDatePickerWithCustomFormatterComponent,
3233
IgxDatePickerWithPassedDateComponent,
@@ -149,7 +150,7 @@ describe('IgxDatePicker', () => {
149150
expect(datePicker.value).toEqual(date);
150151
});
151152

152-
it('When labelVisability is set to false the label should not be visible', () => {
153+
it('When labelVisibility is set to false the label should not be visible', () => {
153154
let label = fixture.debugElement.query(By.directive(IgxLabelDirective));
154155

155156
expect(label.nativeElement.innerText).toBe(datePicker.label);
@@ -158,7 +159,7 @@ describe('IgxDatePicker', () => {
158159
fixture.detectChanges();
159160

160161
label = fixture.debugElement.query(By.directive(IgxLabelDirective));
161-
expect(label).toBeNull();
162+
expect(label.nativeElement.innerText).toBe('Date');
162163
});
163164

164165
it('When update label property it should reflect on the label text of the datepicker', () => {
@@ -178,7 +179,7 @@ describe('IgxDatePicker', () => {
178179
fixture.detectChanges();
179180

180181
let label = fixture.debugElement.query(By.directive(IgxLabelDirective));
181-
expect(label).toBeNull();
182+
expect(label.nativeElement.innerText).toBe('Date');
182183

183184
fixture.componentInstance.labelVisibility = true;
184185
fixture.detectChanges();
@@ -187,6 +188,35 @@ describe('IgxDatePicker', () => {
187188
expect(label).not.toBeNull();
188189
});
189190

191+
it('should display default and custom label', () => {
192+
const fixtureProjectedLabel = TestBed.createComponent(IgxDatePickerProjectedLabelTestComponent);
193+
const dom = fixtureProjectedLabel.debugElement;
194+
const testComponent = fixtureProjectedLabel.componentInstance;
195+
fixtureProjectedLabel.detectChanges();
196+
197+
let label = dom.query(By.directive(IgxLabelDirective)).nativeElement.innerText;
198+
expect(label).toEqual(testComponent.customLabel);
199+
200+
testComponent.customLabelVisibility = false;
201+
fixtureProjectedLabel.detectChanges();
202+
203+
label = dom.query(By.directive(IgxLabelDirective)).nativeElement.innerText;
204+
expect(label).toEqual('Date');
205+
206+
testComponent.labelVisibility = false;
207+
fixtureProjectedLabel.detectChanges();
208+
testComponent.customLabelVisibility = false;
209+
fixtureProjectedLabel.detectChanges();
210+
label = dom.query(By.directive(IgxLabelDirective)).nativeElement.innerText;
211+
fixtureProjectedLabel.detectChanges();
212+
expect(label).toEqual('Date');
213+
214+
testComponent.customLabelVisibility = true;
215+
fixtureProjectedLabel.detectChanges();
216+
label = dom.query(By.directive(IgxLabelDirective)).nativeElement.innerText;
217+
expect(label).toEqual(testComponent.customLabel);
218+
});
219+
190220
it('Handling keyboard navigation with `space`(open) and `esc`(close) buttons', fakeAsync(() => {
191221
const datePickerDom = fixture.debugElement.query(By.css('igx-date-picker'));
192222
UIInteractions.triggerKeyDownEvtUponElem('space', datePickerDom.nativeElement, false);
@@ -1520,6 +1550,21 @@ export class IgxDatePickerWithWeekStartComponent {
15201550
@ViewChild(IgxDatePickerComponent, { static: true }) public datePicker: IgxDatePickerComponent;
15211551
}
15221552

1553+
@Component({
1554+
template: `
1555+
<igx-date-picker [labelVisibility]="labelVisibility">
1556+
<label igxLabel *ngIf="customLabelVisibility">{{ customLabel }}</label>
1557+
</igx-date-picker>
1558+
`
1559+
})
1560+
export class IgxDatePickerProjectedLabelTestComponent {
1561+
@ViewChild(IgxDatePickerComponent, { static: true }) public datePicker: IgxDatePickerComponent;
1562+
1563+
public customLabelVisibility = true;
1564+
public customLabel = 'Custom label';
1565+
public labelVisibility = true;
1566+
}
1567+
15231568
@Component({
15241569
template: `
15251570
<igx-date-picker [labelVisibility]="labelVisibility"></igx-date-picker>
@@ -1530,7 +1575,6 @@ export class IgxDatePickerTestComponent {
15301575

15311576
public labelVisibility = true;
15321577
}
1533-
15341578
@Component({
15351579
template: `
15361580
<igx-date-picker [value]="date" [formatOptions]="formatOptions"></igx-date-picker>

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

+30
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ import { IgxDatePickerTemplateDirective, IgxDatePickerActionsDirective } from '.
6161
import { IgxCalendarContainerComponent } from './calendar-container.component';
6262
import { InteractionMode } from '../core/enums';
6363
import { fadeIn, fadeOut } from '../animations/fade';
64+
import { IgxLabelDirective } from '../directives/label/label.directive';
65+
import { DeprecateProperty } from '../core/deprecateDecorators';
6466

6567
let NEXT_ID = 0;
6668

@@ -161,7 +163,18 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
161163
* ```html
162164
* <igx-date-picker [label]="Calendar"></igx-date-picker>
163165
* ```
166+
* @deprecated Use igxLabel inside the date picker to change the label:
167+
* ````html
168+
* <igx-date-picker>
169+
* <label igxLabel>Custom label</label>
170+
* </igx-date-picker>
171+
* ````
172+
* to set a custom label.
164173
*/
174+
@DeprecateProperty(`Use igxLabel inside the date picker to change the label:
175+
<igx-date-picker>
176+
<label igxLabel>Custom label</label>
177+
</igx-date-picker> `)
165178
@Input()
166179
public label = 'Date';
167180

@@ -171,7 +184,18 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
171184
* By default the visibility is set to true.
172185
* @example
173186
* <igx-date-picker [labelVisibility]="false"></igx-date-picker>
187+
* @deprecated Use
188+
* ````html
189+
* <igx-date-picker>
190+
* <label igxLabel>Custom label</label>
191+
* </igx-date-picker>
192+
* ````
193+
* to set a custom label.
174194
*/
195+
@DeprecateProperty(`Deprecated. Use
196+
<igx-date-picker>
197+
<label igxLabel>Custom label</label>
198+
</igx-date-picker> to set a label.` )
175199
@Input()
176200
public labelVisibility = true;
177201

@@ -631,6 +655,12 @@ export class IgxDatePickerComponent implements IDatePicker, ControlValueAccessor
631655
@ViewChild('readOnlyDatePickerTemplate', { read: TemplateRef, static: true })
632656
protected readOnlyDatePickerTemplate: TemplateRef<any>;
633657

658+
/*
659+
* @hidden @internal
660+
*/
661+
@ContentChild(IgxLabelDirective)
662+
public labelDirective: IgxLabelDirective;
663+
634664
/*
635665
* @hidden
636666
*/

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
[value]="this.selectionValue"
1313
role="combobox"
1414
aria-haspopup="listbox"
15-
[attr.aria-labelledby]="this.label ? this.label.id : ''"
15+
[attr.aria-labelledby]="this.label?.id"
1616
[attr.aria-expanded]="!this.collapsed"
1717
[attr.aria-owns]="this.listId"
1818
[attr.aria-activedescendant]="!this.collapsed ? this.focusedItem?.id : null"
@@ -40,7 +40,8 @@
4040
</div>
4141

4242
<!-- #7436 LMB scrolling closes items container - unselectable attribute is IE specific -->
43-
<div #scrollContainer class="igx-drop-down__list-scroll" unselectable="on" [style.maxHeight]="maxHeight" [attr.id]="this.listId" role="listbox">
43+
<div #scrollContainer class="igx-drop-down__list-scroll" unselectable="on" [style.maxHeight]="maxHeight"
44+
[attr.id]="this.listId" role="listbox" [attr.aria-labelledby]="this.label?.id">
4445
<ng-content select="igx-select-item, igx-select-item-group"></ng-content>
4546
</div>
4647

0 commit comments

Comments
 (0)