@odx/angular 12.21.4 → 12.21.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/fesm2022/odx-angular-animations.mjs.map +1 -1
  3. package/fesm2022/odx-angular-breakpoints.mjs +1 -1
  4. package/fesm2022/odx-angular-breakpoints.mjs.map +1 -1
  5. package/fesm2022/odx-angular-cdk-a11y.mjs +1 -1
  6. package/fesm2022/odx-angular-cdk-a11y.mjs.map +1 -1
  7. package/fesm2022/odx-angular-cdk-active-indicator.mjs +1 -1
  8. package/fesm2022/odx-angular-cdk-active-indicator.mjs.map +1 -1
  9. package/fesm2022/odx-angular-cdk-autocomplete-control.mjs +1 -1
  10. package/fesm2022/odx-angular-cdk-autocomplete-control.mjs.map +1 -1
  11. package/fesm2022/odx-angular-cdk-checkbox-control.mjs +1 -1
  12. package/fesm2022/odx-angular-cdk-checkbox-control.mjs.map +1 -1
  13. package/fesm2022/odx-angular-cdk-connected-overlay.mjs +1 -1
  14. package/fesm2022/odx-angular-cdk-connected-overlay.mjs.map +1 -1
  15. package/fesm2022/odx-angular-cdk-custom-form-control.mjs +1 -1
  16. package/fesm2022/odx-angular-cdk-custom-form-control.mjs.map +1 -1
  17. package/fesm2022/odx-angular-cdk-date-input.mjs.map +1 -1
  18. package/fesm2022/odx-angular-cdk-dynamic-view.mjs +1 -1
  19. package/fesm2022/odx-angular-cdk-dynamic-view.mjs.map +1 -1
  20. package/fesm2022/odx-angular-cdk-event-plugins.mjs.map +1 -1
  21. package/fesm2022/odx-angular-cdk-expandable.mjs +1 -1
  22. package/fesm2022/odx-angular-cdk-expandable.mjs.map +1 -1
  23. package/fesm2022/odx-angular-cdk-option-control.mjs +1 -1
  24. package/fesm2022/odx-angular-cdk-option-control.mjs.map +1 -1
  25. package/fesm2022/odx-angular-cdk-radio-group-control.mjs +1 -1
  26. package/fesm2022/odx-angular-cdk-radio-group-control.mjs.map +1 -1
  27. package/fesm2022/odx-angular-cdk-scrollable.mjs.map +1 -1
  28. package/fesm2022/odx-angular-components-accordion.mjs +1 -1
  29. package/fesm2022/odx-angular-components-accordion.mjs.map +1 -1
  30. package/fesm2022/odx-angular-components-action-group.mjs +1 -1
  31. package/fesm2022/odx-angular-components-action-group.mjs.map +1 -1
  32. package/fesm2022/odx-angular-components-anchor-navigation.mjs +1 -1
  33. package/fesm2022/odx-angular-components-anchor-navigation.mjs.map +1 -1
  34. package/fesm2022/odx-angular-components-area-header.mjs +1 -1
  35. package/fesm2022/odx-angular-components-area-header.mjs.map +1 -1
  36. package/fesm2022/odx-angular-components-autocomplete.mjs +1 -1
  37. package/fesm2022/odx-angular-components-autocomplete.mjs.map +1 -1
  38. package/fesm2022/odx-angular-components-avatar.mjs +1 -1
  39. package/fesm2022/odx-angular-components-avatar.mjs.map +1 -1
  40. package/fesm2022/odx-angular-components-badge.mjs +1 -1
  41. package/fesm2022/odx-angular-components-badge.mjs.map +1 -1
  42. package/fesm2022/odx-angular-components-bar.mjs +1 -1
  43. package/fesm2022/odx-angular-components-bar.mjs.map +1 -1
  44. package/fesm2022/odx-angular-components-breadcrumbs.mjs +1 -1
  45. package/fesm2022/odx-angular-components-breadcrumbs.mjs.map +1 -1
  46. package/fesm2022/odx-angular-components-button-group.mjs +1 -1
  47. package/fesm2022/odx-angular-components-button-group.mjs.map +1 -1
  48. package/fesm2022/odx-angular-components-button.mjs +1 -1
  49. package/fesm2022/odx-angular-components-button.mjs.map +1 -1
  50. package/fesm2022/odx-angular-components-calendar.mjs +2 -2
  51. package/fesm2022/odx-angular-components-calendar.mjs.map +1 -1
  52. package/fesm2022/odx-angular-components-card.mjs +2 -2
  53. package/fesm2022/odx-angular-components-card.mjs.map +1 -1
  54. package/fesm2022/odx-angular-components-checkbox.mjs +1 -1
  55. package/fesm2022/odx-angular-components-checkbox.mjs.map +1 -1
  56. package/fesm2022/odx-angular-components-chip.mjs +1 -1
  57. package/fesm2022/odx-angular-components-chip.mjs.map +1 -1
  58. package/fesm2022/odx-angular-components-circular-progress.mjs +1 -1
  59. package/fesm2022/odx-angular-components-circular-progress.mjs.map +1 -1
  60. package/fesm2022/odx-angular-components-content-box.mjs +1 -1
  61. package/fesm2022/odx-angular-components-content-box.mjs.map +1 -1
  62. package/fesm2022/odx-angular-components-data-table.mjs +1 -1
  63. package/fesm2022/odx-angular-components-data-table.mjs.map +1 -1
  64. package/fesm2022/odx-angular-components-datepicker.mjs +2 -2
  65. package/fesm2022/odx-angular-components-datepicker.mjs.map +1 -1
  66. package/fesm2022/odx-angular-components-daterangepicker.mjs +3 -3
  67. package/fesm2022/odx-angular-components-daterangepicker.mjs.map +1 -1
  68. package/fesm2022/odx-angular-components-dropdown.mjs +1 -1
  69. package/fesm2022/odx-angular-components-dropdown.mjs.map +1 -1
  70. package/fesm2022/odx-angular-components-error-page.mjs +1 -1
  71. package/fesm2022/odx-angular-components-error-page.mjs.map +1 -1
  72. package/fesm2022/odx-angular-components-footer.mjs +2 -2
  73. package/fesm2022/odx-angular-components-footer.mjs.map +1 -1
  74. package/fesm2022/odx-angular-components-form-field.mjs +1 -1
  75. package/fesm2022/odx-angular-components-form-field.mjs.map +1 -1
  76. package/fesm2022/odx-angular-components-header-navigation.mjs +1 -1
  77. package/fesm2022/odx-angular-components-header-navigation.mjs.map +1 -1
  78. package/fesm2022/odx-angular-components-header.mjs +1 -1
  79. package/fesm2022/odx-angular-components-header.mjs.map +1 -1
  80. package/fesm2022/odx-angular-components-icon.mjs +1 -1
  81. package/fesm2022/odx-angular-components-icon.mjs.map +1 -1
  82. package/fesm2022/odx-angular-components-inline-message.mjs +1 -1
  83. package/fesm2022/odx-angular-components-inline-message.mjs.map +1 -1
  84. package/fesm2022/odx-angular-components-link.mjs.map +1 -1
  85. package/fesm2022/odx-angular-components-list.mjs +2 -2
  86. package/fesm2022/odx-angular-components-list.mjs.map +1 -1
  87. package/fesm2022/odx-angular-components-loading-spinner.mjs +1 -1
  88. package/fesm2022/odx-angular-components-loading-spinner.mjs.map +1 -1
  89. package/fesm2022/odx-angular-components-logo.mjs +1 -1
  90. package/fesm2022/odx-angular-components-logo.mjs.map +1 -1
  91. package/fesm2022/odx-angular-components-main-menu.mjs +2 -2
  92. package/fesm2022/odx-angular-components-main-menu.mjs.map +1 -1
  93. package/fesm2022/odx-angular-components-mainfilter-group.mjs +1 -1
  94. package/fesm2022/odx-angular-components-mainfilter-group.mjs.map +1 -1
  95. package/fesm2022/odx-angular-components-menu.mjs +1 -1
  96. package/fesm2022/odx-angular-components-menu.mjs.map +1 -1
  97. package/fesm2022/odx-angular-components-modal.mjs +1 -1
  98. package/fesm2022/odx-angular-components-modal.mjs.map +1 -1
  99. package/fesm2022/odx-angular-components-navigation-back.mjs +1 -1
  100. package/fesm2022/odx-angular-components-navigation-back.mjs.map +1 -1
  101. package/fesm2022/odx-angular-components-notification-testing.mjs.map +1 -1
  102. package/fesm2022/odx-angular-components-notification.mjs +3 -3
  103. package/fesm2022/odx-angular-components-notification.mjs.map +1 -1
  104. package/fesm2022/odx-angular-components-paginator.mjs +1 -1
  105. package/fesm2022/odx-angular-components-paginator.mjs.map +1 -1
  106. package/fesm2022/odx-angular-components-progress.mjs +1 -1
  107. package/fesm2022/odx-angular-components-progress.mjs.map +1 -1
  108. package/fesm2022/odx-angular-components-radio-group.mjs +1 -1
  109. package/fesm2022/odx-angular-components-radio-group.mjs.map +1 -1
  110. package/fesm2022/odx-angular-components-rail-navigation.mjs +1 -1
  111. package/fesm2022/odx-angular-components-rail-navigation.mjs.map +1 -1
  112. package/fesm2022/odx-angular-components-rich-list.mjs +1 -1
  113. package/fesm2022/odx-angular-components-rich-list.mjs.map +1 -1
  114. package/fesm2022/odx-angular-components-search-bar.mjs.map +1 -1
  115. package/fesm2022/odx-angular-components-select.mjs +1 -1
  116. package/fesm2022/odx-angular-components-select.mjs.map +1 -1
  117. package/fesm2022/odx-angular-components-slider.mjs +1 -1
  118. package/fesm2022/odx-angular-components-slider.mjs.map +1 -1
  119. package/fesm2022/odx-angular-components-spinbox.mjs +1 -1
  120. package/fesm2022/odx-angular-components-spinbox.mjs.map +1 -1
  121. package/fesm2022/odx-angular-components-switch.mjs +1 -1
  122. package/fesm2022/odx-angular-components-switch.mjs.map +1 -1
  123. package/fesm2022/odx-angular-components-tab-bar.mjs +1 -1
  124. package/fesm2022/odx-angular-components-tab-bar.mjs.map +1 -1
  125. package/fesm2022/odx-angular-components-table.mjs +1 -1
  126. package/fesm2022/odx-angular-components-table.mjs.map +1 -1
  127. package/fesm2022/odx-angular-components-timepicker.mjs +2 -2
  128. package/fesm2022/odx-angular-components-timepicker.mjs.map +1 -1
  129. package/fesm2022/odx-angular-components-toast.mjs +1 -1
  130. package/fesm2022/odx-angular-components-toast.mjs.map +1 -1
  131. package/fesm2022/odx-angular-components-toggle-button-group.mjs +1 -1
  132. package/fesm2022/odx-angular-components-toggle-button-group.mjs.map +1 -1
  133. package/fesm2022/odx-angular-components-tooltip.mjs +1 -1
  134. package/fesm2022/odx-angular-components-tooltip.mjs.map +1 -1
  135. package/fesm2022/odx-angular-components-wizard.mjs +1 -1
  136. package/fesm2022/odx-angular-components-wizard.mjs.map +1 -1
  137. package/fesm2022/odx-angular-internal-translate.mjs.map +1 -1
  138. package/fesm2022/odx-angular-internal.mjs.map +1 -1
  139. package/fesm2022/odx-angular-localization.mjs.map +1 -1
  140. package/fesm2022/odx-angular-rxjs.mjs.map +1 -1
  141. package/fesm2022/odx-angular-sdk.mjs.map +1 -1
  142. package/fesm2022/odx-angular-theming.mjs.map +1 -1
  143. package/fesm2022/odx-angular-utils.mjs.map +1 -1
  144. package/fesm2022/odx-angular.mjs +2 -2
  145. package/fesm2022/odx-angular.mjs.map +1 -1
  146. package/package.json +7 -7
@@ -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;QA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,GAAG,EAAE,CAAC;KACvC;+GA1DmB,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;mGAArB,qBAAqB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;4FAArB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAH1C,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA,CAAA;;;ACnDD;;AAEG;;;;"}
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,IAAA,CAAA,OAAO,GAAG,aAAa,EAAE;AAC1C,IAAA;+GAFY,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;mGAAhB,gBAAgB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,cAAA,EAAA,QAAA,EAAA,CAAA,YAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAAhB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAL5B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,QAAQ,EAAE,cAAc;AACxB,oBAAA,QAAQ,EAAE,YAAY;AACvB,iBAAA;;;ACDD;;;;;;;;;;AAUG;AASG,MAAgB,iBAAqB,SAAQ,UAAU,CAAA;aAC5C,IAAA,CAAA,aAAa,GAAG,CAAH,CAAK;AA8CjC;;;;;;;;;AASG;IACH,IAAW,KAAK,CAAC,KAAQ,EAAA;AACvB,QAAA,IAAI,IAAI,CAAC,aAAa,KAAK,KAAK,EAAE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C,aAAa,CAAC,KAAK,EAAE;IACpC;AAEA;;;;AAIG;IACI,IAAI,GAAA;AACT,QAAA,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE;IACnC;AAEA;;;;AAIG;IACI,KAAK,GAAA;QACV,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,GAAG,EAAE;IACvC;+GA1DoB,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;mGAArB,qBAAqB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAArB,qBAAqB,EAAA,UAAA,EAAA,CAAA;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":";;;;AAEa,MAAA,cAAc,GAAG;AAC5B,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,GAAG,EAAE,KAAK;EACV;AAIW,MAAA,eAAe,GAAG;AAC7B,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,IAAI,EAAE,MAAM;EACZ;AAEW,MAAA,aAAa,GAAG;AAC3B,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,IAAI,EAAE,MAAM;;;ACHd;;;;;;;;;;;;;;;;;;AAkBG;AACU,MAAA,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,CAAG,EAAA,OAAO,CAAC,IAAI,CAAA,EAAG,kBAAkB,CAAG,EAAA,OAAO,CAAC,KAAK,CAAA,EAAG,kBAAkB,CAAG,EAAA,OAAO,CAAC,IAAI,CAAE,CAAA;QAChH,CAAC,cAAc,CAAC,GAAG,GAAG,CAAG,EAAA,OAAO,CAAC,KAAK,CAAA,EAAG,kBAAkB,CAAG,EAAA,OAAO,CAAC,IAAI,CAAA,EAAG,kBAAkB,CAAG,EAAA,OAAO,CAAC,IAAI,CAAE,CAAA;QAChH,CAAC,cAAc,CAAC,GAAG,GAAG,CAAG,EAAA,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,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACnD,IAAA,OAAO,CAAC,YAAY,CAAC,cAAc,GAAG,IAAI,CAAC;AAC7C,CAAC;AAEY,MAAA,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
+ {"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\n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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 { Component, ChangeDetectionStrategy, ViewEncapsulation, Input, reflectComponentType, ApplicationRef, createComponent, EnvironmentInjector, InjectionToken, inject, Injector, Injectable, ViewContainerRef, TemplateRef, Directive } from '@angular/core';
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.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,IAAO,CAAA,OAAA,GAAG,aAAa,EAAE,CAAC;QACnC,IAAmB,CAAA,mBAAA,GAAwB,IAAI,CAAC;AAsBzD,KAAA;IApBC,IACW,OAAO,CAAC,KAAyB,EAAA;AAC1C,QAAA,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE;YACvB,IAAI,CAAC,WAAW,EAAE,CAAC;AACnB,YAAA,IA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,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,UAAU,CAAC,KAAK,CAAC;QACxB;IACF;IAEO,WAAW,GAAA;AAChB,QAAA,IAAI,CAAC,mBAAmB,EAAE,WAAW,EAAE;AACvC,QAAA,IAAI,CAAC,mBAAmB,GAAG,IAAI;IACjC;AAEQ,IAAA,UAAU,CAAC,KAAa,EAAA;QAC9B,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,SAAS,GAAG,KAAK;IAC9C;+GAvBW,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAApB,IAAA,SAAA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AAQ,EAAA,CAAA;sBADd,KAAK;uBAAC,wBAAwB;gBAWxB,OAAO,EAAA,CAAA;sBADb,KAAK;uBAAC,uBAAuB;;;ACpDhC;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"odx-angular-cdk-event-plugins.mjs","sources":["../../../../libs/angular/cdk/event-plugins/src/lib/models/event-plugin.ts","../../../../libs/angular/cdk/event-plugins/src/lib/plugins/debounce-event-plugin.ts","../../../../libs/angular/cdk/event-plugins/src/lib/plugins/defer-event-plugin.ts","../../../../libs/angular/cdk/event-plugins/src/lib/event-plugins.config.ts","../../../../libs/angular/cdk/event-plugins/src/odx-angular-cdk-event-plugins.ts"],"sourcesContent":["/* istanbul ignore file */\n/* eslint-disable @typescript-eslint/no-unsafe-function-type */\nimport { NgZone } from '@angular/core';\nimport { EventManager } from '@angular/platform-browser';\nimport { isFunction } from '@odx/angular/utils';\n\ntype EventManagerArg = ConstructorParameters<typeof EventManager>[0][0];\n\ntype EventManagerPlugin = {\n [K in keyof EventManagerArg]: EventManagerArg[K];\n};\n\n/**\n * An abstract class for implementing custom event plugins in Angular. This class provides\n * the core functionality required to create a custom event listener with specific behavior,\n * allowing developers to extend Angular's native event handling capabilities.\n *\n * @example\n * Extending EventPlugin to create a custom event plugin:\n * ```ts\n * @Injectable()\n * class CustomEventPlugin extends EventPlugin {\n * public readonly modifier = /custom/;\n *\n * public addEventListener(element: HTMLElement, eventName: string, handler: EventListener): Function {\n * // Custom logic for adding an event listener\n * }\n * }\n * ```\n *\n * ```html\n * <div (click.custom)=\"handleClick($event)\"></div>\n * ```\n */\nexport abstract class EventPlugin implements EventManagerPlugin {\n protected abstract readonly modifier: RegExp;\n\n /**\n * The event manager for handling events.\n *\n * @type {EventManager}\n */\n public manager!: EventManager;\n\n /**\n * Adds an event listener to the given element.\n *\n * @param {HTMLElement} element - The element to attach the event listener to.\n * @param {string} eventName - The name of the event.\n * @param {EventListener} handler - The event listener function.\n * @returns {Function} - A function that can be called to remove the event listener.\n */\n public abstract addEventListener(element: HTMLElement, eventName: string, handler: EventListener): Function;\n\n /**\n * Adds a global event listener.\n *\n * @returns {Function} - A function that does nothing.\n */\n public addGlobalEventListener(): Function {\n return () => void 0;\n }\n\n /**\n * Checks if the event plugin supports the given event name.\n *\n * @param {string} eventName - The name of the event.\n * @returns {boolean} - `true` if the event plugin supports the event, `false` otherwise.\n */\n public supports(eventName: string): boolean {\n return this.modifier.test(eventName);\n }\n\n /**\n * Gets the NgZone instance from the event manager.\n *\n * @returns {NgZone} - The NgZone instance.\n */\n protected getZone(): NgZone {\n return this.manager.getZone();\n }\n\n /**\n * Tears down the event listener.\n *\n * @param {Function | null} listener - The event listener function.\n * @returns {Function} - A function that can be called to clean up the listener.\n */\n protected teardown(listener: Function | null): () => void {\n return () => (isFunction(listener) ? listener() : void 0);\n }\n}\n","/* istanbul ignore file */\n/* eslint-disable @typescript-eslint/no-unsafe-function-type */\nimport { Injectable, numberAttribute } from '@angular/core';\nimport { debounce } from '@odx/angular/utils';\nimport { EventPlugin } from '../models';\n\nconst DEFAULT_DELAY = 250;\n\n/**\n * A service that extends `EventPlugin` for debouncing events. This service wraps event listeners\n * and ensures that they are triggered no more than once per specified delay period. It is\n * particularly useful for handling events that fire frequently, such as mouse movements\n * or keystrokes, in a performant manner.\n *\n * The delay period can be specified directly in the event name using the syntax\n * `(eventName.debounce.delay)`, where `delay` is the debounce duration in milliseconds.\n * If no delay is specified, a default delay of 250 milliseconds is used.\n *\n * @example\n * Provide the `DebounceEventPlugin` in an Angular module:\n * ```ts\n * @NgModule({\n * providers: [\n * ...\n * provideEventPlugins(),\n * ...\n * ],\n * })\n * export class AppModule {}\n * ```\n *\n * In a component template, apply the debounce modifier to an event, specifying a custom delay:\n * ```html\n * <button (click.debounce.400)=\"handleClick($event)\"></button>\n * ```\n * In a component template, apply the debounce modifier with the default delay:\n * ```html\n * <input (keyup.debounce)=\"onKeyUp($event)\" placeholder=\"Type here...\">\n * ```\n */\n@Injectable()\nexport class DebounceEventPlugin extends EventPlugin {\n public readonly modifier = /debounce/;\n\n public addEventListener(element: HTMLElement, eventName: string, originalHandler: EventListener): Function {\n const [name, , delay] = eventName.split('.');\n const handler = this.createHandler(originalHandler, numberAttribute(delay, DEFAULT_DELAY));\n\n return this.runOutsideAngular(() => this.manager.addEventListener(element, name, handler));\n }\n\n private createHandler(originalHandler: EventListener, delay: number): (event: Event) => void {\n const innerHandler = (event: Event): void => this.getZone().runGuarded(() => originalHandler(event));\n\n return debounce(innerHandler, delay);\n }\n\n private runOutsideAngular(addListener: () => Function): () => void {\n let listener: Function | null = null;\n this.getZone().runOutsideAngular(() => {\n listener = addListener();\n });\n\n return this.teardown(listener);\n }\n}\n","/* istanbul ignore file */\n/* eslint-disable @typescript-eslint/no-unsafe-function-type */\nimport { Injectable } from '@angular/core';\nimport { EventPlugin } from '../models';\n\n/**\n * A service that extends `EventPlugin` to allow event handlers to be deferred until the end of the current call stack.\n * This can improve performance by avoiding triggering Angular's change detection unnecessarily.\n *\n * @example\n * Provide the `DeferEventPlugin` in an Angular module:\n * ```ts\n * @NgModule({\n * providers: [\n * ...\n * provideEventPlugins(),\n * ...\n * ],\n * })\n * export class AppModule {}\n * ```\n *\n * In your Angular component:\n * ```html\n * <button (click.defer)=\"handleClick($event)\"></button>\n * ```\n *\n * The `.defer` modifier in the event name `click.defer` indicates that the event handler should be deferred.\n */\n@Injectable()\nexport class DeferEventPlugin extends EventPlugin {\n public readonly modifier = /defer/;\n\n public addEventListener(element: HTMLElement, eventName: string, originalHandler: EventListener): Function {\n const [name] = eventName.split('.');\n const handler = this.createHandler(originalHandler);\n\n return this.getZone().runOutsideAngular(() => this.manager.addEventListener(element, name, handler));\n }\n\n private createHandler(originalHandler: EventListener): (event: Event) => void {\n return (event: Event): void => {\n setTimeout(() => this.getZone().runGuarded(() => originalHandler(event)), 0);\n };\n }\n}\n","import { EnvironmentProviders, Provider, makeEnvironmentProviders } from '@angular/core';\nimport { EVENT_MANAGER_PLUGINS } from '@angular/platform-browser';\nimport { DebounceEventPlugin, DeferEventPlugin } from './plugins';\n\nconst PLUGINS = [DebounceEventPlugin, DeferEventPlugin];\n\nexport const EVENT_PLUGINS: Provider[] = PLUGINS.map((useClass) => ({\n provide: EVENT_MANAGER_PLUGINS,\n useClass,\n multi: true,\n}));\n\n/**\n * Provides a set of custom event plugins to Angular's event handling system. This function\n * registers custom event plugins like `DebounceEventPlugin` and `DeferEventPlugin`, enhancing\n * the capabilities of Angular's native event management. By using `EVENT_MANAGER_PLUGINS`, these\n * plugins are integrated into Angular's event system and can be utilized in templates and components\n * to handle events with custom behaviors such as debouncing or deferring event execution.\n *\n * @example\n * Registering the event plugins in an Angular module:\n * ```ts\n * @NgModule({\n * imports: [\n * BrowserModule,\n * BrowserAnimationsModule,\n * // other imports...\n * ],\n * declarations: [AppComponent],\n * providers: [\n * provideEventPlugins(),\n * ],\n * bootstrap: [AppComponent],\n * })\n * export class AppModule {}\n * ```\n * Assuming `DebounceEventPlugin` modifies event names with a `.debounce` modifier:\n * ```html\n * <button (click.debounce)=\"handleDebouncedClick($event)\">Click Me</button>\n * ```\n * Assuming `DeferEventPlugin` modifies event names with a `.defer` modifier:\n * ```html\n * <div (mouseenter.defer)=\"handleDeferredMouseEnter($event)\"></div>\n * ```\n *\n * @returns {EnvironmentProviders} - A configuration object for Angular's DI system, to be used with `makeEnvironmentProviders`.\n */\nexport function provideEventPlugins(): EnvironmentProviders {\n return makeEnvironmentProviders(EVENT_PLUGINS);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAYA;;;;;;;;;;;;;;;;;;;;;AAqBG;MACmB,WAAW,CAAA;AAoB/B;;;;AAIG;IACI,sBAAsB,GAAA;AAC3B,QAAA,OAAO,MAAM,KAAK,CAAC,CAAC;KACrB;AAED;;;;;AAKG;AACI,IAAA,QAAQ,CAAC,SAAiB,EAAA;QAC/B,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,C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,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;mHAAhB,gBAAgB,EAAA,CAAA,CAAA,EAAA;;4FAAhB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAD5B,UAAU;;;ACzBX,MAAM,OAAO,GAAG,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;AAEjD,MAAM,aAAa,GAAe,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,MAAM;AAClE,IAAA,OAAO,EAAE,qBAAqB;IAC9B,QAAQ;AACR,IAAA,KAAK,EAAE,IAAI;AACZ,CAAA,CAAC,EAAE;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCG;SACa,mBAAmB,GAAA;AACjC,IAAA,OAAO,wBAAwB,CAAC,aAAa,CAAC,CAAC;AACjD;;ACjDA;;AAEG;;;;"}
1
+ {"version":3,"file":"odx-angular-cdk-event-plugins.mjs","sources":["../../../../libs/angular/cdk/event-plugins/src/lib/models/event-plugin.ts","../../../../libs/angular/cdk/event-plugins/src/lib/plugins/debounce-event-plugin.ts","../../../../libs/angular/cdk/event-plugins/src/lib/plugins/defer-event-plugin.ts","../../../../libs/angular/cdk/event-plugins/src/lib/event-plugins.config.ts","../../../../libs/angular/cdk/event-plugins/src/odx-angular-cdk-event-plugins.ts"],"sourcesContent":["/* istanbul ignore file */\n/* eslint-disable @typescript-eslint/no-unsafe-function-type */\nimport { NgZone } from '@angular/core';\nimport { EventManager } from '@angular/platform-browser';\nimport { isFunction } from '@odx/angular/utils';\n\ntype EventManagerArg = ConstructorParameters<typeof EventManager>[0][0];\n\ntype EventManagerPlugin = {\n [K in keyof EventManagerArg]: EventManagerArg[K];\n};\n\n/**\n * An abstract class for implementing custom event plugins in Angular. This class provides\n * the core functionality required to create a custom event listener with specific behavior,\n * allowing developers to extend Angular's native event handling capabilities.\n *\n * @example\n * Extending EventPlugin to create a custom event plugin:\n * ```ts\n * @Injectable()\n * class CustomEventPlugin extends EventPlugin {\n * public readonly modifier = /custom/;\n *\n * public addEventListener(element: HTMLElement, eventName: string, handler: EventListener): Function {\n * // Custom logic for adding an event listener\n * }\n * }\n * ```\n *\n * ```html\n * <div (click.custom)=\"handleClick($event)\"></div>\n * ```\n */\nexport abstract class EventPlugin implements EventManagerPlugin {\n protected abstract readonly modifier: RegExp;\n\n /**\n * The event manager for handling events.\n *\n * @type {EventManager}\n */\n public manager!: EventManager;\n\n /**\n * Adds an event listener to the given element.\n *\n * @param {HTMLElement} element - The element to attach the event listener to.\n * @param {string} eventName - The name of the event.\n * @param {EventListener} handler - The event listener function.\n * @returns {Function} - A function that can be called to remove the event listener.\n */\n public abstract addEventListener(element: HTMLElement, eventName: string, handler: EventListener): Function;\n\n /**\n * Adds a global event listener.\n *\n * @returns {Function} - A function that does nothing.\n */\n public addGlobalEventListener(): Function {\n return () => void 0;\n }\n\n /**\n * Checks if the event plugin supports the given event name.\n *\n * @param {string} eventName - The name of the event.\n * @returns {boolean} - `true` if the event plugin supports the event, `false` otherwise.\n */\n public supports(eventName: string): boolean {\n return this.modifier.test(eventName);\n }\n\n /**\n * Gets the NgZone instance from the event manager.\n *\n * @returns {NgZone} - The NgZone instance.\n */\n protected getZone(): NgZone {\n return this.manager.getZone();\n }\n\n /**\n * Tears down the event listener.\n *\n * @param {Function | null} listener - The event listener function.\n * @returns {Function} - A function that can be called to clean up the listener.\n */\n protected teardown(listener: Function | null): () => void {\n return () => (isFunction(listener) ? listener() : void 0);\n }\n}\n","/* istanbul ignore file */\n/* eslint-disable @typescript-eslint/no-unsafe-function-type */\nimport { Injectable, numberAttribute } from '@angular/core';\nimport { debounce } from '@odx/angular/utils';\nimport { EventPlugin } from '../models';\n\nconst DEFAULT_DELAY = 250;\n\n/**\n * A service that extends `EventPlugin` for debouncing events. This service wraps event listeners\n * and ensures that they are triggered no more than once per specified delay period. It is\n * particularly useful for handling events that fire frequently, such as mouse movements\n * or keystrokes, in a performant manner.\n *\n * The delay period can be specified directly in the event name using the syntax\n * `(eventName.debounce.delay)`, where `delay` is the debounce duration in milliseconds.\n * If no delay is specified, a default delay of 250 milliseconds is used.\n *\n * @example\n * Provide the `DebounceEventPlugin` in an Angular module:\n * ```ts\n * @NgModule({\n * providers: [\n * ...\n * provideEventPlugins(),\n * ...\n * ],\n * })\n * export class AppModule {}\n * ```\n *\n * In a component template, apply the debounce modifier to an event, specifying a custom delay:\n * ```html\n * <button (click.debounce.400)=\"handleClick($event)\"></button>\n * ```\n * In a component template, apply the debounce modifier with the default delay:\n * ```html\n * <input (keyup.debounce)=\"onKeyUp($event)\" placeholder=\"Type here...\">\n * ```\n */\n@Injectable()\nexport class DebounceEventPlugin extends EventPlugin {\n public readonly modifier = /debounce/;\n\n public addEventListener(element: HTMLElement, eventName: string, originalHandler: EventListener): Function {\n const [name, , delay] = eventName.split('.');\n const handler = this.createHandler(originalHandler, numberAttribute(delay, DEFAULT_DELAY));\n\n return this.runOutsideAngular(() => this.manager.addEventListener(element, name, handler));\n }\n\n private createHandler(originalHandler: EventListener, delay: number): (event: Event) => void {\n const innerHandler = (event: Event): void => this.getZone().runGuarded(() => originalHandler(event));\n\n return debounce(innerHandler, delay);\n }\n\n private runOutsideAngular(addListener: () => Function): () => void {\n let listener: Function | null = null;\n this.getZone().runOutsideAngular(() => {\n listener = addListener();\n });\n\n return this.teardown(listener);\n }\n}\n","/* istanbul ignore file */\n/* eslint-disable @typescript-eslint/no-unsafe-function-type */\nimport { Injectable } from '@angular/core';\nimport { EventPlugin } from '../models';\n\n/**\n * A service that extends `EventPlugin` to allow event handlers to be deferred until the end of the current call stack.\n * This can improve performance by avoiding triggering Angular's change detection unnecessarily.\n *\n * @example\n * Provide the `DeferEventPlugin` in an Angular module:\n * ```ts\n * @NgModule({\n * providers: [\n * ...\n * provideEventPlugins(),\n * ...\n * ],\n * })\n * export class AppModule {}\n * ```\n *\n * In your Angular component:\n * ```html\n * <button (click.defer)=\"handleClick($event)\"></button>\n * ```\n *\n * The `.defer` modifier in the event name `click.defer` indicates that the event handler should be deferred.\n */\n@Injectable()\nexport class DeferEventPlugin extends EventPlugin {\n public readonly modifier = /defer/;\n\n public addEventListener(element: HTMLElement, eventName: string, originalHandler: EventListener): Function {\n const [name] = eventName.split('.');\n const handler = this.createHandler(originalHandler);\n\n return this.getZone().runOutsideAngular(() => this.manager.addEventListener(element, name, handler));\n }\n\n private createHandler(originalHandler: EventListener): (event: Event) => void {\n return (event: Event): void => {\n setTimeout(() => this.getZone().runGuarded(() => originalHandler(event)), 0);\n };\n }\n}\n","import { EnvironmentProviders, Provider, makeEnvironmentProviders } from '@angular/core';\nimport { EVENT_MANAGER_PLUGINS } from '@angular/platform-browser';\nimport { DebounceEventPlugin, DeferEventPlugin } from './plugins';\n\nconst PLUGINS = [DebounceEventPlugin, DeferEventPlugin];\n\nexport const EVENT_PLUGINS: Provider[] = PLUGINS.map((useClass) => ({\n provide: EVENT_MANAGER_PLUGINS,\n useClass,\n multi: true,\n}));\n\n/**\n * Provides a set of custom event plugins to Angular's event handling system. This function\n * registers custom event plugins like `DebounceEventPlugin` and `DeferEventPlugin`, enhancing\n * the capabilities of Angular's native event management. By using `EVENT_MANAGER_PLUGINS`, these\n * plugins are integrated into Angular's event system and can be utilized in templates and components\n * to handle events with custom behaviors such as debouncing or deferring event execution.\n *\n * @example\n * Registering the event plugins in an Angular module:\n * ```ts\n * @NgModule({\n * imports: [\n * BrowserModule,\n * BrowserAnimationsModule,\n * // other imports...\n * ],\n * declarations: [AppComponent],\n * providers: [\n * provideEventPlugins(),\n * ],\n * bootstrap: [AppComponent],\n * })\n * export class AppModule {}\n * ```\n * Assuming `DebounceEventPlugin` modifies event names with a `.debounce` modifier:\n * ```html\n * <button (click.debounce)=\"handleDebouncedClick($event)\">Click Me</button>\n * ```\n * Assuming `DeferEventPlugin` modifies event names with a `.defer` modifier:\n * ```html\n * <div (mouseenter.defer)=\"handleDeferredMouseEnter($event)\"></div>\n * ```\n *\n * @returns {EnvironmentProviders} - A configuration object for Angular's DI system, to be used with `makeEnvironmentProviders`.\n */\nexport function provideEventPlugins(): EnvironmentProviders {\n return makeEnvironmentProviders(EVENT_PLUGINS);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAYA;;;;;;;;;;;;;;;;;;;;;AAqBG;MACmB,WAAW,CAAA;AAoB/B;;;;AAIG;IACI,sBAAsB,GAAA;AAC3B,QAAA,OAAO,MAAM,KAAK,CAAC;IACrB;AAEA;;;;;AAKG;AACI,IAAA,QAAQ,CAAC,SAAiB,EAAA;QAC/B,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC;IACtC;AAEA;;;;AAIG;IACO,OAAO,GAAA;AACf,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;IAC/B;AAEA;;;;;AAKG;AACO,IAAA,QAAQ,CAAC,QAAyB,EAAA;AAC1C,QAAA,OAAO,OAAO,UAAU,CAAC,QAAQ,CAAC,GAAG,QAAQ,EAAE,GAAG,KAAK,CAAC,CAAC;IAC3D;AACD;;AC3FD;AACA;AAKA,MAAM,aAAa,GAAG,GAAG;AAEzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BG;AAEG,MAAO,mBAAoB,SAAQ,WAAW,CAAA;AADpD,IAAA,WAAA,GAAA;;QAEkB,IAAA,CAAA,QAAQ,GAAG,UAAU;AAuBtC,IAAA;AArBQ,IAAA,gBAAgB,CAAC,OAAoB,EAAE,SAAiB,EAAE,eAA8B,EAAA;AAC7F,QAAA,MAAM,CAAC,IAAI,IAAI,KAAK,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC;AAC5C,QAAA,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,eAAe,EAAE,eAAe,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;QAE1F,OAAO,IAAI,CAAC,iBAAiB,CAAC,MAAM,IAAI,CAAC,OAAO,C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AI,EAAE,OAAO,CAAC,CAAC;IACtG;AAEQ,IAAA,aAAa,CAAC,eAA8B,EAAA;QAClD,OAAO,CAAC,KAAY,KAAU;YAC5B,UAAU,CAAC,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC,MAAM,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;AAC9E,QAAA,CAAC;IACH;+GAdW,gBAAgB,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;mHAAhB,gBAAgB,EAAA,CAAA,CAAA;;4FAAhB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAD5B;;;ACzBD,MAAM,OAAO,GAAG,CAAC,mBAAmB,EAAE,gBAAgB,CAAC;AAEhD,MAAM,aAAa,GAAe,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,MAAM;AAClE,IAAA,OAAO,EAAE,qBAAqB;IAC9B,QAAQ;AACR,IAAA,KAAK,EAAE,IAAI;AACZ,CAAA,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCG;SACa,mBAAmB,GAAA;AACjC,IAAA,OAAO,wBAAwB,CAAC,aAAa,CAAC;AAChD;;ACjDA;;AAEG;;;;"}
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, booleanAttribute, Directive, Input, ChangeDetectorRef, NgModule } from '@angular/core';
2
+ import { InjectionToken, inject, booleanAttribute, Input, Directive, ChangeDetectorRef, NgModule } from '@angular/core';
3
3
  import { getUniqueId } from '@odx/angular/utils';
4
4
 
5
5
  const ODX_EXPANDABLE_CONTAINER = new InjectionToken('@odx/angular/cdk/expandable::ExpandableContainer');
@@ -1 +1 @@
1
- {"version":3,"file":"odx-angular-cdk-expandable.mjs","sources":["../../../../libs/angular/cdk/expandable/src/lib/expandable.tokens.ts","../../../../libs/angular/cdk/expandable/src/lib/directives/expandable-container.directive.ts","../../../../libs/angular/cdk/expandable/src/lib/directives/expandable-item.directive.ts","../../../../libs/angular/cdk/expandable/src/lib/expandable.module.ts","../../../../libs/angular/cdk/expandable/src/odx-angular-cdk-expandable.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { ExpandableContainer, ExpandableItem } from './facade';\n\nexport const ODX_EXPANDABLE_CONTAINER = new InjectionToken<ExpandableContainer>('@odx/angular/cdk/expandable::ExpandableContainer');\nexport const ODX_EXPANDABLE_ITEM = new InjectionToken<ExpandableItem>('@odx/angular/cdk/expandable::ExpandableItem');\n","import { booleanAttribute, Directive, inject, Input, OnDestroy, OnInit } from '@angular/core';\nimport { ODX_EXPANDABLE_CONTAINER, ODX_EXPANDABLE_ITEM } from '../expandable.tokens';\nimport type { ExpandableContainer, ExpandableItem } from '../facade';\n\n/**\n * `ExpandableContainerDirective` provides a container for managing a group of expandable items,\n * allowing them to expand or collapse. It supports the functionality to either allow multiple\n * items to be expanded simultaneously or restrict to a single item at a time.\n *\n * This directive uses Angular's dependency injection to optionally inject a parent `ExpandableItem` or `ExpandableContainer`,\n * enabling nested expandable structures. The `multiple` property can be set to dictate the expand/collapse behavior.\n */\n@Directive({\n standalone: true,\n selector: '[odxExpandableContainer]',\n exportAs: 'odxExpandableContainer',\n providers: [{ provide: ODX_EXPANDABLE_CONTAINER, useExisting: ExpandableContainerDirective }],\n})\nexport class ExpandableContainerDirective implements ExpandableContainer, OnInit, OnDestroy {\n private readonly expandedItems = new Set<ExpandableItem>();\n private readonly parentItem = inject(ODX_EXPANDABLE_ITEM, { optional: true, skipSelf: true });\n private readonly parentContainer = inject(ODX_EXPANDABLE_CONTAINER, { optional: true, skipSelf: true });\n\n /**\n * Determines whether multiple items can be expanded within the container.\n *\n * @type {boolean}\n * @default false\n */\n @Input({ transform: booleanAttribute })\n public multiple = this.parentContainer?.multiple ?? false;\n\n public ngOnInit(): void {\n this.parentItem?.addChild(this);\n }\n\n public ngOnDestroy(): void {\n this.parentItem?.removeChild(this);\n }\n\n /**\n * Collapses all the expanded items within the expandable container.\n */\n public collapseAll(): void {\n this.expandedItems.forEach((item) => item.collapse());\n }\n\n /**\n * Collapses the specified item.\n *\n * @param {ExpandableItem} item - The item to collapse.\n */\n public collapse(item: ExpandableItem): void {\n this.expandedItems.delete(item);\n }\n\n /**\n * Expands the specified item.\n * If `multiple` is set to `false`, it collapses all other items before expanding the specified item.\n * @param {ExpandableItem} item - The item to expand.\n */\n public expand(item: ExpandableItem): void {\n if (!this.multiple) {\n this.collapseAll();\n }\n this.expandedItems.add(item);\n }\n\n /**\n * Toggles the expansion state of the specified item.\n * If `forceState` is provided, it will set the expansion state to the specified value.\n * If `forceState` is not provided, it will toggle the expansion state of the item.\n *\n * @param {ExpandableItem} item - The item to toggle the expansion state for.\n * @param {boolean} forceState - Optional. The desired expansion state to set for the item.\n */\n public toggle(item: ExpandableItem, forceState?: boolean): void {\n const shouldExpand = forceState ?? !this.isExpanded(item);\n if (shouldExpand) {\n this.expand(item);\n } else {\n this.collapse(item);\n }\n }\n\n /**\n * Checks if the specified item is expanded.\n * @param {ExpandableItem} item - The item to check.\n * @returns `true` if the item is expanded, `false` otherwise.\n */\n public isExpanded(item: ExpandableItem): boolean {\n return this.expandedItems.has(item);\n }\n\n /**\n * Checks if there is any expanded item.\n *\n * @returns {boolean} True if there is at least one expanded item, false otherwise.\n */\n public hasExpandedItem(): boolean {\n return this.expandedItems.size > 0;\n }\n}\n","import { booleanAttribute, ChangeDetectorRef, Directive, inject, Input } from '@angular/core';\nimport { getUniqueId } from '@odx/angular/utils';\nimport { ODX_EXPANDABLE_CONTAINER, ODX_EXPANDABLE_ITEM } from '../expandable.tokens';\nimport type { ExpandableContainer, ExpandableItem } from '../facade';\n\n/**\n * `ExpandableItemDirective` allows you to manage the expansion state of an item within an expandable container, such as an accordion or a nested list. It provides methods to expand, collapse, and toggle the item, and automatically registers itself with a parent expandable container if one is available.\n *\n * You can control the expanded state programmatically by binding to the `expanded` property.\n */\n@Directive({\n standalone: true,\n selector: '[odxExpandableItem]',\n exportAs: 'odxExpandableItem',\n providers: [{ provide: ODX_EXPANDABLE_ITEM, useExisting: ExpandableItemDirective }],\n})\nexport class ExpandableItemDirective implements ExpandableItem {\n private readonly changeDetectorRef = inject(ChangeDetectorRef);\n private readonly childContainers = new Set<ExpandableContainer>();\n private _expanded = false;\n\n /**\n * Container which can be set manually.\n */\n @Input()\n public container: ExpandableContainer | null = inject(ODX_EXPANDABLE_CONTAINER, { optional: true, skipSelf: true });\n\n /** Unique identifier for the expandable item.\n *\n * @type {string}\n */\n @Input()\n public id = getUniqueId('odx-expandable-item');\n\n /**\n * Controls the expanded state of the item.\n *\n * @param {boolean} value - When `true`, expands the item; when `false`, collapses the item.\n *\n * @example\n * Bind to the expanded state:\n * ```html\n * <div odxExpandableItem [expanded]=\"isItemExpanded\"></div>\n * ```\n */\n @Input({ transform: booleanAttribute })\n public set expanded(value: boolean) {\n if (this._expanded === value) return;\n this._expanded = value;\n if (this._expanded) {\n this.container?.expand(this);\n } else {\n this.closeAllChildren();\n this.container?.collapse(this);\n }\n this.changeDetectorRef.markForCheck();\n }\n\n /**\n * Gets a value indicating whether the item is expanded.\n * If the item is contained within a container, it checks the container's `isExpanded` method.\n * Otherwise, it returns the value of the `_expanded` property.\n *\n * @type {boolean} `true` if the item is expanded; otherwise, `false`.\n */\n public get expanded(): boolean {\n return this.container?.isExpanded(this) ?? this._expanded;\n }\n\n /**\n * Toggles the expansion state of the item, optionally forcing a specific state.\n *\n * @param {boolean} forceState - When provided, forces the expansion state to the specified value.\n */\n public toggle(forceState?: boolean): void {\n this.expanded = forceState ?? !this.expanded;\n }\n\n /** Expands the item.\n *\n * @returns {void}\n */\n public expand(): void {\n this.toggle(true);\n }\n\n /** Collapses the item.\n *\n * @returns {void}\n */\n public collapse(): void {\n this.toggle(false);\n }\n\n /** Adds a child container to the item.\n *\n * @param {ExpandableContainer} container - The child container to add.\n * @returns {void}\n */\n public addChild(container: ExpandableContainer): void {\n this.childContainers.add(container);\n }\n\n /** Removes a child container from the item.\n *\n * @param {ExpandableContainer} container - The child container to remove.\n * @returns {void}\n */\n public removeChild(container: ExpandableContainer): void {\n this.childContainers.delete(container);\n }\n\n private closeAllChildren(): void {\n this.childContainers.forEach((container) => container.collapseAll());\n }\n}\n","import { NgModule } from '@angular/core';\nimport { ExpandableContainerDirective, ExpandableItemDirective } from './directives';\n\nconst modules = [ExpandableContainerDirective, ExpandableItemDirective];\n\n@NgModule({\n imports: modules,\n exports: modules,\n})\nexport class ExpandableModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAGa,wBAAwB,GAAG,IAAI,cAAc,CAAsB,kDAAkD,EAAE;MACvH,mBAAmB,GAAG,IAAI,cAAc,CAAiB,6CAA6C;;ACAnH;;;;;;;AAOG;MAOU,4BAA4B,CAAA;AANzC,IAAA,WAAA,GAAA;AAOmB,QAAA,IAAA,CAAA,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAC;AAC1C,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,mBAAmB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AAC7E,QAAA,IAAA,CAAA,eAAe,GAAG,MAAM,CAAC,wBAAwB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AAExG;;;;;AAKG;QAEI,IAAQ,CAAA,QAAA,GAAG,IAAI,CAAC,eAAe,EAAE,QAAQ,IAAI,KAAK,CAAC;AAwE3D,KAAA;IAtEQ,QAAQ,GAAA;AACb,QAAA,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;KACjC;IAEM,WAAW,GAAA;AAChB,QAAA,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;KACpC;AAED;;AAEG;IACI,WAAW,GAAA;AACh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AA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;AAAhB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,YANZ,4BAA4B,EAAE,uBAAuB,CAArD,EAAA,OAAA,EAAA,CAAA,4BAA4B,EAAE,uBAAuB,CAAA,EAAA,CAAA,CAAA,EAAA;gHAMzD,gBAAgB,EAAA,CAAA,CAAA,EAAA;;4FAAhB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAJ5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,OAAO;AAChB,oBAAA,OAAO,EAAE,OAAO;AACjB,iBAAA,CAAA;;;ACRD;;AAEG;;;;"}
1
+ {"version":3,"file":"odx-angular-cdk-expandable.mjs","sources":["../../../../libs/angular/cdk/expandable/src/lib/expandable.tokens.ts","../../../../libs/angular/cdk/expandable/src/lib/directives/expandable-container.directive.ts","../../../../libs/angular/cdk/expandable/src/lib/directives/expandable-item.directive.ts","../../../../libs/angular/cdk/expandable/src/lib/expandable.module.ts","../../../../libs/angular/cdk/expandable/src/odx-angular-cdk-expandable.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { ExpandableContainer, ExpandableItem } from './facade';\n\nexport const ODX_EXPANDABLE_CONTAINER = new InjectionToken<ExpandableContainer>('@odx/angular/cdk/expandable::ExpandableContainer');\nexport const ODX_EXPANDABLE_ITEM = new InjectionToken<ExpandableItem>('@odx/angular/cdk/expandable::ExpandableItem');\n","import { booleanAttribute, Directive, inject, Input, OnDestroy, OnInit } from '@angular/core';\nimport { ODX_EXPANDABLE_CONTAINER, ODX_EXPANDABLE_ITEM } from '../expandable.tokens';\nimport type { ExpandableContainer, ExpandableItem } from '../facade';\n\n/**\n * `ExpandableContainerDirective` provides a container for managing a group of expandable items,\n * allowing them to expand or collapse. It supports the functionality to either allow multiple\n * items to be expanded simultaneously or restrict to a single item at a time.\n *\n * This directive uses Angular's dependency injection to optionally inject a parent `ExpandableItem` or `ExpandableContainer`,\n * enabling nested expandable structures. The `multiple` property can be set to dictate the expand/collapse behavior.\n */\n@Directive({\n standalone: true,\n selector: '[odxExpandableContainer]',\n exportAs: 'odxExpandableContainer',\n providers: [{ provide: ODX_EXPANDABLE_CONTAINER, useExisting: ExpandableContainerDirective }],\n})\nexport class ExpandableContainerDirective implements ExpandableContainer, OnInit, OnDestroy {\n private readonly expandedItems = new Set<ExpandableItem>();\n private readonly parentItem = inject(ODX_EXPANDABLE_ITEM, { optional: true, skipSelf: true });\n private readonly parentContainer = inject(ODX_EXPANDABLE_CONTAINER, { optional: true, skipSelf: true });\n\n /**\n * Determines whether multiple items can be expanded within the container.\n *\n * @type {boolean}\n * @default false\n */\n @Input({ transform: booleanAttribute })\n public multiple = this.parentContainer?.multiple ?? false;\n\n public ngOnInit(): void {\n this.parentItem?.addChild(this);\n }\n\n public ngOnDestroy(): void {\n this.parentItem?.removeChild(this);\n }\n\n /**\n * Collapses all the expanded items within the expandable container.\n */\n public collapseAll(): void {\n this.expandedItems.forEach((item) => item.collapse());\n }\n\n /**\n * Collapses the specified item.\n *\n * @param {ExpandableItem} item - The item to collapse.\n */\n public collapse(item: ExpandableItem): void {\n this.expandedItems.delete(item);\n }\n\n /**\n * Expands the specified item.\n * If `multiple` is set to `false`, it collapses all other items before expanding the specified item.\n * @param {ExpandableItem} item - The item to expand.\n */\n public expand(item: ExpandableItem): void {\n if (!this.multiple) {\n this.collapseAll();\n }\n this.expandedItems.add(item);\n }\n\n /**\n * Toggles the expansion state of the specified item.\n * If `forceState` is provided, it will set the expansion state to the specified value.\n * If `forceState` is not provided, it will toggle the expansion state of the item.\n *\n * @param {ExpandableItem} item - The item to toggle the expansion state for.\n * @param {boolean} forceState - Optional. The desired expansion state to set for the item.\n */\n public toggle(item: ExpandableItem, forceState?: boolean): void {\n const shouldExpand = forceState ?? !this.isExpanded(item);\n if (shouldExpand) {\n this.expand(item);\n } else {\n this.collapse(item);\n }\n }\n\n /**\n * Checks if the specified item is expanded.\n * @param {ExpandableItem} item - The item to check.\n * @returns `true` if the item is expanded, `false` otherwise.\n */\n public isExpanded(item: ExpandableItem): boolean {\n return this.expandedItems.has(item);\n }\n\n /**\n * Checks if there is any expanded item.\n *\n * @returns {boolean} True if there is at least one expanded item, false otherwise.\n */\n public hasExpandedItem(): boolean {\n return this.expandedItems.size > 0;\n }\n}\n","import { booleanAttribute, ChangeDetectorRef, Directive, inject, Input } from '@angular/core';\nimport { getUniqueId } from '@odx/angular/utils';\nimport { ODX_EXPANDABLE_CONTAINER, ODX_EXPANDABLE_ITEM } from '../expandable.tokens';\nimport type { ExpandableContainer, ExpandableItem } from '../facade';\n\n/**\n * `ExpandableItemDirective` allows you to manage the expansion state of an item within an expandable container, such as an accordion or a nested list. It provides methods to expand, collapse, and toggle the item, and automatically registers itself with a parent expandable container if one is available.\n *\n * You can control the expanded state programmatically by binding to the `expanded` property.\n */\n@Directive({\n standalone: true,\n selector: '[odxExpandableItem]',\n exportAs: 'odxExpandableItem',\n providers: [{ provide: ODX_EXPANDABLE_ITEM, useExisting: ExpandableItemDirective }],\n})\nexport class ExpandableItemDirective implements ExpandableItem {\n private readonly changeDetectorRef = inject(ChangeDetectorRef);\n private readonly childContainers = new Set<ExpandableContainer>();\n private _expanded = false;\n\n /**\n * Container which can be set manually.\n */\n @Input()\n public container: ExpandableContainer | null = inject(ODX_EXPANDABLE_CONTAINER, { optional: true, skipSelf: true });\n\n /** Unique identifier for the expandable item.\n *\n * @type {string}\n */\n @Input()\n public id = getUniqueId('odx-expandable-item');\n\n /**\n * Controls the expanded state of the item.\n *\n * @param {boolean} value - When `true`, expands the item; when `false`, collapses the item.\n *\n * @example\n * Bind to the expanded state:\n * ```html\n * <div odxExpandableItem [expanded]=\"isItemExpanded\"></div>\n * ```\n */\n @Input({ transform: booleanAttribute })\n public set expanded(value: boolean) {\n if (this._expanded === value) return;\n this._expanded = value;\n if (this._expanded) {\n this.container?.expand(this);\n } else {\n this.closeAllChildren();\n this.container?.collapse(this);\n }\n this.changeDetectorRef.markForCheck();\n }\n\n /**\n * Gets a value indicating whether the item is expanded.\n * If the item is contained within a container, it checks the container's `isExpanded` method.\n * Otherwise, it returns the value of the `_expanded` property.\n *\n * @type {boolean} `true` if the item is expanded; otherwise, `false`.\n */\n public get expanded(): boolean {\n return this.container?.isExpanded(this) ?? this._expanded;\n }\n\n /**\n * Toggles the expansion state of the item, optionally forcing a specific state.\n *\n * @param {boolean} forceState - When provided, forces the expansion state to the specified value.\n */\n public toggle(forceState?: boolean): void {\n this.expanded = forceState ?? !this.expanded;\n }\n\n /** Expands the item.\n *\n * @returns {void}\n */\n public expand(): void {\n this.toggle(true);\n }\n\n /** Collapses the item.\n *\n * @returns {void}\n */\n public collapse(): void {\n this.toggle(false);\n }\n\n /** Adds a child container to the item.\n *\n * @param {ExpandableContainer} container - The child container to add.\n * @returns {void}\n */\n public addChild(container: ExpandableContainer): void {\n this.childContainers.add(container);\n }\n\n /** Removes a child container from the item.\n *\n * @param {ExpandableContainer} container - The child container to remove.\n * @returns {void}\n */\n public removeChild(container: ExpandableContainer): void {\n this.childContainers.delete(container);\n }\n\n private closeAllChildren(): void {\n this.childContainers.forEach((container) => container.collapseAll());\n }\n}\n","import { NgModule } from '@angular/core';\nimport { ExpandableContainerDirective, ExpandableItemDirective } from './directives';\n\nconst modules = [ExpandableContainerDirective, ExpandableItemDirective];\n\n@NgModule({\n imports: modules,\n exports: modules,\n})\nexport class ExpandableModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAGa,wBAAwB,GAAG,IAAI,cAAc,CAAsB,kDAAkD;MACrH,mBAAmB,GAAG,IAAI,cAAc,CAAiB,6CAA6C;;ACAnH;;;;;;;AAOG;MAOU,4B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,QAAQ,EAAE,qBAAqB;AAC/B,oBAAA,QAAQ,EAAE,mBAAmB;oBAC7B,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAA,uBAAyB,EAAE,CAAC;AACpF,iBAAA;8BAUQ,SAAS,EAAA,CAAA;sBADf;gBAQM,EAAE,EAAA,CAAA;sBADR;gBAeU,QAAQ,EAAA,CAAA;sBADlB,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;;;AC1CxC,MAAM,OAAO,GAAG,CAAC,4BAA4B,EAAE,uBAAuB,CAAC;MAM1D,gBAAgB,CAAA;+GAAhB,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAhB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,YANZ,4BAA4B,EAAE,uBAAuB,CAAA,EAAA,OAAA,EAAA,CAArD,4BAA4B,EAAE,uBAAuB,CAAA,EAAA,CAAA,CAAA;gHAMzD,gBAAgB,EAAA,CAAA,CAAA;;4FAAhB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAJ5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,OAAO;AAChB,oBAAA,OAAO,EAAE,OAAO;AACjB,iBAAA;;;ACRD;;AAEG;;;;"}
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, ChangeDetectorRef, Directive, Input, HostListener } from '@angular/core';
2
+ import { inject, ChangeDetectorRef, HostListener, Input, Directive } from '@angular/core';
3
3
  import { untilDestroyed, injectElement, deferFn } from '@odx/angular/utils';
4
4
 
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"odx-angular-cdk-option-control.mjs","sources":["../../../../libs/angular/cdk/option-control/src/lib/option-control.ts","../../../../libs/angular/cdk/option-control/src/odx-angular-cdk-option-control.ts"],"sourcesContent":["import { Highlightable } from '@angular/cdk/a11y';\nimport { ChangeDetectorRef, Directive, ElementRef, HostListener, inject, Input } from '@angular/core';\nimport { deferFn, injectElement, untilDestroyed } from '@odx/angular/utils';\n\n/**\n * `OptionControl` is an abstract directive that serves as a base class for implementing selectable options in a dropdown\n * list or a similar component. It integrates with CDK's `Highlightable` interface to provide keyboard navigation support.\n *\n * @param {T} - The type of the value.\n *\n * This base class handles the visual feedback for active and selected states and provides a structure for defining\n * how an option is selected.\n *\n * Extend `OptionControl` to create a concrete option component:\n * @example\n * ```ts\n * @Component({\n * selector: 'my-option',\n * templateUrl: './my-option.component.html',\n * providers: [{ provide: OptionControl, useExisting: forwardRef(() => MyOptionComponent) }],\n * })\n * class MyOptionComponent extends OptionControl<MyDataType> {\n * @Input() override value: MyDataType | null = null;\n *\n * protected override selectOption(): void {\n * // Custom logic for when this option is selected\n * }\n * }\n * ```\n *\n * Implement `selectOption` in subclasses to define what happens when an option is selected, such as updating a model\n * or closing a dropdown.\n */\n@Directive({\n standalone: true,\n host: {\n role: 'option',\n '[class.odx-option]': 'true',\n '[class.is-active]': 'isActive',\n '[attr.aria-selected]': 'isSelected',\n '[class.is-selected]': 'isSelected',\n },\n})\nexport abstract class OptionControl<T> implements Highlightable {\n protected readonly takeUntilDestroyed = untilDestroyed();\n protected readonly cdr = inject(ChangeDetectorRef);\n\n protected isActive = false;\n\n /**\n * Represents the value of the option control.\n *\n * @type {T} - The type of the value.\n */\n @Input()\n public value: T | null = null;\n\n public readonly element: ElementRef<HTMLElement> = injectElement();\n\n /**\n * Sets the active styles for the option control.\n *\n * @returns {void}\n */\n public abstract setActiveStyles(): void;\n\n /**\n * Sets the inactive styles for the option control.\n *\n * @returns {void}\n */\n public setInactiveStyles(): void {\n deferFn(() => {\n this.isActive = false;\n this.cdr.markForCheck();\n });\n }\n\n /**\n * Retrieves the label of the option control.\n *\n * @returns {string} - The label of the option control.\n */\n public getLabel(): string {\n return this.element.nativeElement.textContent?.trim() ?? '';\n }\n\n protected abstract selectOption(): void;\n\n @HostListener('click', ['$event'])\n protected select(event: Event): void {\n event.stopPropagation();\n event.preventDefault();\n\n this.selectOption();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;MAWmB,aAAa,CAAA;AAVnC,IAAA,WAAA,GAAA;QAWqB,IAAkB,CAAA,kBAAA,GAAG,cAAc,EAAE,CAAC;AACtC,QAAA,IAAA,CAAA,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAEzC,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;AAE3B;;;;AAIG;QAEI,IAAK,CAAA,KAAA,GAAa,IAAI,CAAC;QAEd,IAAO,CAAA,OAAA,GAA4B,aAAa,EAAE,CAAC;AAuCpE,KAAA;AA9BC;;;;AAIG;IACI,iBAAiB,GAAA;QACtB,OAAO,CAAC,MAAK;AACX,YAAA,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;AACtB,YAAA,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;AAC1B,SAAC,CAAC,CAAC;KACJ;AAED;;;;AAIG;IACI,QAAQ,GAAA;AACb,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;KAC7D;AAKS,IAAA,MAAM,CAAC,KAAY,EAAA;QAC3B,KAAK,CAAC,eAAe,EAAE,CAAC;QACxB,KAAK,CAAC,cAAc,EAAE,CAAC;QAEvB,IAAI,CAAC,YAAY,EAAE,CAAC;KACrB;+GApDmB,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;mGAAb,aAAa,EAAA,YAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,KAAA,EAAA,OAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,MAAA,EAAA,QAAA,EAAA,EAAA,SAAA,EAAA,EAAA,OAAA,EAAA,gBAAA,EAAA,EAAA,UAAA,EAAA,EAAA,kBAAA,EAAA,MAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,oBAAA,EAAA,YAAA,EAAA,mBAAA,EAAA,YAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;4FAAb,aAAa,EAAA,UAAA,EAAA,CAAA;kBAVlC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACJ,wBAAA,IAAI,EAAE,QAAQ;AACd,wBAAA,oBAAoB,EAAE,MAAM;AAC5B,wBAAA,mBAAmB,EAAE,UAAU;AAC/B,wBAAA,sBAAsB,EAAE,YAAY;AACpC,wBAAA,qBAAqB,EAAE,YAAY;AACpC,qBAAA;AACF,iBAAA,CAAA;8BAaQ,KAAK,EAAA,CAAA;sBADX,KAAK;gBAoCI,MAAM,EAAA,CAAA;sBADf,YAAY;uBAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,CAAA;;;ACzFnC;;AAEG;;;;"}
1
+ {"version":3,"file":"odx-angular-cdk-option-control.mjs","sources":["../../../../libs/angular/cdk/option-control/src/lib/option-control.ts","../../../../libs/angular/cdk/option-control/src/odx-angular-cdk-option-control.ts"],"sourcesContent":["import { Highlightable } from '@angular/cdk/a11y';\nimport { ChangeDetectorRef, Directive, ElementRef, HostListener, inject, Input } from '@angular/core';\nimport { deferFn, injectElement, untilDestroyed } from '@odx/angular/utils';\n\n/**\n * `OptionControl` is an abstract directive that serves as a base class for implementing selectable options in a dropdown\n * list or a similar component. It integrates with CDK's `Highlightable` interface to provide keyboard navigation support.\n *\n * @param {T} - The type of the value.\n *\n * This base class handles the visual feedback for active and selected states and provides a structure for defining\n * how an option is selected.\n *\n * Extend `OptionControl` to create a concrete option component:\n * @example\n * ```ts\n * @Component({\n * selector: 'my-option',\n * templateUrl: './my-option.component.html',\n * providers: [{ provide: OptionControl, useExisting: forwardRef(() => MyOptionComponent) }],\n * })\n * class MyOptionComponent extends OptionControl<MyDataType> {\n * @Input() override value: MyDataType | null = null;\n *\n * protected override selectOption(): void {\n * // Custom logic for when this option is selected\n * }\n * }\n * ```\n *\n * Implement `selectOption` in subclasses to define what happens when an option is selected, such as updating a model\n * or closing a dropdown.\n */\n@Directive({\n standalone: true,\n host: {\n role: 'option',\n '[class.odx-option]': 'true',\n '[class.is-active]': 'isActive',\n '[attr.aria-selected]': 'isSelected',\n '[class.is-selected]': 'isSelected',\n },\n})\nexport abstract class OptionControl<T> implements Highlightable {\n protected readonly takeUntilDestroyed = untilDestroyed();\n protected readonly cdr = inject(ChangeDetectorRef);\n\n protected isActive = false;\n\n /**\n * Represents the value of the option control.\n *\n * @type {T} - The type of the value.\n */\n @Input()\n public value: T | null = null;\n\n public readonly element: ElementRef<HTMLElement> = injectElement();\n\n /**\n * Sets the active styles for the option control.\n *\n * @returns {void}\n */\n public abstract setActiveStyles(): void;\n\n /**\n * Sets the inactive styles for the option control.\n *\n * @returns {void}\n */\n public setInactiveStyles(): void {\n deferFn(() => {\n this.isActive = false;\n this.cdr.markForCheck();\n });\n }\n\n /**\n * Retrieves the label of the option control.\n *\n * @returns {string} - The label of the option control.\n */\n public getLabel(): string {\n return this.element.nativeElement.textContent?.trim() ?? '';\n }\n\n protected abstract selectOption(): void;\n\n @HostListener('click', ['$event'])\n protected select(event: Event): void {\n event.stopPropagation();\n event.preventDefault();\n\n this.selectOption();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;M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aAAa,EAAA,UAAA,EAAA,CAAA;kBAVlC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACJ,wBAAA,IAAI,EAAE,QAAQ;AACd,wBAAA,oBAAoB,EAAE,MAAM;AAC5B,wBAAA,mBAAmB,EAAE,UAAU;AAC/B,wBAAA,sBAAsB,EAAE,YAAY;AACpC,wBAAA,qBAAqB,EAAE,YAAY;AACpC,qBAAA;AACF,iBAAA;8BAaQ,KAAK,EAAA,CAAA;sBADX;gBAoCS,MAAM,EAAA,CAAA;sBADf,YAAY;uBAAC,OAAO,EAAE,CAAC,QAAQ,CAAC;;;ACzFnC;;AAEG;;;;"}
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, forwardRef, Directive, HostListener, inject, Input, NgModule } from '@angular/core';
2
+ import { InjectionToken, forwardRef, HostListener, Directive, inject, Input, NgModule } from '@angular/core';
3
3
  import { DisabledController, ReadonlyController, detectControllerChanges, CoreModule } from '@odx/angular';
4
4
  import { injectElement, booleanToAttributeString } from '@odx/angular/utils';
5
5
  import { CustomFormControl } from '@odx/angular/cdk/custom-form-control';
@@ -1 +1 @@
1
- {"version":3,"file":"odx-angular-cdk-radio-group-control.mjs","sources":["../../../../libs/angular/cdk/radio-group-control/src/lib/radio-group-control.directive.ts","../../../../libs/angular/cdk/radio-group-control/src/lib/radio-control.directive.ts","../../../../libs/angular/cdk/radio-group-control/src/lib/radio-group-control.module.ts","../../../../libs/angular/cdk/radio-group-control/src/odx-angular-cdk-radio-group-control.ts"],"sourcesContent":["import { Directive, forwardRef, HostListener, InjectionToken } from '@angular/core';\nimport { DisabledController, ReadonlyController } from '@odx/angular';\nimport { CustomFormControl } from '@odx/angular/cdk/custom-form-control';\nimport { injectElement } from '@odx/angular/utils';\n\nexport const RADIO_GROUP_CONTROL = new InjectionToken<RadioGroupControlDirective>('@odx/angular/cdk/radio-group-control::RadioGroupControl');\n\n/**\n * A directive that provides radio group functionality for its child radio button components.\n * It tracks the value and selection state of a group of `odxRadioControl` directives.\n *\n * This directive extends `CustomFormControl` to integrate seamlessly with Angular Forms API,\n * providing form control methods and properties. It supports form control states like disabled\n * and readonly through `DisabledController` and `ReadonlyController` directives.\n *\n * It uses Angular's dependency injection to provide itself as `RADIO_GROUP_CONTROL` token,\n * allowing child radio buttons to communicate with the radio group directive.\n *\n * @template T - The type of the value.\n */\n@Directive({\n standalone: true,\n selector: '[odxRadioGroupControl]',\n providers: [\n {\n provide: RADIO_GROUP_CONTROL,\n useExisting: forwardRef(() => RadioGroupControlDirective),\n multi: false,\n },\n DisabledController.connect(),\n ReadonlyController.connect(),\n ],\n})\nexport class RadioGroupControlDirective<T = unknown> extends CustomFormControl<T | null> {\n private readonly hostElement = injectElement();\n\n constructor() {\n super(null);\n }\n\n @HostListener('focusout', ['$event'])\n protected onFocusOut(event: FocusEvent): void {\n if (event.target !== this.hostElement.nativeElement) {\n this.onTouched();\n }\n }\n}\n","import { Directive, inject, Input } from '@angular/core';\nimport { detectControllerChanges, DisabledController, ReadonlyController } from '@odx/angular';\nimport { booleanToAttributeString } from '@odx/angular/utils';\nimport { RADIO_GROUP_CONTROL } from './radio-group-control.directive';\n\n/**\n * A directive that provides radio button functionality within a radio group.\n * It tracks the active state based on the current value of the parent `odxRadioGroupControl`.\n *\n * This directive integrates with Angular Forms through `DisabledController` and `ReadonlyController` directives,\n * enabling form control states like disabled and readonly. It automatically updates its classes\n * to reflect these states and the active (checked) state.\n *\n * @template T - The type of the value.\n */\n@Directive({\n standalone: true,\n selector: '[odxRadioControl]',\n host: {\n '[class.is-active]': 'isActive',\n '[class.is-disabled]': 'disabledController?.disabled',\n '[class.is-readonly]': 'readonlyController?.readonly',\n '[class.has-error]': 'radioGroupControl.hasError',\n },\n providers: [DisabledController.connect(), ReadonlyController.connect()],\n})\nexport class RadioControlDirective<T = unknown> {\n protected readonly disabledController = DisabledController.inject();\n protected readonly readonlyController = ReadonlyController.inject();\n protected readonly radioGroupControl = inject(RADIO_GROUP_CONTROL, { skipSelf: true });\n\n /**\n * The value of the radio control.\n *\n * @type {T | null}\n * @default null\n */\n @Input()\n public value: T | null = null;\n\n /**\n * The `aria-checked` attribute value.\n *\n * @type {string}\n */\n public get ariaChecked(): string {\n return booleanToAttributeString(this.isActive);\n }\n\n /**\n * Gets a value indicating whether the radio control is active.\n *\n * @type {boolean}\n */\n public get isActive(): boolean {\n return this.radioGroupControl.value === this.value;\n }\n\n constructor() {\n detectControllerChanges(this.radioGroupControl).subscribe();\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CoreModule } from '@odx/angular';\nimport { RadioControlDirective } from './radio-control.directive';\nimport { RadioGroupControlDirective } from './radio-group-control.directive';\n\nconst modules = [RadioGroupControlDirective, RadioControlDirective];\n\n@NgModule({\n imports: modules,\n exports: [CoreModule, ...modules],\n})\nexport class RadioGroupControlModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAKa,mBAAmB,GAAG,IAAI,cAAc,CAA6B,yDAAyD,EAAE;AAE7I;;;;;;;;;;;;AAYG;AAcG,MAAO,0BAAwC,SAAQ,iBAA2B,CAAA;AAGtF,IAAA,WAAA,GAAA;QACE,KAAK,CAAC,IAAI,CAAC,CAAC;QAHG,IAAW,CAAA,WAAA,GAAG,aAAa,EAAE,CAAC;KAI9C;AAGS,IAAA,UAAU,CAAC,KAAiB,EAAA;QACpC,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE;YACnD,IAAI,CAAC,SAAS,EAAE,CAAC;SAClB;KACF;+GAZU,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;AAA1B,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,U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AACrD,wBAAA,qBAAqB,EAAE,8BAA8B;AACrD,wBAAA,mBAAmB,EAAE,4BAA4B;AAClD,qBAAA;oBACD,SAAS,EAAE,CAAC,kBAAkB,CAAC,OAAO,EAAE,EAAE,kBAAkB,CAAC,OAAO,EAAE,CAAC;AACxE,iBAAA,CAAA;wDAaQ,KAAK,EAAA,CAAA;sBADX,KAAK;;;AChCR,MAAM,OAAO,GAAG,CAAC,0BAA0B,EAAE,qBAAqB,CAAC,CAAC;MAMvD,uBAAuB,CAAA;+GAAvB,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;gHAAvB,uBAAuB,EAAA,OAAA,EAAA,CANnB,0BAA0B,EAAE,qBAAqB,aAItD,UAAU,EAJL,0BAA0B,EAAE,qBAAqB,CAAA,EAAA,CAAA,CAAA,EAAA;AAMrD,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,YAFxB,UAAU,CAAA,EAAA,CAAA,CAAA,EAAA;;4FAET,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAJnC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,OAAO;AAChB,oBAAA,OAAO,EAAE,CAAC,UAAU,EAAE,GAAG,OAAO,CAAC;AAClC,iBAAA,CAAA;;;ACVD;;AAEG;;;;"}
1
+ {"version":3,"file":"odx-angular-cdk-radio-group-control.mjs","sources":["../../../../libs/angular/cdk/radio-group-control/src/lib/radio-group-control.directive.ts","../../../../libs/angular/cdk/radio-group-control/src/lib/radio-control.directive.ts","../../../../libs/angular/cdk/radio-group-control/src/lib/radio-group-control.module.ts","../../../../libs/angular/cdk/radio-group-control/src/odx-angular-cdk-radio-group-control.ts"],"sourcesContent":["import { Directive, forwardRef, HostListener, InjectionToken } from '@angular/core';\nimport { DisabledController, ReadonlyController } from '@odx/angular';\nimport { CustomFormControl } from '@odx/angular/cdk/custom-form-control';\nimport { injectElement } from '@odx/angular/utils';\n\nexport const RADIO_GROUP_CONTROL = new InjectionToken<RadioGroupControlDirective>('@odx/angular/cdk/radio-group-control::RadioGroupControl');\n\n/**\n * A directive that provides radio group functionality for its child radio button components.\n * It tracks the value and selection state of a group of `odxRadioControl` directives.\n *\n * This directive extends `CustomFormControl` to integrate seamlessly with Angular Forms API,\n * providing form control methods and properties. It supports form control states like disabled\n * and readonly through `DisabledController` and `ReadonlyController` directives.\n *\n * It uses Angular's dependency injection to provide itself as `RADIO_GROUP_CONTROL` token,\n * allowing child radio buttons to communicate with the radio group directive.\n *\n * @template T - The type of the value.\n */\n@Directive({\n standalone: true,\n selector: '[odxRadioGroupControl]',\n providers: [\n {\n provide: RADIO_GROUP_CONTROL,\n useExisting: forwardRef(() => RadioGroupControlDirective),\n multi: false,\n },\n DisabledController.connect(),\n ReadonlyController.connect(),\n ],\n})\nexport class RadioGroupControlDirective<T = unknown> extends CustomFormControl<T | null> {\n private readonly hostElement = injectElement();\n\n constructor() {\n super(null);\n }\n\n @HostListener('focusout', ['$event'])\n protected onFocusOut(event: FocusEvent): void {\n if (event.target !== this.hostElement.nativeElement) {\n this.onTouched();\n }\n }\n}\n","import { Directive, inject, Input } from '@angular/core';\nimport { detectControllerChanges, DisabledController, ReadonlyController } from '@odx/angular';\nimport { booleanToAttributeString } from '@odx/angular/utils';\nimport { RADIO_GROUP_CONTROL } from './radio-group-control.directive';\n\n/**\n * A directive that provides radio button functionality within a radio group.\n * It tracks the active state based on the current value of the parent `odxRadioGroupControl`.\n *\n * This directive integrates with Angular Forms through `DisabledController` and `ReadonlyController` directives,\n * enabling form control states like disabled and readonly. It automatically updates its classes\n * to reflect these states and the active (checked) state.\n *\n * @template T - The type of the value.\n */\n@Directive({\n standalone: true,\n selector: '[odxRadioControl]',\n host: {\n '[class.is-active]': 'isActive',\n '[class.is-disabled]': 'disabledController?.disabled',\n '[class.is-readonly]': 'readonlyController?.readonly',\n '[class.has-error]': 'radioGroupControl.hasError',\n },\n providers: [DisabledController.connect(), ReadonlyController.connect()],\n})\nexport class RadioControlDirective<T = unknown> {\n protected readonly disabledController = DisabledController.inject();\n protected readonly readonlyController = ReadonlyController.inject();\n protected readonly radioGroupControl = inject(RADIO_GROUP_CONTROL, { skipSelf: true });\n\n /**\n * The value of the radio control.\n *\n * @type {T | null}\n * @default null\n */\n @Input()\n public value: T | null = null;\n\n /**\n * The `aria-checked` attribute value.\n *\n * @type {string}\n */\n public get ariaChecked(): string {\n return booleanToAttributeString(this.isActive);\n }\n\n /**\n * Gets a value indicating whether the radio control is active.\n *\n * @type {boolean}\n */\n public get isActive(): boolean {\n return this.radioGroupControl.value === this.value;\n }\n\n constructor() {\n detectControllerChanges(this.radioGroupControl).subscribe();\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CoreModule } from '@odx/angular';\nimport { RadioControlDirective } from './radio-control.directive';\nimport { RadioGroupControlDirective } from './radio-group-control.directive';\n\nconst modules = [RadioGroupControlDirective, RadioControlDirective];\n\n@NgModule({\n imports: modules,\n exports: [CoreModule, ...modules],\n})\nexport class RadioGroupControlModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAKa,mBAAmB,GAAG,IAAI,cAAc,CAA6B,yDAAyD;AAE3I;;;;;;;;;;;;AAYG;AAcG,MAAO,0BAAwC,SAAQ,iBAA2B,CAAA;AAGtF,IAAA,WAAA,GAAA;QACE,KAAK,CAAC,IAAI,CAAC;QAHI,IAAA,CAAA,WAAW,GAAG,aAAa,EAAE;IAI9C;AAGU,IAAA,UAAU,CAAC,KAAiB,EAAA;QACpC,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE;YACnD,IAAI,CAAC,SAAS,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