Skip to content

Commit 8172c7b

Browse files
committed
Get generalized ksSizer work. Fix confirmation dialog layout when word wrap occurs.
1 parent 09745da commit 8172c7b

5 files changed

Lines changed: 16 additions & 16 deletions

File tree

src/app/directives/ks-sizer.directive.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
import { Directive, ElementRef, HostBinding, Input, ViewContainerRef } from '@angular/core';
2424
import { DomSanitizer, SafeStyle } from '@angular/platform-browser';
25-
import { toNumber } from 'ks-util';
2625

2726
@Directive({
2827
selector: '[ksSizer]'
@@ -35,12 +34,12 @@ export class KsSizerDirective {
3534

3635
if (!width)
3736
width = 'auto';
38-
else if (toNumber(width) !== 0)
37+
else if (!isNaN(Number(width)))
3938
width += 'px';
4039

4140
if (!height)
4241
height = 'auto';
43-
else if (toNumber(height) !== 0)
42+
else if (!isNaN(Number(height)))
4443
height += 'px';
4544

4645
if (this.hostComponent)
@@ -56,15 +55,11 @@ export class KsSizerDirective {
5655
constructor(
5756
private sanitizer: DomSanitizer,
5857
private elementRef: ElementRef,
59-
viewContainerRef: ViewContainerRef
58+
private viewContainerRef: ViewContainerRef
6059
) {
6160
const vcr = viewContainerRef as any;
6261

63-
if (vcr && vcr._data && vcr._data.componentView && vcr._data.componentView.component) {
64-
const comp = vcr._data.componentView.component;
65-
66-
if (comp.el instanceof ElementRef && comp.el.nativeElement)
67-
this.hostComponent = comp;
68-
}
62+
if (vcr && vcr._data && vcr._data.componentView && vcr._data.componentView.component)
63+
this.hostComponent = vcr._data.componentView.component;
6964
}
7065
}

src/app/svc/svc-atlas-dialog/svc-atlas-dialog.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<span><input #searchField type="text" pInputText class="city-field" [(ngModel)]="city" [disabled]="searching"
1212
(focus)="searchFocus(true)" (blur)="searchFocus(false)"
1313
autocorrect="off" autocapitalize="off" autocomplete="off"/></span>
14-
<span><ks-dropdown [(ngModel)]="state" [options]="states" [editable]="true" [style]="{width: '19em'}"></ks-dropdown></span>
14+
<span><ks-dropdown [(ngModel)]="state" [options]="states" [editable]="true" ksSizer="19em"></ks-dropdown></span>
1515
<span><button type="button" pButton icon="fas fa-search" (click)="search()" label="Search" [disabled]="searching || becomingVisible"
1616
(focus)="searchFocus(true)" (blur)="searchFocus(false)"></button></span>
1717
</div>

src/app/svc/svc-location-settings/svc-location-settings.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<p-dialog header="Save Location" [modal]="true" [(visible)]="showSaveDialog" ksSizer="350">
2424
<div style="height: 80px;">
2525
Save location as:&nbsp;
26-
<ks-dropdown #saveNameDropdown [(ngModel)]="selectedName" [options]="saveDialogNames" [editable]="true" [style]="{width: '200px'}"></ks-dropdown>
26+
<ks-dropdown #saveNameDropdown [(ngModel)]="selectedName" [options]="saveDialogNames" [editable]="true" ksSizer="200"></ks-dropdown>
2727
<br><br><p-checkbox [(ngModel)]="makeDefault" binary="true" label="Make this the default location"></p-checkbox>
2828
</div>
2929
<p-footer>
@@ -32,13 +32,13 @@
3232
<button type="button" pButton icon="fas fa-check" (click)="doSave()" label="OK" [disabled]="!selectedName.trim()"></button>
3333
</div>
3434
</p-footer>
35-
<p-confirmDialog key="save-confirm" header="Same location name in use" icon="fas fa-question-circle" [style]="{width: '400px'}" appendTo="body"></p-confirmDialog>
35+
<p-confirmDialog key="save-confirm" header="Same location name in use" icon="fas fa-question-circle" ksSizer="400" appendTo="body"></p-confirmDialog>
3636
</p-dialog>
3737
<p-dialog header="Delete Location" [modal]="true" [(visible)]="showDeleteDialog" ksSizer="350">
3838
<div style="height: 35px;">
3939
<div fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="4px">
4040
<span>Location to delete:&nbsp;</span>
41-
<ks-dropdown #deleteNameDropdown [(ngModel)]="selectedName" [options]="deleteDialogNames" [style]="{width: '200px'}"></ks-dropdown>
41+
<ks-dropdown #deleteNameDropdown [(ngModel)]="selectedName" [options]="deleteDialogNames" ksSizer="200"></ks-dropdown>
4242
</div>
4343
</div>
4444
<p-footer>

src/app/svc/svc-preferences-dialog/svc-preferences-dialog.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<label for="twilightInput">Twilight begin/end events:</label>
3030
</div>
3131
<div class="settings-value flex-container" fxLayout="row" fxLayoutAlign="space-between center">
32-
<ks-dropdown [options]="twilightOptions" [(ngModel)]="twilightByDegrees" [style]="{width: '27em'}" fxFlex="0 0 auto"></ks-dropdown>
32+
<ks-dropdown [options]="twilightOptions" [(ngModel)]="twilightByDegrees" ksSizer="27em" fxFlex="0 0 auto"></ks-dropdown>
3333
<input type="text" [(ngModel)]="twilightValue" pInputText class="twilight-input form-control" fxFlex="0 0 auto"
3434
id="twilightInput" required minlength="1" maxlength="3" pattern="\d{1,3}" (input)="onTwilightChange($event.target)"/>
3535
</div>
@@ -45,7 +45,7 @@
4545
Calendar:
4646
</div>
4747
<div class="settings-value flex-container" fxLayout="row" fxLayoutAlign="space-between center">
48-
<ks-dropdown [options]="calendarOptions" [(ngModel)]="calendarOption" [style]="{width: '23em'}" fxFlex="0 0 auto"></ks-dropdown>
48+
<ks-dropdown [options]="calendarOptions" [(ngModel)]="calendarOption" ksSizer="23em" fxFlex="0 0 auto"></ks-dropdown>
4949
<svc-date-editor [pureGregorian]="true" [minYear]="300" [maxYear]="3900"
5050
fxFlex="0 0 auto" [blank]="!gcdVisible" [disabled]="gcdDisabled" [(ngModel)]="gcdValue"></svc-date-editor>
5151
</div>

src/primeng-theme-tweaks.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ body {
5454
}
5555
}
5656

57+
.ui-confirmdialog.ui-dialog .ui-dialog-content {
58+
display: grid;
59+
grid-template-columns: auto 1fr;
60+
}
61+
5762
.ui-dialog {
5863
.ui-dialog-titlebar {
5964
font-size: 1.25em;

0 commit comments

Comments
 (0)