@odx/angular 12.19.2 → 12.21.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/CHANGELOG.md +12 -0
- package/cdk/scrollable/README.md +3 -0
- package/cdk/scrollable/index.d.ts +1 -0
- package/cdk/scrollable/lib/scrollable.service.d.ts +53 -0
- package/components/autocomplete/lib/autocomplete.component.d.ts +7 -2
- package/components/tab-bar/lib/components/tab-bar-item/tab-bar-item.component.d.ts +4 -5
- package/components/tab-bar/lib/tab-bar.component.d.ts +22 -44
- package/esm2022/cdk/scrollable/index.mjs +2 -0
- package/esm2022/cdk/scrollable/lib/scrollable.service.mjs +108 -0
- package/esm2022/cdk/scrollable/odx-angular-cdk-scrollable.mjs +5 -0
- package/esm2022/components/autocomplete/lib/autocomplete.component.mjs +17 -16
- package/esm2022/components/tab-bar/lib/components/tab-bar-item/tab-bar-item.component.mjs +10 -17
- package/esm2022/components/tab-bar/lib/tab-bar.component.mjs +75 -114
- package/fesm2022/odx-angular-cdk-scrollable.mjs +115 -0
- package/fesm2022/odx-angular-cdk-scrollable.mjs.map +1 -0
- package/fesm2022/odx-angular-components-autocomplete.mjs +16 -15
- package/fesm2022/odx-angular-components-autocomplete.mjs.map +1 -1
- package/fesm2022/odx-angular-components-tab-bar.mjs +82 -128
- package/fesm2022/odx-angular-components-tab-bar.mjs.map +1 -1
- package/package.json +13 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { InjectionToken, inject, Component, ViewEncapsulation, ChangeDetectionStrategy, Directive, forwardRef, ContentChildren, ContentChild, HostListener, Pipe, NgModule } from '@angular/core';
|
|
3
|
+
import { InjectionToken, inject, Component, ViewEncapsulation, ChangeDetectionStrategy, Directive, input, forwardRef, ContentChildren, ContentChild, HostListener, Pipe, NgModule } from '@angular/core';
|
|
4
4
|
import * as i1 from '@odx/angular';
|
|
5
5
|
import { CoreModule, ReadonlyController, WithTabIndex, ClickOutsideDirective } from '@odx/angular';
|
|
6
6
|
import { AutocompleteControl, ODX_SEARCH_FILTER_HOST, BaseSearchFilterPipe } from '@odx/angular/cdk/autocomplete-control';
|
|
@@ -93,6 +93,11 @@ let AutocompleteComponent = class AutocompleteComponent extends AutocompleteCont
|
|
|
93
93
|
this.defaultActiveOptionIndex = 0;
|
|
94
94
|
this.patchValueFlag = false;
|
|
95
95
|
this.clickOutsideDirective = inject(ClickOutsideDirective, { host: true });
|
|
96
|
+
/** Text to display when no options are found.
|
|
97
|
+
*
|
|
98
|
+
* @type {string | null}
|
|
99
|
+
*/
|
|
100
|
+
this.notFoundText = input(null);
|
|
96
101
|
}
|
|
97
102
|
ngAfterViewInit() {
|
|
98
103
|
if (!this.options)
|
|
@@ -149,11 +154,12 @@ let AutocompleteComponent = class AutocompleteComponent extends AutocompleteCont
|
|
|
149
154
|
this.patchValueFlag = false;
|
|
150
155
|
return;
|
|
151
156
|
}
|
|
152
|
-
if (this.isOpen &&
|
|
153
|
-
this.closeDropdown();
|
|
154
|
-
}
|
|
155
|
-
else if (!this.isOpen && this.hasOptions) {
|
|
157
|
+
if (!this.isOpen && (this.hasOptions || !!this.notFoundText())) {
|
|
156
158
|
this.openDropdown();
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (this.isOpen && !this.hasOptions && !this.notFoundText()) {
|
|
162
|
+
this.closeDropdown();
|
|
157
163
|
}
|
|
158
164
|
}
|
|
159
165
|
handleClickEvent() {
|
|
@@ -168,7 +174,7 @@ let AutocompleteComponent = class AutocompleteComponent extends AutocompleteCont
|
|
|
168
174
|
this.openDropdown();
|
|
169
175
|
}
|
|
170
176
|
}
|
|
171
|
-
handleKeyboardEvent(event) {
|
|
177
|
+
async handleKeyboardEvent(event) {
|
|
172
178
|
if (this.isReadonly || this.isDisabled)
|
|
173
179
|
return;
|
|
174
180
|
if (event.key === 'Escape') {
|
|
@@ -191,11 +197,6 @@ let AutocompleteComponent = class AutocompleteComponent extends AutocompleteCont
|
|
|
191
197
|
if (!this.isOpen && event.key === 'Tab') {
|
|
192
198
|
return;
|
|
193
199
|
}
|
|
194
|
-
deferFn(() => {
|
|
195
|
-
if (!this.isOpen && this.hasOptions) {
|
|
196
|
-
this.openDropdown();
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
200
|
this.keyManager?.onKeydown(event);
|
|
200
201
|
}
|
|
201
202
|
activateSelectedOption() {
|
|
@@ -215,7 +216,7 @@ let AutocompleteComponent = class AutocompleteComponent extends AutocompleteCont
|
|
|
215
216
|
this.searchField?.blur();
|
|
216
217
|
}
|
|
217
218
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AutocompleteComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
218
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: AutocompleteComponent, isStandalone: true, selector: "odx-autocomplete", host: { listeners: { "click": "handleClickEvent()", "keydown": "handleKeyboardEvent($event)" } }, providers: [
|
|
219
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: AutocompleteComponent, isStandalone: true, selector: "odx-autocomplete", inputs: { notFoundText: { classPropertyName: "notFoundText", publicName: "notFoundText", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "handleClickEvent()", "keydown": "handleKeyboardEvent($event)" } }, providers: [
|
|
219
220
|
{
|
|
220
221
|
provide: AUTOCOMPLETE_CONTROL,
|
|
221
222
|
useExisting: forwardRef(() => AutocompleteComponent),
|
|
@@ -224,14 +225,14 @@ let AutocompleteComponent = class AutocompleteComponent extends AutocompleteCont
|
|
|
224
225
|
provide: ODX_SEARCH_FILTER_HOST,
|
|
225
226
|
useExisting: AUTOCOMPLETE_CONTROL,
|
|
226
227
|
},
|
|
227
|
-
], queries: [{ propertyName: "searchField", first: true, predicate: AutocompleteInputControlDirective, descendants: true }, { propertyName: "options", predicate: AutocompleteOptionComponent, descendants: true }], usesInheritance: true, hostDirectives: [{ directive: i1.ClickOutsideDirective }], ngImport: i0, template: "<div\n aria-haspopup=\"listbox\"\n class=\"odx-autocomplete__trigger\"\n [odxDropdown]=\"dropdownContent\"\n [odxDropdownDisabled]=\"isDisabled || isReadonly\"\n [odxDropdownOptions]=\"{ matchReferenceWidth: true, offset: 4, outerPadding: 10, position: 'bottom-start' }\"\n [odxDropdownReferenceElement]=\"dropdownReferenceElement\"\n [odxDropdownShowLoader]=\"isLoading\"\n [odxDropdownOpenTrigger]=\"[]\"\n [odxDropdownClickOutsideActive]=\"false\"\n (odxDropdownBeforeOpen)=\"onDropdownOpen()\"\n (odxDropdownAfterOpen)=\"onDropdownOpened()\"\n (odxDropdownBeforeClose)=\"onDropdownClose()\"\n (odxDropdownAfterClose)=\"onDropdownClosed()\"\n>\n <ng-content select=\"input[odxAutocompleteControl]\" />\n</div>\n<ng-template #dropdownContent>\n <div class=\"odx-dropdown__option-list\" role=\"listbox\">\n @if (hasOptions) {\n <ng-content />\n }\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: DropdownDirective, selector: "[odxDropdown]", inputs: ["odxDropdown", "odxDropdownDisabled", "odxDropdownShowLoader", "odxDropdownClickOutsideActive", "odxDropdownOptions", "odxDropdownReferenceElement", "odxDropdownTriggerElement", "odxDropdownHost", "odxDropdownOpenTrigger", "odxDropdownCloseTrigger"], outputs: ["odxDropdownBeforeOpen", "odxDropdownAfterOpen", "odxDropdownBeforeClose", "odxDropdownAfterClose"], exportAs: ["odxDropdown"] }, { kind: "ngmodule", type: LoadingSpinnerModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
228
|
+
], queries: [{ propertyName: "searchField", first: true, predicate: AutocompleteInputControlDirective, descendants: true }, { propertyName: "options", predicate: AutocompleteOptionComponent, descendants: true }], usesInheritance: true, hostDirectives: [{ directive: i1.ClickOutsideDirective }], ngImport: i0, template: "<div\n aria-haspopup=\"listbox\"\n class=\"odx-autocomplete__trigger\"\n [odxDropdown]=\"dropdownContent\"\n [odxDropdownDisabled]=\"isDisabled || isReadonly\"\n [odxDropdownOptions]=\"{ matchReferenceWidth: true, offset: 4, outerPadding: 10, position: 'bottom-start' }\"\n [odxDropdownReferenceElement]=\"dropdownReferenceElement\"\n [odxDropdownShowLoader]=\"isLoading\"\n [odxDropdownOpenTrigger]=\"[]\"\n [odxDropdownClickOutsideActive]=\"false\"\n (odxDropdownBeforeOpen)=\"onDropdownOpen()\"\n (odxDropdownAfterOpen)=\"onDropdownOpened()\"\n (odxDropdownBeforeClose)=\"onDropdownClose()\"\n (odxDropdownAfterClose)=\"onDropdownClosed()\"\n>\n <ng-content select=\"input[odxAutocompleteControl]\" />\n</div>\n<ng-template #dropdownContent>\n <div class=\"odx-dropdown__option-list\" role=\"listbox\">\n @if (hasOptions) {\n <ng-content />\n } @else if (!!notFoundText()) {\n <odx-autocomplete-option class=\"is-disabled\">{{ notFoundText() }}</odx-autocomplete-option>\n }\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: DropdownDirective, selector: "[odxDropdown]", inputs: ["odxDropdown", "odxDropdownDisabled", "odxDropdownShowLoader", "odxDropdownClickOutsideActive", "odxDropdownOptions", "odxDropdownReferenceElement", "odxDropdownTriggerElement", "odxDropdownHost", "odxDropdownOpenTrigger", "odxDropdownCloseTrigger"], outputs: ["odxDropdownBeforeOpen", "odxDropdownAfterOpen", "odxDropdownBeforeClose", "odxDropdownAfterClose"], exportAs: ["odxDropdown"] }, { kind: "ngmodule", type: LoadingSpinnerModule }, { kind: "component", type: AutocompleteOptionComponent, selector: "odx-autocomplete-option" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
228
229
|
};
|
|
229
230
|
AutocompleteComponent = __decorate([
|
|
230
231
|
CSSComponent('autocomplete')
|
|
231
232
|
], AutocompleteComponent);
|
|
232
233
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AutocompleteComponent, decorators: [{
|
|
233
234
|
type: Component,
|
|
234
|
-
args: [{ standalone: true, selector: 'odx-autocomplete', imports: [DropdownDirective, LoadingSpinnerModule], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
|
|
235
|
+
args: [{ standalone: true, selector: 'odx-autocomplete', imports: [DropdownDirective, LoadingSpinnerModule, AutocompleteOptionComponent], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
|
|
235
236
|
{
|
|
236
237
|
provide: AUTOCOMPLETE_CONTROL,
|
|
237
238
|
useExisting: forwardRef(() => AutocompleteComponent),
|
|
@@ -240,7 +241,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
240
241
|
provide: ODX_SEARCH_FILTER_HOST,
|
|
241
242
|
useExisting: AUTOCOMPLETE_CONTROL,
|
|
242
243
|
},
|
|
243
|
-
], hostDirectives: [ClickOutsideDirective], template: "<div\n aria-haspopup=\"listbox\"\n class=\"odx-autocomplete__trigger\"\n [odxDropdown]=\"dropdownContent\"\n [odxDropdownDisabled]=\"isDisabled || isReadonly\"\n [odxDropdownOptions]=\"{ matchReferenceWidth: true, offset: 4, outerPadding: 10, position: 'bottom-start' }\"\n [odxDropdownReferenceElement]=\"dropdownReferenceElement\"\n [odxDropdownShowLoader]=\"isLoading\"\n [odxDropdownOpenTrigger]=\"[]\"\n [odxDropdownClickOutsideActive]=\"false\"\n (odxDropdownBeforeOpen)=\"onDropdownOpen()\"\n (odxDropdownAfterOpen)=\"onDropdownOpened()\"\n (odxDropdownBeforeClose)=\"onDropdownClose()\"\n (odxDropdownAfterClose)=\"onDropdownClosed()\"\n>\n <ng-content select=\"input[odxAutocompleteControl]\" />\n</div>\n<ng-template #dropdownContent>\n <div class=\"odx-dropdown__option-list\" role=\"listbox\">\n @if (hasOptions) {\n <ng-content />\n }\n </div>\n</ng-template>\n" }]
|
|
244
|
+
], hostDirectives: [ClickOutsideDirective], template: "<div\n aria-haspopup=\"listbox\"\n class=\"odx-autocomplete__trigger\"\n [odxDropdown]=\"dropdownContent\"\n [odxDropdownDisabled]=\"isDisabled || isReadonly\"\n [odxDropdownOptions]=\"{ matchReferenceWidth: true, offset: 4, outerPadding: 10, position: 'bottom-start' }\"\n [odxDropdownReferenceElement]=\"dropdownReferenceElement\"\n [odxDropdownShowLoader]=\"isLoading\"\n [odxDropdownOpenTrigger]=\"[]\"\n [odxDropdownClickOutsideActive]=\"false\"\n (odxDropdownBeforeOpen)=\"onDropdownOpen()\"\n (odxDropdownAfterOpen)=\"onDropdownOpened()\"\n (odxDropdownBeforeClose)=\"onDropdownClose()\"\n (odxDropdownAfterClose)=\"onDropdownClosed()\"\n>\n <ng-content select=\"input[odxAutocompleteControl]\" />\n</div>\n<ng-template #dropdownContent>\n <div class=\"odx-dropdown__option-list\" role=\"listbox\">\n @if (hasOptions) {\n <ng-content />\n } @else if (!!notFoundText()) {\n <odx-autocomplete-option class=\"is-disabled\">{{ notFoundText() }}</odx-autocomplete-option>\n }\n </div>\n</ng-template>\n" }]
|
|
244
245
|
}], propDecorators: { options: [{
|
|
245
246
|
type: ContentChildren,
|
|
246
247
|
args: [AutocompleteOptionComponent, { descendants: true, emitDistinctChangesOnly: true }]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odx-angular-components-autocomplete.mjs","sources":["../../../../libs/angular/components/autocomplete/src/lib/autocomplete.tokens.ts","../../../../libs/angular/components/autocomplete/src/lib/components/option/autocomplete-option.component.ts","../../../../libs/angular/components/autocomplete/src/lib/components/option/autocomplete-option.component.html","../../../../libs/angular/components/autocomplete/src/lib/directives/autocomplete-input-control.directive.ts","../../../../libs/angular/components/autocomplete/src/lib/autocomplete.component.ts","../../../../libs/angular/components/autocomplete/src/lib/autocomplete.component.html","../../../../libs/angular/components/autocomplete/src/lib/pipes/autocomplete-search-filter.pipe.ts","../../../../libs/angular/components/autocomplete/src/lib/autocomplete.module.ts","../../../../libs/angular/components/autocomplete/src/odx-angular-components-autocomplete.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { AutocompleteComponent } from './autocomplete.component';\n\nexport const AUTOCOMPLETE_CONTROL = new InjectionToken<AutocompleteComponent>('@odx/angular/components/autocomplete::AutocompleteComponent');\n","import { ChangeDetectionStrategy, Component, inject, ViewEncapsulation } from '@angular/core';\nimport { CoreModule } from '@odx/angular';\nimport { OptionControl } from '@odx/angular/cdk/option-control';\nimport { CSSComponent } from '@odx/angular/internal';\nimport { deferFn } from '@odx/angular/utils';\nimport { AUTOCOMPLETE_CONTROL } from '../../autocomplete.tokens';\n\n/**\n * Represents an option component for the autocomplete control.\n *\n * @template T - The type of the option value.\n */\n@CSSComponent('autocomplete-option')\n@Component({\n standalone: true,\n selector: 'odx-autocomplete-option',\n imports: [CoreModule],\n templateUrl: './autocomplete-option.component.html',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class AutocompleteOptionComponent<T> extends OptionControl<T> {\n protected readonly autocompleteControl = inject(AUTOCOMPLETE_CONTROL);\n\n /**\n * Sets the active styles for the option component.\n */\n public setActiveStyles(): void {\n deferFn(() => {\n this.isActive = true;\n this.cdr.markForCheck();\n });\n\n if (this.autocompleteControl.isOpen) {\n this.autocompleteControl.scrollOptionIntoView(this);\n }\n }\n\n protected selectOption(): void {\n this.autocompleteControl.selectOption(this);\n }\n}\n","<ng-content />\n","import { Directive } from '@angular/core';\nimport { ReadonlyController, WithTabIndex } from '@odx/angular';\nimport { InputControlDirective } from '@odx/angular/cdk/custom-form-control';\nimport { CSSComponent } from '@odx/angular/internal';\n\n/**\n * Directive for controlling the input in an autocomplete component.\n * Extends the base InputControlDirective class.\n */\n@CSSComponent('autocomplete__control')\n@Directive({\n standalone: true,\n selector: 'input[odxAutocompleteControl]',\n host: {\n '[attr.readonly]': 'readonlyController?.readonly || null',\n },\n providers: [ReadonlyController.connect()],\n hostDirectives: [WithTabIndex],\n})\nexport class AutocompleteInputControlDirective extends InputControlDirective {\n protected readonly readonlyController = ReadonlyController.inject();\n}\n","import {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n ContentChild,\n ContentChildren,\n forwardRef,\n HostListener,\n inject,\n QueryList,\n ViewEncapsulation,\n} from '@angular/core';\nimport { ClickOutsideDirective } from '@odx/angular';\nimport { AutocompleteControl, ODX_SEARCH_FILTER_HOST } from '@odx/angular/cdk/autocomplete-control';\nimport { DropdownDirective } from '@odx/angular/components/dropdown';\nimport { LoadingSpinnerModule } from '@odx/angular/components/loading-spinner';\nimport { CSSComponent } from '@odx/angular/internal';\nimport { deferFn } from '@odx/angular/utils';\nimport { filter, tap } from 'rxjs';\nimport { AUTOCOMPLETE_CONTROL } from './autocomplete.tokens';\nimport { AutocompleteOptionComponent } from './components';\nimport { AutocompleteInputControlDirective } from './directives';\n\n/**\n * Represents an autocomplete component that provides user interface for a dropdown list to select from as users type.\n * It extends `AutocompleteControl`, integrating custom logic for handling keyboard and mouse events,\n * managing the dropdown state, and updating the associated search field.\n *\n * @see {AutocompleteControl}\n *\n * @template T - The type of the value handled by the autocomplete.\n */\n@CSSComponent('autocomplete')\n@Component({\n standalone: true,\n selector: 'odx-autocomplete',\n imports: [DropdownDirective, LoadingSpinnerModule],\n templateUrl: './autocomplete.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n providers: [\n {\n provide: AUTOCOMPLETE_CONTROL,\n useExisting: forwardRef(() => AutocompleteComponent),\n },\n {\n provide: ODX_SEARCH_FILTER_HOST,\n useExisting: AUTOCOMPLETE_CONTROL,\n },\n ],\n hostDirectives: [ClickOutsideDirective],\n})\nexport class AutocompleteComponent<T = unknown> extends AutocompleteControl<T | null> implements AfterViewInit {\n private readonly defaultActiveOptionIndex = 0;\n private patchValueFlag = false;\n protected readonly clickOutsideDirective = inject(ClickOutsideDirective, { host: true });\n\n /**\n * The list of autocomplete options.\n *\n * @type {QueryList<AutocompleteOptionComponent<T>> | undefined}\n */\n @ContentChildren(AutocompleteOptionComponent, { descendants: true, emitDistinctChangesOnly: true })\n public options?: QueryList<AutocompleteOptionComponent<T>>;\n\n /**\n * The search field input control.\n *\n * @type {AutocompleteInputControlDirective | undefined}\n */\n @ContentChild(AutocompleteInputControlDirective)\n public searchField?: AutocompleteInputControlDirective;\n\n public override ngAfterViewInit(): void {\n if (!this.options) return;\n if (this.value) this.updateSearchField(this.value);\n this.initKeyManager(this.options.toArray());\n this.handleQueryListOption(this.options);\n this.handleSearchFieldChanges();\n this.handleClickOutside();\n }\n\n /**\n * Selects an option, updates the value, updates the search field display,\n * emits the selected value, and closes the dropdown.\n *\n * @param {AutocompleteOptionComponent<T> | null} option - The option component to select. If the option is undefined or its value is undefined,\n * no action is taken.\n */\n public selectOption(option?: AutocompleteOptionComponent<T> | null): void {\n if (!option?.value) return;\n\n this.updateValue(option.value);\n this.updateSearchField(option.value);\n\n this.optionSelected.emit(option.value);\n\n this.closeDropdown();\n }\n\n /**\n * Resets the search field to its initial state and updates the value of the autocomplete\n * to an empty string or initial value.\n */\n public resetSearchField(): void {\n this.updateValue('' as T);\n this.searchField?.reset();\n }\n\n protected handleQueryListOption(options: QueryList<AutocompleteOptionComponent<T>>): void {\n options.changes\n .pipe(\n tap(() => deferFn(() => this.updateDropdownState())),\n filter(() => this.isOpen),\n this.takeUntilDestroyed(),\n )\n .subscribe(() => {\n deferFn(() => this.activateSelectedOption());\n });\n }\n\n protected handleSearchFieldChanges(): void {\n this.searchField?.valueChange$.pipe(this.takeUntilDestroyed()).subscribe(() => this.triggerControllerChange());\n }\n\n protected handleClickOutside(): void {\n this.clickOutsideDirective.odxClickOutside.pipe(this.takeUntilDestroyed()).subscribe(() => this.clickOutside());\n }\n\n protected clickOutside(): void {\n this.closeDropdown();\n this.blurSelectSearchField();\n }\n\n protected updateDropdownState(): void {\n if (this.patchValueFlag) {\n this.patchValueFlag = false;\n return;\n }\n\n if (this.isOpen && !this.hasOptions) {\n this.closeDropdown();\n } else if (!this.isOpen && this.hasOptions) {\n this.openDropdown();\n }\n }\n\n @HostListener('click')\n protected handleClickEvent() {\n if (this.isLoading && this.isOpen) {\n this.closeDropdown();\n this.blurSelectSearchField();\n return;\n }\n\n if (this.isReadonly || this.isDisabled) return;\n\n if (!this.isOpen && this.hasOptions) {\n this.openDropdown();\n }\n }\n\n @HostListener('keydown', ['$event'])\n protected handleKeyboardEvent(event: KeyboardEvent) {\n if (this.isReadonly || this.isDisabled) return;\n\n if (event.key === 'Escape') {\n this.resetSearchField();\n this.blurSelectSearchField();\n return;\n }\n\n if (this.isOpen && this.hasOptions) {\n if (event.key === 'Enter' || event.key === 'Tab') {\n event.preventDefault();\n event.stopImmediatePropagation();\n this.selectOption(this.keyManager?.activeItem as AutocompleteOptionComponent<T> | undefined);\n return;\n }\n }\n\n if (event.key === 'Enter') {\n this.optionSelected.emit((this.value ?? '') as T);\n return;\n }\n\n if (!this.isOpen && event.key === 'Tab') {\n return;\n }\n\n deferFn(() => {\n if (!this.isOpen && this.hasOptions) {\n this.openDropdown();\n }\n });\n\n this.keyManager?.onKeydown(event);\n }\n\n protected activateSelectedOption(): void {\n this.keyManager?.setActiveItem(this.defaultActiveOptionIndex);\n }\n\n protected override onDropdownClosed(): void {\n super.onDropdownClosed();\n !this.searchField?.nativeElementValue && this.blurSelectSearchField();\n }\n\n private updateSearchField(value: T): void {\n if (!this.searchField) return;\n this.patchValueFlag = true;\n this.searchField.nativeElementValue = this.stringify?.(value) ?? (value as string);\n }\n\n private blurSelectSearchField(): void {\n this.searchField?.blur();\n }\n}\n","<div\n aria-haspopup=\"listbox\"\n class=\"odx-autocomplete__trigger\"\n [odxDropdown]=\"dropdownContent\"\n [odxDropdownDisabled]=\"isDisabled || isReadonly\"\n [odxDropdownOptions]=\"{ matchReferenceWidth: true, offset: 4, outerPadding: 10, position: 'bottom-start' }\"\n [odxDropdownReferenceElement]=\"dropdownReferenceElement\"\n [odxDropdownShowLoader]=\"isLoading\"\n [odxDropdownOpenTrigger]=\"[]\"\n [odxDropdownClickOutsideActive]=\"false\"\n (odxDropdownBeforeOpen)=\"onDropdownOpen()\"\n (odxDropdownAfterOpen)=\"onDropdownOpened()\"\n (odxDropdownBeforeClose)=\"onDropdownClose()\"\n (odxDropdownAfterClose)=\"onDropdownClosed()\"\n>\n <ng-content select=\"input[odxAutocompleteControl]\" />\n</div>\n<ng-template #dropdownContent>\n <div class=\"odx-dropdown__option-list\" role=\"listbox\">\n @if (hasOptions) {\n <ng-content />\n }\n </div>\n</ng-template>\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { BaseSearchFilterPipe } from '@odx/angular/cdk/autocomplete-control';\n\n@Pipe({\n pure: false,\n name: 'odxAutocompleteSearchFilter',\n standalone: true,\n})\nexport class AutocompleteSearchFilterPipe extends BaseSearchFilterPipe implements PipeTransform {}\n","import { NgModule } from '@angular/core';\nimport { CoreModule } from '@odx/angular';\nimport { AutocompleteComponent } from './autocomplete.component';\nimport { AutocompleteOptionComponent } from './components';\nimport { AutocompleteInputControlDirective } from './directives';\nimport { AutocompleteSearchFilterPipe } from './pipes';\n\nconst modules = [AutocompleteComponent, AutocompleteInputControlDirective, AutocompleteSearchFilterPipe, AutocompleteOptionComponent];\n\n@NgModule({\n imports: modules,\n exports: [CoreModule, ...modules],\n})\nexport class AutocompleteModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;MAGa,oBAAoB,GAAG,IAAI,cAAc,CAAwB,6DAA6D;;ACI3I;;;;AAIG;AAUI,IAAM,2BAA2B,GAAjC,MAAM,2BAA+B,SAAQ,aAAgB,CAAA;AAA7D,IAAA,WAAA,GAAA;;AACc,QAAA,IAAA,CAAA,mBAAmB,GAAG,MAAM,CAAC,oBAAo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B,EAAE,2BAA2B,CAIxH,EAAA,OAAA,EAAA,CAAA,UAAU,EAJL,qBAAqB,EAAE,iCAAiC,EAAE,4BAA4B,EAAE,2BAA2B,CAAA,EAAA,CAAA,CAAA,EAAA;AAMvH,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,EANd,OAAA,EAAA,CAAA,qBAAqB,EAAmE,2BAA2B,EAIxH,UAAU,CAAA,EAAA,CAAA,CAAA,EAAA;;4FAET,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,OAAO;AAChB,oBAAA,OAAO,EAAE,CAAC,UAAU,EAAE,GAAG,OAAO,CAAC;AAClC,iBAAA,CAAA;;;ACZD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"odx-angular-components-autocomplete.mjs","sources":["../../../../libs/angular/components/autocomplete/src/lib/autocomplete.tokens.ts","../../../../libs/angular/components/autocomplete/src/lib/components/option/autocomplete-option.component.ts","../../../../libs/angular/components/autocomplete/src/lib/components/option/autocomplete-option.component.html","../../../../libs/angular/components/autocomplete/src/lib/directives/autocomplete-input-control.directive.ts","../../../../libs/angular/components/autocomplete/src/lib/autocomplete.component.ts","../../../../libs/angular/components/autocomplete/src/lib/autocomplete.component.html","../../../../libs/angular/components/autocomplete/src/lib/pipes/autocomplete-search-filter.pipe.ts","../../../../libs/angular/components/autocomplete/src/lib/autocomplete.module.ts","../../../../libs/angular/components/autocomplete/src/odx-angular-components-autocomplete.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { AutocompleteComponent } from './autocomplete.component';\n\nexport const AUTOCOMPLETE_CONTROL = new InjectionToken<AutocompleteComponent>('@odx/angular/components/autocomplete::AutocompleteComponent');\n","import { ChangeDetectionStrategy, Component, inject, ViewEncapsulation } from '@angular/core';\nimport { CoreModule } from '@odx/angular';\nimport { OptionControl } from '@odx/angular/cdk/option-control';\nimport { CSSComponent } from '@odx/angular/internal';\nimport { deferFn } from '@odx/angular/utils';\nimport { AUTOCOMPLETE_CONTROL } from '../../autocomplete.tokens';\n\n/**\n * Represents an option component for the autocomplete control.\n *\n * @template T - The type of the option value.\n */\n@CSSComponent('autocomplete-option')\n@Component({\n standalone: true,\n selector: 'odx-autocomplete-option',\n imports: [CoreModule],\n templateUrl: './autocomplete-option.component.html',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class AutocompleteOptionComponent<T> extends OptionControl<T> {\n protected readonly autocompleteControl = inject(AUTOCOMPLETE_CONTROL);\n\n /**\n * Sets the active styles for the option component.\n */\n public setActiveStyles(): void {\n deferFn(() => {\n this.isActive = true;\n this.cdr.markForCheck();\n });\n\n if (this.autocompleteControl.isOpen) {\n this.autocompleteControl.scrollOptionIntoView(this);\n }\n }\n\n protected selectOption(): void {\n this.autocompleteControl.selectOption(this);\n }\n}\n","<ng-content />\n","import { Directive } from '@angular/core';\nimport { ReadonlyController, WithTabIndex } from '@odx/angular';\nimport { InputControlDirective } from '@odx/angular/cdk/custom-form-control';\nimport { CSSComponent } from '@odx/angular/internal';\n\n/**\n * Directive for controlling the input in an autocomplete component.\n * Extends the base InputControlDirective class.\n */\n@CSSComponent('autocomplete__control')\n@Directive({\n standalone: true,\n selector: 'input[odxAutocompleteControl]',\n host: {\n '[attr.readonly]': 'readonlyController?.readonly || null',\n },\n providers: [ReadonlyController.connect()],\n hostDirectives: [WithTabIndex],\n})\nexport class AutocompleteInputControlDirective extends InputControlDirective {\n protected readonly readonlyController = ReadonlyController.inject();\n}\n","import {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n ContentChild,\n ContentChildren,\n forwardRef,\n HostListener,\n inject,\n input,\n QueryList,\n ViewEncapsulation,\n} from '@angular/core';\nimport { ClickOutsideDirective } from '@odx/angular';\nimport { AutocompleteControl, ODX_SEARCH_FILTER_HOST } from '@odx/angular/cdk/autocomplete-control';\nimport { DropdownDirective } from '@odx/angular/components/dropdown';\nimport { LoadingSpinnerModule } from '@odx/angular/components/loading-spinner';\nimport { CSSComponent } from '@odx/angular/internal';\nimport { deferFn } from '@odx/angular/utils';\nimport { filter, tap } from 'rxjs';\nimport { AUTOCOMPLETE_CONTROL } from './autocomplete.tokens';\nimport { AutocompleteOptionComponent } from './components';\nimport { AutocompleteInputControlDirective } from './directives';\n\n/**\n * Represents an autocomplete component that provides user interface for a dropdown list to select from as users type.\n * It extends `AutocompleteControl`, integrating custom logic for handling keyboard and mouse events,\n * managing the dropdown state, and updating the associated search field.\n *\n * @see {AutocompleteControl}\n *\n * @template T - The type of the value handled by the autocomplete.\n */\n@CSSComponent('autocomplete')\n@Component({\n standalone: true,\n selector: 'odx-autocomplete',\n imports: [DropdownDirective, LoadingSpinnerModule, AutocompleteOptionComponent],\n templateUrl: './autocomplete.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n providers: [\n {\n provide: AUTOCOMPLETE_CONTROL,\n useExisting: forwardRef(() => AutocompleteComponent),\n },\n {\n provide: ODX_SEARCH_FILTER_HOST,\n useExisting: AUTOCOMPLETE_CONTROL,\n },\n ],\n hostDirectives: [ClickOutsideDirective],\n})\nexport class AutocompleteComponent<T = unknown> extends AutocompleteControl<T | null> implements AfterViewInit {\n private readonly defaultActiveOptionIndex = 0;\n private patchValueFlag = false;\n protected readonly clickOutsideDirective = inject(ClickOutsideDirective, { host: true });\n\n /**\n * The list of autocomplete options.\n *\n * @type {QueryList<AutocompleteOptionComponent<T>> | undefined}\n */\n @ContentChildren(AutocompleteOptionComponent, { descendants: true, emitDistinctChangesOnly: true })\n public options?: QueryList<AutocompleteOptionComponent<T>>;\n\n /** Text to display when no options are found.\n *\n * @type {string | null}\n */\n public notFoundText = input<string | null>(null);\n\n /**\n * The search field input control.\n *\n * @type {AutocompleteInputControlDirective | undefined}\n */\n @ContentChild(AutocompleteInputControlDirective)\n public searchField?: AutocompleteInputControlDirective;\n\n public override ngAfterViewInit(): void {\n if (!this.options) return;\n if (this.value) this.updateSearchField(this.value);\n this.initKeyManager(this.options.toArray());\n this.handleQueryListOption(this.options);\n this.handleSearchFieldChanges();\n this.handleClickOutside();\n }\n\n /**\n * Selects an option, updates the value, updates the search field display,\n * emits the selected value, and closes the dropdown.\n *\n * @param {AutocompleteOptionComponent<T> | null} option - The option component to select. If the option is undefined or its value is undefined,\n * no action is taken.\n */\n public selectOption(option?: AutocompleteOptionComponent<T> | null): void {\n if (!option?.value) return;\n\n this.updateValue(option.value);\n this.updateSearchField(option.value);\n\n this.optionSelected.emit(option.value);\n\n this.closeDropdown();\n }\n\n /**\n * Resets the search field to its initial state and updates the value of the autocomplete\n * to an empty string or initial value.\n */\n public resetSearchField(): void {\n this.updateValue('' as T);\n this.searchField?.reset();\n }\n\n protected handleQueryListOption(options: QueryList<AutocompleteOptionComponent<T>>): void {\n options.changes\n .pipe(\n tap(() => deferFn(() => this.updateDropdownState())),\n filter(() => this.isOpen),\n this.takeUntilDestroyed(),\n )\n .subscribe(() => {\n deferFn(() => this.activateSelectedOption());\n });\n }\n\n protected handleSearchFieldChanges(): void {\n this.searchField?.valueChange$.pipe(this.takeUntilDestroyed()).subscribe(() => this.triggerControllerChange());\n }\n\n protected handleClickOutside(): void {\n this.clickOutsideDirective.odxClickOutside.pipe(this.takeUntilDestroyed()).subscribe(() => this.clickOutside());\n }\n\n protected clickOutside(): void {\n this.closeDropdown();\n this.blurSelectSearchField();\n }\n\n protected updateDropdownState(): void {\n if (this.patchValueFlag) {\n this.patchValueFlag = false;\n return;\n }\n if (!this.isOpen && (this.hasOptions || !!this.notFoundText())) {\n this.openDropdown();\n return;\n }\n if (this.isOpen && !this.hasOptions && !this.notFoundText()) {\n this.closeDropdown();\n }\n }\n\n @HostListener('click')\n protected handleClickEvent() {\n if (this.isLoading && this.isOpen) {\n this.closeDropdown();\n this.blurSelectSearchField();\n return;\n }\n\n if (this.isReadonly || this.isDisabled) return;\n\n if (!this.isOpen && this.hasOptions) {\n this.openDropdown();\n }\n }\n\n @HostListener('keydown', ['$event'])\n protected async handleKeyboardEvent(event: KeyboardEvent) {\n if (this.isReadonly || this.isDisabled) return;\n\n if (event.key === 'Escape') {\n this.resetSearchField();\n this.blurSelectSearchField();\n return;\n }\n\n if (this.isOpen && this.hasOptions) {\n if (event.key === 'Enter' || event.key === 'Tab') {\n event.preventDefault();\n event.stopImmediatePropagation();\n this.selectOption(this.keyManager?.activeItem as AutocompleteOptionComponent<T> | undefined);\n return;\n }\n }\n\n if (event.key === 'Enter') {\n this.optionSelected.emit((this.value ?? '') as T);\n return;\n }\n\n if (!this.isOpen && event.key === 'Tab') {\n return;\n }\n\n this.keyManager?.onKeydown(event);\n }\n\n protected activateSelectedOption(): void {\n this.keyManager?.setActiveItem(this.defaultActiveOptionIndex);\n }\n\n protected override onDropdownClosed(): void {\n super.onDropdownClosed();\n !this.searchField?.nativeElementValue && this.blurSelectSearchField();\n }\n\n private updateSearchField(value: T): void {\n if (!this.searchField) return;\n this.patchValueFlag = true;\n this.searchField.nativeElementValue = this.stringify?.(value) ?? (value as string);\n }\n\n private blurSelectSearchField(): void {\n this.searchField?.blur();\n }\n}\n","<div\n aria-haspopup=\"listbox\"\n class=\"odx-autocomplete__trigger\"\n [odxDropdown]=\"dropdownContent\"\n [odxDropdownDisabled]=\"isDisabled || isReadonly\"\n [odxDropdownOptions]=\"{ matchReferenceWidth: true, offset: 4, outerPadding: 10, position: 'bottom-start' }\"\n [odxDropdownReferenceElement]=\"dropdownReferenceElement\"\n [odxDropdownShowLoader]=\"isLoading\"\n [odxDropdownOpenTrigger]=\"[]\"\n [odxDropdownClickOutsideActive]=\"false\"\n (odxDropdownBeforeOpen)=\"onDropdownOpen()\"\n (odxDropdownAfterOpen)=\"onDropdownOpened()\"\n (odxDropdownBeforeClose)=\"onDropdownClose()\"\n (odxDropdownAfterClose)=\"onDropdownClosed()\"\n>\n <ng-content select=\"input[odxAutocompleteControl]\" />\n</div>\n<ng-template #dropdownContent>\n <div class=\"odx-dropdown__option-list\" role=\"listbox\">\n @if (hasOptions) {\n <ng-content />\n } @else if (!!notFoundText()) {\n <odx-autocomplete-option class=\"is-disabled\">{{ notFoundText() }}</odx-autocomplete-option>\n }\n </div>\n</ng-template>\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { BaseSearchFilterPipe } from '@odx/angular/cdk/autocomplete-control';\n\n@Pipe({\n pure: false,\n name: 'odxAutocompleteSearchFilter',\n standalone: true,\n})\nexport class AutocompleteSearchFilterPipe extends BaseSearchFilterPipe implements PipeTransform {}\n","import { NgModule } from '@angular/core';\nimport { CoreModule } from '@odx/angular';\nimport { AutocompleteComponent } from './autocomplete.component';\nimport { AutocompleteOptionComponent } from './components';\nimport { AutocompleteInputControlDirective } from './directives';\nimport { AutocompleteSearchFilterPipe } from './pipes';\n\nconst modules = [AutocompleteComponent, AutocompleteInputControlDirective, AutocompleteSearchFilterPipe, AutocompleteOptionComponent];\n\n@NgModule({\n imports: modules,\n exports: [CoreModule, ...modules],\n})\nexport class AutocompleteModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;MAGa,oBAAoB,GAAG,IAAI,cAAc,CAAwB,6DAA6D;;ACI3I;;;;AAIG;AAUI,IAAM,2BAA2B,GAAjC,MAAM,2BAA+B,SAAQ,aAAgB,CAAA;AAA7D,IAAA,WAAA,GAAA;;AACc,QAAA,IAAA,CAAA,mBAAmB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAmBvE,KAAA;AAjBC;;AAEG;IACI,eAAe,GAAA;QACpB,OAAO,CAAC,MAAK;AACX,YAAA,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;AACrB,YAAA,IAAI,CAAC,GAAG,CAAC,YAA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import { InjectionToken, inject, ElementRef,
|
|
4
|
+
import { InjectionToken, inject, ElementRef, input, booleanAttribute, output, Component, ViewEncapsulation, ChangeDetectionStrategy, contentChildren, computed, Injector, viewChild, model, effect, forwardRef, NgModule } from '@angular/core';
|
|
5
5
|
import { RouterLinkActive } from '@angular/router';
|
|
6
6
|
import { DisabledController, CoreModule } from '@odx/angular';
|
|
7
7
|
import { IconComponent } from '@odx/angular/components/icon';
|
|
8
|
-
import { CSSComponent
|
|
9
|
-
import { untilDestroyed, deferFn, injectElement
|
|
10
|
-
import { filter,
|
|
8
|
+
import { CSSComponent } from '@odx/angular/internal';
|
|
9
|
+
import { untilDestroyed, deferFn, injectElement } from '@odx/angular/utils';
|
|
10
|
+
import { filter, merge, tap, skip, distinctUntilChanged } from 'rxjs';
|
|
11
11
|
import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';
|
|
12
|
+
import { toObservable } from '@angular/core/rxjs-interop';
|
|
12
13
|
import { ActiveIndicatorDirective } from '@odx/angular/cdk/active-indicator';
|
|
13
|
-
import {
|
|
14
|
+
import { ScrollableService } from '@odx/angular/cdk/scrollable';
|
|
15
|
+
import { fromElementResize$ } from '@odx/angular/rxjs';
|
|
14
16
|
|
|
15
17
|
const TAB_BAR = new InjectionToken('tabBar');
|
|
16
18
|
|
|
@@ -40,13 +42,13 @@ let TabBarItemComponent = class TabBarItemComponent {
|
|
|
40
42
|
* @type {boolean}
|
|
41
43
|
* @default false
|
|
42
44
|
*/
|
|
43
|
-
this.closable = false;
|
|
45
|
+
this.closable = input(false, { transform: booleanAttribute });
|
|
44
46
|
/**
|
|
45
47
|
* Event emitter that fires when the tab is closed. It emits the instance of the tab item component.
|
|
46
48
|
*
|
|
47
49
|
* @emits {TabBarItemComponent}
|
|
48
50
|
*/
|
|
49
|
-
this.tabClose =
|
|
51
|
+
this.tabClose = output();
|
|
50
52
|
}
|
|
51
53
|
get disabled() {
|
|
52
54
|
return !!this.disabledController?.disabled;
|
|
@@ -77,13 +79,13 @@ let TabBarItemComponent = class TabBarItemComponent {
|
|
|
77
79
|
}
|
|
78
80
|
handleClose(event) {
|
|
79
81
|
event.stopPropagation();
|
|
80
|
-
if (this.disabled || !this.closable)
|
|
82
|
+
if (this.disabled || !this.closable())
|
|
81
83
|
return;
|
|
82
84
|
this.tabBar.removeItem(this);
|
|
83
85
|
this.tabClose.emit(this);
|
|
84
86
|
}
|
|
85
87
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TabBarItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
86
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: TabBarItemComponent, isStandalone: true, selector: "odx-tab-bar-item", inputs: { closable:
|
|
88
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: TabBarItemComponent, isStandalone: true, selector: "odx-tab-bar-item", inputs: { closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { tabClose: "tabClose" }, host: { attributes: { "role": "tab" }, listeners: { "click": "onClick()" }, properties: { "class.is-disabled": "disabled", "class.is-active": "isActive", "attr.aria-selected": "isActive", "class.is-closable": "closable()" } }, providers: [DisabledController.connect()], ngImport: i0, template: "<ng-content select=\"odx-icon\" />\n<div class=\"odx-tab-bar-item__label\"><ng-content /></div>\n@if (closable()) {\n <odx-icon name=\"close\" iconSet=\"core\" size=\"small\" (click)=\"handleClose($event)\" />\n}\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: IconComponent, selector: "odx-icon", inputs: ["inline", "size", "name", "iconSet", "identifier"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
87
89
|
};
|
|
88
90
|
TabBarItemComponent = __decorate([
|
|
89
91
|
CSSComponent('tab-bar-item')
|
|
@@ -94,18 +96,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
94
96
|
'[class.is-disabled]': 'disabled',
|
|
95
97
|
'[class.is-active]': 'isActive',
|
|
96
98
|
'[attr.aria-selected]': 'isActive',
|
|
97
|
-
'[class.is-closable]': 'closable',
|
|
99
|
+
'[class.is-closable]': 'closable()',
|
|
98
100
|
role: 'tab',
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
args: [{ transform: booleanAttribute }]
|
|
103
|
-
}], tabClose: [{
|
|
104
|
-
type: Output
|
|
105
|
-
}], onClick: [{
|
|
106
|
-
type: HostListener,
|
|
107
|
-
args: ['click']
|
|
108
|
-
}] } });
|
|
101
|
+
'(click)': 'onClick()',
|
|
102
|
+
}, template: "<ng-content select=\"odx-icon\" />\n<div class=\"odx-tab-bar-item__label\"><ng-content /></div>\n@if (closable()) {\n <odx-icon name=\"close\" iconSet=\"core\" size=\"small\" (click)=\"handleClose($event)\" />\n}\n" }]
|
|
103
|
+
}] });
|
|
109
104
|
|
|
110
105
|
/**
|
|
111
106
|
* `TabBarComponent` creates a dynamic and accessible tab bar interface,
|
|
@@ -119,23 +114,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
119
114
|
*/
|
|
120
115
|
let TabBarComponent = class TabBarComponent {
|
|
121
116
|
constructor() {
|
|
122
|
-
this.changeDetector = inject(ChangeDetectorRef);
|
|
123
117
|
this.takeUntilDestroyed = untilDestroyed();
|
|
124
|
-
this.
|
|
125
|
-
this.
|
|
118
|
+
this.scrollableService = inject(ScrollableService);
|
|
119
|
+
this.nextTab = this.scrollableService.nextItem;
|
|
120
|
+
this.prevTab = this.scrollableService.prevItem;
|
|
121
|
+
this.tabs = contentChildren(TabBarItemComponent);
|
|
122
|
+
this.activeItem = computed(() => this.tabs().at(this.selectedIndex()) ?? null);
|
|
123
|
+
this.keyManager = new ActiveDescendantKeyManager(this.tabs, inject(Injector))
|
|
124
|
+
.withWrap()
|
|
125
|
+
.withHomeAndEnd()
|
|
126
|
+
.withHorizontalOrientation('ltr')
|
|
127
|
+
.withVerticalOrientation(false);
|
|
128
|
+
this.scrollContainerElement = viewChild.required('scrollContainer');
|
|
126
129
|
this.element = injectElement();
|
|
127
130
|
/**
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*/
|
|
132
|
-
this.overflowLeft = false;
|
|
133
|
-
/**
|
|
134
|
-
* Indicates whether the tab bar has overflowed to the right.
|
|
131
|
+
* Index of the currently selected tab. Use this property to programmatically
|
|
132
|
+
* change the active tab. It responds to changes by updating the active state of the corresponding
|
|
133
|
+
* tab item and adjusting the view if necessary.
|
|
135
134
|
*
|
|
136
|
-
* @type {
|
|
135
|
+
* @type {number}
|
|
136
|
+
* @example
|
|
137
|
+
* Programmatically select the second tab (index starts from 0):
|
|
138
|
+
* ```html
|
|
139
|
+
* <odx-tab-bar [selectedIndex]="1"></odx-tab-bar>
|
|
140
|
+
* ```
|
|
137
141
|
*/
|
|
138
|
-
this.
|
|
142
|
+
this.selectedIndex = model(0);
|
|
139
143
|
/**
|
|
140
144
|
* An EventEmitter that emits whenever a new tab is selected. It provides the `TabChangeEvent`
|
|
141
145
|
* which contains the index of the newly selected tab and the instance of the corresponding
|
|
@@ -153,129 +157,79 @@ let TabBarComponent = class TabBarComponent {
|
|
|
153
157
|
* }
|
|
154
158
|
* ```
|
|
155
159
|
*/
|
|
156
|
-
this.selectedTabChanged =
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
ngAfterViewInit() {
|
|
174
|
-
this.keyManager = new ActiveDescendantKeyManager(this.tabs).withWrap().withHomeAndEnd().withHorizontalOrientation('ltr').withVerticalOrientation(false);
|
|
175
|
-
const updatePanelPosition$ = merge(this.selectedTabChanged, fromQueryList(this.tabs), fromElementResize$(this.element.nativeElement)).pipe(debounceTime(0), tap(() => this.updatePanelPosition()));
|
|
176
|
-
const updateActionVisibility$ = fromEvent(this.tabBarPanelElement.nativeElement, 'transitionend').pipe(tap(({ target }) => target === this.tabBarPanelElement.nativeElement && this.updateActionVisbility()));
|
|
177
|
-
const activeItemChange$ = merge(this.keyManager.change.pipe(tap(() => this.activeItemChange())), this.selectedIndex$$.pipe(tap((index) => this.keyManager?.setActiveItem(index))));
|
|
178
|
-
merge(activeItemChange$, updatePanelPosition$, updateActionVisibility$).pipe(this.takeUntilDestroyed()).subscribe();
|
|
179
|
-
this.tabs.changes.pipe(this.takeUntilDestroyed()).subscribe(() => this.selectedIndex$$.next(this.selectedIndex$$.value));
|
|
160
|
+
this.selectedTabChanged = output();
|
|
161
|
+
const tabState = computed(() => ({
|
|
162
|
+
selectedIndex: this.selectedIndex(),
|
|
163
|
+
selectedTab: this.activeItem(),
|
|
164
|
+
}));
|
|
165
|
+
merge(this.keyManager.change.pipe(tap((index) => this.selectedIndex.set(index ?? -1))), fromElementResize$(this.element.nativeElement, 600).pipe(tap(() => this.scrollableService.scrollActiveItemIntoView(this.activeItem()?.element.nativeElement ?? null))), toObservable(tabState).pipe(skip(1), distinctUntilChanged((a, b) => a.selectedIndex === b.selectedIndex), filter(({ selectedTab }) => !selectedTab?.disabled), tap((state) => {
|
|
166
|
+
this.selectedTabChanged.emit(state);
|
|
167
|
+
this.scrollableService.scrollActiveItemIntoView(state.selectedTab?.element.nativeElement ?? null);
|
|
168
|
+
})))
|
|
169
|
+
.pipe(this.takeUntilDestroyed())
|
|
170
|
+
.subscribe();
|
|
171
|
+
effect(() => {
|
|
172
|
+
this.keyManager.setActiveItem(this.selectedIndex());
|
|
173
|
+
}, { allowSignalWrites: true });
|
|
174
|
+
effect(() => {
|
|
175
|
+
this.scrollableService.observe(this.scrollContainerElement(), this.tabs());
|
|
176
|
+
});
|
|
180
177
|
}
|
|
181
178
|
/**
|
|
182
|
-
* Activates the specified tab item.
|
|
179
|
+
* Activates the specified tab item, making it the currently selected tab.
|
|
180
|
+
* If the item is already active, no action is taken.
|
|
183
181
|
*
|
|
184
|
-
* @param {TabBarItemComponent | null} item - The tab item to activate.
|
|
185
|
-
*
|
|
186
|
-
* @example
|
|
187
|
-
* ```ts
|
|
188
|
-
* // Activate the first tab item
|
|
189
|
-
* tabBar.activateItem(tabItems[0]);
|
|
190
|
-
*
|
|
191
|
-
* // Clear the active item
|
|
192
|
-
* tabBar.activateItem(null);
|
|
193
|
-
* ```
|
|
182
|
+
* @param {TabBarItemComponent | null} item - The tab item to activate.
|
|
194
183
|
*/
|
|
195
184
|
activateItem(item) {
|
|
196
|
-
if (item === this.activeItem)
|
|
185
|
+
if (item === this.keyManager?.activeItem)
|
|
197
186
|
return;
|
|
198
|
-
const selectedIndex = item ? this.tabs
|
|
199
|
-
this.
|
|
187
|
+
const selectedIndex = item ? this.tabs().indexOf(item) : -1;
|
|
188
|
+
this.selectedIndex.set(selectedIndex);
|
|
200
189
|
}
|
|
201
190
|
/**
|
|
202
|
-
*
|
|
203
|
-
* If the
|
|
191
|
+
* Fires when the specified tab item is removed from the tab bar.
|
|
192
|
+
* If the item is currently active, the previous tab is activated.
|
|
204
193
|
*
|
|
205
|
-
* @param {TabBarItemComponent} item - The item to
|
|
194
|
+
* @param {TabBarItemComponent} item - The tab item to remove.
|
|
206
195
|
*/
|
|
207
196
|
removeItem(item) {
|
|
208
|
-
if (this.activeItem !== item)
|
|
197
|
+
if (this.keyManager?.activeItem !== item)
|
|
209
198
|
return;
|
|
210
|
-
|
|
199
|
+
this.keyManager?.setPreviousItemActive();
|
|
211
200
|
}
|
|
212
201
|
onKeydown(event) {
|
|
213
202
|
this.keyManager?.onKeydown(event);
|
|
214
203
|
}
|
|
215
|
-
|
|
216
|
-
const
|
|
217
|
-
if (!
|
|
204
|
+
onFocused() {
|
|
205
|
+
const activeItem = this.activeItem()?.element.nativeElement;
|
|
206
|
+
if (!activeItem)
|
|
218
207
|
return;
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
const panelPositionX = tabBarRect.width / 2 - activeElement.offsetLeft - activeElement.offsetWidth / 2;
|
|
223
|
-
const positionX = Math.min(0, Math.max(panelPositionX, maxPanelPositionX));
|
|
224
|
-
applyStyles(this.tabBarPanelElement.nativeElement, {
|
|
225
|
-
transform: cssTranslate(px(positionX), 0),
|
|
226
|
-
});
|
|
227
|
-
this.updateActionVisbility();
|
|
228
|
-
}
|
|
229
|
-
updateActionVisbility() {
|
|
230
|
-
const panelRect = this.tabBarPanelElement.nativeElement.getBoundingClientRect();
|
|
231
|
-
const tabBarRect = this.element.nativeElement.getBoundingClientRect();
|
|
232
|
-
this.overflowLeft = panelRect.left < tabBarRect.left;
|
|
233
|
-
this.overflowRight = panelRect.right > tabBarRect.right;
|
|
234
|
-
this.changeDetector.detectChanges();
|
|
208
|
+
if (this.scrollableService.visibleItems().includes(activeItem))
|
|
209
|
+
return;
|
|
210
|
+
this.scrollableService.scrollActiveItemIntoView(activeItem);
|
|
235
211
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
this.activeItem = activeItem ?? null;
|
|
239
|
-
this.selectedTabChanged.emit({ selectedIndex: activeItemIndex ?? -1, selectedTab: this.keyManager?.activeItem ?? null });
|
|
212
|
+
scrollTabs(direction = 1) {
|
|
213
|
+
this.scrollableService.scroll(direction);
|
|
240
214
|
}
|
|
241
215
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TabBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
242
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
216
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.13", type: TabBarComponent, isStandalone: true, selector: "odx-tab-bar", inputs: { selectedIndex: { classPropertyName: "selectedIndex", publicName: "selectedIndex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedIndex: "selectedIndexChange", selectedTabChanged: "selectedTabChanged" }, host: { attributes: { "role": "tabpanel", "tabindex": "0" }, listeners: { "keydown": "onKeydown($event)", "focus": "onFocused()" }, properties: { "class.odx-tab-bar--overflow-left": "!!prevTab()", "class.odx-tab-bar--overflow-right": "!!nextTab()" } }, providers: [{ provide: TAB_BAR, useExisting: forwardRef(() => TabBarComponent) }, ScrollableService], queries: [{ propertyName: "tabs", predicate: TabBarItemComponent, isSignal: true }], viewQueries: [{ propertyName: "scrollContainerElement", first: true, predicate: ["scrollContainer"], descendants: true, isSignal: true }], ngImport: i0, template: "<button #tabAction class=\"odx-tab-bar__action odx-tab-bar__action--prev\" [class.is-active]=\"!!prevTab()\" (click)=\"scrollTabs(-1)\" tabindex=\"-1\">\n <odx-icon class=\"tab-bar-action-icon\" name=\"chevron-left\" iconSet=\"core\" />\n</button>\n<div class=\"odx-tab-bar__inner\" #scrollContainer tabindex=\"-1\">\n <div class=\"odx-tab-bar__panel\" role=\"tablist\" #tabBarPanel>\n <ng-content />\n <div class=\"odx-tab-bar__indicator\" [odxActiveIndicator]=\"activeItem()?.element?.nativeElement\" odxActiveIndicatorPosition=\"start\"></div>\n </div>\n</div>\n<button #tabAction class=\"odx-tab-bar__action odx-tab-bar__action--next\" [class.is-active]=\"!!nextTab()\" (click)=\"scrollTabs()\" tabindex=\"-1\">\n <odx-icon class=\"tab-bar-action-icon\" name=\"chevron-right\" iconSet=\"core\" />\n</button>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: IconComponent, selector: "odx-icon", inputs: ["inline", "size", "name", "iconSet", "identifier"] }, { kind: "directive", type: ActiveIndicatorDirective, selector: "[odxActiveIndicator]", inputs: ["odxActiveIndicator", "odxActiveIndicatorParent", "odxActiveIndicatorDirection", "odxActiveIndicatorPosition"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
243
217
|
};
|
|
244
|
-
__decorate([
|
|
245
|
-
CSSModifier(),
|
|
246
|
-
__metadata("design:type", Object)
|
|
247
|
-
], TabBarComponent.prototype, "overflowLeft", void 0);
|
|
248
|
-
__decorate([
|
|
249
|
-
CSSModifier(),
|
|
250
|
-
__metadata("design:type", Object)
|
|
251
|
-
], TabBarComponent.prototype, "overflowRight", void 0);
|
|
252
218
|
TabBarComponent = __decorate([
|
|
253
|
-
CSSComponent('tab-bar')
|
|
219
|
+
CSSComponent('tab-bar'),
|
|
220
|
+
__metadata("design:paramtypes", [])
|
|
254
221
|
], TabBarComponent);
|
|
255
222
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TabBarComponent, decorators: [{
|
|
256
223
|
type: Component,
|
|
257
|
-
args: [{ selector: 'odx-tab-bar', standalone: true, imports: [CommonModule, IconComponent, ActiveIndicatorDirective], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [{ provide: TAB_BAR, useExisting: forwardRef(() => TabBarComponent) }], host: {
|
|
224
|
+
args: [{ selector: 'odx-tab-bar', standalone: true, imports: [CommonModule, IconComponent, ActiveIndicatorDirective], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [{ provide: TAB_BAR, useExisting: forwardRef(() => TabBarComponent) }, ScrollableService], host: {
|
|
258
225
|
role: 'tabpanel',
|
|
259
226
|
tabindex: '0',
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
args: ['tabAction']
|
|
267
|
-
}], tabs: [{
|
|
268
|
-
type: ContentChildren,
|
|
269
|
-
args: [TabBarItemComponent]
|
|
270
|
-
}], overflowLeft: [], overflowRight: [], selectedIndex: [{
|
|
271
|
-
type: Input,
|
|
272
|
-
args: [{ transform: numberAttribute }]
|
|
273
|
-
}], selectedTabChanged: [{
|
|
274
|
-
type: Output
|
|
275
|
-
}], onKeydown: [{
|
|
276
|
-
type: HostListener,
|
|
277
|
-
args: ['keydown', ['$event']]
|
|
278
|
-
}] } });
|
|
227
|
+
'[class.odx-tab-bar--overflow-left]': '!!prevTab()',
|
|
228
|
+
'[class.odx-tab-bar--overflow-right]': '!!nextTab()',
|
|
229
|
+
'(keydown)': 'onKeydown($event)',
|
|
230
|
+
'(focus)': 'onFocused()',
|
|
231
|
+
}, template: "<button #tabAction class=\"odx-tab-bar__action odx-tab-bar__action--prev\" [class.is-active]=\"!!prevTab()\" (click)=\"scrollTabs(-1)\" tabindex=\"-1\">\n <odx-icon class=\"tab-bar-action-icon\" name=\"chevron-left\" iconSet=\"core\" />\n</button>\n<div class=\"odx-tab-bar__inner\" #scrollContainer tabindex=\"-1\">\n <div class=\"odx-tab-bar__panel\" role=\"tablist\" #tabBarPanel>\n <ng-content />\n <div class=\"odx-tab-bar__indicator\" [odxActiveIndicator]=\"activeItem()?.element?.nativeElement\" odxActiveIndicatorPosition=\"start\"></div>\n </div>\n</div>\n<button #tabAction class=\"odx-tab-bar__action odx-tab-bar__action--next\" [class.is-active]=\"!!nextTab()\" (click)=\"scrollTabs()\" tabindex=\"-1\">\n <odx-icon class=\"tab-bar-action-icon\" name=\"chevron-right\" iconSet=\"core\" />\n</button>\n" }]
|
|
232
|
+
}], ctorParameters: () => [] });
|
|
279
233
|
|
|
280
234
|
const modules = [TabBarComponent, TabBarItemComponent];
|
|
281
235
|
class TabBarModule {
|