@wildmason/aegis 1.5.4 → 1.5.5
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.
|
@@ -2,6 +2,7 @@ import * as _angular_core from '@angular/core';
|
|
|
2
2
|
import { ElementRef, AfterViewInit, TemplateRef, OnDestroy } from '@angular/core';
|
|
3
3
|
import { ConnectedPosition } from '@angular/cdk/overlay';
|
|
4
4
|
import { ControlValueAccessor } from '@angular/forms';
|
|
5
|
+
import * as rxjs from 'rxjs';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* WmModal — Lightweight modal backdrop with Escape key and click-outside dismissal.
|
|
@@ -425,6 +426,210 @@ declare class PageHeader {
|
|
|
425
426
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<PageHeader, "wm-page-header", never, { "flavourText": { "alias": "flavourText"; "required": true; "isSignal": true; }; "title": { "alias": "title"; "required": true; "isSignal": true; }; "subtitle": { "alias": "subtitle"; "required": false; "isSignal": true; }; "badgeLabel": { "alias": "badgeLabel"; "required": false; "isSignal": true; }; }, {}, never, ["[icon]", "[back]", "*"], true, never>;
|
|
426
427
|
}
|
|
427
428
|
|
|
429
|
+
interface ComboboxOption {
|
|
430
|
+
/** Emitted on selection. Can be string, number, or object. */
|
|
431
|
+
value: unknown;
|
|
432
|
+
/** Displayed text in the trigger and dropdown. */
|
|
433
|
+
label: string;
|
|
434
|
+
/** Optional. Greys out and prevents selection. */
|
|
435
|
+
disabled?: boolean;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Segment of an option label, split by filter-query matches.
|
|
440
|
+
* `match: true` means this segment matched the query and should be bolded.
|
|
441
|
+
*/
|
|
442
|
+
interface LabelSegment {
|
|
443
|
+
text: string;
|
|
444
|
+
match: boolean;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Internal sub-component that renders the virtual-scrolled option list
|
|
448
|
+
* inside the WmCombobox's CDK overlay. NOT exported from Aegis.
|
|
449
|
+
*/
|
|
450
|
+
declare class ComboboxPanel {
|
|
451
|
+
/** Filtered options to display. */
|
|
452
|
+
readonly options: _angular_core.InputSignal<ComboboxOption[]>;
|
|
453
|
+
/** Index of the keyboard-highlighted option (-1 = none). */
|
|
454
|
+
readonly highlightIndex: _angular_core.InputSignal<number>;
|
|
455
|
+
/** Values currently selected (for checkmark display). */
|
|
456
|
+
readonly selectedValues: _angular_core.InputSignal<Set<unknown>>;
|
|
457
|
+
/** Whether the parent is multi-select. */
|
|
458
|
+
readonly multiple: _angular_core.InputSignal<boolean>;
|
|
459
|
+
/** Pixel height per row. */
|
|
460
|
+
readonly itemHeight: _angular_core.InputSignal<number>;
|
|
461
|
+
/** Max panel height in pixels. */
|
|
462
|
+
readonly maxHeight: _angular_core.InputSignal<number>;
|
|
463
|
+
/** Current filter text — used for match highlighting in labels. */
|
|
464
|
+
readonly filterQuery: _angular_core.InputSignal<string>;
|
|
465
|
+
/** Show spinner when async filter is pending. */
|
|
466
|
+
readonly loading: _angular_core.InputSignal<boolean>;
|
|
467
|
+
/** Shown in empty state when freeform input is enabled. */
|
|
468
|
+
readonly freeformHint: _angular_core.InputSignal<string>;
|
|
469
|
+
/** Emitted on mousedown (not click) to prevent focus steal. */
|
|
470
|
+
readonly optionClicked: _angular_core.OutputEmitterRef<{
|
|
471
|
+
option: ComboboxOption;
|
|
472
|
+
index: number;
|
|
473
|
+
}>;
|
|
474
|
+
private viewport?;
|
|
475
|
+
/** Unique instance ID for generating DOM IDs. */
|
|
476
|
+
private readonly instanceId;
|
|
477
|
+
/** The DOM ID of the listbox element — used by parent for aria-controls. */
|
|
478
|
+
readonly listboxId: string;
|
|
479
|
+
/** Computed viewport height: min of (options * itemHeight) and maxHeight. */
|
|
480
|
+
protected readonly viewportHeight: _angular_core.Signal<number>;
|
|
481
|
+
/** Whether to show the empty state. */
|
|
482
|
+
protected readonly showEmpty: _angular_core.Signal<boolean>;
|
|
483
|
+
/** Text for the empty state. */
|
|
484
|
+
protected readonly emptyText: _angular_core.Signal<string>;
|
|
485
|
+
/**
|
|
486
|
+
* Precomputed label segments for each option, split by the current filter query.
|
|
487
|
+
* Recomputes whenever options or filterQuery changes.
|
|
488
|
+
*/
|
|
489
|
+
protected readonly segmentedLabels: _angular_core.Signal<LabelSegment[][]>;
|
|
490
|
+
/** Map from option value to a stable key for DOM IDs. */
|
|
491
|
+
private optionKeyMap;
|
|
492
|
+
private nextObjectIndex;
|
|
493
|
+
constructor();
|
|
494
|
+
/** Returns a stable DOM ID for the option at the given index. */
|
|
495
|
+
optionIdAt(index: number): string;
|
|
496
|
+
/** Handle mousedown on an option — emits event and prevents default. */
|
|
497
|
+
protected onOptionMousedown(event: MouseEvent, option: ComboboxOption, index: number): void;
|
|
498
|
+
/** Check whether a value is currently selected. */
|
|
499
|
+
protected isSelected(value: unknown): boolean;
|
|
500
|
+
/** Get label segments for the option at the given virtual-scroll index. */
|
|
501
|
+
protected segmentsAt(index: number): LabelSegment[];
|
|
502
|
+
/**
|
|
503
|
+
* Returns a stable string key for an option value.
|
|
504
|
+
* Strings/numbers use the value directly. Objects use a monotonic index.
|
|
505
|
+
*/
|
|
506
|
+
private keyFor;
|
|
507
|
+
/**
|
|
508
|
+
* Split a label into segments where the query matches (case-insensitive).
|
|
509
|
+
* Returns an array of { text, match } segments.
|
|
510
|
+
*/
|
|
511
|
+
private splitLabel;
|
|
512
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ComboboxPanel, never>;
|
|
513
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ComboboxPanel, "wm-combobox-panel", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "highlightIndex": { "alias": "highlightIndex"; "required": false; "isSignal": true; }; "selectedValues": { "alias": "selectedValues"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "itemHeight": { "alias": "itemHeight"; "required": false; "isSignal": true; }; "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; "filterQuery": { "alias": "filterQuery"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "freeformHint": { "alias": "freeformHint"; "required": false; "isSignal": true; }; }, { "optionClicked": "optionClicked"; }, never, never, true, never>;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* WmCombobox — Accessible combobox with filtering, single/multi-select,
|
|
518
|
+
* freeform entry, chips, and virtual-scrolled panel.
|
|
519
|
+
*
|
|
520
|
+
* Built on Angular CDK Overlay and the WAI-ARIA APG combobox pattern.
|
|
521
|
+
* DOM focus ALWAYS stays on the input; assistive tech focus moves via
|
|
522
|
+
* `aria-activedescendant`.
|
|
523
|
+
*
|
|
524
|
+
* Implements ControlValueAccessor for both template-driven and reactive forms.
|
|
525
|
+
*
|
|
526
|
+
* Usage:
|
|
527
|
+
* <!-- Single-select -->
|
|
528
|
+
* <wm-combobox [options]="opts" [(value)]="selected" />
|
|
529
|
+
*
|
|
530
|
+
* <!-- Multi-select with chips -->
|
|
531
|
+
* <wm-combobox [options]="opts" [(values)]="selectedIds" [multiple]="true" />
|
|
532
|
+
*
|
|
533
|
+
* <!-- Async filter -->
|
|
534
|
+
* <wm-combobox [options]="opts" [filterFn]="searchApi" />
|
|
535
|
+
*
|
|
536
|
+
* <!-- Reactive form -->
|
|
537
|
+
* <wm-combobox formControlName="tag" [options]="tags" />
|
|
538
|
+
*/
|
|
539
|
+
declare class WmCombobox implements ControlValueAccessor, OnDestroy {
|
|
540
|
+
/** Full option list (before filtering). */
|
|
541
|
+
readonly options: _angular_core.InputSignal<ComboboxOption[]>;
|
|
542
|
+
/** Selected value (single-select). Two-way bindable. */
|
|
543
|
+
readonly value: _angular_core.ModelSignal<unknown>;
|
|
544
|
+
/** Selected values (multi-select). Two-way bindable. */
|
|
545
|
+
readonly values: _angular_core.ModelSignal<unknown[]>;
|
|
546
|
+
/** Enable multi-select mode with chips. */
|
|
547
|
+
readonly multiple: _angular_core.InputSignal<boolean>;
|
|
548
|
+
/** Allow typed text to be accepted as a freeform value. */
|
|
549
|
+
readonly allowFreeform: _angular_core.InputSignal<boolean>;
|
|
550
|
+
/** Placeholder text for the input. */
|
|
551
|
+
readonly placeholder: _angular_core.InputSignal<string>;
|
|
552
|
+
/** Disable the combobox. */
|
|
553
|
+
readonly disabled: _angular_core.InputSignal<boolean>;
|
|
554
|
+
/** Custom async filter function. Overrides default substring matching. */
|
|
555
|
+
readonly filterFn: _angular_core.InputSignal<(query: string) => rxjs.Observable<ComboboxOption[]>>;
|
|
556
|
+
/** Pixel height of each option row. */
|
|
557
|
+
readonly itemHeight: _angular_core.InputSignal<number>;
|
|
558
|
+
/** Max panel height in pixels. */
|
|
559
|
+
readonly maxPanelHeight: _angular_core.InputSignal<number>;
|
|
560
|
+
/** Emitted when the input text changes. */
|
|
561
|
+
readonly query: _angular_core.OutputEmitterRef<string>;
|
|
562
|
+
/** Emitted when the panel opens. */
|
|
563
|
+
readonly opened: _angular_core.OutputEmitterRef<void>;
|
|
564
|
+
/** Emitted when the panel closes. */
|
|
565
|
+
readonly closed: _angular_core.OutputEmitterRef<void>;
|
|
566
|
+
protected readonly inputRef: _angular_core.Signal<ElementRef<HTMLInputElement>>;
|
|
567
|
+
protected readonly panel: _angular_core.Signal<ComboboxPanel>;
|
|
568
|
+
protected readonly isOpen: _angular_core.WritableSignal<boolean>;
|
|
569
|
+
protected readonly inputText: _angular_core.WritableSignal<string>;
|
|
570
|
+
protected readonly highlightIndex: _angular_core.WritableSignal<number>;
|
|
571
|
+
protected readonly asyncLoading: _angular_core.WritableSignal<boolean>;
|
|
572
|
+
protected readonly asyncResults: _angular_core.WritableSignal<ComboboxOption[]>;
|
|
573
|
+
/** Text the input had when the panel opened — restored on Escape. */
|
|
574
|
+
private savedText;
|
|
575
|
+
private readonly hostEl;
|
|
576
|
+
private onChangeFn;
|
|
577
|
+
protected onTouchedFn: () => void;
|
|
578
|
+
private readonly filterSubject;
|
|
579
|
+
private filterSub;
|
|
580
|
+
protected readonly liveText: _angular_core.WritableSignal<string>;
|
|
581
|
+
private liveTimer;
|
|
582
|
+
/** Set of currently selected values for the panel. */
|
|
583
|
+
protected readonly selectedValues: _angular_core.Signal<Set<unknown>>;
|
|
584
|
+
/** Filtered options shown in the panel. */
|
|
585
|
+
protected readonly filteredOptions: _angular_core.Signal<ComboboxOption[]>;
|
|
586
|
+
/** Chips for multi-select mode. */
|
|
587
|
+
protected readonly chips: _angular_core.Signal<{
|
|
588
|
+
value: unknown;
|
|
589
|
+
label: string;
|
|
590
|
+
}[]>;
|
|
591
|
+
/** The aria-activedescendant value. */
|
|
592
|
+
protected readonly activeDescendant: _angular_core.Signal<string>;
|
|
593
|
+
/** The listbox ID from the panel (for aria-controls). */
|
|
594
|
+
protected readonly panelListboxId: _angular_core.Signal<string>;
|
|
595
|
+
/** Freeform hint for empty state. */
|
|
596
|
+
protected readonly freeformHint: _angular_core.Signal<string>;
|
|
597
|
+
/** Overlay width tracks host element width. */
|
|
598
|
+
protected get overlayWidth(): number;
|
|
599
|
+
/** Overlay positions: below-first with above-fallback. */
|
|
600
|
+
protected readonly positions: ConnectedPosition[];
|
|
601
|
+
constructor();
|
|
602
|
+
ngOnDestroy(): void;
|
|
603
|
+
writeValue(value: unknown): void;
|
|
604
|
+
registerOnChange(fn: (v: unknown) => void): void;
|
|
605
|
+
registerOnTouched(fn: () => void): void;
|
|
606
|
+
protected open(highlightFirst?: boolean, highlightLast?: boolean): void;
|
|
607
|
+
protected close(restoreText?: boolean): void;
|
|
608
|
+
protected onInput(event: Event): void;
|
|
609
|
+
protected onBlur(): void;
|
|
610
|
+
protected onTriggerClick(): void;
|
|
611
|
+
protected onKeydown(event: KeyboardEvent): void;
|
|
612
|
+
protected onOptionClicked(event: {
|
|
613
|
+
option: ComboboxOption;
|
|
614
|
+
index: number;
|
|
615
|
+
}): void;
|
|
616
|
+
private selectOption;
|
|
617
|
+
protected removeChip(chipValue: unknown): void;
|
|
618
|
+
private removeChipByIndex;
|
|
619
|
+
private acceptFreeform;
|
|
620
|
+
private highlightFirst;
|
|
621
|
+
private highlightLast;
|
|
622
|
+
/**
|
|
623
|
+
* Find the next enabled option in the given direction.
|
|
624
|
+
* Returns -1 if wrapping past the end/start (clears highlight).
|
|
625
|
+
*/
|
|
626
|
+
private nextEnabled;
|
|
627
|
+
/** Sync input text to the currently selected option label (single-select). */
|
|
628
|
+
private syncInputToSelection;
|
|
629
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<WmCombobox, never>;
|
|
630
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<WmCombobox, "wm-combobox", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "values": { "alias": "values"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "allowFreeform": { "alias": "allowFreeform"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "filterFn": { "alias": "filterFn"; "required": false; "isSignal": true; }; "itemHeight": { "alias": "itemHeight"; "required": false; "isSignal": true; }; "maxPanelHeight": { "alias": "maxPanelHeight"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "values": "valuesChange"; "query": "query"; "opened": "opened"; "closed": "closed"; }, never, never, true, never>;
|
|
631
|
+
}
|
|
632
|
+
|
|
428
633
|
type ToastType = 'success' | 'error' | 'info' | 'progress';
|
|
429
634
|
interface Toast {
|
|
430
635
|
id: number;
|
|
@@ -541,5 +746,5 @@ declare class WmLicenseDialog {
|
|
|
541
746
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<WmLicenseDialog, "wm-license-dialog", never, { "visible": { "alias": "visible"; "required": true; "isSignal": true; }; }, { "dismiss": "dismiss"; }, never, never, true, never>;
|
|
542
747
|
}
|
|
543
748
|
|
|
544
|
-
export { Checkbox, GhostField, NumberInput, PageHeader, Toggle, WmAutoFocus, WmButton, WmDialog, WmLicenseDialog, WmLicenseNudge, WmLicenseService, WmModal, WmPopover, WmSelect, WmTab, WmTabs, WmToastContainer, WmToastService };
|
|
545
|
-
export type { ButtonSize, ButtonVariant, DialogSize, LicenseStatus, SelectOption, Toast, ToastType };
|
|
749
|
+
export { Checkbox, GhostField, NumberInput, PageHeader, Toggle, WmAutoFocus, WmButton, WmCombobox, WmDialog, WmLicenseDialog, WmLicenseNudge, WmLicenseService, WmModal, WmPopover, WmSelect, WmTab, WmTabs, WmToastContainer, WmToastService };
|
|
750
|
+
export type { ButtonSize, ButtonVariant, ComboboxOption, DialogSize, LicenseStatus, SelectOption, Toast, ToastType };
|