UNPKG

@3mo/data-grid

Version:
26 lines (25 loc) 810 B
export class DataRecord { constructor(dataGrid, init) { this.dataGrid = dataGrid; Object.assign(this, init); this.subDataRecords = !this.subDataRecords?.length ? undefined : this.subDataRecords; } get isSelected() { return this.dataGrid.selectionController.isSelected(this.data); } get isSelectable() { return this.dataGrid.selectionController.isSelectable(this.data); } get detailsOpen() { return this.dataGrid.detailsController.isOpen(this); } getSubDataByLevel(level) { return this.subDataRecords?.filter(r => r.level === level); } get hasSubData() { return (this.subDataRecords?.length ?? 0) > 0; } get hasDetails() { return this.dataGrid.detailsController.hasDetail(this); } }