/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import { Injectable } from '@angular/core';
import { TaskMagicService } from "./task.magics.service";
import { ComponentListMagicService } from "./component-list.magic.service";
/**
 * Implements various table-related functionalities
 */
var TableMagicService = /** @class */ (function () {
    /**
     *
     * @param componentList Component-mapping service
     * @param task Magic task service
     */
    function TableMagicService(componentList, task) {
        this.componentList = componentList;
        this.task = task;
        this.shouldOpenFieldTextEditor = true;
    }
    /**
     * Refreshes the DataSource
     */
    /**
     * Refreshes the DataSource
     * @return {?}
     */
    TableMagicService.prototype.refreshDataSource = /**
     * Refreshes the DataSource
     * @return {?}
     */
    function () {
    };
    /**
     * Returns the table page size
     */
    /**
     * Returns the table page size
     * @return {?}
     */
    TableMagicService.prototype.getPageSize = /**
     * Returns the table page size
     * @return {?}
     */
    function () {
        return 10;
    };
    /**
     * Returns max no of rows in the table.
     */
    /**
     * Returns max no of rows in the table.
     * @return {?}
     */
    TableMagicService.prototype.getMaxRowsInTable = /**
     * Returns max no of rows in the table.
     * @return {?}
     */
    function () {
        return this.task.Records.list.length;
    };
    /**
     * Selects the specified row
     * @param rowId The row to select
     */
    /**
     * Selects the specified row
     * @param {?} rowId The row to select
     * @return {?}
     */
    TableMagicService.prototype.selectRow = /**
     * Selects the specified row
     * @param {?} rowId The row to select
     * @return {?}
     */
    function (rowId) {
        this.selectedItem = rowId;
    };
    /**
     * @return {?}
     */
    TableMagicService.prototype.getSelectedRow = /**
     * @return {?}
     */
    function () {
        return this.selectedItem;
    };
    /**
     * Returns the selected row
     */
    /**
     * Returns the selected row
     * @return {?}
     */
    TableMagicService.prototype.selectedRow = /**
     * Returns the selected row
     * @return {?}
     */
    function () {
        return null;
    };
    /**
     * Selects the specified page
     * @param  pageId The page to select
     */
    /**
     * Selects the specified page
     * @param {?} pageId The page to select
     * @return {?}
     */
    TableMagicService.prototype.selectPage = /**
     * Selects the specified page
     * @param {?} pageId The page to select
     * @return {?}
     */
    function (pageId) {
    };
    /**
     * Returns whether a dialog should be opened for the HTML element
     * @param  element The HTML element for which a dialog may be needed
     * @returns
     */
    /**
     * Returns whether a dialog should be opened for the HTML element
     * @param {?} element The HTML element for which a dialog may be needed
     * @return {?}
     */
    TableMagicService.prototype.OpenDialogForControl = /**
     * Returns whether a dialog should be opened for the HTML element
     * @param {?} element The HTML element for which a dialog may be needed
     * @return {?}
     */
    function (element) {
        if (element.tagName === "MAT-SELECT" || element.tagName === "MAT-CHECKBOX" ||
            element.tagName === "INPUT" ||
            element.tagName === "SELECT")
            return false;
        return true;
    };
    /**
     * Returns the dialog used to edit values
     */
    /**
     * Returns the dialog used to edit values
     * @return {?}
     */
    TableMagicService.prototype.getDialog = /**
     * Returns the dialog used to edit values
     * @return {?}
     */
    function () {
        return null;
    };
    /**
     * Handles the table "scrolled" event
     */
    /**
     * Handles the table "scrolled" event
     * @return {?}
     */
    TableMagicService.prototype.onScrollDown = /**
     * Handles the table "scrolled" event
     * @return {?}
     */
    function () {
        this.task.onScrollDown();
    };
    /**
     * To be overwitten in specific implelemtations
     */
    /**
     * To be overwitten in specific implelemtations
     * @param {?} e
     * @return {?}
     */
    TableMagicService.prototype.sortData = /**
     * To be overwitten in specific implelemtations
     * @param {?} e
     * @return {?}
     */
    function (e) { };
    /**
     * To be overwitten in specific implelemtations
     */
    /**
     * To be overwitten in specific implelemtations
     * @param {?} e
     * @return {?}
     */
    TableMagicService.prototype.mgOnPaginateChange = /**
     * To be overwitten in specific implelemtations
     * @param {?} e
     * @return {?}
     */
    function (e) { };
    /**
     * Change the number of lines in a table
     * @param  size New number of lines in table
     */
    /**
     * Change the number of lines in a table
     * @param {?} size New number of lines in table
     * @return {?}
     */
    TableMagicService.prototype.updateTableSize = /**
     * Change the number of lines in a table
     * @param {?} size New number of lines in table
     * @return {?}
     */
    function (size) {
        if (size === 0) // never remove row 0 for now
         {
            size = 1;
            this.task.Records.clearFirstTableRecord(this.task.template);
        }
        this.task.formGroups.length = size;
        this.task.Records.updateSize(size);
        this.task.setIncludesFirst(false);
    };
    /**
     * @ignore
     */
    /**
     * @ignore
     * @param {?} value
     * @return {?}
     */
    TableMagicService.prototype.setTableTopIndex = /**
     * @ignore
     * @param {?} value
     * @return {?}
     */
    function (value) {
        if (!this.task.Records.includesFirst)
            value++;
        this.task.Records.setGuiTopIndex(value);
    };
    /**
     * @ignore
     */
    /**
     * @ignore
     * @return {?}
     */
    TableMagicService.prototype.getTableTopIndex = /**
     * @ignore
     * @return {?}
     */
    function () {
        /** @type {?} */
        var topIndex = this.task.Records.getGuiTopIndex();
        if (!this.task.Records.includesFirst)
            topIndex--;
        return topIndex;
    };
    TableMagicService.decorators = [
        { type: Injectable },
    ];
    /** @nocollapse */
    TableMagicService.ctorParameters = function () { return [
        { type: ComponentListMagicService },
        { type: TaskMagicService }
    ]; };
    return TableMagicService;
}());
export { TableMagicService };
if (false) {
    /** @type {?} */
    TableMagicService.prototype.selectedItem;
    /** @type {?} */
    TableMagicService.prototype.shouldOpenFieldTextEditor;
    /**
     * @type {?}
     * @protected
     */
    TableMagicService.prototype.componentList;
    /**
     * @type {?}
     * @protected
     */
    TableMagicService.prototype.task;
}
//# sourceMappingURL=data:application/json;base64, 