Skip to content

Commit

Permalink
Merge pull request #5 from cameronpettit/sonarcloud1
Browse files Browse the repository at this point in the history
sonarcloud fix 1
  • Loading branch information
cameronpettit authored Sep 16, 2023
2 parents 2272c6a + 2e293a5 commit 52380ac
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 43 deletions.
18 changes: 10 additions & 8 deletions src/app/forms/multiselects/multiselects.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,15 @@ export class MultiselectsComponent implements OnInit, AfterViewInit {

ngAfterViewInit(): void {
let list = [];
for (const item of this.entries?.['_results']) {
// get title
let titleIndex = item?.nativeElement?.querySelector('h3');
list.push({
href: item?.nativeElement?.id,
title: titleIndex.innerText
})
if (this.entries['_results']) {
for (const item of this.entries['_results']) {
// get title
let titleIndex = item?.nativeElement?.querySelector('h3');
list.push({
href: item?.nativeElement?.id,
title: titleIndex.innerText
})
}
}
this.sidebarService.updateList(list);
}
Expand All @@ -122,7 +124,7 @@ export class MultiselectsComponent implements OnInit, AfterViewInit {
const value = control?.value;
console.log('value:', value);
if (value?.length > 3) {
return {customValidator: "You can pick a max of 3 items."};
return { customValidator: "You can pick a max of 3 items." };
}
return null
}
Expand Down
20 changes: 11 additions & 9 deletions src/app/forms/picklists/picklists.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,16 @@ export class PicklistsComponent implements OnInit, AfterViewInit {

ngAfterViewInit(): void {
let list = [];
for (const item of this.entries?.['_results']) {
console.log('item:', item);
// get title
let titleIndex = item?.nativeElement?.querySelector('h3');
list.push({
href: item?.nativeElement?.id,
title: titleIndex.innerText
})
if (this.entries['_results']) {
for (const item of this.entries['_results']) {
console.log('item:', item);
// get title
let titleIndex = item?.nativeElement?.querySelector('h3');
list.push({
href: item?.nativeElement?.id,
title: titleIndex.innerText
})
}
}
this.sidebarService.updateList(list);
}
Expand All @@ -98,7 +100,7 @@ export class PicklistsComponent implements OnInit, AfterViewInit {
this.currentChangeSelectList = nextSelectList;
}, 5000);
}

disableProgrammatically(control) {
if (this.form.controls[control].enabled) {
this.form.controls[control].disable();
Expand Down
24 changes: 13 additions & 11 deletions src/app/forms/text-input/text-input.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class TextInputComponent implements OnInit, AfterViewInit {
resetInput: new UntypedFormControl(null),
disabledInput: new UntypedFormControl(null),
initialDefault: new UntypedFormControl(
'My default value', {nonNullable: true}
'My default value', { nonNullable: true }
),
loadingInput: new UntypedFormControl(null),
requiredInput: new UntypedFormControl(null, Validators.required),
Expand All @@ -38,13 +38,15 @@ export class TextInputComponent implements OnInit, AfterViewInit {

ngAfterViewInit(): void {
let list = [];
for (const item of this.entries?.['_results']) {
// get title
let titleIndex = item?.nativeElement?.querySelector('h3');
list.push({
href: item?.nativeElement?.id,
title: titleIndex.innerText
})
if (this.entries['_results']) {
for (const item of this.entries['_results']) {
// get title
let titleIndex = item?.nativeElement?.querySelector('h3');
list.push({
href: item?.nativeElement?.id,
title: titleIndex.innerText
})
}
}
this.sidebarService.updateList(list);
}
Expand All @@ -66,13 +68,13 @@ export class TextInputComponent implements OnInit, AfterViewInit {
return null;
}
}


disabledSwitch(){

disabledSwitch() {
this.isDisabled = !this.isDisabled;
}

loadingSwitch(){
loadingSwitch() {
this.isLoading = !this.isLoading;
}

Expand Down
8 changes: 1 addition & 7 deletions src/app/forms/typeaheads/typeaheads.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<section #section id="basicTypeahead" class="mb-5 mt-3">
<h3>Basic Typeahead</h3>
<p>
Provide the list of selection options as an array in <code>[selectionListItems]</code>, same as the picklist input. NGDS Forms Typeahead extends the functionality of the typeahead provided in <a href="https://valor-software.com/ngx-bootstrap/#/components/typeahead" target="_blank">ngx-bootstrap</a>.
Provide the list of selection options as an array in <code>[selectionListItems]</code>, same as the picklist input. NGDS Forms Typeahead extends the functionality of the typeahead provided in <a href="https://valor-software.com/ngx-bootstrap/#/components/typeahead" target="_blank" rel="noopener">ngx-bootstrap</a>.
</p>
<p>
In the example below, search for a Canadian province or territory.
Expand All @@ -17,12 +17,6 @@ <h3>Basic Typeahead</h3>

<section #section id="programmaticTypeahead" class="mb-5 mt-3">
<h3>Set typeahead value programmatically</h3>
<p>
Provide the list of selection options as an array in <code>[selectionListItems]</code>, same as the picklist input. NGDS Forms Typeahead extends the functionality of the typeahead provided in <a href="https://valor-software.com/ngx-bootstrap/#/components/typeahead" target="_blank">ngx-bootstrap</a>.
</p>
<p>
In the example below, search for a Canadian province or territory.
</p>
<demonstrator [htmlFile]="snippets?.programmaticTypeahead?.html" [tsFile]="snippets?.programmaticTypeahead?.ts"
[control]="form?.controls?.['programmaticTypeahead']">
<button class="btn btn-primary mb-2" (click)="programmaticSet()">Set value</button>
Expand Down
18 changes: 10 additions & 8 deletions src/app/forms/typeaheads/typeaheads.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export class TypeaheadsComponent implements OnInit {
this.fields.displayTypeahead.setValue(value)
}

programmaticSet(){
programmaticSet() {
this.fields.programmaticTypeahead.setValue('0006');
}

Expand Down Expand Up @@ -161,13 +161,15 @@ export class TypeaheadsComponent implements OnInit {

ngAfterViewInit(): void {
let list = [];
for (const item of this.entries?.['_results']) {
// get title
let titleIndex = item?.nativeElement?.querySelector('h3');
list.push({
href: item?.nativeElement?.id,
title: titleIndex.innerText
})
if (this.entries['_results']) {
for (const item of this.entries['_results']) {
// get title
let titleIndex = item?.nativeElement?.querySelector('h3');
list.push({
href: item?.nativeElement?.id,
title: titleIndex.innerText
})
}
}
this.sidebarService.updateList(list);
}
Expand Down

0 comments on commit 52380ac

Please sign in to comment.