define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-buttons", "@syncfusion/ej2-base", "../base/util"], function (require, exports, ej2_base_1, ej2_buttons_1, ej2_base_2, util_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var BooleanEditCell = (function () {
        function BooleanEditCell(parent) {
            this.activeClasses = ['e-selectionbackground', 'e-active'];
            this.parent = parent;
        }
        BooleanEditCell.prototype.create = function (args) {
            var col = args.column;
            var classNames = 'e-field e-boolcell';
            Iif (col.type === 'checkbox') {
                classNames = 'e-field e-boolcell e-edit-checkselect';
            }
            var complexFieldName = util_1.getComplexFieldID(args.column.field);
            return ej2_base_1.createElement('input', {
                className: classNames, attrs: {
                    type: 'checkbox', value: args.value, 'e-mappinguid': col.uid,
                    id: this.parent.element.id + complexFieldName,
                    name: complexFieldName
                }
            });
        };
        BooleanEditCell.prototype.read = function (element) {
            return element.checked;
        };
        BooleanEditCell.prototype.write = function (args) {
            var selectChkBox;
            var chkState;
            var isAddRow = args.requestType === 'add' || args.row.classList.contains('e-addedrow');
            if (!ej2_base_1.isNullOrUndefined(args.row)) {
                selectChkBox = args.row.querySelector('.e-edit-checkselect');
            }
            if (util_1.getObject(args.column.field, args.rowData)) {
                chkState = JSON.parse(args.rowData[args.column.field].toString().toLowerCase());
            }
            Iif (!ej2_base_1.isNullOrUndefined(selectChkBox)) {
                this.editType = this.parent.editSettings.mode;
                this.editRow = args.row;
                if (args.requestType !== 'add') {
                    var row = this.parent.getRowObjectFromUID(args.row.getAttribute('data-uid'));
                    chkState = row ? row.isSelected : false;
                }
                util_1.addRemoveActiveClasses.apply(void 0, [[].slice.call(args.row.querySelectorAll('.e-rowcell')), chkState].concat(this.activeClasses));
            }
            this.obj = new ej2_buttons_1.CheckBox(ej2_base_2.extend({
                label: this.parent.editSettings.mode !== 'Dialog' ? '' : args.column.headerText,
                checked: chkState,
                disabled: !util_1.isEditable(args.column, args.requestType, args.element), enableRtl: this.parent.enableRtl,
                change: this.checkBoxChange.bind(this)
            }, args.column.edit.params));
            this.obj.appendTo(args.element);
        };
        BooleanEditCell.prototype.checkBoxChange = function (args) {
            if (this.editRow && this.editType !== 'Dialog') {
                var add = false;
                if (!args.checked) {
                    this.editRow.removeAttribute('aria-selected');
                }
                else {
                    add = true;
                    this.editRow.setAttribute('aria-selected', add.toString());
                }
                util_1.addRemoveActiveClasses.apply(void 0, [[].slice.call(this.editRow.querySelectorAll('.e-rowcell')), add].concat(this.activeClasses));
            }
        };
        BooleanEditCell.prototype.destroy = function () {
            Eif (this.obj) {
                this.obj.destroy();
            }
        };
        return BooleanEditCell;
    }());
    exports.BooleanEditCell = BooleanEditCell;
});
  |