<commit_before>import { Component, OnInit, Injectable, ViewContainerRef, ComponentFactoryResolver,
         ComponentFactory, ComponentRef, AfterContentChecked, AfterViewChecked,
         AfterViewInit, Input, EventEmitter, Output, ViewChild ,
         ElementRef, Renderer} from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { AngularSlickgridComponent, Column, Editors, FieldType, Formatter, Formatters,
         GridExtraService, GridExtraUtils, GridOption, OnEventArgs, ResizerService,
         FormElementType, FilterService, SortService, BackendService,
         BackendServiceOption, FilterChangedArgs, PaginationChangedArgs, SortChangedArgs, Pagination} from '../modules/angular-slickgrid';
import { TranslateService } from '@ngx-translate/core';
import { Logger } from './swt-logger.service';
import { SwtCommonGridPaginationComponent } from './swt-common-grid-pagination.component';

/**
 * Custom wrapper of angular-slickgrid components, allows easily interacting with SwtCommonGridPaginationComponent
 *
 * @author <NAME>, <EMAIL>
 */

let timer: any;
const DEFAULT_FILTER_TYPING_DEBOUNCE = 750;

@Component({
  selector: 'swt-common-grid',
  template: `<angular-slickgrid gridId='common-grid'
                      #angularSlickGrid
                      (onDataviewCreated)="dataviewReady($event)"
                      (onGridCreated)="gridReady($event)"
                      [columnDefinitions]="columnDefinitions"
                      [gridOptions]="gridOptions"
                      [dataset]="dataset"
                      >
                      </angular-slickgrid>`,
  styles: [`
       :host ::ng-deep .gridPane{
            width: 100%!important;
        }
        :host ::ng-deep .slickgrid-container{
            width: 100%!important;
         }
    `]
})

@Injectable()
export class SwtCommonGridComponent implements OnInit, AfterViewInit, BackendService {

    private logger: Logger = null;
    private defaultPageSize = 20;

    @Input() gridHeight = 100;
    @Input() gridWidth = 600;

    gridHeightString: string;
    gridWidthString: string;

    @ViewChild('angularSlickGrid') angularSlickGrid: AngularSlickgridComponent;

    columnDefinitions: Column[] = [];
    dataset: any[];
    gridObj: any;
    dataviewObj: any;
    isAutoEdit = false;
    updatedObject: any;
    isMultiSelect = true;
    selectedObjects: any[];
    selectedObject: any;

    // Slick grid
    metaData: any;
    columnData: any;
    rowsData: any;
    selects: any;
    id: any;

    options: BackendServiceOption;
    pagination: Pagination;


    @Output('onFilterChanged') onFilterChanged_: EventEmitter<FilterChangedArgs> = new EventEmitter<FilterChangedArgs>();
    @Output('onPaginationChanged') onPaginationChanged_: EventEmitter<PaginationChangedArgs> = new EventEmitter<PaginationChangedArgs>();
    @Output('onSortChanged') onSortChanged_: EventEmitter<SortChangedArgs> = new EventEmitter<SortChangedArgs>();

    sortedGridColumn = '';
    currentPage = 1;
    filteredGridColumns = '';

    // Data


    // Injected functions
    private _onRowDoubleClick: Function = new Function();
    private _onRowClick: Function = new Function();


    private _selectedRow: any;


    gridOptions: GridOption = {
        asyncEditorLoading: false,
        autoEdit: this.isAutoEdit,
        autoResize: {
          containerId: 'common-grid-container',
          sidePadding: 15
        },
        // locale: 'fr',
        enableColumnPicker: true,
        enableCellNavigation: true,
        enableRowSelection: true,
        enableCheckboxSelector: false,
        enableFiltering: true ,
        rowHeight: 23,
        forceFitColumns: true,
        enableAutoTooltip: true,
        enableGridMenu: true,
        enablePagination: false
    };

    // Initialized to a fake pagination object
    private _paginationComponent: any = {
         processing: false,
         realPagination: false
    };

    @Input('pagination')
    set paginationComponent(value: SwtCommonGridPaginationComponent) {
        this.logger.info('method [pagination] - START, assigned datagrid pagination object: ', value.realPagination );
        if (value.realPagination) {
            this._paginationComponent = value;
            this.gridOptions.backendServiceApi = {
              service: this,
              preProcess: () => {},
              process: (query) => { return null; },
              postProcess: (response) => {}
            };
            this._paginationComponent.gridPaginationOptions = this.gridOptions;
            this.angularSlickGrid.createBackendApiInternalPostProcessCallback(this.gridOptions);
        }
        this.logger.info('method [pagination] - START');
    }

    get paginationComponent(): SwtCommonGridPaginationComponent{
        return this._paginationComponent;
    }

    /**
     *
     * @param gridExtraService
     * @param resizer
     * @param httpClient
     */
    constructor( private gridExtraService: GridExtraService, private resizer: ResizerService, private httpClient: HttpClient,
            private filterService: FilterService, private sortService: SortService, private translate: TranslateService,
            private el: ElementRef, private renderer: Renderer) {
        this.logger = new Logger('grid', httpClient);

        this.logger.info('method [constructor] - START/END');
    }

<commit_msg>fix(lint): fix tslint errors in custom pagination<commit_after>import { Component, OnInit, Injectable, ViewContainerRef, ComponentFactoryResolver,
         ComponentFactory, ComponentRef, AfterContentChecked, AfterViewChecked,
         AfterViewInit, Input, EventEmitter, Output, ViewChild ,
         ElementRef, Renderer} from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { AngularSlickgridComponent, Column, Editors, FieldType, Formatter, Formatters,
         GridExtraService, GridExtraUtils, GridOption, OnEventArgs, ResizerService,
         FormElementType, FilterService, SortService, BackendService,
         BackendServiceOption, FilterChangedArgs, PaginationChangedArgs, SortChangedArgs, Pagination} from '../modules/angular-slickgrid';
import { TranslateService } from '@ngx-translate/core';
import { Logger } from './swt-logger.service';
import { SwtCommonGridPaginationComponent } from './swt-common-grid-pagination.component';

/**
 * Custom wrapper of angular-slickgrid components, allows easily interacting with SwtCommonGridPaginationComponent
 *
 * @author <NAME>, <EMAIL>
 */

let timer: any;
const DEFAULT_FILTER_TYPING_DEBOUNCE = 750;

@Component({
  selector: 'swt-common-grid',
  template: `<angular-slickgrid gridId='common-grid'
                      #angularSlickGrid
                      (onDataviewCreated)="dataviewReady($event)"
                      (onGridCreated)="gridReady($event)"
                      [columnDefinitions]="columnDefinitions"
                      [gridOptions]="gridOptions"
                      [dataset]="dataset"
                      >
                      </angular-slickgrid>`,
  styles: [`
       :host ::ng-deep .gridPane{
            width: 100%!important;
        }
        :host ::ng-deep .slickgrid-container{
            width: 100%!important;
         }
    `]
})

@Injectable()
export class SwtCommonGridComponent implements OnInit, AfterViewInit, BackendService {

    private logger: Logger = null;
    private defaultPageSize = 20;

    @Input() gridHeight = 100;
    @Input() gridWidth = 600;

    gridHeightString: string;
    gridWidthString: string;

    @ViewChild('angularSlickGrid') angularSlickGrid: AngularSlickgridComponent;

    columnDefinitions: Column[] = [];
    dataset: any[];
    gridObj: any;
    dataviewObj: any;
    isAutoEdit = false;
    updatedObject: any;
    isMultiSelect = true;
    selectedObjects: any[];
    selectedObject: any;

    // Slick grid
    metaData: any;
    columnData: any;
    rowsData: any;
    selects: any;
    id: any;

    options: BackendServiceOption;
    pagination: Pagination;


    @Output('onFilterChanged') onFilterChanged_: EventEmitter<FilterChangedArgs> = new EventEmitter<FilterChangedArgs>();
    @Output('onPaginationChanged') onPaginationChanged_: EventEmitter<PaginationChangedArgs> = new EventEmitter<PaginationChangedArgs>();
    @Output('onSortChanged') onSortChanged_: EventEmitter<SortChangedArgs> = new EventEmitter<SortChangedArgs>();

    sortedGridColumn = '';
    currentPage = 1;
    filteredGridColumns = '';

    // Data


    // Injected functions
    private _onRowDoubleClick: Function = new Function();
    private _onRowClick: Function = new Function();


    private _selectedRow: any;


    gridOptions: GridOption = {
        asyncEditorLoading: false,
        autoEdit: this.isAutoEdit,
        autoResize: {
          containerId: 'common-grid-container',
          sidePadding: 15
        },
        // locale: 'fr',
        enableColumnPicker: true,
        enableCellNavigation: true,
        enableRowSelection: true,
        enableCheckboxSelector: false,
        enableFiltering: true ,
        rowHeight: 23,
        forceFitColumns: true,
        enableAutoTooltip: true,
        enableGridMenu: true,
        enablePagination: false
    };

    // Initialized to a fake pagination object
    private _paginationComponent: any = {
         processing: false,
         realPagination: false
    };

    @Input('pagination')
    set paginationComponent(value: SwtCommonGridPaginationComponent) {
        this.logger.info('method [pagination] - START, assigned datagrid pagination object: ', value.realPagination );
        if (value.realPagination) {
            this._paginationComponent = value;
            this.gridOptions.backendServiceApi = {
              service: this,
              preProcess: () => {},
              process: (query) => { return null; },
              postProcess: (response) => {}
            };
            this._paginationComponent.gridPaginationOptions = this.gridOptions;
            this.angularSlickGrid.createBackendApiInternalPostProcessCallback(this.gridOptions);
        }
        this.logger.info('method [pagination] - START');
    }

    get paginationComponent(): SwtCommonGridPaginationComponent {
        return this._paginationComponent;
    }

    /**
     *
     * @param gridExtraService
     * @param resizer
     * @param httpClient
     */
    constructor( private gridExtraService: GridExtraService, private resizer: ResizerService, private httpClient: HttpClient,
            private filterService: FilterService, private sortService: SortService, private translate: TranslateService,
            private el: ElementRef, private renderer: Renderer) {
        this.logger = new Logger('grid', httpClient);

        this.logger.info('method [constructor] - START/END');
    }


{'fraction_non_alphanumeric': 0.09951030213434353, 'fraction_numerical': 0.004065416243185808, 'mean_word_length': 2.9188993482983348, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 29, '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': '969008', 'n_tokens_mistral': 2939, 'n_tokens_neox': 2855, 'n_words': 644}