0.2.0 • Published 5 years ago

@tp-ui/tp-window v0.2.0

Weekly downloads
-
License
-
Repository
-
Last release
5 years ago

ThingsPro Window

Features

Usages

1. Create a tp-window state config or write a config in template directly.

Example: create a config

const tpStateConfig: TpWindowStateConfig = new TpWindowStateConfig('stateId', 'stateName', 'STATE', 'settings');

Example: write config in template files.

<tp-window-state stateId="demoState" name="{{Demo State}}" type="CONTENT" icon="settings">  
</tp-window-state>

2. Setup tp-window

Notice: tp-window id and tp-window-state config is required.

<tp-window [name]="name" maxStateNumber="3" id="tpDemoId" [optionPortal]="portal" (stateChange)="onStateChange($event)">
  <tp-window-state [config]="tpStateConfig">
    <!-- Your DOM template -->
  <tp-window-state>
</tp-window>

3. Inject TpWindowService to manipulate your states.

constructor(public tpWindow: TpWindowService) {}
// Navigate a window to a state
this.tpWindow.navigateTo('windowId.stateId'); // windowId + '.' + stateId

// Show or hide progress bar
this.tpWindow.progressStart('tpDemoId');
this.tpWindow.progressComplete('tpDemoId');

// Show or hide state icon
this.tpWindow.setIcons([{stateUrl: 'tpDemoId.stateId',isShow: false}, {stateUrl: 'tpDemoId.stateId',isShow: false}]);

API Document

tp-window (TpWindowComponent)

PropertyTypeDescription
*windowId@Input stringThe identification for window
name@Input stringThe name will be showed on the title of component.
maxStateNumber@Input numberLimit the total number of icons on the tool bar. The rest of icons will be sorted to menu list as the number of icons exceeds it. This setting could be used to RWD.
loading@Input Observable<any>It Will show a loading bar before observable completed.
optionPortal@Input Portal<any>Add customized actions or information by using CdkPortal
stateChange@Output EventEmitter<WindowStateComponent>emit clicked state component.

tp-window-state (TpWindowStateComponent)

PropertyTypeDescription
*config@input TpWindowStateConfigState config.

TpWindowStateConfig

PropertyTypeDescription
stateIdstringThe identification for state.
namestringThe name will be showed on the menu item or tooltip.
typeTpWindowStateType'ACTION' 'STATE' 'CONTENT'
iconstringThe name of Angular Material Icon ,please see Icons

TpWindowService

MethodsDescription
navigateTo(stateUrl: string)Navigate a state of a window
progress(windowId: string, progress: Observable<any>)Show progress bar
progressStart(windowId: string)Show progress bar
progressComplete(windowId: string)Hide progress bar
setIcons(options: Array<{stateUrl: string, isShow: boolean}>)Hide a icon of a state
0.2.0

5 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago