import { OnInit, AfterContentInit, AfterViewInit, Renderer, DoCheck, EventEmitter, ElementRef, QueryList, IterableDiffers } from '@angular/core'; import { CfCoreComponent } from '../core/core.component'; import { CfDatatablePagerComponent } from '../datatable-pager/datatable-pager.component'; import { CfDatatableColumnComponent } from '../datatable-column/datatable-column.component'; import { CfDatatableFilterComponent } from '../datatable-filter/datatable-filter.component'; import { CfDatatableRowsExpanderComponent } from '../datatable-rows-expander/datatable-rows-expander.component'; import { IconModel } from '../../models/icon/icon.model'; import { DatatableModel } from '../../models/datatable/datatable.model'; import { DatatableStylingModel } from '../../models/datatable/datatable-styling.model'; import { TemplateService } from '../../services/template-service/template.service'; /** *
CfDatatable component is built using * ngx-datatable, CfIcon and CfInput.
*
*
* import {{'{'}} DatatableModel {{'}'}} from 'cedrus-fusion'
* import {{'{'}} DatatableStylingModel {{'}'}} from 'cedrus-fusion'
* <cf-datatable></cf-datatable>
*
*
*/
export declare class CfDatatableComponent extends CfCoreComponent implements OnInit, AfterContentInit, AfterViewInit, DoCheck {
private _renderer;
elementRef: ElementRef;
/** @hidden
* List of datatable column components with column templates and names.
*/
tableColumns: QueryList{{'{'}}
* showTableFooter: boolean,
* showTableCount: boolean,
* showTablePager: boolean,
* headerHeight: any,
* footerHeight: any,
* rows: any[],
* rowHeight: any,
* columnMode: string,
* limit: number,
* expandable: boolean,
* rowExpand: string,
* detailsHeight: number,
* expandIcon: IconModel,
* collapseIcon: IconModel,
* selectable: boolean,
* sorted: any[],
* selected: any[],
* {{'}'}}
* Example:
*{{'{'}}
* showTableFooter: true,
* showTableCount: false,
* showTablePager: true,
* rows: [
* {{'{'}} name: 'Austin', city: 'London' {{'}'}},
* {{'{'}} name: 'Molly', city: 'Tokyo' {{'}'}},
* {{'{'}} name: 'Austin', city: 'New York' {{'}'}},
* {{'{'}} name: 'Monica', city: 'Paris' {{'}'}},
* {{'{'}} name: 'Austin', city: 'Dubai'{{'}'}}
* ],
* rowHeight: 'auto',
* columnMode: 'force',
* limit: 3,
* expandable: true,
* rowExpand: 'single',
* detailsHeight: 150,
* expandIcon: this.myRowExpandIcon,
* collapseIcon: this.myRowCollapseIcon,
* selectable: true,
* sorted: [{{'{'}}prop: 'name', dir: 'desc'{{'}'}}],
* selected: this.mySelected
* {{'}'}}
*/
properties: DatatableModel;
/**
*dynamicClass: function() -> string, // Function that returns name of the class
*class: string // Name of the css class selector
*themeColor: string // primary/accent/warn
*
*{{'{'}}
* // Container surrounding the all datatable elelemnts
* container: {{'{'}}
* dynamicClass,
* class
* {{'}'}},
* // Header
* header: {{'{'}}
* dynamicClass,
* class
* {{'}'}},
* // Ngx-datatable elelemnt
* table: {{'{'}}
* dynamicClass,
* class
* {{'}'}},
* // Each cell container
* tableCell: {{'{'}}
* dynamicClass,
* class
* {{'}'}},
* // Each row details section
* tableRowDetails: {{'{'}}
* dynamicClass,
* class
* {{'}'}}
* // Row expanding icon styling
* expandIcon: IconStylingModel, //refer to icon component
* // Row collapsing icon styling
* collapseIcon: IconStylingModel, //refer to icon component
* // Footer
* footer: {{'{'}}
* dynamicClass,
* class
* {{'}'}},
*{{'}'}}
*
* Example:
*
*/
styling: DatatableStylingModel;
/**
* If to show ngx-datatable footer
*/
showTableFooter: boolean;
/**
* If to show ngx-datatable footer count text
*/
showTableCount: boolean;
/**
* If to show ngx-datatable footer pager
*/
showTablePager: boolean;
/**
* The height of the header in pixels. Type any. Pass a false for no header. Default: 42.
*/
headerHeight: any;
/**
* The height of the footer in pixels. Type any. Pass a false for no footer. Default: 42.
*/
footerHeight: any;
/**
* It is array with rows json objects.
*/
rows: any[];
/**
* It is height of each row. Can be numeric (nember will be transformed to pixels) or 'auto'. Default: 50.
*/
rowHeight: any;
/**
* The mode which the columns are distributed across the table. Type string. Can be: flex, force, standard. Default: force.
*/
columnMode: string;
/**
* It is rows quontity per page. Type number. Default: 3. To show all rows: -1.
*/
limit: number;
/**
* It is boolean value to use or not row details section. Default: false.
*/
expandable: boolean;
/**
* Means how rows can be expanded at one time. Default: multiple. Can be: multiple or single.
*/
rowExpand: string;
/**
* It is height of row in pixels. Type number. Default: 130.
*/
detailsHeight: number;
/**
* CfIcon component for the row expanding icon.
*/
expandIcon: IconModel;
/**
* CfIcon component for the row collapsing icon.
*/
collapseIcon: IconModel;
/**
* It is boolean value to show or not rows section checkboxes. Default: false.
*/
selectable: boolean;
/**
* Array with sorting objects.
* Default: []. Rows can sorted by multipe columns.
* Each sorting object is a json object with two properties:
* prop(property name by which to sort rows) and dir(sort direction. Can be: asc or desc).
*/
sorted: any[];
/**
* Array for selected items.
*/
selected: any[];
/**
*
* new DatatableStylingModel({{'{'}}
* container: {{'{'}}class: 'my-class-for-datatable-container'{{'}'}},
* header: {{'{'}}class: 'my-class-for-datatable-header'{{'}'}},
* table: {{'{'}}class: 'my-class-for-table'{{'}'}},
* tableCell: {{'{'}}class: 'my-class-for-table-cell'{{'}'}},
* tableRowDetails: {{'{'}}class: 'my-class-for-table-row-details'{{'}'}},
* expandIcon: new IconStylingModel({{'{'}} icon: {{'{'}}themeColor: "primary"{{'}'}} {{'}'}}),
* collapseIcon: new IconStylingModel({{'{'}} icon: {{'{'}}themeColor: "primary"{{'}'}} {{'}'}}),
* footer: {{'{'}}class: 'my-class-for-datatable-footer'{{'}'}},
* {{'}'}})
*
Output event with two properties: type and value.
*Type can be: all or row
*When type is all - value can be true(all details rows was expanded) or * false(all details rows was compressed).
*When type is row - value is an row json object.
*/ onDetailsToggle: EventEmitterOutput event with selected items array
*/ onSelect: EventEmitterOutput event with two properties: value and rows.
*Value is a search string.
*Rows is an array with filtered rows.
*/ onFilter: EventEmitterOutput event with four properties: column, newValue, prevValue, sorts.
*Column is data with ngx-datatable column properties.
*NewValue can be: asc(ascending sorting), desc(descending sorting) or undefined(not sorted).
*PrevValue can be: asc(ascending sorting), desc(descending sorting) or undefined(not sorted).
*Sorts is an array with sorting object(s).
*/ onSort: EventEmitter