@mintplayer/ng-bootstrap 22.24.0 → 22.26.0
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.
- package/fesm2022/mintplayer-ng-bootstrap-a11y.mjs +27 -48
- package/fesm2022/mintplayer-ng-bootstrap-a11y.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-badge.mjs +11 -1
- package/fesm2022/mintplayer-ng-bootstrap-badge.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-code-snippet.mjs +0 -1
- package/fesm2022/mintplayer-ng-bootstrap-code-snippet.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-dropdown-menu.mjs +7 -19
- package/fesm2022/mintplayer-ng-bootstrap-dropdown-menu.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-dropdown.mjs +6 -160
- package/fesm2022/mintplayer-ng-bootstrap-dropdown.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-machine.mjs +102 -0
- package/fesm2022/mintplayer-ng-bootstrap-machine.mjs.map +1 -0
- package/fesm2022/mintplayer-ng-bootstrap-navbar.mjs +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-navbar.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-bootstrap-typeahead.mjs +250 -103
- package/fesm2022/mintplayer-ng-bootstrap-typeahead.mjs.map +1 -1
- package/machine/package.json +4 -0
- package/package.json +7 -2
- package/types/mintplayer-ng-bootstrap-a11y.d.ts +23 -34
- package/types/mintplayer-ng-bootstrap-code-snippet.d.ts +0 -1
- package/types/mintplayer-ng-bootstrap-datatable.d.ts +7 -0
- package/types/mintplayer-ng-bootstrap-dropdown-menu.d.ts +6 -18
- package/types/mintplayer-ng-bootstrap-dropdown.d.ts +2 -48
- package/types/mintplayer-ng-bootstrap-machine.d.ts +54 -0
- package/types/mintplayer-ng-bootstrap-typeahead.d.ts +141 -32
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mintplayer-ng-bootstrap-navbar.mjs","sources":["../../../../libs/mintplayer-ng-bootstrap/navbar/src/navbar/navbar.component.ts","../../../../libs/mintplayer-ng-bootstrap/navbar/src/navbar/navbar.component.html","../../../../libs/mintplayer-ng-bootstrap/navbar/src/navbar-nav/navbar-nav.component.ts","../../../../libs/mintplayer-ng-bootstrap/navbar/src/navbar-item/navbar-item.component.ts","../../../../libs/mintplayer-ng-bootstrap/navbar/src/navbar-brand/navbar-brand.component.ts","../../../../libs/mintplayer-ng-bootstrap/navbar/src/navbar-dropdown/navbar-dropdown-label.directive.ts","../../../../libs/mintplayer-ng-bootstrap/navbar/src/navbar-dropdown/navbar-dropdown.component.ts","../../../../libs/mintplayer-ng-bootstrap/navbar/src/navbar-dropdown/navbar-dropdown.component.html","../../../../libs/mintplayer-ng-bootstrap/navbar/src/navbar-toggler-slot/navbar-toggler.directive.ts","../../../../libs/mintplayer-ng-bootstrap/navbar/src/navbar-content/navbar-content.directive.ts","../../../../libs/mintplayer-ng-bootstrap/navbar/mintplayer-ng-bootstrap-navbar.ts"],"sourcesContent":["import { afterNextRender, ChangeDetectionStrategy, Component, computed, CUSTOM_ELEMENTS_SCHEMA, ElementRef, inject, input, output } from '@angular/core';\nimport type { NavbarBreakpoint, NavbarExpandedChangeEventDetail } from '@mintplayer/web-components/navbar';\nimport { BsForwardAriaDirective } from '@mintplayer/ng-bootstrap/a11y';\n\n/**\n * `<bs-navbar>` — Angular wrapper around the `<mp-navbar>` web component.\n *\n * Layout, the responsive collapse behaviour, the pure-CSS no-JS toggle and the\n * theme-aware styling all live in the WC (single source of UI truth). This\n * wrapper only bridges inputs to attributes and projects content into the WC's\n * slots:\n * - mark the brand with `bs-navbar-brand` (→ `slot=\"brand\"`);\n * - left-aligned items go in the default slot;\n * - right-aligned items get `slot=\"end\"`.\n *\n * The WC is registered **client-side only** (`afterNextRender`); on the server\n * Angular emits a bare `<mp-navbar>` tag and the SSR layer injects its\n * Declarative Shadow DOM (see `injectMpNavbarDsd`), so it renders with JS off.\n */\n@Component({\n selector: 'bs-navbar',\n templateUrl: './navbar.component.html',\n imports: [BsForwardAriaDirective],\n changeDetection: ChangeDetectionStrategy.OnPush,\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n})\nexport class BsNavbarComponent {\n /** Host element — measured by `[bsNavbarContent]` to offset page content. */\n readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** Bootstrap breakpoint the navbar expands at; collapses below it. */\n readonly breakpoint = input<NavbarBreakpoint>('md');\n /** Theme color of the navbar background (e.g. `primary`, `dark`, `body-tertiary`). */\n readonly color = input<string>();\n /** Accessible label for the `<nav>` landmark. */\n /** Whether the collapse is (visually) expanded; reflected to the WC. */\n readonly expanded = input(false);\n /** `fixed` pins the bar to the top of the viewport, full width; omit for in-flow. */\n readonly positioning = input<'fixed'>();\n\n /** Fires when the collapse toggles (re-emits the WC's `expandedchange`). */\n readonly expandedchange = output<NavbarExpandedChangeEventDetail>();\n\n /** String-or-absent attributes derived once via signals. */\n protected readonly colorAttr = computed(() => this.color() ?? null);\n protected readonly positioningAttr = computed(() => this.positioning() ?? null);\n /** Presence attribute: `''` when expanded, `null` when collapsed. */\n protected readonly expandedAttr = computed(() => (this.expanded() ? '' : null));\n\n protected onExpandedchange(event: Event) {\n // The WC's `expandedchange` is a general-purpose DOM event (bubbles +\n // composed). The public Angular API is this typed `output()`, so consume\n // the raw event here. Without `stopPropagation` it keeps bubbling to the\n // consumer's `<bs-navbar>` host, where their `(expandedchange)` binding\n // fires a SECOND time with the raw `CustomEvent` (Angular doesn't unwrap\n // `.detail`).\n event.stopPropagation();\n this.expandedchange.emit((event as CustomEvent<NavbarExpandedChangeEventDetail>).detail);\n }\n\n constructor() {\n afterNextRender(() => {\n // Side-effect import registers <mp-navbar> and friends; client-only so\n // SSR stays a bare tag for DSD injection.\n import('@mintplayer/web-components/navbar');\n });\n }\n}\n","<mp-navbar bsForwardAria [attr.breakpoint]=\"breakpoint()\" [attr.color]=\"colorAttr()\" [attr.expanded]=\"expandedAttr()\" [attr.positioning]=\"positioningAttr()\" (expandedchange)=\"onExpandedchange($event)\">\n <ng-content></ng-content>\n</mp-navbar>\n","import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\n\n/**\n * `<bs-navbar-nav>` — groups navbar items into one of the WC's two nav lists.\n *\n * `align=\"start\"` (default) joins the left list, `align=\"end\"` the list pushed\n * to the far edge in wide mode. The host is `display: contents`, so the grouped\n * `<bs-navbar-item>` / `<bs-navbar-dropdown>` children flatten into the WC's\n * `.navbar-nav` flex layout exactly like directly-slotted items — the same\n * mechanism `<mp-navbar>` itself uses for its slots. The WC slot name stays an\n * internal detail (mirrors `bs-navbar-brand` hiding `slot=\"brand\"`).\n *\n * `display: contents` MUST stay static CSS (never applied via JS) so the no-JS\n * SSR path lays out identically from first paint.\n */\n@Component({\n selector: 'bs-navbar-nav',\n template: '<ng-content></ng-content>',\n styles: ':host { display: contents; }',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[attr.slot]': 'slotAttr()',\n },\n})\nexport class BsNavbarNavComponent {\n /** Which nav group the items join: `start` (default) or `end` (pushed to the far edge in wide mode). */\n readonly align = input<'start' | 'end'>('start');\n\n protected readonly slotAttr = computed(() => (this.align() === 'end' ? 'end' : null));\n}\n","import { NgTemplateOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, computed, CUSTOM_ELEMENTS_SCHEMA, inject, input } from '@angular/core';\nimport { BS_DROPDOWN_MENU_CONTEXT } from '@mintplayer/ng-bootstrap/dropdown-menu';\n\n/**\n * `<bs-navbar-item>` — one navbar entry, uniform at EVERY nesting level.\n *\n * Wraps a consumer light-DOM link: project an `<a routerLink>` / `<a href>` (or\n * a `<button>`) as content. The rendered shape is context-aware:\n *\n * - **Directly in the navbar** (top level, or inside `<bs-navbar-nav>`): wraps\n * the link in `<mp-navbar-item>`, which styles it as a `.nav-link` in its\n * own shadow.\n * - **Inside a dropdown** (`<bs-navbar-dropdown>` / `<bs-dropdown-menu>`,\n * detected via `BS_DROPDOWN_MENU_CONTEXT`): the HOST itself becomes the\n * `.dropdown-item` — the shape `mp-dropdown-menu` queries (roving tabindex,\n * `role=menuitem` on the inner control) and styles via\n * `::slotted(.dropdown-item)`. The link stays a DIRECT child of the host so\n * the menu wrapper's companion `.dropdown-item > a` reset reaches it\n * (`NgTemplateOutlet` through `<ng-container>` adds no wrapper element).\n *\n * `active` / `disabled` bridge to the WC's presence attributes (nav mode) or\n * Bootstrap's item classes + `aria-disabled` (menu mode).\n */\n@Component({\n selector: 'bs-navbar-item',\n template: `\n <ng-template #content><ng-content></ng-content></ng-template>\n @if (inMenu) {\n <ng-container [ngTemplateOutlet]=\"content\" />\n } @else {\n <mp-navbar-item [attr.active]=\"activeAttr()\" [attr.disabled]=\"disabledAttr()\" [attr.aria-current]=\"active() ? 'page' : null\">\n <ng-container [ngTemplateOutlet]=\"content\" />\n </mp-navbar-item>\n }\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n imports: [NgTemplateOutlet],\n host: {\n '[class.dropdown-item]': 'inMenu',\n '[class.active]': 'inMenu && active()',\n '[class.disabled]': 'inMenu && disabled()',\n '[attr.aria-disabled]': \"inMenu && disabled() ? 'true' : null\",\n // Menu mode: the same active state is the current page.\n '[attr.aria-current]': \"inMenu && active() ? 'page' : null\",\n },\n})\nexport class BsNavbarItemComponent {\n readonly active = input(false);\n readonly disabled = input(false);\n\n /** Menu mode when authored inside a dropdown; fixed per instance. */\n protected readonly inMenu = inject(BS_DROPDOWN_MENU_CONTEXT, { optional: true }) ?? false;\n\n /** Presence attributes: `''` when set, `null` when absent. */\n protected readonly activeAttr = computed(() => (this.active() ? '' : null));\n protected readonly disabledAttr = computed(() => (this.disabled() ? '' : null));\n}\n","import { ChangeDetectionStrategy, Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';\n\n/**\n * `<bs-navbar-brand>` — Angular wrapper around `<mp-navbar-brand>`.\n *\n * Project an `<a routerLink>` / text as the brand. The host sets\n * `slot=\"brand\"` so the wrapper element lands in `<mp-navbar>`'s `brand` slot\n * (mirrors `BsShellSidebarDirective`, which sets `slot=\"sidebar\"`).\n */\n@Component({\n selector: 'bs-navbar-brand',\n template: '<mp-navbar-brand><ng-content></ng-content></mp-navbar-brand>',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[attr.slot]': \"'brand'\",\n },\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n})\nexport class BsNavbarBrandComponent {}\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\n/**\n * Marks the trigger-label template for `<bs-navbar-dropdown>` — any HTML\n * (text, icon + text, badges, …). Rendered into the WC's trigger via\n * `ngTemplateOutlet`; the trigger's accessible name derives from this content,\n * so give an icon-only label an `aria-label`.\n *\n * ```html\n * <bs-navbar-dropdown>\n * <span *bsNavbarDropdownLabel>Products</span>\n * <bs-navbar-item><a routerLink=\"/p1\">Product 1</a></bs-navbar-item>\n * </bs-navbar-dropdown>\n * ```\n */\n@Directive({ selector: '[bsNavbarDropdownLabel]' })\nexport class BsNavbarDropdownLabelDirective {\n readonly templateRef = inject(TemplateRef);\n}\n","import { NgTemplateOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, contentChild, CUSTOM_ELEMENTS_SCHEMA, inject, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { RouterLinkActive } from '@angular/router';\nimport { BS_DROPDOWN_MENU_CONTEXT, BsDropdownMenuComponent } from '@mintplayer/ng-bootstrap/dropdown-menu';\nimport { BsNavbarDropdownLabelDirective } from './navbar-dropdown-label.directive';\nimport { BsForwardAriaDirective } from '@mintplayer/ng-bootstrap/a11y';\n\n/**\n * `<bs-navbar-dropdown>` — Angular wrapper around `<mp-navbar-dropdown>`.\n *\n * The trigger content is the `*bsNavbarDropdownLabel` template — any HTML\n * (matches the React/Vue wrappers, which take the WC's `label` slot directly).\n * The dropdown panel (`<bs-dropdown-menu>`) is rendered internally — author\n * the items directly between the tags, uniformly with the rest of the navbar:\n *\n * <bs-navbar-dropdown>\n * <span *bsNavbarDropdownLabel>Basic</span>\n * <bs-navbar-item><a routerLink=\"/basic/alert\">Alert</a></bs-navbar-item>\n * <bs-navbar-dropdown>…</bs-navbar-dropdown> <!-- submenu -->\n * </bs-navbar-dropdown>\n *\n * `BS_DROPDOWN_MENU_CONTEXT` is provided here (element injectors follow the\n * consumer template's nesting, not the projection site — the internally\n * rendered menu is invisible to projected children's injectors), so nested\n * `<bs-navbar-item>`s render their `.dropdown-item` shape.\n *\n * **Active-route trigger highlighting:** a `RouterLinkActive` host directive\n * collects the projected descendant `routerLink`s; when any is active\n * (non-exact — the whole subtree counts, like the legacy `[bsNavbarTrigger]`\n * prefix match) the WC gets its `active` attribute, which recolors the\n * shadow-rendered trigger (primary background for submenu triggers). Nested\n * dropdowns each report their own subtree, so the full trigger chain of the\n * active route highlights. Renders server-side, so it works with JS off.\n *\n * Reveal/positioning and the no-JS `:focus-within` fallback all live in the WC.\n */\n@Component({\n selector: 'bs-navbar-dropdown',\n templateUrl: './navbar-dropdown.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n imports: [BsForwardAriaDirective, NgTemplateOutlet, BsDropdownMenuComponent],\n providers: [{ provide: BS_DROPDOWN_MENU_CONTEXT, useValue: true }],\n hostDirectives: [RouterLinkActive],\n})\nexport class BsNavbarDropdownComponent {\n protected readonly label = contentChild.required(BsNavbarDropdownLabelDirective);\n\n /** A projected descendant link's route is active → highlight the trigger. */\n protected readonly routeActive = signal(false);\n\n constructor() {\n const rla = inject(RouterLinkActive, { self: true });\n // No class on this host — the state is bridged to the WC's `active`\n // attribute instead (the trigger lives in the WC's shadow, out of reach\n // of any class-based styling from here).\n rla.routerLinkActive = [];\n rla.isActiveChange.pipe(takeUntilDestroyed()).subscribe((active) => this.routeActive.set(active));\n }\n}\n","<mp-navbar-dropdown bsForwardAria [attr.active]=\"routeActive() ? '' : null\">\n <span slot=\"label\"><ng-container [ngTemplateOutlet]=\"label().templateRef\"></ng-container></span>\n <bs-dropdown-menu>\n <ng-content></ng-content>\n </bs-dropdown-menu>\n</mp-navbar-dropdown>\n","import { Directive } from '@angular/core';\n\n/**\n * `[bsNavbarToggler]` — marks an element as the navbar's custom hamburger\n * glyph, replacing the WC's built-in animated 3-bar → X toggler (the `toggler`\n * slot's fallback). The slot name stays an internal detail of the WC.\n *\n * The glyph is a first-class no-JS citizen: DSD slot assignment happens at\n * parse time (no fallback flash), the click reaches the in-shadow checkbox via\n * native label activation, and the open-state arrives as the inherited\n * `--mp-navbar-expanded: 0|1` custom property — derive the morph in CSS, e.g.\n * `transform: rotate(calc(var(--mp-navbar-expanded, 0) * 45deg))`.\n *\n * The host must be NON-interactive: labels do not forward clicks from\n * interactive descendants, so a `<button>`/`<a href>` here would kill the\n * no-JS toggle. Use a `<span>`/`<div>` glyph. (For a programmatic boolean, use\n * `[expanded]`/`(expandedchange)` on `bs-navbar` instead.)\n */\n@Directive({\n selector: '[bsNavbarToggler]',\n host: {\n slot: 'toggler',\n },\n})\nexport class BsNavbarTogglerDirective {}\n","import { afterNextRender, Directive, ElementRef, inject, input, OnDestroy, PLATFORM_ID, Renderer2 } from '@angular/core';\nimport { isPlatformServer } from '@angular/common';\nimport { BsNavbarComponent } from '../navbar/navbar.component';\n\n/**\n * `[bsNavbarContent]` — offsets page content below a `positioning=\"fixed\"`\n * navbar by its LIVE height (replaces hand-maintained `padding-top` constants).\n *\n * <bs-navbar [positioning]=\"'fixed'\" #nav>…</bs-navbar>\n * <div [bsNavbarContent]=\"nav\"><router-outlet /></div>\n *\n * On the client a `ResizeObserver` tracks the bar (theme/viewport changes\n * resize it) and sets `padding-top` = the element's own initial padding + the\n * bar height. On the server — where the bar can't be measured — a fixed 58px\n * approximation is serialized into the HTML so SSR/no-JS pages still clear the\n * bar (same contract as the pre-WC directive).\n */\n@Directive({\n selector: '[bsNavbarContent]',\n})\nexport class BsNavbarContentDirective implements OnDestroy {\n /** The `bs-navbar` to clear — pass its template reference (`#nav`). */\n readonly navbar = input.required<BsNavbarComponent>({ alias: 'bsNavbarContent' });\n\n /** Server-side height approximation (px) — the bar isn't measurable there. */\n static readonly SSR_NAVBAR_HEIGHT = 58;\n\n readonly #element = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n readonly #renderer = inject(Renderer2);\n #observer?: ResizeObserver;\n\n constructor() {\n if (isPlatformServer(inject(PLATFORM_ID))) {\n this.#setPadding(BsNavbarContentDirective.SSR_NAVBAR_HEIGHT);\n return;\n }\n afterNextRender(() => {\n // The measurable bar is the WC inside the wrapper host (the host itself\n // is inline and reports no height for a fixed child).\n const bar = this.navbar().elementRef.nativeElement.querySelector('mp-navbar');\n if (!bar) return;\n // Hydration reuses the SSR element, so the 58px approximation this\n // directive wrote server-side is still inline here. Remove it BEFORE\n // measuring, or the author's baseline would double-count it.\n this.#renderer.removeStyle(this.#element, 'padding-top');\n const initial = parseFloat(getComputedStyle(this.#element).paddingTop) || 0;\n this.#observer = new ResizeObserver(() =>\n this.#setPadding(initial + (bar as HTMLElement).offsetHeight),\n );\n this.#observer.observe(bar);\n });\n }\n\n #setPadding(px: number): void {\n this.#renderer.setStyle(this.#element, 'padding-top', `${px}px`);\n }\n\n ngOnDestroy(): void {\n this.#observer?.disconnect();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAIA;;;;;;;;;;;;;;AAcG;MAQU,iBAAiB,CAAA;AAuBlB,IAAA,gBAAgB,CAAC,KAAY,EAAA;;;;;;;QAOrC,KAAK,CAAC,eAAe,EAAE;QACvB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAE,KAAsD,CAAC,MAAM,CAAC;IAC1F;AAEA,IAAA,WAAA,GAAA;;AAhCS,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAA0B,UAAU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mB,CAAC,YAAY,CAAC,CAC9D;AACD,YAAA,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC;AAC7B,QAAA,CAAC,CAAC;IACJ;AAEA,IAAA,WAAW,CAAC,EAAU,EAAA;AACpB,QAAA,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,aAAa,EAAE,CAAA,EAAG,EAAE,CAAA,EAAA,CAAI,CAAC;IAClE;IAEA,WAAW,GAAA;AACT,QAAA,IAAI,CAAC,SAAS,EAAE,UAAU,EAAE;IAC9B;8GAvCW,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAxB,wBAAwB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,EAAA,MAAA,EAAA,EAAA,iBAAA,EAAA,QAAA,EAAA,UAAA,EAAA,iBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAxB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBAHpC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,mBAAmB;AAC9B,iBAAA;;;ACnBD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"mintplayer-ng-bootstrap-navbar.mjs","sources":["../../../../libs/mintplayer-ng-bootstrap/navbar/src/navbar/navbar.component.ts","../../../../libs/mintplayer-ng-bootstrap/navbar/src/navbar/navbar.component.html","../../../../libs/mintplayer-ng-bootstrap/navbar/src/navbar-nav/navbar-nav.component.ts","../../../../libs/mintplayer-ng-bootstrap/navbar/src/navbar-item/navbar-item.component.ts","../../../../libs/mintplayer-ng-bootstrap/navbar/src/navbar-brand/navbar-brand.component.ts","../../../../libs/mintplayer-ng-bootstrap/navbar/src/navbar-dropdown/navbar-dropdown-label.directive.ts","../../../../libs/mintplayer-ng-bootstrap/navbar/src/navbar-dropdown/navbar-dropdown.component.ts","../../../../libs/mintplayer-ng-bootstrap/navbar/src/navbar-dropdown/navbar-dropdown.component.html","../../../../libs/mintplayer-ng-bootstrap/navbar/src/navbar-toggler-slot/navbar-toggler.directive.ts","../../../../libs/mintplayer-ng-bootstrap/navbar/src/navbar-content/navbar-content.directive.ts","../../../../libs/mintplayer-ng-bootstrap/navbar/mintplayer-ng-bootstrap-navbar.ts"],"sourcesContent":["import { afterNextRender, ChangeDetectionStrategy, Component, computed, CUSTOM_ELEMENTS_SCHEMA, ElementRef, inject, input, output } from '@angular/core';\nimport type { NavbarBreakpoint, NavbarExpandedChangeEventDetail } from '@mintplayer/web-components/navbar';\nimport { BsForwardAriaDirective } from '@mintplayer/ng-bootstrap/a11y';\n\n/**\n * `<bs-navbar>` — Angular wrapper around the `<mp-navbar>` web component.\n *\n * Layout, the responsive collapse behaviour, the pure-CSS no-JS toggle and the\n * theme-aware styling all live in the WC (single source of UI truth). This\n * wrapper only bridges inputs to attributes and projects content into the WC's\n * slots:\n * - mark the brand with `bs-navbar-brand` (→ `slot=\"brand\"`);\n * - left-aligned items go in the default slot;\n * - right-aligned items get `slot=\"end\"`.\n *\n * The WC is registered **client-side only** (`afterNextRender`); on the server\n * Angular emits a bare `<mp-navbar>` tag and the SSR layer injects its\n * Declarative Shadow DOM (see `injectMpNavbarDsd`), so it renders with JS off.\n */\n@Component({\n selector: 'bs-navbar',\n templateUrl: './navbar.component.html',\n imports: [BsForwardAriaDirective],\n changeDetection: ChangeDetectionStrategy.OnPush,\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n})\nexport class BsNavbarComponent {\n /** Host element — measured by `[bsNavbarContent]` to offset page content. */\n readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** Bootstrap breakpoint the navbar expands at; collapses below it. */\n readonly breakpoint = input<NavbarBreakpoint>('md');\n /** Theme color of the navbar background (e.g. `primary`, `dark`, `body-tertiary`). */\n readonly color = input<string>();\n /** Accessible label for the `<nav>` landmark. */\n /** Whether the collapse is (visually) expanded; reflected to the WC. */\n readonly expanded = input(false);\n /** `fixed` pins the bar to the top of the viewport, full width; omit for in-flow. */\n readonly positioning = input<'fixed'>();\n\n /** Fires when the collapse toggles (re-emits the WC's `expandedchange`). */\n readonly expandedchange = output<NavbarExpandedChangeEventDetail>();\n\n /** String-or-absent attributes derived once via signals. */\n protected readonly colorAttr = computed(() => this.color() ?? null);\n protected readonly positioningAttr = computed(() => this.positioning() ?? null);\n /** Presence attribute: `''` when expanded, `null` when collapsed. */\n protected readonly expandedAttr = computed(() => (this.expanded() ? '' : null));\n\n protected onExpandedchange(event: Event) {\n // The WC's `expandedchange` is a general-purpose DOM event (bubbles +\n // composed). The public Angular API is this typed `output()`, so consume\n // the raw event here. Without `stopPropagation` it keeps bubbling to the\n // consumer's `<bs-navbar>` host, where their `(expandedchange)` binding\n // fires a SECOND time with the raw `CustomEvent` (Angular doesn't unwrap\n // `.detail`).\n event.stopPropagation();\n this.expandedchange.emit((event as CustomEvent<NavbarExpandedChangeEventDetail>).detail);\n }\n\n constructor() {\n afterNextRender(() => {\n // Side-effect import registers <mp-navbar> and friends; client-only so\n // SSR stays a bare tag for DSD injection.\n import('@mintplayer/web-components/navbar');\n });\n }\n}\n","<mp-navbar bsForwardAria [attr.breakpoint]=\"breakpoint()\" [attr.color]=\"colorAttr()\" [attr.expanded]=\"expandedAttr()\" [attr.positioning]=\"positioningAttr()\" (expandedchange)=\"onExpandedchange($event)\">\n <ng-content></ng-content>\n</mp-navbar>\n","import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\n\n/**\n * `<bs-navbar-nav>` — groups navbar items into one of the WC's two nav lists.\n *\n * `align=\"start\"` (default) joins the left list, `align=\"end\"` the list pushed\n * to the far edge in wide mode. The host is `display: contents`, so the grouped\n * `<bs-navbar-item>` / `<bs-navbar-dropdown>` children flatten into the WC's\n * `.navbar-nav` flex layout exactly like directly-slotted items — the same\n * mechanism `<mp-navbar>` itself uses for its slots. The WC slot name stays an\n * internal detail (mirrors `bs-navbar-brand` hiding `slot=\"brand\"`).\n *\n * `display: contents` MUST stay static CSS (never applied via JS) so the no-JS\n * SSR path lays out identically from first paint.\n */\n@Component({\n selector: 'bs-navbar-nav',\n template: '<ng-content></ng-content>',\n styles: ':host { display: contents; }',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[attr.slot]': 'slotAttr()',\n },\n})\nexport class BsNavbarNavComponent {\n /** Which nav group the items join: `start` (default) or `end` (pushed to the far edge in wide mode). */\n readonly align = input<'start' | 'end'>('start');\n\n protected readonly slotAttr = computed(() => (this.align() === 'end' ? 'end' : null));\n}\n","import { NgTemplateOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, computed, CUSTOM_ELEMENTS_SCHEMA, inject, input } from '@angular/core';\nimport { BS_DROPDOWN_MENU_CONTEXT } from '@mintplayer/ng-bootstrap/dropdown-menu';\n\n/**\n * `<bs-navbar-item>` — one navbar entry, uniform at EVERY nesting level.\n *\n * Wraps a consumer light-DOM link: project an `<a routerLink>` / `<a href>` (or\n * a `<button>`) as content. The rendered shape is context-aware:\n *\n * - **Directly in the navbar** (top level, or inside `<bs-navbar-nav>`): wraps\n * the link in `<mp-navbar-item>`, which styles it as a `.nav-link` in its\n * own shadow.\n * - **Inside a dropdown** (`<bs-navbar-dropdown>` / `<bs-dropdown-menu>`,\n * detected via `BS_DROPDOWN_MENU_CONTEXT`): the HOST itself becomes the\n * `.dropdown-item` — the shape `mp-dropdown-menu` queries (roving tabindex,\n * `role=menuitem` on the inner control) and styles via\n * `::slotted(.dropdown-item)`. The link stays a DIRECT child of the host so\n * the menu wrapper's companion `.dropdown-item > a` reset reaches it\n * (`NgTemplateOutlet` through `<ng-container>` adds no wrapper element).\n *\n * `active` / `disabled` bridge to the WC's presence attributes (nav mode) or\n * Bootstrap's item classes + `aria-disabled` (menu mode).\n */\n@Component({\n selector: 'bs-navbar-item',\n template: `\n <ng-template #content><ng-content></ng-content></ng-template>\n @if (inMenu) {\n <ng-container [ngTemplateOutlet]=\"content\" />\n } @else {\n <mp-navbar-item [attr.active]=\"activeAttr()\" [attr.disabled]=\"disabledAttr()\" [attr.aria-current]=\"active() ? 'page' : null\">\n <ng-container [ngTemplateOutlet]=\"content\" />\n </mp-navbar-item>\n }\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n imports: [NgTemplateOutlet],\n host: {\n '[class.dropdown-item]': 'inMenu',\n '[class.active]': 'inMenu && active()',\n '[class.disabled]': 'inMenu && disabled()',\n '[attr.aria-disabled]': \"inMenu && disabled() ? 'true' : null\",\n // Menu mode: the same active state is the current page.\n '[attr.aria-current]': \"inMenu && active() ? 'page' : null\",\n },\n})\nexport class BsNavbarItemComponent {\n readonly active = input(false);\n readonly disabled = input(false);\n\n /** Menu mode when authored inside a dropdown; fixed per instance. */\n protected readonly inMenu = inject(BS_DROPDOWN_MENU_CONTEXT, { optional: true }) ?? false;\n\n /** Presence attributes: `''` when set, `null` when absent. */\n protected readonly activeAttr = computed(() => (this.active() ? '' : null));\n protected readonly disabledAttr = computed(() => (this.disabled() ? '' : null));\n}\n","import { ChangeDetectionStrategy, Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';\n\n/**\n * `<bs-navbar-brand>` — Angular wrapper around `<mp-navbar-brand>`.\n *\n * Project an `<a routerLink>` / text as the brand. The host sets\n * `slot=\"brand\"` so the wrapper element lands in `<mp-navbar>`'s `brand` slot\n * (mirrors `BsShellSidebarDirective`, which sets `slot=\"sidebar\"`).\n */\n@Component({\n selector: 'bs-navbar-brand',\n template: '<mp-navbar-brand><ng-content></ng-content></mp-navbar-brand>',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[attr.slot]': \"'brand'\",\n },\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n})\nexport class BsNavbarBrandComponent {}\n","import { Directive, inject, TemplateRef } from '@angular/core';\n\n/**\n * Marks the trigger-label template for `<bs-navbar-dropdown>` — any HTML\n * (text, icon + text, badges, …). Rendered into the WC's trigger via\n * `ngTemplateOutlet`; the trigger's accessible name derives from this content,\n * so give an icon-only label an `aria-label`.\n *\n * ```html\n * <bs-navbar-dropdown>\n * <span *bsNavbarDropdownLabel>Products</span>\n * <bs-navbar-item><a routerLink=\"/p1\">Product 1</a></bs-navbar-item>\n * </bs-navbar-dropdown>\n * ```\n */\n@Directive({ selector: '[bsNavbarDropdownLabel]' })\nexport class BsNavbarDropdownLabelDirective {\n readonly templateRef = inject(TemplateRef);\n}\n","import { NgTemplateOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, contentChild, CUSTOM_ELEMENTS_SCHEMA, inject, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { RouterLinkActive } from '@angular/router';\nimport { BS_DROPDOWN_MENU_CONTEXT, BsDropdownMenuComponent } from '@mintplayer/ng-bootstrap/dropdown-menu';\nimport { BsNavbarDropdownLabelDirective } from './navbar-dropdown-label.directive';\nimport { BsForwardAriaDirective } from '@mintplayer/ng-bootstrap/a11y';\n\n/**\n * `<bs-navbar-dropdown>` — Angular wrapper around `<mp-navbar-dropdown>`.\n *\n * The trigger content is the `*bsNavbarDropdownLabel` template — any HTML\n * (matches the React/Vue wrappers, which take the WC's `label` slot directly).\n * The dropdown panel (`<bs-dropdown-menu>`) is rendered internally — author\n * the items directly between the tags, uniformly with the rest of the navbar:\n *\n * <bs-navbar-dropdown>\n * <span *bsNavbarDropdownLabel>Basic</span>\n * <bs-navbar-item><a routerLink=\"/basic/alert\">Alert</a></bs-navbar-item>\n * <bs-navbar-dropdown>…</bs-navbar-dropdown> <!-- submenu -->\n * </bs-navbar-dropdown>\n *\n * `BS_DROPDOWN_MENU_CONTEXT` is provided here (element injectors follow the\n * consumer template's nesting, not the projection site — the internally\n * rendered menu is invisible to projected children's injectors), so nested\n * `<bs-navbar-item>`s render their `.dropdown-item` shape.\n *\n * **Active-route trigger highlighting:** a `RouterLinkActive` host directive\n * collects the projected descendant `routerLink`s; when any is active\n * (non-exact — the whole subtree counts, like the legacy `[bsNavbarTrigger]`\n * prefix match) the WC gets its `active` attribute, which recolors the\n * shadow-rendered trigger (primary background for submenu triggers). Nested\n * dropdowns each report their own subtree, so the full trigger chain of the\n * active route highlights. Renders server-side, so it works with JS off.\n *\n * Reveal/positioning and the no-JS `:focus-within` fallback all live in the WC.\n */\n@Component({\n selector: 'bs-navbar-dropdown',\n templateUrl: './navbar-dropdown.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n imports: [BsForwardAriaDirective, NgTemplateOutlet, BsDropdownMenuComponent],\n providers: [{ provide: BS_DROPDOWN_MENU_CONTEXT, useValue: true }],\n hostDirectives: [RouterLinkActive],\n})\nexport class BsNavbarDropdownComponent {\n protected readonly label = contentChild.required(BsNavbarDropdownLabelDirective);\n\n /** A projected descendant link's route is active → highlight the trigger. */\n protected readonly routeActive = signal(false);\n\n constructor() {\n const rla = inject(RouterLinkActive, { self: true });\n // No class on this host — the state is bridged to the WC's `active`\n // attribute instead (the trigger lives in the WC's shadow, out of reach\n // of any class-based styling from here).\n rla.routerLinkActive = [];\n rla.isActiveChange.pipe(takeUntilDestroyed()).subscribe((active) => this.routeActive.set(active));\n }\n}\n","<mp-navbar-dropdown bsForwardAria [attr.active]=\"routeActive() ? '' : null\">\n <span slot=\"label\"><ng-container [ngTemplateOutlet]=\"label().templateRef\"></ng-container></span>\n <bs-dropdown-menu>\n <ng-content></ng-content>\n </bs-dropdown-menu>\n</mp-navbar-dropdown>\n","import { Directive } from '@angular/core';\n\n/**\n * `[bsNavbarToggler]` — marks an element as the navbar's custom hamburger\n * glyph, replacing the WC's built-in animated 3-bar → X toggler (the `toggler`\n * slot's fallback). The slot name stays an internal detail of the WC.\n *\n * The glyph is a first-class no-JS citizen: DSD slot assignment happens at\n * parse time (no fallback flash), the click reaches the in-shadow checkbox via\n * native label activation, and the open-state arrives as the inherited\n * `--mp-navbar-expanded: 0|1` custom property — derive the morph in CSS, e.g.\n * `transform: rotate(calc(var(--mp-navbar-expanded, 0) * 45deg))`.\n *\n * The host must be NON-interactive: labels do not forward clicks from\n * interactive descendants, so a `<button>`/`<a href>` here would kill the\n * no-JS toggle. Use a `<span>`/`<div>` glyph. (For a programmatic boolean, use\n * `[expanded]`/`(expandedchange)` on `bs-navbar` instead.)\n */\n@Directive({\n selector: '[bsNavbarToggler]',\n host: {\n slot: 'toggler',\n },\n})\nexport class BsNavbarTogglerDirective {}\n","import { afterNextRender, Directive, ElementRef, inject, input, OnDestroy, PLATFORM_ID, Renderer2 } from '@angular/core';\nimport { isPlatformServer } from '@angular/common';\nimport { BsNavbarComponent } from '../navbar/navbar.component';\n\n/**\n * `[bsNavbarContent]` — offsets page content below a `positioning=\"fixed\"`\n * navbar by its LIVE height (replaces hand-maintained `padding-top` constants).\n *\n * <bs-navbar [positioning]=\"'fixed'\" #nav>…</bs-navbar>\n * <div [bsNavbarContent]=\"nav\"><router-outlet /></div>\n *\n * On the client a `ResizeObserver` tracks the bar (theme/viewport changes\n * resize it) and sets `padding-top` = the element's own initial padding + the\n * bar height. On the server — where the bar can't be measured — a fixed 58px\n * approximation is serialized into the HTML so SSR/no-JS pages still clear the\n * bar (same contract as the pre-WC directive).\n */\n@Directive({\n selector: '[bsNavbarContent]',\n})\nexport class BsNavbarContentDirective implements OnDestroy {\n /** The `bs-navbar` to clear — pass its template reference (`#nav`). */\n readonly navbar = input.required<BsNavbarComponent>({ alias: 'bsNavbarContent' });\n\n /** Server-side height approximation (px) — the bar isn't measurable there. */\n static readonly SSR_NAVBAR_HEIGHT = 58;\n\n readonly #element = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n readonly #renderer = inject(Renderer2);\n #observer?: ResizeObserver;\n\n constructor() {\n if (isPlatformServer(inject(PLATFORM_ID))) {\n this.#setPadding(BsNavbarContentDirective.SSR_NAVBAR_HEIGHT);\n return;\n }\n afterNextRender(() => {\n // The measurable bar is the WC inside the wrapper host (the host itself\n // is inline and reports no height for a fixed child).\n const bar = this.navbar().elementRef.nativeElement.querySelector('mp-navbar');\n if (!bar) return;\n // Hydration reuses the SSR element, so the 58px approximation this\n // directive wrote server-side is still inline here. Remove it BEFORE\n // measuring, or the author's baseline would double-count it.\n this.#renderer.removeStyle(this.#element, 'padding-top');\n const initial = parseFloat(getComputedStyle(this.#element).paddingTop) || 0;\n this.#observer = new ResizeObserver(() =>\n this.#setPadding(initial + (bar as HTMLElement).offsetHeight),\n );\n this.#observer.observe(bar);\n });\n }\n\n #setPadding(px: number): void {\n this.#renderer.setStyle(this.#element, 'padding-top', `${px}px`);\n }\n\n ngOnDestroy(): void {\n this.#observer?.disconnect();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAIA;;;;;;;;;;;;;;AAcG;MAQU,iBAAiB,CAAA;AAuBlB,IAAA,gBAAgB,CAAC,KAAY,EAAA;;;;;;;QAOrC,KAAK,CAAC,eAAe,EAAE;QACvB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAE,KAAsD,CAAC,MAAM,CAAC;IAC1F;AAEA,IAAA,WAAA,GAAA;;AAhCS,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAA0B,UAAU,CAAC;;QAGxD,IAAA,CAAA,UAAU,GAAG,KAAK,CAAmB,IAAI;uFAAC;;AAE1C,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK;6FAAU;;;QAGvB,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAC,KAAK;qFAAC;;AAEvB,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK;mGAAW;;QAG9B,IAAA,CAAA,cAAc,GAAG,MAAM,EAAmC;;QAGhD,IAAA,CAAA,SAAS,G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AA,IAAI,CAAC,SAAS,EAAE,UAAU,EAAE;IAC9B;8GAvCW,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAxB,wBAAwB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,EAAA,MAAA,EAAA,EAAA,iBAAA,EAAA,QAAA,EAAA,UAAA,EAAA,iBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAxB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBAHpC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,mBAAmB;AAC9B,iBAAA;;;ACnBD;;AAEG;;;;"}
|
|
@@ -1,130 +1,277 @@
|
|
|
1
|
+
import { isPlatformBrowser, NgTemplateOutlet } from '@angular/common';
|
|
1
2
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject,
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
import { BsProgressComponent } from '@mintplayer/ng-bootstrap/progress-bar';
|
|
3
|
+
import { inject, TemplateRef, input, Directive, model, output, contentChild, viewChild, ElementRef, signal, computed, DestroyRef, effect, untracked, PLATFORM_ID, afterNextRender, forwardRef, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
5
|
+
import { isObservable } from 'rxjs';
|
|
6
|
+
import { BsIdService } from '@mintplayer/ng-bootstrap/a11y';
|
|
7
|
+
import { useScopedStyles, machineSignal, MpPropsDirective } from '@mintplayer/ng-bootstrap/machine';
|
|
8
|
+
import { abortError } from '@mintplayer/ui-core/async';
|
|
9
|
+
import { TYPEAHEAD_SCOPE, typeaheadScopedStyles, TypeaheadMachine, connect } from '@mintplayer/ui-core/typeahead';
|
|
10
|
+
export { inMemoryTypeaheadProvider } from '@mintplayer/ui-core/typeahead';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Renders one suggestion row. Declared inside `<bs-typeahead>`; absent, the
|
|
14
|
+
* row shows the item's text (`itemText`).
|
|
15
|
+
*
|
|
16
|
+
* ```html
|
|
17
|
+
* <bs-typeahead [provider]="streets">
|
|
18
|
+
* <ng-container *bsTypeaheadItem="let street; let term = term; of: streetList">
|
|
19
|
+
* {{ street.name }} <small>{{ street.municipality }}</small>
|
|
20
|
+
* </ng-container>
|
|
21
|
+
* </bs-typeahead>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* `of:` is optional and only carries the item type into the template (like
|
|
25
|
+
* `ngFor`'s `of`); pass any value of the item type or an array of it.
|
|
26
|
+
*/
|
|
27
|
+
class BsTypeaheadItemDirective {
|
|
28
|
+
constructor() {
|
|
29
|
+
this.templateRef = inject(TemplateRef);
|
|
30
|
+
/** Type carrier only; never read at runtime. */
|
|
31
|
+
this.bsTypeaheadItemOf = input(undefined, /* @ts-ignore */
|
|
32
|
+
...(ngDevMode ? [{ debugName: "bsTypeaheadItemOf" }] : /* istanbul ignore next */ []));
|
|
33
|
+
}
|
|
34
|
+
static ngTemplateContextGuard(_dir, ctx) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BsTypeaheadItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
38
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.8", type: BsTypeaheadItemDirective, isStandalone: true, selector: "[bsTypeaheadItem]", inputs: { bsTypeaheadItemOf: { classPropertyName: "bsTypeaheadItemOf", publicName: "bsTypeaheadItemOf", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
|
|
39
|
+
}
|
|
40
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BsTypeaheadItemDirective, decorators: [{
|
|
41
|
+
type: Directive,
|
|
42
|
+
args: [{ selector: '[bsTypeaheadItem]' }]
|
|
43
|
+
}], propDecorators: { bsTypeaheadItemOf: [{ type: i0.Input, args: [{ isSignal: true, alias: "bsTypeaheadItemOf", required: false }] }] } });
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Typeahead: a text input with asynchronous suggestions and free text.
|
|
47
|
+
*
|
|
48
|
+
* The first component built on the headless-core architecture (#436): all
|
|
49
|
+
* behaviour lives in `TypeaheadMachine` (`@mintplayer/ui-core/typeahead`); this
|
|
50
|
+
* component renders its own Angular template from the machine's snapshot and
|
|
51
|
+
* applies the core's ARIA bags with `[mpProps]`. Because it is an Angular
|
|
52
|
+
* template, Angular SSR emits a real, named `<input>` that submits free text
|
|
53
|
+
* with JavaScript disabled, and hydration attaches to that same node.
|
|
54
|
+
*
|
|
55
|
+
* Value = the term (string). `selectedItem()` holds the last picked item until
|
|
56
|
+
* the text changes. Usable with `[(value)]`, `[(ngModel)]`, `formControlName`.
|
|
57
|
+
*/
|
|
12
58
|
class BsTypeaheadComponent {
|
|
13
59
|
constructor() {
|
|
14
|
-
|
|
15
|
-
this.
|
|
16
|
-
...(ngDevMode ? [{ debugName: "
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
60
|
+
/** Supplies suggestions for a settled term; a newer term aborts the previous request. */
|
|
61
|
+
this.provider = input(null, /* @ts-ignore */
|
|
62
|
+
...(ngDevMode ? [{ debugName: "provider" }] : /* istanbul ignore next */ []));
|
|
63
|
+
/** Quiet time after the last keystroke, ms. 0 requests synchronously. */
|
|
64
|
+
this.debounceMs = input(200, /* @ts-ignore */
|
|
65
|
+
...(ngDevMode ? [{ debugName: "debounceMs" }] : /* istanbul ignore next */ []));
|
|
66
|
+
/** A trimmed term shorter than this closes the list without querying. */
|
|
67
|
+
this.minLength = input(1, /* @ts-ignore */
|
|
68
|
+
...(ngDevMode ? [{ debugName: "minLength" }] : /* istanbul ignore next */ []));
|
|
69
|
+
this.disabled = input(false, /* @ts-ignore */
|
|
70
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
71
|
+
/** The text a pick writes into the input. Default: `item.text`, else `String(item)`. */
|
|
72
|
+
this.itemText = input(undefined, /* @ts-ignore */
|
|
73
|
+
...(ngDevMode ? [{ debugName: "itemText" }] : /* istanbul ignore next */ []));
|
|
74
|
+
/** Row identity for keyed rendering. Default: `itemText`. */
|
|
75
|
+
this.itemKey = input(undefined, /* @ts-ignore */
|
|
76
|
+
...(ngDevMode ? [{ debugName: "itemKey" }] : /* istanbul ignore next */ []));
|
|
77
|
+
/** Submitted with a native `<form>` under this name (also with JavaScript disabled). */
|
|
78
|
+
this.name = input(null, /* @ts-ignore */
|
|
79
|
+
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
80
|
+
/** Accessible name of the input. A host `aria-label` or `aria-labelledby` wins. */
|
|
22
81
|
this.inputLabel = input(null, /* @ts-ignore */
|
|
23
82
|
...(ngDevMode ? [{ debugName: "inputLabel" }] : /* istanbul ignore next */ []));
|
|
24
|
-
this.
|
|
25
|
-
...(ngDevMode ? [{ debugName: "
|
|
26
|
-
this.
|
|
27
|
-
...(ngDevMode ? [{ debugName: "
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
this.
|
|
36
|
-
...(ngDevMode ? [{ debugName: "
|
|
37
|
-
this.
|
|
38
|
-
...(ngDevMode ? [{ debugName: "isLoadingText" }] : /* istanbul ignore next */ []));
|
|
39
|
-
this.noSuggestionsText = input('No suggestions found', /* @ts-ignore */
|
|
40
|
-
...(ngDevMode ? [{ debugName: "noSuggestionsText" }] : /* istanbul ignore next */ []));
|
|
41
|
-
this.resultsAnnouncementSingular = input('1 result found', /* @ts-ignore */
|
|
42
|
-
...(ngDevMode ? [{ debugName: "resultsAnnouncementSingular" }] : /* istanbul ignore next */ []));
|
|
43
|
-
this.resultsAnnouncementPlural = input((count) => `${count} results found`, /* @ts-ignore */
|
|
44
|
-
...(ngDevMode ? [{ debugName: "resultsAnnouncementPlural" }] : /* istanbul ignore next */ []));
|
|
45
|
-
this.provideSuggestions = output();
|
|
46
|
-
this.suggestionSelected = output();
|
|
83
|
+
this.loadingLabel = input(undefined, /* @ts-ignore */
|
|
84
|
+
...(ngDevMode ? [{ debugName: "loadingLabel" }] : /* istanbul ignore next */ []));
|
|
85
|
+
this.noResultsLabel = input(undefined, /* @ts-ignore */
|
|
86
|
+
...(ngDevMode ? [{ debugName: "noResultsLabel" }] : /* istanbul ignore next */ []));
|
|
87
|
+
/** Spoken once per settled request, e.g. `n => n + ' resultaten'`. */
|
|
88
|
+
this.resultsLabel = input(undefined, /* @ts-ignore */
|
|
89
|
+
...(ngDevMode ? [{ debugName: "resultsLabel" }] : /* istanbul ignore next */ []));
|
|
90
|
+
/** A persistent validation message, wired to the input with aria-errormessage. */
|
|
91
|
+
this.errorText = input(null, /* @ts-ignore */
|
|
92
|
+
...(ngDevMode ? [{ debugName: "errorText" }] : /* istanbul ignore next */ []));
|
|
93
|
+
/** The term. Two-way; also the ControlValueAccessor value. */
|
|
94
|
+
this.value = model('', /* @ts-ignore */
|
|
95
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
96
|
+
this.select = output();
|
|
47
97
|
this.submitted = output();
|
|
48
|
-
this.
|
|
98
|
+
this.opened = output();
|
|
99
|
+
this.closed = output();
|
|
100
|
+
this.loadError = output();
|
|
101
|
+
this.itemTemplate = contentChild(BsTypeaheadItemDirective, /* @ts-ignore */
|
|
102
|
+
...(ngDevMode ? [{ debugName: "itemTemplate" }] : /* istanbul ignore next */ []));
|
|
103
|
+
this.inputRef = viewChild.required('input', /* @ts-ignore */
|
|
104
|
+
...(ngDevMode ? [{ debugName: "inputRef" }] : /* istanbul ignore next */ []));
|
|
105
|
+
this.id = inject(BsIdService).next('bs-typeahead');
|
|
106
|
+
/**
|
|
107
|
+
* Host transparency: a consumer's `aria-*`, `id` and `tabindex` on
|
|
108
|
+
* `<bs-typeahead>` land on the role-bearing input (`id` and `tabindex` are
|
|
109
|
+
* moved, so no duplicate id and no dead tab stop on the host). A consumer
|
|
110
|
+
* `role` is NOT forwarded: the input's role is `combobox` by contract. Read
|
|
111
|
+
* once, in the constructor, so the server render carries them too.
|
|
112
|
+
*/
|
|
113
|
+
this.hostAria = takeHostAria(inject(ElementRef).nativeElement);
|
|
114
|
+
this.disabledByCva = signal(false, /* @ts-ignore */
|
|
115
|
+
...(ngDevMode ? [{ debugName: "disabledByCva" }] : /* istanbul ignore next */ []));
|
|
116
|
+
this.onChange = () => undefined;
|
|
117
|
+
this.onTouched = () => undefined;
|
|
118
|
+
this.trackItem = (index, item) => this.machine.itemKeyOf(item) ?? index;
|
|
119
|
+
const host = inject(ElementRef).nativeElement;
|
|
120
|
+
useScopedStyles(TYPEAHEAD_SCOPE, typeaheadScopedStyles);
|
|
121
|
+
this.machine = new TypeaheadMachine({
|
|
122
|
+
id: this.id,
|
|
123
|
+
value: this.value(),
|
|
124
|
+
onChange: (term) => {
|
|
125
|
+
this.value.set(term);
|
|
126
|
+
this.onChange(term);
|
|
127
|
+
},
|
|
128
|
+
onSelect: (item) => this.select.emit(item),
|
|
129
|
+
onSubmit: (term) => this.submitted.emit(term),
|
|
130
|
+
onOpen: () => this.opened.emit(),
|
|
131
|
+
onClose: () => {
|
|
132
|
+
this.closed.emit();
|
|
133
|
+
this.onTouched();
|
|
134
|
+
},
|
|
135
|
+
onError: (error) => this.loadError.emit(error),
|
|
136
|
+
});
|
|
137
|
+
this.state = machineSignal(this.machine);
|
|
138
|
+
this.api = computed(() => {
|
|
139
|
+
const api = connect(this.state(), this.id, { name: this.name() });
|
|
140
|
+
// A host aria-label / aria-labelledby wins over inputLabel (naming conformance).
|
|
141
|
+
return { ...api, input: { ...api.input, ...this.hostAria } };
|
|
142
|
+
}, /* @ts-ignore */
|
|
143
|
+
...(ngDevMode ? [{ debugName: "api" }] : /* istanbul ignore next */ []));
|
|
144
|
+
this.selectedItem = computed(() => this.state().selectedItem, /* @ts-ignore */
|
|
145
|
+
...(ngDevMode ? [{ debugName: "selectedItem" }] : /* istanbul ignore next */ []));
|
|
146
|
+
inject(DestroyRef).onDestroy(() => this.machine.destroy());
|
|
147
|
+
// Inputs → machine configuration. Each effect reads one input so an
|
|
148
|
+
// unrelated input change does not re-apply everything.
|
|
49
149
|
effect(() => {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
this.isLoading.set(false);
|
|
53
|
-
if (this.requestInFlight) {
|
|
54
|
-
this.requestInFlight = false;
|
|
55
|
-
this.announceResults(suggestions.length);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
150
|
+
const provider = this.provider();
|
|
151
|
+
this.machine.provider = provider ? adaptProvider(provider) : null;
|
|
58
152
|
});
|
|
153
|
+
effect(() => (this.machine.debounceMs = this.debounceMs()));
|
|
154
|
+
effect(() => (this.machine.minLength = this.minLength()));
|
|
155
|
+
effect(() => (this.machine.itemText = this.itemText()));
|
|
156
|
+
effect(() => (this.machine.itemKey = this.itemKey()));
|
|
157
|
+
effect(() => this.machine.setDisabled(this.disabled() || this.disabledByCva()));
|
|
158
|
+
effect(() => this.machine.setErrorText(this.errorText()));
|
|
159
|
+
effect(() => {
|
|
160
|
+
const labels = { input: this.inputLabel() };
|
|
161
|
+
const loading = this.loadingLabel();
|
|
162
|
+
const noResults = this.noResultsLabel();
|
|
163
|
+
const results = this.resultsLabel();
|
|
164
|
+
if (loading !== undefined)
|
|
165
|
+
labels.loading = loading;
|
|
166
|
+
if (noResults !== undefined)
|
|
167
|
+
labels.noResults = noResults;
|
|
168
|
+
if (results !== undefined)
|
|
169
|
+
labels.results = results;
|
|
170
|
+
this.machine.setLabels(labels);
|
|
171
|
+
});
|
|
172
|
+
// A consumer write to [(value)] (not an echo of our own onChange) is a programmatic set: no query.
|
|
173
|
+
effect(() => {
|
|
174
|
+
const next = this.value();
|
|
175
|
+
if (next !== untracked(() => this.machine.snapshot.term))
|
|
176
|
+
this.machine.setValue(next);
|
|
177
|
+
});
|
|
178
|
+
this.adoptPreHydrationText(host);
|
|
59
179
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
180
|
+
/**
|
|
181
|
+
* Text typed or pasted into the server-rendered input before hydration lives
|
|
182
|
+
* only in the DOM. Hydration's [value] binding would overwrite it with the
|
|
183
|
+
* empty term, and the replayed input event then reads the empty field, so it
|
|
184
|
+
* is lost. Read it here, while the host still holds the server DOM, and keep
|
|
185
|
+
* it as the term; once effects have configured the provider, re-enter it as a
|
|
186
|
+
* typed term so it notifies the model and queries.
|
|
187
|
+
*/
|
|
188
|
+
adoptPreHydrationText(host) {
|
|
189
|
+
if (!isPlatformBrowser(inject(PLATFORM_ID)))
|
|
190
|
+
return;
|
|
191
|
+
const typed = host.querySelector('input')?.value ?? '';
|
|
192
|
+
if (!typed || typed === this.machine.snapshot.term)
|
|
193
|
+
return;
|
|
194
|
+
this.machine.setValue(typed);
|
|
195
|
+
this.value.set(typed);
|
|
196
|
+
afterNextRender(() => {
|
|
197
|
+
if (this.machine.snapshot.term !== typed)
|
|
198
|
+
return; // superseded by the consumer or the user
|
|
199
|
+
this.machine.setValue('');
|
|
200
|
+
this.machine.setTerm(typed);
|
|
201
|
+
});
|
|
70
202
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
this.isOpen.set(false);
|
|
75
|
-
this.requestInFlight = false;
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
this.requestInFlight = true;
|
|
79
|
-
this.isLoading.set(true);
|
|
80
|
-
this.isOpen.set(true);
|
|
81
|
-
this.provideSuggestions.emit(value);
|
|
82
|
-
}
|
|
203
|
+
// ---- template handlers --------------------------------------------------
|
|
204
|
+
onInput(event) {
|
|
205
|
+
this.machine.setTerm(event.target.value);
|
|
83
206
|
}
|
|
84
|
-
|
|
85
|
-
this.
|
|
86
|
-
|
|
87
|
-
|
|
207
|
+
onKeydown(event) {
|
|
208
|
+
const handled = this.machine.keydown(event.key, event);
|
|
209
|
+
if (handled)
|
|
210
|
+
event.preventDefault();
|
|
88
211
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
return;
|
|
93
|
-
const suggestion = this.suggestions()[rf.activeIndex()];
|
|
94
|
-
if (suggestion) {
|
|
95
|
-
this.suggestionClicked(suggestion);
|
|
96
|
-
}
|
|
212
|
+
onBlur() {
|
|
213
|
+
this.machine.blur();
|
|
214
|
+
this.onTouched();
|
|
97
215
|
}
|
|
98
|
-
|
|
99
|
-
|
|
216
|
+
/** Focus the input. */
|
|
217
|
+
focus() {
|
|
218
|
+
this.inputRef().nativeElement.focus();
|
|
100
219
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
this.
|
|
105
|
-
this.submitted.emit(this.searchterm());
|
|
220
|
+
// ---- ControlValueAccessor -----------------------------------------------
|
|
221
|
+
writeValue(value) {
|
|
222
|
+
this.value.set(value ?? '');
|
|
223
|
+
this.machine.setValue(value);
|
|
106
224
|
}
|
|
107
|
-
|
|
108
|
-
this.
|
|
225
|
+
registerOnChange(fn) {
|
|
226
|
+
this.onChange = fn;
|
|
227
|
+
}
|
|
228
|
+
registerOnTouched(fn) {
|
|
229
|
+
this.onTouched = fn;
|
|
230
|
+
}
|
|
231
|
+
setDisabledState(isDisabled) {
|
|
232
|
+
this.disabledByCva.set(isDisabled);
|
|
109
233
|
}
|
|
110
234
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BsTypeaheadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
111
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: BsTypeaheadComponent, isStandalone: true, selector: "bs-typeahead", inputs: {
|
|
235
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: BsTypeaheadComponent, isStandalone: true, selector: "bs-typeahead", inputs: { provider: { classPropertyName: "provider", publicName: "provider", isSignal: true, isRequired: false, transformFunction: null }, debounceMs: { classPropertyName: "debounceMs", publicName: "debounceMs", isSignal: true, isRequired: false, transformFunction: null }, minLength: { classPropertyName: "minLength", publicName: "minLength", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, itemText: { classPropertyName: "itemText", publicName: "itemText", isSignal: true, isRequired: false, transformFunction: null }, itemKey: { classPropertyName: "itemKey", publicName: "itemKey", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, inputLabel: { classPropertyName: "inputLabel", publicName: "inputLabel", isSignal: true, isRequired: false, transformFunction: null }, loadingLabel: { classPropertyName: "loadingLabel", publicName: "loadingLabel", isSignal: true, isRequired: false, transformFunction: null }, noResultsLabel: { classPropertyName: "noResultsLabel", publicName: "noResultsLabel", isSignal: true, isRequired: false, transformFunction: null }, resultsLabel: { classPropertyName: "resultsLabel", publicName: "resultsLabel", isSignal: true, isRequired: false, transformFunction: null }, errorText: { classPropertyName: "errorText", publicName: "errorText", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", select: "select", submitted: "submitted", opened: "opened", closed: "closed", loadError: "loadError" }, host: { attributes: { "role": "presentation" } }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BsTypeaheadComponent), multi: true }], queries: [{ propertyName: "itemTemplate", first: true, predicate: BsTypeaheadItemDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "inputRef", first: true, predicate: ["input"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"mp-typeahead\" [mpProps]=\"api().root\">\n <input #input\n class=\"form-control\"\n type=\"text\"\n [mpProps]=\"api().input\"\n [value]=\"state().term\"\n (input)=\"onInput($event)\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"onBlur()\" />\n <ul class=\"dropdown-menu\" [mpProps]=\"api().listbox\">\n @if (api().status; as status) {\n <li class=\"ta-status\" [mpProps]=\"status.attrs\">{{ status.text }}</li>\n }\n @for (item of state().items; track trackItem($index, item); let i = $index) {\n <li class=\"dropdown-item\" [mpProps]=\"api().option(i)\" (mousedown)=\"$event.preventDefault()\" (click)=\"machine.pick(i)\">\n <ng-container *ngTemplateOutlet=\"itemTemplate()?.templateRef ?? defaultItem; context: { $implicit: item, term: state().term }\"></ng-container>\n </li>\n }\n </ul>\n <span class=\"visually-hidden\" [mpProps]=\"api().live.attrs\">{{ api().live.text }}</span>\n @if (api().error; as error) {\n <div class=\"ta-error\" [mpProps]=\"error.attrs\">{{ error.text }}</div>\n }\n</div>\n<ng-template #defaultItem let-item>{{ machine.itemTextOf(item) }}</ng-template>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: MpPropsDirective, selector: "[mpProps]", inputs: ["mpProps"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
112
236
|
}
|
|
113
237
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: BsTypeaheadComponent, decorators: [{
|
|
114
238
|
type: Component,
|
|
115
|
-
args: [{ selector: 'bs-typeahead', imports: [
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
239
|
+
args: [{ selector: 'bs-typeahead', imports: [NgTemplateOutlet, MpPropsDirective], providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => BsTypeaheadComponent), multi: true }], changeDetection: ChangeDetectionStrategy.OnPush, host: { role: 'presentation' }, template: "<div class=\"mp-typeahead\" [mpProps]=\"api().root\">\n <input #input\n class=\"form-control\"\n type=\"text\"\n [mpProps]=\"api().input\"\n [value]=\"state().term\"\n (input)=\"onInput($event)\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"onBlur()\" />\n <ul class=\"dropdown-menu\" [mpProps]=\"api().listbox\">\n @if (api().status; as status) {\n <li class=\"ta-status\" [mpProps]=\"status.attrs\">{{ status.text }}</li>\n }\n @for (item of state().items; track trackItem($index, item); let i = $index) {\n <li class=\"dropdown-item\" [mpProps]=\"api().option(i)\" (mousedown)=\"$event.preventDefault()\" (click)=\"machine.pick(i)\">\n <ng-container *ngTemplateOutlet=\"itemTemplate()?.templateRef ?? defaultItem; context: { $implicit: item, term: state().term }\"></ng-container>\n </li>\n }\n </ul>\n <span class=\"visually-hidden\" [mpProps]=\"api().live.attrs\">{{ api().live.text }}</span>\n @if (api().error; as error) {\n <div class=\"ta-error\" [mpProps]=\"error.attrs\">{{ error.text }}</div>\n }\n</div>\n<ng-template #defaultItem let-item>{{ machine.itemTextOf(item) }}</ng-template>\n" }]
|
|
240
|
+
}], ctorParameters: () => [], propDecorators: { provider: [{ type: i0.Input, args: [{ isSignal: true, alias: "provider", required: false }] }], debounceMs: [{ type: i0.Input, args: [{ isSignal: true, alias: "debounceMs", required: false }] }], minLength: [{ type: i0.Input, args: [{ isSignal: true, alias: "minLength", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], itemText: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemText", required: false }] }], itemKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemKey", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], inputLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputLabel", required: false }] }], loadingLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "loadingLabel", required: false }] }], noResultsLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "noResultsLabel", required: false }] }], resultsLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "resultsLabel", required: false }] }], errorText: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorText", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], select: [{ type: i0.Output, args: ["select"] }], submitted: [{ type: i0.Output, args: ["submitted"] }], opened: [{ type: i0.Output, args: ["opened"] }], closed: [{ type: i0.Output, args: ["closed"] }], loadError: [{ type: i0.Output, args: ["loadError"] }], itemTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => BsTypeaheadItemDirective), { isSignal: true }] }], inputRef: [{ type: i0.ViewChild, args: ['input', { isSignal: true }] }] } });
|
|
241
|
+
/** Collect `aria-*` (copied) and `id` / `tabindex` (moved) from the host element. */
|
|
242
|
+
function takeHostAria(host) {
|
|
243
|
+
const bag = Object.fromEntries(Array.from(host.attributes)
|
|
244
|
+
.filter(({ name }) => name.startsWith('aria-') || name === 'id' || name === 'tabindex')
|
|
245
|
+
.map(({ name, value }) => [name, value]));
|
|
246
|
+
['id', 'tabindex'].filter((name) => name in bag).forEach((name) => host.removeAttribute(name));
|
|
247
|
+
return bag;
|
|
248
|
+
}
|
|
249
|
+
/** Promise or Observable in, Promise out; the Observable is unsubscribed when the request aborts. */
|
|
250
|
+
function adaptProvider(provider) {
|
|
251
|
+
return (term, request) => {
|
|
252
|
+
const result = provider(term, request);
|
|
253
|
+
if (!isObservable(result))
|
|
254
|
+
return result;
|
|
255
|
+
return new Promise((resolve, reject) => {
|
|
256
|
+
const subscription = result.subscribe({
|
|
257
|
+
next: (items) => {
|
|
258
|
+
resolve(items);
|
|
259
|
+
subscription.unsubscribe();
|
|
260
|
+
},
|
|
261
|
+
error: reject,
|
|
262
|
+
complete: () => resolve([]),
|
|
263
|
+
});
|
|
264
|
+
request.signal.addEventListener('abort', () => {
|
|
265
|
+
subscription.unsubscribe();
|
|
266
|
+
reject(abortError());
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
};
|
|
270
|
+
}
|
|
124
271
|
|
|
125
272
|
/**
|
|
126
273
|
* Generated bundle index. Do not edit.
|
|
127
274
|
*/
|
|
128
275
|
|
|
129
|
-
export { BsTypeaheadComponent };
|
|
276
|
+
export { BsTypeaheadComponent, BsTypeaheadItemDirective };
|
|
130
277
|
//# sourceMappingURL=mintplayer-ng-bootstrap-typeahead.mjs.map
|