@odx/angular 12.21.4 → 12.21.6
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/components/timepicker/lib/directives/timepicker-input-control.directive.d.ts +6 -0
- package/esm2022/components/timepicker/lib/directives/timepicker-input-control.directive.mjs +11 -1
- package/esm2022/components/timepicker/lib/timepicker.component.mjs +10 -7
- package/fesm2022/odx-angular-animations.mjs.map +1 -1
- package/fesm2022/odx-angular-breakpoints.mjs +1 -1
- package/fesm2022/odx-angular-breakpoints.mjs.map +1 -1
- package/fesm2022/odx-angular-cdk-a11y.mjs +1 -1
- package/fesm2022/odx-angular-cdk-a11y.mjs.map +1 -1
- package/fesm2022/odx-angular-cdk-active-indicator.mjs +1 -1
- package/fesm2022/odx-angular-cdk-active-indicator.mjs.map +1 -1
- package/fesm2022/odx-angular-cdk-autocomplete-control.mjs +1 -1
- package/fesm2022/odx-angular-cdk-autocomplete-control.mjs.map +1 -1
- package/fesm2022/odx-angular-cdk-checkbox-control.mjs +1 -1
- package/fesm2022/odx-angular-cdk-checkbox-control.mjs.map +1 -1
- package/fesm2022/odx-angular-cdk-connected-overlay.mjs +1 -1
- package/fesm2022/odx-angular-cdk-connected-overlay.mjs.map +1 -1
- package/fesm2022/odx-angular-cdk-custom-form-control.mjs +1 -1
- package/fesm2022/odx-angular-cdk-custom-form-control.mjs.map +1 -1
- package/fesm2022/odx-angular-cdk-date-input.mjs.map +1 -1
- package/fesm2022/odx-angular-cdk-dynamic-view.mjs +1 -1
- package/fesm2022/odx-angular-cdk-dynamic-view.mjs.map +1 -1
- package/fesm2022/odx-angular-cdk-event-plugins.mjs.map +1 -1
- package/fesm2022/odx-angular-cdk-expandable.mjs +1 -1
- package/fesm2022/odx-angular-cdk-expandable.mjs.map +1 -1
- package/fesm2022/odx-angular-cdk-option-control.mjs +1 -1
- package/fesm2022/odx-angular-cdk-option-control.mjs.map +1 -1
- package/fesm2022/odx-angular-cdk-radio-group-control.mjs +1 -1
- package/fesm2022/odx-angular-cdk-radio-group-control.mjs.map +1 -1
- package/fesm2022/odx-angular-cdk-scrollable.mjs.map +1 -1
- package/fesm2022/odx-angular-components-accordion.mjs +1 -1
- package/fesm2022/odx-angular-components-accordion.mjs.map +1 -1
- package/fesm2022/odx-angular-components-action-group.mjs +1 -1
- package/fesm2022/odx-angular-components-action-group.mjs.map +1 -1
- package/fesm2022/odx-angular-components-anchor-navigation.mjs +1 -1
- package/fesm2022/odx-angular-components-anchor-navigation.mjs.map +1 -1
- package/fesm2022/odx-angular-components-area-header.mjs +1 -1
- package/fesm2022/odx-angular-components-area-header.mjs.map +1 -1
- package/fesm2022/odx-angular-components-autocomplete.mjs +1 -1
- package/fesm2022/odx-angular-components-autocomplete.mjs.map +1 -1
- package/fesm2022/odx-angular-components-avatar.mjs +1 -1
- package/fesm2022/odx-angular-components-avatar.mjs.map +1 -1
- package/fesm2022/odx-angular-components-badge.mjs +1 -1
- package/fesm2022/odx-angular-components-badge.mjs.map +1 -1
- package/fesm2022/odx-angular-components-bar.mjs +1 -1
- package/fesm2022/odx-angular-components-bar.mjs.map +1 -1
- package/fesm2022/odx-angular-components-breadcrumbs.mjs +1 -1
- package/fesm2022/odx-angular-components-breadcrumbs.mjs.map +1 -1
- package/fesm2022/odx-angular-components-button-group.mjs +1 -1
- package/fesm2022/odx-angular-components-button-group.mjs.map +1 -1
- package/fesm2022/odx-angular-components-button.mjs +1 -1
- package/fesm2022/odx-angular-components-button.mjs.map +1 -1
- package/fesm2022/odx-angular-components-calendar.mjs +2 -2
- package/fesm2022/odx-angular-components-calendar.mjs.map +1 -1
- package/fesm2022/odx-angular-components-card.mjs +2 -2
- package/fesm2022/odx-angular-components-card.mjs.map +1 -1
- package/fesm2022/odx-angular-components-checkbox.mjs +1 -1
- package/fesm2022/odx-angular-components-checkbox.mjs.map +1 -1
- package/fesm2022/odx-angular-components-chip.mjs +1 -1
- package/fesm2022/odx-angular-components-chip.mjs.map +1 -1
- package/fesm2022/odx-angular-components-circular-progress.mjs +1 -1
- package/fesm2022/odx-angular-components-circular-progress.mjs.map +1 -1
- package/fesm2022/odx-angular-components-content-box.mjs +1 -1
- package/fesm2022/odx-angular-components-content-box.mjs.map +1 -1
- package/fesm2022/odx-angular-components-data-table.mjs +1 -1
- package/fesm2022/odx-angular-components-data-table.mjs.map +1 -1
- package/fesm2022/odx-angular-components-datepicker.mjs +2 -2
- package/fesm2022/odx-angular-components-datepicker.mjs.map +1 -1
- package/fesm2022/odx-angular-components-daterangepicker.mjs +3 -3
- package/fesm2022/odx-angular-components-daterangepicker.mjs.map +1 -1
- package/fesm2022/odx-angular-components-dropdown.mjs +1 -1
- package/fesm2022/odx-angular-components-dropdown.mjs.map +1 -1
- package/fesm2022/odx-angular-components-error-page.mjs +1 -1
- package/fesm2022/odx-angular-components-error-page.mjs.map +1 -1
- package/fesm2022/odx-angular-components-footer.mjs +2 -2
- package/fesm2022/odx-angular-components-footer.mjs.map +1 -1
- package/fesm2022/odx-angular-components-form-field.mjs +1 -1
- package/fesm2022/odx-angular-components-form-field.mjs.map +1 -1
- package/fesm2022/odx-angular-components-header-navigation.mjs +1 -1
- package/fesm2022/odx-angular-components-header-navigation.mjs.map +1 -1
- package/fesm2022/odx-angular-components-header.mjs +1 -1
- package/fesm2022/odx-angular-components-header.mjs.map +1 -1
- package/fesm2022/odx-angular-components-icon.mjs +1 -1
- package/fesm2022/odx-angular-components-icon.mjs.map +1 -1
- package/fesm2022/odx-angular-components-inline-message.mjs +1 -1
- package/fesm2022/odx-angular-components-inline-message.mjs.map +1 -1
- package/fesm2022/odx-angular-components-link.mjs.map +1 -1
- package/fesm2022/odx-angular-components-list.mjs +2 -2
- package/fesm2022/odx-angular-components-list.mjs.map +1 -1
- package/fesm2022/odx-angular-components-loading-spinner.mjs +1 -1
- package/fesm2022/odx-angular-components-loading-spinner.mjs.map +1 -1
- package/fesm2022/odx-angular-components-logo.mjs +1 -1
- package/fesm2022/odx-angular-components-logo.mjs.map +1 -1
- package/fesm2022/odx-angular-components-main-menu.mjs +2 -2
- package/fesm2022/odx-angular-components-main-menu.mjs.map +1 -1
- package/fesm2022/odx-angular-components-mainfilter-group.mjs +1 -1
- package/fesm2022/odx-angular-components-mainfilter-group.mjs.map +1 -1
- package/fesm2022/odx-angular-components-menu.mjs +1 -1
- package/fesm2022/odx-angular-components-menu.mjs.map +1 -1
- package/fesm2022/odx-angular-components-modal.mjs +1 -1
- package/fesm2022/odx-angular-components-modal.mjs.map +1 -1
- package/fesm2022/odx-angular-components-navigation-back.mjs +1 -1
- package/fesm2022/odx-angular-components-navigation-back.mjs.map +1 -1
- package/fesm2022/odx-angular-components-notification-testing.mjs.map +1 -1
- package/fesm2022/odx-angular-components-notification.mjs +3 -3
- package/fesm2022/odx-angular-components-notification.mjs.map +1 -1
- package/fesm2022/odx-angular-components-paginator.mjs +1 -1
- package/fesm2022/odx-angular-components-paginator.mjs.map +1 -1
- package/fesm2022/odx-angular-components-progress.mjs +1 -1
- package/fesm2022/odx-angular-components-progress.mjs.map +1 -1
- package/fesm2022/odx-angular-components-radio-group.mjs +1 -1
- package/fesm2022/odx-angular-components-radio-group.mjs.map +1 -1
- package/fesm2022/odx-angular-components-rail-navigation.mjs +1 -1
- package/fesm2022/odx-angular-components-rail-navigation.mjs.map +1 -1
- package/fesm2022/odx-angular-components-rich-list.mjs +1 -1
- package/fesm2022/odx-angular-components-rich-list.mjs.map +1 -1
- package/fesm2022/odx-angular-components-search-bar.mjs.map +1 -1
- package/fesm2022/odx-angular-components-select.mjs +1 -1
- package/fesm2022/odx-angular-components-select.mjs.map +1 -1
- package/fesm2022/odx-angular-components-slider.mjs +1 -1
- package/fesm2022/odx-angular-components-slider.mjs.map +1 -1
- package/fesm2022/odx-angular-components-spinbox.mjs +1 -1
- package/fesm2022/odx-angular-components-spinbox.mjs.map +1 -1
- package/fesm2022/odx-angular-components-switch.mjs +1 -1
- package/fesm2022/odx-angular-components-switch.mjs.map +1 -1
- package/fesm2022/odx-angular-components-tab-bar.mjs +1 -1
- package/fesm2022/odx-angular-components-tab-bar.mjs.map +1 -1
- package/fesm2022/odx-angular-components-table.mjs +1 -1
- package/fesm2022/odx-angular-components-table.mjs.map +1 -1
- package/fesm2022/odx-angular-components-timepicker.mjs +21 -9
- package/fesm2022/odx-angular-components-timepicker.mjs.map +1 -1
- package/fesm2022/odx-angular-components-toast.mjs +1 -1
- package/fesm2022/odx-angular-components-toast.mjs.map +1 -1
- package/fesm2022/odx-angular-components-toggle-button-group.mjs +1 -1
- package/fesm2022/odx-angular-components-toggle-button-group.mjs.map +1 -1
- package/fesm2022/odx-angular-components-tooltip.mjs +1 -1
- package/fesm2022/odx-angular-components-tooltip.mjs.map +1 -1
- package/fesm2022/odx-angular-components-wizard.mjs +1 -1
- package/fesm2022/odx-angular-components-wizard.mjs.map +1 -1
- package/fesm2022/odx-angular-internal-translate.mjs.map +1 -1
- package/fesm2022/odx-angular-internal.mjs.map +1 -1
- package/fesm2022/odx-angular-localization.mjs.map +1 -1
- package/fesm2022/odx-angular-rxjs.mjs.map +1 -1
- package/fesm2022/odx-angular-sdk.mjs.map +1 -1
- package/fesm2022/odx-angular-theming.mjs.map +1 -1
- package/fesm2022/odx-angular-utils.mjs.map +1 -1
- package/fesm2022/odx-angular.mjs +2 -2
- package/fesm2022/odx-angular.mjs.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odx-angular-cdk-autocomplete-control.mjs","sources":["../../../../libs/angular/cdk/autocomplete-control/src/lib/autocomplete-control.ts","../../../../libs/angular/cdk/autocomplete-control/src/lib/directives/highlight-search-result.directive.ts","../../../../libs/angular/cdk/autocomplete-control/src/lib/pipes/base-search-filter-pipe.ts","../../../../libs/angular/cdk/autocomplete-control/src/odx-angular-cdk-autocomplete-control.ts"],"sourcesContent":["import { ActiveDescendantKeyManager, Highlightable } from '@angular/cdk/a11y';\nimport {\n AfterViewInit,\n booleanAttribute,\n ChangeDetectorRef,\n Directive,\n EventEmitter,\n HostListener,\n inject,\n Input,\n Output,\n QueryList,\n ViewChild,\n} from '@angular/core';\nimport { detectControllerChanges, StringifyFn } from '@odx/angular';\nimport { CustomFormControl, InputControlDirective } from '@odx/angular/cdk/custom-form-control';\nimport { OptionControl } from '@odx/angular/cdk/option-control';\nimport { DropdownDirective } from '@odx/angular/components/dropdown';\nimport { FormFieldComponent } from '@odx/angular/components/form-field';\nimport { injectElement, isFunction, untilDestroyed } from '@odx/angular/utils';\n\n/**\n * `AutocompleteControl` is a base directive to enhance an input field with autocomplete functionality,\n * providing keyboard navigation and selection for options displayed in a dropdown. It's designed to be extended\n * for specific implementations.\n * Extends `CustomFormControl` to provide form control behavior and state management.\n *\n * @see {CustomFormControl}\n *\n * This directive manages the open/close state of the dropdown, the loading state indication, and the interaction between\n * the autocomplete input and the dropdown options. It utilizes `ActiveDescendantKeyManager` for keyboard navigation among options.\n *\n * Extend this directive to create a fully functional autocomplete control tailored to your data type and UI requirements.\n *\n * @template T - The type of the items displayed in the autocomplete dropdown.\n */\n@Directive({\n standalone: true,\n host: {\n '[class.is-open]': 'isOpen',\n '[attr.aria-disabled]': 'isDisabled || null',\n },\n})\nexport abstract class AutocompleteControl<T> extends CustomFormControl<T | null> implements AfterViewInit {\n protected abstract readonly options?: QueryList<OptionControl<T>>;\n\n protected readonly changeDetector = inject(ChangeDetectorRef);\n protected readonly formField = inject(FormFieldComponent, { optional: true });\n protected readonly takeUntilDestroyed = untilDestroyed();\n\n protected keyManager?: ActiveDescendantKeyManager<Highlightable>;\n protected smoothScrollEnabled = false;\n\n @ViewChild(DropdownDirective)\n protected readonly dropdown?: DropdownDirective;\n\n public abstract searchField?: InputControlDirective;\n\n public readonly element = injectElement();\n\n public get dropdownReferenceElement(): HTMLElement {\n return this.formField?.controlElement?.nativeElement ?? this.element?.nativeElement;\n }\n\n public get hasOptions(): boolean {\n return !!this.options?.length;\n }\n\n public get isOpen(): boolean {\n return !!this.dropdown?.isOpen;\n }\n\n @Input({ transform: booleanAttribute })\n public isLoading = false;\n\n /**\n * A function that converts an item of type T to a string representation.\n * Used by the AutocompleteControl component to display the selected item.\n *\n * @type {StringifyFn<T>}\n *\n * @example\n * ```ts\n * // Define a stringify function for a custom type Person\n * const stringifyPerson: StringifyFn<Person> = (person) => `${person.firstName} ${person.lastName}`;\n *\n * // Assign the stringify function to the AutocompleteControl\n * autocompleteControl.stringify = stringifyPerson;\n * ```\n */\n @Input()\n public stringify?: StringifyFn<T>;\n\n /**\n * Emits the selected option when an option is selected from the dropdown.\n *\n * @emits {T} - The selected option.\n *\n * @example\n * ```ts\n * autocompleteControl.optionSelected.subscribe((selectedOption) => {\n * console.log('Selected option:', selectedOption);\n * });\n * ```\n */\n @Output()\n public optionSelected = new EventEmitter<T>();\n\n /**\n * Event emitted before the dropdown opens.\n * @emits {void}\n *\n * @example\n * ```html\n * <odx-select (beforeDropdownOpen)=\"onBeforeDropdownOpen()\">\n * </odx-select>\n * ```\n */\n @Output()\n public beforeDropdownOpen = new EventEmitter<void>();\n\n /**\n * Event emitted after the dropdown opened.\n *\n * @emits {void}\n *\n * @example\n * ```html\n * <odx-select (afterDropdownOpen)=\"onAfterDropdownOpen()\">\n * </odx-select>\n * ```\n */\n @Output()\n public afterDropdownOpen = new EventEmitter<void>();\n\n /**\n * Event emitted before the dropdown closes.\n *\n * @emits {void}\n *\n * @example\n * ```html\n * <odx-select (beforeDropdownClose)=\"onBeforeDropdownClose()\">\n * </odx-select>\n * ```\n */\n @Output()\n public beforeDropdownClose = new EventEmitter<void>();\n\n /**\n * Event emitted after the dropdown closed.\n *\n * @emits {void}\n *\n * @example\n * ```html\n * <odx-select (afterDropdownClose)=\"onAfterDropdownClose()\">\n * </odx-select>\n * ```\n */\n @Output()\n public afterDropdownClose = new EventEmitter<void>();\n\n constructor() {\n super(null);\n detectControllerChanges(this).subscribe();\n }\n\n public ngAfterViewInit(): void {\n if (!this.options) return;\n\n this.initKeyManager(this.options.toArray());\n this.handleQueryListOption(this.options);\n this.handleSearchFieldChanges();\n }\n\n /**\n * Scrolls the specified option element into view.\n * @param {OptionControl<T>} option - The option control containing the element to scroll into view.\n * @returns {void}\n *\n * @example\n * ```ts\n * const optionControl: OptionControl<string> = { element: myOptionElement };\n * scrollOptionIntoView(optionControl);\n * ```\n */\n public scrollOptionIntoView({ element }: OptionControl<T>): void {\n const behavior = this.smoothScrollEnabled ? 'smooth' : undefined;\n if (isFunction(element.nativeElement.scrollIntoView)) {\n element.nativeElement.scrollIntoView({ block: 'center', behavior });\n }\n }\n\n protected abstract handleQueryListOption(options: QueryList<OptionControl<T>>): void;\n\n protected abstract handleSearchFieldChanges(): void;\n\n protected abstract activateSelectedOption(): void;\n\n protected initKeyManager(options: Highlightable[]): void {\n this.keyManager = new ActiveDescendantKeyManager<Highlightable>(options).withHomeAndEnd();\n }\n\n protected disableSmoothScroll(): void {\n this.smoothScrollEnabled = false;\n }\n\n protected enableSmoothScroll(): void {\n this.smoothScrollEnabled = true;\n }\n\n protected openDropdown(): void {\n this.dropdown?.open();\n }\n\n protected closeDropdown(): void {\n this.dropdown?.close();\n }\n\n protected onDropdownOpen(): void {\n this.beforeDropdownOpen.emit();\n this.activateSelectedOption();\n }\n\n protected onDropdownOpened(): void {\n this.afterDropdownOpen.emit();\n this.enableSmoothScroll();\n }\n\n protected onDropdownClose(): void {\n this.beforeDropdownClose.emit();\n this.disableSmoothScroll();\n }\n\n protected onDropdownClosed(): void {\n this.afterDropdownClose.emit();\n }\n\n @HostListener('focusout', ['$event'])\n protected handleFocusOut(event: FocusEvent): void {\n if (this.isOpen) {\n event.stopImmediatePropagation();\n }\n this.onTouched();\n }\n}\n","import { computed, Directive, inject, input, SecurityContext } from '@angular/core';\nimport { DomSanitizer } from '@angular/platform-browser';\n\n@Directive({\n selector: 'odx-highlight',\n standalone: true,\n host: {\n '[innerHTML]': 'highlightedText()',\n },\n})\nexport class HighlightSearchDirective {\n private readonly sanitizer = inject(DomSanitizer);\n\n protected highlightedText = computed(() => {\n const search = this.odxHighlightSearch().trim();\n const text = this.sanitizer.sanitize(SecurityContext.HTML, this.text()) ?? '';\n\n if (!search) {\n return text;\n }\n\n const regex = new RegExp(search.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'), 'gi');\n const highlightedText = text.replace(regex, '<mark>$&</mark>');\n\n return this.sanitizer.bypassSecurityTrustHtml(highlightedText);\n });\n\n /**\n * Search string\n * @required\n * @type string\n */\n public odxHighlightSearch = input.required<string>();\n\n /**\n * Text to highlight\n * @required\n * @type string\n */\n public text = input.required<string>();\n}\n","import { inject, InjectionToken, PipeTransform } from '@angular/core';\nimport { ODX_STRINGIFY, ODX_STRING_SEARCH_HANDLER, StringifyFn, StringSearchHandler } from '@odx/angular';\nimport { InputControlDirective } from '@odx/angular/cdk/custom-form-control';\nimport { isFunction, Pure } from '@odx/angular/utils';\n\ninterface HostController {\n searchField?: InputControlDirective;\n stringify?: StringifyFn<unknown>;\n}\n\ninterface SearchFilterPipeOptions<T> {\n searchHandler?: StringSearchHandler;\n stringify?: StringifyFn<T>;\n}\n\nexport const ODX_SEARCH_FILTER_HOST = new InjectionToken<HostController>('@odx/angular/cdk/autocomplete-control::SearchFilterHost');\n\nexport abstract class BaseSearchFilterPipe implements PipeTransform {\n private readonly stringSearchHandler = inject(ODX_STRING_SEARCH_HANDLER);\n private readonly defaultStringify = inject(ODX_STRINGIFY);\n protected readonly hostController = inject(ODX_SEARCH_FILTER_HOST, { optional: true });\n\n protected get searchField(): InputControlDirective | undefined {\n return this.hostController?.searchField;\n }\n\n protected get stringify(): StringifyFn<unknown> {\n return this.hostController?.stringify ?? this.defaultStringify;\n }\n\n public transform<T>(items: T[] | null, optionsOrHandler?: SearchFilterPipeOptions<T> | StringSearchHandler): T[] | null {\n const searchHandler = this.isStringSearchHandler(optionsOrHandler) ? optionsOrHandler : optionsOrHandler?.searchHandler;\n const stringify = this.isStringSearchHandler(optionsOrHandler) ? null : optionsOrHandler?.stringify;\n if (this.searchField) {\n return this.filter(items, this.searchField.nativeElementValue, stringify ?? (this.stringify as never), searchHandler ?? this.stringSearchHandler);\n }\n return items;\n }\n\n protected queryHandler(query: string): string {\n return query?.trim() || '';\n }\n\n @Pure\n private filter<T>(items: T[] | null, query: string, stringify: StringifyFn<T>, searchHandler: StringSearchHandler): T[] | null {\n if (!items) return null;\n\n query = this.queryHandler(query);\n\n if (query === '') return items;\n\n return items.filter((item) => searchHandler(stringify(item), query));\n }\n\n private isStringSearchHandler<T>(optionsOrHandler?: SearchFilterPipeOptions<T> | StringSearchHandler): optionsOrHandler is StringSearchHandler {\n return isFunction(optionsOrHandler);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAqBA;;;;;;;;;;;;;;AAcG;AAQG,MAAgB,mBAAuB,SAAQ,iBAA2B,CAAA;AAiB9E,IAAA,IAAW,wBAAwB,GAAA;AACjC,QAAA,OAAO,IAAI,CAAC,SAAS,EAAE,cAAc,EAAE,aAAa,IAAI,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC;KACrF;AAED,IAAA,IAAW,UAAU,GAAA;AACnB,QAAA,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC;KAC/B;AAED,IAAA,IAAW,MAAM,GAAA;AACf,QAAA,OAAO,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC;KAChC;AA6FD,IAAA,WAAA,GAAA;QACE,KAAK,CAAC,IAAI,CAAC,CAAC;AAtHK,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAC3C,IAAS,CAAA,SAAA,GAAG,MAAM,CAAC,kBAAkB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3D,IAAkB,CAAA,kBAAA,GAAG,cAAc,EAAE,CAAC;QAG/C,IAAmB,CAAA,mBAAA,GAAG,KAAK,CAAC;QAO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ources":["../../../../libs/angular/cdk/autocomplete-control/src/lib/autocomplete-control.ts","../../../../libs/angular/cdk/autocomplete-control/src/lib/directives/highlight-search-result.directive.ts","../../../../libs/angular/cdk/autocomplete-control/src/lib/pipes/base-search-filter-pipe.ts","../../../../libs/angular/cdk/autocomplete-control/src/odx-angular-cdk-autocomplete-control.ts"],"sourcesContent":["import { ActiveDescendantKeyManager, Highlightable } from '@angular/cdk/a11y';\nimport {\n AfterViewInit,\n booleanAttribute,\n ChangeDetectorRef,\n Directive,\n EventEmitter,\n HostListener,\n inject,\n Input,\n Output,\n QueryList,\n ViewChild,\n} from '@angular/core';\nimport { detectControllerChanges, StringifyFn } from '@odx/angular';\nimport { CustomFormControl, InputControlDirective } from '@odx/angular/cdk/custom-form-control';\nimport { OptionControl } from '@odx/angular/cdk/option-control';\nimport { DropdownDirective } from '@odx/angular/components/dropdown';\nimport { FormFieldComponent } from '@odx/angular/components/form-field';\nimport { injectElement, isFunction, untilDestroyed } from '@odx/angular/utils';\n\n/**\n * `AutocompleteControl` is a base directive to enhance an input field with autocomplete functionality,\n * providing keyboard navigation and selection for options displayed in a dropdown. It's designed to be extended\n * for specific implementations.\n * Extends `CustomFormControl` to provide form control behavior and state management.\n *\n * @see {CustomFormControl}\n *\n * This directive manages the open/close state of the dropdown, the loading state indication, and the interaction between\n * the autocomplete input and the dropdown options. It utilizes `ActiveDescendantKeyManager` for keyboard navigation among options.\n *\n * Extend this directive to create a fully functional autocomplete control tailored to your data type and UI requirements.\n *\n * @template T - The type of the items displayed in the autocomplete dropdown.\n */\n@Directive({\n standalone: true,\n host: {\n '[class.is-open]': 'isOpen',\n '[attr.aria-disabled]': 'isDisabled || null',\n },\n})\nexport abstract class AutocompleteControl<T> extends CustomFormControl<T | null> implements AfterViewInit {\n protected abstract readonly options?: QueryList<OptionControl<T>>;\n\n protected readonly changeDetector = inject(ChangeDetectorRef);\n protected readonly formField = inject(FormFieldComponent, { optional: true });\n protected readonly takeUntilDestroyed = untilDestroyed();\n\n protected keyManager?: ActiveDescendantKeyManager<Highlightable>;\n protected smoothScrollEnabled = false;\n\n @ViewChild(DropdownDirective)\n protected readonly dropdown?: DropdownDirective;\n\n public abstract searchField?: InputControlDirective;\n\n public readonly element = injectElement();\n\n public get dropdownReferenceElement(): HTMLElement {\n return this.formField?.controlElement?.nativeElement ?? this.element?.nativeElement;\n }\n\n public get hasOptions(): boolean {\n return !!this.options?.length;\n }\n\n public get isOpen(): boolean {\n return !!this.dropdown?.isOpen;\n }\n\n @Input({ transform: booleanAttribute })\n public isLoading = false;\n\n /**\n * A function that converts an item of type T to a string representation.\n * Used by the AutocompleteControl component to display the selected item.\n *\n * @type {StringifyFn<T>}\n *\n * @example\n * ```ts\n * // Define a stringify function for a custom type Person\n * const stringifyPerson: StringifyFn<Person> = (person) => `${person.firstName} ${person.lastName}`;\n *\n * // Assign the stringify function to the AutocompleteControl\n * autocompleteControl.stringify = stringifyPerson;\n * ```\n */\n @Input()\n public stringify?: StringifyFn<T>;\n\n /**\n * Emits the selected option when an option is selected from the dropdown.\n *\n * @emits {T} - The selected option.\n *\n * @example\n * ```ts\n * autocompleteControl.optionSelected.subscribe((selectedOption) => {\n * console.log('Selected option:', selectedOption);\n * });\n * ```\n */\n @Output()\n public optionSelected = new EventEmitter<T>();\n\n /**\n * Event emitted before the dropdown opens.\n * @emits {void}\n *\n * @example\n * ```html\n * <odx-select (beforeDropdownOpen)=\"onBeforeDropdownOpen()\">\n * </odx-select>\n * ```\n */\n @Output()\n public beforeDropdownOpen = new EventEmitter<void>();\n\n /**\n * Event emitted after the dropdown opened.\n *\n * @emits {void}\n *\n * @example\n * ```html\n * <odx-select (afterDropdownOpen)=\"onAfterDropdownOpen()\">\n * </odx-select>\n * ```\n */\n @Output()\n public afterDropdownOpen = new EventEmitter<void>();\n\n /**\n * Event emitted before the dropdown closes.\n *\n * @emits {void}\n *\n * @example\n * ```html\n * <odx-select (beforeDropdownClose)=\"onBeforeDropdownClose()\">\n * </odx-select>\n * ```\n */\n @Output()\n public beforeDropdownClose = new EventEmitter<void>();\n\n /**\n * Event emitted after the dropdown closed.\n *\n * @emits {void}\n *\n * @example\n * ```html\n * <odx-select (afterDropdownClose)=\"onAfterDropdownClose()\">\n * </odx-select>\n * ```\n */\n @Output()\n public afterDropdownClose = new EventEmitter<void>();\n\n constructor() {\n super(null);\n detectControllerChanges(this).subscribe();\n }\n\n public ngAfterViewInit(): void {\n if (!this.options) return;\n\n this.initKeyManager(this.options.toArray());\n this.handleQueryListOption(this.options);\n this.handleSearchFieldChanges();\n }\n\n /**\n * Scrolls the specified option element into view.\n * @param {OptionControl<T>} option - The option control containing the element to scroll into view.\n * @returns {void}\n *\n * @example\n * ```ts\n * const optionControl: OptionControl<string> = { element: myOptionElement };\n * scrollOptionIntoView(optionControl);\n * ```\n */\n public scrollOptionIntoView({ element }: OptionControl<T>): void {\n const behavior = this.smoothScrollEnabled ? 'smooth' : undefined;\n if (isFunction(element.nativeElement.scrollIntoView)) {\n element.nativeElement.scrollIntoView({ block: 'center', behavior });\n }\n }\n\n protected abstract handleQueryListOption(options: QueryList<OptionControl<T>>): void;\n\n protected abstract handleSearchFieldChanges(): void;\n\n protected abstract activateSelectedOption(): void;\n\n protected initKeyManager(options: Highlightable[]): void {\n this.keyManager = new ActiveDescendantKeyManager<Highlightable>(options).withHomeAndEnd();\n }\n\n protected disableSmoothScroll(): void {\n this.smoothScrollEnabled = false;\n }\n\n protected enableSmoothScroll(): void {\n this.smoothScrollEnabled = true;\n }\n\n protected openDropdown(): void {\n this.dropdown?.open();\n }\n\n protected closeDropdown(): void {\n this.dropdown?.close();\n }\n\n protected onDropdownOpen(): void {\n this.beforeDropdownOpen.emit();\n this.activateSelectedOption();\n }\n\n protected onDropdownOpened(): void {\n this.afterDropdownOpen.emit();\n this.enableSmoothScroll();\n }\n\n protected onDropdownClose(): void {\n this.beforeDropdownClose.emit();\n this.disableSmoothScroll();\n }\n\n protected onDropdownClosed(): void {\n this.afterDropdownClose.emit();\n }\n\n @HostListener('focusout', ['$event'])\n protected handleFocusOut(event: FocusEvent): void {\n if (this.isOpen) {\n event.stopImmediatePropagation();\n }\n this.onTouched();\n }\n}\n","import { computed, Directive, inject, input, SecurityContext } from '@angular/core';\nimport { DomSanitizer } from '@angular/platform-browser';\n\n@Directive({\n selector: 'odx-highlight',\n standalone: true,\n host: {\n '[innerHTML]': 'highlightedText()',\n },\n})\nexport class HighlightSearchDirective {\n private readonly sanitizer = inject(DomSanitizer);\n\n protected highlightedText = computed(() => {\n const search = this.odxHighlightSearch().trim();\n const text = this.sanitizer.sanitize(SecurityContext.HTML, this.text()) ?? '';\n\n if (!search) {\n return text;\n }\n\n const regex = new RegExp(search.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'), 'gi');\n const highlightedText = text.replace(regex, '<mark>$&</mark>');\n\n return this.sanitizer.bypassSecurityTrustHtml(highlightedText);\n });\n\n /**\n * Search string\n * @required\n * @type string\n */\n public odxHighlightSearch = input.required<string>();\n\n /**\n * Text to highlight\n * @required\n * @type string\n */\n public text = input.required<string>();\n}\n","import { inject, InjectionToken, PipeTransform } from '@angular/core';\nimport { ODX_STRINGIFY, ODX_STRING_SEARCH_HANDLER, StringifyFn, StringSearchHandler } from '@odx/angular';\nimport { InputControlDirective } from '@odx/angular/cdk/custom-form-control';\nimport { isFunction, Pure } from '@odx/angular/utils';\n\ninterface HostController {\n searchField?: InputControlDirective;\n stringify?: StringifyFn<unknown>;\n}\n\ninterface SearchFilterPipeOptions<T> {\n searchHandler?: StringSearchHandler;\n stringify?: StringifyFn<T>;\n}\n\nexport const ODX_SEARCH_FILTER_HOST = new InjectionToken<HostController>('@odx/angular/cdk/autocomplete-control::SearchFilterHost');\n\nexport abstract class BaseSearchFilterPipe implements PipeTransform {\n private readonly stringSearchHandler = inject(ODX_STRING_SEARCH_HANDLER);\n private readonly defaultStringify = inject(ODX_STRINGIFY);\n protected readonly hostController = inject(ODX_SEARCH_FILTER_HOST, { optional: true });\n\n protected get searchField(): InputControlDirective | undefined {\n return this.hostController?.searchField;\n }\n\n protected get stringify(): StringifyFn<unknown> {\n return this.hostController?.stringify ?? this.defaultStringify;\n }\n\n public transform<T>(items: T[] | null, optionsOrHandler?: SearchFilterPipeOptions<T> | StringSearchHandler): T[] | null {\n const searchHandler = this.isStringSearchHandler(optionsOrHandler) ? optionsOrHandler : optionsOrHandler?.searchHandler;\n const stringify = this.isStringSearchHandler(optionsOrHandler) ? null : optionsOrHandler?.stringify;\n if (this.searchField) {\n return this.filter(items, this.searchField.nativeElementValue, stringify ?? (this.stringify as never), searchHandler ?? this.stringSearchHandler);\n }\n return items;\n }\n\n protected queryHandler(query: string): string {\n return query?.trim() || '';\n }\n\n @Pure\n private filter<T>(items: T[] | null, query: string, stringify: StringifyFn<T>, searchHandler: StringSearchHandler): T[] | null {\n if (!items) return null;\n\n query = this.queryHandler(query);\n\n if (query === '') return items;\n\n return items.filter((item) => searchHandler(stringify(item), query));\n }\n\n private isStringSearchHandler<T>(optionsOrHandler?: SearchFilterPipeOptions<T> | StringSearchHandler): optionsOrHandler is StringSearchHandler {\n return isFunction(optionsOrHandler);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAqBA;;;;;;;;;;;;;;AAcG;AAQG,MAAgB,mBAAuB,SAAQ,iBAA2B,CAAA;AAiB9E,IAAA,IAAW,wBAAwB,GAAA;AACjC,QAAA,OAAO,IAAI,CAAC,SAAS,EAAE,cAAc,EAAE,aAAa,IAAI,IAAI,CAAC,OAAO,EAAE,aAAa;IACrF;AAEA,IAAA,IAAW,UAAU,GAAA;AACnB,QAAA,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM;IAC/B;AAEA,IAAA,IAAW,MAAM,GAAA;AACf,QAAA,OAAO,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM;IAChC;AA6FA,IAAA,WAAA,GAAA;QACE,KAAK,CAAC,IAAI,CA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vH,QAAA,MAAM,SAAS,GAAG,IAAI,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,GAAG,IAAI,GAAG,gBAAgB,EAAE,SAAS;AACnG,QAAA,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,kBAAkB,EAAE,SAAS,IAAK,IAAI,CAAC,SAAmB,EAAE,aAAa,IAAI,IAAI,CAAC,mBAAmB,CAAC;QACnJ;AACA,QAAA,OAAO,KAAK;IACd;AAEU,IAAA,YAAY,CAAC,KAAa,EAAA;AAClC,QAAA,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE;IAC5B;AAGQ,IAAA,MAAM,CAAI,KAAiB,EAAE,KAAa,EAAE,SAAyB,EAAE,aAAkC,EAAA;AAC/G,QAAA,IAAI,CAAC,KAAK;AAAE,YAAA,OAAO,IAAI;AAEvB,QAAA,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;QAEhC,IAAI,KAAK,KAAK,EAAE;AAAE,YAAA,OAAO,KAAK;AAE9B,QAAA,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;IACtE;AAEQ,IAAA,qBAAqB,CAAI,gBAAmE,EAAA;AAClG,QAAA,OAAO,UAAU,CAAC,gBAAgB,CAAC;IACrC;AACD;AAbS,UAAA,CAAA;IADP,IAAI;;;;AASJ,CAAA,EAAA,oBAAA,CAAA,SAAA,EAAA,QAAA,EAAA,IAAA,CAAA;;ACpDH;;AAEG;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { EventEmitter, booleanAttribute,
|
|
2
|
+
import { EventEmitter, booleanAttribute, Output, Input, Directive } from '@angular/core';
|
|
3
3
|
import { detectControllerChanges } from '@odx/angular';
|
|
4
4
|
import { CustomFormControl } from '@odx/angular/cdk/custom-form-control';
|
|
5
5
|
import { booleanToAttributeString, injectElement } from '@odx/angular/utils';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odx-angular-cdk-checkbox-control.mjs","sources":["../../../../libs/angular/cdk/checkbox-control/src/lib/checkbox-control.directive.ts","../../../../libs/angular/cdk/checkbox-control/src/odx-angular-cdk-checkbox-control.ts"],"sourcesContent":["import { booleanAttribute, Directive, EventEmitter, Input, Output } from '@angular/core';\nimport { detectControllerChanges } from '@odx/angular';\nimport { CustomFormControl } from '@odx/angular/cdk/custom-form-control';\nimport { booleanToAttributeString, injectElement } from '@odx/angular/utils';\n\n/**\n * `CheckBoxControl` is a directive that extends `CustomFormControl` to create a custom checkbox control.\n * It integrates seamlessly with Angular forms and provides additional events and bindings for enhanced\n * functionality.\n */\n@Directive({\n selector: '[odxCheckBoxControl]',\n})\nexport class CheckBoxControl extends CustomFormControl<boolean> {\n public readonly element = injectElement();\n\n @Input({ transform: booleanAttribute })\n public set checked(value: boolean) {\n this.value = value;\n }\n public get checked(): boolean {\n return this.value;\n }\n\n /**\n * The value of the checkbox control.\n *\n * @type {string | null}\n * @default null\n */\n // eslint-disable-next-line @angular-eslint/no-input-rename\n @Input('value')\n public controlValue: string | null = null;\n\n /**\n * A boolean value when the checked state of the checkbox changes.\n *\n * @emits {boolean} - The new checked state of the checkbox.\n */\n @Output()\n public checkedChange = new EventEmitter<boolean>();\n\n /**\n * Aria attribute that represents the checked state of the checkbox.\n *\n * @type {string}\n */\n public get ariaChecked(): string {\n return booleanToAttributeString(this.checked);\n }\n\n constructor() {\n super(false);\n detectControllerChanges(this).subscribe();\n }\n\n public onChanged(event: Event): void {\n event.stopPropagation();\n super.updateValue((event.target as HTMLInputElement).checked);\n this.checkedChange.next(this.checked);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAKA;;;;AAIG;AAIG,MAAO,eAAgB,SAAQ,iBAA0B,CAAA;IAG7D,IACW,OAAO,CAAC,KAAc,EAAA;AAC/B,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK
|
|
1
|
+
{"version":3,"file":"odx-angular-cdk-checkbox-control.mjs","sources":["../../../../libs/angular/cdk/checkbox-control/src/lib/checkbox-control.directive.ts","../../../../libs/angular/cdk/checkbox-control/src/odx-angular-cdk-checkbox-control.ts"],"sourcesContent":["import { booleanAttribute, Directive, EventEmitter, Input, Output } from '@angular/core';\nimport { detectControllerChanges } from '@odx/angular';\nimport { CustomFormControl } from '@odx/angular/cdk/custom-form-control';\nimport { booleanToAttributeString, injectElement } from '@odx/angular/utils';\n\n/**\n * `CheckBoxControl` is a directive that extends `CustomFormControl` to create a custom checkbox control.\n * It integrates seamlessly with Angular forms and provides additional events and bindings for enhanced\n * functionality.\n */\n@Directive({\n selector: '[odxCheckBoxControl]',\n})\nexport class CheckBoxControl extends CustomFormControl<boolean> {\n public readonly element = injectElement();\n\n @Input({ transform: booleanAttribute })\n public set checked(value: boolean) {\n this.value = value;\n }\n public get checked(): boolean {\n return this.value;\n }\n\n /**\n * The value of the checkbox control.\n *\n * @type {string | null}\n * @default null\n */\n // eslint-disable-next-line @angular-eslint/no-input-rename\n @Input('value')\n public controlValue: string | null = null;\n\n /**\n * A boolean value when the checked state of the checkbox changes.\n *\n * @emits {boolean} - The new checked state of the checkbox.\n */\n @Output()\n public checkedChange = new EventEmitter<boolean>();\n\n /**\n * Aria attribute that represents the checked state of the checkbox.\n *\n * @type {string}\n */\n public get ariaChecked(): string {\n return booleanToAttributeString(this.checked);\n }\n\n constructor() {\n super(false);\n detectControllerChanges(this).subscribe();\n }\n\n public onChanged(event: Event): void {\n event.stopPropagation();\n super.updateValue((event.target as HTMLInputElement).checked);\n this.checkedChange.next(this.checked);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAKA;;;;AAIG;AAIG,MAAO,eAAg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AA,UAAA,EAAA,CAAA;kBAH3B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,sBAAsB;AACjC,iBAAA;wDAKY,OAAO,EAAA,CAAA;sBADjB,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;gBAgB/B,YAAY,EAAA,CAAA;sBADlB,KAAK;uBAAC,OAAO;gBASP,aAAa,EAAA,CAAA;sBADnB;;;ACvCH;;AAEG;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject, NgZone, Injector,
|
|
3
|
+
import { inject, NgZone, Injector, Output, Input, ViewChild, ViewEncapsulation, ChangeDetectionStrategy, Component, Injectable } from '@angular/core';
|
|
4
4
|
import { arrow, flip, computePosition, offset, shift, size, hide, autoUpdate } from '@floating-ui/dom';
|
|
5
5
|
import { CoreModule } from '@odx/angular';
|
|
6
6
|
import { DynamicViewDirective, DynamicViewService } from '@odx/angular/cdk/dynamic-view';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odx-angular-cdk-connected-overlay.mjs","sources":["../../../../libs/angular/cdk/connected-overlay/src/lib/helpers/compute-overlay-position.ts","../../../../libs/angular/cdk/connected-overlay/src/lib/models/connected-overlay-options.ts","../../../../libs/angular/cdk/connected-overlay/src/lib/models/connected-overlay-ref.ts","../../../../libs/angular/cdk/connected-overlay/src/lib/connected-overlay.component.ts","../../../../libs/angular/cdk/connected-overlay/src/lib/connected-overlay.component.html","../../../../libs/angular/cdk/connected-overlay/src/lib/connected-overlay.service.ts","../../../../libs/angular/cdk/connected-overlay/src/odx-angular-cdk-connected-overlay.ts"],"sourcesContent":["import { ComputePositionReturn, VirtualElement, arrow, computePosition, flip, hide, shift, size, offset as withOffset } from '@floating-ui/dom';\nimport { applyStyles, getOppositeSide, getSide, px } from '@odx/angular/utils';\nimport { ConnectedOverlayOptions } from '../models';\n\n/**\n * Computes the position of an overlay element relative to a reference element.\n *\n * @param referenceElement - The reference element to position the overlay relative to.\n * @param overlayElement - The overlay element to be positioned.\n * @param contentElement - The content element within the overlay.\n * @param arrowElement - The arrow element within the overlay.\n * @param options - The options for positioning the overlay.\n * @returns A promise that resolves to the computed position of the overlay.\n */\nexport async function computeOverlayPosition(\n referenceElement: VirtualElement,\n overlayElement: HTMLElement,\n contentElement: HTMLElement,\n arrowElement: HTMLElement,\n options: ConnectedOverlayOptions,\n): Promise<ComputePositionReturn> {\n const variablePrefix = '--odx-cdk-connected-overlay';\n const { position, offset, outerPadding, matchReferenceWidth, enableFallback, fallbackAxisSideDirection, strategy, minHeight } = options;\n const arrowSize = options.showArrow ? arrowElement.offsetWidth : 0;\n const arrowMiddleware = options.showArrow ? [arrow({ element: arrowElement, padding: 8 })] : [];\n const flipMiddleWare = enableFallback ? [flip({ fallbackAxisSideDirection })] : [];\n return computePosition(referenceElement, overlayElement, {\n strategy,\n placement: position,\n middleware: [\n withOffset(Math.max(offset, arrowSize + offset)),\n shift({ padding: outerPadding }),\n ...flipMiddleWare,\n size({\n padding: outerPadding,\n apply: ({ availableHeight, rects }) => {\n contentElement.style.setProperty?.(`${variablePrefix}-min-height`, minHeight ? px(Math.min(availableHeight, minHeight)) : null);\n contentElement.style.setProperty?.(`${variablePrefix}-min-width`, matchReferenceWidth ? px(rects.reference.width) : null);\n },\n }),\n ...arrowMiddleware,\n hide({ rootBoundary: 'viewport' }),\n ],\n }).then((result) => {\n overlayElement.style.setProperty?.(`${variablePrefix}-position-x`, px(result.x));\n overlayElement.style.setProperty?.(`${variablePrefix}-position-y`, px(result.y));\n if (options.hiddenClass) {\n overlayElement.classList.toggle(options.hiddenClass, !!result.middlewareData.hide?.referenceHidden);\n }\n if (options.showArrow) {\n const overlaySide = getSide(result.placement);\n const arrowSide = getOppositeSide(result.placement);\n applyStyles(arrowElement, {\n display: null,\n top: px(result.middlewareData.arrow?.y),\n left: px(result.middlewareData.arrow?.x),\n [arrowSide]: px(-arrowSize / 2),\n [overlaySide]: null,\n });\n } else {\n applyStyles(arrowElement, { display: 'none' });\n }\n\n return result;\n });\n}\n","import { Strategy } from '@floating-ui/dom';\nimport { DynamicContent } from '@odx/angular/cdk/dynamic-view';\nimport { Position } from '@odx/angular/utils';\n\nexport interface ConnectedOverlayOptions {\n content?: DynamicContent | null;\n context?: Record<string, unknown>;\n containerClass?: string | null;\n hiddenClass: string | null;\n enableFallback: boolean;\n fallbackAxisSideDirection: 'start' | 'end';\n matchReferenceWidth: boolean;\n minHeight?: number | null;\n offset: number;\n outerPadding: number;\n position: Position;\n strategy: Strategy;\n showArrow?: boolean;\n updateOnAnimationFrame?: boolean;\n nonInteractive?: boolean;\n hooks?: {\n beforeOpen?: () => void;\n afterOpen?: () => void;\n beforeClose?: () => void;\n afterClose?: () => void;\n };\n}\n\nexport const DefaultConnectedOverlayOptions: ConnectedOverlayOptions = {\n hiddenClass: 'is-hidden',\n enableFallback: false,\n fallbackAxisSideDirection: 'start',\n matchReferenceWidth: false,\n offset: 8,\n outerPadding: 12,\n position: Position.BOTTOM,\n strategy: 'fixed',\n};\n","import { DynamicViewRef } from '@odx/angular/cdk/dynamic-view';\nimport { waitForAnimations } from '@odx/angular/utils';\nimport { EMPTY, Observable } from 'rxjs';\nimport { ConnectedOverlayComponent } from '../connected-overlay.component';\nimport { ConnectedOverlayOptions } from './connected-overlay-options';\n\n/**\n * A reference to a connected overlay created by the `ConnectedOverlayService`. This class provides methods to interact\n * with the overlay, such as updating its options or closing it. It encapsulates the `DynamicViewRef` for the overlay's instance,\n * allowing for direct manipulation of the overlay's state and behavior.\n *\n * This example demonstrates how to use a `ConnectedOverlayRef` to update and close a connected overlay in response\n * to user interactions.\n *\n * @example\n * ```ts\n * class MyComponent {\n * private overlayRef?: ConnectedOverlayRef;\n *\n * constructor(private overlayService: ConnectedOverlayService) {}\n *\n * openOverlay() {\n * this.overlayRef = this.overlayService.createOverlay(this.someElementRef.nativeElement, { position: 'bottom' });\n * }\n *\n * updateOverlayPosition() {\n * if (this.overlayRef) {\n * this.overlayRef.update({ position: 'top' });\n * }\n * }\n *\n * closeOverlay() {\n * this.overlayRef?.close();\n * }\n * }\n * ```\n *\n * In this example, `MyComponent` uses the `ConnectedOverlayService` to create an overlay. It stores a reference to\n * the created overlay in `overlayRef`, allowing it to update the overlay's position or close it when necessary.\n */\nexport class ConnectedOverlayRef {\n public readonly element = this.dynamicViewRef.getElement();\n\n /**\n * An Observable that emits when the overlay is closed.\n *\n * @emits {void} - Emits when the overlay is closed.\n *\n */\n public readonly onClose$: Observable<void> = this.dynamicViewRef.getContext().closed ?? EMPTY;\n\n constructor(private readonly dynamicViewRef: DynamicViewRef<typeof ConnectedOverlayComponent>) {}\n\n /**\n * Updates the connected overlay with new options.\n *\n * @param options {Partial<ConnectedOverlayOptions>} - The new options to be applied to the connected overlay.\n */\n public update(options: Partial<ConnectedOverlayOptions>): void {\n this.dynamicViewRef.update({ options: options as ConnectedOverlayOptions });\n }\n\n /**\n * Closes the connected overlay.\n *\n * @returns {void}\n */\n public async close(force = false) {\n const hiddenClass = force ? 'force-hidden' : this.dynamicViewRef.getContext().options?.hiddenClass || 'is-hidden';\n this.element?.classList.add(hiddenClass);\n await waitForAnimations(this.element);\n this.dynamicViewRef.destroy();\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n Injector,\n Input,\n NgZone,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n ViewChild,\n ViewEncapsulation,\n inject,\n} from '@angular/core';\nimport { VirtualElement, autoUpdate } from '@floating-ui/dom';\nimport { CoreModule } from '@odx/angular';\nimport { DynamicViewDirective } from '@odx/angular/cdk/dynamic-view';\nimport { CSSComponent } from '@odx/angular/internal';\nimport { NgChanges, Side, deferFn, getSide, hasChanged, injectElement, isPresent } from '@odx/angular/utils';\nimport { Subject } from 'rxjs';\nimport { computeOverlayPosition } from './helpers';\nimport { ConnectedOverlayOptions, DefaultConnectedOverlayOptions } from './models';\n\n@CSSComponent('cdk-connected-overlay')\n@Component({\n standalone: true,\n selector: 'odx-connected-overlay[popover=\"manual\"]',\n imports: [CoreModule, DynamicViewDirective],\n templateUrl: 'connected-overlay.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class ConnectedOverlayComponent implements OnInit, OnChanges, OnDestroy {\n private readonly zone = inject(NgZone);\n private positionUpdater: (() => void) | null = null;\n\n protected readonly injector = inject(Injector);\n protected overlaySide?: Side;\n\n @ViewChild('content', { static: true })\n protected contentElement!: ElementRef<HTMLElement>;\n\n @ViewChild('arrow', { static: true })\n protected arrowElement!: ElementRef<HTMLElement>;\n\n public readonly element = injectElement();\n\n @Input()\n public referenceElement!: VirtualElement;\n\n @Input()\n public options: ConnectedOverlayOptions = DefaultConnectedOverlayOptions;\n\n @Output()\n public closed = new Subject<void>();\n\n public ngOnInit(): void {\n this.options.hooks?.beforeOpen?.();\n deferFn(() => {\n this.element.nativeElement?.isConnected && this.element.nativeElement?.showPopover?.();\n this.options.hooks?.afterOpen?.();\n });\n }\n\n public ngOnChanges(changes: NgChanges<ConnectedOverlayComponent>): void {\n if (hasChanged(changes, ['options'], false)) {\n this.overlaySide = getSide(this.options.position);\n this.element.nativeElement.classList.toggle('odx-cdk-connected-overlay--non-interactive', this.options.nonInteractive ?? false);\n }\n if (hasChanged(changes, ['referenceElement', 'options'], false)) {\n this.stopPositionUpdater();\n this.startPositionUpdater();\n }\n }\n\n public ngOnDestroy(): void {\n this.options.hooks?.beforeClose?.();\n this.stopPositionUpdater();\n this.element.nativeElement?.hidePopover?.();\n this.closed.next();\n this.options.hooks?.afterClose?.();\n }\n\n private startPositionUpdater(): void {\n this.positionUpdater = this.zone.runOutsideAngular(() =>\n autoUpdate(this.referenceElement, this.element.nativeElement, () => this.updatePosition(), {\n elementResize: isPresent(window.ResizeObserver),\n animationFrame: this.options.updateOnAnimationFrame,\n }),\n );\n }\n\n private stopPositionUpdater(): void {\n this.positionUpdater?.();\n this.positionUpdater = null;\n }\n\n private async updatePosition(): Promise<void> {\n return computeOverlayPosition(\n this.referenceElement,\n this.element.nativeElement,\n this.contentElement.nativeElement,\n this.arrowElement.nativeElement,\n this.options,\n ).then(({ placement }) => {\n this.overlaySide = getSide(placement);\n });\n }\n}\n","<div class=\"odx-cdk-connected-overlay__content {{ options.containerClass }}\" #content>\n <ng-template [odxDynamicView]=\"options.content\" [odxDynamicViewContext]=\"options.context\" [odxDynamicViewInjector]=\"injector\" />\n <div class=\"odx-cdk-connected-overlay-arrow\" #arrow></div>\n</div>\n","import { inject, Injectable } from '@angular/core';\nimport { VirtualElement } from '@floating-ui/dom';\nimport { DynamicViewRenderingOptions, DynamicViewService } from '@odx/angular/cdk/dynamic-view';\nimport { deepmerge } from '@odx/angular/internal';\nimport { ConnectedOverlayComponent } from './connected-overlay.component';\nimport { ConnectedOverlayOptions, ConnectedOverlayRef, DefaultConnectedOverlayOptions } from './models';\n\n/**\n * Service for creating and managing connected overlays. These overlays are UI elements such as popovers, tooltips,\n * or dropdown menus that are positioned relative to a reference element in the DOM. This service leverages the `DynamicViewService`\n * for dynamic component rendering and provides a streamlined API for creating overlays with custom positioning and options.\n *\n * Use the `ConnectedOverlayService` to dynamically create an overlay next to a specific element in your Angular application.\n * This example demonstrates creating a connected overlay next to a button element when the button is clicked.\n *\n * @example\n * ```ts\n * import { Component, ElementRef, ViewChild } from '@angular/core';\n * import { ConnectedOverlayService, ConnectedOverlayOptions } from '@odx/angular/cdk/connected-overlay';\n *\n * @Component({\n * selector: 'app-example',\n * template: `<button #triggerElement>Click me</button>`,\n * })\n * class AppComponent {\n * @ViewChild('triggerElement') triggerElementRef!: ElementRef;\n *\n * constructor(private connectedOverlayService: ConnectedOverlayService) {}\n *\n * showOverlay(): void {\n * const options: Partial<ConnectedOverlayOptions> = {\n * position: 'bottom-start',\n * showArrow: true,\n * content: 'Hello, world!',\n * };\n *\n * this.connectedOverlayService.createOverlay(this.triggerElementRef.nativeElement, options);\n * }\n * }\n * ```\n *\n * This service simplifies the process of creating dynamic, positionally aware overlays that enhance the interactivity\n * and visual appeal of Angular applications.\n */\n@Injectable({ providedIn: 'root' })\nexport class ConnectedOverlayService {\n private readonly dynamicViewService = inject(DynamicViewService);\n\n /**\n * Creates a connected overlay.\n * @param referenceElement - The reference element to which the overlay will be connected.\n * @param options - Optional configuration for the connected overlay.\n * @param renderingOptions - Optional rendering options for the connected overlay.\n * @returns {ConnectedOverlayRef} The created Connected Overlay reference instance.\n */\n public createOverlay(\n referenceElement: VirtualElement,\n options?: Partial<ConnectedOverlayOptions>,\n renderingOptions?: Partial<DynamicViewRenderingOptions>,\n ): ConnectedOverlayRef {\n const dynamicViewRef = this.dynamicViewService.createView(ConnectedOverlayComponent, {\n ...renderingOptions,\n context: { options: deepmerge(DefaultConnectedOverlayOptions, options) as ConnectedOverlayOptions, referenceElement },\n });\n\n return new ConnectedOverlayRef(dynamicViewRef);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["offset","withOffset"],"mappings":";;;;;;;;;;AAIA;;;;;;;;;AASG;AACI,eAAe,sBAAsB,CAC1C,gBAAgC,EAChC,cAA2B,EAC3B,cAA2B,EAC3B,YAAyB,EACzB,OAAgC,EAAA;IAEhC,MAAM,cAAc,GAAG,6BAA6B,CAAC;AACrD,IAAA,MAAM,EAAE,QAAQ,UAAEA,QAAM,EAAE,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,yBAAyB,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;AACxI,IAAA,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,GAAG,YAAY,CAAC,WAAW,GAAG,CAAC,CAAC;IACnE,MAAM,eAAe,GAAG,OAAO,CAAC,SAAS,GAAG,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC;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;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAA;;;AC5ClC;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"odx-angular-cdk-connected-overlay.mjs","sources":["../../../../libs/angular/cdk/connected-overlay/src/lib/helpers/compute-overlay-position.ts","../../../../libs/angular/cdk/connected-overlay/src/lib/models/connected-overlay-options.ts","../../../../libs/angular/cdk/connected-overlay/src/lib/models/connected-overlay-ref.ts","../../../../libs/angular/cdk/connected-overlay/src/lib/connected-overlay.component.ts","../../../../libs/angular/cdk/connected-overlay/src/lib/connected-overlay.component.html","../../../../libs/angular/cdk/connected-overlay/src/lib/connected-overlay.service.ts","../../../../libs/angular/cdk/connected-overlay/src/odx-angular-cdk-connected-overlay.ts"],"sourcesContent":["import { ComputePositionReturn, VirtualElement, arrow, computePosition, flip, hide, shift, size, offset as withOffset } from '@floating-ui/dom';\nimport { applyStyles, getOppositeSide, getSide, px } from '@odx/angular/utils';\nimport { ConnectedOverlayOptions } from '../models';\n\n/**\n * Computes the position of an overlay element relative to a reference element.\n *\n * @param referenceElement - The reference element to position the overlay relative to.\n * @param overlayElement - The overlay element to be positioned.\n * @param contentElement - The content element within the overlay.\n * @param arrowElement - The arrow element within the overlay.\n * @param options - The options for positioning the overlay.\n * @returns A promise that resolves to the computed position of the overlay.\n */\nexport async function computeOverlayPosition(\n referenceElement: VirtualElement,\n overlayElement: HTMLElement,\n contentElement: HTMLElement,\n arrowElement: HTMLElement,\n options: ConnectedOverlayOptions,\n): Promise<ComputePositionReturn> {\n const variablePrefix = '--odx-cdk-connected-overlay';\n const { position, offset, outerPadding, matchReferenceWidth, enableFallback, fallbackAxisSideDirection, strategy, minHeight } = options;\n const arrowSize = options.showArrow ? arrowElement.offsetWidth : 0;\n const arrowMiddleware = options.showArrow ? [arrow({ element: arrowElement, padding: 8 })] : [];\n const flipMiddleWare = enableFallback ? [flip({ fallbackAxisSideDirection })] : [];\n return computePosition(referenceElement, overlayElement, {\n strategy,\n placement: position,\n middleware: [\n withOffset(Math.max(offset, arrowSize + offset)),\n shift({ padding: outerPadding }),\n ...flipMiddleWare,\n size({\n padding: outerPadding,\n apply: ({ availableHeight, rects }) => {\n contentElement.style.setProperty?.(`${variablePrefix}-min-height`, minHeight ? px(Math.min(availableHeight, minHeight)) : null);\n contentElement.style.setProperty?.(`${variablePrefix}-min-width`, matchReferenceWidth ? px(rects.reference.width) : null);\n },\n }),\n ...arrowMiddleware,\n hide({ rootBoundary: 'viewport' }),\n ],\n }).then((result) => {\n overlayElement.style.setProperty?.(`${variablePrefix}-position-x`, px(result.x));\n overlayElement.style.setProperty?.(`${variablePrefix}-position-y`, px(result.y));\n if (options.hiddenClass) {\n overlayElement.classList.toggle(options.hiddenClass, !!result.middlewareData.hide?.referenceHidden);\n }\n if (options.showArrow) {\n const overlaySide = getSide(result.placement);\n const arrowSide = getOppositeSide(result.placement);\n applyStyles(arrowElement, {\n display: null,\n top: px(result.middlewareData.arrow?.y),\n left: px(result.middlewareData.arrow?.x),\n [arrowSide]: px(-arrowSize / 2),\n [overlaySide]: null,\n });\n } else {\n applyStyles(arrowElement, { display: 'none' });\n }\n\n return result;\n });\n}\n","import { Strategy } from '@floating-ui/dom';\nimport { DynamicContent } from '@odx/angular/cdk/dynamic-view';\nimport { Position } from '@odx/angular/utils';\n\nexport interface ConnectedOverlayOptions {\n content?: DynamicContent | null;\n context?: Record<string, unknown>;\n containerClass?: string | null;\n hiddenClass: string | null;\n enableFallback: boolean;\n fallbackAxisSideDirection: 'start' | 'end';\n matchReferenceWidth: boolean;\n minHeight?: number | null;\n offset: number;\n outerPadding: number;\n position: Position;\n strategy: Strategy;\n showArrow?: boolean;\n updateOnAnimationFrame?: boolean;\n nonInteractive?: boolean;\n hooks?: {\n beforeOpen?: () => void;\n afterOpen?: () => void;\n beforeClose?: () => void;\n afterClose?: () => void;\n };\n}\n\nexport const DefaultConnectedOverlayOptions: ConnectedOverlayOptions = {\n hiddenClass: 'is-hidden',\n enableFallback: false,\n fallbackAxisSideDirection: 'start',\n matchReferenceWidth: false,\n offset: 8,\n outerPadding: 12,\n position: Position.BOTTOM,\n strategy: 'fixed',\n};\n","import { DynamicViewRef } from '@odx/angular/cdk/dynamic-view';\nimport { waitForAnimations } from '@odx/angular/utils';\nimport { EMPTY, Observable } from 'rxjs';\nimport { ConnectedOverlayComponent } from '../connected-overlay.component';\nimport { ConnectedOverlayOptions } from './connected-overlay-options';\n\n/**\n * A reference to a connected overlay created by the `ConnectedOverlayService`. This class provides methods to interact\n * with the overlay, such as updating its options or closing it. It encapsulates the `DynamicViewRef` for the overlay's instance,\n * allowing for direct manipulation of the overlay's state and behavior.\n *\n * This example demonstrates how to use a `ConnectedOverlayRef` to update and close a connected overlay in response\n * to user interactions.\n *\n * @example\n * ```ts\n * class MyComponent {\n * private overlayRef?: ConnectedOverlayRef;\n *\n * constructor(private overlayService: ConnectedOverlayService) {}\n *\n * openOverlay() {\n * this.overlayRef = this.overlayService.createOverlay(this.someElementRef.nativeElement, { position: 'bottom' });\n * }\n *\n * updateOverlayPosition() {\n * if (this.overlayRef) {\n * this.overlayRef.update({ position: 'top' });\n * }\n * }\n *\n * closeOverlay() {\n * this.overlayRef?.close();\n * }\n * }\n * ```\n *\n * In this example, `MyComponent` uses the `ConnectedOverlayService` to create an overlay. It stores a reference to\n * the created overlay in `overlayRef`, allowing it to update the overlay's position or close it when necessary.\n */\nexport class ConnectedOverlayRef {\n public readonly element = this.dynamicViewRef.getElement();\n\n /**\n * An Observable that emits when the overlay is closed.\n *\n * @emits {void} - Emits when the overlay is closed.\n *\n */\n public readonly onClose$: Observable<void> = this.dynamicViewRef.getContext().closed ?? EMPTY;\n\n constructor(private readonly dynamicViewRef: DynamicViewRef<typeof ConnectedOverlayComponent>) {}\n\n /**\n * Updates the connected overlay with new options.\n *\n * @param options {Partial<ConnectedOverlayOptions>} - The new options to be applied to the connected overlay.\n */\n public update(options: Partial<ConnectedOverlayOptions>): void {\n this.dynamicViewRef.update({ options: options as ConnectedOverlayOptions });\n }\n\n /**\n * Closes the connected overlay.\n *\n * @returns {void}\n */\n public async close(force = false) {\n const hiddenClass = force ? 'force-hidden' : this.dynamicViewRef.getContext().options?.hiddenClass || 'is-hidden';\n this.element?.classList.add(hiddenClass);\n await waitForAnimations(this.element);\n this.dynamicViewRef.destroy();\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n Injector,\n Input,\n NgZone,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n ViewChild,\n ViewEncapsulation,\n inject,\n} from '@angular/core';\nimport { VirtualElement, autoUpdate } from '@floating-ui/dom';\nimport { CoreModule } from '@odx/angular';\nimport { DynamicViewDirective } from '@odx/angular/cdk/dynamic-view';\nimport { CSSComponent } from '@odx/angular/internal';\nimport { NgChanges, Side, deferFn, getSide, hasChanged, injectElement, isPresent } from '@odx/angular/utils';\nimport { Subject } from 'rxjs';\nimport { computeOverlayPosition } from './helpers';\nimport { ConnectedOverlayOptions, DefaultConnectedOverlayOptions } from './models';\n\n@CSSComponent('cdk-connected-overlay')\n@Component({\n standalone: true,\n selector: 'odx-connected-overlay[popover=\"manual\"]',\n imports: [CoreModule, DynamicViewDirective],\n templateUrl: 'connected-overlay.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class ConnectedOverlayComponent implements OnInit, OnChanges, OnDestroy {\n private readonly zone = inject(NgZone);\n private positionUpdater: (() => void) | null = null;\n\n protected readonly injector = inject(Injector);\n protected overlaySide?: Side;\n\n @ViewChild('content', { static: true })\n protected contentElement!: ElementRef<HTMLElement>;\n\n @ViewChild('arrow', { static: true })\n protected arrowElement!: ElementRef<HTMLElement>;\n\n public readonly element = injectElement();\n\n @Input()\n public referenceElement!: VirtualElement;\n\n @Input()\n public options: ConnectedOverlayOptions = DefaultConnectedOverlayOptions;\n\n @Output()\n public closed = new Subject<void>();\n\n public ngOnInit(): void {\n this.options.hooks?.beforeOpen?.();\n deferFn(() => {\n this.element.nativeElement?.isConnected && this.element.nativeElement?.showPopover?.();\n this.options.hooks?.afterOpen?.();\n });\n }\n\n public ngOnChanges(changes: NgChanges<ConnectedOverlayComponent>): void {\n if (hasChanged(changes, ['options'], false)) {\n this.overlaySide = getSide(this.options.position);\n this.element.nativeElement.classList.toggle('odx-cdk-connected-overlay--non-interactive', this.options.nonInteractive ?? false);\n }\n if (hasChanged(changes, ['referenceElement', 'options'], false)) {\n this.stopPositionUpdater();\n this.startPositionUpdater();\n }\n }\n\n public ngOnDestroy(): void {\n this.options.hooks?.beforeClose?.();\n this.stopPositionUpdater();\n this.element.nativeElement?.hidePopover?.();\n this.closed.next();\n this.options.hooks?.afterClose?.();\n }\n\n private startPositionUpdater(): void {\n this.positionUpdater = this.zone.runOutsideAngular(() =>\n autoUpdate(this.referenceElement, this.element.nativeElement, () => this.updatePosition(), {\n elementResize: isPresent(window.ResizeObserver),\n animationFrame: this.options.updateOnAnimationFrame,\n }),\n );\n }\n\n private stopPositionUpdater(): void {\n this.positionUpdater?.();\n this.positionUpdater = null;\n }\n\n private async updatePosition(): Promise<void> {\n return computeOverlayPosition(\n this.referenceElement,\n this.element.nativeElement,\n this.contentElement.nativeElement,\n this.arrowElement.nativeElement,\n this.options,\n ).then(({ placement }) => {\n this.overlaySide = getSide(placement);\n });\n }\n}\n","<div class=\"odx-cdk-connected-overlay__content {{ options.containerClass }}\" #content>\n <ng-template [odxDynamicView]=\"options.content\" [odxDynamicViewContext]=\"options.context\" [odxDynamicViewInjector]=\"injector\" />\n <div class=\"odx-cdk-connected-overlay-arrow\" #arrow></div>\n</div>\n","import { inject, Injectable } from '@angular/core';\nimport { VirtualElement } from '@floating-ui/dom';\nimport { DynamicViewRenderingOptions, DynamicViewService } from '@odx/angular/cdk/dynamic-view';\nimport { deepmerge } from '@odx/angular/internal';\nimport { ConnectedOverlayComponent } from './connected-overlay.component';\nimport { ConnectedOverlayOptions, ConnectedOverlayRef, DefaultConnectedOverlayOptions } from './models';\n\n/**\n * Service for creating and managing connected overlays. These overlays are UI elements such as popovers, tooltips,\n * or dropdown menus that are positioned relative to a reference element in the DOM. This service leverages the `DynamicViewService`\n * for dynamic component rendering and provides a streamlined API for creating overlays with custom positioning and options.\n *\n * Use the `ConnectedOverlayService` to dynamically create an overlay next to a specific element in your Angular application.\n * This example demonstrates creating a connected overlay next to a button element when the button is clicked.\n *\n * @example\n * ```ts\n * import { Component, ElementRef, ViewChild } from '@angular/core';\n * import { ConnectedOverlayService, ConnectedOverlayOptions } from '@odx/angular/cdk/connected-overlay';\n *\n * @Component({\n * selector: 'app-example',\n * template: `<button #triggerElement>Click me</button>`,\n * })\n * class AppComponent {\n * @ViewChild('triggerElement') triggerElementRef!: ElementRef;\n *\n * constructor(private connectedOverlayService: ConnectedOverlayService) {}\n *\n * showOverlay(): void {\n * const options: Partial<ConnectedOverlayOptions> = {\n * position: 'bottom-start',\n * showArrow: true,\n * content: 'Hello, world!',\n * };\n *\n * this.connectedOverlayService.createOverlay(this.triggerElementRef.nativeElement, options);\n * }\n * }\n * ```\n *\n * This service simplifies the process of creating dynamic, positionally aware overlays that enhance the interactivity\n * and visual appeal of Angular applications.\n */\n@Injectable({ providedIn: 'root' })\nexport class ConnectedOverlayService {\n private readonly dynamicViewService = inject(DynamicViewService);\n\n /**\n * Creates a connected overlay.\n * @param referenceElement - The reference element to which the overlay will be connected.\n * @param options - Optional configuration for the connected overlay.\n * @param renderingOptions - Optional rendering options for the connected overlay.\n * @returns {ConnectedOverlayRef} The created Connected Overlay reference instance.\n */\n public createOverlay(\n referenceElement: VirtualElement,\n options?: Partial<ConnectedOverlayOptions>,\n renderingOptions?: Partial<DynamicViewRenderingOptions>,\n ): ConnectedOverlayRef {\n const dynamicViewRef = this.dynamicViewService.createView(ConnectedOverlayComponent, {\n ...renderingOptions,\n context: { options: deepmerge(DefaultConnectedOverlayOptions, options) as ConnectedOverlayOptions, referenceElement },\n });\n\n return new ConnectedOverlayRef(dynamicViewRef);\n }\n}\n","/**\n * Generated bund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,CAAA,CAAA;AAAvB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,cADV,MAAM,EAAA,CAAA,CAAA;;4FACnB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBADnC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;AC5ClC;;AAEG;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Directive, inject, booleanAttribute,
|
|
2
|
+
import { Directive, inject, booleanAttribute, ViewChild, Input } from '@angular/core';
|
|
3
3
|
import { injectElement, arrayAttribute, Pure, untilDestroyed } from '@odx/angular/utils';
|
|
4
4
|
import { __decorate, __metadata } from 'tslib';
|
|
5
5
|
import { Validators, RequiredValidator, NgControl } from '@angular/forms';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odx-angular-cdk-custom-form-control.mjs","sources":["../../../../libs/angular/cdk/custom-form-control/src/lib/control.directive.ts","../../../../libs/angular/cdk/custom-form-control/src/lib/custom-form-control.ts","../../../../libs/angular/cdk/custom-form-control/src/lib/input-control.directive.ts","../../../../libs/angular/cdk/custom-form-control/src/odx-angular-cdk-custom-form-control.ts"],"sourcesContent":["import { Directive } from '@angular/core';\nimport { injectElement } from '@odx/angular/utils';\n\n@Directive({\n standalone: true,\n selector: '[odxControl]',\n exportAs: 'odxControl',\n})\nexport class ControlDirective {\n public readonly element = injectElement();\n}\n","import { booleanAttribute, Directive, inject, Input, ViewChild } from '@angular/core';\nimport { ControlValueAccessor, NgControl, RequiredValidator, ValidationErrors, ValidatorFn, Validators } from '@angular/forms';\nimport { Controller, DisabledController, ReadonlyController } from '@odx/angular';\nimport { arrayAttribute, Pure } from '@odx/angular/utils';\nimport { ControlDirective } from './control.directive';\n\n/**\n * An abstract directive that serves as a base for custom form controls, integrating seamlessly with Angular Forms.\n * It incorporates common form control behaviors such as handling disabled and readonly states, validation, and more.\n *\n * This approach allows the creation of highly reusable and consistent form controls within Angular applications,\n * simplifying the integration with Angular Forms and the handling of common form behaviors.\n *\n * Extends Controller to provide a consistent API for managing state changes and subscriptions.\n *\n * @see {Controller}\n */\n@Directive({\n host: {\n '[class.has-error]': 'hasError',\n '[class.is-disabled]': 'isDisabled',\n '[class.is-readonly]': 'isReadonly',\n '[class.is-required]': 'isRequired',\n },\n})\nexport abstract class CustomFormControl<T> extends Controller implements ControlValueAccessor {\n private static CURRENT_INDEX = 0;\n\n private readonly requiredValidator = inject(RequiredValidator, { optional: true, self: true });\n private internalValue: T;\n protected readonly disabledController = DisabledController.inject();\n protected readonly readonlyController = ReadonlyController.inject();\n protected readonly ngControl = inject(NgControl, { self: true, optional: true });\n\n /**\n * A unique identifier for the custom form control. If not provided, a unique ID is generated automatically.\n * This can be useful for associating form control with a label.\n *\n * @type {string}\n */\n @Input()\n public id: string | null = null;\n\n /**\n * The name attribute for the custom form control. Defaults to a unique name if not provided.\n * This is useful when the form control is part of a form and needs to be identified.\n *\n * @type {string}\n */\n @Input()\n public name = `odx-form-control-${CustomFormControl.CURRENT_INDEX++}`;\n\n /**\n * The tabindex attribute for the custom form control. Can be used to control the order of focus navigation.\n *\n * @type {string | null}\n */\n @Input()\n public tabindex: string | null = null;\n\n /**\n * An array of error codes to ignore. If an error code is included in this array, the form control will not\n * consider it as an error state. Useful for ignoring specific validation errors.\n *\n * @type {string[]}\n */\n @Input({ transform: arrayAttribute })\n public ignoreErrors: string[] = [];\n\n @Input({ transform: booleanAttribute })\n public required = false;\n\n /**\n * The current value of the form control. Setting this value updates the internal state and marks the control\n * for checking changes. Getting this value returns the current internal value of the control.\n *\n * @example\n * ```ts\n * this.customInputControl.value = 'newValue'; // Sets the value\n * const currentValue = this.customInputControl.value; // Gets the current value\n * ```\n */\n public set value(value: T) {\n if (this.internalValue !== value) {\n this.internalValue = value;\n this.triggerControllerChange();\n }\n }\n\n /**\n * Gets the value of the custom form control.\n *\n * @returns {T} - The value of the custom form control.\n */\n public get value(): T {\n return this.internalValue;\n }\n\n /**\n * Indicates whether the form control currently has an error. This takes into account any ignored errors.\n *\n * @returns {boolean} - True if the form control has an error, false otherwise.\n *\n * @example\n * ```ts\n * if (this.customInputControl.hasError) { ... }\n * ```\n */\n public get hasError(): boolean {\n return !!this.ngControl?.touched && !!this.ngControl?.invalid && this.hasNonIgnoredError(this.ngControl.errors);\n }\n\n /**\n * Indicates whether the form control is currently disabled.\n *\n * @returns {boolean} - True if the form control is disabled, false otherwise.\n *\n * @example\n * ```ts\n * if (this.customInputControl.isDisabled) { ... }\n * ```\n */\n public get isDisabled(): boolean {\n return !!this.disabledController?.disabled;\n }\n\n /**\n * Indicates whether the form control is currently in a readonly state.\n *\n * @returns {boolean} - True if the form control is readonly, false otherwise.\n *\n * @example\n * ```ts\n * if (this.customInputControl.isReadonly) { ... }\n * ```\n */\n public get isReadonly(): boolean {\n return !!this.readonlyController?.readonly;\n }\n\n /**\n * Indicates whether the form control is marked as required, either through Validators.required, Validators.requiredTrue,\n * or by a required attribute on a parent form field.\n *\n * @returns {boolean} - True if the form control is required, false otherwise.\n *\n * @example\n * ````ts\n * if (this.customInputControl.isRequired) { ... }\n * ````\n */\n public get isRequired(): boolean {\n return this.required || !!this.requiredValidator?.required || this.hasValidator(Validators.required) || this.hasValidator(Validators.requiredTrue);\n }\n\n /**\n * A reference to the `ControlDirective` if it exists within the same host. This allows for direct interaction\n * with the underlying form control directive.\n *\n * @type {ControlDirective | null}\n *\n * @example\n * ```ts\n * this.customInputControl.control?.focus();\n * ```\n */\n @ViewChild(ControlDirective)\n public readonly control: ControlDirective | null = null;\n\n constructor(initialValue: T) {\n super();\n this.internalValue = initialValue;\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n /** @internal */\n public onTouched() {\n // implemented by control value accessor\n }\n\n /** @internal */\n public onChange(_value: T) {\n // implemented by control value accessor\n }\n\n /** @internal */\n public registerOnChange(fn: (value: T) => void): void {\n this.onChange = fn;\n }\n /** @internal */\n public registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /** @internal */\n public setDisabledState(isDisabled: boolean): void {\n this.disabledController?.setDisabledState(isDisabled);\n }\n\n /** @internal */\n public writeValue(value: T): void {\n this.value = value;\n this.onChange(value);\n }\n\n /** @internal */\n public updateValue(value: T): void {\n if (this.isDisabled) return;\n this.writeValue(value);\n this.onTouched();\n }\n\n protected hasValidator(validator: ValidatorFn): boolean {\n return !!this.ngControl?.control?.hasValidator(validator);\n }\n\n @Pure\n private hasNonIgnoredError(errors: ValidationErrors | null): boolean {\n if (!errors) return false;\n\n return Object.keys(errors).some((error) => !this.ignoreErrors.includes(error));\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectElement, untilDestroyed } from '@odx/angular/utils';\nimport { distinctUntilChanged, fromEvent, map } from 'rxjs';\n\n/**\n * An abstract directive that facilitates handling input changes, focusing, and blurring programmatically for input elements.\n * It provides a reactive `valueChange$` observable to subscribe to input changes.\n * This directive can be extended to create more specific input handlers.\n *\n * @example\n * Extending InputControlDirective in a custom directive:\n * ```ts\n * @Directive({\n * selector: '[appCustomInput]',\n * standalone: true,\n * })\n * export class CustomInputDirective extends InputControlDirective {\n * // Custom logic here\n * }\n * ```\n *\n * Using the directive in a component template:\n * ```html\n * <input appCustomInput type=\"text\" />\n * ```\n *\n * Subscribing to input changes in the component:\n * ```ts\n * @Component({...})\n * export class MyComponent implements AfterViewInit {\n * @ViewChild(CustomInputDirective) customInputDirective!: CustomInputDirective;\n *\n * ngAfterViewInit(): void {\n * this.customInputDirective.valueChange$.subscribe(value => {\n * console.log('Input value changed to:', value);\n * });\n * }\n * }\n *\n * // Focusing the input programmatically\n * this.customInputDirective.focus();\n *\n * // Blurring the input programmatically\n * this.customInputDirective.blur();\n *\n * // Resetting the input value programmatically\n * this.customInputDirective.reset();\n * ```\n */\n@Directive({\n standalone: true,\n})\nexport abstract class InputControlDirective {\n protected readonly takeUntilDestroyed = untilDestroyed();\n\n public readonly element = injectElement<HTMLInputElement>();\n\n /**\n * Represents an observable stream of value changes for the input control.\n *\n * @emits {string} input value changes.\n */\n public valueChange$ = fromEvent(this.element.nativeElement, 'input').pipe(\n distinctUntilChanged(),\n map(() => this.nativeElementValue),\n );\n\n /**\n * Gets the current value of the input element.\n *\n * @type {string} The current value of the input element.\n */\n public get nativeElementValue(): string {\n return this.element.nativeElement.value;\n }\n\n /**\n * Sets the value of the input element.\n *\n * @param {string} value - The value to set.\n */\n public set nativeElementValue(value: string) {\n this.element.nativeElement.value = value;\n }\n\n /**\n * Sets focus on the input element.\n *\n * @returns {void}\n */\n public focus(): void {\n this.element.nativeElement.focus();\n }\n\n /**\n * Removes focus from the input element.\n *\n * @returns {void}\n */\n public blur(): void {\n this.element.nativeElement.blur();\n }\n\n /**\n * Resets the input element value to an empty string.\n *\n * @returns {void}\n */\n public reset(): void {\n this.element.nativeElement.value = '';\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAQa,gBAAgB,CAAA;AAL7B,IAAA,WAAA,GAAA;QAMkB,IAAO,CAAA,OAAA,GAAG,aAAa,EAAE,CAAC;AAC3C,KAAA;+GAFY,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;mGAAhB,gBAAgB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,cAAA,EAAA,QAAA,EAAA,CAAA,YAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;4FAAhB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAL5B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,QAAQ,EAA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-control/src/lib/control.directive.ts","../../../../libs/angular/cdk/custom-form-control/src/lib/custom-form-control.ts","../../../../libs/angular/cdk/custom-form-control/src/lib/input-control.directive.ts","../../../../libs/angular/cdk/custom-form-control/src/odx-angular-cdk-custom-form-control.ts"],"sourcesContent":["import { Directive } from '@angular/core';\nimport { injectElement } from '@odx/angular/utils';\n\n@Directive({\n standalone: true,\n selector: '[odxControl]',\n exportAs: 'odxControl',\n})\nexport class ControlDirective {\n public readonly element = injectElement();\n}\n","import { booleanAttribute, Directive, inject, Input, ViewChild } from '@angular/core';\nimport { ControlValueAccessor, NgControl, RequiredValidator, ValidationErrors, ValidatorFn, Validators } from '@angular/forms';\nimport { Controller, DisabledController, ReadonlyController } from '@odx/angular';\nimport { arrayAttribute, Pure } from '@odx/angular/utils';\nimport { ControlDirective } from './control.directive';\n\n/**\n * An abstract directive that serves as a base for custom form controls, integrating seamlessly with Angular Forms.\n * It incorporates common form control behaviors such as handling disabled and readonly states, validation, and more.\n *\n * This approach allows the creation of highly reusable and consistent form controls within Angular applications,\n * simplifying the integration with Angular Forms and the handling of common form behaviors.\n *\n * Extends Controller to provide a consistent API for managing state changes and subscriptions.\n *\n * @see {Controller}\n */\n@Directive({\n host: {\n '[class.has-error]': 'hasError',\n '[class.is-disabled]': 'isDisabled',\n '[class.is-readonly]': 'isReadonly',\n '[class.is-required]': 'isRequired',\n },\n})\nexport abstract class CustomFormControl<T> extends Controller implements ControlValueAccessor {\n private static CURRENT_INDEX = 0;\n\n private readonly requiredValidator = inject(RequiredValidator, { optional: true, self: true });\n private internalValue: T;\n protected readonly disabledController = DisabledController.inject();\n protected readonly readonlyController = ReadonlyController.inject();\n protected readonly ngControl = inject(NgControl, { self: true, optional: true });\n\n /**\n * A unique identifier for the custom form control. If not provided, a unique ID is generated automatically.\n * This can be useful for associating form control with a label.\n *\n * @type {string}\n */\n @Input()\n public id: string | null = null;\n\n /**\n * The name attribute for the custom form control. Defaults to a unique name if not provided.\n * This is useful when the form control is part of a form and needs to be identified.\n *\n * @type {string}\n */\n @Input()\n public name = `odx-form-control-${CustomFormControl.CURRENT_INDEX++}`;\n\n /**\n * The tabindex attribute for the custom form control. Can be used to control the order of focus navigation.\n *\n * @type {string | null}\n */\n @Input()\n public tabindex: string | null = null;\n\n /**\n * An array of error codes to ignore. If an error code is included in this array, the form control will not\n * consider it as an error state. Useful for ignoring specific validation errors.\n *\n * @type {string[]}\n */\n @Input({ transform: arrayAttribute })\n public ignoreErrors: string[] = [];\n\n @Input({ transform: booleanAttribute })\n public required = false;\n\n /**\n * The current value of the form control. Setting this value updates the internal state and marks the control\n * for checking changes. Getting this value returns the current internal value of the control.\n *\n * @example\n * ```ts\n * this.customInputControl.value = 'newValue'; // Sets the value\n * const currentValue = this.customInputControl.value; // Gets the current value\n * ```\n */\n public set value(value: T) {\n if (this.internalValue !== value) {\n this.internalValue = value;\n this.triggerControllerChange();\n }\n }\n\n /**\n * Gets the value of the custom form control.\n *\n * @returns {T} - The value of the custom form control.\n */\n public get value(): T {\n return this.internalValue;\n }\n\n /**\n * Indicates whether the form control currently has an error. This takes into account any ignored errors.\n *\n * @returns {boolean} - True if the form control has an error, false otherwise.\n *\n * @example\n * ```ts\n * if (this.customInputControl.hasError) { ... }\n * ```\n */\n public get hasError(): boolean {\n return !!this.ngControl?.touched && !!this.ngControl?.invalid && this.hasNonIgnoredError(this.ngControl.errors);\n }\n\n /**\n * Indicates whether the form control is currently disabled.\n *\n * @returns {boolean} - True if the form control is disabled, false otherwise.\n *\n * @example\n * ```ts\n * if (this.customInputControl.isDisabled) { ... }\n * ```\n */\n public get isDisabled(): boolean {\n return !!this.disabledController?.disabled;\n }\n\n /**\n * Indicates whether the form control is currently in a readonly state.\n *\n * @returns {boolean} - True if the form control is readonly, false otherwise.\n *\n * @example\n * ```ts\n * if (this.customInputControl.isReadonly) { ... }\n * ```\n */\n public get isReadonly(): boolean {\n return !!this.readonlyController?.readonly;\n }\n\n /**\n * Indicates whether the form control is marked as required, either through Validators.required, Validators.requiredTrue,\n * or by a required attribute on a parent form field.\n *\n * @returns {boolean} - True if the form control is required, false otherwise.\n *\n * @example\n * ````ts\n * if (this.customInputControl.isRequired) { ... }\n * ````\n */\n public get isRequired(): boolean {\n return this.required || !!this.requiredValidator?.required || this.hasValidator(Validators.required) || this.hasValidator(Validators.requiredTrue);\n }\n\n /**\n * A reference to the `ControlDirective` if it exists within the same host. This allows for direct interaction\n * with the underlying form control directive.\n *\n * @type {ControlDirective | null}\n *\n * @example\n * ```ts\n * this.customInputControl.control?.focus();\n * ```\n */\n @ViewChild(ControlDirective)\n public readonly control: ControlDirective | null = null;\n\n constructor(initialValue: T) {\n super();\n this.internalValue = initialValue;\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n /** @internal */\n public onTouched() {\n // implemented by control value accessor\n }\n\n /** @internal */\n public onChange(_value: T) {\n // implemented by control value accessor\n }\n\n /** @internal */\n public registerOnChange(fn: (value: T) => void): void {\n this.onChange = fn;\n }\n /** @internal */\n public registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /** @internal */\n public setDisabledState(isDisabled: boolean): void {\n this.disabledController?.setDisabledState(isDisabled);\n }\n\n /** @internal */\n public writeValue(value: T): void {\n this.value = value;\n this.onChange(value);\n }\n\n /** @internal */\n public updateValue(value: T): void {\n if (this.isDisabled) return;\n this.writeValue(value);\n this.onTouched();\n }\n\n protected hasValidator(validator: ValidatorFn): boolean {\n return !!this.ngControl?.control?.hasValidator(validator);\n }\n\n @Pure\n private hasNonIgnoredError(errors: ValidationErrors | null): boolean {\n if (!errors) return false;\n\n return Object.keys(errors).some((error) => !this.ignoreErrors.includes(error));\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectElement, untilDestroyed } from '@odx/angular/utils';\nimport { distinctUntilChanged, fromEvent, map } from 'rxjs';\n\n/**\n * An abstract directive that facilitates handling input changes, focusing, and blurring programmatically for input elements.\n * It provides a reactive `valueChange$` observable to subscribe to input changes.\n * This directive can be extended to create more specific input handlers.\n *\n * @example\n * Extending InputControlDirective in a custom directive:\n * ```ts\n * @Directive({\n * selector: '[appCustomInput]',\n * standalone: true,\n * })\n * export class CustomInputDirective extends InputControlDirective {\n * // Custom logic here\n * }\n * ```\n *\n * Using the directive in a component template:\n * ```html\n * <input appCustomInput type=\"text\" />\n * ```\n *\n * Subscribing to input changes in the component:\n * ```ts\n * @Component({...})\n * export class MyComponent implements AfterViewInit {\n * @ViewChild(CustomInputDirective) customInputDirective!: CustomInputDirective;\n *\n * ngAfterViewInit(): void {\n * this.customInputDirective.valueChange$.subscribe(value => {\n * console.log('Input value changed to:', value);\n * });\n * }\n * }\n *\n * // Focusing the input programmatically\n * this.customInputDirective.focus();\n *\n * // Blurring the input programmatically\n * this.customInputDirective.blur();\n *\n * // Resetting the input value programmatically\n * this.customInputDirective.reset();\n * ```\n */\n@Directive({\n standalone: true,\n})\nexport abstract class InputControlDirective {\n protected readonly takeUntilDestroyed = untilDestroyed();\n\n public readonly element = injectElement<HTMLInputElement>();\n\n /**\n * Represents an observable stream of value changes for the input control.\n *\n * @emits {string} input value changes.\n */\n public valueChange$ = fromEvent(this.element.nativeElement, 'input').pipe(\n distinctUntilChanged(),\n map(() => this.nativeElementValue),\n );\n\n /**\n * Gets the current value of the input element.\n *\n * @type {string} The current value of the input element.\n */\n public get nativeElementValue(): string {\n return this.element.nativeElement.value;\n }\n\n /**\n * Sets the value of the input element.\n *\n * @param {string} value - The value to set.\n */\n public set nativeElementValue(value: string) {\n this.element.nativeElement.value = value;\n }\n\n /**\n * Sets focus on the input element.\n *\n * @returns {void}\n */\n public focus(): void {\n this.element.nativeElement.focus();\n }\n\n /**\n * Removes focus from the input element.\n *\n * @returns {void}\n */\n public blur(): void {\n this.element.nativeElement.blur();\n }\n\n /**\n * Resets the input element value to an empty string.\n *\n * @returns {void}\n */\n public reset(): void {\n this.element.nativeElement.value = '';\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings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AA;kBAH1C,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;;;ACnDD;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odx-angular-cdk-date-input.mjs","sources":["../../../../libs/angular/cdk/date-input/src/lib/models/input-date-order.ts","../../../../libs/angular/cdk/date-input/src/lib/date.config.ts","../../../../libs/angular/cdk/date-input/src/lib/utils/get-date-input-pattern.ts","../../../../libs/angular/cdk/date-input/src/lib/utils/get-input-value-as-date.ts","../../../../libs/angular/cdk/date-input/src/lib/utils/ngx-mask-init.ts","../../../../libs/angular/cdk/date-input/src/odx-angular-cdk-date-input.ts"],"sourcesContent":["export type InputDateOrder = (typeof InputDateOrder)[keyof typeof InputDateOrder];\n\nexport const InputDateOrder = {\n DMY: 'DMY',\n MDY: 'MDY',\n YMD: 'YMD',\n};\n\nexport type DateInputPattern = typeof DateInputFormat | typeof DateInputMask;\n\nexport const DateInputFormat = {\n DAYS: 'dd',\n MONTH: 'MM',\n YEAR: 'yyyy',\n};\n\nexport const DateInputMask = {\n DAYS: 'd0',\n MONTH: 'M0',\n YEAR: '0000',\n};\n","import { createConfigTokens } from '@odx/angular/utils';\nimport { InputDateOrder } from './models/input-date-order';\n\nexport interface DateConfig {\n /**\n * Date's order ('DMY' | 'MDY' | 'YMD').\n * @default InputDateOrder.DMY\n */\n inputDateOrder: InputDateOrder;\n /**\n * Single-character date's separator (dot, slash etc.).\n * @default '.'\n */\n inputDateSeparator: string;\n}\n\n/**\n * Tools for injecting and providing the date configuration with default configuration for the date.\n *\n * @example\n * // Providing custom date configuration.\n * ```ts\n * @Component({\n * providers: [provideDateConfig({ inputDateOrder: InputDateOrder.MDY, inputDateSeparator: '/'})]\n * })\n * export class MyComponent {}\n *\n * // Injecting the date configuration.\n * ```ts\n * @Component({})\n * export class MyComponent {\n * constructor(@Inject(injectDateConfig()) private readonly dateConfig: DateConfig) {}\n * }\n * ```\n */\nexport const { DateConfig, DateDefaultConfig, injectDateConfig, provideDateConfig } = createConfigTokens('Date', '@odx/angular/components/date', {\n inputDateOrder: InputDateOrder.DMY,\n inputDateSeparator: '.',\n});\n","import { DateConfig } from '../date.config';\nimport { DateInputFormat, DateInputMask, DateInputPattern, InputDateOrder } from '../models/input-date-order';\n\nfunction getDateInputPattern({ inputDateOrder, inputDateSeparator }: DateConfig, pattern: DateInputPattern): string {\n const patternList: Record<InputDateOrder, string> = {\n [InputDateOrder.DMY]: `${pattern.DAYS}${inputDateSeparator}${pattern.MONTH}${inputDateSeparator}${pattern.YEAR}`,\n [InputDateOrder.MDY]: `${pattern.MONTH}${inputDateSeparator}${pattern.DAYS}${inputDateSeparator}${pattern.YEAR}`,\n [InputDateOrder.YMD]: `${pattern.YEAR}${inputDateSeparator}${pattern.MONTH}${inputDateSeparator}${pattern.DAYS}`,\n };\n\n return patternList[inputDateOrder];\n}\n\n/** @internal */\nexport function getDateInputFormat(config: DateConfig): string {\n return getDateInputPattern(config, DateInputFormat);\n}\n\n/** @internal */\nexport function getDateInputMask(config: DateConfig): string {\n return getDateInputPattern(config, DateInputMask);\n}\n","import { isValid, toDate } from 'date-fns';\nimport { DateConfig } from '../date.config';\nimport { DateInputFormat, InputDateOrder } from '../models/input-date-order';\n\ninterface DateCandidateInterface {\n month: string;\n day: string;\n year: string;\n}\n\nconst functionList: Record<InputDateOrder, (splittedValue: string[]) => DateCandidateInterface> = {\n [InputDateOrder.DMY]: (splittedValue: string[]) => {\n const [day, month, year] = splittedValue;\n return { month, day, year };\n },\n [InputDateOrder.MDY]: (splittedValue: string[]) => {\n const [month, day, year] = splittedValue;\n return { month, day, year };\n },\n [InputDateOrder.YMD]: (splittedValue: string[]) => {\n const [year, month, day] = splittedValue;\n return { month, day, year };\n },\n};\n\nfunction getDateCandidate({ inputDateOrder, inputDateSeparator }: DateConfig, value: string): DateCandidateInterface | null {\n const splittedValue = value.split(inputDateSeparator);\n\n const { month, day, year }: DateCandidateInterface = functionList[inputDateOrder](splittedValue);\n\n if (\n !month ||\n !day ||\n !year ||\n month.length !== DateInputFormat.MONTH.length ||\n day.length !== DateInputFormat.DAYS.length ||\n year.length !== DateInputFormat.YEAR.length\n ) {\n return null;\n }\n\n return { month, day, year };\n}\n\n/** @internal */\nexport function getDateInputValueAsDate(config: DateConfig, value: string): Date | null {\n const dateCandidate: DateCandidateInterface | null = getDateCandidate(config, value);\n\n if (!dateCandidate) return null;\n\n const date = toDate(`${dateCandidate.month}.${dateCandidate.day}.${dateCandidate.year}`);\n\n return isValid(date) ? date : null;\n}\n","import { isFunction } from '@odx/angular/utils';\nimport { initialConfig, NgxMaskConfig, NgxMaskDirective } from 'ngx-mask';\n\nexport function initNgxMask(ngxMask: NgxMaskDirective | undefined = undefined, mask: string): void {\n if (!ngxMask) return;\n if (!Object.hasOwn(ngxMask, '_maskValue')) {\n throw new Error('[DatepickerInputControlDirective] initNgxMask: ngx-mask internal API changed, mask signal not available.');\n }\n const maskSignal = ngxMask['_maskValue'];\n isFunction(maskSignal.set) && maskSignal.set(mask);\n ngxMask._maskService.maskExpression = mask;\n}\n\nexport const ngxMaskProviderConfig: Partial<NgxMaskConfig> = {\n validation: false,\n leadZeroDateTime: true,\n patterns: {\n ...initialConfig.patterns,\n A: { pattern: new RegExp('[AaPp]') },\n M: { pattern: new RegExp('[mM]') },\n },\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"odx-angular-cdk-date-input.mjs","sources":["../../../../libs/angular/cdk/date-input/src/lib/models/input-date-order.ts","../../../../libs/angular/cdk/date-input/src/lib/date.config.ts","../../../../libs/angular/cdk/date-input/src/lib/utils/get-date-input-pattern.ts","../../../../libs/angular/cdk/date-input/src/lib/utils/get-input-value-as-date.ts","../../../../libs/angular/cdk/date-input/src/lib/utils/ngx-mask-init.ts","../../../../libs/angular/cdk/date-input/src/odx-angular-cdk-date-input.ts"],"sourcesContent":["export type InputDateOrder = (typeof InputDateOrder)[keyof typeof InputDateOrder];\n\nexport const InputDateOrder = {\n DMY: 'DMY',\n MDY: 'MDY',\n YMD: 'YMD',\n};\n\nexport type DateInputPattern = typeof DateInputFormat | typeof DateInputMask;\n\nexport const DateInputFormat = {\n DAYS: 'dd',\n MONTH: 'MM',\n YEAR: 'yyyy',\n};\n\nexport const DateInputMask = {\n DAYS: 'd0',\n MONTH: 'M0',\n YEAR: '0000',\n};\n","import { createConfigTokens } from '@odx/angular/utils';\nimport { InputDateOrder } from './models/input-date-order';\n\nexport interface DateConfig {\n /**\n * Date's order ('DMY' | 'MDY' | 'YMD').\n * @default InputDateOrder.DMY\n */\n inputDateOrder: InputDateOrder;\n /**\n * Single-character date's separator (dot, slash etc.).\n * @default '.'\n */\n inputDateSeparator: string;\n}\n\n/**\n * Tools for injecting and providing the date configuration with default configuration for the date.\n *\n * @example\n * // Providing custom date configuration.\n * ```ts\n * @Component({\n * providers: [provideDateConfig({ inputDateOrder: InputDateOrder.MDY, inputDateSeparator: '/'})]\n * })\n * export class MyComponent {}\n *\n * // Injecting the date configuration.\n * ```ts\n * @Component({})\n * export class MyComponent {\n * constructor(@Inject(injectDateConfig()) private readonly dateConfig: DateConfig) {}\n * }\n * ```\n */\nexport const { DateConfig, DateDefaultConfig, injectDateConfig, provideDateConfig } = createConfigTokens('Date', '@odx/angular/components/date', {\n inputDateOrder: InputDateOrder.DMY,\n inputDateSeparator: '.',\n});\n","import { DateConfig } from '../date.config';\nimport { DateInputFormat, DateInputMask, DateInputPattern, InputDateOrder } from '../models/input-date-order';\n\nfunction getDateInputPattern({ inputDateOrder, inputDateSeparator }: DateConfig, pattern: DateInputPattern): string {\n const patternList: Record<InputDateOrder, string> = {\n [InputDateOrder.DMY]: `${pattern.DAYS}${inputDateSeparator}${pattern.MONTH}${inputDateSeparator}${pattern.YEAR}`,\n [InputDateOrder.MDY]: `${pattern.MONTH}${inputDateSeparator}${pattern.DAYS}${inputDateSeparator}${pattern.YEAR}`,\n [InputDateOrder.YMD]: `${pattern.YEAR}${inputDateSeparator}${pattern.MONTH}${inputDateSeparator}${pattern.DAYS}`,\n };\n\n return patternList[inputDateOrder];\n}\n\n/** @internal */\nexport function getDateInputFormat(config: DateConfig): string {\n return getDateInputPattern(config, DateInputFormat);\n}\n\n/** @internal */\nexport function getDateInputMask(config: DateConfig): string {\n return getDateInputPattern(config, DateInputMask);\n}\n","import { isValid, toDate } from 'date-fns';\nimport { DateConfig } from '../date.config';\nimport { DateInputFormat, InputDateOrder } from '../models/input-date-order';\n\ninterface DateCandidateInterface {\n month: string;\n day: string;\n year: string;\n}\n\nconst functionList: Record<InputDateOrder, (splittedValue: string[]) => DateCandidateInterface> = {\n [InputDateOrder.DMY]: (splittedValue: string[]) => {\n const [day, month, year] = splittedValue;\n return { month, day, year };\n },\n [InputDateOrder.MDY]: (splittedValue: string[]) => {\n const [month, day, year] = splittedValue;\n return { month, day, year };\n },\n [InputDateOrder.YMD]: (splittedValue: string[]) => {\n const [year, month, day] = splittedValue;\n return { month, day, year };\n },\n};\n\nfunction getDateCandidate({ inputDateOrder, inputDateSeparator }: DateConfig, value: string): DateCandidateInterface | null {\n const splittedValue = value.split(inputDateSeparator);\n\n const { month, day, year }: DateCandidateInterface = functionList[inputDateOrder](splittedValue);\n\n if (\n !month ||\n !day ||\n !year ||\n month.length !== DateInputFormat.MONTH.length ||\n day.length !== DateInputFormat.DAYS.length ||\n year.length !== DateInputFormat.YEAR.length\n ) {\n return null;\n }\n\n return { month, day, year };\n}\n\n/** @internal */\nexport function getDateInputValueAsDate(config: DateConfig, value: string): Date | null {\n const dateCandidate: DateCandidateInterface | null = getDateCandidate(config, value);\n\n if (!dateCandidate) return null;\n\n const date = toDate(`${dateCandidate.month}.${dateCandidate.day}.${dateCandidate.year}`);\n\n return isValid(date) ? date : null;\n}\n","import { isFunction } from '@odx/angular/utils';\nimport { initialConfig, NgxMaskConfig, NgxMaskDirective } from 'ngx-mask';\n\nexport function initNgxMask(ngxMask: NgxMaskDirective | undefined = undefined, mask: string): void {\n if (!ngxMask) return;\n if (!Object.hasOwn(ngxMask, '_maskValue')) {\n throw new Error('[DatepickerInputControlDirective] initNgxMask: ngx-mask internal API changed, mask signal not available.');\n }\n const maskSignal = ngxMask['_maskValue'];\n isFunction(maskSignal.set) && maskSignal.set(mask);\n ngxMask._maskService.maskExpression = mask;\n}\n\nexport const ngxMaskProviderConfig: Partial<NgxMaskConfig> = {\n validation: false,\n leadZeroDateTime: true,\n patterns: {\n ...initialConfig.patterns,\n A: { pattern: new RegExp('[AaPp]') },\n M: { pattern: new RegExp('[mM]') },\n },\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAEO,MAAM,cAAc,GAAG;AAC5B,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,GAAG,EAAE,KAAK;;AAKL,MAAM,eAAe,GAAG;AAC7B,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,IAAI,EAAE,MAAM;;AAGP,MAAM,aAAa,GAAG;AAC3B,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,IAAI,EAAE,MAAM;;;ACHd;;;;;;;;;;;;;;;;;;AAkBG;AACI,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,GAAG,kBAAkB,CAAC,MAAM,EAAE,8BAA8B,EAAE;IAC/I,cAAc,EAAE,cAAc,CAAC,GAAG;AAClC,IAAA,kBAAkB,EAAE,GAAG;AACxB,CAAA;;ACnCD,SAAS,mBAAmB,CAAC,EAAE,cAAc,EAAE,kBAAkB,EAAc,EAAE,OAAyB,EAAA;AACxG,IAAA,MAAM,WAAW,GAAmC;QAClD,CAAC,cAAc,CAAC,GAAG,GAAG,CAAA,EAAG,OAAO,CAAC,IAAI,CAAA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AO;QAAE;IACd,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,YAAY,CAAC,EAAE;AACzC,QAAA,MAAM,IAAI,KAAK,CAAC,0GAA0G,CAAC;IAC7H;AACA,IAAA,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;AACxC,IAAA,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC;AAClD,IAAA,OAAO,CAAC,YAAY,CAAC,cAAc,GAAG,IAAI;AAC5C;AAEO,MAAM,qBAAqB,GAA2B;AAC3D,IAAA,UAAU,EAAE,KAAK;AACjB,IAAA,gBAAgB,EAAE,IAAI;AACtB,IAAA,QAAQ,EAAE;QACR,GAAG,aAAa,CAAC,QAAQ;QACzB,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,MAAM,CAAC,QAAQ,CAAC,EAAE;QACpC,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE;AACnC,KAAA;;;ACpBH;;AAEG;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { Input, ViewEncapsulation, ChangeDetectionStrategy, Component, reflectComponentType, ApplicationRef, createComponent, EnvironmentInjector, InjectionToken, inject, Injector, Injectable, ViewContainerRef, TemplateRef, Directive } from '@angular/core';
|
|
3
3
|
import { injectElement, isString, isViewContainer, isTemplateRef, isComponent, hasChanged } from '@odx/angular/utils';
|
|
4
4
|
import { isObservable, distinctUntilChanged } from 'rxjs';
|
|
5
5
|
import { deepmerge } from '@odx/angular/internal';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odx-angular-cdk-dynamic-view.mjs","sources":["../../../../libs/angular/cdk/dynamic-view/src/lib/dynamic-view.component.ts","../../../../libs/angular/cdk/dynamic-view/src/lib/helpers/create-projectable-nodes.ts","../../../../libs/angular/cdk/dynamic-view/src/lib/helpers/is-dynamic-text-content.ts","../../../../libs/angular/cdk/dynamic-view/src/lib/models/dynamic-component-ref.ts","../../../../libs/angular/cdk/dynamic-view/src/lib/models/dynamic-template-ref.ts","../../../../libs/angular/cdk/dynamic-view/src/lib/helpers/is-dynamic-view.ts","../../../../libs/angular/cdk/dynamic-view/src/lib/tokens/dynamic-view-context.ts","../../../../libs/angular/cdk/dynamic-view/src/lib/tokens/dynamic-view-default-host.ts","../../../../libs/angular/cdk/dynamic-view/src/lib/dynamic-view.service.ts","../../../../libs/angular/cdk/dynamic-view/src/lib/dynamic-view.directive.ts","../../../../libs/angular/cdk/dynamic-view/src/odx-angular-cdk-dynamic-view.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, Input, OnDestroy, ViewEncapsulation } from '@angular/core';\nimport { injectElement } from '@odx/angular/utils';\nimport { distinctUntilChanged, isObservable, Subscription } from 'rxjs';\nimport { DynamicTextContent } from './facade';\n\n@Component({\n selector: 'odx-dynamic-view',\n template: '',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n standalone: true,\n})\nexport class DynamicViewComponent implements OnDestroy {\n private readonly element = injectElement();\n private currentSubscription: Subscription | null = null;\n\n @Input()\n public set content(value: DynamicTextContent) {\n if (isObservable(value)) {\n this.ngOnDestroy();\n this.currentSubscription = value.pipe(distinctUntilChanged()).subscribe((innerValue) => {\n this.setContent(innerValue);\n });\n } else {\n this.setContent(value);\n }\n }\n\n public ngOnDestroy(): void {\n this.currentSubscription?.unsubscribe();\n this.currentSubscription = null;\n }\n\n private setContent(value: string): void {\n this.element.nativeElement.innerHTML = value;\n }\n}\n","import { reflectComponentType, Type } from '@angular/core';\n\n/**\n * Prepares an array of node arrays suitable for projection into the `<ng-content>` slots\n * of a dynamically created Angular component based on its content selectors.\n *\n * The function inspects the component's content selectors and aligns the provided nodes\n * for projection according to these selectors. A selector of '*' indicates that the nodes\n * should be projected into this slot. If a content selector does not match '*', an empty\n * array is returned for that slot, indicating no nodes are projected into it.\n *\n * @param {Type<unknown>} component - The component class for which the projectable nodes are being prepared.\n * @param {Node[]} nodes - The nodes intended for projection into the component's `<ng-content>` slots.\n * @returns {Node[][]} An array of node arrays, each corresponding to a `<ng-content>` slot in the component.\n * Each sub-array contains nodes to be projected into the respective `<ng-content>` slot, based on the component's content selectors.\n *\n * @example\n * ```ts\n * // Given a component with two `<ng-content>` slots, the first without a selector and the second with the selector `<ng-content select=\".selector-class\">`,\n * const nodes = [document.createTextNode('Hello'), document.createElement('div')];\n * const projectableNodes = createProjectableNodes(MyComponent, nodes);\n * // projectableNodes would be `[[TextNode, DivElement], []]` for a component with selectors ['*', '.selector-class']\n * ```\n */\nexport function createProjectableNodes(component: Type<unknown>, nodes: Node[]): Node[][] {\n const componentType = reflectComponentType(component);\n if (componentType && componentType.ngContentSelectors.length > 0) {\n return componentType.ngContentSelectors.map((selector) => (selector === '*' ? nodes : []));\n }\n return [];\n}\n","import { isString } from '@odx/angular/utils';\nimport { isObservable } from 'rxjs';\nimport { DynamicTextContent } from '../facade';\n\n/**\n * Type guard function to check if a given value is considered dynamic text content.\n * Dynamic text content can either be a plain string or an Observable. This function\n * facilitates type-safe handling of dynamic text content by checking the type of the value.\n *\n * @param {unknown} value - The value to be checked.\n * @returns {value is DynamicTextContent} Returns `true` if the value is a string or an Observable,\n * indicating it can be used as dynamic text content; otherwise, returns `false`.\n *\n * @example\n * ```ts\n * // Example usage of the isDynamicTextContent function\n * const textValue: unknown = getTextValue(); // This function may return either string or Observable\n *\n * if (isDynamicTextContent(textValue)) {\n * // The type of textValue is now narrowed to DynamicTextContent (string | Observable)\n * console.log('The value can be used as dynamic text content.');\n * } else {\n * console.log('The value is not suitable as dynamic text content.');\n * }\n * ```\n */\nexport function isDynamicTextContent(value: unknown): value is DynamicTextContent {\n return isString(value) || isObservable(value);\n}\n","import { ApplicationRef, ComponentRef, createComponent, EnvironmentInjector, reflectComponentType, Type, ViewRef } from '@angular/core';\nimport { deepmerge } from '@odx/angular/internal';\nimport { isViewContainer } from '@odx/angular/utils';\nimport { GetDynamicViewContext } from '../facade';\nimport { DynamicViewRef } from '../facade/dynamic-view-ref';\nimport { DynamicViewOptions } from './dynamic-view-options';\n\nexport interface DynamicComponentOptions<T extends Type<unknown>> extends DynamicViewOptions<T> {\n component: T;\n}\n\n/**\n * The DynamicComponentRef class is a powerful utility for dynamically creating and managing\n * Angular components at runtime. It encapsulates the logic for component creation, input handling,\n * and lifecycle management, making it easier to work with dynamic components in complex applications.\n *\n * A reference to a dynamically created component, providing methods to manage its lifecycle,\n * detect changes, and update its inputs based on a context.\n *\n * @template T - The type of the component being managed.\n * @template C - The type of the context used to update the component's inputs.\n */\nexport class DynamicComponentRef<T extends Type<unknown>, C extends GetDynamicViewContext<T>> implements DynamicViewRef<T> {\n private readonly application = this.options.injector.get(ApplicationRef);\n private componentRef: ComponentRef<T> | null = null;\n private componentInputs: Record<string, true> | null = null;\n\n constructor(private readonly options: DynamicComponentOptions<T>) {\n const { component, context, injector, projectableNodes, host } = options;\n\n this.componentRef = createComponent(component as Type<T>, {\n environmentInjector: injector.get(EnvironmentInjector),\n elementInjector: injector,\n projectableNodes,\n });\n this.componentInputs =\n reflectComponentType(this.componentRef.componentType)?.inputs.reduce(\n (acc, { propName }) => {\n acc[propName] = true;\n return acc;\n },\n {} as Record<string, true>,\n ) ?? null;\n\n if (isViewContainer(host)) {\n host.insert(this.componentRef.hostView);\n } else {\n this.application.attachView(this.componentRef.hostView);\n if (host) {\n host.appendChild(this.getElement());\n }\n }\n if (context) {\n this.update(context as C);\n }\n }\n\n /**\n * Triggers change detection for the dynamically created component, ensuring that any updates to inputs\n * or internal state are reflected in the view.\n */\n public detectChanges(): void {\n this.componentRef?.changeDetectorRef.detectChanges();\n }\n\n /**\n * Destroys the dynamically created component, cleaning up resources and detaching it from the application view.\n */\n public destroy(): void {\n if (this.componentRef?.hostView.destroyed) {\n this.componentRef = null;\n return;\n }\n if (this.componentRef && !isViewContainer(this.options.host)) {\n this.application.detachView(this.componentRef.hostView);\n }\n this.componentRef?.destroy();\n this.componentRef = null;\n this.componentInputs = null;\n }\n\n /**\n * Retrieves the native element associated with the dynamically created component's host view.\n *\n * @returns {Element} The native DOM element of the component.\n */\n public getElement(): Element {\n return this.componentRef?.location.nativeElement ?? null;\n }\n\n /**\n * Updates the component's inputs based on the provided context. Merges the new context with the existing\n * context and applies the combined context as inputs to the component.\n *\n * @param {C} context - The context containing new values for the component's inputs.\n */\n public update(context: C): void {\n this.options.context = deepmerge({}, this.options.context, context) as C;\n if (!this.componentRef) return;\n for (const key in this.options.context) {\n if (this.componentInputs?.[key]) {\n this.componentRef.setInput(key, this.options.context[key]);\n }\n }\n }\n\n /**\n * Retrieves the current context used for the component's inputs.\n *\n * @returns {GetDynamicViewContext<T>} The current context object.\n */\n public getContext(): GetDynamicViewContext<T> {\n return this.options.context ?? {};\n }\n\n /**\n * Retrieves the view reference associated with the dynamically created component.\n *\n * @returns {ViewRef | null} The view reference, or null if the component has not been created or has been destroyed.\n */\n public getView(): ViewRef | null {\n return this.componentRef?.hostView ?? null;\n }\n}\n","import { ApplicationRef, EmbeddedViewRef, TemplateRef as NgTemplateRef, ViewRef } from '@angular/core';\nimport { deepmerge } from '@odx/angular/internal';\nimport { isViewContainer } from '@odx/angular/utils';\nimport { DynamicViewRef, GetDynamicViewContext } from '../facade';\nimport { DynamicViewOptions } from './dynamic-view-options';\n\nexport interface DynamicTemplateOptions<T extends NgTemplateRef<unknown>> extends DynamicViewOptions<T> {\n template: T;\n}\n\n/**\n * A reference to a dynamically created template, offering methods to manage its lifecycle,\n * detect changes, and update its context. It encapsulates the logic for creating and manipulating\n * an `EmbeddedViewRef` from a given `TemplateRef`.\n *\n * @template T - The type of the `NgTemplateRef` being managed.\n */\nexport class DynamicTemplateRef<T extends NgTemplateRef<unknown> = NgTemplateRef<unknown>> implements DynamicViewRef<T> {\n private readonly application = this.options.injector.get(ApplicationRef);\n private embeddedViewRef: EmbeddedViewRef<unknown> | null = null;\n\n constructor(private readonly options: DynamicTemplateOptions<T>) {\n this.create(options);\n }\n\n /**\n * Triggers change detection on the embedded view created from the template, ensuring that any updates\n * to the context or internal state are reflected in the view.\n */\n public detectChanges(): void {\n this.embeddedViewRef?.detectChanges();\n }\n\n /**\n * Destroys the embedded view associated with the template, cleaning up resources and detaching it from the\n * application view if necessary.\n */\n public destroy(): void {\n if (this.embeddedViewRef?.destroyed) {\n this.embeddedViewRef = null;\n return;\n }\n if (!isViewContainer(this.options.host) && this.embeddedViewRef) {\n this.application.detachView(this.embeddedViewRef);\n }\n this.embeddedViewRef?.destroy();\n this.embeddedViewRef = null;\n }\n\n /**\n * Retrieves the native element associated with the template's embedded view's root node.\n *\n * @returns {Element} The native DOM element of the embedded view's root node, if available.\n */\n public getElement(): Element {\n return this.embeddedViewRef?.rootNodes?.[0] ?? null;\n }\n\n /**\n * Updates the context of the embedded view based on the provided context object. Merges the new context\n * with the existing one and applies the combined context to the embedded view.\n *\n * @param {GetDynamicViewContext<T>} context - The context containing new values for the template's view.\n */\n public update(context: GetDynamicViewContext<T>): void {\n this.options.context = deepmerge({}, this.options.context, context) as GetDynamicViewContext<T>;\n if (this.embeddedViewRef) {\n this.embeddedViewRef.context = this.options.context;\n this.detectChanges();\n }\n }\n\n /**\n * Retrieves the current context used for the template's view.\n *\n * @returns {GetDynamicViewContext<T>} The current context object.\n */\n public getContext(): GetDynamicViewContext<T> {\n return this.options.context ?? {};\n }\n\n /**\n * Retrieves the view reference (`ViewRef`) associated with the dynamically created template's embedded view.\n *\n * @returns {ViewRef | null} The view reference, or null if the template has not been instantiated or has been destroyed.\n */\n public getView(): ViewRef | null {\n return this.embeddedViewRef;\n }\n\n private create({ context, template, host }: DynamicTemplateOptions<T>) {\n if (isViewContainer(host)) {\n this.embeddedViewRef = host.createEmbeddedView(template, context, { injector: this.options.injector });\n } else {\n this.embeddedViewRef = template.createEmbeddedView(context ?? {}, this.options.injector);\n this.application.attachView(this.embeddedViewRef);\n }\n }\n}\n","import { DynamicContent, DynamicViewRef } from '../facade';\nimport { DynamicComponentRef, DynamicTemplateRef } from '../models';\n\n/**\n * Type guard function to check if a given value is a reference to a dynamically created view.\n * This helps in distinguishing between dynamic view references (`DynamicComponentRef` or `DynamicTemplateRef`)\n * and other types of values, facilitating type-safe operations on dynamic views.\n *\n * @param {unknown} value - The value to check.\n * @returns {value is DynamicViewRef<DynamicContent>} `true` if the value is an instance of `DynamicComponentRef`\n * or `DynamicTemplateRef`, indicating it is a dynamic view reference; otherwise, `false`.\n *\n * @example\n * ```ts\n * // Given a value that could be a dynamic view reference or something else\n * const value: unknown = getSomeValue();\n *\n * if (isDynamicView(value)) {\n * // TypeScript now knows `value` is a dynamic view reference, so you can access its methods safely\n * value.detectChanges();\n * } else {\n * console.log('Value is not a dynamic view reference');\n * }\n * ```\n */\nexport function isDynamicView(value: unknown): value is DynamicViewRef<DynamicContent> {\n return value instanceof DynamicComponentRef || value instanceof DynamicTemplateRef;\n}\n","import { InjectionToken, TemplateRef } from '@angular/core';\n\nexport interface DynamicViewContextWithImplicitTemplate<T = unknown> {\n $implicit: TemplateRef<T>;\n}\n\n/**\n * @internal\n * Injection token for the dynamic view context.\n */\nexport const DYNAMIC_VIEW_CONTEXT = new InjectionToken('@odx/angular/cdk/dynamic-view::DynamicViewContext');\n","import { DOCUMENT } from '@angular/common';\nimport { inject, InjectionToken } from '@angular/core';\n\n/**\n * @internal\n * Injection token for the default host element for dynamic views.\n */\nexport const ODX_DYNAMIC_VIEW_DEFAULT_HOST = new InjectionToken<Element>('@odx/angular/cdk/dynamic-view::DynamicViewDefaultHost', {\n providedIn: 'root',\n factory: () => inject(DOCUMENT).body,\n});\n\n/**\n * @internal\n * Retrieves the default host for dynamic views.\n *\n * @returns {Element} The default host element for dynamic views.\n */\nexport function getDynamicViewDefaultHost(): Element {\n return inject(ODX_DYNAMIC_VIEW_DEFAULT_HOST);\n}\n","import { inject, Injectable, Injector } from '@angular/core';\nimport { isComponent, isTemplateRef } from '@odx/angular/utils';\nimport { DynamicViewComponent } from './dynamic-view.component';\nimport { DynamicContent, DynamicViewRef } from './facade';\nimport { isDynamicTextContent } from './helpers';\nimport { DynamicComponentRef, DynamicViewOptions } from './models';\nimport { DynamicTemplateRef } from './models/dynamic-template-ref';\nimport { DYNAMIC_VIEW_CONTEXT, getDynamicViewDefaultHost } from './tokens';\n\n/**\n * A service for creating and managing dynamic views in an Angular application.\n * It supports rendering Angular components, templates, and text content dynamically,\n * allowing for flexible and dynamic content composition.\n */\n@Injectable({ providedIn: 'root' })\nexport class DynamicViewService {\n private readonly injector = inject(Injector);\n private readonly defaultHost = getDynamicViewDefaultHost();\n\n /**\n * Creates and returns a reference to a dynamic view based on the provided content and options.\n * The method supports dynamic creation of components, template references, and text content,\n * providing a unified API for dynamic content rendering.\n *\n * @template T - The type of the content to be dynamically rendered.\n * @param {T} content - The content to be rendered dynamically. This can be a component class,\n * a template reference, or text content.\n * @param {Partial<DynamicViewOptions<T>>} [options={}] - Optional configuration for the dynamic view creation,\n * including a custom injector, context, host element, and additional providers for the dynamic component's injector.\n * @returns {DynamicViewRef<T>} A reference to the dynamically created view, encapsulating the rendered content\n * and providing methods for interaction and management.\n * @throws {Error} Throws an error if the content type is not supported.\n * @example\n * ```ts\n * // Create a dynamic view for a component\n * const componentRef = dynamicViewService.createView(MyComponent, { context: { ... } });\n *\n * // Create a dynamic view for a template reference\n * const templateRef = dynamicViewService.createView(myTemplate, { context: { ... } });\n *\n * // Create a dynamic view for text content\n * const textRef = dynamicViewService.createView('Dynamic text content', {});\n * ```\n */\n public createView<T extends DynamicContent>(content: T, options: Partial<DynamicViewOptions<T>> = {}): DynamicViewRef<T> {\n const viewOptions: DynamicViewOptions<T> = {\n ...options,\n host: options.host ?? this.defaultHost,\n injector: Injector.create({\n providers: [{ provide: DYNAMIC_VIEW_CONTEXT, useValue: options.context }, options.providers ?? []],\n parent: options.injector ?? this.injector,\n }),\n };\n if (isTemplateRef(content)) {\n return new DynamicTemplateRef({ ...viewOptions, template: content });\n }\n if (isComponent(content)) {\n return new DynamicComponentRef({ ...viewOptions, context: options.context, component: content });\n }\n if (isDynamicTextContent(content)) {\n return new DynamicComponentRef({\n ...viewOptions,\n component: DynamicViewComponent,\n context: { content },\n }) as never;\n }\n throw new Error('Content type is not supported');\n }\n}\n","import { Directive, EmbeddedViewRef, inject, Injector, Input, OnChanges, OnDestroy, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { hasChanged, isComponent, NgChanges } from '@odx/angular/utils';\nimport { DynamicViewService } from './dynamic-view.service';\nimport { DynamicContent, DynamicViewRef, GetDynamicViewContext } from './facade';\nimport { createProjectableNodes, isDynamicTextContent, isDynamicView } from './helpers';\n\n/**\n * A directive that dynamically renders content based on the provided input. It supports rendering\n * Angular components, templates, and text content, allowing for dynamic and flexible content\n * management within Angular applications.\n *\n * @template T - A type parameter that extends `DynamicContent<unknown>`, representing the type of content to be dynamically rendered.\n */\n@Directive({\n selector: 'ng-template[odxDynamicView]',\n standalone: true,\n})\nexport class DynamicViewDirective<T extends DynamicContent<unknown> = DynamicContent<unknown>> implements OnDestroy, OnInit, OnChanges {\n private readonly dynamicViewService = inject(DynamicViewService);\n private readonly viewContainer = inject(ViewContainerRef);\n private readonly template = inject(TemplateRef);\n private viewRef: DynamicViewRef<T> | null = null;\n private contentViewRef: DynamicViewRef<TemplateRef<unknown>> | null = null;\n\n /**\n * The content to be dynamically rendered. This can be a component, template reference, or text content.\n * The content is wrapped in a `DynamicViewRef`, providing additional control over the dynamically rendered view.\n *\n * @type {T | DynamicViewRef<T> | null}\n * @default null\n */\n @Input('odxDynamicView')\n public content?: T | DynamicViewRef<T> | null = null;\n\n /**\n * An optional injector to be used for dynamically created components.\n * This allows for custom dependency injection\n * into dynamically rendered components.\n *\n * @type {Injector | undefined}\n */\n // eslint-disable-next-line @angular-eslint/no-input-rename\n @Input('odxDynamicViewInjector')\n public injector?: Injector;\n\n /**\n * An optional context providing function for dynamically created views. This function returns the context\n * object to be passed to the dynamically rendered content, allowing for dynamic interaction with the content.\n *\n * @type {GetDynamicViewContext<T> | undefined}\n */\n // eslint-disable-next-line @angular-eslint/no-input-rename\n @Input('odxDynamicViewContext')\n public context?: GetDynamicViewContext<T>;\n\n public ngOnInit(): void {\n this.render();\n }\n\n public ngOnChanges(changes: NgChanges<DynamicViewDirective<DynamicContent>>): void {\n if (hasChanged(changes, 'injector')) {\n this.render();\n }\n if (hasChanged(changes, 'content')) {\n const hasChangedTextContent = isDynamicTextContent(changes.content?.previousValue) && isDynamicTextContent(changes.content?.currentValue);\n this.render(!hasChangedTextContent);\n }\n if (hasChanged(changes, 'context')) {\n this.viewRef?.update(changes.context?.currentValue ?? {});\n }\n }\n\n public ngOnDestroy(): void {\n this.destroy();\n }\n\n /**\n * Retrieves the current `DynamicViewRef` associated with the rendered content, providing access\n * to the view reference for additional operations like updating context or manual destruction.\n *\n * @returns {DynamicViewRef<T> | null} The current view reference for the dynamically rendered content, if available.\n */\n public getView(): DynamicViewRef<T> | null {\n return this.viewRef;\n }\n\n private render(reRender = true) {\n if (!this.content) {\n this.destroy();\n return;\n }\n if (!reRender && this.viewRef) {\n this.viewRef?.update({ content: this.content } as object);\n return;\n }\n this.viewRef?.destroy();\n if (isDynamicView(this.content)) {\n this.viewRef = this.content;\n const hostView = this.viewRef.getView();\n if (hostView) {\n this.viewContainer.insert(hostView);\n }\n } else {\n let projectableNodes: Node[][] = [];\n if (isComponent(this.content)) {\n this.contentViewRef = this.dynamicViewService.createView(this.template, { injector: this.injector });\n const rootNodes = (this.contentViewRef.getView() as EmbeddedViewRef<unknown>).rootNodes;\n projectableNodes = createProjectableNodes(this.content, rootNodes);\n }\n this.viewRef = this.dynamicViewService.createView(this.content, {\n context: this.context ?? undefined,\n injector: this.injector ?? this.viewContainer.injector,\n projectableNodes,\n host: this.viewContainer,\n });\n }\n }\n\n private destroy() {\n this.contentViewRef?.destroy();\n this.viewRef?.destroy();\n this.contentViewRef = null;\n this.vi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,CAAA,uBAAA,EAAA,SAAA,CAAA,EAAA,EAAA,aAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;4FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAJhC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,6BAA6B;AACvC,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA,CAAA;8BAgBQ,OAAO,EAAA,CAAA;sBADb,KAAK;uBAAC,gBAAgB,CAAA;gBAYhB,QAAQ,EAAA,CAAA;sBADd,KAAK;uBAAC,wBAAwB,CAAA;gBAWxB,OAAO,EAAA,CAAA;sBADb,KAAK;uBAAC,uBAAuB,CAAA;;;ACpDhC;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"odx-angular-cdk-dynamic-view.mjs","sources":["../../../../libs/angular/cdk/dynamic-view/src/lib/dynamic-view.component.ts","../../../../libs/angular/cdk/dynamic-view/src/lib/helpers/create-projectable-nodes.ts","../../../../libs/angular/cdk/dynamic-view/src/lib/helpers/is-dynamic-text-content.ts","../../../../libs/angular/cdk/dynamic-view/src/lib/models/dynamic-component-ref.ts","../../../../libs/angular/cdk/dynamic-view/src/lib/models/dynamic-template-ref.ts","../../../../libs/angular/cdk/dynamic-view/src/lib/helpers/is-dynamic-view.ts","../../../../libs/angular/cdk/dynamic-view/src/lib/tokens/dynamic-view-context.ts","../../../../libs/angular/cdk/dynamic-view/src/lib/tokens/dynamic-view-default-host.ts","../../../../libs/angular/cdk/dynamic-view/src/lib/dynamic-view.service.ts","../../../../libs/angular/cdk/dynamic-view/src/lib/dynamic-view.directive.ts","../../../../libs/angular/cdk/dynamic-view/src/odx-angular-cdk-dynamic-view.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, Input, OnDestroy, ViewEncapsulation } from '@angular/core';\nimport { injectElement } from '@odx/angular/utils';\nimport { distinctUntilChanged, isObservable, Subscription } from 'rxjs';\nimport { DynamicTextContent } from './facade';\n\n@Component({\n selector: 'odx-dynamic-view',\n template: '',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n standalone: true,\n})\nexport class DynamicViewComponent implements OnDestroy {\n private readonly element = injectElement();\n private currentSubscription: Subscription | null = null;\n\n @Input()\n public set content(value: DynamicTextContent) {\n if (isObservable(value)) {\n this.ngOnDestroy();\n this.currentSubscription = value.pipe(distinctUntilChanged()).subscribe((innerValue) => {\n this.setContent(innerValue);\n });\n } else {\n this.setContent(value);\n }\n }\n\n public ngOnDestroy(): void {\n this.currentSubscription?.unsubscribe();\n this.currentSubscription = null;\n }\n\n private setContent(value: string): void {\n this.element.nativeElement.innerHTML = value;\n }\n}\n","import { reflectComponentType, Type } from '@angular/core';\n\n/**\n * Prepares an array of node arrays suitable for projection into the `<ng-content>` slots\n * of a dynamically created Angular component based on its content selectors.\n *\n * The function inspects the component's content selectors and aligns the provided nodes\n * for projection according to these selectors. A selector of '*' indicates that the nodes\n * should be projected into this slot. If a content selector does not match '*', an empty\n * array is returned for that slot, indicating no nodes are projected into it.\n *\n * @param {Type<unknown>} component - The component class for which the projectable nodes are being prepared.\n * @param {Node[]} nodes - The nodes intended for projection into the component's `<ng-content>` slots.\n * @returns {Node[][]} An array of node arrays, each corresponding to a `<ng-content>` slot in the component.\n * Each sub-array contains nodes to be projected into the respective `<ng-content>` slot, based on the component's content selectors.\n *\n * @example\n * ```ts\n * // Given a component with two `<ng-content>` slots, the first without a selector and the second with the selector `<ng-content select=\".selector-class\">`,\n * const nodes = [document.createTextNode('Hello'), document.createElement('div')];\n * const projectableNodes = createProjectableNodes(MyComponent, nodes);\n * // projectableNodes would be `[[TextNode, DivElement], []]` for a component with selectors ['*', '.selector-class']\n * ```\n */\nexport function createProjectableNodes(component: Type<unknown>, nodes: Node[]): Node[][] {\n const componentType = reflectComponentType(component);\n if (componentType && componentType.ngContentSelectors.length > 0) {\n return componentType.ngContentSelectors.map((selector) => (selector === '*' ? nodes : []));\n }\n return [];\n}\n","import { isString } from '@odx/angular/utils';\nimport { isObservable } from 'rxjs';\nimport { DynamicTextContent } from '../facade';\n\n/**\n * Type guard function to check if a given value is considered dynamic text content.\n * Dynamic text content can either be a plain string or an Observable. This function\n * facilitates type-safe handling of dynamic text content by checking the type of the value.\n *\n * @param {unknown} value - The value to be checked.\n * @returns {value is DynamicTextContent} Returns `true` if the value is a string or an Observable,\n * indicating it can be used as dynamic text content; otherwise, returns `false`.\n *\n * @example\n * ```ts\n * // Example usage of the isDynamicTextContent function\n * const textValue: unknown = getTextValue(); // This function may return either string or Observable\n *\n * if (isDynamicTextContent(textValue)) {\n * // The type of textValue is now narrowed to DynamicTextContent (string | Observable)\n * console.log('The value can be used as dynamic text content.');\n * } else {\n * console.log('The value is not suitable as dynamic text content.');\n * }\n * ```\n */\nexport function isDynamicTextContent(value: unknown): value is DynamicTextContent {\n return isString(value) || isObservable(value);\n}\n","import { ApplicationRef, ComponentRef, createComponent, EnvironmentInjector, reflectComponentType, Type, ViewRef } from '@angular/core';\nimport { deepmerge } from '@odx/angular/internal';\nimport { isViewContainer } from '@odx/angular/utils';\nimport { GetDynamicViewContext } from '../facade';\nimport { DynamicViewRef } from '../facade/dynamic-view-ref';\nimport { DynamicViewOptions } from './dynamic-view-options';\n\nexport interface DynamicComponentOptions<T extends Type<unknown>> extends DynamicViewOptions<T> {\n component: T;\n}\n\n/**\n * The DynamicComponentRef class is a powerful utility for dynamically creating and managing\n * Angular components at runtime. It encapsulates the logic for component creation, input handling,\n * and lifecycle management, making it easier to work with dynamic components in complex applications.\n *\n * A reference to a dynamically created component, providing methods to manage its lifecycle,\n * detect changes, and update its inputs based on a context.\n *\n * @template T - The type of the component being managed.\n * @template C - The type of the context used to update the component's inputs.\n */\nexport class DynamicComponentRef<T extends Type<unknown>, C extends GetDynamicViewContext<T>> implements DynamicViewRef<T> {\n private readonly application = this.options.injector.get(ApplicationRef);\n private componentRef: ComponentRef<T> | null = null;\n private componentInputs: Record<string, true> | null = null;\n\n constructor(private readonly options: DynamicComponentOptions<T>) {\n const { component, context, injector, projectableNodes, host } = options;\n\n this.componentRef = createComponent(component as Type<T>, {\n environmentInjector: injector.get(EnvironmentInjector),\n elementInjector: injector,\n projectableNodes,\n });\n this.componentInputs =\n reflectComponentType(this.componentRef.componentType)?.inputs.reduce(\n (acc, { propName }) => {\n acc[propName] = true;\n return acc;\n },\n {} as Record<string, true>,\n ) ?? null;\n\n if (isViewContainer(host)) {\n host.insert(this.componentRef.hostView);\n } else {\n this.application.attachView(this.componentRef.hostView);\n if (host) {\n host.appendChild(this.getElement());\n }\n }\n if (context) {\n this.update(context as C);\n }\n }\n\n /**\n * Triggers change detection for the dynamically created component, ensuring that any updates to inputs\n * or internal state are reflected in the view.\n */\n public detectChanges(): void {\n this.componentRef?.changeDetectorRef.detectChanges();\n }\n\n /**\n * Destroys the dynamically created component, cleaning up resources and detaching it from the application view.\n */\n public destroy(): void {\n if (this.componentRef?.hostView.destroyed) {\n this.componentRef = null;\n return;\n }\n if (this.componentRef && !isViewContainer(this.options.host)) {\n this.application.detachView(this.componentRef.hostView);\n }\n this.componentRef?.destroy();\n this.componentRef = null;\n this.componentInputs = null;\n }\n\n /**\n * Retrieves the native element associated with the dynamically created component's host view.\n *\n * @returns {Element} The native DOM element of the component.\n */\n public getElement(): Element {\n return this.componentRef?.location.nativeElement ?? null;\n }\n\n /**\n * Updates the component's inputs based on the provided context. Merges the new context with the existing\n * context and applies the combined context as inputs to the component.\n *\n * @param {C} context - The context containing new values for the component's inputs.\n */\n public update(context: C): void {\n this.options.context = deepmerge({}, this.options.context, context) as C;\n if (!this.componentRef) return;\n for (const key in this.options.context) {\n if (this.componentInputs?.[key]) {\n this.componentRef.setInput(key, this.options.context[key]);\n }\n }\n }\n\n /**\n * Retrieves the current context used for the component's inputs.\n *\n * @returns {GetDynamicViewContext<T>} The current context object.\n */\n public getContext(): GetDynamicViewContext<T> {\n return this.options.context ?? {};\n }\n\n /**\n * Retrieves the view reference associated with the dynamically created component.\n *\n * @returns {ViewRef | null} The view reference, or null if the component has not been created or has been destroyed.\n */\n public getView(): ViewRef | null {\n return this.componentRef?.hostView ?? null;\n }\n}\n","import { ApplicationRef, EmbeddedViewRef, TemplateRef as NgTemplateRef, ViewRef } from '@angular/core';\nimport { deepmerge } from '@odx/angular/internal';\nimport { isViewContainer } from '@odx/angular/utils';\nimport { DynamicViewRef, GetDynamicViewContext } from '../facade';\nimport { DynamicViewOptions } from './dynamic-view-options';\n\nexport interface DynamicTemplateOptions<T extends NgTemplateRef<unknown>> extends DynamicViewOptions<T> {\n template: T;\n}\n\n/**\n * A reference to a dynamically created template, offering methods to manage its lifecycle,\n * detect changes, and update its context. It encapsulates the logic for creating and manipulating\n * an `EmbeddedViewRef` from a given `TemplateRef`.\n *\n * @template T - The type of the `NgTemplateRef` being managed.\n */\nexport class DynamicTemplateRef<T extends NgTemplateRef<unknown> = NgTemplateRef<unknown>> implements DynamicViewRef<T> {\n private readonly application = this.options.injector.get(ApplicationRef);\n private embeddedViewRef: EmbeddedViewRef<unknown> | null = null;\n\n constructor(private readonly options: DynamicTemplateOptions<T>) {\n this.create(options);\n }\n\n /**\n * Triggers change detection on the embedded view created from the template, ensuring that any updates\n * to the context or internal state are reflected in the view.\n */\n public detectChanges(): void {\n this.embeddedViewRef?.detectChanges();\n }\n\n /**\n * Destroys the embedded view associated with the template, cleaning up resources and detaching it from the\n * application view if necessary.\n */\n public destroy(): void {\n if (this.embeddedViewRef?.destroyed) {\n this.embeddedViewRef = null;\n return;\n }\n if (!isViewContainer(this.options.host) && this.embeddedViewRef) {\n this.application.detachView(this.embeddedViewRef);\n }\n this.embeddedViewRef?.destroy();\n this.embeddedViewRef = null;\n }\n\n /**\n * Retrieves the native element associated with the template's embedded view's root node.\n *\n * @returns {Element} The native DOM element of the embedded view's root node, if available.\n */\n public getElement(): Element {\n return this.embeddedViewRef?.rootNodes?.[0] ?? null;\n }\n\n /**\n * Updates the context of the embedded view based on the provided context object. Merges the new context\n * with the existing one and applies the combined context to the embedded view.\n *\n * @param {GetDynamicViewContext<T>} context - The context containing new values for the template's view.\n */\n public update(context: GetDynamicViewContext<T>): void {\n this.options.context = deepmerge({}, this.options.context, context) as GetDynamicViewContext<T>;\n if (this.embeddedViewRef) {\n this.embeddedViewRef.context = this.options.context;\n this.detectChanges();\n }\n }\n\n /**\n * Retrieves the current context used for the template's view.\n *\n * @returns {GetDynamicViewContext<T>} The current context object.\n */\n public getContext(): GetDynamicViewContext<T> {\n return this.options.context ?? {};\n }\n\n /**\n * Retrieves the view reference (`ViewRef`) associated with the dynamically created template's embedded view.\n *\n * @returns {ViewRef | null} The view reference, or null if the template has not been instantiated or has been destroyed.\n */\n public getView(): ViewRef | null {\n return this.embeddedViewRef;\n }\n\n private create({ context, template, host }: DynamicTemplateOptions<T>) {\n if (isViewContainer(host)) {\n this.embeddedViewRef = host.createEmbeddedView(template, context, { injector: this.options.injector });\n } else {\n this.embeddedViewRef = template.createEmbeddedView(context ?? {}, this.options.injector);\n this.application.attachView(this.embeddedViewRef);\n }\n }\n}\n","import { DynamicContent, DynamicViewRef } from '../facade';\nimport { DynamicComponentRef, DynamicTemplateRef } from '../models';\n\n/**\n * Type guard function to check if a given value is a reference to a dynamically created view.\n * This helps in distinguishing between dynamic view references (`DynamicComponentRef` or `DynamicTemplateRef`)\n * and other types of values, facilitating type-safe operations on dynamic views.\n *\n * @param {unknown} value - The value to check.\n * @returns {value is DynamicViewRef<DynamicContent>} `true` if the value is an instance of `DynamicComponentRef`\n * or `DynamicTemplateRef`, indicating it is a dynamic view reference; otherwise, `false`.\n *\n * @example\n * ```ts\n * // Given a value that could be a dynamic view reference or something else\n * const value: unknown = getSomeValue();\n *\n * if (isDynamicView(value)) {\n * // TypeScript now knows `value` is a dynamic view reference, so you can access its methods safely\n * value.detectChanges();\n * } else {\n * console.log('Value is not a dynamic view reference');\n * }\n * ```\n */\nexport function isDynamicView(value: unknown): value is DynamicViewRef<DynamicContent> {\n return value instanceof DynamicComponentRef || value instanceof DynamicTemplateRef;\n}\n","import { InjectionToken, TemplateRef } from '@angular/core';\n\nexport interface DynamicViewContextWithImplicitTemplate<T = unknown> {\n $implicit: TemplateRef<T>;\n}\n\n/**\n * @internal\n * Injection token for the dynamic view context.\n */\nexport const DYNAMIC_VIEW_CONTEXT = new InjectionToken('@odx/angular/cdk/dynamic-view::DynamicViewContext');\n","import { DOCUMENT } from '@angular/common';\nimport { inject, InjectionToken } from '@angular/core';\n\n/**\n * @internal\n * Injection token for the default host element for dynamic views.\n */\nexport const ODX_DYNAMIC_VIEW_DEFAULT_HOST = new InjectionToken<Element>('@odx/angular/cdk/dynamic-view::DynamicViewDefaultHost', {\n providedIn: 'root',\n factory: () => inject(DOCUMENT).body,\n});\n\n/**\n * @internal\n * Retrieves the default host for dynamic views.\n *\n * @returns {Element} The default host element for dynamic views.\n */\nexport function getDynamicViewDefaultHost(): Element {\n return inject(ODX_DYNAMIC_VIEW_DEFAULT_HOST);\n}\n","import { inject, Injectable, Injector } from '@angular/core';\nimport { isComponent, isTemplateRef } from '@odx/angular/utils';\nimport { DynamicViewComponent } from './dynamic-view.component';\nimport { DynamicContent, DynamicViewRef } from './facade';\nimport { isDynamicTextContent } from './helpers';\nimport { DynamicComponentRef, DynamicViewOptions } from './models';\nimport { DynamicTemplateRef } from './models/dynamic-template-ref';\nimport { DYNAMIC_VIEW_CONTEXT, getDynamicViewDefaultHost } from './tokens';\n\n/**\n * A service for creating and managing dynamic views in an Angular application.\n * It supports rendering Angular components, templates, and text content dynamically,\n * allowing for flexible and dynamic content composition.\n */\n@Injectable({ providedIn: 'root' })\nexport class DynamicViewService {\n private readonly injector = inject(Injector);\n private readonly defaultHost = getDynamicViewDefaultHost();\n\n /**\n * Creates and returns a reference to a dynamic view based on the provided content and options.\n * The method supports dynamic creation of components, template references, and text content,\n * providing a unified API for dynamic content rendering.\n *\n * @template T - The type of the content to be dynamically rendered.\n * @param {T} content - The content to be rendered dynamically. This can be a component class,\n * a template reference, or text content.\n * @param {Partial<DynamicViewOptions<T>>} [options={}] - Optional configuration for the dynamic view creation,\n * including a custom injector, context, host element, and additional providers for the dynamic component's injector.\n * @returns {DynamicViewRef<T>} A reference to the dynamically created view, encapsulating the rendered content\n * and providing methods for interaction and management.\n * @throws {Error} Throws an error if the content type is not supported.\n * @example\n * ```ts\n * // Create a dynamic view for a component\n * const componentRef = dynamicViewService.createView(MyComponent, { context: { ... } });\n *\n * // Create a dynamic view for a template reference\n * const templateRef = dynamicViewService.createView(myTemplate, { context: { ... } });\n *\n * // Create a dynamic view for text content\n * const textRef = dynamicViewService.createView('Dynamic text content', {});\n * ```\n */\n public createView<T extends DynamicContent>(content: T, options: Partial<DynamicViewOptions<T>> = {}): DynamicViewRef<T> {\n const viewOptions: DynamicViewOptions<T> = {\n ...options,\n host: options.host ?? this.defaultHost,\n injector: Injector.create({\n providers: [{ provide: DYNAMIC_VIEW_CONTEXT, useValue: options.context }, options.providers ?? []],\n parent: options.injector ?? this.injector,\n }),\n };\n if (isTemplateRef(content)) {\n return new DynamicTemplateRef({ ...viewOptions, template: content });\n }\n if (isComponent(content)) {\n return new DynamicComponentRef({ ...viewOptions, context: options.context, component: content });\n }\n if (isDynamicTextContent(content)) {\n return new DynamicComponentRef({\n ...viewOptions,\n component: DynamicViewComponent,\n context: { content },\n }) as never;\n }\n throw new Error('Content type is not supported');\n }\n}\n","import { Directive, EmbeddedViewRef, inject, Injector, Input, OnChanges, OnDestroy, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { hasChanged, isComponent, NgChanges } from '@odx/angular/utils';\nimport { DynamicViewService } from './dynamic-view.service';\nimport { DynamicContent, DynamicViewRef, GetDynamicViewContext } from './facade';\nimport { createProjectableNodes, isDynamicTextContent, isDynamicView } from './helpers';\n\n/**\n * A directive that dynamically renders content based on the provided input. It supports rendering\n * Angular components, templates, and text content, allowing for dynamic and flexible content\n * management within Angular applications.\n *\n * @template T - A type parameter that extends `DynamicContent<unknown>`, representing the type of content to be dynamically rendered.\n */\n@Directive({\n selector: 'ng-template[odxDynamicView]',\n standalone: true,\n})\nexport class DynamicViewDirective<T extends DynamicContent<unknown> = DynamicContent<unknown>> implements OnDestroy, OnInit, OnChanges {\n private readonly dynamicViewService = inject(DynamicViewService);\n private readonly viewContainer = inject(ViewContainerRef);\n private readonly template = inject(TemplateRef);\n private viewRef: DynamicViewRef<T> | null = null;\n private contentViewRef: DynamicViewRef<TemplateRef<unknown>> | null = null;\n\n /**\n * The content to be dynamically rendered. This can be a component, template reference, or text content.\n * The content is wrapped in a `DynamicViewRef`, providing additional control over the dynamically rendered view.\n *\n * @type {T | DynamicViewRef<T> | null}\n * @default null\n */\n @Input('odxDynamicView')\n public content?: T | DynamicViewRef<T> | null = null;\n\n /**\n * An optional injector to be used for dynamically created components.\n * This allows for custom dependency injection\n * into dynamically rendered components.\n *\n * @type {Injector | undefined}\n */\n // eslint-disable-next-line @angular-eslint/no-input-rename\n @Input('odxDynamicViewInjector')\n public injector?: Injector;\n\n /**\n * An optional context providing function for dynamically created views. This function returns the context\n * object to be passed to the dynamically rendered content, allowing for dynamic interaction with the content.\n *\n * @type {GetDynamicViewContext<T> | undefined}\n */\n // eslint-disable-next-line @angular-eslint/no-input-rename\n @Input('odxDynamicViewContext')\n public context?: GetDynamicViewContext<T>;\n\n public ngOnInit(): void {\n this.render();\n }\n\n public ngOnChanges(changes: NgChanges<DynamicViewDirective<DynamicContent>>): void {\n if (hasChanged(changes, 'injector')) {\n this.render();\n }\n if (hasChanged(changes, 'content')) {\n const hasChangedTextContent = isDynamicTextContent(changes.content?.previousValue) && isDynamicTextContent(changes.content?.currentValue);\n this.render(!hasChangedTextContent);\n }\n if (hasChanged(changes, 'context')) {\n this.viewRef?.update(changes.context?.currentValue ?? {});\n }\n }\n\n public ngOnDestroy(): void {\n this.destroy();\n }\n\n /**\n * Retrieves the current `DynamicViewRef` associated with the rendered content, providing access\n * to the view reference for additional operations like updating context or manual destruction.\n *\n * @returns {DynamicViewRef<T> | null} The current view reference for the dynamically rendered content, if available.\n */\n public getView(): DynamicViewRef<T> | null {\n return this.viewRef;\n }\n\n private render(reRender = true) {\n if (!this.content) {\n this.destroy();\n return;\n }\n if (!reRender && this.viewRef) {\n this.viewRef?.update({ content: this.content } as object);\n return;\n }\n this.viewRef?.destroy();\n if (isDynamicView(this.content)) {\n this.viewRef = this.content;\n const hostView = this.viewRef.getView();\n if (hostView) {\n this.viewContainer.insert(hostView);\n }\n } else {\n let projectableNodes: Node[][] = [];\n if (isComponent(this.content)) {\n this.contentViewRef = this.dynamicViewService.createView(this.template, { injector: this.injector });\n const rootNodes = (this.contentViewRef.getView() as EmbeddedViewRef<unknown>).rootNodes;\n projectableNodes = createProjectableNodes(this.content, rootNodes);\n }\n this.viewRef = this.dynamicViewService.createView(this.content, {\n context: this.context ?? undefined,\n injector: this.injector ?? this.viewContainer.injector,\n projectableNodes,\n host: this.viewContainer,\n });\n }\n }\n\n private destroy() {\n this.contentViewRef?.destroy();\n this.viewRef?.destroy();\n this.contentViewRef = null;\n this.viewRef = null;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAYa,oBAAoB,CAAA;AAPjC,IAAA,WAAA,GAAA;QAQmB,IAAA,CAAA,OAAO,GAAG,aAAa,EAAE;QAClC,IAAA,CAAA,mBAAmB,GAAwB,IAAI;AAsBxD,IAAA;IApBC,IACW,OAAO,CAAC,KAAyB,EAAA;AAC1C,QAAA,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE;YACvB,IAAI,CAAC,WAAW,EAAE;AAClB,YAAA,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,KAAI;AACrF,gBAAA,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;AAC7B,YAAA,CAAC,CAAC;QACJ;aAAO;AACL,YAAA,IAAI,CAAC,UA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