Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Bootstrap Italia and bug fix #272

Merged
merged 4 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5,727 changes: 3,409 additions & 2,318 deletions package-lock.json

Large diffs are not rendered by default.

60 changes: 30 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,60 +52,60 @@
"postversion": "echo \"You can now publish your version using 'git push --follow-tags'\""
},
"dependencies": {
"@angular-devkit/schematics": "^16.1.4",
"@angular/animations": "^16.1.3",
"@angular/common": "^16.1.3",
"@angular/compiler": "^16.1.3",
"@angular/core": "^16.1.3",
"@angular/forms": "^16.1.3",
"@angular/localize": "^16.1.3",
"@angular/platform-browser": "^16.1.3",
"@angular/platform-browser-dynamic": "^16.1.3",
"@angular/router": "^16.1.3",
"@angular-devkit/schematics": "^16.2.4",
"@angular/animations": "^16.2.7",
"@angular/common": "^16.2.7",
"@angular/compiler": "^16.2.7",
"@angular/core": "^16.2.7",
"@angular/forms": "^16.2.7",
"@angular/localize": "^16.2.7",
"@angular/platform-browser": "^16.2.7",
"@angular/platform-browser-dynamic": "^16.2.7",
"@angular/router": "^16.2.7",
"@ngx-translate/core": "^15.0.0",
"@ngx-translate/http-loader": "^8.0.0",
"bootstrap-italia": "^2.6.0",
"bootstrap-italia": "^2.7.0",
"core-js": "^3.31.1",
"fp-ts": "^2.16.0",
"fp-ts": "^2.16.1",
"io-ts": "^2.2.20",
"ngx-highlightjs": "^10.0.0",
"rxjs": "^7.8.1",
"tslib": "^2.6.0",
"tslib": "^2.6.2",
"zone.js": "~0.13.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "^16.1.4",
"@angular-eslint/builder": "16.0.3",
"@angular-eslint/eslint-plugin": "16.0.3",
"@angular-eslint/eslint-plugin-template": "16.0.3",
"@angular-eslint/schematics": "16.0.3",
"@angular-eslint/template-parser": "16.0.3",
"@angular/cli": "^16.1.4",
"@angular/compiler-cli": "^16.1.3",
"@angular/language-service": "^16.1.3",
"@angular-devkit/build-angular": "^16.2.4",
"@angular-eslint/builder": "16.2.0",
"@angular-eslint/eslint-plugin": "16.2.0",
"@angular-eslint/eslint-plugin-template": "16.2.0",
"@angular-eslint/schematics": "16.2.0",
"@angular-eslint/template-parser": "16.2.0",
"@angular/cli": "^16.2.4",
"@angular/compiler-cli": "^16.2.7",
"@angular/language-service": "^16.2.7",
"@compodoc/compodoc": "^1.1.21",
"@types/bootstrap": "^5.2.6",
"@types/jasmine": "~4.3.5",
"@types/jasminewd2": "~2.0.10",
"@types/node": "^20.4.0",
"@types/bootstrap": "^5.2.7",
"@types/jasmine": "~4.3.6",
"@types/jasminewd2": "~2.0.11",
"@types/node": "^20.8.0",
"@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/parser": "^5.61.0",
"browserslist-config-design-italia": "^1.1.0",
"concurrently": "^8.2.0",
"concurrently": "^8.2.1",
"conventional-changelog": "^4.0.0",
"conventional-changelog-cli": "^3.0.0",
"cz-conventional-changelog": "3.3.0",
"eslint": "^8.44.0",
"gh-pages": "^5.0.0",
"jasmine-core": "~5.0.1",
"jasmine-core": "~5.1.1",
"jasmine-spec-reporter": "~7.0.0",
"karma": "~6.4.2",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "^2.2.1",
"karma-coverage-istanbul-reporter": "~3.0.3",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "^2.1.0",
"ng-packagr": "^16.1.0",
"ng-packagr": "^16.2.3",
"nunjucks-cli": "^1.0.0",
"semantic-release": "^21.0.7",
"ts-node": "~10.9.1",
Expand All @@ -114,4 +114,4 @@
"browserslist": [
"extends browserslist-config-design-italia"
]
}
}
4 changes: 2 additions & 2 deletions projects/design-angular-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
"@angular/platform-browser": "^16.0.0",
"@ngx-translate/core": "^15.0.0",
"@ngx-translate/http-loader": "^8.0.0",
"bootstrap-italia": "^2.6.0"
"bootstrap-italia": "^2.7.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export abstract class ItAbstractFormComponent<T = any> extends ItAbstractCompone
/**
* Internal form control
*/
protected control: FormControl;
protected control: FormControl<T>;

constructor(
protected readonly _translateService: TranslateService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { Modal } from 'bootstrap-italia';
import { BooleanInput, isTrueBooleanInput } from '../../../utils/boolean-input';
import { NgIf } from '@angular/common';
import { TranslateModule } from '@ngx-translate/core';
import { Modal as BSModal } from 'bootstrap'

/**
* Modal windows
Expand Down Expand Up @@ -80,12 +81,35 @@ export class ItModalComponent extends ItAbstractComponent implements AfterViewIn
*/
@Input() size: 'sm' | 'lg' | 'xl' | undefined;

/**
* Includes a modal-backdrop element. Alternatively, specify static for a backdrop which doesn’t close the modal when clicked.
* @default true
*/
@Input() backdrop: 'static' | BooleanInput = true;

/**
* Puts the focus on the modal when initialized.
* @default true
*/
@Input() focus: BooleanInput = true;

/**
* Closes the modal when escape key is pressed.
* @default true
*/
@Input() keyboard: BooleanInput = true;

/**
* To better distinguish the footer element with a shadow
* @default false
*/
@Input() footerShadow: BooleanInput | undefined;

/**
* Modal options
*/
@Input() options?: Partial<BSModal.Options>

/**
* This event fires immediately when the instance method show is called.
*/
Expand Down Expand Up @@ -122,7 +146,12 @@ export class ItModalComponent extends ItAbstractComponent implements AfterViewIn

if (this.modalElement) {
const element = this.modalElement.nativeElement;
this.modal = Modal.getOrCreateInstance(element);
this.modal = Modal.getOrCreateInstance(element, {
...this.options,
backdrop: this.backdrop === 'static' ? 'static' : isTrueBooleanInput(this.backdrop),
focus: isTrueBooleanInput(this.focus),
keyboard: isTrueBooleanInput(this.keyboard)
});

element.addEventListener('show.bs.modal', event => this.showEvent.emit(event));
element.addEventListener('shown.bs.modal', event => this.shownEvent.emit(event));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
* If you need to retrieve items via API, can pass a function of Observable
* @default undefined
*/
@Input() autocompleteData?: Array<AutocompleteItem> | ((search?: string) => Observable<Array<AutocompleteItem>>);
@Input() autocompleteData?: Array<AutocompleteItem> | ((search?: string | number | null) => Observable<Array<AutocompleteItem>>);

/**
* Time span [ms] has passed without another source emission, to delay data filtering.
Expand Down Expand Up @@ -189,7 +189,7 @@

/** Observable da cui vengono emessi i risultati dell'auto completamento */
autocompleteResults$: Observable<{
searchedValue: string,
searchedValue: string | number | null | undefined,
relatedEntries: Array<AutocompleteItem>
}> = new Observable();

Expand Down Expand Up @@ -250,7 +250,7 @@
/**
* Create the autocomplete list
*/
private getAutocompleteResults$(): Observable<{ searchedValue: string, relatedEntries: Array<AutocompleteItem> }> {
private getAutocompleteResults$(): Observable<{ searchedValue: string | number | null | undefined, relatedEntries: Array<AutocompleteItem> }> {
if (this.type !== 'search') {
return of({ searchedValue: '', relatedEntries: [] });
}
Expand All @@ -259,13 +259,13 @@
distinctUntilChanged(), // Only if searchValue is distinct in comparison to the last value
switchMap(searchedValue => {
if (!this.autocompleteData) {
return of({ searchedValue, relatedEntries: [] });
return of({ searchedValue, relatedEntries: <Array<AutocompleteItem>>[] });

Check warning on line 262 in projects/design-angular-kit/src/lib/components/form/input/input.component.ts

View check run for this annotation

Codecov / codecov/patch

projects/design-angular-kit/src/lib/components/form/input/input.component.ts#L262

Added line #L262 was not covered by tests
}

const autoCompleteData$ = Array.isArray(this.autocompleteData) ? of(this.autocompleteData) : this.autocompleteData(searchedValue);
return autoCompleteData$.pipe(
map(autocompleteData => {
if (!searchedValue) {
if (!searchedValue || typeof searchedValue === 'number') {
return { searchedValue, relatedEntries: [] };
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
(blur)="markAsTouched()"
[attr.aria-describedby]="id + '-description'">

<option *ngIf="defaultOption" [value]="null" disabled selected>
<option *ngIf="defaultOption" [ngValue]="null" disabled selected>
{{defaultOption}}
</option>

<ng-content></ng-content>

<ng-container *ngIf="options">
<option *ngFor="let option of options" [disabled]="optionIsDisabled(option)" [value]="option.value">
<option *ngFor="let option of options" [disabled]="optionIsDisabled(option)" [ngValue]="option.value">
{{option.text ?? option.value}}
</option>
</ng-container>

<ng-container *ngIf="groups">
<optgroup *ngFor="let group of groups" [label]="group.label">
<option *ngFor="let option of group.options" [disabled]="optionIsDisabled(option)" [value]="option.value">
<option *ngFor="let option of group.options" [disabled]="optionIsDisabled(option)" [ngValue]="option.value">
{{option.text ?? option.value}}
</option>
</optgroup>
Expand Down
2 changes: 1 addition & 1 deletion projects/design-angular-kit/src/lib/interfaces/core.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IconName } from './icon';

export type AlertColor = 'info' | 'success' | 'warning' | 'danger';
export type AlertColor = 'primary' | 'info' | 'success' | 'warning' | 'danger';

export type ButtonColor =
'primary'
Expand Down
12 changes: 6 additions & 6 deletions projects/design-angular-kit/src/lib/interfaces/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import { IconName } from './icon';

export type InputControlType = 'text' | 'email' | 'number' | 'date' | 'time' | 'tel' | 'color' | 'url' | 'search';

export interface SelectControlOption {
value: any,
export interface SelectControlOption<T = any> {
value: T,
text?: string,
selected?: boolean | ((value: any) => boolean),
disabled?: boolean | ((value: any) => boolean)
selected?: boolean | ((value: T) => boolean),
disabled?: boolean | ((value: T) => boolean)
}

export interface SelectControlGroup {
export interface SelectControlGroup<T = any> {
label: string,
options: Array<SelectControlOption>,
options: Array<SelectControlOption<T>>,
dragdrop?: boolean
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ <h3>Esempi</h3>
<div class="bd-example">
<div class="example-section">

<it-alert color="primary">
Questo è un alert di tipo "<b>primary</b>".
</it-alert>

<it-alert>
Questo è un alert di tipo "<b>info</b>".
</it-alert>
Expand Down
Loading