0.0.1-demo-2 β€’ Published 2 years ago

ngx-table-nested v0.0.1-demo-2

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

Logo

Description

The ngx-table-nested angular library provides a powerful nested table built on top of @swimlane/ngx-datatable with the ability to collapse rows to display a second table with a different column configuration than the parent. It allows you to create flexible and organised user interfaces to display hierarchical and structured data.

Badge Badge Badge

πŸŒ’ Content

πŸ“– Requirements

brew install node 
npm install -g @angular/cli 
npm install @swimlane/ngx-datatable 

πŸͺ€ Usage

!IMPORTANT you need to have installed @swimlane/ngx-datatatable

Once you have installed ngx-table-nested, you can import it in your AppModule:

import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {NgxDatatableModule} from '@swimlane/ngx-datatable';
import {AppComponent} from './app.component';
import {NgxDatatableModule} from '@swimlane/ngx-datatable';
// Import your TableNestedComponent
import {TableNestedComponent} from 'ngx-table-nested';

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    NgxDatatableModule,
    // Specify TableNestedComponent as an import
    TableNestedComponent
  ],
  bootstrap: [AppComponent]
})
export class AppModule {
}

Or you can import it in your AppComponent (for this example):

import {Component, inject} from '@angular/core';
import {NgxDatatableModule} from '@swimlane/ngx-datatable';
import {TableNestedComponent} from '@ngx-table-nested';
import {NgxDatatableModule} from '@swimlane/ngx-datatable';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  standalone: true,
  imports: [NgxDatatableModule, TableNestedComponent],
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
}

Configure styles

  • Now, let's import lib styles, include default nested-table CSS file into your `angular.json file:
  {
    "styles": [
      "node_modules/@nebular/theme/styles/prebuilt/default.css"
    ]
}

In your html

  • HTML
<ngx-table-nested
  [theme]="lightTheme"
  [dataTable]="data"
  [columns]="columnConfig"
  [childrenKey]="'ingredients'"
  [childrenColumns]="childrenColumnConfig"
  [actionConfig]="actionConfig"
/>

πŸ›  Features

  • Use simplify
  • Nested tables with different (or the same) column configurations
  • Light/Dark theme support
  • Client side render
  • Standalone components standards
  • Jasmine test on 83% coverage
  • Column template support (images, tags, text, buttons, icons)

🌐 API

Components

TableNestedComponent

  • Inputs

InputDefaultTypeDescription
dataTableundefinedTableConfigModelConfiguration data for the table
limit5numberNumber of rows of show in the table
themelightTableThemeEnumTheme of the table

  • Outputs

OutputDefaultTypeDescription
onRowClickEventEmitter<TableEventRowClick>Callback to invoke when row is clicked on
onRowClickChildrenEventEmitter<TableEventRowClick>Callback to invoke when the row of the child table is clicked

TableBasicComponent

  • Inputs

InputDefaultTypeDescription
dataTableundefinedTableConfigModelConfiguration data for the table
limit5numberNumber of rows of show in the table
themelightTableThemeEnumTheme of the table

  • Outputs

OutputDefaultTypeDescription
onRowClickEventEmitter<TableEventRowClick>Callback to invoke when row is clicked on

Enums

  • ContentTypeColumnEnum
enum ContentTypeColumnEnum {
  'icon' = 'icon',
  'tag' = 'tag',
  'text' = 'text',
  'image' = 'image'
}
  • ActionTypeEnum
enum ActionTypeEnum {
  update = 'update',
  delete = 'delete',
  create = 'create',
  positive = 'positive',
  negative = 'negative',
}
  • TableThemeEnum
enum TableThemeEnum {
  'light' = 'light',
  'dark' = 'dark'
}

Interface

  • TableEventRowClick

propertiesDefaultTypeDescription
typeupdateActionTypeEnumType defining the action
rowanyTGeneric type received by the interface

  • TableColumnModel

propertiesDefaultTypeDescription
fieldundefinedstringproperty to display in the cell
headerundefinedstringtext in column header
sortfalsebooleanenable sorting
resizefalsebooleanenable resize
grow1numbercolumn width in fraction
typetextContentTypeColumnEnumcolumn type

  • TableIconActionColumnModel

propertiesDefaultTypeDescription
iconundefinedstringicon name
classundefinedstringicon class

  • TableActionColumnModel

propertiesDefaultTypeDescription
labelundefinedstringtext in button
iconundefinedTableIconActionColumnModelicon in button
typeupdateActionTypeEnumtype of action
tooltipundefinedstringtooltip to show
clickundefinedFunctionfunction that invokes after the click

  • TableActioneConfigModel

propertiesDefaultTypeDescription
data[]TableActionColumnModel[]list of actions
headerAccionesstringtext in header column

  • TableMessageConfigModel

propertiesDefaultTypeDescription
emptyundefinedstringis displayed when there is no data
errorundefinedstringis displayed when an error has occurred

  • TableExtraConfigModel

propertiesDefaultTypeDescription
actionsundefinedTableActioneConfigModelactions config
messagesundefinedTableMessageConfigModelmessages config
configundefinedTableCellViewConfigModelcolumn types config
selectionundefinedSelectionTypesection type
sortTypesingleSortTypesort type
columnModeflexColumnModecolumn mode type

  • TableChildrenConfigModel

propertiesDefaultTypeDescription
fieldundefinedstring
columns[]TableColumnModel[]
extraundefinedTableExtraConfigModel
limit5number

  • TableConfigModel

propertiesDefaultTypeDescription
datachildrenT
columns[]TableColumnModel[]
extraundefinedTableExtraConfigModel
children5TableChildrenConfigModel

πŸš€ Building

Generate installer file (.tgz) locally

  • Install dependency locally

npm install 
  • Compile library

ng build ngx-table-nested 
  • Generate installer

npm pack ngx-table-nested 

πŸ“ˆ Stats

Most Used Languages

GitHub Langs

1.30.13-rc

2 years ago

1.29.9-rc

2 years ago

1.30.9-rc

2 years ago

1.28.9-rc

2 years ago

1.26.8-rc

2 years ago

1.25.6-rc

2 years ago

1.25.8-rc

2 years ago

1.25.7-rc

2 years ago

1.25.5-rc

2 years ago

1.2.0

2 years ago

0.2.0

2 years ago

0.0.1-demo-10

2 years ago

0.0.1-demo-7

2 years ago

0.0.1-demo-5

2 years ago

0.0.1-demo-4

2 years ago

0.0.1-demo-2

2 years ago