3.0.0 • Published 5 years ago

biplab-notifier v3.0.0

Weekly downloads
69
License
SEE LICENSE IN LI...
Repository
github
Last release
5 years ago

biplab-notifier

Reference to use biplab-notifier

Selector

biplab-notifier

Properties

NameDescription
@Input() customTemplate: TemplateRefDesign your own template and pass that to use
@Input() notification: NotificationYou must have to pass as instance of Notification
@Input() notifierTemplates: NotifierTemplateYou can pass template to add icon for notification type, change ok button with something else, or add template in body or header

NotifierTemplate

NameDescription
typeIcon?: TemplateRefWill be seen with the title text
head?: TemplateRefWill overried the existing head
body?: TemplateRefWill overried the existing body
button?: TemplateRefWill overried the existing default buttons
footer?: TemplateRefWill add footer
titleTemplate?: TemplateRefWill replace existing title template

Notification is a class, which contain all configuration need to execute biplab-notifier

Notification attibutes

NameDescription
type: 'warn', 'error' , 'note' , 'success', 'help'You must have to specify the type
timer?: TimerYou can set duration for message, once set it will hide notification, Default setting will not hide notification
message: stringYou will use if you want to pass single value
message: string[]You will use if you want to pass multiple values
layoutType: 'single' or 'multi'Default is single, meaning you can only set data to message attribute, Always remember to set layoutType as 'multi' if you want to set list of values in notices attribute otherwise it will generate error
afterClosed: ObservableWill notify you whenever notifaction closed
afterOpened: ObservableWill notify you whenever notifaction opened
falseButton: stringChange text of false action button
trueButton: stringChange text of true action button
title: show or hideChange title visibility, default is show
closeButton: show or hideChange closeButton visibility, default is show
actionRow: show or hideChange actionRow visibility, default is show
body: show or hideChange body visibility, default is show
isDialog: booleanChange notifier to dialog, default is false
isSnack: booleanChange notifier to snackbar, default is false
disableOutsideClick: booleanPrevent closing dialog if clicked outside
header: stringAdd header text ( Only application of multi layout notifier )
titleText: stringSet title of your notification
css: CssOverride width, height, color, background color of notifier
actionButtons: NotificationButton[]These are the buttons appear in multi notification form
currentStatus: 'hide' or 'show'return the current status of notification
trueActionButton: NotificationButtonYou can access the true button properties

NotificationButton

NameDescription
text: stringWill be seen button label
disabled: booleanWill be seen disable button if set as true
type: 'button' or 'submit'Default is button
emitValue: anyThis is the value button will return after clicked
callBackFunction: { func: Function, param: any }[]You can bind the function list with the button

css

NameDescription
shadow: booleanWill enable shadow if set as true
position: top, buttom, left, right, centerWill place the notifier into mentioned place
background: stringchange background color in title bar
color: stringchange text color in title bar
width: stringchange the width of the notifier
height: stringchange the height of the notifier

Notification methods

NameDescription
showWill show the notification
hideWill hide the notification
buttonShadow('show''hide')Will hide or show shadow in button
buttonColorReverseWill change button font color into background and vise versa
buttonColorReverseWill change button font color into background and vise versa
defaultButtons(actionButtons?: NotificationButton[])Will add 2 buttons ( Yes and Cancel ) if not provided
applyThemeColorInTrueButtons()Will apply same color as applied in title
addNewButton(button: label: string)Will add new button

ng-content for followling selector available

  • notifierIcon
  • notifierTitle
  • notifierMessages
  • notifierTrueButton
  • notifierFalseButton
  • notifierFooter

In ng-template you can access notificationClose method will close the notification and data

<ng-template #custom let-message="data" let-notificationClose="notificationClose" >
  <div style="background: red; color: white; padding: 15px;">
  </div>
</ng-template>

Implementation 1 ( Getting started )

Import NotifierModule from biplab-notifier import { NotifierModule } from 'biplab-notifier

@NgModule({
  imports:      [ BrowserModule, FormsModule, NotifierModule ],
  declarations: [ AppComponent ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }

In component file import Notification from biplab-notifier and initilize it

// First Import Notification class
import { Notification } from 'biplab-notifier';

// Declare and Initiliza the variable
notification = new Notification()

// Now for testing, add following line to see message

constructor() {
    //Setup the type, it can be success, error, warn, note, or help
    this.notification.type = 'success';

    //Send message to display
    this.notification.message = 'You will see this message with success title';

    //Calling function to display message
    this.notification.show();
}

In Template file pass current notification instance ( HTML )

  <biplab-notifier [(notification)]="notification"></biplab-notifier>

Few examples are here

3.0.0

5 years ago

2.0.9

5 years ago

2.0.8

5 years ago

2.0.7

5 years ago

2.0.6

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago