@spartan-ng/brain 0.0.1-alpha.533 → 0.0.1-alpha.535
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/accordion/lib/brn-accordion-content.d.ts +16 -9
- package/accordion/lib/brn-accordion.d.ts +14 -2
- package/autocomplete/lib/brn-autocomplete-search-input.d.ts +5 -4
- package/autocomplete/lib/brn-autocomplete.d.ts +5 -0
- package/calendar/lib/brn-calendar-month-select.d.ts +1 -1
- package/calendar/lib/brn-calendar-year-select.d.ts +1 -1
- package/calendar/lib/brn-calendar.d.ts +1 -8
- package/calendar/lib/brn-calendar.token.d.ts +1 -4
- package/calendar/lib/mode/brn-calendar-multiple.d.ts +1 -8
- package/calendar/lib/mode/brn-calendar-range.d.ts +1 -8
- package/checkbox/lib/brn-checkbox.d.ts +10 -12
- package/fesm2022/spartan-ng-brain-accordion.mjs +57 -39
- package/fesm2022/spartan-ng-brain-accordion.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-autocomplete.mjs +40 -11
- package/fesm2022/spartan-ng-brain-autocomplete.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-calendar.mjs +33 -58
- package/fesm2022/spartan-ng-brain-calendar.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-checkbox.mjs +23 -25
- package/fesm2022/spartan-ng-brain-checkbox.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-menu.mjs +27 -24
- package/fesm2022/spartan-ng-brain-menu.mjs.map +1 -1
- package/hlm-tailwind-preset.css +38 -26
- package/menu/lib/brn-context-menu-trigger.d.ts +3 -2
- package/menu/lib/brn-menu-align.d.ts +3 -2
- package/menu/lib/brn-menu-trigger.d.ts +3 -2
- package/package.json +2 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { InjectionToken, inject,
|
|
3
|
+
import { InjectionToken, inject, model, output, signal, effect, forwardRef, Optional, Inject, Directive, Injector, input, computed, contentChild, contentChildren, untracked, TemplateRef, ViewContainerRef, PLATFORM_ID, ElementRef, booleanAttribute } from '@angular/core';
|
|
4
4
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
5
|
import { BrnPopover } from '@spartan-ng/brain/popover';
|
|
6
6
|
import { DefaultValueAccessor, COMPOSITION_BUFFER_MODE, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
@@ -29,9 +29,10 @@ class BrnAutocompleteSearchInput extends DefaultValueAccessor {
|
|
|
29
29
|
elementRef;
|
|
30
30
|
_autocomplete = injectBrnAutocomplete();
|
|
31
31
|
/** The initial value of the search input */
|
|
32
|
-
value =
|
|
33
|
-
/**
|
|
34
|
-
|
|
32
|
+
value = model('');
|
|
33
|
+
/** Emitted when the value changes */
|
|
34
|
+
valueChange = output();
|
|
35
|
+
/** Whether the autocomplete panel is expanded */
|
|
35
36
|
_isExpanded = this._autocomplete.isExpanded;
|
|
36
37
|
/** The id of the active option */
|
|
37
38
|
_activeDescendant = signal(undefined);
|
|
@@ -42,12 +43,14 @@ class BrnAutocompleteSearchInput extends DefaultValueAccessor {
|
|
|
42
43
|
.pipe(startWith(this._autocomplete.keyManager.activeItemIndex), takeUntilDestroyed())
|
|
43
44
|
.subscribe(() => this._activeDescendant.set(this._autocomplete.keyManager.activeItem?.id()));
|
|
44
45
|
effect(() => {
|
|
45
|
-
|
|
46
|
+
const value = this.value();
|
|
47
|
+
this.elementRef.nativeElement.value = value;
|
|
48
|
+
this.valueChange.emit(value);
|
|
46
49
|
});
|
|
47
50
|
}
|
|
48
51
|
/** Listen for changes to the input value */
|
|
49
52
|
onInput() {
|
|
50
|
-
this.
|
|
53
|
+
this.value.set(this.elementRef.nativeElement.value);
|
|
51
54
|
}
|
|
52
55
|
/** Listen for keydown events */
|
|
53
56
|
onKeyDown(event) {
|
|
@@ -55,17 +58,28 @@ class BrnAutocompleteSearchInput extends DefaultValueAccessor {
|
|
|
55
58
|
// prevent form submission if inside a form
|
|
56
59
|
event.preventDefault();
|
|
57
60
|
}
|
|
61
|
+
if (!this._isExpanded()) {
|
|
62
|
+
if (event.key === 'ArrowDown') {
|
|
63
|
+
this._autocomplete.open('first');
|
|
64
|
+
}
|
|
65
|
+
if (event.key === 'ArrowUp') {
|
|
66
|
+
this._autocomplete.open('last');
|
|
67
|
+
}
|
|
68
|
+
if (event.key === 'Escape') {
|
|
69
|
+
this.value.set('');
|
|
70
|
+
}
|
|
71
|
+
}
|
|
58
72
|
this._autocomplete.keyManager.onKeydown(event);
|
|
59
73
|
}
|
|
60
74
|
/** CONROL VALUE ACCESSOR */
|
|
61
75
|
writeValue(value) {
|
|
62
76
|
super.writeValue(value);
|
|
63
77
|
if (value) {
|
|
64
|
-
this.
|
|
78
|
+
this.value.set(value);
|
|
65
79
|
}
|
|
66
80
|
}
|
|
67
81
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAutocompleteSearchInput, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: COMPOSITION_BUFFER_MODE, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
68
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnAutocompleteSearchInput, isStandalone: true, selector: "input[brnAutocompleteSearchInput]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "combobox", "aria-autocomplete": "list" }, listeners: { "keydown": "onKeyDown($event)", "input": "onInput()" }, properties: { "attr.aria-activedescendant": "_activeDescendant()", "attr.aria-expanded": "_isExpanded()" } }, providers: [
|
|
82
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: BrnAutocompleteSearchInput, isStandalone: true, selector: "input[brnAutocompleteSearchInput]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", valueChange: "valueChange" }, host: { attributes: { "role": "combobox", "aria-autocomplete": "list" }, listeners: { "keydown": "onKeyDown($event)", "input": "onInput()" }, properties: { "attr.aria-activedescendant": "_activeDescendant()", "attr.aria-expanded": "_isExpanded()" } }, providers: [
|
|
69
83
|
provideBrnAutocompleteSearchInput(BrnAutocompleteSearchInput),
|
|
70
84
|
{
|
|
71
85
|
provide: NG_VALUE_ACCESSOR,
|
|
@@ -110,13 +124,15 @@ class BrnAutocomplete {
|
|
|
110
124
|
/** when the selection has changed */
|
|
111
125
|
valueChange = output();
|
|
112
126
|
/** @internal The search query */
|
|
113
|
-
search = computed(() => this._searchInput()?.
|
|
127
|
+
search = computed(() => this._searchInput()?.value() ?? '');
|
|
114
128
|
/** Access the popover if present */
|
|
115
129
|
_brnPopover = inject(BrnPopover, { optional: true });
|
|
116
130
|
/** Access the search input if present */
|
|
117
131
|
_searchInput = contentChild(BrnAutocompleteSearchInput, {
|
|
118
132
|
descendants: true,
|
|
119
133
|
});
|
|
134
|
+
/** @internal The focus strategy when opening */
|
|
135
|
+
_focus = signal('first');
|
|
120
136
|
/** @internal Access all the items within the autocomplete */
|
|
121
137
|
items = contentChildren(BrnAutocompleteItemToken, {
|
|
122
138
|
descendants: true,
|
|
@@ -133,10 +149,13 @@ class BrnAutocomplete {
|
|
|
133
149
|
.skipPredicate((item) => item.disabled);
|
|
134
150
|
effect(() => {
|
|
135
151
|
const items = this.items();
|
|
152
|
+
const focus = this._focus();
|
|
136
153
|
untracked(() => {
|
|
154
|
+
if (!items.length)
|
|
155
|
+
return;
|
|
137
156
|
const activeItem = this.keyManager.activeItem;
|
|
138
|
-
if (!activeItem || !items.includes(activeItem)
|
|
139
|
-
this.keyManager.setFirstItemActive();
|
|
157
|
+
if (!activeItem || !items.includes(activeItem)) {
|
|
158
|
+
focus === 'first' ? this.keyManager.setFirstItemActive() : this.keyManager.setLastItemActive();
|
|
140
159
|
}
|
|
141
160
|
});
|
|
142
161
|
});
|
|
@@ -152,6 +171,16 @@ class BrnAutocomplete {
|
|
|
152
171
|
this.keyManager.activeItem?.selected.emit();
|
|
153
172
|
}
|
|
154
173
|
}
|
|
174
|
+
open(focus = 'first') {
|
|
175
|
+
this._brnPopover?.open();
|
|
176
|
+
this._focus.set(focus);
|
|
177
|
+
}
|
|
178
|
+
close() {
|
|
179
|
+
this._brnPopover?.close();
|
|
180
|
+
}
|
|
181
|
+
toggle() {
|
|
182
|
+
this.isExpanded() ? this.close() : this.open();
|
|
183
|
+
}
|
|
155
184
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnAutocomplete, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
156
185
|
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type: BrnAutocomplete, isStandalone: true, selector: "[brnAutocomplete]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, host: { listeners: { "keydown.enter": "selectActiveItem()" }, properties: { "id": "id()" } }, providers: [provideBrnAutocomplete(BrnAutocomplete)], queries: [{ propertyName: "_searchInput", first: true, predicate: BrnAutocompleteSearchInput, descendants: true, isSignal: true }, { propertyName: "items", predicate: BrnAutocompleteItemToken, descendants: true, isSignal: true }], ngImport: i0 });
|
|
157
186
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spartan-ng-brain-autocomplete.mjs","sources":["../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-item.token.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-search-input.token.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete.token.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-search-input.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-empty.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-group.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-item.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-list.ts","../../../../libs/brain/autocomplete/src/index.ts","../../../../libs/brain/autocomplete/src/spartan-ng-brain-autocomplete.ts"],"sourcesContent":["import { type ExistingProvider, InjectionToken, type Type } from '@angular/core';\nimport type { BrnAutocompleteItem } from './brn-autocomplete-item';\n\nexport const BrnAutocompleteItemToken = new InjectionToken<BrnAutocompleteItem<unknown>>('BrnAutocompleteItemToken');\n\nexport function provideBrnAutocompleteItem<T>(autocomplete: Type<BrnAutocompleteItem<T>>): ExistingProvider {\n\treturn { provide: BrnAutocompleteItemToken, useExisting: autocomplete };\n}\n","import { type ExistingProvider, InjectionToken, type Type } from '@angular/core';\nimport type { BrnAutocompleteSearchInput } from './brn-autocomplete-search-input';\n\nexport const BrnAutocompleteSearchInputToken = new InjectionToken<BrnAutocompleteSearchInput>(\n\t'BrnAutocompleteSearchInputToken',\n);\n\nexport function provideBrnAutocompleteSearchInput(autocomplete: Type<BrnAutocompleteSearchInput>): ExistingProvider {\n\treturn { provide: BrnAutocompleteSearchInputToken, useExisting: autocomplete };\n}\n","import { type ExistingProvider, inject, InjectionToken, type Type } from '@angular/core';\nimport type { BrnAutocomplete } from './brn-autocomplete';\n\nexport const BrnAutocompleteToken = new InjectionToken<BrnAutocomplete<unknown>>('BrnAutocompleteToken');\n\nexport function provideBrnAutocomplete<T>(autocomplete: Type<BrnAutocomplete<T>>): ExistingProvider {\n\treturn { provide: BrnAutocompleteToken, useExisting: autocomplete };\n}\n\nexport function injectBrnAutocomplete<T>(): BrnAutocomplete<T> {\n\treturn inject(BrnAutocompleteToken) as BrnAutocomplete<T>;\n}\n","import {\n\tDirective,\n\teffect,\n\tElementRef,\n\tforwardRef,\n\tInject,\n\tinput,\n\tlinkedSignal,\n\tOptional,\n\tRenderer2,\n\tsignal,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { COMPOSITION_BUFFER_MODE, DefaultValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { startWith } from 'rxjs/operators';\nimport { provideBrnAutocompleteSearchInput } from './brn-autocomplete-search-input.token';\nimport { injectBrnAutocomplete } from './brn-autocomplete.token';\n\n@Directive({\n\tselector: 'input[brnAutocompleteSearchInput]',\n\tproviders: [\n\t\tprovideBrnAutocompleteSearchInput(BrnAutocompleteSearchInput),\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: forwardRef(() => BrnAutocompleteSearchInput),\n\t\t\tmulti: true,\n\t\t},\n\t],\n\thost: {\n\t\trole: 'combobox',\n\t\t'aria-autocomplete': 'list',\n\t\t'[attr.aria-activedescendant]': '_activeDescendant()',\n\t\t'[attr.aria-expanded]': '_isExpanded()',\n\t\t'(keydown)': 'onKeyDown($event)',\n\t\t'(input)': 'onInput()',\n\t},\n})\nexport class BrnAutocompleteSearchInput extends DefaultValueAccessor {\n\tprivate readonly _autocomplete = injectBrnAutocomplete();\n\n\t/** The initial value of the search input */\n\tpublic readonly value = input<string>('');\n\n\t/** @internal The \"real\" value of the search input */\n\tpublic readonly valueState = linkedSignal(() => this.value());\n\n\tprotected readonly _isExpanded = this._autocomplete.isExpanded;\n\n\t/** The id of the active option */\n\tprotected readonly _activeDescendant = signal<string | undefined>(undefined);\n\n\tconstructor(\n\t\trenderer: Renderer2,\n\t\tprivate readonly elementRef: ElementRef,\n\t\t@Optional() @Inject(COMPOSITION_BUFFER_MODE) compositionMode: boolean,\n\t) {\n\t\tsuper(renderer, elementRef, compositionMode);\n\t\tthis._autocomplete.keyManager.change\n\t\t\t.pipe(startWith(this._autocomplete.keyManager.activeItemIndex), takeUntilDestroyed())\n\t\t\t.subscribe(() => this._activeDescendant.set(this._autocomplete.keyManager.activeItem?.id()));\n\n\t\teffect(() => {\n\t\t\tthis.elementRef.nativeElement.value = this.valueState();\n\t\t});\n\t}\n\t/** Listen for changes to the input value */\n\tprotected onInput(): void {\n\t\tthis.valueState.set(this.elementRef.nativeElement.value);\n\t}\n\n\t/** Listen for keydown events */\n\tprotected onKeyDown(event: KeyboardEvent): void {\n\t\tif (event.key === 'Enter') {\n\t\t\t// prevent form submission if inside a form\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\tthis._autocomplete.keyManager.onKeydown(event);\n\t}\n\n\t/** CONROL VALUE ACCESSOR */\n\toverride writeValue(value: string | null): void {\n\t\tsuper.writeValue(value);\n\t\tif (value) {\n\t\t\tthis.valueState.set(value);\n\t\t}\n\t}\n}\n","import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';\nimport {\n\tcomputed,\n\tcontentChild,\n\tcontentChildren,\n\tDirective,\n\teffect,\n\tinject,\n\tInjector,\n\tinput,\n\toutput,\n\tuntracked,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { BrnPopover } from '@spartan-ng/brain/popover';\nimport type { BrnAutocompleteItem } from './brn-autocomplete-item';\nimport { BrnAutocompleteItemToken } from './brn-autocomplete-item.token';\nimport { BrnAutocompleteSearchInput } from './brn-autocomplete-search-input';\nimport { provideBrnAutocomplete } from './brn-autocomplete.token';\n\n@Directive({\n\tselector: '[brnAutocomplete]',\n\tproviders: [provideBrnAutocomplete(BrnAutocomplete)],\n\thost: {\n\t\t'[id]': 'id()',\n\t\t'(keydown.enter)': 'selectActiveItem()',\n\t},\n})\nexport class BrnAutocomplete<T> {\n\tprivate static _id = 0;\n\n\tprivate readonly _injector = inject(Injector);\n\n\t/** The id of the autocomplete */\n\tpublic readonly id = input<string>(`brn-autocomplete-${++BrnAutocomplete._id}`);\n\n\t/** when the selection has changed */\n\tpublic readonly valueChange = output<T>();\n\n\t/** @internal The search query */\n\tpublic readonly search = computed(() => this._searchInput()?.valueState() ?? '');\n\n\t/** Access the popover if present */\n\tprivate readonly _brnPopover = inject(BrnPopover, { optional: true });\n\n\t/** Access the search input if present */\n\tprivate readonly _searchInput = contentChild(BrnAutocompleteSearchInput, {\n\t\tdescendants: true,\n\t});\n\n\t/** @internal Access all the items within the autocomplete */\n\tpublic readonly items = contentChildren<BrnAutocompleteItem<T>>(BrnAutocompleteItemToken, {\n\t\tdescendants: true,\n\t});\n\n\t/** @internal The key manager for managing active descendant */\n\tpublic readonly keyManager = new ActiveDescendantKeyManager(this.items, this._injector);\n\n\t/** @internal Whether the autocomplete is expanded */\n\tpublic readonly isExpanded = computed(() => this._brnPopover?.stateComputed() === 'open');\n\n\tconstructor() {\n\t\tthis.keyManager\n\t\t\t.withVerticalOrientation()\n\t\t\t.withHomeAndEnd()\n\t\t\t.withWrap()\n\t\t\t.skipPredicate((item) => item.disabled);\n\n\t\teffect(() => {\n\t\t\tconst items = this.items();\n\n\t\t\tuntracked(() => {\n\t\t\t\tconst activeItem = this.keyManager.activeItem;\n\t\t\t\tif (!activeItem || !items.includes(activeItem) || items[0] !== activeItem) {\n\t\t\t\t\tthis.keyManager.setFirstItemActive();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tthis.keyManager.change.pipe(takeUntilDestroyed()).subscribe(() => {\n\t\t\tconst value = this.keyManager.activeItem?.value();\n\t\t\tif (value) {\n\t\t\t\tthis.valueChange.emit(value);\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected selectActiveItem(): void {\n\t\tif (this._brnPopover?.stateComputed() === 'open') {\n\t\t\tthis.keyManager.activeItem?.selected.emit();\n\t\t}\n\t}\n}\n","import { computed, Directive, effect, inject, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { injectBrnAutocomplete } from './brn-autocomplete.token';\n\n@Directive({\n\tselector: '[brnAutocompleteEmpty]',\n})\nexport class BrnAutocompleteEmpty {\n\tprivate readonly _templateRef = inject<TemplateRef<void>>(TemplateRef);\n\tprivate readonly _viewContainerRef = inject(ViewContainerRef);\n\tprivate readonly _autocomplete = injectBrnAutocomplete();\n\n\t/** Determine if the autocomplete has any items */\n\tprivate readonly _visible = computed(() => this._autocomplete.items().length > 0);\n\n\tconstructor() {\n\t\teffect(() => {\n\t\t\tif (this._visible()) {\n\t\t\t\tthis._viewContainerRef.clear();\n\t\t\t} else {\n\t\t\t\tthis._viewContainerRef.createEmbeddedView(this._templateRef);\n\t\t\t}\n\t\t});\n\t}\n}\n","import { Directive, input } from '@angular/core';\n\n@Directive({\n\tselector: '[brnAutocompleteGroup]',\n\thost: {\n\t\trole: 'group',\n\t\t'[id]': 'id()',\n\t},\n})\nexport class BrnAutocompleteGroup {\n\tprivate static _id = 0;\n\n\t/** The id of the autocomplete list */\n\tpublic readonly id = input<string>(`brn-autocomplete-group-${++BrnAutocompleteGroup._id}`);\n}\n","import type { Highlightable } from '@angular/cdk/a11y';\nimport type { BooleanInput } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport { booleanAttribute, Directive, ElementRef, inject, input, output, PLATFORM_ID, signal } from '@angular/core';\nimport { provideBrnAutocompleteItem } from './brn-autocomplete-item.token';\nimport { injectBrnAutocomplete } from './brn-autocomplete.token';\n\n@Directive({\n\tselector: 'button[brnAutocompleteItem]',\n\tproviders: [provideBrnAutocompleteItem(BrnAutocompleteItem)],\n\thost: {\n\t\ttype: 'button',\n\t\trole: 'option',\n\t\ttabIndex: '-1',\n\t\t'[id]': 'id()',\n\t\t'[attr.disabled]': '_disabled() ? true : null',\n\t\t'[attr.data-disabled]': '_disabled() ? \"\" : null',\n\t\t'[attr.data-value]': 'value()',\n\t\t'[attr.aria-selected]': '_active()',\n\t\t'[attr.data-selected]': \"_active() ? '' : null\",\n\t\t'(click)': 'onClick()',\n\t\t'(mouseenter)': 'activate()',\n\t},\n})\nexport class BrnAutocompleteItem<T> implements Highlightable {\n\tprivate static _id = 0;\n\n\tprivate readonly _platform = inject(PLATFORM_ID);\n\n\tprivate readonly _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n\t/** Access the autocomplete component */\n\tprivate readonly _autocomplete = injectBrnAutocomplete<T>();\n\n\t/** A unique id for the item */\n\tpublic readonly id = input(`brn-autocomplete-item-${++BrnAutocompleteItem._id}`);\n\n\t/** The value this item represents. */\n\tpublic readonly value = input.required<T>();\n\n\t/** Whether the item is disabled. */\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\tpublic readonly _disabled = input<boolean, BooleanInput>(false, {\n\t\talias: 'disabled',\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/** Expose disabled as a value - used by the Highlightable interface */\n\tpublic get disabled() {\n\t\treturn this._disabled();\n\t}\n\n\t/** Whether the item is selected. */\n\tprotected readonly _active = signal(false);\n\n\t/** Emits when the item is selected. */\n\tpublic readonly selected = output<void>();\n\n\t/** @internal Get the display value */\n\tpublic getLabel(): string {\n\t\treturn this._elementRef.nativeElement.textContent?.trim() ?? '';\n\t}\n\n\t/** @internal */\n\tsetActiveStyles(): void {\n\t\tthis._active.set(true);\n\n\t\t// ensure the item is in view\n\t\tif (isPlatformBrowser(this._platform)) {\n\t\t\tthis._elementRef.nativeElement.scrollIntoView({ block: 'nearest' });\n\t\t}\n\t}\n\n\t/** @internal */\n\tsetInactiveStyles(): void {\n\t\tthis._active.set(false);\n\t}\n\n\tprotected onClick(): void {\n\t\tthis._autocomplete.keyManager.setActiveItem(this);\n\t\tthis.selected.emit();\n\t}\n\n\tprotected activate(): void {\n\t\tif (this._disabled()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._autocomplete.keyManager.setActiveItem(this);\n\t}\n}\n","import { Directive, input } from '@angular/core';\n\n@Directive({\n\tselector: '[brnAutocompleteList]',\n\thost: {\n\t\trole: 'listbox',\n\t\t'[id]': 'id()',\n\t},\n})\nexport class BrnAutocompleteList {\n\tprivate static _id = 0;\n\n\t/** The id of the command list */\n\tpublic readonly id = input<string>(`brn-autocomplete-list-${++BrnAutocompleteList._id}`);\n}\n","import { BrnAutocomplete } from './lib/brn-autocomplete';\nimport { BrnAutocompleteEmpty } from './lib/brn-autocomplete-empty';\nimport { BrnAutocompleteGroup } from './lib/brn-autocomplete-group';\nimport { BrnAutocompleteItem } from './lib/brn-autocomplete-item';\nimport { BrnAutocompleteList } from './lib/brn-autocomplete-list';\nimport { BrnAutocompleteSearchInput } from './lib/brn-autocomplete-search-input';\n\nexport * from './lib/brn-autocomplete';\nexport * from './lib/brn-autocomplete-empty';\nexport * from './lib/brn-autocomplete-group';\nexport * from './lib/brn-autocomplete-item';\nexport * from './lib/brn-autocomplete-item.token';\nexport * from './lib/brn-autocomplete-list';\nexport * from './lib/brn-autocomplete-search-input';\nexport * from './lib/brn-autocomplete-search-input.token';\nexport * from './lib/brn-autocomplete.token';\n\nexport const BrnAutocompleteImports = [\n\tBrnAutocomplete,\n\tBrnAutocompleteEmpty,\n\tBrnAutocompleteGroup,\n\tBrnAutocompleteItem,\n\tBrnAutocompleteList,\n\tBrnAutocompleteSearchInput,\n] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;MAGa,wBAAwB,GAAG,IAAI,cAAc,CAA+B,0BAA0B;AAE7G,SAAU,0BAA0B,CAAI,YAA0C,EAAA;IACvF,OAAO,EAAE,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,YAAY,EAAE;AACxE;;MCJa,+BAA+B,GAAG,IAAI,cAAc,CAChE,iCAAiC;AAG5B,SAAU,iCAAiC,CAAC,YAA8C,EAAA;IAC/F,OAAO,EAAE,OAAO,EAAE,+BAA+B,EAAE,WAAW,EAAE,YAAY,EAAE;AAC/E;;MCNa,oBAAoB,GAAG,IAAI,cAAc,CAA2B,sBAAsB;AAEjG,SAAU,sBAAsB,CAAI,YAAsC,EAAA;IAC/E,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,YAAY,EAAE;AACpE;SAEgB,qBAAqB,GAAA;AACpC,IAAA,OAAO,MAAM,CAAC,oBAAoB,CAAuB;AAC1D;;AC0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ACpB,mBAAmB;IACnB,mBAAmB;IACnB,0BAA0B;;;ACvB3B;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"spartan-ng-brain-autocomplete.mjs","sources":["../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-item.token.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-search-input.token.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete.token.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-search-input.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-empty.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-group.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-item.ts","../../../../libs/brain/autocomplete/src/lib/brn-autocomplete-list.ts","../../../../libs/brain/autocomplete/src/index.ts","../../../../libs/brain/autocomplete/src/spartan-ng-brain-autocomplete.ts"],"sourcesContent":["import { type ExistingProvider, InjectionToken, type Type } from '@angular/core';\nimport type { BrnAutocompleteItem } from './brn-autocomplete-item';\n\nexport const BrnAutocompleteItemToken = new InjectionToken<BrnAutocompleteItem<unknown>>('BrnAutocompleteItemToken');\n\nexport function provideBrnAutocompleteItem<T>(autocomplete: Type<BrnAutocompleteItem<T>>): ExistingProvider {\n\treturn { provide: BrnAutocompleteItemToken, useExisting: autocomplete };\n}\n","import { type ExistingProvider, InjectionToken, type Type } from '@angular/core';\nimport type { BrnAutocompleteSearchInput } from './brn-autocomplete-search-input';\n\nexport const BrnAutocompleteSearchInputToken = new InjectionToken<BrnAutocompleteSearchInput>(\n\t'BrnAutocompleteSearchInputToken',\n);\n\nexport function provideBrnAutocompleteSearchInput(autocomplete: Type<BrnAutocompleteSearchInput>): ExistingProvider {\n\treturn { provide: BrnAutocompleteSearchInputToken, useExisting: autocomplete };\n}\n","import { type ExistingProvider, inject, InjectionToken, type Type } from '@angular/core';\nimport type { BrnAutocomplete } from './brn-autocomplete';\n\nexport const BrnAutocompleteToken = new InjectionToken<BrnAutocomplete<unknown>>('BrnAutocompleteToken');\n\nexport function provideBrnAutocomplete<T>(autocomplete: Type<BrnAutocomplete<T>>): ExistingProvider {\n\treturn { provide: BrnAutocompleteToken, useExisting: autocomplete };\n}\n\nexport function injectBrnAutocomplete<T>(): BrnAutocomplete<T> {\n\treturn inject(BrnAutocompleteToken) as BrnAutocomplete<T>;\n}\n","import {\n\tDirective,\n\teffect,\n\tElementRef,\n\tforwardRef,\n\tInject,\n\tmodel,\n\tOptional,\n\toutput,\n\tRenderer2,\n\tsignal,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { COMPOSITION_BUFFER_MODE, DefaultValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { startWith } from 'rxjs/operators';\nimport { provideBrnAutocompleteSearchInput } from './brn-autocomplete-search-input.token';\nimport { injectBrnAutocomplete } from './brn-autocomplete.token';\n\n@Directive({\n\tselector: 'input[brnAutocompleteSearchInput]',\n\tproviders: [\n\t\tprovideBrnAutocompleteSearchInput(BrnAutocompleteSearchInput),\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: forwardRef(() => BrnAutocompleteSearchInput),\n\t\t\tmulti: true,\n\t\t},\n\t],\n\thost: {\n\t\trole: 'combobox',\n\t\t'aria-autocomplete': 'list',\n\t\t'[attr.aria-activedescendant]': '_activeDescendant()',\n\t\t'[attr.aria-expanded]': '_isExpanded()',\n\t\t'(keydown)': 'onKeyDown($event)',\n\t\t'(input)': 'onInput()',\n\t},\n})\nexport class BrnAutocompleteSearchInput extends DefaultValueAccessor {\n\tprivate readonly _autocomplete = injectBrnAutocomplete();\n\n\t/** The initial value of the search input */\n\tpublic readonly value = model<string>('');\n\n\t/** Emitted when the value changes */\n\tpublic readonly valueChange = output<string>();\n\n\t/** Whether the autocomplete panel is expanded */\n\tprotected readonly _isExpanded = this._autocomplete.isExpanded;\n\n\t/** The id of the active option */\n\tprotected readonly _activeDescendant = signal<string | undefined>(undefined);\n\n\tconstructor(\n\t\trenderer: Renderer2,\n\t\tprivate readonly elementRef: ElementRef,\n\t\t@Optional() @Inject(COMPOSITION_BUFFER_MODE) compositionMode: boolean,\n\t) {\n\t\tsuper(renderer, elementRef, compositionMode);\n\t\tthis._autocomplete.keyManager.change\n\t\t\t.pipe(startWith(this._autocomplete.keyManager.activeItemIndex), takeUntilDestroyed())\n\t\t\t.subscribe(() => this._activeDescendant.set(this._autocomplete.keyManager.activeItem?.id()));\n\n\t\teffect(() => {\n\t\t\tconst value = this.value();\n\t\t\tthis.elementRef.nativeElement.value = value;\n\t\t\tthis.valueChange.emit(value);\n\t\t});\n\t}\n\t/** Listen for changes to the input value */\n\tprotected onInput(): void {\n\t\tthis.value.set(this.elementRef.nativeElement.value);\n\t}\n\n\t/** Listen for keydown events */\n\tprotected onKeyDown(event: KeyboardEvent): void {\n\t\tif (event.key === 'Enter') {\n\t\t\t// prevent form submission if inside a form\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\tif (!this._isExpanded()) {\n\t\t\tif (event.key === 'ArrowDown') {\n\t\t\t\tthis._autocomplete.open('first');\n\t\t\t}\n\n\t\t\tif (event.key === 'ArrowUp') {\n\t\t\t\tthis._autocomplete.open('last');\n\t\t\t}\n\n\t\t\tif (event.key === 'Escape') {\n\t\t\t\tthis.value.set('');\n\t\t\t}\n\t\t}\n\n\t\tthis._autocomplete.keyManager.onKeydown(event);\n\t}\n\n\t/** CONROL VALUE ACCESSOR */\n\toverride writeValue(value: string | null): void {\n\t\tsuper.writeValue(value);\n\t\tif (value) {\n\t\t\tthis.value.set(value);\n\t\t}\n\t}\n}\n","import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';\nimport {\n\tcomputed,\n\tcontentChild,\n\tcontentChildren,\n\tDirective,\n\teffect,\n\tinject,\n\tInjector,\n\tinput,\n\toutput,\n\tsignal,\n\tuntracked,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { BrnPopover } from '@spartan-ng/brain/popover';\nimport type { BrnAutocompleteItem } from './brn-autocomplete-item';\nimport { BrnAutocompleteItemToken } from './brn-autocomplete-item.token';\nimport { BrnAutocompleteSearchInput } from './brn-autocomplete-search-input';\nimport { provideBrnAutocomplete } from './brn-autocomplete.token';\n\n@Directive({\n\tselector: '[brnAutocomplete]',\n\tproviders: [provideBrnAutocomplete(BrnAutocomplete)],\n\thost: {\n\t\t'[id]': 'id()',\n\t\t'(keydown.enter)': 'selectActiveItem()',\n\t},\n})\nexport class BrnAutocomplete<T> {\n\tprivate static _id = 0;\n\n\tprivate readonly _injector = inject(Injector);\n\n\t/** The id of the autocomplete */\n\tpublic readonly id = input<string>(`brn-autocomplete-${++BrnAutocomplete._id}`);\n\n\t/** when the selection has changed */\n\tpublic readonly valueChange = output<T>();\n\n\t/** @internal The search query */\n\tpublic readonly search = computed(() => this._searchInput()?.value() ?? '');\n\n\t/** Access the popover if present */\n\tprivate readonly _brnPopover = inject(BrnPopover, { optional: true });\n\n\t/** Access the search input if present */\n\tprivate readonly _searchInput = contentChild(BrnAutocompleteSearchInput, {\n\t\tdescendants: true,\n\t});\n\n\t/** @internal The focus strategy when opening */\n\tprivate readonly _focus = signal<'first' | 'last'>('first');\n\n\t/** @internal Access all the items within the autocomplete */\n\tpublic readonly items = contentChildren<BrnAutocompleteItem<T>>(BrnAutocompleteItemToken, {\n\t\tdescendants: true,\n\t});\n\n\t/** @internal The key manager for managing active descendant */\n\tpublic readonly keyManager = new ActiveDescendantKeyManager(this.items, this._injector);\n\n\t/** @internal Whether the autocomplete is expanded */\n\tpublic readonly isExpanded = computed(() => this._brnPopover?.stateComputed() === 'open');\n\n\tconstructor() {\n\t\tthis.keyManager\n\t\t\t.withVerticalOrientation()\n\t\t\t.withHomeAndEnd()\n\t\t\t.withWrap()\n\t\t\t.skipPredicate((item) => item.disabled);\n\n\t\teffect(() => {\n\t\t\tconst items = this.items();\n\t\t\tconst focus = this._focus();\n\n\t\t\tuntracked(() => {\n\t\t\t\tif (!items.length) return;\n\n\t\t\t\tconst activeItem = this.keyManager.activeItem;\n\n\t\t\t\tif (!activeItem || !items.includes(activeItem)) {\n\t\t\t\t\tfocus === 'first' ? this.keyManager.setFirstItemActive() : this.keyManager.setLastItemActive();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\tthis.keyManager.change.pipe(takeUntilDestroyed()).subscribe(() => {\n\t\t\tconst value = this.keyManager.activeItem?.value();\n\t\t\tif (value) {\n\t\t\t\tthis.valueChange.emit(value);\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected selectActiveItem(): void {\n\t\tif (this._brnPopover?.stateComputed() === 'open') {\n\t\t\tthis.keyManager.activeItem?.selected.emit();\n\t\t}\n\t}\n\n\topen(focus: 'first' | 'last' = 'first') {\n\t\tthis._brnPopover?.open();\n\t\tthis._focus.set(focus);\n\t}\n\n\tclose() {\n\t\tthis._brnPopover?.close();\n\t}\n\n\ttoggle() {\n\t\tthis.isExpanded() ? this.close() : this.open();\n\t}\n}\n","import { computed, Directive, effect, inject, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { injectBrnAutocomplete } from './brn-autocomplete.token';\n\n@Directive({\n\tselector: '[brnAutocompleteEmpty]',\n})\nexport class BrnAutocompleteEmpty {\n\tprivate readonly _templateRef = inject<TemplateRef<void>>(TemplateRef);\n\tprivate readonly _viewContainerRef = inject(ViewContainerRef);\n\tprivate readonly _autocomplete = injectBrnAutocomplete();\n\n\t/** Determine if the autocomplete has any items */\n\tprivate readonly _visible = computed(() => this._autocomplete.items().length > 0);\n\n\tconstructor() {\n\t\teffect(() => {\n\t\t\tif (this._visible()) {\n\t\t\t\tthis._viewContainerRef.clear();\n\t\t\t} else {\n\t\t\t\tthis._viewContainerRef.createEmbeddedView(this._templateRef);\n\t\t\t}\n\t\t});\n\t}\n}\n","import { Directive, input } from '@angular/core';\n\n@Directive({\n\tselector: '[brnAutocompleteGroup]',\n\thost: {\n\t\trole: 'group',\n\t\t'[id]': 'id()',\n\t},\n})\nexport class BrnAutocompleteGroup {\n\tprivate static _id = 0;\n\n\t/** The id of the autocomplete list */\n\tpublic readonly id = input<string>(`brn-autocomplete-group-${++BrnAutocompleteGroup._id}`);\n}\n","import type { Highlightable } from '@angular/cdk/a11y';\nimport type { BooleanInput } from '@angular/cdk/coercion';\nimport { isPlatformBrowser } from '@angular/common';\nimport { booleanAttribute, Directive, ElementRef, inject, input, output, PLATFORM_ID, signal } from '@angular/core';\nimport { provideBrnAutocompleteItem } from './brn-autocomplete-item.token';\nimport { injectBrnAutocomplete } from './brn-autocomplete.token';\n\n@Directive({\n\tselector: 'button[brnAutocompleteItem]',\n\tproviders: [provideBrnAutocompleteItem(BrnAutocompleteItem)],\n\thost: {\n\t\ttype: 'button',\n\t\trole: 'option',\n\t\ttabIndex: '-1',\n\t\t'[id]': 'id()',\n\t\t'[attr.disabled]': '_disabled() ? true : null',\n\t\t'[attr.data-disabled]': '_disabled() ? \"\" : null',\n\t\t'[attr.data-value]': 'value()',\n\t\t'[attr.aria-selected]': '_active()',\n\t\t'[attr.data-selected]': \"_active() ? '' : null\",\n\t\t'(click)': 'onClick()',\n\t\t'(mouseenter)': 'activate()',\n\t},\n})\nexport class BrnAutocompleteItem<T> implements Highlightable {\n\tprivate static _id = 0;\n\n\tprivate readonly _platform = inject(PLATFORM_ID);\n\n\tprivate readonly _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n\t/** Access the autocomplete component */\n\tprivate readonly _autocomplete = injectBrnAutocomplete<T>();\n\n\t/** A unique id for the item */\n\tpublic readonly id = input(`brn-autocomplete-item-${++BrnAutocompleteItem._id}`);\n\n\t/** The value this item represents. */\n\tpublic readonly value = input.required<T>();\n\n\t/** Whether the item is disabled. */\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\tpublic readonly _disabled = input<boolean, BooleanInput>(false, {\n\t\talias: 'disabled',\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/** Expose disabled as a value - used by the Highlightable interface */\n\tpublic get disabled() {\n\t\treturn this._disabled();\n\t}\n\n\t/** Whether the item is selected. */\n\tprotected readonly _active = signal(false);\n\n\t/** Emits when the item is selected. */\n\tpublic readonly selected = output<void>();\n\n\t/** @internal Get the display value */\n\tpublic getLabel(): string {\n\t\treturn this._elementRef.nativeElement.textContent?.trim() ?? '';\n\t}\n\n\t/** @internal */\n\tsetActiveStyles(): void {\n\t\tthis._active.set(true);\n\n\t\t// ensure the item is in view\n\t\tif (isPlatformBrowser(this._platform)) {\n\t\t\tthis._elementRef.nativeElement.scrollIntoView({ block: 'nearest' });\n\t\t}\n\t}\n\n\t/** @internal */\n\tsetInactiveStyles(): void {\n\t\tthis._active.set(false);\n\t}\n\n\tprotected onClick(): void {\n\t\tthis._autocomplete.keyManager.setActiveItem(this);\n\t\tthis.selected.emit();\n\t}\n\n\tprotected activate(): void {\n\t\tif (this._disabled()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._autocomplete.keyManager.setActiveItem(this);\n\t}\n}\n","import { Directive, input } from '@angular/core';\n\n@Directive({\n\tselector: '[brnAutocompleteList]',\n\thost: {\n\t\trole: 'listbox',\n\t\t'[id]': 'id()',\n\t},\n})\nexport class BrnAutocompleteList {\n\tprivate static _id = 0;\n\n\t/** The id of the command list */\n\tpublic readonly id = input<string>(`brn-autocomplete-list-${++BrnAutocompleteList._id}`);\n}\n","import { BrnAutocomplete } from './lib/brn-autocomplete';\nimport { BrnAutocompleteEmpty } from './lib/brn-autocomplete-empty';\nimport { BrnAutocompleteGroup } from './lib/brn-autocomplete-group';\nimport { BrnAutocompleteItem } from './lib/brn-autocomplete-item';\nimport { BrnAutocompleteList } from './lib/brn-autocomplete-list';\nimport { BrnAutocompleteSearchInput } from './lib/brn-autocomplete-search-input';\n\nexport * from './lib/brn-autocomplete';\nexport * from './lib/brn-autocomplete-empty';\nexport * from './lib/brn-autocomplete-group';\nexport * from './lib/brn-autocomplete-item';\nexport * from './lib/brn-autocomplete-item.token';\nexport * from './lib/brn-autocomplete-list';\nexport * from './lib/brn-autocomplete-search-input';\nexport * from './lib/brn-autocomplete-search-input.token';\nexport * from './lib/brn-autocomplete.token';\n\nexport const BrnAutocompleteImports = [\n\tBrnAutocomplete,\n\tBrnAutocompleteEmpty,\n\tBrnAutocompleteGroup,\n\tBrnAutocompleteItem,\n\tBrnAutocompleteList,\n\tBrnAutocompleteSearchInput,\n] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;MAGa,wBAAwB,GAAG,IAAI,cAAc,CAA+B,0BAA0B;AAE7G,SAAU,0BAA0B,CAAI,YAA0C,EAAA;IACvF,OAAO,EAAE,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,YAAY,EAAE;AACxE;;MCJa,+BAA+B,GAAG,IAAI,cAAc,CAChE,iCAAiC;AAG5B,SAAU,iCAAiC,CAAC,YAA8C,EAAA;IAC/F,OAAO,EAAE,OAAO,EAAE,+BAA+B,EAAE,WAAW,EAAE,YAAY,EAAE;AAC/E;;MCNa,oBAAoB,GAAG,IAAI,cAAc,CAA2B,sBAAsB;AAEjG,SAAU,sBAAsB,CAAI,YAAsC,EAAA;IAC/E,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,YAAY,EAAE;AACpE;SAEgB,qBAAqB,GAAA;AACpC,IAAA,OAAO,MAAM,CAAC,oBAAoB,CAAuB;AAC1D;;AC0BM,MAAO,0BAA2B,SAAQ,oBAAoB,CAAA;AAiBjD,IAAA,UAAA;IAhBD,aAAa,GAAG,qBAAqB,EAAE;;AAGxC,IAAA,KAAK,GAAG,KAAK,CAAS,EAAE,CAAC;;IAGzB,WAAW,GAAG,MAAM,EAAU;;AAG3B,IAAA,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU;;AAG3C,IAAA,iBAAiB,GAAG,MAAM,CAAqB,SAAS,CAAC;AAE5E,IAAA,WAAA,CACC,QAAmB,EACF,U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A,eAAA,CAAA,SAAA,EAAA,CAAA;8GAAnB,mBAAmB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,uBAAA,EAAA,MAAA,EAAA,EAAA,EAAA,EAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,MAAA,EAAA,SAAA,EAAA,EAAA,UAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAP/B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,uBAAuB;AACjC,oBAAA,IAAI,EAAE;AACL,wBAAA,IAAI,EAAE,SAAS;AACf,wBAAA,MAAM,EAAE,MAAM;AACd,qBAAA;AACD,iBAAA;;;ACSM,MAAM,sBAAsB,GAAG;IACrC,eAAe;IACf,oBAAoB;IACpB,oBAAoB;IACpB,mBAAmB;IACnB,mBAAmB;IACnB,0BAA0B;;;ACvB3B;;AAEG;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, ElementRef, input, computed, Directive, signal, Injectable, ChangeDetectorRef, Injector, booleanAttribute, model, numberAttribute, contentChild, contentChildren, afterNextRender, effect,
|
|
2
|
+
import { InjectionToken, inject, ElementRef, input, computed, Directive, signal, Injectable, ChangeDetectorRef, Injector, booleanAttribute, model, numberAttribute, contentChild, contentChildren, linkedSignal, afterNextRender, effect, ViewContainerRef, TemplateRef, untracked } from '@angular/core';
|
|
3
3
|
import { injectDateAdapter } from '@spartan-ng/brain/date-time';
|
|
4
4
|
import { BrnSelect } from '@spartan-ng/brain/select';
|
|
5
5
|
|
|
@@ -289,24 +289,17 @@ class BrnCalendar {
|
|
|
289
289
|
_cells = contentChildren(BrnCalendarCellButton, {
|
|
290
290
|
descendants: true,
|
|
291
291
|
});
|
|
292
|
-
/**
|
|
293
|
-
* @internal
|
|
294
|
-
* The internal state of the component.
|
|
295
|
-
*/
|
|
296
|
-
state = computed(() => ({
|
|
297
|
-
focusedDate: signal(this.constrainDate(this.defaultFocusedDate() ?? this.date() ?? this._dateAdapter.now())),
|
|
298
|
-
}));
|
|
299
292
|
/**
|
|
300
293
|
* The focused date.
|
|
301
294
|
*/
|
|
302
|
-
focusedDate =
|
|
295
|
+
focusedDate = linkedSignal(() => this.constrainDate(this.defaultFocusedDate() ?? this.date() ?? this._dateAdapter.now()));
|
|
303
296
|
/**
|
|
304
297
|
* Get all the days to display, this is the days of the current month
|
|
305
298
|
* and the days of the previous and next month to fill the grid.
|
|
306
299
|
*/
|
|
307
300
|
days = computed(() => {
|
|
308
301
|
const weekStartsOn = this._weekStartsOn();
|
|
309
|
-
const month = this.
|
|
302
|
+
const month = this.focusedDate();
|
|
310
303
|
const days = [];
|
|
311
304
|
// Get the first and last day of the month.
|
|
312
305
|
let firstDay = this._dateAdapter.startOfMonth(month);
|
|
@@ -379,7 +372,7 @@ class BrnCalendar {
|
|
|
379
372
|
else {
|
|
380
373
|
this.date.set(date);
|
|
381
374
|
}
|
|
382
|
-
this.
|
|
375
|
+
this.focusedDate.set(date);
|
|
383
376
|
}
|
|
384
377
|
/** @internal Set the focused date */
|
|
385
378
|
setFocusedDate(date) {
|
|
@@ -387,7 +380,7 @@ class BrnCalendar {
|
|
|
387
380
|
if (this.isDateDisabled(date)) {
|
|
388
381
|
return;
|
|
389
382
|
}
|
|
390
|
-
this.
|
|
383
|
+
this.focusedDate.set(date);
|
|
391
384
|
// wait until the cells have all updated
|
|
392
385
|
afterNextRender({
|
|
393
386
|
write: () => {
|
|
@@ -484,19 +477,19 @@ class BrnCalendarMonthSelect {
|
|
|
484
477
|
_selectedMonth = computed(() => {
|
|
485
478
|
return this._i18n.config().months()[this._dateAdapter.getMonth(this._calendar.focusedDate())];
|
|
486
479
|
});
|
|
480
|
+
constructor() {
|
|
481
|
+
effect(() => {
|
|
482
|
+
this._select.writeValue(this._selectedMonth());
|
|
483
|
+
});
|
|
484
|
+
}
|
|
487
485
|
/** Focus selected month */
|
|
488
486
|
monthSelected(selectedMonth) {
|
|
489
487
|
const month = this._i18n
|
|
490
488
|
.config()
|
|
491
489
|
.months()
|
|
492
490
|
.findIndex((month) => month === selectedMonth);
|
|
493
|
-
const targetDate = this._dateAdapter.set(this._calendar.
|
|
494
|
-
this._calendar.
|
|
495
|
-
}
|
|
496
|
-
constructor() {
|
|
497
|
-
effect(() => {
|
|
498
|
-
this._select.writeValue(this._selectedMonth());
|
|
499
|
-
});
|
|
491
|
+
const targetDate = this._dateAdapter.set(this._calendar.focusedDate(), { month });
|
|
492
|
+
this._calendar.focusedDate.set(targetDate);
|
|
500
493
|
}
|
|
501
494
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarMonthSelect, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
502
495
|
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: BrnCalendarMonthSelect, isStandalone: true, selector: "brn-select[brnCalendarMonthSelect]", host: { listeners: { "valueChange": "monthSelected($event)" } }, ngImport: i0 });
|
|
@@ -520,15 +513,15 @@ class BrnCalendarNextButton {
|
|
|
520
513
|
_i18n = injectBrnCalendarI18n();
|
|
521
514
|
/** Focus the previous month */
|
|
522
515
|
focusPreviousMonth() {
|
|
523
|
-
const targetDate = this._dateAdapter.add(this._calendar.
|
|
516
|
+
const targetDate = this._dateAdapter.add(this._calendar.focusedDate(), { months: 1 });
|
|
524
517
|
// if the date is disabled, but there are available dates in the month, focus the last day of the month.
|
|
525
518
|
const possibleDate = this._calendar.constrainDate(targetDate);
|
|
526
519
|
if (this._dateAdapter.isSameMonth(possibleDate, targetDate)) {
|
|
527
520
|
// if this date is within the same month, then focus it
|
|
528
|
-
this._calendar.
|
|
521
|
+
this._calendar.focusedDate.set(possibleDate);
|
|
529
522
|
return;
|
|
530
523
|
}
|
|
531
|
-
this._calendar.
|
|
524
|
+
this._calendar.focusedDate.set(targetDate);
|
|
532
525
|
}
|
|
533
526
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarNextButton, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
534
527
|
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: BrnCalendarNextButton, isStandalone: true, selector: "[brnCalendarNextButton]", host: { attributes: { "type": "button" }, listeners: { "click": "focusPreviousMonth()" }, properties: { "attr.aria-label": "_i18n.config().labelNext()" } }, ngImport: i0 });
|
|
@@ -540,12 +533,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
540
533
|
host: {
|
|
541
534
|
type: 'button',
|
|
542
535
|
'[attr.aria-label]': '_i18n.config().labelNext()',
|
|
536
|
+
'(click)': 'focusPreviousMonth()',
|
|
543
537
|
},
|
|
544
538
|
}]
|
|
545
|
-
}]
|
|
546
|
-
type: HostListener,
|
|
547
|
-
args: ['click']
|
|
548
|
-
}] } });
|
|
539
|
+
}] });
|
|
549
540
|
|
|
550
541
|
class BrnCalendarPreviousButton {
|
|
551
542
|
/** Access the calendar */
|
|
@@ -556,15 +547,15 @@ class BrnCalendarPreviousButton {
|
|
|
556
547
|
_i18n = injectBrnCalendarI18n();
|
|
557
548
|
/** Focus the previous month */
|
|
558
549
|
focusPreviousMonth() {
|
|
559
|
-
const targetDate = this._dateAdapter.subtract(this._calendar.
|
|
550
|
+
const targetDate = this._dateAdapter.subtract(this._calendar.focusedDate(), { months: 1 });
|
|
560
551
|
// if the date is disabled, but there are available dates in the month, focus the last day of the month.
|
|
561
552
|
const possibleDate = this._calendar.constrainDate(targetDate);
|
|
562
553
|
if (this._dateAdapter.isSameMonth(possibleDate, targetDate)) {
|
|
563
554
|
// if this date is within the same month, then focus it
|
|
564
|
-
this._calendar.
|
|
555
|
+
this._calendar.focusedDate.set(possibleDate);
|
|
565
556
|
return;
|
|
566
557
|
}
|
|
567
|
-
this._calendar.
|
|
558
|
+
this._calendar.focusedDate.set(targetDate);
|
|
568
559
|
}
|
|
569
560
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarPreviousButton, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
570
561
|
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: BrnCalendarPreviousButton, isStandalone: true, selector: "[brnCalendarPreviousButton]", host: { attributes: { "type": "button" }, listeners: { "click": "focusPreviousMonth()" }, properties: { "attr.aria-label": "_i18n.config().labelPrevious()" } }, ngImport: i0 });
|
|
@@ -576,12 +567,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
576
567
|
host: {
|
|
577
568
|
type: 'button',
|
|
578
569
|
'[attr.aria-label]': '_i18n.config().labelPrevious()',
|
|
570
|
+
'(click)': 'focusPreviousMonth()',
|
|
579
571
|
},
|
|
580
572
|
}]
|
|
581
|
-
}]
|
|
582
|
-
type: HostListener,
|
|
583
|
-
args: ['click']
|
|
584
|
-
}] } });
|
|
573
|
+
}] });
|
|
585
574
|
|
|
586
575
|
class BrnCalendarWeek {
|
|
587
576
|
/** Access the calendar */
|
|
@@ -715,16 +704,16 @@ class BrnCalendarYearSelect {
|
|
|
715
704
|
_dateAdapter = injectDateAdapter();
|
|
716
705
|
/** Access the calendar i18n */
|
|
717
706
|
_i18n = injectBrnCalendarI18n();
|
|
718
|
-
/** Focus selected year */
|
|
719
|
-
yearSelected(year) {
|
|
720
|
-
const targetDate = this._dateAdapter.set(this._calendar.state().focusedDate(), { year });
|
|
721
|
-
this._calendar.state().focusedDate.set(targetDate);
|
|
722
|
-
}
|
|
723
707
|
constructor() {
|
|
724
708
|
effect(() => {
|
|
725
709
|
this._select.writeValue(this._dateAdapter.getYear(this._calendar.focusedDate()));
|
|
726
710
|
});
|
|
727
711
|
}
|
|
712
|
+
/** Focus selected year */
|
|
713
|
+
yearSelected(year) {
|
|
714
|
+
const targetDate = this._dateAdapter.set(this._calendar.focusedDate(), { year });
|
|
715
|
+
this._calendar.focusedDate.set(targetDate);
|
|
716
|
+
}
|
|
728
717
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BrnCalendarYearSelect, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
729
718
|
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: BrnCalendarYearSelect, isStandalone: true, selector: "brn-select[brnCalendarYearSelect]", host: { listeners: { "valueChange": "yearSelected($event)" } }, ngImport: i0 });
|
|
730
719
|
}
|
|
@@ -806,24 +795,17 @@ class BrnCalendarMulti {
|
|
|
806
795
|
_cells = contentChildren(BrnCalendarCellButton, {
|
|
807
796
|
descendants: true,
|
|
808
797
|
});
|
|
809
|
-
/**
|
|
810
|
-
* @internal
|
|
811
|
-
* The internal state of the component.
|
|
812
|
-
*/
|
|
813
|
-
state = computed(() => ({
|
|
814
|
-
focusedDate: signal(this.constrainDate(this.defaultFocusedDate() ?? this._dateAdapter.now())),
|
|
815
|
-
}));
|
|
816
798
|
/**
|
|
817
799
|
* The focused date.
|
|
818
800
|
*/
|
|
819
|
-
focusedDate =
|
|
801
|
+
focusedDate = linkedSignal(() => this.constrainDate(this.defaultFocusedDate() ?? this._dateAdapter.now()));
|
|
820
802
|
/**
|
|
821
803
|
* Get all the days to display, this is the days of the current month
|
|
822
804
|
* and the days of the previous and next month to fill the grid.
|
|
823
805
|
*/
|
|
824
806
|
days = computed(() => {
|
|
825
807
|
const weekStartsOn = this._weekStartsOn();
|
|
826
|
-
const month = this.
|
|
808
|
+
const month = this.focusedDate();
|
|
827
809
|
const days = [];
|
|
828
810
|
// Get the first and last day of the month.
|
|
829
811
|
let firstDay = this._dateAdapter.startOfMonth(month);
|
|
@@ -917,7 +899,7 @@ class BrnCalendarMulti {
|
|
|
917
899
|
if (this.isDateDisabled(date)) {
|
|
918
900
|
return;
|
|
919
901
|
}
|
|
920
|
-
this.
|
|
902
|
+
this.focusedDate.set(date);
|
|
921
903
|
// wait until the cells have all updated
|
|
922
904
|
afterNextRender({
|
|
923
905
|
write: () => {
|
|
@@ -975,17 +957,10 @@ class BrnCalendarRange {
|
|
|
975
957
|
_cells = contentChildren(BrnCalendarCellButton, {
|
|
976
958
|
descendants: true,
|
|
977
959
|
});
|
|
978
|
-
/**
|
|
979
|
-
* @internal
|
|
980
|
-
* The internal state of the component.
|
|
981
|
-
*/
|
|
982
|
-
state = computed(() => ({
|
|
983
|
-
focusedDate: signal(this.constrainDate(this.defaultFocusedDate() ?? this.startDate() ?? this._dateAdapter.now())),
|
|
984
|
-
}));
|
|
985
960
|
/**
|
|
986
961
|
* The focused date.
|
|
987
962
|
*/
|
|
988
|
-
focusedDate =
|
|
963
|
+
focusedDate = linkedSignal(() => this.constrainDate(this.defaultFocusedDate() ?? this.startDate() ?? this._dateAdapter.now()));
|
|
989
964
|
/**
|
|
990
965
|
* The selected start date
|
|
991
966
|
*/
|
|
@@ -1000,7 +975,7 @@ class BrnCalendarRange {
|
|
|
1000
975
|
*/
|
|
1001
976
|
days = computed(() => {
|
|
1002
977
|
const weekStartsOn = this._weekStartsOn();
|
|
1003
|
-
const month = this.
|
|
978
|
+
const month = this.focusedDate();
|
|
1004
979
|
const days = [];
|
|
1005
980
|
// Get the first and last day of the month.
|
|
1006
981
|
let firstDay = this._dateAdapter.startOfMonth(month);
|
|
@@ -1103,7 +1078,7 @@ class BrnCalendarRange {
|
|
|
1103
1078
|
if (this.isDateDisabled(date)) {
|
|
1104
1079
|
return;
|
|
1105
1080
|
}
|
|
1106
|
-
this.
|
|
1081
|
+
this.focusedDate.set(date);
|
|
1107
1082
|
// wait until the cells have all updated
|
|
1108
1083
|
afterNextRender({
|
|
1109
1084
|
write: () => {
|