17.8.3 • Published 10 months ago

@3kles/kles-material-table v17.8.3

Weekly downloads
-
License
-
Repository
-
Last release
10 months ago

@3kles/kles-material-table

@3kles/kles-material-table is a angular library to create table.

Changelog

Check out the changelog to check all the latest changes.

Models

Directives

  • KlesTableDirective -> Directive to build table
  • KlesTreetableDirective -> Directive to build tree table

Interfaces

IKlesCellFieldConfig

Interface to define the cell of a column, extends IKlesFieldConfig from @3kles/kles-material-dynamicforms

  • executeAfterChange?: (property?: string, row?: any, group?: UntypedFormGroup | UntypedFormArray) => Observable -> Execute something after the value of a cell is update

IKlesHeaderFieldConfig

Interface to define the header of a column, extends IKlesFieldConfig from @3kles/kles-material-dynamicforms

  • filterComponent?: Type -> Define a new filter component
  • filterClearable?: boolean -> Set if the button to clear the filter is visible
  • filterable?: boolean -> Set if the column is filterable
  • filterPredicate?: (value: any, filter: any) => boolean -> Define a new filter predicate for the column
  • sortable?: boolean -> Set if the column is sortable

KlesColumnConfig

Interface to manage column for table and lazy table

  • columnDef: string -> Set the column def of the column
  • sticky?: boolean -> Define if the column is sticky at the start
  • stickyEnd?: boolean -> Define if the column is sticky at the end
  • visible: boolean -> Define if the column is visible
  • disabled?: boolean -> Define if the column is disabled
  • name?: string -> Set the name of the column
  • ngClass?: any -> Define a css class for the table
  • filterable?: boolean -> Define if the column is filterable
  • sortable?: boolean -> Define if the column is sortable
  • resizable?: boolean -> Define if we can resize the column
  • headerCell: IKlesHeaderFieldConfig -> Define the header of the column
  • cell: IKlesCellFieldConfig -> Define the cell of the column
  • footerCell?: IKlesCellFieldConfig -> Define the footer of the column if there is one
  • canUnfold?: boolean -> Define if we can unfold this column on each cell
  • align?: AlignCell -> Align the content of cells for this column

KlesTreeColumnConfig

Interface to manage column for tree table, extends KlesColumnConfig

  • canExpand?: boolean -> Define if the column can be expand to see his children
  • paginator?: boolean -> Define a paginator for the children
  • paginatorOption?: { pageSize?: number; showFirstLastButtons?: boolean; hidePageSize?: boolean; pageSizeOptions?: number[] } -> Define the paginator options

KlesTableConfig

Interface to manage table

  • id?: string -> Id of the table
  • tableComponent: Type\ -> Component to create the table
  • columns: KlesColumnConfig[] -> Config of the columns
  • tableService: AbstractKlesTableService -> Service of the table
  • customMatPaginatorIntl?: Type\ -> Custom paginator to replace the default one
  • selectionMode?: boolean -> Set lines multiple selection
  • options?: Options\ -> Set options to the table
  • sortConfig?: Sort -> Define the sort config for sortable columns
  • hidePaginator?: boolean -> Set if the paginator is visible
  • pageSize?: number -> Define the number of lines
  • pageSizeOptions?: number[] -> Define the options for the number of lines to display
  • lineValidations?: ValidatorFn[] -> Define validators for the table lines
  • lineAsyncValidations?: AsyncValidatorFn[] -> Define async validators for the table lines
  • showFooter?: boolean -> Define if the footer is visible
  • ngClassRow?: (row: UntypedFormGroup) => any -> Set css class to use for the lines
  • multiTemplate?: boolean -> Define if the table have multi template
  • templateUnfold?: { disabled?: (row: UntypedFormGroup) => boolean; cells: (IKlesCellFieldConfig & { colspan?: number | Span, rowspan?: number })[]; multiUnfold?: boolean; } -> Define table unfold templates
  • templates?: { cells: (IKlesCellFieldConfig & { colspan?: number | Span, rowspan?: number })[], when?: ((index: number, rowData: any) => boolean) }[] -> Define table templates
  • dragDropRows?: boolean -> Set if we can drag and drop the lines
  • dragDropRowsOptions?: { autoScrollStep?: number; connectedTo?: string[]; dragDisabled?: (row: UntypedFormGroup) => boolean; dragPreview?: { matchSize?: boolean; component: Type; }; dragPlaceholder?: { component: Type; } } -> Set options for the drag and drop

Components

  • KlesUnfoldCellComponent -> Component to create a cell that can be unfold
  • KlesFormTextHeaderComponent -> Component to create a simple text header
  • KlesFormTextHeaderFilterComponent -> Component to create a text header with a filter
  • KlesTableComponent -> Component to create a table
  • KlesTreetableComponent\ -> Component to create a tree table
  • KlesLazyTableComponent -> Component to create a lazy table
  • KlesLazyTreetableComponent\ -> Component to create a lazy tree table

Install

npm

npm install --save @3kles/kles-material-table

How to use

In the module

import { KlesMaterialTableModule } from '@3kles/kles-material-table';
...
@NgModule({
  imports: [
    KlesMaterialTableModule,
    ...
  ]
  ...
})

Example

const columns = [
      {
        columnDef: '#select', sticky: true, visible: true,
        headerCell: {
          type: 'checkbox',
          name: '#select',
          component: KlesFormCheckboxComponent,
          indeterminate: false,
        } as IKlesFieldConfig,
        cell: {
          type: 'checkbox',
          name: '#select',
          component: KlesFormCheckboxComponent,
          indeterminate: false,
        } as IKlesFieldConfig,
      },
      {
        columnDef: 'beginvalue',
        visible: true, sticky: true,
        filterable:true,
        resizable: true,
        headerCell: {
          type: 'input',
          name: 'beginvalue',
          component: KlesFormLabelComponent,
          value: 'Begin',
          pipeTransform: [{
            pipe: new UpperCasePipe
          }]
        } as IKlesFieldConfig
      },
      ...
        
];

const lines = [ { beginvalue: 1 },{ beginvalue: 10} ];

 const tableConfig = {
      tableComponent: KlesTableComponent,
      columns: this.columns,
      tableService: new KlesTableService()
}
<ng-container #table klesTable [tableConfig]="tableConfig" [lines]="lines"></ng-container>

Check the documentation to use component and directive.

Tests

npm install
npm test

License

MIT

17.8.3

10 months ago

17.8.2

10 months ago

17.8.1

10 months ago

17.8.0

10 months ago

17.7.0

11 months ago

17.6.4

11 months ago

17.6.1

11 months ago

17.6.3

11 months ago

17.6.2

11 months ago

17.3.2

1 year ago

17.3.1

1 year ago

17.3.4

1 year ago

17.3.3

1 year ago

17.4.1

1 year ago

17.4.0

1 year ago

17.5.0

1 year ago

17.5.2

1 year ago

17.5.1

1 year ago

17.5.4

1 year ago

17.5.3

1 year ago

17.6.0

1 year ago

17.3.0

1 year ago

17.2.1

1 year ago

17.1.11

1 year ago

17.2.0

1 year ago

17.1.10

2 years ago

17.1.9

2 years ago

17.1.8

2 years ago

17.1.7

2 years ago

17.1.6

2 years ago

17.1.4

2 years ago

17.1.5

2 years ago

17.1.3

2 years ago

17.1.2

2 years ago

17.1.1

2 years ago

17.1.0

2 years ago

17.0.3

2 years ago

17.0.2

2 years ago

17.0.1

2 years ago

17.0.0

2 years ago

16.1.1

2 years ago

16.1.3

2 years ago

16.1.2

2 years ago

14.10.7

2 years ago

14.7.2

2 years ago

14.10.6

2 years ago

14.7.3

2 years ago

14.10.5

2 years ago

14.7.4

2 years ago

14.10.4

2 years ago

14.10.3

2 years ago

14.9.3

2 years ago

14.5.0

2 years ago

14.10.2

2 years ago

14.9.2

2 years ago

14.5.1

2 years ago

14.10.1

2 years ago

14.9.1

2 years ago

14.7.0

2 years ago

14.5.2

2 years ago

14.10.0

2 years ago

14.9.0

2 years ago

14.7.1

2 years ago

16.1.0

2 years ago

14.8.1

2 years ago

14.6.3

2 years ago

14.8.2

2 years ago

14.8.3

2 years ago

14.6.0

2 years ago

14.11.0

2 years ago

14.6.1

2 years ago

14.8.0

2 years ago

14.6.2

2 years ago

16.0.0

2 years ago

14.1.0

2 years ago

14.3.0

2 years ago

14.2.0

2 years ago

14.0.4

3 years ago

14.0.5

3 years ago

1.4.0

3 years ago

1.3.10

3 years ago

1.3.13

3 years ago

1.3.14

3 years ago

1.3.11

3 years ago

1.3.12

3 years ago

1.3.15

3 years ago

1.3.16

3 years ago

14.0.1

3 years ago

14.0.2

3 years ago

14.0.3

3 years ago

1.3.9

3 years ago

1.3.7

3 years ago

1.3.8

3 years ago

1.3.6

3 years ago

1.3.5

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.9

3 years ago

1.2.10

3 years ago

1.2.0

3 years ago

1.2.8

3 years ago

1.2.7

3 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.1.9

3 years ago

1.1.8

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.18

3 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.1.2

3 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.3

4 years ago