<commit_before>import {autoinject, Container, transient, ViewCompiler, ViewResources} from "aurelia-framework";
import {BaseFrameworkFactory, ColDef, ICellEditorComp, IFilterComp, IFrameworkFactory} from "ag-grid/main";
import {AureliaComponentFactory} from "./aureliaComponentFactory";

@autoinject()
@transient()
export class AureliaFrameworkFactory implements IFrameworkFactory {
    private _container: Container;
    private _viewResources: ViewResources;
    private _baseFrameworkFactory: IFrameworkFactory = new BaseFrameworkFactory();    // todo - inject this

    constructor(private _componentFactory: AureliaComponentFactory, private _viewCompiler: ViewCompiler) {
    }

    public colDefCellEditor(colDef: ColDef): { new (): ICellEditorComp; } | string {
        if (colDef.cellEditorFramework) {
            //cache the columnDef viewFactory
            if (!colDef.cellEditorFramework.$viewFactory) {
                colDef.cellEditorFramework.$viewFactory = this._viewCompiler.compile(colDef.cellEditorFramework.template, this._viewResources);
            }
            return this._componentFactory.createEditorFromTemplate(this._container, colDef.cellEditorFramework.$viewFactory);

        } else {
            return this._baseFrameworkFactory.colDefCellEditor(colDef);
        }
    }

    public colDefFilter(colDef: ColDef): { new (): IFilterComp; } | string {
        return this._baseFrameworkFactory.colDefFilter(colDef);
    }

    public setContainer(container: Container): void {
        this._container = container;
    }

    public setViewResources(viewResources: ViewResources): void {
        this._viewResources = viewResources;
    }

    setTimeout(action: any, timeout?: any): void {
        this._baseFrameworkFactory.setTimeout(action, timeout);
    }
}<commit_msg>AG-467 Use ComponentResolver for CellEditor<commit_after>import {autoinject, Container, transient, ViewCompiler, ViewResources} from "aurelia-framework";
import {BaseFrameworkFactory, ColDef, ICellEditorComp, IFilterComp, IFrameworkFactory} from "ag-grid/main";
import {AureliaComponentFactory} from "./aureliaComponentFactory";

@autoinject()
@transient()
export class AureliaFrameworkFactory implements IFrameworkFactory {
    private _container: Container;
    private _viewResources: ViewResources;
    private _baseFrameworkFactory: IFrameworkFactory = new BaseFrameworkFactory();    // todo - inject this

    constructor(private _componentFactory: AureliaComponentFactory, private _viewCompiler: ViewCompiler) {
    }

    public colDefFilter(colDef: ColDef): { new (): IFilterComp; } | string {
        return this._baseFrameworkFactory.colDefFilter(colDef);
    }

    public setContainer(container: Container): void {
        this._container = container;
    }

    public setViewResources(viewResources: ViewResources): void {
        this._viewResources = viewResources;
    }

    setTimeout(action: any, timeout?: any): void {
        this._baseFrameworkFactory.setTimeout(action, timeout);
    }
}
{'fraction_non_alphanumeric': 0.09178263750828364, 'fraction_numerical': 0.0009940357852882703, 'mean_word_length': 4.268760907504363, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4308281', 'n_tokens_mistral': 784, 'n_tokens_neox': 763, 'n_words': 175}