design-angular-kit 21.0.0 → 21.0.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,11 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, Renderer2, ElementRef, ChangeDetectorRef, EventEmitter, Output, Input, Component, Injectable, signal, DestroyRef, NgZone, Injector, afterNextRender, ViewChild, ChangeDetectionStrategy, ViewEncapsulation, booleanAttribute, InjectionToken, ContentChildren, NgModule, TemplateRef, HostBinding, Directive, DOCUMENT, HostListener, ViewChildren, Pipe, HostAttributeToken, provideAppInitializer, importProvidersFrom, makeEnvironmentProviders } from '@angular/core';
2
+ import { inject, Renderer2, ElementRef, ChangeDetectorRef, EventEmitter, Output, Input, Component, Injectable, signal, DestroyRef, NgZone, Injector, afterNextRender, ViewChild, ChangeDetectionStrategy, ViewEncapsulation, booleanAttribute, InjectionToken, ContentChildren, NgModule, TemplateRef, HostBinding, Directive, DOCUMENT, HostListener, ViewChildren, Pipe, HostAttributeToken, provideAppInitializer, makeEnvironmentProviders } from '@angular/core';
3
3
  import { NgTemplateOutlet, NgClass, AsyncPipe, LowerCasePipe, DatePipe, NgOptimizedImage, TitleCasePipe, Location, JsonPipe, ViewportScroller } from '@angular/common';
4
4
  import { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';
5
5
  import { tap, delay, startWith, Subject, filter, debounceTime, distinctUntilChanged, switchMap, of, merge, map, Observable, take, forkJoin, BehaviorSubject, shareReplay, combineLatest, skip, AsyncSubject, withLatestFrom, timer, takeWhile } from 'rxjs';
6
6
  import videojs from 'video.js';
7
7
  import * as i1 from '@ngx-translate/core';
8
- import { TranslateService, TranslateModule, TranslatePipe, TranslateLoader } from '@ngx-translate/core';
8
+ import { TranslateService, TranslateModule, TranslatePipe, provideTranslateService } from '@ngx-translate/core';
9
9
  import { initYoutubePlugin } from 'bootstrap-italia/dist/plugins/util/youtube-video.js';
10
10
  import { Collapse, Alert, Dropdown, Carousel, Modal, Notification, Popover, Tab, Tooltip, InputPassword, ProgressDonut, SelectAutocomplete, BackToTop, NavBarCollapsible, HeaderSticky, loadFonts } from 'bootstrap-italia';
11
11
  import { RouterLink, RouterLinkActive, Router, NavigationEnd, Scroll, RouterLinkWithHref, ActivatedRoute } from '@angular/router';
@@ -13,9 +13,9 @@ import { trigger, transition, style, animate } from '@angular/animations';
13
13
  import * as i1$1 from '@angular/forms';
14
14
  import { NgControl, ControlContainer, FormControl, FormGroup, Validators, ReactiveFormsModule, NgModel, FormControlName } from '@angular/forms';
15
15
  import { DomSanitizer } from '@angular/platform-browser';
16
- import { provideHttpClient, HttpClient } from '@angular/common/http';
16
+ import { provideHttpClient } from '@angular/common/http';
17
17
  import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
18
- import { TranslateHttpLoader } from '@ngx-translate/http-loader';
18
+ import { provideTranslateHttpLoader } from '@ngx-translate/http-loader';
19
19
  import { map as map$1 } from 'rxjs/operators';
20
20
 
21
21
  class ItAbstractComponent {
@@ -6834,7 +6834,7 @@ class ItLanguageSwitcherComponent {
6834
6834
  */
6835
6835
  this.mode = 'link';
6836
6836
  const translateService = this.translateService;
6837
- this.currentLang$ = this.translateService.onLangChange.pipe(startWith({ lang: translateService.currentLang }), map(event => this.availableLanguages?.find(l => l.code === event.lang)));
6837
+ this.currentLang$ = this.translateService.onLangChange.pipe(startWith({ lang: translateService.getCurrentLang() }), map(event => this.availableLanguages?.find(l => l.code === event.lang)));
6838
6838
  }
6839
6839
  ngOnInit() {
6840
6840
  if (!this.availableLanguages) {
@@ -6950,7 +6950,7 @@ class ItDurationPipe extends TranslatePipe {
6950
6950
  */
6951
6951
  transform(value, type) {
6952
6952
  let valueAdjust = Number(value);
6953
- if (isNaN(valueAdjust)) {
6953
+ if (isNaN(valueAdjust) || value === null) {
6954
6954
  return '';
6955
6955
  }
6956
6956
  switch (type) {
@@ -7066,15 +7066,25 @@ function provideDesignAngularKit(config) {
7066
7066
  // Add provider to initialize the TranslateModule
7067
7067
  const langPrefix = `${assetBasePath}/i18n/`;
7068
7068
  const langSuffix = `.json`; // TODO: add ?v${version} to prevent cache loading on version change
7069
- providers.push(importProvidersFrom(TranslateModule.forRoot({
7070
- loader: config?.translateLoader?.(langPrefix, langSuffix) ?? {
7071
- provide: TranslateLoader,
7072
- useFactory: (http) => new TranslateHttpLoader(http, langPrefix, langSuffix),
7073
- deps: [HttpClient],
7074
- },
7075
- defaultLanguage: 'it',
7076
- useDefaultLang: true,
7077
- })));
7069
+ providers.push(
7070
+ // Design Angular Kit < 21
7071
+ // ngx-translate <= 16
7072
+ // importProvidersFrom(
7073
+ // TranslateModule.forRoot({
7074
+ // loader: config?.translateLoader?.(langPrefix, langSuffix) ?? {
7075
+ // provide: TranslateLoader,
7076
+ // useFactory: (http: HttpClient) => new TranslateHttpLoader(http, langPrefix, langSuffix),
7077
+ // deps: [HttpClient],
7078
+ // },
7079
+ // fallbackLang: 'it'
7080
+ // })
7081
+ // )
7082
+ // Design Angular Kit >= 21
7083
+ // ngx-translate >= 17
7084
+ provideTranslateService({
7085
+ loader: provideTranslateHttpLoader({ prefix: langPrefix, suffix: langSuffix }),
7086
+ fallbackLang: 'it',
7087
+ }));
7078
7088
  // Add provider to initialize library default languages
7079
7089
  providers.push(provideAppInitializer(() => {
7080
7090
  const initializerFn = ((translateService) => {