From 3581729d4d1ae483d27bec767de3433b7d91939d Mon Sep 17 00:00:00 2001 From: Alex Inkin Date: Fri, 20 Sep 2024 18:55:58 +0400 Subject: [PATCH 1/3] fix(demo): correct templateRef option in icon dropdown for inputCardGroup api (#9054) --- .../demo/src/modules/components/input-card-group/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/demo/src/modules/components/input-card-group/index.ts b/projects/demo/src/modules/components/input-card-group/index.ts index 0bdf6683cf5c..d69eb016e025 100644 --- a/projects/demo/src/modules/components/input-card-group/index.ts +++ b/projects/demo/src/modules/components/input-card-group/index.ts @@ -34,11 +34,12 @@ export default class PageComponent extends AbstractExampleTuiInteractive { 'Custom labels', ]; - protected readonly cards: Record = { + protected readonly cards: Record = { common: 'https://ng-web-apis.github.io/dist/assets/images/common.svg', universal: 'https://ng-web-apis.github.io/dist/assets/images/universal.svg', mutation: 'https://ng-web-apis.github.io/dist/assets/images/mutation-observer.svg', + TemplateRef: '', }; protected iconVariants: readonly string[] = Object.keys(this.cards); @@ -80,6 +81,8 @@ export default class PageComponent extends AbstractExampleTuiInteractive { protected getContentVariants( template: PolymorpheusContent, ): readonly PolymorpheusContent[] | null { - return [...this.iconVariants, template]; + this.cards['TemplateRef'] = template; + + return [...this.iconVariants]; } } From a56e8a53ec0f3110ee40585a3afb3b879a7ace28 Mon Sep 17 00:00:00 2001 From: shiv9604 Date: Wed, 25 Sep 2024 23:42:55 +0530 Subject: [PATCH 2/3] fix(demo): resolve pr comments (#9054) --- .../demo/src/modules/components/input-card-group/index.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/projects/demo/src/modules/components/input-card-group/index.ts b/projects/demo/src/modules/components/input-card-group/index.ts index d69eb016e025..659c6d67d791 100644 --- a/projects/demo/src/modules/components/input-card-group/index.ts +++ b/projects/demo/src/modules/components/input-card-group/index.ts @@ -1,4 +1,4 @@ -import {Component} from '@angular/core'; +import {Component, TemplateRef} from '@angular/core'; import {FormControl, ReactiveFormsModule} from '@angular/forms'; import {changeDetection} from '@demo/emulate/change-detection'; import {TuiDemo} from '@demo/utils'; @@ -39,7 +39,6 @@ export default class PageComponent extends AbstractExampleTuiInteractive { universal: 'https://ng-web-apis.github.io/dist/assets/images/universal.svg', mutation: 'https://ng-web-apis.github.io/dist/assets/images/mutation-observer.svg', - TemplateRef: '', }; protected iconVariants: readonly string[] = Object.keys(this.cards); @@ -81,7 +80,10 @@ export default class PageComponent extends AbstractExampleTuiInteractive { protected getContentVariants( template: PolymorpheusContent, ): readonly PolymorpheusContent[] | null { - this.cards['TemplateRef'] = template; + if (template instanceof TemplateRef) { + this.cards['TemplateRef'] = template; + this.iconVariants = Object.keys(this.cards); + } return [...this.iconVariants]; } From 9fdd72f8ba1f6fc3eb20296e27761a4cd14a16f9 Mon Sep 17 00:00:00 2001 From: shiv9604 Date: Thu, 3 Oct 2024 21:37:19 +0530 Subject: [PATCH 3/3] fix(demo): resolve pr comments (#9054) --- .../components/documentation/pipes/inspect.pipe.ts | 4 ++-- .../src/modules/components/input-card-group/index.ts | 9 ++------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/projects/addon-doc/components/documentation/pipes/inspect.pipe.ts b/projects/addon-doc/components/documentation/pipes/inspect.pipe.ts index ec7bf48f92ef..dc002324bdc9 100644 --- a/projects/addon-doc/components/documentation/pipes/inspect.pipe.ts +++ b/projects/addon-doc/components/documentation/pipes/inspect.pipe.ts @@ -1,5 +1,5 @@ import type {PipeTransform} from '@angular/core'; -import {inject, Pipe} from '@angular/core'; +import {inject, Pipe, TemplateRef} from '@angular/core'; import {tuiInspectAny} from '@taiga-ui/addon-doc/utils'; import {TUI_IS_E2E} from '@taiga-ui/cdk/tokens'; @@ -22,6 +22,6 @@ export class TuiInspectPipe implements PipeTransform { return 'λ(x) => y'; } - return tuiInspectAny(value, depth); + return value instanceof TemplateRef ? 'TemplateRef' : tuiInspectAny(value, depth); } } diff --git a/projects/demo/src/modules/components/input-card-group/index.ts b/projects/demo/src/modules/components/input-card-group/index.ts index 659c6d67d791..e29e4e6ae0f6 100644 --- a/projects/demo/src/modules/components/input-card-group/index.ts +++ b/projects/demo/src/modules/components/input-card-group/index.ts @@ -1,4 +1,4 @@ -import {Component, TemplateRef} from '@angular/core'; +import {Component} from '@angular/core'; import {FormControl, ReactiveFormsModule} from '@angular/forms'; import {changeDetection} from '@demo/emulate/change-detection'; import {TuiDemo} from '@demo/utils'; @@ -80,11 +80,6 @@ export default class PageComponent extends AbstractExampleTuiInteractive { protected getContentVariants( template: PolymorpheusContent, ): readonly PolymorpheusContent[] | null { - if (template instanceof TemplateRef) { - this.cards['TemplateRef'] = template; - this.iconVariants = Object.keys(this.cards); - } - - return [...this.iconVariants]; + return [...this.iconVariants, template]; } }