@six-group/ui-library-angular 5.5.1-rc.1 → 5.5.1

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, Output, ChangeDetectionStrategy, Component, Injectable, InjectionToken, inject, HostListener, Directive, Input, Optional, HostBinding, ContentChildren, APP_INITIALIZER, NgModule, NgZone } from '@angular/core';
2
+ import { EventEmitter, Output, ChangeDetectionStrategy, Component, Injectable, InjectionToken, inject, HostListener, Directive, Input, Optional, HostBinding, ContentChildren, provideAppInitializer, NgModule, NgZone } from '@angular/core';
3
3
  import { __decorate } from 'tslib';
4
4
  import { fromEvent } from 'rxjs';
5
5
  import { defineCustomElements } from '@six-group/ui-library/loader';
@@ -2107,7 +2107,23 @@ const DEFAULT_UI_LIBRARY_CONFIG = {
2107
2107
  showAsteriskOnRequiredValidator: false,
2108
2108
  disableValidationService: false,
2109
2109
  };
2110
- const UI_LIBRARY_CONFIG = new InjectionToken('UiLibraryConfig');
2110
+ /**
2111
+ * Injection token holding the {@link UiLibraryConfig}.
2112
+ *
2113
+ * The token provides {@link DEFAULT_UI_LIBRARY_CONFIG} by default, so that components and
2114
+ * directives of this library can be used without calling `UiLibraryAngularModule.forRoot()`
2115
+ * (e.g. in unit tests). Provide the token explicitly to override single options:
2116
+ *
2117
+ * ```ts
2118
+ * TestBed.configureTestingModule({
2119
+ * providers: [{ provide: UI_LIBRARY_CONFIG, useValue: { showAsteriskOnRequiredValidator: true } }],
2120
+ * });
2121
+ * ```
2122
+ */
2123
+ const UI_LIBRARY_CONFIG = new InjectionToken('UiLibraryConfig', {
2124
+ providedIn: 'root',
2125
+ factory: () => DEFAULT_UI_LIBRARY_CONFIG,
2126
+ });
2111
2127
 
2112
2128
  class ValueAccessor {
2113
2129
  injector;
@@ -3249,6 +3265,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
3249
3265
  args: ['change', ['$event.target']]
3250
3266
  }] } });
3251
3267
 
3268
+ /**
3269
+ * Custom elements are registered in the global `customElements` registry, so registering them
3270
+ * more than once is pointless and expensive. `forRoot()` may be called once per injector
3271
+ * (e.g. once per test case), therefore the registration is memoized per JS realm.
3272
+ */
3273
+ let customElementsRegistration;
3274
+ const registerCustomElementsOnce = () => {
3275
+ customElementsRegistration ??= (async () => {
3276
+ defineCustomElements();
3277
+ })();
3278
+ return customElementsRegistration;
3279
+ };
3252
3280
  class UiLibraryAngularModule {
3253
3281
  static forRoot(customValidationMessagesService, config) {
3254
3282
  const mergedConfig = {
@@ -3258,11 +3286,7 @@ class UiLibraryAngularModule {
3258
3286
  return {
3259
3287
  ngModule: UiLibraryAngularModule,
3260
3288
  providers: [
3261
- {
3262
- provide: APP_INITIALIZER,
3263
- useFactory: () => async () => defineCustomElements(),
3264
- multi: true,
3265
- },
3289
+ provideAppInitializer(() => registerCustomElementsOnce()),
3266
3290
  { provide: ValidationMessagesService, useClass: customValidationMessagesService ?? ValidationMessagesService },
3267
3291
  { provide: UI_LIBRARY_CONFIG, useValue: mergedConfig },
3268
3292
  ],
@@ -3435,5 +3459,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
3435
3459
  * Generated bundle index. Do not edit.
3436
3460
  */
3437
3461
 
3438
- export { ActiveSidebarDirective, ActiveSidebarItemDirective, ActiveSidebarItemGroupDirective, AlertService, AllowedDatesValidator, AllowedDatesValidatorIso, CheckboxMultiSelectValueAccessor, CheckboxValueAccessor, DIRECTIVES, DateValueAccessor, DatepickerValueAccessor, MaxDateValidator, MaxDateValidatorIso, MaxValidator, MinDateValidator, MinDateValidatorIso, MinValidator, NumericValueAccessor, RadioValueAccessor, RangeValueAccessor, SelectValueAccessor, SixAlert, SixAvatar, SixBadge, SixBreadcrumbs, SixBreadcrumbsItem, SixButton, SixCard, SixCheckbox, SixCheckboxGroupDirective, SixDate, SixDatepicker, SixDetails, SixDialog, SixDrawer, SixDropdown, SixError, SixErrorPage, SixFileList, SixFileListItem, SixFileUpload, SixFooter, SixFormDirective, SixFormUtilDirective, SixGroupLabel, SixHeader, SixHeaderDropdownItem, SixHeaderItem, SixHeaderMenuButton, SixIcon, SixIconButton, SixInput, SixItemPicker, SixLanguageSwitcher, SixLayoutGrid, SixLogo, SixMainContainer, SixMenu, SixMenuDivider, SixMenuItem, SixMenuLabel, SixPaginator, SixPicto, SixProgressBar, SixProgressRing, SixRadio, SixRange, SixRating, SixRoot, SixRouterLinkDirective, SixSearchField, SixSelect, SixSidebar, SixSidebarItem, SixSidebarItemGroup, SixSpinner, SixStageIndicator, SixSwitch, SixTab, SixTabGroup, SixTabPanel, SixTag, SixTextarea, SixTile, SixTimepicker, SixTooltip, SixUiLibraryValidators, SwitchValueAccessor, TextValueAccessor, TimepickerValueAccessor, UiLibraryAngularModule, ValidationMessagesService, ValueAccessor };
3462
+ export { ActiveSidebarDirective, ActiveSidebarItemDirective, ActiveSidebarItemGroupDirective, AlertService, AllowedDatesValidator, AllowedDatesValidatorIso, CheckboxMultiSelectValueAccessor, CheckboxValueAccessor, DEFAULT_UI_LIBRARY_CONFIG, DIRECTIVES, DateValueAccessor, DatepickerValueAccessor, MaxDateValidator, MaxDateValidatorIso, MaxValidator, MinDateValidator, MinDateValidatorIso, MinValidator, NumericValueAccessor, RadioValueAccessor, RangeValueAccessor, SelectValueAccessor, SixAlert, SixAvatar, SixBadge, SixBreadcrumbs, SixBreadcrumbsItem, SixButton, SixCard, SixCheckbox, SixCheckboxGroupDirective, SixDate, SixDatepicker, SixDetails, SixDialog, SixDrawer, SixDropdown, SixError, SixErrorPage, SixFileList, SixFileListItem, SixFileUpload, SixFooter, SixFormDirective, SixFormUtilDirective, SixGroupLabel, SixHeader, SixHeaderDropdownItem, SixHeaderItem, SixHeaderMenuButton, SixIcon, SixIconButton, SixInput, SixItemPicker, SixLanguageSwitcher, SixLayoutGrid, SixLogo, SixMainContainer, SixMenu, SixMenuDivider, SixMenuItem, SixMenuLabel, SixPaginator, SixPicto, SixProgressBar, SixProgressRing, SixRadio, SixRange, SixRating, SixRoot, SixRouterLinkDirective, SixSearchField, SixSelect, SixSidebar, SixSidebarItem, SixSidebarItemGroup, SixSpinner, SixStageIndicator, SixSwitch, SixTab, SixTabGroup, SixTabPanel, SixTag, SixTextarea, SixTile, SixTimepicker, SixTooltip, SixUiLibraryValidators, SwitchValueAccessor, TextValueAccessor, TimepickerValueAccessor, UI_LIBRARY_CONFIG, UiLibraryAngularModule, ValidationMessagesService, ValueAccessor };
3439
3463
  //# sourceMappingURL=six-group-ui-library-angular.mjs.map