17.2.1 • Published 1 month ago

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

Weekly downloads
-
License
-
Repository
-
Last release
1 month 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.2.1

1 month ago

17.1.11

3 months ago

17.2.0

3 months ago

17.1.10

4 months ago

17.1.9

4 months ago

17.1.8

4 months ago

17.1.7

4 months ago

17.1.6

5 months ago

17.1.4

5 months ago

17.1.5

5 months ago

17.1.3

5 months ago

17.1.2

5 months ago

17.1.1

5 months ago

17.1.0

5 months ago

17.0.3

5 months ago

17.0.2

5 months ago

17.0.1

5 months ago

17.0.0

6 months ago

16.1.1

7 months ago

16.1.3

7 months ago

16.1.2

7 months ago

14.10.7

7 months ago

14.7.2

9 months ago

14.10.6

7 months ago

14.7.3

9 months ago

14.10.5

8 months ago

14.7.4

9 months ago

14.10.4

8 months ago

14.10.3

8 months ago

14.9.3

9 months ago

14.5.0

9 months ago

14.10.2

8 months ago

14.9.2

9 months ago

14.5.1

9 months ago

14.10.1

9 months ago

14.9.1

9 months ago

14.7.0

9 months ago

14.5.2

9 months ago

14.10.0

9 months ago

14.9.0

9 months ago

14.7.1

9 months ago

16.1.0

8 months ago

14.8.1

9 months ago

14.6.3

9 months ago

14.8.2

9 months ago

14.8.3

9 months ago

14.6.0

9 months ago

14.11.0

7 months ago

14.6.1

9 months ago

14.8.0

9 months ago

14.6.2

9 months ago

16.0.0

8 months ago

14.1.0

1 year ago

14.3.0

1 year ago

14.2.0

1 year ago

14.0.4

1 year ago

14.0.5

1 year ago

1.4.0

2 years ago

1.3.10

2 years ago

1.3.13

2 years ago

1.3.14

2 years ago

1.3.11

2 years ago

1.3.12

2 years ago

1.3.15

2 years ago

1.3.16

1 year ago

14.0.1

1 year ago

14.0.2

1 year ago

14.0.3

1 year ago

1.3.9

2 years ago

1.3.7

2 years ago

1.3.8

2 years ago

1.3.6

2 years ago

1.3.5

2 years ago

1.3.4

2 years ago

1.3.3

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.9

2 years ago

1.2.10

2 years ago

1.2.0

2 years ago

1.2.8

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.1.2

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.3

3 years ago