@mintplayer/ng-bootstrap 22.25.0 → 22.27.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-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-tile-manager.mjs +316 -174
- package/fesm2022/mintplayer-ng-bootstrap-tile-manager.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-tile-manager.d.ts +157 -42
- package/types/mintplayer-ng-bootstrap-typeahead.d.ts +141 -32
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mintplayer-ng-bootstrap-tile-manager.mjs","sources":["../../../../libs/mintplayer-ng-bootstrap/tile-manager/src/lib/components/tile.component.ts","../../../../libs/mintplayer-ng-bootstrap/tile-manager/src/lib/components/tile-manager.component.ts","../../../../libs/mintplayer-ng-bootstrap/tile-manager/src/lib/components/tile-header.component.ts","../../../../libs/mintplayer-ng-bootstrap/tile-manager/mintplayer-ng-bootstrap-tile-manager.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n TemplateRef,\n input,\n output,\n viewChild,\n} from '@angular/core';\nimport type { TilePosition } from '@mintplayer/web-components/tile-manager';\n\n/**\n * One tile inside a `<bs-tile-manager>`.\n *\n * The component captures two `TemplateRef`s — one for the header (a child\n * `<bs-tile-header>`) and one for the body (everything else) — which the\n * manager projects into named slots on the underlying `<mp-tile-manager>`\n * web component (`${id}-header` and `${id}-content`).\n */\n@Component({\n selector: 'bs-tile',\n template: `\n <ng-template #headerTpl>\n <ng-content select=\"bs-tile-header\"></ng-content>\n </ng-template>\n <ng-template #contentTpl>\n <ng-content></ng-content>\n </ng-template>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BsTileComponent {\n readonly id = input.required<string>();\n readonly position = input.required<TilePosition>();\n readonly disableMove = input<boolean>(false);\n readonly disableResize = input<boolean>(false);\n readonly label = input<string | null>(null);\n\n readonly positionChange = output<TilePosition>();\n\n readonly headerTpl = viewChild.required<TemplateRef<unknown>>('headerTpl');\n readonly contentTpl = viewChild.required<TemplateRef<unknown>>('contentTpl');\n}\n","import {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n CUSTOM_ELEMENTS_SCHEMA,\n ElementRef,\n computed,\n contentChildren,\n effect,\n input,\n output,\n viewChild,\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { BsTileComponent } from './tile.component';\nimport {\n type MintTile,\n MintTileManagerElement,\n type TileDragMode,\n type TileResizeMode,\n type TileLayoutSnapshot,\n type TileGestureBlocked,\n type TilePosition,\n} from '@mintplayer/web-components/tile-manager';\n\n// Side-effect import: registers <mp-tile-manager>.\nimport '@mintplayer/web-components/tile-manager';\n\n@Component({\n selector: 'bs-tile-manager',\n template: `\n <mp-tile-manager\n #manager\n class=\"bs-tile-manager\"\n [attr.column-count]=\"columnCountAttr()\"\n [attr.min-column-width]=\"minColumnWidth()\"\n [attr.min-row-height]=\"minRowHeight()\"\n [attr.gap]=\"gap()\"\n [attr.drag-mode]=\"dragMode()\"\n [attr.resize-mode]=\"resizeMode()\"\n [attr.animate-reflow]=\"animateReflow() ? '' : null\"\n [attr.label]=\"label()\"\n (tilelayoutchange)=\"onLayoutChange($event)\"\n (tilepositionchange)=\"onPositionChange($event)\"\n (tilegestureblocked)=\"onGestureBlocked($event)\"\n >\n @for (tile of tiles(); track tile.id()) {\n <div [attr.slot]=\"tile.id() + '-header'\" class=\"bs-tile-slot\">\n <ng-container *ngTemplateOutlet=\"tile.headerTpl()\"></ng-container>\n </div>\n <div [attr.slot]=\"tile.id() + '-content'\" class=\"bs-tile-slot\">\n <ng-container *ngTemplateOutlet=\"tile.contentTpl()\"></ng-container>\n </div>\n }\n </mp-tile-manager>\n `,\n styles: [\n `\n :host {\n display: block;\n width: 100%;\n }\n .bs-tile-manager {\n display: block;\n width: 100%;\n }\n .bs-tile-slot {\n display: contents;\n }\n `,\n ],\n imports: [NgTemplateOutlet],\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BsTileManagerComponent implements AfterViewInit {\n readonly columnCount = input<number | null>(null);\n readonly minColumnWidth = input<string>('200px');\n readonly minRowHeight = input<string>('8rem');\n readonly gap = input<string>('0.5rem');\n readonly dragMode = input<TileDragMode>('header');\n readonly resizeMode = input<TileResizeMode>('hover');\n readonly animateReflow = input<boolean>(true);\n readonly label = input<string | null>(null);\n\n readonly layoutChange = output<TileLayoutSnapshot>();\n readonly gestureBlocked = output<TileGestureBlocked>();\n\n readonly tiles = contentChildren(BsTileComponent);\n // Deliberately NOT viewChild.required: public methods read it, and a caller that reaches\n // this component through DI (a child's constructor, say) can call one before this\n // component's view exists. There, NG0951 would throw where the guard is a no-op.\n readonly managerRef = viewChild<ElementRef<MintTileManagerElement>>('manager');\n\n protected readonly columnCountAttr = computed(() => {\n const c = this.columnCount();\n return c && c > 0 ? String(c) : null;\n });\n\n // Snapshot of Angular tile state, derived from contentChildren signals.\n // Re-runs whenever any tile's id, position, disableMove, disableResize, or label changes.\n // contentChildren() can surface a child before Angular has finished binding its\n // required inputs; reading them then throws NG0950. flatMap-with-try lets us\n // skip the not-yet-bound entry — the effect re-runs once binding completes.\n private readonly tilesSnapshot = computed<MintTile[]>(() =>\n this.tiles().flatMap((t) => {\n try {\n return [{\n id: t.id(),\n position: t.position(),\n disableMove: t.disableMove(),\n disableResize: t.disableResize(),\n label: t.label(),\n }];\n } catch {\n return [];\n }\n }),\n );\n\n constructor() {\n effect(() => {\n const snapshot = this.tilesSnapshot();\n const ref = this.managerRef();\n if (!ref) return;\n ref.nativeElement.tiles = snapshot;\n });\n }\n\n ngAfterViewInit(): void {\n // First push happens via the constructor effect once the view is alive.\n }\n\n /** Returns the current layout. Mirrors `BsDockManagerComponent.captureLayout()`. */\n captureLayout(): TileLayoutSnapshot {\n const ref = this.managerRef();\n if (!ref) return [];\n return Array.from(ref.nativeElement.tiles ?? []).map((t) => ({\n id: t.id,\n position: { ...t.position },\n }));\n }\n\n protected onLayoutChange(event: Event): void {\n const detail = (event as CustomEvent<TileLayoutSnapshot>).detail;\n if (detail) this.layoutChange.emit(detail);\n }\n\n protected onPositionChange(event: Event): void {\n const detail = (event as CustomEvent<{ id: string; position: TilePosition }>).detail;\n if (!detail) return;\n const tile = this.tiles().find((t) => t.id() === detail.id);\n tile?.positionChange.emit(detail.position);\n }\n\n protected onGestureBlocked(event: Event): void {\n const detail = (event as CustomEvent<TileGestureBlocked>).detail;\n if (detail) this.gestureBlocked.emit(detail);\n }\n}\n","import { ChangeDetectionStrategy, Component } from '@angular/core';\n\n@Component({\n selector: 'bs-tile-header',\n template: `<ng-content></ng-content>`,\n styles: [\n `:host {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.5rem 0.75rem;\n font-size: 0.875rem;\n font-weight: 500;\n color: var(--bs-body-color, inherit);\n background: linear-gradient(to bottom, rgba(var(--bs-primary-rgb, 13, 110, 253), 0.10), rgba(var(--bs-primary-rgb, 13, 110, 253), 0.04));\n border-bottom: 1px solid var(--bs-border-color, #dee2e6);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n touch-action: none;\n user-select: none;\n -webkit-user-select: none;\n -webkit-touch-callout: none;\n }`,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BsTileHeaderComponent {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAUA;;;;;;;AAOG;MAaU,eAAe,CAAA;AAZ5B,IAAA,WAAA,GAAA;QAaW,IAAA,CAAA,EAAE,GAAG,KAAK,CAAC,QAAQ;+EAAU;QAC7B,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAC,QAAQ;qFAAgB;QACzC,IAAA,CAAA,WAAW,GAAG,KAAK,CAAU,KAAK;wFAAC;QACnC,IAAA,CAAA,aAAa,GAAG,KAAK,CAAU,KAAK;0FAAC;QACrC,IAAA,CAAA,KAAK,GAAG,KAAK,CAAgB,IAAI;kFAAC;QAElC,IAAA,CAAA,cAAc,GAAG,MAAM,EAAgB;AAEvC,QAAA,IAAA,CAAA,SAAS,GAAG,SAAS,CAAC,QAAQ,CAAuB,WAAW;sFAAC;AACjE,QAAA,IAAA,CAAA,UAAU,GAAG,SAAS,CAAC,QAAQ,CAAuB,YAAY;uFAAC;AAC7E,IAAA;8GAXY,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CA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A,EAAA,IAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,CAAA,EAAA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,eAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,UAAA,CAAA,MAAA,eAAe,qEAIoB,SAAS,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;MCjElE,qBAAqB,CAAA;8GAArB,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAArB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,qBAAqB,0EAvBtB,CAAA,yBAAA,CAA2B,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,ydAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAuB1B,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAzBjC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,gBAAgB,EAAA,QAAA,EAChB,CAAA,yBAAA,CAA2B,EAAA,eAAA,EAqBpB,uBAAuB,CAAC,MAAM,EAAA,MAAA,EAAA,CAAA,ydAAA,CAAA,EAAA;;;ACzBjD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"mintplayer-ng-bootstrap-tile-manager.mjs","sources":["../../../../libs/mintplayer-ng-bootstrap/tile-manager/src/lib/directives/tile-template.directives.ts","../../../../libs/mintplayer-ng-bootstrap/tile-manager/src/lib/components/tile-manager.component.ts","../../../../libs/mintplayer-ng-bootstrap/tile-manager/src/lib/components/tile-manager.component.html","../../../../libs/mintplayer-ng-bootstrap/tile-manager/mintplayer-ng-bootstrap-tile-manager.ts"],"sourcesContent":["import { DestroyRef, Directive, inject, Injector, input, TemplateRef } from '@angular/core';\nimport type { MintTile } from '@mintplayer/ui-core/tile-manager';\n\n/** The context of a `*bsTile` template: the tile it renders. */\nexport interface BsTileContext<T extends MintTile = MintTile> {\n $implicit: T;\n}\n\n/**\n * One tile's slots. The manager stamps the `*bsTile` template once per tile with an injector\n * providing that tile's `BsTileSlots`; `*bsTileHeader` / `*bsTileContent` inside it register\n * their template here, and the manager renders them into the tile's header and body. Kept per\n * tile id, so a new tile object (a locked panel, say) updates the view instead of rebuilding it.\n */\nexport class BsTileSlots {\n header: TemplateRef<unknown> | null = null;\n content: TemplateRef<unknown> | null = null;\n readonly injector: Injector;\n\n constructor(parent: Injector) {\n this.injector = Injector.create({ providers: [{ provide: BsTileSlots, useValue: this }], parent });\n }\n}\n\n/**\n * Declares the markup of every tile, once, inside `<bs-tile-manager>`. The header and body are\n * its direct `*bsTileHeader` / `*bsTileContent` children, and both see the tile variable.\n *\n * ```html\n * <bs-tile-manager [(layouts)]=\"layouts\">\n * <ng-container *bsTile=\"let tile of tiles()\">\n * <span *bsTileHeader>{{ tile.title }}</span>\n * <div *bsTileContent>{{ tile.body }}</div>\n * </ng-container>\n * </bs-tile-manager>\n * ```\n *\n * `of` is the manager's tile list, like `ngFor`'s: the manager reads it from here.\n */\n@Directive({ selector: '[bsTile]' })\nexport class BsTileDirective<T extends MintTile = MintTile> {\n readonly templateRef = inject<TemplateRef<BsTileContext<T>>>(TemplateRef);\n /** The visible tiles, in DOM order. */\n readonly bsTileOf = input<readonly T[] | null | undefined>(undefined);\n\n static ngTemplateContextGuard<T extends MintTile>(_dir: BsTileDirective<T>, ctx: unknown): ctx is BsTileContext<T> {\n return true;\n }\n}\n\n/** A tile's header: the drag handle in `dragMode=\"header\"`. Only valid inside `*bsTile`. */\n@Directive({ selector: '[bsTileHeader]' })\nexport class BsTileHeaderDirective {\n constructor() {\n register('header');\n }\n}\n\n/** A tile's body. Only valid inside `*bsTile`. */\n@Directive({ selector: '[bsTileContent]' })\nexport class BsTileContentDirective {\n constructor() {\n register('content');\n }\n}\n\nfunction register(slot: 'header' | 'content'): void {\n const slots = inject(BsTileSlots);\n const template = inject(TemplateRef);\n slots[slot] = template;\n inject(DestroyRef).onDestroy(() => {\n if (slots[slot] === template) slots[slot] = null;\n });\n}\n","import { DOCUMENT, isPlatformServer, NgTemplateOutlet } from '@angular/common';\nimport {\n afterNextRender,\n ChangeDetectionStrategy,\n Component,\n computed,\n contentChild,\n DestroyRef,\n effect,\n ElementRef,\n HostAttributeToken,\n inject,\n Injector,\n input,\n linkedSignal,\n model,\n output,\n PLATFORM_ID,\n untracked,\n viewChild,\n} from '@angular/core';\nimport { BsIdService } from '@mintplayer/ng-bootstrap/a11y';\nimport { machineSignal, MpPropsDirective, useScopedStyles } from '@mintplayer/ng-bootstrap/machine';\nimport { writeScopedStyleTag } from '@mintplayer/ui-core/scoped-styles';\nimport {\n breakpointCss,\n connect,\n DEFAULT_GAP,\n DEFAULT_MIN_COLUMN_WIDTH,\n gridPointer,\n readCellMetrics,\n TILE_MANAGER_SCOPE,\n TileFlip,\n TileManagerMachine,\n tileManagerScopedStyles,\n type MintTile,\n type TileBreakpoint,\n type TileDragMode,\n type TileGestureBlocked,\n type TileLayoutChange,\n type TileLayouts,\n type TileLayoutSnapshot,\n type TileManagerInputPatch,\n type TileManagerMessages,\n type TilePart,\n type TileResizeMode,\n} from '@mintplayer/ui-core/tile-manager';\nimport { BsTileDirective, BsTileSlots, type BsTileContext } from '../directives/tile-template.directives';\n\n/** Payload of `columnCountChange`. */\nexport interface BsTileColumnCountChange {\n columnCount: number;\n previous: number | null;\n}\n\n/**\n * Tile manager: a dashboard grid whose tiles the user moves and resizes, with one layout per\n * column count (#440).\n *\n * The Angular front of `TileManagerMachine` (`@mintplayer/ui-core/tile-manager`). Every decision\n * (layout per column count, gestures, keyboard, ARIA) is the machine's; this component renders\n * its own template from `connect()`'s bags with `[mpProps]`, measures the grid, owns pointer\n * capture and the FLIP animation, and turns the machine's events into outputs. Tile header and\n * body come from the `*bsTileHeader` / `*bsTileContent` templates inside one `*bsTile` block.\n *\n * SSR: the whole tree is rendered, plus a `<style>` in `<head>` holding the `@container` rules\n * that place every tile at every column count (D14), so the server HTML paints the right layout\n * with no JS. No-JS tier 2: before the first measure the tiles are named groups with no tab stop\n * or grips.\n */\n@Component({\n selector: 'bs-tile-manager',\n templateUrl: './tile-manager.component.html',\n imports: [NgTemplateOutlet, MpPropsDirective],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'd-block' },\n})\nexport class BsTileManagerComponent<T extends MintTile = MintTile> {\n /** The `*bsTile` block: the tile markup, and through its `of` the tiles themselves. */\n readonly tileTemplate = contentChild<BsTileDirective<T>>(BsTileDirective);\n /**\n * The visible tiles, in DOM order: `*bsTile=\"let tile of tiles()\"`. Read from the directive\n * rather than pushed by it: its input is not set yet when its constructor runs, and a signal\n * write while the view renders is NG0600.\n */\n readonly tiles = computed<readonly T[]>(() => this.tileTemplate()?.bsTileOf() ?? []);\n /** One layout per column count. Two-way: a commit writes the full next record. */\n readonly layouts = model<TileLayouts>({});\n /** Explicit `{ minWidth, columns }` map. Wins over `stackBelow` and the generated map. */\n readonly breakpoints = input<readonly TileBreakpoint[] | null>(null);\n /** px. Below this width the tiles stack in one column. */\n readonly stackBelow = input<number | null>(null);\n /** Upper bound of the generated map when `layouts` is empty. */\n readonly maxColumns = input<number>(6);\n /** px. No column is narrower than this, except at one column. */\n readonly minColumnWidth = input<number>(DEFAULT_MIN_COLUMN_WIDTH);\n /** CSS length of one grid row. */\n readonly minRowHeight = input<string>('8rem');\n /** px between tiles. */\n readonly gap = input<number>(DEFAULT_GAP);\n readonly dragMode = input<TileDragMode>('header');\n readonly resizeMode = input<TileResizeMode>('hover');\n /** Animate tiles to their new place when the layout reflows. Off under reduced motion. */\n readonly animateReflow = input<boolean>(true);\n /** Accessible name of the board. A host `aria-label` / `aria-labelledby` wins. */\n readonly label = input<string | null>(null);\n /** Localized strings for the board's descriptions and announcements. */\n readonly messages = input<Partial<TileManagerMessages>>({});\n\n /** Each step of a gesture or keyboard move: the layout as it would be committed. */\n readonly layoutPreview = output<TileLayoutChange>();\n /** A commit, with the full layouts record and the stale narrower counts (D15). */\n readonly layoutChange = output<TileLayoutChange>();\n readonly columnCountChange = output<BsTileColumnCountChange>();\n readonly gestureBlocked = output<TileGestureBlocked>();\n\n readonly id = inject(BsIdService).next('bs-tile-manager');\n readonly machine = new TileManagerMachine({ vibrate: (ms) => navigator.vibrate?.(ms) });\n readonly state = machineSignal(this.machine);\n /** Host transparency: a consumer's aria-* on `<bs-tile-manager>` lands on the region. */\n private readonly hostAria = takeHostAria();\n readonly api = computed(() => {\n this.state();\n const api = connect(this.machine, this.id);\n const describedBy = [api.board.attrs['aria-describedby'], this.hostAria['aria-describedby']].filter(Boolean).join(' ') || null;\n return { ...api, board: { ...api.board, attrs: { ...api.board.attrs, ...this.hostAria, 'aria-describedby': describedBy } } };\n });\n /** The `*bsTile` context per tile id, stable across change detection. */\n readonly tileContext = computed(() => new Map(this.tiles().map((t) => [t.id, { $implicit: t } as BsTileContext<T>])));\n /** Slots per tile id, kept while the id stays so the tile's view is reused, not rebuilt. */\n readonly tileSlots = linkedSignal<readonly T[], ReadonlyMap<string, BsTileSlots>>({\n source: this.tiles,\n computation: (tiles, previous) => new Map(tiles.map((t) => [t.id, previous?.value.get(t.id) ?? new BsTileSlots(this.injector)])),\n });\n\n // Not `.required`: the machine notifies (onChange) while effects configure it, before the view exists.\n private readonly grid = viewChild<ElementRef<HTMLElement>>('grid');\n private readonly host = inject(ElementRef).nativeElement as HTMLElement;\n private readonly injector = inject(Injector);\n private readonly flip = new TileFlip();\n private lastRendered: TileLayoutSnapshot | null = null;\n private focusSeq = 0;\n private resizeObserver: ResizeObserver | null = null;\n private measureFrame = 0;\n private width = 0;\n\n constructor() {\n useScopedStyles(TILE_MANAGER_SCOPE, tileManagerScopedStyles);\n\n // Inputs → machine. One effect per input, so an unrelated input change never re-pushes a\n // stale controlled `layouts` over the layout the machine just committed (S3).\n const forward = <K extends keyof TileManagerInputPatch>(key: K, read: () => TileManagerInputPatch[K]) =>\n effect(() => {\n const value = read();\n untracked(() => this.machine.setInputs({ [key]: value } as TileManagerInputPatch));\n });\n forward('tiles', this.tiles);\n forward('breakpoints', this.breakpoints);\n forward('stackBelow', this.stackBelow);\n forward('maxColumns', this.maxColumns);\n forward('minColumnWidth', this.minColumnWidth);\n forward('minRowHeight', this.minRowHeight);\n forward('gap', this.gap);\n forward('dragMode', this.dragMode);\n forward('resizeMode', this.resizeMode);\n forward('label', this.label);\n forward('messages', this.messages);\n // A consumer write to [(layouts)], not the echo of our own commit.\n effect(() => {\n const layouts = this.layouts();\n if (layouts !== untracked(() => this.machine.snapshot.layouts)) untracked(() => this.machine.setInputs({ layouts }));\n });\n\n const offEvents = this.machine.onEvent((e) => {\n switch (e.type) {\n case 'layoutchange': {\n const { type: _, ...change } = e;\n this.layouts.set(change.layouts);\n this.layoutChange.emit(change);\n break;\n }\n case 'layoutpreview': {\n const { type: _, ...change } = e;\n this.layoutPreview.emit(change);\n break;\n }\n case 'columncountchange':\n this.columnCountChange.emit({ columnCount: e.columnCount, previous: e.previous });\n break;\n case 'gestureblocked': {\n const { type: _, ...blocked } = e;\n this.gestureBlocked.emit(blocked);\n break;\n }\n }\n });\n\n if (isPlatformServer(inject(PLATFORM_ID))) {\n // D14: Angular strips <style> from templates, so the container rules go into <head>.\n const doc = inject(DOCUMENT);\n effect(() => {\n const css = breakpointCss(\n this.layouts(),\n this.tiles(),\n { breakpoints: this.breakpoints(), stackBelow: this.stackBelow(), minColumnWidth: this.minColumnWidth(), gap: this.gap(), maxColumns: this.maxColumns(), layouts: this.layouts() },\n this.id,\n );\n writeScopedStyleTag(doc, `${TILE_MANAGER_SCOPE}-layout-${this.id}`, css);\n });\n }\n\n // FLIP \"first\" runs in the store notification, before change detection writes the new positions.\n const unsubscribe = this.machine.subscribe(() => this.onChange());\n const onVisibilityChange = () => {\n if (document.visibilityState === 'hidden') this.machine.cancelGesture();\n };\n afterNextRender(() => {\n document.addEventListener('visibilitychange', onVisibilityChange);\n this.observe();\n });\n\n inject(DestroyRef).onDestroy(() => {\n unsubscribe();\n offEvents();\n this.resizeObserver?.disconnect();\n if (typeof cancelAnimationFrame === 'function') cancelAnimationFrame(this.measureFrame);\n if (typeof document !== 'undefined') document.removeEventListener('visibilitychange', onVisibilityChange);\n this.machine.destroy();\n });\n }\n\n /** What is rendered: the resolved column count and its layout (the preview while editing). */\n captureLayout(): { columnCount: number; layout: TileLayoutSnapshot } {\n return { columnCount: this.machine.snapshot.columnCount, layout: this.machine.rendered.map((p) => ({ id: p.id, position: { ...p.position } })) };\n }\n\n /** Drops `layouts[count]` and commits, so that count derives again (D15). */\n resetLayout(count: number): void {\n this.machine.resetLayout(count);\n }\n\n /** True while a pointer drag or resize is in flight. */\n get isGestureActive(): boolean {\n const kind = this.machine.snapshot.gesture.kind;\n return kind === 'drag' || kind === 'resize';\n }\n\n // ---- template handlers --------------------------------------------------\n\n down(e: PointerEvent, id: string, part: TilePart): void {\n const grid = this.grid()?.nativeElement;\n if (!grid) return;\n const verdict = this.machine.pointerDown(id, part, gridPointer(e, grid), readCellMetrics(grid, this.machine.snapshot.columnCount));\n if (verdict === 'capture') {\n e.preventDefault();\n (e.currentTarget as HTMLElement).closest<HTMLElement>('[data-tile-id]')?.setPointerCapture(e.pointerId);\n }\n }\n\n move(e: PointerEvent): void {\n const grid = this.grid()?.nativeElement;\n if (grid && this.machine.pointerMove(gridPointer(e, grid)) === 'capture') (e.currentTarget as HTMLElement).setPointerCapture(e.pointerId);\n }\n\n key(e: KeyboardEvent, id: string): void {\n if (this.machine.keydown(id, e.key, { shift: e.shiftKey })) e.preventDefault();\n }\n\n // ---- internals ----------------------------------------------------------\n\n // One observer on the grid; `measure` runs in the next frame, never inside the callback (S2).\n private observe(): void {\n const grid = this.grid()?.nativeElement;\n if (!grid || this.resizeObserver || typeof ResizeObserver === 'undefined') return;\n this.resizeObserver = new ResizeObserver((entries) => {\n const entry = entries[entries.length - 1];\n this.width = entry.contentBoxSize?.[0]?.inlineSize ?? entry.contentRect.width;\n if (this.measureFrame) return;\n this.measureFrame = requestAnimationFrame(() => {\n this.measureFrame = 0;\n this.machine.measure(this.width);\n });\n });\n this.resizeObserver.observe(grid);\n }\n\n private onChange(): void {\n const s = this.machine.snapshot;\n const rendered = this.machine.rendered;\n const grid = this.grid()?.nativeElement;\n const reflow = rendered !== this.lastRendered && !!grid && untracked(this.animateReflow) && s.measured;\n this.lastRendered = rendered;\n if (reflow && grid) this.flip.first(grid);\n const wantsFocus = !!s.focusRequest && s.focusRequest.seq !== this.focusSeq;\n if (!reflow && !wantsFocus) return;\n afterNextRender(\n () => {\n const now = this.machine.snapshot;\n if (reflow && grid) this.flip.play(grid,now.gesture.kind === 'drag' ? now.gesture.tileId : null);\n if (now.focusRequest && now.focusRequest.seq !== this.focusSeq) {\n this.focusSeq = now.focusRequest.seq;\n const tileId = now.focusRequest.tileId;\n Array.from(this.host.querySelectorAll<HTMLElement>('[data-tile-id]')).find((el) => el.dataset['tileId'] === tileId)?.focus();\n }\n },\n { injector: this.injector },\n );\n }\n}\n\nconst HOST_ARIA = ['aria-label', 'aria-labelledby', 'aria-describedby'] as const;\n\n/**\n * A consumer's static `aria-label` / `-labelledby` / `-describedby` on `<bs-tile-manager>`. Read\n * from the template (HostAttributeToken), not the DOM, so server and hydrated client agree; the\n * copy on the roleless host is removed so nothing is announced twice.\n */\nfunction takeHostAria(): Record<string, string> {\n const host = inject(ElementRef).nativeElement as HTMLElement;\n const bag: Record<string, string> = Object.fromEntries(\n HOST_ARIA.flatMap((name) => {\n const value = inject(new HostAttributeToken(name), { optional: true });\n return value === null ? [] : [[name, value]];\n }),\n );\n Object.keys(bag).forEach((name) => host.removeAttribute(name));\n return bag;\n}\n","<div class=\"mp-tile-manager\" [mpProps]=\"api().board.attrs\" [style]=\"api().board.style\">\n <div class=\"tile-container\" [mpProps]=\"api().container\">\n <div #grid class=\"tile-grid\" [mpProps]=\"api().grid.attrs\" [style]=\"api().grid.style\">\n <!-- A press on the header or a grip bubbles to the tile's body handler; the machine\n ignores that second pointerdown for the same pointer, so the innermost part decides. -->\n @for (t of api().tiles; track t.id) {\n @let slots = tileSlots().get(t.id);\n <div class=\"tile\" [mpProps]=\"t.attrs\" [style]=\"t.style\"\n (pointerdown)=\"down($event, t.id, 'body')\"\n (pointermove)=\"move($event)\"\n (pointerup)=\"machine.pointerUp($event)\"\n (pointercancel)=\"machine.pointerCancel($event)\"\n (lostpointercapture)=\"machine.pointerCancel($event)\"\n (keydown)=\"key($event, t.id)\"\n (focus)=\"machine.focus(t.id)\"\n (blur)=\"machine.blur(t.id)\">\n <!-- Stamps the consumer's *bsTile block first: its *bsTileHeader / *bsTileContent\n register into this tile's slots before the outlets below read them. Not inside an\n @if: an @if body refreshes after this view's own bindings, so the reads would run\n first and the server would render empty headers. -->\n <ng-container [ngTemplateOutlet]=\"tileTemplate()?.templateRef ?? null\" [ngTemplateOutletContext]=\"tileContext().get(t.id)\" [ngTemplateOutletInjector]=\"slots?.injector\"></ng-container>\n <div class=\"tile-header\" [mpProps]=\"t.header\" (pointerdown)=\"down($event, t.id, 'header')\">\n @if (slots?.header; as header) {\n <ng-container [ngTemplateOutlet]=\"header\"></ng-container>\n }\n </div>\n <div class=\"tile-content\" [mpProps]=\"t.content\">\n @if (slots?.content; as content) {\n <ng-container [ngTemplateOutlet]=\"content\"></ng-container>\n }\n </div>\n @for (g of t.grips; track g.handle) {\n <span class=\"tile-grip\" [mpProps]=\"g.attrs\" (pointerdown)=\"down($event, t.id, g.handle)\"></span>\n }\n </div>\n }\n </div>\n </div>\n @for (n of api().descriptions; track n.key) {\n <div class=\"tile-sr-only\" [mpProps]=\"n.attrs\">{{ n.text }}</div>\n }\n <span class=\"tile-sr-only\" [mpProps]=\"api().live.attrs\">{{ api().live.text }}</span>\n</div>\n","/**\n * Generated b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,CAAC,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACtE,QAAA,OAAO,KAAK,KAAK,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC,CAAC,CACH;IACD,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AAC9D,IAAA,OAAO,GAAG;AACZ;;AEvUA;;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
|