/** * Licensed Materials - Property of IBM * * IBM Cognos Products: BI Glass * * Copyright IBM Corp. 2018 * * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['lib/@waca/core-client/js/core-client/ui/core/View', 'authoring-common'], function(View, AC) { var CustomPalettesFlyout = View.extend({ open: function(){ this.palettesView.render(); }, paletteCreated: function(paletteId){ if(paletteId){ this.fn_applyCreatedPalette(paletteId); // the returned paletteId is used by ChangePaletteView to update selection return paletteId; } }, paletteSelected: function(propName, paletteDef){ if(paletteDef && paletteDef.id){ this.fn_applyPalette(paletteDef); } }, closeFlyout: function(){ this.fn_hide(); }, init: function(options){ this.fn_applyPalette = options.fn_applyPalette; this.fn_applyCreatedPalette = options.fn_applyCreatedPalette; this.fn_hide = options.fn_hide; // why is this here?? options.slideout.$el[0].style.borderLeft = '1px solid #BEBEBE'; var paletteViewOptions = { name: 'colorPalette', el: options.slideout.$el[0], glassContext: options.glassContext, getPalettes: options.fn_getPalettes, slideout: options.slideout, selectedId: options.selectedPalette, createPaletteType: options.paletteType, onCreatePalette: this.paletteCreated.bind(this), onChange: this.paletteSelected.bind(this) }; this.palettesView = new AC.ChangePaletteView(paletteViewOptions); if(this.palettesView) { this.open(); } } }); return CustomPalettesFlyout; });