define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MAPPING_GROUP = '_mapping_group';
exports.XMLMAPPING_ID = '_xmlmapping';
var MappingGroup = (function () {
function MappingGroup(container) {
this.container = container;
this.ribbonId = this.container.element.id + '_ribbon';
}
Object.defineProperty(MappingGroup.prototype, "documentEditor", {
get: function () {
return this.container.documentEditor;
},
enumerable: true,
configurable: true
});
MappingGroup.prototype.getGroupModel = function () {
var locale = this.container.localObj;
var id = this.ribbonId + exports.MAPPING_GROUP;
return {
id: id,
header: locale.getConstant('Mapping'),
orientation: 'Row',
enableGroupOverflow: true,
overflowHeader: locale.getConstant('Mapping'),
collections: [
{
items: [
this.getXmlMappingButtonModel()
]
}
]
};
};
MappingGroup.prototype.getXmlMappingButtonModel = function () {
var locale = this.container.localObj;
var id = this.ribbonId + exports.MAPPING_GROUP;
return {
type: 'Button',
id: id + exports.XMLMAPPING_ID,
buttonSettings: {
iconCss: 'e-icons e-de-ctnr-xml-mapping',
content: locale.getConstant('XML Mapping Pane'),
clicked: this.onXmlMappingClick.bind(this)
},
ribbonTooltipSettings: {
content: locale.getConstant('XML Mapping Pane')
}
};
};
MappingGroup.prototype.onXmlMappingClick = function () {
var _this = this;
Eif (!this.documentEditor.isXmlPaneTool) {
this.documentEditor.showXmlPane();
}
this.container.statusBar.toggleWebLayout();
setTimeout(function () {
_this.documentEditor.focusIn();
}, 30);
};
MappingGroup.prototype.updateSelection = function () {
var isReadOnly = this.documentEditor.isReadOnly;
var isDocumentProtected = this.documentEditor.documentHelper.isDocumentProtected;
var enableXmlMapping = !isReadOnly && !isDocumentProtected;
var xmlMappingElement = document.getElementById(this.ribbonId + exports.MAPPING_GROUP + exports.XMLMAPPING_ID);
Eif (xmlMappingElement) {
xmlMappingElement.classList.toggle('e-disabled', !enableXmlMapping);
}
};
MappingGroup.prototype.destroy = function () {
this.container = undefined;
this.ribbonId = undefined;
};
return MappingGroup;
}());
exports.MappingGroup = MappingGroup;
});
|