enable string templates, fix resulting issues.

This commit is contained in:
Jason Wall 2024-03-08 12:09:38 -05:00
parent 94bc54d06b
commit 1799c14fdb
11 changed files with 22 additions and 10 deletions

View File

@ -10,7 +10,7 @@
<mat-list-option <mat-list-option
*ngFor="let page of this.pages$ | async" *ngFor="let page of this.pages$ | async"
[value]="page" [value]="page"
[checkBoxPosition]="before" [checkboxPosition]="'before'"
> >
{{ page.title }} {{ page.title }}
</mat-list-option> </mat-list-option>

View File

@ -15,7 +15,6 @@
<mat-chip-grid #chipList aria-label="Cross References"> <mat-chip-grid #chipList aria-label="Cross References">
<mat-chip-row <mat-chip-row
*ngFor="let ref of references" *ngFor="let ref of references"
[selectable]="selectable"
[removable]="removable" [removable]="removable"
(removed)="remove(ref)" (removed)="remove(ref)"
> >

View File

@ -23,7 +23,6 @@ export class NoteEditModalComponent {
//#region Cross References //#region Cross References
visible = true; visible = true;
selectable = true;
removable = true; removable = true;
addOnBlur = true; addOnBlur = true;
readonly separatorKeysCodes: number[] = [ENTER, COMMA, SEMICOLON]; readonly separatorKeysCodes: number[] = [ENTER, COMMA, SEMICOLON];

View File

@ -82,12 +82,12 @@ export class SavedPageCardComponent extends SubscriberBase {
return ''; return '';
} }
onRemoveCard(card: CardItem) { onRemoveCard(reference: DataReference) {
this.dialog this.dialog
.open(OkCancelModalComponent, { .open(OkCancelModalComponent, {
data: { data: {
title: 'Delete Card from Saved Page', title: 'Delete Card from Saved Page',
content: `Do you want to delete this card '${this.format(card)}' from the saved page '${ content: `Do you want to delete this card '${this.format(reference)}' from the saved page '${
this.savedPage.title this.savedPage.title
}?`, }?`,
}, },
@ -97,7 +97,7 @@ export class SavedPageCardComponent extends SubscriberBase {
if (ds.ok) { if (ds.ok) {
this.appService.updateSavedPage({ this.appService.updateSavedPage({
...this.savedPage, ...this.savedPage,
queries: this.savedPage.queries.filter((o) => o !== card), queries: this.savedPage.queries.filter((o) => o !== reference),
}); });
this.snackBar.open(`${this.savedPage.title} has been updated!`, '', { this.snackBar.open(`${this.savedPage.title} has been updated!`, '', {
duration: 3 * 1000, duration: 3 * 1000,

View File

@ -14,7 +14,7 @@
</div> </div>
<div class="card-content" *ngIf="cardItem" #strongs> <div class="card-content" *ngIf="cardItem" #strongs>
<app-strongs <app-strongs
[data]="cardItem.data" [data]="strongsResult"
[isCard]="true" [isCard]="true"
(openPassage)="openPassage($event)" (openPassage)="openPassage($event)"
(openStrongs)="openStrongs($event)" (openStrongs)="openStrongs($event)"

View File

@ -4,6 +4,7 @@ import { StrongsModalComponent } from '../modal/strongs-modal.component';
import { CardComponent } from 'src/app/components/card.component'; import { CardComponent } from 'src/app/components/card.component';
import { AppService } from 'src/app/services/app.service'; import { AppService } from 'src/app/services/app.service';
import { BibleReference } from 'src/app/common/bible-reference'; import { BibleReference } from 'src/app/common/bible-reference';
import { StrongsResult } from 'src/app/models/strongs-state';
@Component({ @Component({
selector: 'app-strongs-card', selector: 'app-strongs-card',
@ -16,6 +17,10 @@ export class StrongsCardComponent extends CardComponent {
asModal = false; asModal = false;
@ViewChild('strongs') strongsElement: ElementRef; @ViewChild('strongs') strongsElement: ElementRef;
get strongsResult(){
return this.cardItem.data as StrongsResult;
}
constructor(protected elementRef: ElementRef, protected appService: AppService, protected dialog: MatDialog) { constructor(protected elementRef: ElementRef, protected appService: AppService, protected dialog: MatDialog) {
super(elementRef, dialog, appService); super(elementRef, dialog, appService);
this.icon$ = appService.select((state) => state.settings.value.cardIcons.strongs); this.icon$ = appService.select((state) => state.settings.value.cardIcons.strongs);

View File

@ -16,7 +16,7 @@
<mat-dialog-content class="content"> <mat-dialog-content class="content">
<br /> <br />
<app-strongs <app-strongs
[data]="cardItem.data" [data]="strongsResult"
(openPassage)="openPassage($event)" (openPassage)="openPassage($event)"
></app-strongs> ></app-strongs>
</mat-dialog-content> </mat-dialog-content>

View File

@ -4,6 +4,7 @@ import { Observable } from 'rxjs';
import { AppService } from 'src/app/services/app.service'; import { AppService } from 'src/app/services/app.service';
import { BibleReference } from 'src/app/common/bible-reference'; import { BibleReference } from 'src/app/common/bible-reference';
import { CardItem } from 'src/app/models/card-state'; import { CardItem } from 'src/app/models/card-state';
import { StrongsResult } from 'src/app/models/strongs-state';
@Component({ @Component({
selector: 'app-strongs-modal', selector: 'app-strongs-modal',
@ -14,6 +15,7 @@ import { CardItem } from 'src/app/models/card-state';
}) })
export class StrongsModalComponent { export class StrongsModalComponent {
icon$: Observable<string>; icon$: Observable<string>;
strongsResult: StrongsResult;
constructor( constructor(
@Inject(MAT_DIALOG_DATA) public cardItem: CardItem, @Inject(MAT_DIALOG_DATA) public cardItem: CardItem,
@ -21,7 +23,7 @@ export class StrongsModalComponent {
private appService: AppService private appService: AppService
) { ) {
console.log(cardItem); console.log(cardItem);
this.strongsResult = cardItem.data as StrongsResult;
this.icon$ = appService.select((state) => state.settings.value.cardIcons.strongs); this.icon$ = appService.select((state) => state.settings.value.cardIcons.strongs);
} }

View File

@ -16,7 +16,7 @@
#autoCompleteInput #autoCompleteInput
[formControl]="searchControl" [formControl]="searchControl"
[matAutocomplete]="auto" [matAutocomplete]="auto"
(keyup.enter)="search($event.target.value)" (keyup.enter)="searchWithTarget($event.target)"
/> />
<mat-autocomplete #auto="matAutocomplete"> <mat-autocomplete #auto="matAutocomplete">
<mat-option *ngFor="let option of suggestions$ | async" [value]="option"> <mat-option *ngFor="let option of suggestions$ | async" [value]="option">

View File

@ -109,6 +109,10 @@ export class SearchPageComponent extends SubscriberBase implements OnInit {
this.appService.removeCard(card); this.appService.removeCard(card);
} }
async searchWithTarget(target: EventTarget) {
const term = (target as HTMLInputElement).value;
await this.search(term);
}
async search(search: string) { async search(search: string) {
// clear search box. // clear search box.
if (this.clearSearchAfterQuery) { if (this.clearSearchAfterQuery) {

View File

@ -14,5 +14,8 @@
"target": "es2022", "target": "es2022",
"module": "ESNext", "module": "ESNext",
"lib": ["es2018", "dom"] "lib": ["es2018", "dom"]
},
"angularCompilerOptions": {
"strictTemplates": true,
} }
} }