define(["require", "exports", "@syncfusion/ej2-base"], function (require, exports, ej2_base_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PROTECT_GROUP = '_developer_protect_group';
exports.RESTRICT_EDITING_ID = '_restrict_edit';
var ProtectGroup = (function () {
function ProtectGroup(container) {
this.container = container;
this.ribbonId = this.container.element.id + '_ribbon';
}
Object.defineProperty(ProtectGroup.prototype, "documentEditor", {
get: function () {
return this.container.documentEditor;
},
enumerable: true,
configurable: true
});
ProtectGroup.prototype.getGroupModel = function () {
var locale = this.container.localObj;
var id = this.ribbonId + exports.PROTECT_GROUP;
return {
id: id,
header: locale.getConstant('Protect'),
orientation: 'Row',
enableGroupOverflow: true,
overflowHeader: locale.getConstant('Protect'),
collections: [
{
items: [
this.getRestrictEditingButtonModel()
]
}
]
};
};
ProtectGroup.prototype.getRestrictEditingButtonModel = function () {
var locale = this.container.localObj;
var id = this.ribbonId + exports.PROTECT_GROUP;
return {
type: 'Button',
id: id + exports.RESTRICT_EDITING_ID,
buttonSettings: {
iconCss: 'e-icons e-de-ctnr-lock',
content: locale.getConstant('Restrict Editing'),
clicked: this.onRestrictEditingClick.bind(this)
},
ribbonTooltipSettings: {
content: locale.getConstant('Restrict editing')
}
};
};
ProtectGroup.prototype.onRestrictEditingClick = function () {
var _this = this;
this.documentEditor.documentHelper.restrictEditingPane.showHideRestrictPane(true);
setTimeout(function () {
_this.documentEditor.focusIn();
}, 30);
};
ProtectGroup.prototype.updateSelection = function () {
var isReadOnly = this.documentEditor.isReadOnly;
var isDocumentProtected = this.documentEditor.documentHelper.isDocumentProtected;
var enableRestrictEditing = !isReadOnly;
var restrictEditingElement = document.getElementById(this.ribbonId + exports.PROTECT_GROUP + exports.RESTRICT_EDITING_ID);
Eif (restrictEditingElement) {
restrictEditingElement.classList.toggle('e-disabled', !enableRestrictEditing);
this.toggleButton(restrictEditingElement, this.container.restrictEditing);
}
};
ProtectGroup.prototype.toggleButton = function (element, toggle) {
Iif (toggle) {
ej2_base_1.classList(element, ['e-btn-toggle'], []);
element.setAttribute('aria-pressed', 'true');
}
else {
ej2_base_1.classList(element, [], ['e-btn-toggle']);
element.setAttribute('aria-pressed', 'false');
}
};
ProtectGroup.prototype.destroy = function () {
this.container = undefined;
this.ribbonId = undefined;
};
return ProtectGroup;
}());
exports.ProtectGroup = ProtectGroup;
});
|