@taiga-ui/layout 4.52.0-canary.6043e8f → 4.52.0-canary.65c65f9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,9 +3,10 @@ import { inject, EventEmitter, TemplateRef, Output, Input, ViewChild, ChangeDete
|
|
|
3
3
|
import { toSignal } from '@angular/core/rxjs-interop';
|
|
4
4
|
import { tuiInjectElement, tuiIsElement, tuiContainsOrAfter } from '@taiga-ui/cdk/utils/dom';
|
|
5
5
|
import { tuiGetClosestFocusable } from '@taiga-ui/cdk/utils/focus';
|
|
6
|
+
import { tuiDirectiveBinding } from '@taiga-ui/cdk/utils/miscellaneous';
|
|
6
7
|
import * as i1 from '@taiga-ui/core/components/textfield';
|
|
7
8
|
import { TuiTextfieldComponent, TuiWithTextfield } from '@taiga-ui/core/components/textfield';
|
|
8
|
-
import {
|
|
9
|
+
import { TuiIcons } from '@taiga-ui/core/directives/icons';
|
|
9
10
|
import { TuiPopupService } from '@taiga-ui/core/directives/popup';
|
|
10
11
|
import { TUI_COMMON_ICONS } from '@taiga-ui/core/tokens';
|
|
11
12
|
import { tuiCellOptionsProvider } from '@taiga-ui/layout/components/cell';
|
|
@@ -21,7 +22,7 @@ class TuiInputSearch {
|
|
|
21
22
|
this.parent = this.textfield.el.parentElement;
|
|
22
23
|
this.neighbor = this.textfield.el.nextSibling;
|
|
23
24
|
this.placeholder = '';
|
|
24
|
-
this.icon =
|
|
25
|
+
this.icon = tuiDirectiveBinding(TuiIcons, 'iconStart', inject(TUI_COMMON_ICONS).search, {});
|
|
25
26
|
this.tuiInputSearchOpen = false;
|
|
26
27
|
this.tuiInputSearchOpenChange = new EventEmitter();
|
|
27
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-layout-components-input-search.mjs","sources":["../../../projects/layout/components/input-search/input-search.component.ts","../../../projects/layout/components/input-search/input-search.component.html","../../../projects/layout/components/input-search/taiga-ui-layout-components-input-search.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n type ElementRef,\n type EmbeddedViewRef,\n EventEmitter,\n inject,\n Input,\n type OnChanges,\n Output,\n TemplateRef,\n ViewChild,\n} from '@angular/core';\nimport {toSignal} from '@angular/core/rxjs-interop';\nimport {\n tuiContainsOrAfter,\n tuiInjectElement,\n tuiIsElement,\n} from '@taiga-ui/cdk/utils/dom';\nimport {tuiGetClosestFocusable} from '@taiga-ui/cdk/utils/focus';\nimport {\n TuiTextfieldComponent,\n TuiWithTextfield,\n} from '@taiga-ui/core/components/textfield';\nimport {
|
|
1
|
+
{"version":3,"file":"taiga-ui-layout-components-input-search.mjs","sources":["../../../projects/layout/components/input-search/input-search.component.ts","../../../projects/layout/components/input-search/input-search.component.html","../../../projects/layout/components/input-search/taiga-ui-layout-components-input-search.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n type ElementRef,\n type EmbeddedViewRef,\n EventEmitter,\n inject,\n Input,\n type OnChanges,\n Output,\n TemplateRef,\n ViewChild,\n} from '@angular/core';\nimport {toSignal} from '@angular/core/rxjs-interop';\nimport {\n tuiContainsOrAfter,\n tuiInjectElement,\n tuiIsElement,\n} from '@taiga-ui/cdk/utils/dom';\nimport {tuiGetClosestFocusable} from '@taiga-ui/cdk/utils/focus';\nimport {tuiDirectiveBinding} from '@taiga-ui/cdk/utils/miscellaneous';\nimport {\n TuiTextfieldComponent,\n TuiWithTextfield,\n} from '@taiga-ui/core/components/textfield';\nimport {TuiIcons} from '@taiga-ui/core/directives/icons';\nimport {TuiPopupService} from '@taiga-ui/core/directives/popup';\nimport {TUI_COMMON_ICONS} from '@taiga-ui/core/tokens';\nimport {tuiCellOptionsProvider} from '@taiga-ui/layout/components/cell';\nimport {TUI_INPUT_SEARCH} from '@taiga-ui/layout/tokens';\nimport {type PolymorpheusContent, PolymorpheusOutlet} from '@taiga-ui/polymorpheus';\n\n@Component({\n selector: 'input[tuiInputSearch]',\n imports: [PolymorpheusOutlet],\n templateUrl: './input-search.component.html',\n styleUrls: ['./input-search.component.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [tuiCellOptionsProvider({size: 'm'})],\n hostDirectives: [TuiWithTextfield],\n host: {\n ngSkipHydration: 'true',\n '(focus)': 'open()',\n '(keydown.tab.prevent)': '0',\n '(keydown.arrowDown.prevent)': 'onArrow()',\n },\n})\nexport class TuiInputSearch implements OnChanges {\n @ViewChild(TemplateRef)\n private readonly template?: TemplateRef<any>;\n\n @ViewChild('container')\n private readonly container?: ElementRef<HTMLElement>;\n\n private readonly el = tuiInjectElement<HTMLInputElement>();\n private readonly service = inject(TuiPopupService);\n private readonly textfield = inject(TuiTextfieldComponent);\n private readonly i18n = toSignal(inject(TUI_INPUT_SEARCH));\n private parent = this.textfield.el.parentElement;\n private neighbor = this.textfield.el.nextSibling;\n private placeholder = '';\n private ref?: EmbeddedViewRef<unknown>;\n\n protected readonly icon = tuiDirectiveBinding(\n TuiIcons,\n 'iconStart',\n inject(TUI_COMMON_ICONS).search,\n {},\n );\n\n @Input()\n public tuiInputSearch: PolymorpheusContent;\n\n @Input()\n public tuiInputSearchOpen = false;\n\n @Output()\n public readonly tuiInputSearchOpenChange = new EventEmitter<boolean>();\n\n public ngOnChanges(): void {\n if (this.tuiInputSearchOpen) {\n this.open();\n } else {\n this.close();\n }\n }\n\n public open(): void {\n if (this.ref?.destroyed === false || !this.template) {\n return;\n }\n\n this.placeholder = this.el.placeholder;\n this.parent = this.textfield.el.parentElement;\n this.neighbor = this.textfield.el.nextSibling;\n this.ref = this.service.addTemplate(this.template);\n this.ref.rootNodes[0]?.insertAdjacentElement('afterbegin', this.textfield.el);\n this.el.focus({preventScroll: true});\n this.el.placeholder = this.i18n()?.placeholder || this.el.placeholder;\n this.tuiInputSearchOpen = true;\n this.tuiInputSearchOpenChange.emit(true);\n }\n\n public close(): void {\n this.el.placeholder = this.placeholder || this.el.placeholder;\n this.parent?.insertBefore(this.textfield.el, this.neighbor);\n this.ref?.destroy();\n this.tuiInputSearchOpen = false;\n this.tuiInputSearchOpenChange.emit(false);\n }\n\n protected onArrow(): void {\n tuiGetClosestFocusable({\n initial: this.container?.nativeElement || this.el,\n root: this.container?.nativeElement || this.el,\n })?.focus();\n }\n\n protected onFocus({target}: Event): void {\n if (\n this.container &&\n target !== this.el &&\n tuiIsElement(target) &&\n !tuiContainsOrAfter(this.container.nativeElement, target)\n ) {\n this.close();\n }\n }\n}\n","<ng-template>\n <div\n tuiTheme=\"dark\"\n class=\"t-container\"\n (document:focusin)=\"onFocus($event)\"\n (keydown.esc)=\"close()\"\n (pointerdown.self)=\"close()\"\n >\n <div\n #container\n class=\"t-content\"\n >\n <ng-container *polymorpheusOutlet=\"tuiInputSearch\" />\n </div>\n </div>\n</ng-template>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;MA+Ca,cAAc,CAAA;AAf3B,IAAA,WAAA,GAAA;QAsBqB,IAAE,CAAA,EAAA,GAAG,gBAAgB,EAAoB;AACzC,QAAA,IAAA,CAAA,OAAO,GAAG,MAAM,CAAC,eAAe,CAAC;AACjC,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,qBAAqB,CAAC;QACzC,IAAI,CAAA,IAAA,GAAG,QAAQ,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAClD,IAAM,CAAA,MAAA,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,aAAa;QACxC,IAAQ,CAAA,QAAA,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,WAAW;QACxC,IAAW,CAAA,WAAA,GAAG,EAAE;AAGL,QAAA,IAAA,CAAA,IAAI,GAAG,mBAAmB,CACzC,QAAQ,EACR,WAAW,EACX,MAAM,CAAC,gBAAgB,CAAC,CAAC,MAAM,EAC/B,EAAE,CACL;QAMM,IAAkB,CAAA,kBAAA,GAAG,KAAK;AAGjB,QAAA,IAAA,CAA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