<commit_before>import {
    ElementRef,
    NgZone,
    ChangeDetectorRef,
    IterableDiffers,
    ViewContainerRef,
    Inject,
    ComponentFactoryResolver,
    Optional,
    Input,
    ViewChild,
    TemplateRef,
    Directive,
    Output,
    EventEmitter,
    LOCALE_ID
} from '@angular/core';
import { IgxGridBaseDirective, IgxGridTransaction } from '../grid-base.directive';
import { GridBaseAPIService } from '../api.service';
import { IgxHierarchicalGridAPIService } from './hierarchical-grid-api.service';
import { IgxRowIslandComponent } from './row-island.component';
import { IgxFilteringService } from '../filtering/grid-filtering.service';
import { IDisplayDensityOptions, DisplayDensityToken } from '../../core/displayDensity';
import { IgxSummaryOperand } from '../summaries/grid-summary';
import { IgxOverlayService, IgxTransactionService, Transaction, TransactionService, State } from '../../services/public_api';
import { DOCUMENT } from '@angular/common';
import { IgxHierarchicalGridNavigationService } from './hierarchical-grid-navigation.service';
import { IgxGridSummaryService } from '../summaries/grid-summary.service';
import { IgxGridSelectionService, IgxGridCRUDService } from '../selection/selection.service';
import { IgxChildGridRowComponent } from './child-grid-row.component';
import { IgxColumnResizingService } from '../resizing/resizing.service';
import { GridType } from '../common/grid.interface';
import { IgxColumnGroupComponent } from '../columns/column-group.component';
import { IgxColumnComponent } from '../columns/column.component';
import { IForOfState } from '../../directives/for-of/for_of.directive';

export const IgxHierarchicalTransactionServiceFactory = {
    provide: IgxGridTransaction,
    useFactory: hierarchicalTransactionServiceFactory
};

export function hierarchicalTransactionServiceFactory() {
    return new IgxTransactionService();
}

export interface IPathSegment {
    rowID: any;
    rowIslandKey: string;
}

@Directive()
export abstract class IgxHierarchicalGridBaseDirective extends IgxGridBaseDirective {
    public abstract rootGrid;

    public abstract expandChildren: boolean;

    @Input()
    public hasChildrenKey: string;

    @Input()
    public showExpandAll = false;

    /**
     * Emitted when a new chunk of data is loaded from virtualization.
     * @example
     * ```typescript
     *  <igx-hierarchical-grid [id]="'igx-grid-1'" [data]="Data" [autoGenerate]="true" (onDataPreLoad)="handleEvent()">
     *  </igx-hierarchical-grid>
     * ```
     */
    @Output()
    public onDataPreLoad = new EventEmitter<IForOfState>();

    /**
     * @hidden
     */
    get maxLevelHeaderDepth() {
        if (this._maxLevelHeaderDepth === null) {
            this._maxLevelHeaderDepth = this.columnList.reduce((acc, col) => Math.max(acc, col.level), 0);
        }
        return this._maxLevelHeaderDepth;
    }

    /**<commit_msg>chore(*): Add api docs for hasChildrenKey and showExpandAll.<commit_after>import {
    ElementRef,
    NgZone,
    ChangeDetectorRef,
    IterableDiffers,
    ViewContainerRef,
    Inject,
    ComponentFactoryResolver,
    Optional,
    Input,
    ViewChild,
    TemplateRef,
    Directive,
    Output,
    EventEmitter,
    LOCALE_ID
} from '@angular/core';
import { IgxGridBaseDirective, IgxGridTransaction } from '../grid-base.directive';
import { GridBaseAPIService } from '../api.service';
import { IgxHierarchicalGridAPIService } from './hierarchical-grid-api.service';
import { IgxRowIslandComponent } from './row-island.component';
import { IgxFilteringService } from '../filtering/grid-filtering.service';
import { IDisplayDensityOptions, DisplayDensityToken } from '../../core/displayDensity';
import { IgxSummaryOperand } from '../summaries/grid-summary';
import { IgxOverlayService, IgxTransactionService, Transaction, TransactionService, State } from '../../services/public_api';
import { DOCUMENT } from '@angular/common';
import { IgxHierarchicalGridNavigationService } from './hierarchical-grid-navigation.service';
import { IgxGridSummaryService } from '../summaries/grid-summary.service';
import { IgxGridSelectionService, IgxGridCRUDService } from '../selection/selection.service';
import { IgxChildGridRowComponent } from './child-grid-row.component';
import { IgxColumnResizingService } from '../resizing/resizing.service';
import { GridType } from '../common/grid.interface';
import { IgxColumnGroupComponent } from '../columns/column-group.component';
import { IgxColumnComponent } from '../columns/column.component';
import { IForOfState } from '../../directives/for-of/for_of.directive';

export const IgxHierarchicalTransactionServiceFactory = {
    provide: IgxGridTransaction,
    useFactory: hierarchicalTransactionServiceFactory
};

export function hierarchicalTransactionServiceFactory() {
    return new IgxTransactionService();
}

export interface IPathSegment {
    rowID: any;
    rowIslandKey: string;
}

@Directive()
export abstract class IgxHierarchicalGridBaseDirective extends IgxGridBaseDirective {
    public abstract rootGrid;

    public abstract expandChildren: boolean;

    /**
     * Gets/Sets the key indicating whether a row has children. If row has no children it does not render an expand indicator.
     * @example
     * ```html
     * <igx-hierarchical-grid #grid [data]="localData" [hasChildrenKey]="'hasEmployees'">
     * </igx-hierarchical-grid>
     * ```
     */
    @Input()
    public hasChildrenKey: string;

    /**
     * Gets/Sets whether the expand/collapse all button in the header should be rendered.
     * @remark
     * The default value is false.
     * @example
     * ```html
     * <igx-hierarchical-grid #grid [data]="localData" [showExpandAll]="true">
     * </igx-hierarchical-grid>
     * ```
     */
    @Input()
    public showExpandAll = false;

    /**
     * Emitted when a new chunk of data is loaded from virtualization.
     * @example
     * ```typescript
     *  <igx-hierarchical-grid [id]="'igx-grid-1'" [data]="Data" [autoGenerate]="true" (onDataPreLoad)="handleEvent()">
     *  </igx-hierarchical-grid>
     * ```
     */
    @Output()
    public onDataPreLoad = new EventEmitter<IForOfState>();

    /**
     * @hidden
     */
    get maxLevelHeaderDepth() {
        if (this._maxLevelHeaderDepth === null) {
            this._maxLevelHeaderDepth = this.columnList.reduce((acc, col) => Math.max(acc, col.level), 0);
        }
        return this._maxLevelHeaderDepth;
    }

    /**
{'fraction_non_alphanumeric': 0.12517321016166283, 'fraction_numerical': 0.0006158583525789069, 'mean_word_length': 3.765957446808511, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, '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': '2020819', 'n_tokens_mistral': 1947, 'n_tokens_neox': 1894, 'n_words': 414}