From 6414c00a63436fa9e66e5f5d2198e172192fb95f Mon Sep 17 00:00:00 2001 From: valerio como Date: Tue, 30 Jul 2024 14:30:28 +0000 Subject: [PATCH] fix: new component interface --- .../form/transfer/transfer.component.ts | 16 ++++++++-------- .../transfer-default-example.component.html | 2 +- .../transfer-default-example.component.ts | 4 ++-- ...transfer-reactive-form-example.component.html | 2 +- .../transfer-reactive-form-example.component.ts | 6 +++--- ...transfer-template-form-example.component.html | 2 +- .../transfer-template-form-example.component.ts | 6 +++--- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/projects/design-angular-kit/src/lib/components/form/transfer/transfer.component.ts b/projects/design-angular-kit/src/lib/components/form/transfer/transfer.component.ts index d3f74373..08c9801b 100644 --- a/projects/design-angular-kit/src/lib/components/form/transfer/transfer.component.ts +++ b/projects/design-angular-kit/src/lib/components/form/transfer/transfer.component.ts @@ -23,13 +23,13 @@ import { TransferItem } from './transfer.model'; }) export class ItTransferComponent extends ItAbstractFormComponent implements OnInit { /** - * The source options (left side) + * The select options (left side) */ - @Input() source = []; + @Input() options = []; /** - * The target options (right side) + * The selected options (right side) */ - @Input() target = []; + @Input() selected = []; /** * Fired when there is a transfer, a backtransfer or a reset event */ @@ -136,12 +136,12 @@ export class ItTransferComponent extends ItAbstractFormComponent imp } console.debug('ngControl is defined. Input() target will be ignored'); - } else if (this.target && Array.isArray(this.target)) { - target = [...this.target]; + } else if (this.selected && Array.isArray(this.selected)) { + target = [...this.selected]; } - console.debug('target:', this.target, 'formControl:', this.control.value, 'ngModel:', this._ngControl); - this.store.init({ source: [...this.source], target }); + console.debug('target:', this.selected, 'formControl:', this.control.value, 'ngModel:', this._ngControl); + this.store.init({ source: [...this.options], target }); } private onStoreValueChanged() { diff --git a/src/app/transfer/transfer-default-example/transfer-default-example.component.html b/src/app/transfer/transfer-default-example/transfer-default-example.component.html index 7e767a78..2fa06b68 100644 --- a/src/app/transfer/transfer-default-example/transfer-default-example.component.html +++ b/src/app/transfer/transfer-default-example/transfer-default-example.component.html @@ -3,7 +3,7 @@

Esempio senza form

Esempio di default
- +
diff --git a/src/app/transfer/transfer-default-example/transfer-default-example.component.ts b/src/app/transfer/transfer-default-example/transfer-default-example.component.ts index ad611b15..33c9cd35 100644 --- a/src/app/transfer/transfer-default-example/transfer-default-example.component.ts +++ b/src/app/transfer/transfer-default-example/transfer-default-example.component.ts @@ -6,7 +6,7 @@ import { TransferItem } from 'projects/design-angular-kit/src/public_api'; templateUrl: './transfer-default-example.component.html', }) export class TransferDefaultExampleComponent { - readonly sourceItems: TransferItem[] = [ + readonly options: TransferItem[] = [ { text: 'Item 1', value: 1, @@ -16,7 +16,7 @@ export class TransferDefaultExampleComponent { value: 2, }, ]; - readonly targetItems: TransferItem[] = [ + readonly selected: TransferItem[] = [ { text: 'Item 3', value: 3, diff --git a/src/app/transfer/transfer-reactive-form-example/transfer-reactive-form-example.component.html b/src/app/transfer/transfer-reactive-form-example/transfer-reactive-form-example.component.html index 4e58fb42..68e80434 100644 --- a/src/app/transfer/transfer-reactive-form-example/transfer-reactive-form-example.component.html +++ b/src/app/transfer/transfer-reactive-form-example/transfer-reactive-form-example.component.html @@ -4,7 +4,7 @@

Esempio con Reactive Form

FormGroup
- +
diff --git a/src/app/transfer/transfer-reactive-form-example/transfer-reactive-form-example.component.ts b/src/app/transfer/transfer-reactive-form-example/transfer-reactive-form-example.component.ts index a3a6dc8d..c3c4b008 100644 --- a/src/app/transfer/transfer-reactive-form-example/transfer-reactive-form-example.component.ts +++ b/src/app/transfer/transfer-reactive-form-example/transfer-reactive-form-example.component.ts @@ -7,7 +7,7 @@ import { TransferItem } from 'projects/design-angular-kit/src/public_api'; templateUrl: './transfer-reactive-form-example.component.html', }) export class TransferReactiveFormExampleComponent { - readonly sourceItems: TransferItem[] = [ + readonly options: TransferItem[] = [ { text: 'Item 1', value: 1, @@ -17,7 +17,7 @@ export class TransferReactiveFormExampleComponent { value: 2, }, ]; - readonly targetItems: TransferItem[] = [ + readonly selected: TransferItem[] = [ { text: 'Item 3', value: 3, @@ -25,6 +25,6 @@ export class TransferReactiveFormExampleComponent { ]; readonly formGroup = inject(FormBuilder).group({ - transfer: [this.targetItems], + transfer: [this.selected], }); } diff --git a/src/app/transfer/transfer-template-form-example/transfer-template-form-example.component.html b/src/app/transfer/transfer-template-form-example/transfer-template-form-example.component.html index 7b3fe43c..7311b2d2 100644 --- a/src/app/transfer/transfer-template-form-example/transfer-template-form-example.component.html +++ b/src/app/transfer/transfer-template-form-example/transfer-template-form-example.component.html @@ -3,7 +3,7 @@

Esempio con Template Form

NgModel
- +
diff --git a/src/app/transfer/transfer-template-form-example/transfer-template-form-example.component.ts b/src/app/transfer/transfer-template-form-example/transfer-template-form-example.component.ts index dd4d2c18..b18b4e35 100644 --- a/src/app/transfer/transfer-template-form-example/transfer-template-form-example.component.ts +++ b/src/app/transfer/transfer-template-form-example/transfer-template-form-example.component.ts @@ -6,7 +6,7 @@ import { TransferItem } from 'projects/design-angular-kit/src/public_api'; templateUrl: './transfer-template-form-example.component.html', }) export class TransferTemplateFormExampleComponent { - readonly sourceItems: TransferItem[] = [ + readonly options: TransferItem[] = [ { text: 'Item 1', value: 1, @@ -16,12 +16,12 @@ export class TransferTemplateFormExampleComponent { value: 2, }, ]; - readonly targetItems: TransferItem[] = [ + readonly selected: TransferItem[] = [ { text: 'Item 3', value: 3, }, ]; - transferModel = this.targetItems; + transferModel = this.selected; }