Skip to content

Commit

Permalink
fix(cdk): fix cdk mappings duplicates (#2068)
Browse files Browse the repository at this point in the history
BREAKING CHANGE:

NbPlatform and NbScrollStrategyOptions from theme/components/cdk/overlay/mapping.ts removed. Use NbPlatform from theme/components/cdk/platform/platform-service.ts and NbScrollStrategyOptions from theme/components/cdk/adapter/block-scroll-strategy-adapter.ts.
NbPlatformModule removed.
  • Loading branch information
denStrigo authored and yggg committed Dec 6, 2019
1 parent 1c5323d commit 8179a02
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Injectable, NgZone } from '@angular/core';
import { CdkScrollable, ScrollDispatcher } from '@angular/cdk/overlay';
import { Observable } from 'rxjs';

import { NbPlatform } from '../overlay/mapping';
import { NbPlatform } from '../platform/platform-service';
import { NbLayoutScrollService } from '../../../services/scroll.service';

@Injectable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Injectable, NgZone } from '@angular/core';
import { ViewportRuler } from '@angular/cdk/overlay';
import { map } from 'rxjs/operators';

import { NbPlatform } from '../overlay/mapping';
import { NbPlatform } from '../platform/platform-service';
import { NbLayoutRulerService } from '../../../services/ruler.service';
import { NbLayoutScrollService, NbScrollPosition } from '../../../services/scroll.service';

Expand Down
10 changes: 2 additions & 8 deletions src/framework/theme/components/cdk/overlay/mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ import {
OverlayRef,
PositionStrategy,
ScrollStrategy,
ScrollStrategyOptions,
} from '@angular/cdk/overlay';
import { Platform } from '@angular/cdk/platform';
import { NbScrollStrategyOptions } from '../adapter/block-scroll-strategy-adapter';


@Directive({ selector: '[nbPortal]' })
Expand All @@ -47,10 +46,7 @@ export class NbComponentPortal<T = any> extends ComponentPortal<T> {

@Injectable()
export class NbOverlay extends Overlay {
}

@Injectable()
export class NbPlatform extends Platform {
scrollStrategies: NbScrollStrategyOptions;
}

@Injectable()
Expand Down Expand Up @@ -80,7 +76,6 @@ export type NbConnectedPosition = ConnectedPosition;
export type NbConnectedOverlayPositionChange = ConnectedOverlayPositionChange;
export type NbConnectionPositionPair = ConnectionPositionPair;
export type NbOverlayConfig = OverlayConfig;
export type NbScrollStrategyOptions = ScrollStrategyOptions;
export type NbScrollStrategy = ScrollStrategy;

const CDK_MODULES = [OverlayModule, PortalModule];
Expand All @@ -104,7 +99,6 @@ export class NbCdkMappingModule {
ngModule: NbCdkMappingModule,
providers: [
NbOverlay,
NbPlatform,
NbOverlayPositionBuilder,
],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import {
NbFlexibleConnectedPositionStrategy,
NbOverlayPositionBuilder,
NbOverlayRef,
NbPlatform,
NbPositionStrategy,
} from './mapping';
import { NbPlatform } from '../platform/platform-service';
import { NbOverlayContainerAdapter } from '../adapter/overlay-container-adapter';
import { NbViewportRulerAdapter } from '../adapter/viewport-ruler-adapter';
import { NbGlobalLogicalPosition } from './position-helper';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
NbOverlay,
NbOverlayConfig,
NbOverlayRef,
NbScrollStrategyOptions,
} from './mapping';
import { NbScrollStrategyOptions } from '../adapter/block-scroll-strategy-adapter';
import { NbLayoutDirectionService } from '../../../services/direction.service';


Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import { Platform } from '@angular/cdk/platform';
import { Injectable } from '@angular/core';

@Injectable({
providedIn: 'root',
useClass: Platform,
})
export class NbPlatform extends Platform {}
10 changes: 0 additions & 10 deletions src/framework/theme/components/cdk/platform/platform.module.ts

This file was deleted.

3 changes: 1 addition & 2 deletions src/framework/theme/components/cdk/table/table.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Attribute, ChangeDetectorRef, ElementRef, Inject, IterableDiffers, NgMo
import { CdkTable, CdkTableModule } from '@angular/cdk/table';
import { NbBidiModule } from '../bidi/bidi.module';
import { NbDirectionality } from '../bidi/bidi-service';
import { NbPlatformModule } from '../platform/platform.module';
import { NbPlatform } from '../platform/platform-service';
import { NB_DOCUMENT } from '../../../theme.options';
import {
Expand Down Expand Up @@ -76,7 +75,7 @@ const COMPONENTS = [
];

@NgModule({
imports: [ NbBidiModule, NbPlatformModule ],
imports: [ NbBidiModule ],
declarations: [ ...COMPONENTS ],
exports: [ ...COMPONENTS ],
})
Expand Down
2 changes: 1 addition & 1 deletion src/framework/theme/public_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export * from './components/cdk/overlay/mapping';
export * from './components/cdk/overlay/position-helper';
export * from './components/cdk/overlay/dynamic/dynamic-overlay';
export * from './components/cdk/overlay/dynamic/dynamic-overlay-handler';
export * from './components/cdk/platform/platform-service';
export * from './components/cdk/a11y/a11y.module';
export * from './components/cdk/a11y/focus-trap';
export * from './components/cdk/adapter/adapter.module';
Expand All @@ -144,7 +145,6 @@ export * from './components/cdk/adapter/scroll-dispatcher-adapter';
export * from './components/cdk/adapter/viewport-ruler-adapter';
export * from './components/cdk/bidi/bidi-service';
export * from './components/cdk/bidi/bidi.module';
export * from './components/cdk/platform/platform.module';
export * from './components/cdk/table/cell';
export * from './components/cdk/table/data-source';
export * from './components/cdk/table/row';
Expand Down

0 comments on commit 8179a02

Please sign in to comment.