/*! grafana - v4.5.1 - 2017-09-19
 * Copyright (c) 2017 Torkel Ödegaard; Licensed Apache-2.0 */

System.register(["lodash","app/core/utils/kbn"],function(a,b){"use strict";function c(a,b){return{restrict:"E",scope:!0,templateUrl:"public/app/plugins/panel/table/column_options.html",controller:f}}c.$inject=["$q","uiSegmentSrv"];b&&b.id;a("columnOptionsTab",c);var d,e,f;return{setters:[function(a){d=a},function(a){e=a}],execute:function(){f=function(){function a(a,b,c){var f=this;this.$q=b,this.uiSegmentSrv=c,a.editor=this,this.activeStyleIndex=0,this.panelCtrl=a.ctrl,this.panel=this.panelCtrl.panel,this.unitFormats=e.default.getUnitFormats(),this.colorModes=[{text:"Disabled",value:null},{text:"Cell",value:"cell"},{text:"Value",value:"value"},{text:"Row",value:"row"}],this.columnTypes=[{text:"Number",value:"number"},{text:"String",value:"string"},{text:"Date",value:"date"},{text:"Hidden",value:"hidden"}],this.fontSizes=["80%","90%","100%","110%","120%","130%","150%","160%","180%","200%","220%","250%"],this.dateFormats=[{text:"YYYY-MM-DD HH:mm:ss",value:"YYYY-MM-DD HH:mm:ss"},{text:"MM/DD/YY h:mm:ss a",value:"MM/DD/YY h:mm:ss a"},{text:"MMMM D, YYYY LT",value:"MMMM D, YYYY LT"}],this.getColumnNames=function(){return f.panelCtrl.table?d.default.map(f.panelCtrl.table.columns,function(a){return a.text}):[]}}return a.$inject=["$scope","$q","uiSegmentSrv"],a.prototype.render=function(){this.panelCtrl.render()},a.prototype.setUnitFormat=function(a,b){a.unit=b.value,this.panelCtrl.render()},a.prototype.addColumnStyle=function(){var a={unit:"short",type:"number",alias:"",decimals:2,colors:["rgba(245, 54, 54, 0.9)","rgba(237, 129, 40, 0.89)","rgba(50, 172, 45, 0.97)"],colorMode:null,pattern:"",dateFormat:"YYYY-MM-DD HH:mm:ss",thresholds:[]},b=this.panel.styles,c=b.length,d=c;if(c>0){var e=b[c-1];"/.*/"===e.pattern&&(d=c-1)}b.splice(d,0,a),this.activeStyleIndex=d},a.prototype.removeColumnStyle=function(a){this.panel.styles=d.default.without(this.panel.styles,a)},a.prototype.invertColorOrder=function(a){var b=this.panel.styles[a].colors,c=b[0];b[0]=b[2],b[2]=c,this.panelCtrl.render()},a}(),a("ColumnOptionsCtrl",f)}}});