Skip to content

Commit cd3d0bb

Browse files
authored
Merge pull request #8789 from IgniteUI/refactor_dialog_component
Dialog component refactoring
2 parents e25d648 + cb2273e commit cd3d0bb

File tree

9 files changed

+21
-24
lines changed

9 files changed

+21
-24
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ All notable changes for each version of this project will be documented in this
77
- `IgxDropDown`
88
- The `igx-drop-down-item` now allows for `igxPrefix`, `igxSuffix` and `igx-divider` directives to be passed as `ng-content` and they will be renderer accordingly in the item's content.
99
### General
10+
- `IgxDialog`
11+
- The dialog content has been moved inside the dialog window container in the template. This means that if you have added something in-between the opening and closing tags of the dialog, you may have to adjust its styling a bit since that content is now rendered inside a container that has padding on it.
1012
- `IgxCalendar`
1113
- A new string enumeration `IgxCalendarView` is exported. Either the new one or the current `CalendarView` can be used. `CalendarView` will be deprecated in a future release.
1214
- `IgxRadioGroup`

projects/igniteui-angular/src/lib/dialog/dialog-content.component.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
</div>
77
<ng-content *ngIf="!title" select="igx-dialog-title,[igxDialogTitle]"></ng-content>
88

9-
<div class="igx-dialog__window-content" *ngIf="message">{{ message }}</div>
10-
<ng-content *ngIf="!message"></ng-content>
9+
<div class="igx-dialog__window-content">
10+
{{ message }}
11+
<ng-content *ngIf="!message"></ng-content>
12+
</div>
1113

1214
<div *ngIf="leftButtonLabel || rightButtonLabel" class="igx-dialog__window-actions">
1315
<button *ngIf="leftButtonLabel" type="button" [igxFocus]="isOpen" igxButton="{{ leftButtonType }}" igxButtonColor="{{ leftButtonColor }}" igxButtonBackground="{{ leftButtonBackgroundColor }}"

projects/igniteui-angular/src/lib/dialog/dialog.component.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ describe('Dialog', () => {
232232
dialog.open();
233233
tick();
234234
fixture.detectChanges();
235-
const buttons = document.getElementsByClassName('custom-sample')[0].nextElementSibling.querySelectorAll('button');
235+
const buttons = document.querySelectorAll('button');
236236
const leftButton = buttons[0];
237237
const rightButton = buttons[1];
238238

@@ -313,10 +313,10 @@ describe('Dialog', () => {
313313
fixture.detectChanges();
314314

315315
const dialogWindow = fixture.debugElement.query(By.css('.igx-dialog__window'));
316-
expect(dialogWindow.children.length).toEqual(2);
316+
expect(dialogWindow.children.length).toEqual(3);
317317

318318
expect(dialogWindow.children[0].nativeElement.innerText.toString()).toContain('TITLE');
319-
expect(dialogWindow.children[1].nativeElement.innerText.toString()).toContain('BUTTONS');
319+
expect(dialogWindow.children[2].nativeElement.innerText.toString()).toContain('BUTTONS');
320320

321321
dialog.close();
322322
});

src/app/dialog/dialog.sample.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
max-width: 200px;
33
}
44

5-
.login-form {
6-
padding: 0 24px 24px 24px;
7-
}
8-
95
.icon {
106
font-size: .75em;
117
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ <h4 class="sample-title">Ghost and base templating:</h4>
2929
<br>
3030
<h4 class="sample-title">Drag Handle:</h4>
3131
<button igxButton="raised" igxRipple (click)="openDialog()" [style.width.px]="150">Open dialog</button>
32-
<div igxToggle #toggleForm="toggle" class="igx-dialog" [style.width.px]="280"
32+
<div igxToggle #toggleForm="toggle" class="igx-dialog" [style.width.px]="320"
3333
igxDrag [ghost]="false" [dragTolerance]="0" [dragChannel]="'dialog'">
3434
<div class="igx-dialog__window">
35-
<div class="login-form">
35+
<div class="igx-dialog__window-content">
3636
<div class="dialogHeader">
3737
<span [style.margin.px]="10">Sign In</span>
3838
<igx-icon igxDragHandle fontSet="material" class="dialogHandle">control_camera</igx-icon>

src/app/grid-multi-row-layout-config/grid-mrl-config.sample.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
border: 1px black dotted;
99
}
1010

11+
textarea {
12+
max-width: 100%;
13+
padding: 8px;
14+
}
15+
1116
.columnOut {
1217
display: flex;
1318
height: 32px;

src/app/grid-multi-row-layout-config/grid-mrl-config.sample.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@
9393
<igx-dialog #jsonDialog title="Multi-row layout result:"
9494
leftButtonLabel="Cancel" (onLeftButtonSelect)="jsonDialog.close()" rightButtonLabel="Copy" (onRightButtonSelect)="copyToClipboard()"
9595
backgroundClick="true" [closeOnOutsideSelect]="true">
96-
<div class="login-form">
97-
<textarea #textArea rows="18" cols="101" readonly style="margin: 10px;">{{jsonCollection}}</textarea>
98-
</div>
96+
<textarea #textArea rows="18" cols="101" readonly>{{jsonCollection}}</textarea>
9997
</igx-dialog>
10098
</section>

src/app/list/list.sample.html

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,11 +325,9 @@ <h4 class="sample-title">
325325
<igx-dialog #addFruitDialog title="Add Fruit" leftButtonLabel="Cancel" (onLeftButtonSelect)="addFruitDialog.close()" rightButtonLabel="Add"
326326
rightButtonBackgroundColor="#0375be" rightButtonColor="white" (onRightButtonSelect)="onAddFruitButtonClicked(newFruitName.value);newFruitName.value='';"
327327
backgroundClick="true" closeOnOutsideSelect="true">
328-
<div class="sample-dialog-content">
329-
<igx-input-group>
330-
<label for="newFruit">Fruit Name</label>
331-
<input id="newFruit" igxInput #newFruitName type="text" />
332-
</igx-input-group>
333-
</div>
328+
<igx-input-group>
329+
<label igxLabel for="newFruit">Fruit Name</label>
330+
<input id="newFruit" igxInput #newFruitName type="text" />
331+
</igx-input-group>
334332
</igx-dialog>
335333

src/app/list/list.sample.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@
1818
position: relative;
1919
}
2020

21-
.sample-dialog-content {
22-
padding: 8px;
23-
}
24-
2521
.sample-column.bootstrap {
2622
display: none;
2723
}

0 commit comments

Comments
 (0)