projects/i-components/src/lib/components/xam-tile-manager/xam-tile-manager.service.ts
Properties |
|
Methods |
Accessors |
notifyTileResizing | ||||||
notifyTileResizing(value: boolean)
|
||||||
Notify XamTile that is a resizing in progress
Parameters :
Returns :
void
|
notifyTileSwapped | ||||||
notifyTileSwapped(component: XamTileComponent)
|
||||||
Notify XamTile swapped
Parameters :
Returns :
void
|
notifyXamTileManagerStateChanged | ||||||
notifyXamTileManagerStateChanged(component: XamTileComponent)
|
||||||
Notify XamTile current state changed
Parameters :
Returns :
void
|
Private stateTileChanged |
Type : Subject<XamTileComponent>
|
Default value : new Subject<XamTileComponent>()
|
Subject to handle the tile state It should be used to notify the XamTileManager about a tile that is maximized or minimized |
Public targetTile |
Type : XamTileModel
|
Swap Target Tile model |
Private tileResizing |
Type : Subject<boolean>
|
Default value : new Subject<boolean>()
|
Subject to handle the resizing of the tiles |
xamTileManagerRef |
Type : any
|
A reference to the manager component |
xamTilesCollection |
Type : []
|
Default value : []
|
XamTilesCollection |
tileResizingEvent |
gettileResizingEvent()
|
Subscription event to get if there is a resizing in progress
Returns :
Observable<boolean>
|
tileStateChangeEvent |
gettileStateChangeEvent()
|
Subscription event to handle the XamTile state changed
Returns :
Observable<XamTileComponent>
|
import { Injectable } from '@angular/core';
import { TileSwappedEventArgs, XamTileModel } from '@mobilize/wms-framework';
import { Observable, Subject } from 'rxjs';
import { XamTileComponent } from '../xam-tile/xam-tile.component';
@Injectable()
export class XamTileManagerService {
/**
* Swap Target Tile model
*
* @type {XamTileModel}
* @memberof XamTileManagerService
*/
public targetTile: XamTileModel;
/**
* A reference to the manager component
*
* @type {XamTileManagerComponent}
* @memberof XamTileManagerService
*/
xamTileManagerRef: any;
/**
* XamTilesCollection
*
* @memberof XamTileManagerService
*/
xamTilesCollection = [];
/**
* Subject to handle the tile state
* It should be used to notify the XamTileManager
* about a tile that is maximized or minimized
*
* @private
* @type {Subject<XamTileComponent>}
* @memberof XamTileManagerService
*/
private stateTileChanged: Subject<XamTileComponent> =
new Subject<XamTileComponent>();
/**
* Subject to handle the resizing of the tiles
*
* @private
* @type {Subject<XamTileComponent>}
* @memberof XamTileManagerService
*/
private tileResizing: Subject<boolean> = new Subject<boolean>();
/**
* Subscription event to get if there is a resizing in progress
*
* @readonly
* @type {Observable<boolean>}
* @memberof XamTileManagerService
*/
get tileResizingEvent(): Observable<boolean> {
return this.tileResizing.asObservable();
}
/**
* Notify XamTile that is a resizing in progress
*
* @param {boolean} value
* @memberof XamTileManagerService
*/
notifyTileResizing(value: boolean): void {
this.tileResizing.next(value);
}
/**
* Subscription event to handle the XamTile state changed
*
* @readonly
* @type {Observable<XamTileComponent>}
* @memberof XamTileManagerService
*/
get tileStateChangeEvent(): Observable<XamTileComponent> {
return this.stateTileChanged.asObservable();
}
/**
* Notify XamTile current state changed
*
* @param {*} void
* @memberof XamTileManagerService
*/
notifyXamTileManagerStateChanged(component: XamTileComponent): void {
this.stateTileChanged.next(component);
}
/**
* Notify XamTile swapped
*
* @param {*} void
* @memberof XamTileManagerService
*/
notifyTileSwapped(component: XamTileComponent): void {
if (this.targetTile && this.targetTile !== component.model) {
const eventArgs: TileSwappedEventArgs = new TileSwappedEventArgs(
component.model,
null,
this.targetTile,
component
);
const params = { sender: this.xamTileManagerRef.model, e: eventArgs };
this.xamTileManagerRef.tileSwappedHandler(params.sender, params.e);
}
this.targetTile = null;
}
}