0.0.11 • Published 5 years ago

@bnuby/ng-bnuby v0.0.11

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

NgBnuby Library

Installation

npm install ng-bnuby --save

Usage

step 1: Import NgBnubyModule into your app.module.ts

  @NgModule({
    imports: [
      NgBnubyModule
    ]
  })

step 2:
You are Well Done!.
Now you can Add your favorite Component. (prefix with: ng-bnuby)

<body>
  <ng-bnuby-datatable></ng-bnuby-datatable>
  <ng-bnuby-image-upload></ng-bnuby-image-upload>
</body>

Components List

1. Datatable

2. Image Upload

3. Multi Select

4. Side Bar

Components


1. Datatable Component

Dom

example.component.html

<ng-bnuby-datatable
  [table]="table"
  [headers]="headers"
  [isLoading]="isLoading"
  [itemSet]="itemSet"
></ng-bnuby-datatable>

typescript

example.component.ts

Datatable main config

table: Datatable = {
  style: {
    'background-color': 'white'
  }
};

Define Header

headers: DatatableHeaders = [
  {
    title: 'Name',
    key: 'h1'
  },
  {
    title: 'Test2',
    key: 'h2'
  },
  {
    title: 'Tools',
    key: 'tools'
  }
];

Define thead style

theadStyle: { [klass: string]: any } = {
  'border-bottom': '1px solid gray'
};

Define th style

thStyle: { [klass: string]: any } = {
  padding: '10px 10px'
};

Define loading text

loadingText: string = 'Data Loading';

Define no Data text

noDataText: string = 'No Data';

Define Table Item

itemSet: DatatableRows =  [
    {
      _item: {},
      h1: {
        title: 'Hello World'
      },
      h2: {
        title: 'Temporary 2'
      },
      tools: {
        buttons: [
          {
            html: '<i class=\'fa fa-edit\'/i>',
            callback: item => {
              console.log(item);
            }
          },
          {
            html: '<i class=\'fa fa-trash\'/i>',
            callback: item => {
              console.log(item);
            }
          },
          {
            html: '<i class=\'fa fa-info\'/i>',
            callback: item => {
              console.log(item);
            }
          }
        ]
      }
    }
  ]

Methods / Attributes

AttributeDescriptiontypedefault value
tableUse to define datatable, ex: title, style, classDatatable{ style: { 'background-color': 'white' } };
theadStyleUse to define thead StyleCSSStyleDeclaration{ 'border-bottom': '1px solid gray' }`
thStyleUse to define th StyleCSSStyleDeclaration{ padding: '10px 10px' }`
tdStyleUse to define td StyleCSSStyleDeclaration{ padding: '5px 10px', 'border-bottom': '1px solid gray' }
* headersUse to define datatable headerDatatableHeaders{ title: 'Name', key: 'h1' }
loadingTextUse to define loading textstringData Loading
noDataTextUse to define no data textstringNo Data
* itemSetUse to define Table DataDatatableRows{ ... }
isLoadingUse to control loading textbooleanfalse

2. Image Upload Component

Use ng-bnuby-image-upload tag selector

<ng-bnuby-image-upload></ng-bnuby-image-upload>

Methods / Attributes

AttributeDescriptiontypedefault value
titleGiven a title for the image uploadstringImage Upload
simpleIf false Use the title attr and size attrbooleanfalse
sizeUse to define image upload sizesm, md, lg, fluidmd
uploadURL (Require)The url that file upload.string''
uploadedCallbackUse to receive the request callback and return a string for form control value. If status true, mean upload succses, otherwise mean fail.Funtion | (status: boolean, res: any) => stringnull
zIndexUse to change content (image) z-indexnumber0

3. Multi Select Component

Use ng-bnuby-multi-select multi selector

<ng-bnuby-multi-select></ng-bnuby-multi-select>

Methods / Attributes

AttributeDescriptiontypedefault value
titleGiven a title for the image uploadstringImage Upload
simpleIf false Use the title attr and size attrbooleanfalse
optionsUse to define the optionsngBnubyOptions { title: 'example', value: 'example', }
placeholderUse to define placeholderstringexample

4. Side Bar Component

Use ng-bnuby-side-bar selector

<ng-bnuby-side-bar></ng-bnuby-side-bar>

Methods / Attributes

AttributeDescriptiontypedefault value
sideBarItemsUse SideBarItems to define the sidebarSideBarItemsBelow Example 1

Example 1: Basic Usage

 sideBarItems: SideBarItems = [
  [
    {
      title: 'Home',
      icon: 'fa-home',
      path: '/home'
    },
    {
      title: 'User',
      icon: 'fa-user',
      children: [
        {
          title: 'Management',
          icon: 'fa-text',
          path: '/user/user-mgt'
        },
        {
          title: 'Setting',
          icon: 'fa-text',
          path: '/user/setting'
        },
      ],
    },
  ]
 ]
0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago