import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
export class SdDesktopCellEditor {
    constructor() {
        this.onChange = (selected) => {
            var _a, _b, _c;
            if (this.column.type === 'children' || this.column.type === 'children-col') {
                return;
            }
            (_c = (_b = (_a = this.column) === null || _a === void 0 ? void 0 : _a.editor) === null || _b === void 0 ? void 0 : _b.change) === null || _c === void 0 ? void 0 : _c.call(_b, this.item, selected);
        };
        this.editorOnAdd = () => {
            var _a, _b;
            if (this.column.type === 'children' || this.column.type === 'children-col') {
                return;
            }
            if (this.column.type === 'values') {
                (_b = (_a = this.column.editor) === null || _a === void 0 ? void 0 : _a.add) === null || _b === void 0 ? void 0 : _b.call(_a, this.item);
            }
        };
        this.editorOnEdit = (option) => {
            var _a, _b;
            if (this.column.type === 'children' || this.column.type === 'children-col') {
                return;
            }
            if (this.column.type === 'values') {
                (_b = (_a = this.column.editor) === null || _a === void 0 ? void 0 : _a.edit) === null || _b === void 0 ? void 0 : _b.call(_a, option, this.item);
            }
        };
        this.editorOnDelete = (option) => {
            var _a, _b;
            if (this.column.type === 'children' || this.column.type === 'children-col') {
                return;
            }
            if (this.column.type === 'values') {
                (_b = (_a = this.column.editor) === null || _a === void 0 ? void 0 : _a.delete) === null || _b === void 0 ? void 0 : _b.call(_a, option, this.item);
            }
        };
    }
}
SdDesktopCellEditor.decorators = [
    { type: Component, args: [{
                selector: 'sd-desktop-cell-editor',
                template: "<sd-input *ngIf=\"column.type === 'string'\" size=\"sm\" type=\"text\" [(model)]=\"item[column.field]\"\r\n  (sdChange)=\"onChange($event)\" disableErrorMessage>\r\n</sd-input>\r\n<sd-input-number *ngIf=\"column.type === 'number'\" size=\"sm\" [(model)]=\"item[column.field]\" (sdChange)=\"onChange($event)\"\r\n  [min]=\"column?.editor?.minValue\" [max]=\"column?.editor?.maxValue\" disableErrorMessage>\r\n</sd-input-number>\r\n<sd-select *ngIf=\"column.type === 'bool'\" size=\"sm\" [items]=\"[\r\n    { value: true, display: column.option?.displayOnTrue || 'True' },\r\n    { value: false, display: column.option?.displayOnFalse || 'False' }\r\n  ]\" valueField=\"value\" displayField=\"display\" [(model)]=\"item[column.field]\" (sdSelection)=\"onChange($event)\"\r\n  disableErrorMessage>\r\n</sd-select>\r\n<sd-date-time *ngIf=\"\r\n    column.type === 'date' ||\r\n    column.type === 'datetime' ||\r\n    column.type === 'time'\r\n  \" size=\"sm\" [(model)]=\"item[column.field]\" [type]=\"column.type\" (sdChange)=\"onChange($event)\" disableErrorMessage>\r\n</sd-date-time>\r\n\r\n<ng-container *ngIf=\"column.type === 'values'\">\r\n  <sd-select *ngIf=\"!column?.option?.selection\" size=\"sm\" [items]=\"column.option.items\"\r\n    [valueField]=\"column.option.valueField\" [displayField]=\"column.option.displayField\" [(model)]=\"item[column.field]\"\r\n    (sdSelection)=\"onChange($event)\" disableErrorMessage></sd-select>\r\n    <sd-select *ngIf=\"\r\n      column?.option?.selection === 'MULTIPLE' ||\r\n      column?.option?.selection === 'MULTIPLEAUTOCOMPLETE'\r\n    \" size=\"sm\" [items]=\"column.option.items\" [valueField]=\"column.option.valueField\"\r\n      [displayField]=\"column.option.displayField\" [(model)]=\"item[column.field]\" (sdSelection)=\"onChange($event)\"\r\n      [multiple]=\"\r\n      column?.option?.selection === 'MULTIPLE' ||\r\n      column?.option?.selection === 'MULTIPLEAUTOCOMPLETE'\r\n    \" [filtered]=\"column?.option?.selection === 'MULTIPLEAUTOCOMPLETE'\" disableErrorMessage>\r\n    </sd-select>\r\n    <sd-autocomplete *ngIf=\"\r\n      column?.option?.selection === 'AUTOCOMPLETE'\r\n    \" size=\"sm\" [items]=\"column.option.items\" [valueField]=\"column.option.valueField\"\r\n      [displayField]=\"column.option.displayField\" [(model)]=\"item[column.field]\" (sdChange)=\"onChange($event)\"\r\n      disableErrorMessage>\r\n    </sd-autocomplete>\r\n\r\n    <!-- EDITOR -->\r\n    <sd-select-editor *ngIf=\"\r\n      column?.option?.selection === 'AUTOCOMPLETE_EDITOR'\r\n    \" size=\"sm\" [items]=\"column.option.items\" [valueField]=\"column.option.valueField\"\r\n      [displayField]=\"column.option.displayField\" [(model)]=\"item[column.field]\" (sdSelection)=\"onChange($event)\"\r\n      filtered disableErrorMessage [addable]=\"column?.editor?.add\" [editable]=\"column?.editor?.edit\"\r\n      [deletable]=\"column?.editor?.delete\" (sdAdd)=\"editorOnAdd()\" (sdEdit)=\"editorOnEdit($event)\"\r\n      (sdDelete)=\"editorOnDelete($event)\">\r\n    </sd-select-editor>\r\n    <sd-select-editor *ngIf=\"\r\n      column?.option?.selection === 'MULTIPLE_EDITOR'\r\n    \" size=\"sm\" [items]=\"column.option.items\" [valueField]=\"column.option.valueField\"\r\n      [displayField]=\"column.option.displayField\" [(model)]=\"item[column.field]\" (sdSelection)=\"onChange($event)\"\r\n      multiple disableErrorMessage [addable]=\"column?.editor?.add\" [editable]=\"column?.editor?.edit\"\r\n      [deletable]=\"column?.editor?.delete\" (sdAdd)=\"editorOnAdd()\" (sdEdit)=\"editorOnEdit($event)\"\r\n      (sdDelete)=\"editorOnDelete($event)\">\r\n    </sd-select-editor>\r\n    <sd-select-editor *ngIf=\"\r\n      column?.option?.selection === 'MULTIPLEAUTOCOMPLETE_EDITOR'\r\n    \" size=\"sm\" [items]=\"column.option.items\" [valueField]=\"column.option.valueField\"\r\n      [displayField]=\"column.option.displayField\" [(model)]=\"item[column.field]\" (sdSelection)=\"onChange($event)\"\r\n      multiple filtered disableErrorMessage [addable]=\"column?.editor?.add\" [editable]=\"column?.editor?.edit\"\r\n      [deletable]=\"column?.editor?.delete\" (sdAdd)=\"editorOnAdd()\" (sdEdit)=\"editorOnEdit($event)\"\r\n      (sdDelete)=\"editorOnDelete($event)\">\r\n    </sd-select-editor>\r\n    <!-- END EDITOR -->\r\n</ng-container>",
                changeDetection: ChangeDetectionStrategy.OnPush
            },] }
];
SdDesktopCellEditor.ctorParameters = () => [];
SdDesktopCellEditor.propDecorators = {
    sdId: [{ type: Input }],
    column: [{ type: Input }],
    item: [{ type: Input }]
};
//# sourceMappingURL=data:application/json;base64, 