2.1.6 • Published 14 days ago

cats4u-lib v2.1.6

Weekly downloads
-
License
-
Repository
-
Last release
14 days ago

Cats4uLib Angular Library

Cats4uLib is a angular library which has multiple modules and easy to integrate in angular project

  1. tree structure in tabular form
  2. code editor
  3. single select
  4. multi select
  5. input dropdown

Demo

link will be add soon

Setup

npm i cats4u-lib

code editor module has dependency on 3rd party library .if you want to use then need to install this dependency

npm i @materia-ui/ngx-monaco-editor --force

Usage Overview

import { Cats4uLibModule } from 'cats4u-lib'
              or
import { CatsTreeViewModule } from 'cats4u-lib/cats-tree-view'

@NgModule({
module: [Cats4uLibModule]
})

Tree Structure

     <cats-tree-view
         [tableHeader]="tableHeader"
         [iconConfig]="iconConfig"
         [tableData]="newsitesDetails"
         [icons]="icons"
         (selectFolder)="newSelectFolder($event)"
         (selectedRow)="selectedRow($event)"
         (singleClickEvent)="singleClickOnRow($event)"
         (doubleClickEvent)="doublClickOnRow($event)"
         (treeStructureData)="treeStructureData($event)"
         [treeType]="'folder'"
         [showExpandedIcon]="showExpandedIcon">
     </cats-tree-view>
tableHeader = [
  {
    headerName: "name",
    field: "name",
    isActive: true,
  },
  {
    headerName: "",
    field: "region.name",
    isActive: true,
    buttonRenderer: InputRendererComponent,
  },
  {
    headerName: "Tenant",
    field: "slug",
    isActive: true,
  },
  {
    headerName: "No of Device",
    field: "devices_count",
    isActive: true,
  },
];
table header

table header pass into tableHeader array which has 4 keys

  1. headerName - pass string which you want to display as header of table
  2. field - contains key which value you want to display in a row (this key must be exist in tableData array).
  3. isActive - set boolean value which means you want to display this header or not (you can hide/show header dynamically using this key value)
  4. buttonRenderer - you can pass component for custom style or perform some action in a cell
icons = {
  parentIcon: "/assets/svg-icon/folder.svg",
  parentExpandedIcon: "/assets/svg-icon/folder-open.svg",
  childIcon: "",
  checkboxEnable: true,
  enableRenameOption: true,
  rowSelection: "single",
  treeType: "folder",
  parentCheckboxSelection: true,
  multipleValueCheck: false,
  fieldArray: [
    {
      field: "model_type",
      value: "rack",
      icon: "/assets/svg-icon/device.svg",
      expandedIcon: "/assets/svg-icon/device.svg",
    },
  ],
};

icons input property used for initial data rendering only or we can say parent data

  1. parentIcon - parentIcon hold icon for first column
  2. parentExpandedIcon - hold icon for first column which is visible after child data called or want to expand
  3. rowSelection - can pass 'single' or 'multiple'
  4. treeType - can pass 'folder' or 'checkbox'
  5. fieldArray - change parent icon based on field value
  6. multipleValueCheck - select one or more checkbox
iconConfig = {
  field: "model_type",
  value: "device",
  checkboxEnable: true,
  enableRenameOption: true,
  multipleValueCheck: false,
  fieldArray: [
    {
      field: "model_type",
      value: "rack",
      icon: "/assets/svg-icon/device.svg",
    },
  ],
};

iconConfig input property for child data or row .whenever you expand parent data coreesponding child data append in tree structure table data. let's understand child data properties-

  1. field - if you want to add icon only single field than you can declare field otherwise use fieldArray
  2. value - pass value related to field .show icon based on this value
  3. checkboxEnable - pass boolean value for show/hide checkbox
  4. multipleValueCheck - enable/disable multiple checkbox selection
  5. fieldArray - show icon based on field value selection
Code Editor
<cats-code-editor
      [sourceCode]="sourceCode"
      [width]="width"
      [height]="height"
      [theme]="theme"
      [isMinimap]="isMinimap"
      [lineNumbers]="lineNumbers"
      [scrollBarSize]="scrollBarSize"
      [language]="'json'"
      (languageCode)="languageCode($event)"
    ></cats-code-editor>

sourceCode - pass data which you want to display width - width of the editor height - height of the editor theme - theme of the editor. 2 types of theme exist 1. vs-dark 2. vs-light or vs isMinimap - display minimap on right hand side lineNumbers - show line numbers in editor language - pass language type which you want to display 1.HTML 2.javascript 3.json 4.typescript languageCde - return updated code

Single Select Dropdown
Multi Select Dropdown
<cats-multi-select-dropdown
  [dropdownList]="optionsList"
  [selectSettings]="selectSetting"
  [placeholder] = "placeholder"
  [selectedItems]="selectedItems"
  (onItemsChange)="onItemsChange($event)"
></cats-multi-select-dropdown>

dropdownList - pass list as array of object selectSettings - has 2 fields 1. idField - pass key than this key represent as unique id for dropdown list 2. textField - pass key than this key text visible in dropdown list

selectSetting = {
  idField: "organisation_id",
  textField: "organisation_name",
};

onItemsChange - provide selected data placeholder - pass string which you want to display in placeholder selectedItems - pass as array of object same as options list

Input Dropdown
<cats-dropdown placeholderName="Enter Text" [optionsList]="optionsList"></cats-dropdown>
optionsList = [
  { id: 2, name: "alpha" },
  { id: 3, name: "gama" },
];

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.

2.1.6

14 days ago

2.1.5

16 days ago

2.1.4

1 month ago

2.1.3

1 month ago

2.1.2

2 months ago

2.1.1

2 months ago

2.0.1

2 months ago

2.0.0

2 months ago

1.9.5

2 months ago

1.9.4

2 months ago

1.9.3

3 months ago

1.9.2

3 months ago

1.9.1

3 months ago

1.9.0

4 months ago

1.8.9

4 months ago

1.8.8

4 months ago

1.8.7

4 months ago

1.8.6

4 months ago

1.8.5

4 months ago

1.8.2

5 months ago

1.8.3

5 months ago

1.8.1

5 months ago

1.8.0

5 months ago

1.7.9

5 months ago

1.7.8

5 months ago

1.7.7

5 months ago

1.7.6

5 months ago

1.7.5

5 months ago

1.7.4

5 months ago

1.7.3

5 months ago

1.7.2

6 months ago

1.7.1

6 months ago

1.6.5

6 months ago

1.6.0

6 months ago

1.5.9

6 months ago

1.5.8

6 months ago

1.5.7

6 months ago

1.5.6

6 months ago

1.5.5

6 months ago

1.5.4

6 months ago

1.5.3

6 months ago

1.5.2

6 months ago

1.5.1

7 months ago

1.5.0

7 months ago

1.4.0

7 months ago

1.3.9

7 months ago

1.3.8

7 months ago

1.3.5

7 months ago

1.3.4

7 months ago

1.3.3

7 months ago

1.3.2

7 months ago

1.3.1

7 months ago

1.2.9

8 months ago

1.2.8

8 months ago

1.2.7

8 months ago

1.2.6

8 months ago

1.2.5

8 months ago

1.1.5

8 months ago

1.1.4

8 months ago

1.1.3

8 months ago

1.1.2

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago

0.0.5

9 months ago

0.0.4

9 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago