Skip to content

Commit

Permalink
(fix): prod build fix bug NG3003
Browse files Browse the repository at this point in the history
  • Loading branch information
dreyliky committed Apr 8, 2023
1 parent 2989638 commit eb7c8b4
Show file tree
Hide file tree
Showing 22 changed files with 75 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from '@angular/core';
import { debounceTime, filter, merge, takeUntil } from 'rxjs';
import { ɵCommonCssClassEnum, ɵOsBaseViewComponent } from '../../../../core';
import { ɵTREE_NODE } from '../../constants';
import { ɵTREE_NODE, ɵTREE_NODE_COMPONENT } from '../../constants';
import { TreeNodeTriggerDirective } from '../../directives';
import { ɵTreeNodeCssClassEnum, ɵTreeNodeCssVariableEnum } from '../../enums';
import { ɵTreeNodesDepthState } from '../../states';
Expand All @@ -26,7 +26,13 @@ import { TreeViewComponent } from '../tree-view';
encapsulation: ViewEncapsulation.None,
host: {
class: 'os-tree-node'
}
},
providers: [
{
provide: ɵTREE_NODE_COMPONENT,
useExisting: TreeNodeComponent
}
]
})
export class TreeNodeComponent<T = any> extends ɵOsBaseViewComponent implements OnInit {
/** Is disabled? */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
ViewEncapsulation
} from '@angular/core';
import { ɵOsBaseViewComponent } from '../../../../core';
import { ɵTREE_VIEW_COMPONENT } from '../../constants';
import { TreeViewNodeDirective } from '../../directives/node.directive';
import { ɵNodeTemplateContext } from '../../interfaces';
import {
Expand Down Expand Up @@ -74,6 +75,10 @@ import {
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [
{
provide: ɵTREE_VIEW_COMPONENT,
useExisting: TreeViewComponent
},
ɵTreeNodesState,
ɵTreeNodesDepthState,
TreeNodesExpansionService,
Expand Down
2 changes: 2 additions & 0 deletions src/app/library/modules/tree-view/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export * from './tree-node-component.token';
export * from './tree-node.token';
export * from './tree-view-component.token';

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/** @internal */
// This used for fix error NG3003
export const ɵTREE_NODE_COMPONENT = 'TREE_NODE_COMPONENT';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/** @internal */
// This used for fix error NG3003
export const ɵTREE_VIEW_COMPONENT = 'TREE_VIEW_COMPONENT';
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import {
Directive,
HostBinding,
HostListener
HostListener,
Inject
} from '@angular/core';
import { ɵDestroyService } from '../../../core';
import { TreeNodeComponent, TreeViewComponent } from '../components';
import type { TreeNodeComponent, TreeViewComponent } from '../components';
import { ɵTREE_NODE_COMPONENT, ɵTREE_VIEW_COMPONENT } from '../constants';

/** Marks element as the expander (action trigger) of the TreeNode. */
@Directive({
Expand All @@ -26,7 +28,9 @@ export class TreeNodeTriggerDirective {
}

constructor(
@Inject(ɵTREE_VIEW_COMPONENT)
private readonly treeView: TreeViewComponent,
@Inject(ɵTREE_NODE_COMPONENT)
private readonly treeNode: TreeNodeComponent
) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import {
Directive,
DoCheck,
EmbeddedViewRef,
Inject,
Injector,
Input,
OnChanges,
SimpleChanges,
ViewContainerRef
} from '@angular/core';
import { TreeViewComponent } from '../components';
import { ɵTREE_NODE } from '../constants';
import type { TreeViewComponent } from '../components/tree-view';
import { ɵTREE_NODE, ɵTREE_VIEW_COMPONENT } from '../constants';
import { ɵNodeTemplateContext } from '../interfaces';

/** @internal */
Expand All @@ -29,6 +30,7 @@ export class ɵTreeNodeOutletDirective<T = any> implements OnChanges, DoCheck {
private viewRef: EmbeddedViewRef<ɵNodeTemplateContext<T>>;

constructor(
@Inject(ɵTREE_VIEW_COMPONENT)
private readonly treeView: TreeViewComponent,
private readonly viewContainer: ViewContainerRef,
private readonly injector: Injector
Expand Down
8 changes: 4 additions & 4 deletions src/app/library/modules/window/classes/dynamic-window-ref.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ComponentRef } from '@angular/core';
import { BehaviorSubject, Observable, Subject } from 'rxjs';
import { ɵIdGenerator } from '../../../core';
import { DraggableDirective } from '../../drag-and-drop';
import { ResizableDirective } from '../../resizer';
import { ɵDynamicWindowComponent } from '../components';
import { DynamicWindowConfig, DynamicWindowRef } from '../interfaces';
import type { DraggableDirective } from '../../drag-and-drop';
import type { ResizableDirective } from '../../resizer';
import type { ɵDynamicWindowComponent } from '../components';
import type { DynamicWindowConfig, DynamicWindowRef } from '../interfaces';

/** @internal */
export class ɵDynamicWindowRefModel implements DynamicWindowRef {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Directive, DoCheck, HostBinding } from '@angular/core';
import { ɵDynamicWindowCssClassEnum as CssClass } from '../../../enums';
import { ɵStateManager } from '../services';
import { ɵStateManager } from '../services/state-manager.service';

/** @internal */
@Directive({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { ChangeDetectorRef, Directive, ElementRef, HostBinding } from '@angular/
import { debounceTime, filter, takeUntil } from 'rxjs';
import { ɵDestroyService, ɵElementResizingObserver } from '../../../../../core';
import { ɵDynamicWindowCssVariableEnum as CssVariable } from '../../../enums';
import { DynamicWindowConfig } from '../../../interfaces';
import { ɵMergedConfigService } from '../services';
import type { DynamicWindowConfig } from '../../../interfaces/config.interface';
import { ɵMergedConfigService } from '../services/merged-config.service';

/** @internal */
@Directive({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ import { AfterViewInit, Directive, ElementRef, inject } from '@angular/core';
import { filter, forkJoin, of, switchMap, take, takeUntil } from 'rxjs';
import { ɵDestroyService } from '../../../../../core';
import { DragStrategyByAxisProperties, DraggableDirective } from '../../../../drag-and-drop';
import { ɵDynamicWindowRefModel } from '../../../classes';
import { DYNAMIC_WINDOW_REF } from '../../../data';
import { ɵDynamicWindowRefModel } from '../../../classes/dynamic-window-ref';
import { DYNAMIC_WINDOW_REF } from '../../../data/dynamic-window-ref.token';
import { ɵDynamicWindowCssVariableEnum as CssVariable } from '../../../enums';
import { DynamicWindowConfig } from '../../../interfaces';
import { ɵExitFromFullscreenHelper } from '../helpers';
import { ɵMergedConfigService } from '../services';
import { DynamicWindowConfig } from '../../../interfaces/config.interface';
import { ɵExitFromFullscreenHelper } from '../helpers/exit-from-fullscreen-by-dragging.helper';
import { ɵMergedConfigService } from '../services/merged-config.service';

/** @internal */
@Directive({
selector: 'os-title-bar[osDynamicWindowDraggable]'
selector: 'os-title-bar[osDynamicWindowDraggable]',
exportAs: 'osWindowDraggable'
})
export class ɵDynamicWindowDraggableDirective extends DraggableDirective implements AfterViewInit {
public get _windowElement(): HTMLElement {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import { takeUntil } from 'rxjs';
import { ɵDestroyService } from '../../../../../core';
import { ResizableDirective, ɵResizerFactory } from '../../../../resizer';
import { ɵDynamicWindowCssVariableEnum as CssVariable } from '../../../enums';
import { DynamicWindowConfig } from '../../../interfaces';
import { ɵMergedConfigService } from '../services';
import { DynamicWindowConfig } from '../../../interfaces/config.interface';
import { ɵMergedConfigService } from '../services/merged-config.service';

/** @internal */
@Directive({
selector: 'os-window[osDynamicWindowResizable]',
exportAs: 'osWindowResizable',
providers: [
ɵResizerFactory
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<os-window
#resizableDir="osWindowResizable"
osDynamicWindowCssVariablesBinding
osDynamicWindowCssClassesBinding
osDynamicWindowResizable
Expand All @@ -12,6 +13,7 @@
(osResizeStart)="changeDetector.detach()"
(osResizeEnd)="changeDetector.reattach()">
<os-title-bar
#draggableDir="osWindowDraggable"
osDynamicWindowDraggable
[isActive]="windowRef.isActive"
[style.display]="_titleBarDisplayAttr"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ import { ɵDynamicWindowRefModel } from '../../classes';
import { DYNAMIC_WINDOW_REF } from '../../data';
import { DynamicWindowConfig } from '../../interfaces';
import { WindowComponent } from '../window';
import { ɵDynamicWindowDraggableDirective, ɵDynamicWindowResizableDirective } from './directives';
import type {
ɵDynamicWindowDraggableDirective,
ɵDynamicWindowResizableDirective
} from './directives';
import { ɵDynamicStateManager, ɵMergedConfigService, ɵStateManager } from './services';

/**
Expand Down Expand Up @@ -73,10 +76,10 @@ export class ɵDynamicWindowComponent implements OnInit, AfterViewInit, OnDestro
@ViewChild(WindowComponent, { read: ElementRef })
private readonly windowElementRef: ElementRef<HTMLElement>;

@ViewChild(ɵDynamicWindowDraggableDirective, { static: true })
@ViewChild('draggableDir', { static: true })
private readonly draggableDirective: ɵDynamicWindowDraggableDirective;

@ViewChild(ɵDynamicWindowResizableDirective, { static: true })
@ViewChild('resizableDir', { static: true })
private readonly resizableDirective: ɵDynamicWindowResizableDirective;

private readonly baseZIndex: number = 1000;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Inject, Injectable } from '@angular/core';
import { BehaviorSubject, filter, map, Observable, skip } from 'rxjs';
import { ɵDynamicWindowRefModel } from '../../../classes';
import { DYNAMIC_WINDOW_REF } from '../../../data';
import { BehaviorSubject, Observable, filter, map, skip } from 'rxjs';
import { ɵDynamicWindowRefModel } from '../../../classes/dynamic-window-ref';
import { DYNAMIC_WINDOW_REF } from '../../../data/dynamic-window-ref.token';
import { ɵDynamicStateEnum } from '../../../enums';

/** @internal */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { Inject, Injectable } from '@angular/core';
import { combineLatest, map, Observable, shareReplay } from 'rxjs';
import { ɵDynamicWindowRefModel } from '../../../classes';
import { DYNAMIC_WINDOW_REF, DYNAMIC_WINDOW_SHARED_CONFIG as SHARED_CONFIG } from '../../../data';
import { ɵMergeConfigs } from '../../../helpers';
import { DynamicWindowConfig } from '../../../interfaces';
import { Observable, combineLatest, map, shareReplay } from 'rxjs';
import { ɵDynamicWindowRefModel } from '../../../classes/dynamic-window-ref';
import { DYNAMIC_WINDOW_REF } from '../../../data/dynamic-window-ref.token';
import {
DYNAMIC_WINDOW_SHARED_CONFIG as SHARED_CONFIG
} from '../../../data/shared-dynamic-window-config.token';
import { ɵMergeConfigs } from '../../../helpers/configs-merger.helper';
import type { DynamicWindowConfig } from '../../../interfaces/config.interface';

/** @internal */
@Injectable()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Inject, Injectable } from '@angular/core';
import { ɵDynamicWindowRefModel } from '../../../classes';
import { DYNAMIC_WINDOW_REF } from '../../../data';
import { ɵDynamicWindowRefModel } from '../../../classes/dynamic-window-ref';
import { DYNAMIC_WINDOW_REF } from '../../../data/dynamic-window-ref.token';
import { ɵDynamicStateEnum } from '../../../enums';
import { ɵDynamicStateManager } from './dynamic-state-manager.service';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { InjectionToken } from '@angular/core';
import { DynamicWindowRef } from '../interfaces';
import type { DynamicWindowRef } from '../interfaces';

/** An injection token that can be used to get window reference inside your component */
export const DYNAMIC_WINDOW_REF: InjectionToken<DynamicWindowRef> = new InjectionToken(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { InjectionToken } from '@angular/core';
import { Observable } from 'rxjs';
import { DynamicWindowConfig } from '../interfaces';
import type { DynamicWindowConfig } from '../interfaces';

/** An injection token that can be used to get shared config of dynamic windows */
export const DYNAMIC_WINDOW_SHARED_CONFIG:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DynamicWindowConfig } from '../interfaces';
import type { DynamicWindowConfig } from '../interfaces';

// FIXME: Investigate is it might be simplified
/** @internal */
Expand Down
4 changes: 2 additions & 2 deletions src/app/library/modules/window/interfaces/config.interface.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Type } from '@angular/core';
import { CssCoordinate } from '../../../core';
import { DraggerConfig } from '../../drag-and-drop';
import { ResizerConfig, ResizerEnum } from '../../resizer';
import type { DraggerConfig } from '../../drag-and-drop';
import type { ResizerConfig, ResizerEnum } from '../../resizer';
import { DynamicWindowFullscreenOffset } from './fullscreen-offset.interface';

/** The parameters to set up a dynamic window and pass some custom data for the component which will be rendered inside */
Expand Down
2 changes: 1 addition & 1 deletion src/app/library/tsconfig.lib.prod.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "./tsconfig.lib.json",
"angularCompilerOptions": {
"compilationMode": "full"
"compilationMode": "partial"
}
}

0 comments on commit eb7c8b4

Please sign in to comment.