diff --git a/projects/addon-doc/components/documentation/documentation-property-connector.directive.ts b/projects/addon-doc/components/documentation/documentation-property-connector.directive.ts index 5169f04f6a8f..916f52e6ba47 100644 --- a/projects/addon-doc/components/documentation/documentation-property-connector.directive.ts +++ b/projects/addon-doc/components/documentation/documentation-property-connector.directive.ts @@ -11,8 +11,9 @@ import { } from '@angular/core'; import {ActivatedRoute, Params, UrlSerializer, UrlTree} from '@angular/router'; import {TUI_DOC_URL_STATE_HANDLER} from '@taiga-ui/addon-doc/tokens'; -import {tuiCoerceValue} from '@taiga-ui/addon-doc/utils'; +import {tuiCoerceValue, tuiInspectAny} from '@taiga-ui/addon-doc/utils'; import {tuiIsNumber, TuiStringHandler} from '@taiga-ui/cdk'; +import {TuiAlertService} from '@taiga-ui/core'; import {BehaviorSubject, Subject} from 'rxjs'; const SERIALIZED_SUFFIX = '$'; @@ -66,6 +67,7 @@ export class TuiDocDocumentationPropertyConnectorDirective @Inject(UrlSerializer) private readonly urlSerializer: UrlSerializer, @Inject(TUI_DOC_URL_STATE_HANDLER) private readonly urlStateHandler: TuiStringHandler, + @Inject(TuiAlertService) private readonly alerts: TuiAlertService, ) {} ngOnInit(): void { @@ -108,6 +110,14 @@ export class TuiDocDocumentationPropertyConnectorDirective console.info(this.attrName, event); this.emits$.next(this.emits$.value + 1); + + let content: string | undefined; + + if (event !== undefined) { + content = tuiInspectAny(event, 2); + } + + this.alerts.open(content, {label: this.attrName}).subscribe(); } private parseParams(params: Params): void { diff --git a/projects/demo/src/modules/components/calendar-month/calendar-month.component.ts b/projects/demo/src/modules/components/calendar-month/calendar-month.component.ts index 63e1ef3f209e..3de74e50dd98 100644 --- a/projects/demo/src/modules/components/calendar-month/calendar-month.component.ts +++ b/projects/demo/src/modules/components/calendar-month/calendar-month.component.ts @@ -1,4 +1,4 @@ -import {Component, Inject} from '@angular/core'; +import {Component} from '@angular/core'; import {changeDetection} from '@demo/emulate/change-detection'; import {TuiDocExample} from '@taiga-ui/addon-doc'; import { @@ -11,7 +11,6 @@ import { TuiMonthRange, TuiYear, } from '@taiga-ui/cdk'; -import {TuiAlertService} from '@taiga-ui/core'; @Component({ selector: 'example-tui-calendar-month', @@ -68,13 +67,4 @@ export class ExampleTuiCalendarMonthComponent { ]; year = this.yearVariants[0]; - - constructor( - @Inject(TuiAlertService) - private readonly alerts: TuiAlertService, - ) {} - - onMonthClick(month: TuiMonth): void { - this.alerts.open(String(month)).subscribe(); - } } diff --git a/projects/demo/src/modules/components/calendar-month/calendar-month.template.html b/projects/demo/src/modules/components/calendar-month/calendar-month.template.html index 923a0ee9deab..795fdd52063e 100644 --- a/projects/demo/src/modules/components/calendar-month/calendar-month.template.html +++ b/projects/demo/src/modules/components/calendar-month/calendar-month.template.html @@ -39,7 +39,7 @@ [min]="min" [value]="value" [year]="year" - (monthClick)="onMonthClick($event)" + (monthClick)="documentationPropertyMonthClick.emitEvent($event)" > @@ -91,6 +91,7 @@ Current year @@ -204,6 +204,7 @@ Selected day or range = ['xs', 's', 'm', 'l']; size = this.sizeVariants[2]; - - constructor( - @Inject(TuiAlertService) - private readonly alerts: TuiAlertService, - ) {} - - onToggledItemChange(item: unknown): void { - this.alerts.open(String(item)).subscribe(); - } } diff --git a/projects/demo/src/modules/components/filter/filter.template.html b/projects/demo/src/modules/components/filter/filter.template.html index cfdc45125298..c846c96c3c10 100644 --- a/projects/demo/src/modules/components/filter/filter.template.html +++ b/projects/demo/src/modules/components/filter/filter.template.html @@ -52,7 +52,7 @@ [formControl]="control" [items]="items" [size]="size" - (toggledItem)="onToggledItemChange($event)" + (toggledItem)="documentationPropertyToggledItem.emitEvent($event)" > @@ -118,6 +118,7 @@ Size @@ -131,6 +131,7 @@ Code length ; + readonly exampleModule = import('./examples/import/import-module.md?raw'); readonly exampleHtml = import('./examples/import/insert-template.md?raw'); @@ -73,13 +81,6 @@ export class ExampleTuiInputCardComponent extends AbstractExampleTuiControl { cvc: new FormControl('', Validators.required), }); - constructor( - @Inject(TuiAlertService) - private readonly alerts: TuiAlertService, - ) { - super(); - } - get cardSrc(): string | null { return this.cardSrcSelected === null ? null : this.cards[this.cardSrcSelected]; } @@ -121,8 +122,4 @@ export class ExampleTuiInputCardComponent extends AbstractExampleTuiControl { this.control.get(control)!.enable(); } - - onBinChange(bin: string | null): void { - this.alerts.open(`bin: ${bin}`).subscribe(); - } } diff --git a/projects/demo/src/modules/components/input-card/input-card.template.html b/projects/demo/src/modules/components/input-card/input-card.template.html index 3d36c27897f7..19f06561e5aa 100644 --- a/projects/demo/src/modules/components/input-card/input-card.template.html +++ b/projects/demo/src/modules/components/input-card/input-card.template.html @@ -47,7 +47,7 @@ [tuiTextfieldCleaner]="cleaner" [tuiTextfieldLabelOutside]="labelOutside" [tuiTextfieldSize]="size" - (binChange)="onBinChange($event)" + (binChange)="binChangeProperty?.emitEvent($event)" > Card number @@ -135,6 +135,7 @@ SVG card icon @@ -161,6 +161,7 @@ Max file size in bytes (30 MB by default — 30 * 1000 * 1000) Lorem ipsum @@ -91,6 +92,7 @@ Number of visible lines @@ -119,6 +121,7 @@ Single date or a range