'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * Licensed Materials - Property of IBM * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2019, 2020 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['underscore', '../../../lib/@waca/dashboard-common/dist/api/PropertiesProviderAPI', '../../../lib/@waca/dashboard-common/dist/core/APIFactory', '../../../app/nls/StringResources'], function (_, PropertiesProviderAPI, APIFactory, stringResources) { var AlignPropertiesProvider = function () { function AlignPropertiesProvider(options) { _classCallCheck(this, AlignPropertiesProvider); this.content = options.content; this.dashboardApi = options.dashboardAPI; this._api = APIFactory.createAPI(this, [PropertiesProviderAPI]); // register self as a properties provider contributing align properties this.content.getFeature('Properties').registerProvider(this.getAPI()); this._icons = options.features['Dashboard.Icons']; } AlignPropertiesProvider.prototype.getAPI = function getAPI() { return this._api; }; AlignPropertiesProvider.prototype.destroy = function destroy() { this.dashboardApi = null; }; AlignPropertiesProvider.prototype.getPropertyLayoutList = function getPropertyLayoutList() { return [{ id: 'general', type: 'Group', label: stringResources.get('tabName_general') }, { id: 'layout', type: 'Section', label: stringResources.get('sectionName_layout'), position: 2 }].concat(this.getPropertyLayoutControlList()); }; AlignPropertiesProvider.prototype.getPropertyList = function getPropertyList() { return []; }; AlignPropertiesProvider.prototype.getPropertyLayoutControlList = function getPropertyLayoutControlList() { var selectedContent = this.dashboardApi.getCanvas().getSelectedContentList(); var isReadOnly = selectedContent.length <= 1; var alignAction = this.dashboardApi.getFeature('alignAction'); return [{ id: 'alignWidget', editor: { sectionId: 'general.layout', readOnly: isReadOnly, position: 1, uiControl: { type: 'IconPicker', label: stringResources.get('toolbarActionAlign'), items: [{ name: 'left', label: stringResources.get('alignWidgetLeft'), value: this._icons.getIcon('align-left').id }, { name: 'center', label: stringResources.get('alignWidgetCenter'), value: this._icons.getIcon('align-horizontally').id }, { name: 'right', label: stringResources.get('alignWidgetRight'), value: this._icons.getIcon('align-right').id }, { name: 'top', label: stringResources.get('alignWidgetTop'), value: this._icons.getIcon('align-top').id }, { name: 'middle', label: stringResources.get('alignWidgetMiddle'), value: this._icons.getIcon('align-vertically').id }, { name: 'bottom', label: stringResources.get('alignWidgetBottom'), value: this._icons.getIcon('align-bottom').id }], onChange: function onChange(name, selection) { alignAction.applyAction(_.map(selection, function (entry) { return _.extend(entry, { layoutIds: _.map(selectedContent, function (content) { return content.getId(); }) }); })); } } } }]; }; return AlignPropertiesProvider; }(); return AlignPropertiesProvider; }); //# sourceMappingURL=AlignPropertiesProvider.js.map