From 4d90a688fa2ff8287d1da5aaf7557864f9d07a0b Mon Sep 17 00:00:00 2001 From: Umanskiy Aleksey Date: Thu, 17 Oct 2024 10:59:24 +0300 Subject: [PATCH] hotfix(typescript): some angular setups can't handle .forRoot() returning just module --- apps/ngx-bootstrap-docs/src/assets/css/style.scss | 4 +++- src/accordion/accordion.module.ts | 9 ++++++--- src/alert/alert.module.ts | 9 ++++++--- src/buttons/buttons.module.ts | 9 ++++++--- src/carousel/carousel.module.ts | 9 ++++++--- src/collapse/collapse.module.ts | 9 ++++++--- src/datepicker/bs-datepicker.module.ts | 9 ++++++--- src/dropdown/bs-dropdown.module.ts | 9 ++++++--- src/focus-trap/focus-trap.module.ts | 9 ++++++--- src/pagination/pagination.module.ts | 9 ++++++--- src/popover/popover.module.ts | 9 ++++++--- src/progressbar/progressbar.module.ts | 9 ++++++--- src/rating/rating.module.ts | 9 ++++++--- src/sortable/sortable.module.ts | 9 ++++++--- src/tabs/tabs.module.ts | 7 +++++-- src/timepicker/timepicker.module.ts | 9 ++++++--- src/tooltip/tooltip.module.ts | 9 ++++++--- src/typeahead/typeahead.module.ts | 9 ++++++--- 18 files changed, 104 insertions(+), 51 deletions(-) diff --git a/apps/ngx-bootstrap-docs/src/assets/css/style.scss b/apps/ngx-bootstrap-docs/src/assets/css/style.scss index 8020c1da36..3db1f2272a 100644 --- a/apps/ngx-bootstrap-docs/src/assets/css/style.scss +++ b/apps/ngx-bootstrap-docs/src/assets/css/style.scss @@ -2,7 +2,9 @@ @import "bs-datepicker"; /* HEADER */ - +.bs-datepicker-head { + width: 150px; +} header { padding: 10px 50px 10px 30px; height: $header-height; diff --git a/src/accordion/accordion.module.ts b/src/accordion/accordion.module.ts index 60a8a70db1..23541e2d23 100644 --- a/src/accordion/accordion.module.ts +++ b/src/accordion/accordion.module.ts @@ -1,4 +1,4 @@ -import { NgModule } from '@angular/core'; +import { ModuleWithProviders, NgModule } from '@angular/core'; import { AccordionComponent } from './accordion.component'; import { AccordionPanelComponent } from './accordion-group.component'; @@ -9,7 +9,10 @@ import { AccordionPanelComponent } from './accordion-group.component'; }) export class AccordionModule { // @deprecated method not required anymore, will be deleted in v19.0.0 - static forRoot() { - return AccordionModule; + static forRoot(): ModuleWithProviders { + return { + ngModule: AccordionModule, + providers: [] + }; } } diff --git a/src/alert/alert.module.ts b/src/alert/alert.module.ts index d682d7cbce..2cfca0257a 100644 --- a/src/alert/alert.module.ts +++ b/src/alert/alert.module.ts @@ -1,4 +1,4 @@ -import { NgModule } from '@angular/core'; +import { ModuleWithProviders, NgModule } from '@angular/core'; import { AlertComponent } from './alert.component'; @NgModule({ @@ -7,7 +7,10 @@ import { AlertComponent } from './alert.component'; }) export class AlertModule { // @deprecated method not required anymore, will be deleted in v19.0.0 - static forRoot() { - return AlertModule; + static forRoot(): ModuleWithProviders { + return { + ngModule: AlertModule, + providers: [] + }; } } diff --git a/src/buttons/buttons.module.ts b/src/buttons/buttons.module.ts index dd6ad1d660..f2a4854d52 100644 --- a/src/buttons/buttons.module.ts +++ b/src/buttons/buttons.module.ts @@ -1,4 +1,4 @@ -import { NgModule } from '@angular/core'; +import { ModuleWithProviders, NgModule } from '@angular/core'; import { ButtonCheckboxDirective } from './button-checkbox.directive'; import { ButtonRadioDirective } from './button-radio.directive'; @@ -10,7 +10,10 @@ import { ButtonRadioGroupDirective } from './button-radio-group.directive'; }) export class ButtonsModule { // @deprecated method not required anymore, will be deleted in v19.0.0 - static forRoot() { - return ButtonsModule; + static forRoot(): ModuleWithProviders { + return { + ngModule: ButtonsModule, + providers: [] + }; } } diff --git a/src/carousel/carousel.module.ts b/src/carousel/carousel.module.ts index 177452e83c..4bf02720f8 100644 --- a/src/carousel/carousel.module.ts +++ b/src/carousel/carousel.module.ts @@ -1,4 +1,4 @@ -import { NgModule } from '@angular/core'; +import { ModuleWithProviders, NgModule } from '@angular/core'; import { CarouselComponent } from './carousel.component'; import { SlideComponent } from './slide.component'; @@ -9,7 +9,10 @@ import { SlideComponent } from './slide.component'; }) export class CarouselModule { // @deprecated method not required anymore, will be deleted in v19.0.0 - static forRoot() { - return CarouselModule; + static forRoot(): ModuleWithProviders { + return { + ngModule: CarouselModule, + providers: [] + }; } } diff --git a/src/collapse/collapse.module.ts b/src/collapse/collapse.module.ts index 769cddbde2..611d9f5aa6 100644 --- a/src/collapse/collapse.module.ts +++ b/src/collapse/collapse.module.ts @@ -1,4 +1,4 @@ -import { NgModule } from '@angular/core'; +import { ModuleWithProviders, NgModule } from '@angular/core'; import { CollapseDirective } from './collapse.directive'; @@ -8,7 +8,10 @@ import { CollapseDirective } from './collapse.directive'; }) export class CollapseModule { // @deprecated method not required anymore, will be deleted in v19.0.0 - static forRoot() { - return CollapseModule; + static forRoot(): ModuleWithProviders { + return { + ngModule: CollapseModule, + providers: [] + }; } } diff --git a/src/datepicker/bs-datepicker.module.ts b/src/datepicker/bs-datepicker.module.ts index 88abae332f..5677ba96cd 100644 --- a/src/datepicker/bs-datepicker.module.ts +++ b/src/datepicker/bs-datepicker.module.ts @@ -1,5 +1,5 @@ import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; +import { ModuleWithProviders, NgModule } from '@angular/core'; import { TooltipModule } from 'ngx-bootstrap/tooltip'; import { TimepickerModule } from 'ngx-bootstrap/timepicker'; @@ -64,7 +64,10 @@ import { BsYearsCalendarViewComponent } from './themes/bs/bs-years-calendar-view }) export class BsDatepickerModule { // @deprecated method not required anymore, will be deleted in v19.0.0 - static forRoot() { - return BsDatepickerModule; + static forRoot(): ModuleWithProviders { + return { + ngModule: BsDatepickerModule, + providers: [] + }; } } diff --git a/src/dropdown/bs-dropdown.module.ts b/src/dropdown/bs-dropdown.module.ts index 5ab54af6fd..7f7624ea4c 100644 --- a/src/dropdown/bs-dropdown.module.ts +++ b/src/dropdown/bs-dropdown.module.ts @@ -1,4 +1,4 @@ -import { NgModule } from '@angular/core'; +import { ModuleWithProviders, NgModule } from '@angular/core'; import { BsDropdownContainerComponent } from './bs-dropdown-container.component'; import { BsDropdownMenuDirective } from './bs-dropdown-menu.directive'; @@ -21,7 +21,10 @@ import { BsDropdownDirective } from './bs-dropdown.directive'; }) export class BsDropdownModule { // @deprecated method not required anymore, will be deleted in v19.0.0 - static forRoot() { - return BsDropdownModule; + static forRoot(): ModuleWithProviders { + return { + ngModule: BsDropdownModule, + providers: [] + }; } } diff --git a/src/focus-trap/focus-trap.module.ts b/src/focus-trap/focus-trap.module.ts index 60ecd48574..509b87439b 100644 --- a/src/focus-trap/focus-trap.module.ts +++ b/src/focus-trap/focus-trap.module.ts @@ -1,4 +1,4 @@ -import { NgModule } from '@angular/core'; +import { ModuleWithProviders, NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FocusTrapDirective } from './focus-trap'; @@ -9,7 +9,10 @@ import { FocusTrapDirective } from './focus-trap'; }) export class FocusTrapModule { // @deprecated method not required anymore, will be deleted in v19.0.0 - static forRoot() { - return FocusTrapModule; + static forRoot(): ModuleWithProviders { + return { + ngModule: FocusTrapModule, + providers: [] + }; } } diff --git a/src/pagination/pagination.module.ts b/src/pagination/pagination.module.ts index 0dc6fd8334..a7c377f4af 100644 --- a/src/pagination/pagination.module.ts +++ b/src/pagination/pagination.module.ts @@ -1,5 +1,5 @@ import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; +import { ModuleWithProviders, NgModule } from '@angular/core'; import { PagerComponent } from './pager.component'; import { PaginationComponent } from './pagination.component'; @@ -10,7 +10,10 @@ import { PaginationComponent } from './pagination.component'; }) export class PaginationModule { // @deprecated method not required anymore, will be deleted in v19.0.0 - static forRoot() { - return PaginationModule; + static forRoot(): ModuleWithProviders { + return { + ngModule: PaginationModule, + providers: [] + }; } } diff --git a/src/popover/popover.module.ts b/src/popover/popover.module.ts index d992626951..d69a1f8864 100644 --- a/src/popover/popover.module.ts +++ b/src/popover/popover.module.ts @@ -1,4 +1,4 @@ -import { NgModule } from '@angular/core'; +import { ModuleWithProviders, NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { PopoverDirective } from './popover.directive'; @@ -10,7 +10,10 @@ import { PopoverContainerComponent } from './popover-container.component'; }) export class PopoverModule { // @deprecated method not required anymore, will be deleted in v19.0.0 - static forRoot() { - return PopoverModule; + static forRoot(): ModuleWithProviders { + return { + ngModule: PopoverModule, + providers: [] + }; } } diff --git a/src/progressbar/progressbar.module.ts b/src/progressbar/progressbar.module.ts index feb7ac4f90..27385314b9 100644 --- a/src/progressbar/progressbar.module.ts +++ b/src/progressbar/progressbar.module.ts @@ -1,4 +1,4 @@ -import { NgModule } from '@angular/core'; +import { ModuleWithProviders, NgModule } from '@angular/core'; import { BarComponent } from './bar.component'; import { ProgressbarComponent } from './progressbar.component'; @@ -9,7 +9,10 @@ import { ProgressbarComponent } from './progressbar.component'; }) export class ProgressbarModule { // @deprecated method not required anymore, will be deleted in v19.0.0 - static forRoot() { - return ProgressbarModule; + static forRoot(): ModuleWithProviders { + return { + ngModule: ProgressbarModule, + providers: [] + }; } } diff --git a/src/rating/rating.module.ts b/src/rating/rating.module.ts index 2b75fd726d..0c85ba15c6 100644 --- a/src/rating/rating.module.ts +++ b/src/rating/rating.module.ts @@ -1,4 +1,4 @@ -import { NgModule } from '@angular/core'; +import { ModuleWithProviders, NgModule } from '@angular/core'; import { RatingComponent } from './rating.component'; @@ -8,7 +8,10 @@ import { RatingComponent } from './rating.component'; }) export class RatingModule { // @deprecated method not required anymore, will be deleted in v19.0.0 - static forRoot() { - return RatingModule; + static forRoot(): ModuleWithProviders { + return { + ngModule: RatingModule, + providers: [] + }; } } diff --git a/src/sortable/sortable.module.ts b/src/sortable/sortable.module.ts index 1bddcf40cc..29cda7c63c 100644 --- a/src/sortable/sortable.module.ts +++ b/src/sortable/sortable.module.ts @@ -1,4 +1,4 @@ -import { NgModule } from '@angular/core'; +import { ModuleWithProviders, NgModule } from '@angular/core'; import { SortableComponent } from './sortable.component'; @@ -8,7 +8,10 @@ import { SortableComponent } from './sortable.component'; }) export class SortableModule { // @deprecated method not required anymore, will be deleted in v19.0.0 - static forRoot() { - return SortableModule; + static forRoot(): ModuleWithProviders { + return { + ngModule: SortableModule, + providers: [] + }; } } diff --git a/src/tabs/tabs.module.ts b/src/tabs/tabs.module.ts index 359d111fcc..ce779c96e1 100644 --- a/src/tabs/tabs.module.ts +++ b/src/tabs/tabs.module.ts @@ -20,7 +20,10 @@ import { TabsetComponent } from './tabset.component'; }) export class TabsModule { // @deprecated method not required anymore, will be deleted in v19.0.0 - static forRoot() { - return TabsModule; + static forRoot(): ModuleWithProviders { + return { + ngModule: TabsModule, + providers: [] + }; } } diff --git a/src/timepicker/timepicker.module.ts b/src/timepicker/timepicker.module.ts index 9b10a82df5..bdb8678a4a 100644 --- a/src/timepicker/timepicker.module.ts +++ b/src/timepicker/timepicker.module.ts @@ -1,4 +1,4 @@ -import { NgModule } from '@angular/core'; +import { ModuleWithProviders, NgModule } from '@angular/core'; import { TimepickerComponent } from './timepicker.component'; @@ -8,7 +8,10 @@ import { TimepickerComponent } from './timepicker.component'; }) export class TimepickerModule { // @deprecated method not required anymore, will be deleted in v19.0.0 - static forRoot() { - return TimepickerModule; + static forRoot(): ModuleWithProviders { + return { + ngModule: TimepickerModule, + providers: [] + }; } } diff --git a/src/tooltip/tooltip.module.ts b/src/tooltip/tooltip.module.ts index 928ca7a217..6a390afbd8 100644 --- a/src/tooltip/tooltip.module.ts +++ b/src/tooltip/tooltip.module.ts @@ -1,5 +1,5 @@ import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; +import { ModuleWithProviders, NgModule } from '@angular/core'; import { TooltipContainerComponent } from './tooltip-container.component'; import { TooltipDirective } from './tooltip.directive'; @@ -9,7 +9,10 @@ import { TooltipDirective } from './tooltip.directive'; }) export class TooltipModule { // @deprecated method not required anymore, will be deleted in v19.0.0 - static forRoot() { - return TooltipModule; + static forRoot(): ModuleWithProviders { + return { + ngModule: TooltipModule, + providers: [] + }; } } diff --git a/src/typeahead/typeahead.module.ts b/src/typeahead/typeahead.module.ts index ccdd9d35dd..334b3df41c 100644 --- a/src/typeahead/typeahead.module.ts +++ b/src/typeahead/typeahead.module.ts @@ -1,5 +1,5 @@ import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; +import { ModuleWithProviders, NgModule } from '@angular/core'; import { TypeaheadContainerComponent } from './typeahead-container.component'; import { TypeaheadDirective } from './typeahead.directive'; @@ -10,7 +10,10 @@ import { TypeaheadDirective } from './typeahead.directive'; }) export class TypeaheadModule { // @deprecated method not required anymore, will be deleted in v19.0.0 - static forRoot() { - return TypeaheadModule; + static forRoot(): ModuleWithProviders { + return { + ngModule: TypeaheadModule, + providers: [] + }; } }