<commit_before>import {
    ChangeDetectionStrategy, ChangeDetectorRef,
    Component, DoCheck, HostBinding, Input
} from '@angular/core';
import { DisplayDensity } from '../core/displayDensity';
import { DataType } from '../data-operations/data-util';
import { GridBaseAPIService } from './api.service';
import { IgxColumnComponent } from './column.component';
import { IgxGridBaseComponent } from './grid-base.component';
/**
 *@hidden
 */
@Component({
    changeDetection: ChangeDetectionStrategy.OnPush,
    preserveWhitespaces: false,
    selector: 'igx-grid-summary',
    templateUrl: './grid-summary.component.html'
})
export class IgxGridSummaryComponent implements DoCheck {

    fieldName: string;

    @Input()
    public column: IgxColumnComponent;

    @Input()
    public gridID: string;

    @HostBinding('class.igx-grid-summary--fw')
    get widthPersistenceClass(): boolean {
        return this.column.width !== null;
    }

    @HostBinding('class.igx-grid-summary--pinned')
    get isPinned() {
        return this.column.pinned;
    }

    @HostBinding('class.igx-grid-summary--pinned-last')
    get isLastPinned() {
        const pinnedCols = this.gridAPI.get(this.gridID).pinnedColumns;
        if (pinnedCols.length === 0) {
            return false;
        } else {
            return pinnedCols.indexOf(this.column) === pinnedCols.length - 1;
        }
    }

    @HostBinding('class.igx-grid-summary--empty')
    get emptyClass(): boolean {
        return !this.column.hasSummary;
    }

    @HostBinding('style.min-width')
    @HostBinding('style.flex-basis')
    get width() {
        return this.column.width;
    }

    @HostBinding('class.igx-grid-summary--compact')
    get compactCSS() {
        return this.displayDensity === DisplayDensity.compact;
    }

    @HostBinding('class.igx-grid-summary--cosy')
    get cosyCSS() {
        return this.displayDensity === DisplayDensity.cosy;
    }

    @HostBinding('class.igx-grid-summary')
    get defaultCSS() {
        return this.gridAPI.get(this.gridID).isComfortable();
    }

    get dataType(): DataType {
        return this.column.dataType;
    }
    public summaryItemHeight;
    public itemClass = 'igx-grid-summary__item';
    private displayDensity: DisplayDensity | string;

    constructor(public gridAPI: GridBaseAPIService<IgxGridBaseComponent>, public cdr: ChangeDetectorRef) { }

    ngDoCheck() {
        this.displayDensity = this.gridAPI.get(this.gridID).displayDensity;
        this.summaryItemHeight = this.gridAPI.get(this.gridID).defaultRowHeight;
        this.cdr.detectChanges();
    }

    get resolveSummaries(): any[] {
        if (this.fieldName) {
            const field = this.fieldName;
            this.fieldName = null;
            this.gridAPI.set_summary_by_column_name(this.gridID, field);
            if (this.column.field === field) {
                return this.gridAPI.get_summaries(this.gridID).get(field);
            } else {
                return this.gridAPI.get_summaries(this.gridID).get(this.column.field);
            }
        } else {
            this.gridAPI.set_summary_by_column_name(this.gridID, this.column.field);
            return this.gridAPI.get_summaries(this.gridID).get(this.column.field);
        }
    }
}
<commit_msg>Summaries display denisty classes are now correctly applied<commit_after>import {
    ChangeDetectionStrategy, ChangeDetectorRef,
    Component, DoCheck, HostBinding, Input
} from '@angular/core';
import { DisplayDensity } from '../core/displayDensity';
import { DataType } from '../data-operations/data-util';
import { GridBaseAPIService } from './api.service';
import { IgxColumnComponent } from './column.component';
import { IgxGridBaseComponent } from './grid-base.component';
/**
 *@hidden
 */
@Component({
    changeDetection: ChangeDetectionStrategy.OnPush,
    preserveWhitespaces: false,
    selector: 'igx-grid-summary',
    templateUrl: './grid-summary.component.html'
})
export class IgxGridSummaryComponent implements DoCheck {

    fieldName: string;

    @Input()
    public column: IgxColumnComponent;

    @Input()
    public gridID: string;

    @HostBinding('class.igx-grid-summary--fw')
    get widthPersistenceClass(): boolean {
        return this.column.width !== null;
    }

    @HostBinding('class.igx-grid-summary--pinned')
    get isPinned() {
        return this.column.pinned;
    }

    @HostBinding('class.igx-grid-summary--pinned-last')
    get isLastPinned() {
        const pinnedCols = this.gridAPI.get(this.gridID).pinnedColumns;
        if (pinnedCols.length === 0) {
            return false;
        } else {
            return pinnedCols.indexOf(this.column) === pinnedCols.length - 1;
        }
    }

    @HostBinding('class.igx-grid-summary--empty')
    get emptyClass(): boolean {
        return !this.column.hasSummary;
    }

    @HostBinding('style.min-width')
    @HostBinding('style.flex-basis')
    get width() {
        return this.column.width;
    }

    @HostBinding('class.igx-grid-summary--compact')
    get compactCSS() {
        return this.gridAPI.get(this.gridID).isCompact();
    }

    @HostBinding('class.igx-grid-summary--cosy')
    get cosyCSS() {
        return this.gridAPI.get(this.gridID).isCosy();
    }

    @HostBinding('class.igx-grid-summary')
    get defaultCSS() {
        return this.gridAPI.get(this.gridID).isComfortable();
    }

    get dataType(): DataType {
        return this.column.dataType;
    }
    public summaryItemHeight;
    public itemClass = 'igx-grid-summary__item';
    private displayDensity: DisplayDensity | string;

    constructor(public gridAPI: GridBaseAPIService<IgxGridBaseComponent>, public cdr: ChangeDetectorRef) { }

    ngDoCheck() {
        this.displayDensity = this.gridAPI.get(this.gridID).displayDensity;
        this.summaryItemHeight = this.gridAPI.get(this.gridID).defaultRowHeight;
        this.cdr.detectChanges();
    }

    get resolveSummaries(): any[] {
        if (this.fieldName) {
            const field = this.fieldName;
            this.fieldName = null;
            this.gridAPI.set_summary_by_column_name(this.gridID, field);
            if (this.column.field === field) {
                return this.gridAPI.get_summaries(this.gridID).get(field);
            } else {
                return this.gridAPI.get_summaries(this.gridID).get(this.column.field);
            }
        } else {
            this.gridAPI.set_summary_by_column_name(this.gridID, this.column.field);
            return this.gridAPI.get_summaries(this.gridID).get(this.column.field);
        }
    }
}

{'fraction_non_alphanumeric': 0.12857142857142856, 'fraction_numerical': 0.0006079027355623101, 'mean_word_length': 2.786536248561565, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7150546', 'n_tokens_mistral': 2051, 'n_tokens_neox': 1989, 'n_words': 329}