Skip to content

Commit 9ca9e74

Browse files
committed
style: change accessibility of props in HTML/TS for AOT compilation
1 parent ffd1b81 commit 9ca9e74

11 files changed

+118
-114
lines changed

public_src/components/app/app.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { EditService } from '../../services/edit.service';
2020
})
2121
export class AppComponent {
2222
public advancedMode: boolean = Boolean(localStorage.getItem('advancedMode'));
23-
private editingMode: boolean;
23+
public editingMode: boolean;
2424

2525
@ViewChild(ToolbarComponent) public toolbarComponent: ToolbarComponent;
2626
@ViewChild(AuthComponent) public authComponent: AuthComponent;
@@ -80,16 +80,16 @@ export class AppComponent {
8080
this.toolbarComponent.Initialize();
8181
}
8282

83-
private showHelpModal(): void {
84-
this.helpModal.show();
83+
public isLoading(): boolean {
84+
return this.loadSrv.isLoading();
8585
}
8686

87-
private hideHelpModal(): void {
87+
public hideHelpModal(): void {
8888
this.helpModal.hide();
8989
}
9090

91-
private isLoading(): boolean {
92-
return this.loadSrv.isLoading();
91+
private showHelpModal(): void {
92+
this.helpModal.show();
9393
}
9494

9595
private getStatus(): string {

public_src/components/auth/auth.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ export class AuthComponent {
2222
this.imgHref = this.storageSrv.getImgHref();
2323
}
2424

25+
public isAuthenticated(): void {
26+
return this.authSrv.oauth.authenticated();
27+
}
28+
2529
private getDisplayName(): string {
2630
return this.storageSrv.getDisplayName();
2731
}
@@ -62,10 +66,6 @@ export class AuthComponent {
6266
// document.getElementById("display_name").innerHTML = userDetails["display_name"];
6367
}
6468

65-
private isAuthenticated(): void {
66-
return this.authSrv.oauth.authenticated();
67-
}
68-
6969
private showDetails(): void {
7070
this.authSrv.oauth.xhr(
7171
{

public_src/components/editor/editor.component.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class EditorComponent {
2020
@ViewChild('editModal') public editModal: ModalDirective;
2121
private totalEditSteps: number = 0;
2222
private currentEditStep: number = 0;
23-
private editing: boolean = false;
23+
public editing: boolean = false;
2424
private creatingElementOfType: string = '';
2525

2626
constructor(
@@ -55,27 +55,27 @@ export class EditorComponent {
5555
console.log('LOG (editor) Current edits are: ', this.storageSrv.edits);
5656
}
5757

58-
private isAuthenticated(): void {
58+
public isAuthenticated(): void {
5959
return this.authSrv.oauth.authenticated();
6060
}
6161

6262
/**
63-
* Deletes current edits create in the localStorage.
63+
* Provides access to editing service function.
6464
*/
65-
private deleteEdits(): void {
66-
localStorage.removeItem('edits');
67-
alert(this.storageSrv.edits);
68-
alert('LOG: LocalStorage changed to ' + localStorage.getItem('edits'));
65+
public continueEditing(): void {
66+
this.storageSrv.edits = this.storageSrv.getLocalStorageItem('edits');
6967
this.editModal.hide();
68+
this.editSrv.continueEditing();
7069
}
7170

7271
/**
73-
* Provides access to editing service function.
72+
* Deletes current edits create in the localStorage.
7473
*/
75-
private continueEditing(): void {
76-
this.storageSrv.edits = this.storageSrv.getLocalStorageItem('edits');
74+
public deleteEdits(): void {
75+
localStorage.removeItem('edits');
76+
alert(this.storageSrv.edits);
77+
alert('LOG: LocalStorage changed to ' + localStorage.getItem('edits'));
7778
this.editModal.hide();
78-
this.editSrv.continueEditing();
7979
}
8080

8181
private showEditModal(): void {

public_src/components/lang/lang.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { TranslateService } from '@ngx-translate/core';
1111
})
1212
export class LangComponent {
1313
constructor(
14-
private translate: TranslateService,
14+
public translate: TranslateService,
1515
) {
1616
translate.setDefaultLang('en');
1717
this.switchLanguage(translate.defaultLang);

public_src/components/sidebar/relation-browser.component.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ import { IPtRouteMasterNew } from '../../core/ptRouteMasterNew.interface';
1818
})
1919
export class RelationBrowserComponent {
2020
private currentElement: IPtRouteMasterNew;
21-
private listOfVariants = this.storageSrv.listOfVariants;
21+
public listOfVariants = this.storageSrv.listOfVariants;
2222
private editingMode: boolean;
23-
private listOfMasters = this.storageSrv.listOfMasters;
23+
public listOfMasters = this.storageSrv.listOfMasters;
2424

2525
constructor(
2626
private editSrv: EditService,
@@ -59,6 +59,21 @@ export class RelationBrowserComponent {
5959
});
6060
}
6161

62+
/**
63+
* NgFor track function which helps to re-render rows faster.
64+
*
65+
* @param index
66+
* @param item
67+
* @returns {number}
68+
*/
69+
public trackByFn(index: number, item: any): number {
70+
return item.id;
71+
}
72+
73+
public hideMasterModal(): void {
74+
this.masterModal.hide();
75+
}
76+
6277
private isDownloaded(relId: number): boolean {
6378
return this.storageSrv.elementsDownloaded.has(relId) || relId < 0; // show created
6479
}
@@ -90,7 +105,6 @@ export class RelationBrowserComponent {
90105
this.editSrv.createMaster();
91106
}
92107
}
93-
94108
private changeRouteMasterMembers(routeMasterId: number): void {
95109
this.editSrv.changeRouteMasterMembers(
96110
this.currentElement.id,
@@ -99,15 +113,12 @@ export class RelationBrowserComponent {
99113
}
100114

101115
@ViewChild('masterModal') public masterModal: ModalDirective;
116+
102117
public showMasterModal(): void {
103118
this.masterModal.show();
104119
// this.mapSrv.disableMouseEvent("modalDownload");
105120
}
106121

107-
private hideMasterModal(): void {
108-
this.masterModal.hide();
109-
}
110-
111122
private isAlreadyAdded(relId: number): boolean {
112123
if (!this.currentElement) {
113124
return;
@@ -126,15 +137,4 @@ export class RelationBrowserComponent {
126137
private isSelected(relId: number): boolean {
127138
return this.processSrv.haveSameIds(relId, this.currentElement.id);
128139
}
129-
130-
/**
131-
* NgFor track function which helps to re-render rows faster.
132-
*
133-
* @param index
134-
* @param item
135-
* @returns {number}
136-
*/
137-
private trackByFn(index: number, item: any): number {
138-
return item.id;
139-
}
140140
}

public_src/components/sidebar/route-browser.component.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ import { StorageService } from '../../services/storage.service';
1616
templateUrl: './route-browser.component.html',
1717
})
1818
export class RouteBrowserComponent {
19-
private currentElement;
19+
public currentElement;
2020
private listOfMasters: object[] = this.storageSrv.listOfMasters;
21-
private listOfRelations: object[] = this.storageSrv.listOfRelations;
22-
private listOfRelationsForStop: object[] = this.storageSrv.listOfRelationsForStop;
21+
public listOfRelations: object[] = this.storageSrv.listOfRelations;
22+
public listOfRelationsForStop: object[] = this.storageSrv.listOfRelationsForStop;
2323

2424
private isRequesting: boolean;
25-
private filteredView: boolean;
25+
public filteredView: boolean;
2626
private idsHaveMaster = new Set();
27-
private editingMode: boolean;
27+
public editingMode: boolean;
2828
private membersEditing: boolean = false;
2929

3030
constructor(

public_src/components/sidebar/stop-browser.component.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ import { IPtStop } from '../../core/ptStop.interface';
2020
})
2121
export class StopBrowserComponent {
2222
public listOfStopsForRoute: object[] = this.storageSrv.listOfStopsForRoute;
23-
private currentElement: any;
24-
private listOfStops: object[] = this.storageSrv.listOfStops;
25-
private filteredView: boolean;
26-
private editingMode: boolean;
23+
public currentElement: any;
24+
public listOfStops: object[] = this.storageSrv.listOfStops;
25+
public filteredView: boolean;
26+
public editingMode: boolean;
2727

2828
constructor(
2929
private dragulaSrv: DragulaService,
@@ -68,6 +68,14 @@ export class StopBrowserComponent {
6868
);
6969
}
7070

71+
public reorderingEnabled(): boolean {
72+
if (this.currentElement) {
73+
return this.currentElement.type === 'relation' && this.filteredView;
74+
} else {
75+
return false;
76+
}
77+
}
78+
7179
private isDownloaded(nodeId: number): boolean {
7280
return this.storageSrv.elementsDownloaded.has(nodeId);
7381
}
@@ -105,14 +113,6 @@ export class StopBrowserComponent {
105113
this.processSrv.exploreStop(stop, true, true, true);
106114
}
107115

108-
private reorderingEnabled(): boolean {
109-
if (this.currentElement) {
110-
return this.currentElement.type === 'relation' && this.filteredView;
111-
} else {
112-
return false;
113-
}
114-
}
115-
116116
private isSelected(relId: number): boolean {
117117
return this.processSrv.haveSameIds(relId, this.currentElement.id);
118118
}

public_src/components/sidebar/tag-browser.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { IOsmEntity } from '../../core/osmEntity.interface';
2424
export class TagBrowserComponent {
2525
@Input() public tagKey: string = '';
2626
@Input() public tagValue: string = '';
27-
private currentElement: IOsmEntity;
27+
public currentElement: IOsmEntity;
2828
private editingMode: boolean;
2929

3030
private expectedKeys = [

public_src/components/toolbar/toolbar.component.ts

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ export class ToolbarComponent {
2626
@ViewChild(TransporterComponent)
2727
public transporterComponent: TransporterComponent;
2828
@ViewChild(EditorComponent) public editorComponent: EditorComponent;
29-
private filtering: boolean;
29+
public filtering: boolean;
3030

31-
private currentElement: IOsmEntity;
32-
private stats = { s: 0, r: 0, a: 0, m: 0 };
31+
public currentElement: IOsmEntity;
32+
public stats = { s: 0, r: 0, a: 0, m: 0 };
3333

3434
constructor(
3535
private confSrv: ConfService,
@@ -70,6 +70,37 @@ export class ToolbarComponent {
7070
});
7171
}
7272

73+
public highlightIsActive(): boolean {
74+
return this.mapSrv.highlightIsActive();
75+
}
76+
77+
public isRelation(): boolean {
78+
return this.currentElement && this.currentElement.type === 'relation';
79+
}
80+
81+
public toggleDownloading(): void {
82+
this.downloading = !this.downloading;
83+
if (this.downloading) {
84+
this.mapSrv.map.on('zoomend moveend', () => {
85+
this.initDownloader();
86+
});
87+
} else if (!this.downloading) {
88+
this.mapSrv.map.off('zoomend moveend');
89+
}
90+
}
91+
92+
public showOptions(): void {
93+
document.getElementById('toggle-filter').style.display = 'inline';
94+
setTimeout(() => {
95+
document.getElementById('toggle-filter').style.display = 'none';
96+
}, 5000);
97+
}
98+
99+
public toggleLinesFilter(): void {
100+
this.confSrv.cfgFilterLines = !this.confSrv.cfgFilterLines;
101+
this.filtering = !this.filtering;
102+
}
103+
73104
private changeHighlight(): void {
74105
if (
75106
this.highlightIsActive() &&
@@ -106,17 +137,6 @@ export class ToolbarComponent {
106137
return this.checkMinZoomLevel() && this.checkMinDistance();
107138
}
108139

109-
private toggleDownloading(): void {
110-
this.downloading = !this.downloading;
111-
if (this.downloading) {
112-
this.mapSrv.map.on('zoomend moveend', () => {
113-
this.initDownloader();
114-
});
115-
} else if (!this.downloading) {
116-
this.mapSrv.map.off('zoomend moveend');
117-
}
118-
}
119-
120140
/**
121141
*
122142
* @param selection
@@ -131,30 +151,10 @@ export class ToolbarComponent {
131151
this.processSrv.cancelSelection();
132152
}
133153

134-
private isRelation(): boolean {
135-
return this.currentElement && this.currentElement.type === 'relation';
136-
}
137-
138154
private zoomTo(selection: IOsmEntity): void {
139155
this.processSrv.zoomToElement(selection);
140156
}
141157

142-
private showOptions(): void {
143-
document.getElementById('toggle-filter').style.display = 'inline';
144-
setTimeout(() => {
145-
document.getElementById('toggle-filter').style.display = 'none';
146-
}, 5000);
147-
}
148-
149-
private toggleLinesFilter(): void {
150-
this.confSrv.cfgFilterLines = !this.confSrv.cfgFilterLines;
151-
this.filtering = !this.filtering;
152-
}
153-
154-
private highlightIsActive(): boolean {
155-
return this.mapSrv.highlightIsActive();
156-
}
157-
158158
private clearHighlight(): void {
159159
return this.mapSrv.clearHighlight();
160160
}

public_src/components/transporter/transporter.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<button id="download-data" class="btn btn-default on-map hidden" container="body"
22
tooltip="{{ 'Download data from Overpass API' | translate }}"
3-
[class.btn-primary]="downloading"
3+
[class.btn-primary]="downloading()"
44
(click)="showDownloadModal()">
55
<i class="fa fa-download" aria-hidden="true"></i>
66
</button>
77

88
<button *ngIf="isAuthenticated() && hasEdits()" id="upload-data" class="btn btn-default on-map" container="body"
99
tooltip="{{ 'Save changes to OpenStreetMap' | translate }}"
10-
[class.btn-primary]="downloading"
10+
[class.btn-primary]="downloading()"
1111
(click)="showUploadModal()">
1212
<i class="fa fa-upload" aria-hidden="true"></i>
1313
&nbsp;{{ 'Save' | translate }}

0 commit comments

Comments
 (0)