text: (window.webpackJsonp=window.webpackJsonp||[]).push([[0],{137:function(e,t,a){},138:function(e,t,a){},143:function(e,t,a){"use strict";a.r(t);var n=a(13),l=a(14),s=a(16),i=a(15),r=a(17),o=(a(77),a(0)),c=a(71),u=a(18),d=a(75),m=a(35),h=a(1),p=function(e){return o.createElement("div",{className:"selected"},o.createElement("p",null,o.createElement("i",null,"The ",e.selecting," ",o.createElement("b",null,e.selected)," has been selected")),o.createElement(h.Button,{onClick:e.onClear,style:{visibility:e.nextConfig?"hidden":"visible",marginLeft:"12px"}},"Clear"))};p.displayName="Selected";var f=function(e){var t={className:"dropdown-select",disabled:!e.enabled,kind:"line",onChange:e.onChange,onSelect:e.onChange,value:e.selected},a={disabled:!e.enabled||""===e.selected,kind:"filledGreen",onClick:e.onClick,style:{marginLeft:"12px"}};return o.createElement("div",{className:"selector"},o.createElement(h.DropdownSelect,t,e.list.map(function(e){return o.createElement("option",{key:e},e)})),o.createElement(h.Button,a,"Set"))};f.displayName="Selector";var g=function(e){return o.createElement(o.Fragment,null,o.createElement("span",null,"Select a ",e.selecting),function(e){var t=e.config,a=e.enabled,n=e.list,l=e.nextConfig,s=e.onChange,i=e.onClear,r=e.onClick,c=e.selected,u=e.selecting;return t?o.createElement(p,{nextConfig:l,onClear:i,selected:c,selecting:u}):o.createElement(f,{enabled:a,list:n,onChange:s,onClick:r,selected:c})}(e))};g.displayName="Setting";var y=window.tableau,b="Loading...",v=function(e){function t(){var e,a;Object(n.a)(this,t);for(var l=arguments.length,r=new Array(l),o=0;o<l;o++)r[o]=arguments[o];return(a=Object(s.a)(this,(e=Object(i.a)(t)).call.apply(e,[this].concat(r)))).state={allLabel:"(All)",applyButton:!1,applyButtonLabel:"Apply",autoUpdate:!1,bg:"#ffffff",configured:!1,dataType:"string",delimiter:"|",displayField:"",field:"",field_config:!1,field_enabled:!1,field_list:[],updateOnSelection:!1,includeAllValue:!1,listenParam:!1,listenParamName:"",listenParamList:[],matchParam:!1,multiselect:!1,param_config:!1,param_enabled:!1,param_list:[],parameter:"",selectedTabIndex:0,showDisplayValues:!1,sort:"asc",txt:"#333333",updateOnChange:!1,useFormattedValues:!1,worksheet:"",ws_config:!1,ws_enabled:!1,ws_list:[]},a.bgChange=function(e){a.setState({bg:e.target.value})},a.txtChange=function(e){a.setState({txt:e.target.value})},a.paramChange=function(e){a.setState({parameter:e.target.value},a.listenParameter)},a.fieldChange=function(e){a.setState({field:e.target.value})},a.wsChange=function(e){a.setState({worksheet:e.target.value})},a.sortChange=function(e){a.setState({sort:e.target.value})},a.textInputChange=function(e){a.setState(Object(m.a)({},e.target.name,e.target.value))},a.checkboxChange=function(e){a.setState(Object(m.a)({},e.target.name,e.target.checked))},a.listInputChange=function(e){a.setState(Object(m.a)({},e.target.name,e.target.value))},a.tabChange=function(e){a.setState({selectedTabIndex:e})},a.setParam=function(){var e=y.extensions.dashboardContent.dashboard;""!==a.state.parameter&&e.findParameterAsync(a.state.parameter).then(function(e){a.setState({dataType:e.dataType,includeAllValue:"string"===e.dataType&&a.state.includeAllValue,multiselect:"string"===e.dataType&&a.state.multiselect,param_config:!0}),a.populateWS()})},a.clearParam=function(){a.setState({param_config:!1,param_enabled:!0,ws_enabled:!1}),a.populateParamList()},a.setWS=function(){""!==a.state.worksheet&&(a.setState({ws_config:!0}),a.populateFieldList())},a.clearWS=function(){a.setState({field_enabled:!1,ws_config:!1,ws_enabled:!0}),a.populateWS()},a.setField=function(){var e=y.extensions.dashboardContent.dashboard;""!==a.state.field&&a.setState({configured:!0,field_config:!0}),e.worksheets.find(function(e){return e.name===a.state.worksheet}).getSummaryDataAsync().then(function(e){var t=[],n=!0,l=!1,s=void 0;try{for(var i,r=e.columns[Symbol.iterator]();!(n=(i=r.next()).done);n=!0){var o=i.value;t.push(o.fieldName)}}catch(c){l=!0,s=c}finally{try{n||null==r.return||r.return()}finally{if(l)throw s}}t.sort(),a.setState({displayField:t[0],field_list:t})})},a.clearField=function(){a.setState({configured:!1,field_config:!1,field_enabled:!0}),a.populateFieldList()},a.submit=function(){y.extensions.settings.set("allLabel",a.state.allLabel),y.extensions.settings.set("applyButton",a.state.applyButton&&a.state.multiselect),y.extensions.settings.set("applyButtonLabel",a.state.applyButtonLabel),y.extensions.settings.set("autoUpdate",a.state.autoUpdate),y.extensions.settings.set("bg",a.state.bg),y.extensions.settings.set("configured","true"),y.extensions.settings.set("dataType",a.state.dataType||"string"),y.extensions.settings.set("delimiter",a.state.delimiter),y.extensions.settings.set("displayField",a.state.displayField),y.extensions.settings.set("includeAllValue",a.state.includeAllValue&&"string"===a.state.dataType),y.extensions.settings.set("listenParam",a.state.listenParam),y.extensions.settings.set("listenParamName",a.state.listenParamName),y.extensions.settings.set("matchParam",a.state.matchParam),y.extensions.settings.set("multiselect",a.state.multiselect&&"string"===a.state.dataType),y.extensions.settings.set("selField",a.state.field),y.extensions.settings.set("selParam",a.state.parameter),y.extensions.settings.set("selWorksheet",a.state.worksheet),y.extensions.settings.set("showDisplayValues",a.state.showDisplayValues),y.extensions.settings.set("sort",a.state.sort),y.extensions.settings.set("txt",a.state.txt),y.extensions.settings.set("updateOnChange",a.state.updateOnChange),y.extensions.settings.set("updateOnSelection",a.state.updateOnSelection),y.extensions.settings.set("useFormattedValues",a.state.useFormattedValues&&"string"===a.state.dataType),y.extensions.settings.saveAsync().then(function(){y.extensions.ui.closeDialog(a.state.worksheet)})},a.clearSettings=function(){a.setState({configured:!1,displayField:"",field:"",field_config:!1,field_enabled:!1,field_list:[],param_config:!1,param_list:[],parameter:"",showDisplayValues:!1,worksheet:"",ws_config:!1,ws_enabled:!1,ws_list:[]}),a.populateParamList()},a}return Object(r.a)(t,e),Object(l.a)(t,[{key:"testParamSettings",value:function(){var e=this,t=y.extensions.dashboardContent.dashboard,a=y.extensions.settings.getAll();this.state.configured?t.findParameterAsync(a.selParam).then(function(t){t&&"all"===t.allowableValues.type?(e.setState({dataType:t.dataType,param_config:!0,parameter:t.name},e.listenParameter),e.testWSSettings()):(e.populateParamList(),e.setState({configured:!1}))}):this.populateParamList()}},{key:"populateParamList",value:function(){var e=this,t=y.extensions.dashboardContent.dashboard;this.setState({param_list:[b],parameter:b}),t.getParametersAsync().then(function(t){var a=[],n=!0,l=!1,s=void 0;try{for(var i,r=t[Symbol.iterator]();!(n=(i=r.next()).done);n=!0){var o=i.value;"all"===o.allowableValues.type&&a.push(o.name)}}catch(c){l=!0,s=c}finally{try{n||null==r.return||r.return()}finally{if(l)throw s}}a.sort(),a.length>0?e.setState({param_enabled:!0,param_list:a,parameter:a[0]},e.listenParameter):e.setState({param_enabled:!1,param_list:["No open input parameters found!"],parameter:"No open input parameters found!"})})}},{key:"testWSSettings",value:function(){var e=y.extensions.dashboardContent.dashboard,t=y.extensions.settings.getAll();this.state.configured?e.worksheets.find(function(e){return e.name===t.selWorksheet})?(this.setState({worksheet:t.selWorksheet,ws_config:!0,ws_enabled:!1}),this.testFieldSettings()):(this.populateWS(),this.setState({configured:!1})):this.populateWS()}},{key:"populateWS",value:function(){var e=y.extensions.dashboardContent.dashboard;this.setState({worksheet:b,ws_list:[b]});var t=[],a=!0,n=!1,l=void 0;try{for(var s,i=e.worksheets[Symbol.iterator]();!(a=(s=i.next()).done);a=!0){var r=s.value;t.push(r.name)}}catch(o){n=!0,l=o}finally{try{a||null==i.return||i.return()}finally{if(n)throw l}}t.sort(),t.length>0?this.setState({worksheet:t[0],ws_enabled:!0,ws_list:t}):this.setState({worksheet:"No worksheets found!",ws_enabled:!1,ws_list:["No worksheets found!"]})}},{key:"testFieldSettings",value:function(){var e=this,t=y.extensions.dashboardContent.dashboard,a=y.extensions.settings.getAll();this.state.configured?t.worksheets.find(function(t){return t.name===e.state.worksheet}).getSummaryDataAsync().then(function(t){if(t.columns.find(function(e){return e.fieldName===a.selField})){var n=[],l=!0,s=!1,i=void 0;try{for(var r,o=t.columns[Symbol.iterator]();!(l=(r=o.next()).done);l=!0){var c=r.value;n.push(c.fieldName)}}catch(u){s=!0,i=u}finally{try{l||null==o.return||o.return()}finally{if(s)throw i}}n.sort(),e.setState({configured:!0,field:a.selField,field_config:!0,field_enabled:!1,field_list:n})}else e.populateFieldList(),e.setState({configured:!1})}):this.populateFieldList()}},{key:"populateFieldList",value:function(){var e,t=this,a=y.extensions.dashboardContent.dashboard;this.setState({field:b,field_list:[b]}),a.findParameterAsync(this.state.parameter).then(function(n){return e=n.dataType,a.worksheets.find(function(e){return e.name===t.state.worksheet}).getSummaryDataAsync()}).then(function(a){var n=[],l=!0,s=!1,i=void 0;try{for(var r,o=a.columns[Symbol.iterator]();!(l=(r=o.next()).done);l=!0){var c=r.value;c.dataType===e&&n.push(c.fieldName)}}catch(u){s=!0,i=u}finally{try{l||null==o.return||o.return()}finally{if(s)throw i}}n.sort(),n.length>0?t.setState({field:n[0],field_enabled:!0,field_list:n}):t.setState({field:"No fields found that match parameter!",field_enabled:!1,field_list:["No fields found that match parameter!"]})})}},{key:"listenParameter",value:function(){var e=this;y.extensions.dashboardContent.dashboard.getParametersAsync().then(function(t){var a=[],n=!0,l=!1,s=void 0;try{for(var i,r=t[Symbol.iterator]();!(n=(i=r.next()).done);n=!0){var o=i.value;o.name!==e.state.parameter&&a.push(o.name)}}catch(c){l=!0,s=c}finally{try{n||null==r.return||r.return()}finally{if(l)throw s}}a.sort(),e.setState({listenParamList:a,listenParamName:a[0]})})}},{key:"componentWillMount",value:function(){var e=this;y.extensions.initializeDialogAsync().then(function(){var t=y.extensions.settings.getAll();"true"===t.configured?(e.setState({allLabel:t.allLabel||"(All)",applyButton:"true"===t.applyButton||!1,applyButtonLabel:t.applyButtonLabel||"Apply",autoUpdate:"true"===t.autoUpdate||!1,bg:t.bg||"#ffffff",configured:!0,dataType:t.dataType,delimiter:t.delimiter||"|",displayField:t.displayField||"",includeAllValue:"true"===t.includeAllValue||!1,listenParam:"true"===t.listenParam||!1,listenParamName:t.listenParamName||"",matchParam:"true"===t.matchParam||!1,multiselect:"true"===t.multiselect||!1,showDisplayValues:"true"===t.showDisplayValues||!1,sort:t.sort||"asc",txt:t.txt||"#333333",updateOnChange:"true"===t.updateOnChange||!1,updateOnSelection:"true"===t.updateOnSelection||!1,useFormattedValues:"true"===t.useFormattedValues||!1}),e.testParamSettings()):e.populateParamList()})}},{key:"render",value:function(){var e=[o.createElement("div",{className:"content"},o.createElement(g,{selecting:"parameter",onClick:this.setParam,onClear:this.clearParam,config:this.state.param_config,nextConfig:this.state.ws_config,selected:this.state.parameter,enabled:this.state.param_enabled&&!this.state.param_config,list:this.state.param_list,onChange:this.paramChange}),o.createElement(g,{selecting:"worksheet",onClick:this.setWS,onClear:this.clearWS,config:this.state.ws_config,nextConfig:this.state.field_config,selected:this.state.worksheet,enabled:this.state.ws_enabled,list:this.state.ws_list,onChange:this.wsChange}),o.createElement(g,{selecting:"field",onClick:this.setField,onClear:this.clearField,config:this.state.field_config,selected:this.state.field,enabled:this.state.field_enabled,list:this.state.field_list,onChange:this.fieldChange})),o.createElement("div",{className:"content"},o.createElement("div",{className:"option"},"Sorting:",o.createElement(h.Radio,{checked:"asc"===this.state.sort,onChange:this.sortChange,name:"sorting",value:"asc",style:{margin:"0px 12px"}},"Ascending (A-Z)"),o.createElement(h.Radio,{checked:"desc"===this.state.sort,onChange:this.sortChange,name:"sorting",value:"desc",style:{margin:"0px 12px"}},"Descending (Z-A)")),o.createElement("div",{className:"option"},o.createElement(h.Checkbox,{name:"updateOnSelection",checked:this.state.updateOnSelection,onChange:this.checkboxChange,style:{flexGrow:1}},"Filter list based on worksheet selections")),o.createElement("div",{className:"option"},o.createElement(h.Checkbox,{name:"autoUpdate",checked:this.state.autoUpdate,onChange:this.checkboxChange,style:{flexGrow:1}},"Automatically reset values on dashboard load.")),o.createElement("div",{className:"option"},o.createElement(h.Checkbox,{name:"updateOnChange",disabled:this.state.multiselect,checked:this.state.updateOnChange,onChange:this.checkboxChange,style:{flexGrow:1}},"Update list of values after selection is made. (Dropdown only)")),o.createElement("div",{className:"option"},o.createElement(h.Checkbox,{name:"matchParam",checked:this.state.matchParam,onChange:this.checkboxChange,style:{flexGrow:1}},"Update selection if source parameter changes.")),o.createElement("div",{className:"option"},o.createElement(h.Checkbox,{name:"listenParam",disabled:!this.state.param_config,checked:this.state.listenParam,onChange:this.checkboxChange,style:{marginRight:"10px"}},"Update list when a parameter changes."),o.createElement("div",{style:{display:"flex",width:"150px"}},o.createElement(h.DropdownSelect,{name:"listenParamName",className:"dropdown-select",disabled:!this.state.listenParam||!this.state.param_config,kind:"line",onChange:this.listInputChange,value:this.state.listenParamName,style:{flexGrow:1}},this.state.listenParamList.map(function(e){return o.createElement("option",{key:e},e)})))),o.createElement("div",{className:"option"},o.createElement(h.Checkbox,{name:"showDisplayValues",disabled:!this.state.field_config,checked:this.state.showDisplayValues,onChange:this.checkboxChange,style:{marginRight:"10px"}},"Use different field for display values"),o.createElement("div",{style:{display:"flex",width:"150px"}},o.createElement(h.DropdownSelect,{name:"displayField",className:"dropdown-select",disabled:!this.state.showDisplayValues||!this.state.field_config,kind:"line",onChange:this.listInputChange,value:this.state.displayField,style:{flexGrow:1}},this.state.field_list.map(function(e){return o.createElement("option",{key:e},e)})))),o.createElement("div",{className:"option"},o.createElement("p",null,o.createElement("i",null,"For use with string parameters only:"))),o.createElement("div",{className:"option"},o.createElement(h.Checkbox,{name:"useFormattedValues",disabled:"string"!==this.state.dataType,checked:this.state.useFormattedValues&&"string"===this.state.dataType,onChange:this.checkboxChange,style:{flexGrow:1}},"Use aliased values")),o.createElement("div",{className:"option"},o.createElement(h.Checkbox,{name:"includeAllValue",disabled:"string"!==this.state.dataType,checked:this.state.includeAllValue&&"string"===this.state.dataType,onChange:this.checkboxChange,style:{marginRight:"10px"}},'Include "(All)" in parameter list'),o.createElement("span",{children:"Label:",style:{marginRight:"5px",color:"string"===this.state.dataType&&this.state.includeAllValue?"inherit":"rgba(0, 0, 0, 0.35)"}}),o.createElement(h.TextField,{name:"allLabel",kind:"line",onChange:this.textInputChange,className:"delimiter-text-field",value:this.state.allLabel,disabled:"string"!==this.state.dataType||!this.state.includeAllValue,maxLength:20,style:{width:150}})),o.createElement("p",{style:{marginLeft:"20px"}},o.createElement("i",null,"Note: This is only a placeholder for calculations.")),o.createElement("div",{className:"option"},o.createElement(h.Checkbox,{name:"multiselect",disabled:"string"!==this.state.dataType,checked:this.state.multiselect&&"string"===this.state.dataType,onChange:this.checkboxChange,style:{marginRight:"10px"}},"Allow for multiple selections."),o.createElement("span",{children:"Delimiter:",style:{marginRight:"5px",color:this.state.multiselect?"inherit":"rgba(0, 0, 0, 0.35)"}}),o.createElement(h.TextField,{name:"delimiter",kind:"line",onChange:this.textInputChange,className:"delimiter-text-field",value:this.state.delimiter,disabled:!this.state.multiselect||"string"!==this.state.dataType,maxLength:1,style:{width:20}})),o.createElement("div",{className:"option"},o.createElement(h.Checkbox,{name:"applyButton",disabled:!this.state.multiselect,checked:this.state.applyButton&&this.state.multiselect,onChange:this.checkboxChange,style:{marginRight:"10px"}},"Show apply button."),o.createElement("span",{children:"Label:",style:{marginRight:"5px",color:this.state.multiselect&&this.state.applyButton?"inherit":"rgba(0, 0, 0, 0.35)"}}),o.createElement(h.TextField,{name:"applyButtonLabel",kind:"line",onChange:this.textInputChange,className:"delimiter-text-field",value:this.state.applyButtonLabel,disabled:!this.state.multiselect||!this.state.applyButton,maxLength:20,style:{width:150}}))),o.createElement("div",{className:"content"},o.createElement("div",{className:"format"},o.createElement("div",{className:"formattext"},"Background Color"),o.createElement("div",null,o.createElement("input",{type:"color",value:this.state.bg,onChange:this.bgChange,style:{backgroundColor:this.state.bg}}))),o.createElement("div",{className:"format"},o.createElement("div",{className:"formattext"},"Text Color"),o.createElement("div",null,o.createElement("input",{type:"color",value:this.state.txt,onChange:this.txtChange,style:{backgroundColor:this.state.txt}}))))];return o.createElement(o.Fragment,null,o.createElement("div",{className:"container"},o.createElement("div",null,o.createElement("div",{className:"header"},"Data-Driven Parameter Configuration",o.createElement("div",{className:"tooltip"},o.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",id:"Dialogs_x5F_Info",width:"15",height:"15",viewBox:"0 0 15 15"},o.createElement("rect",{id:"Line",x:"7",y:"6",width:"1",height:"5",fillRule:"evenodd",clipRule:"evenodd",fill:"#666766"}),o.createElement("rect",{id:"Dot_2_",x:"7",y:"4",width:"1",height:"1",fillRule:"evenodd",clipRule:"evenodd",fill:"#666766"}),o.createElement("path",{id:"Circle",d:"M7.5,1C3.9,1,1,3.9,1,7.5S3.9,14,7.5,14 S14,11.1,14,7.5S11.1,1,7.5,1z M7.5,13C4.5,13,2,10.5,2,7.5C2,4.5,4.5,2,7.5,2S13,4.5,13,7.5C13,10.5,10.5,13,7.5,13z",fillRule:"evenodd",clipRule:"evenodd",fill:"#666766"})),o.createElement("span",{className:"tooltiptext"},o.createElement("b",null,"How to Use"),o.createElement("ol",null,o.createElement("li",null,'Select a Tableau parameter to manipulate. This parameter must already exists and must allow "all" values.'),o.createElement("li",null,"Select a worksheet with the data you want to use in your parameter."),o.createElement("li",null,"Select a field to use to populate the parameter. Field data type must match the data type of parameter.")),o.createElement("br",null),o.createElement("p",null,"Note: Mac Desktop 2018.3 and lower, please use arrow keys and 'Enter' to select options")))),o.createElement("div",{className:"tabs"},o.createElement(h.Tabs,{activation:"automatic",alignment:"left",onTabChange:this.tabChange,selectedTabIndex:this.state.selectedTabIndex,tabs:[{content:"Configure"},{content:"Options"},{content:"Formatting"}]},e[this.state.selectedTabIndex]))),o.createElement("div",{className:"footer"},o.createElement("div",{className:"btncluster"},o.createElement(h.Button,{onClick:this.clearSettings,style:{marginRight:"auto"}},"Clear Settings"),o.createElement(h.Button,{kind:"filledGreen",onClick:this.submit,disabled:!this.state.configured||!this.state.ws_config,style:{marginLeft:"12px"}},"OK")))))}}]),t}(o.Component),x=a(54),C=a.n(x),E=a(72),w=(a(137),window.tableau),k=[function(){},function(){},function(){},function(){}],S={value:"Parameter needs configuration",displayValue:"Parameter needs configuration"},P={value:"Loading...",displayValue:"Loading..."};function N(e){var t=function(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{b:parseInt(t[3],16),g:parseInt(t[2],16),r:parseInt(t[1],16)}:null}(e);return t?"rgb(".concat(Math.min(Math.floor(t.r/2)+127,255),", ").concat(Math.min(Math.floor(t.g/2)+127,255),", ").concat(Math.min(Math.floor(t.b/2)+127,255),")"):"#ffffff"}var V=function(e){function t(){var e,a;Object(n.a)(this,t);for(var l=arguments.length,r=new Array(l),o=0;o<l;o++)r[o]=arguments[o];return(a=Object(s.a)(this,(e=Object(i.a)(t)).call.apply(e,[this].concat(r)))).state={allLabel:"Apply",applyButton:!1,applyButtonLabel:"(All)",bg:"#ffffff",configured:!1,currentVal:[P],disabled:!0,firstInit:!0,list:[P],multiselect:!1},a.configure=function(){var e="".concat(window.location.origin).concat("/extension-data-driven-parameters/2.1.0","/#/config");w.extensions.ui.displayDialogAsync(e,"",{height:610,width:450}).then(function(e){a.setup()}).catch(function(e){switch("true"!==w.extensions.settings.get("configured")&&a.setState({currentVal:[S],disabled:!0,list:[S]}),e.errorCode){case w.ErrorCodes.DialogClosedByUser:console.log("Dialog was closed by user.");break;default:console.error(e.message)}})},a.getParamData=function(){var e=w.extensions.settings.getAll(),t=w.extensions.dashboardContent.dashboard.worksheets.find(function(t){return t.name===e.selWorksheet});t?t.getSummaryDataAsync({ignoreSelection:"true"===e.ignoreSelection}).then(function(e){a.populateParam(e)}):a.setState({currentVal:[S],disabled:!0,list:[S]})},a.setCurrentValue=function(){var e=w.extensions.settings.getAll(),t=w.extensions.dashboardContent.dashboard,n=a.state.list,l=[];t.findParameterAsync(e.selParam).then(function(t){if(a.state.firstInit&&"false"===e.autoUpdate){if("true"===e.multiselect){var s=[],i=!0,r=!1,o=void 0;try{for(var c,u=function(){var e=c.value;n.find(function(t){return t.value.toString()===e||t.value===e})&&s.push(e)},d=t.currentValue.value.split(e.delimiter)[Symbol.iterator]();!(i=(c=d.next()).done);i=!0)u()}catch(m){r=!0,o=m}finally{try{i||null==d.return||d.return()}finally{if(r)throw o}}l=s}else n.find(function(e){return e.value.toString()===t.currentValue.value||e.value===t.currentValue.value})&&(l=[t.currentValue.value]);l.length>0?a.setState({currentVal:l}):(l=["true"===e.includeAllValue?n[1].value:n[0].value],t.changeValueAsync(e.multiselect?l.join(e.delimiter):l.toString()).then(console.log))}else l=["true"===e.includeAllValue?n[1].value:n[0].value],t.changeValueAsync(e.multiselect?l.join(e.delimiter):l.toString()).then(console.log);a.setState({disabled:!1,firstInit:!1})})},a.matchListener=function(){var e=w.extensions.settings.getAll();w.extensions.dashboardContent.dashboard.findParameterAsync(e.selParam).then(function(t){var n=a.state.multiselect?t.currentValue.value.split(e.delimiter):[t.currentValue.value];a.setState({currentVal:n})})},a.updateParam=function(e){var t,n=w.extensions.settings.getAll(),l=w.extensions.dashboardContent.dashboard,s=[],i=!0,r=!1,o=void 0;try{for(var c,u=e.target.options[Symbol.iterator]();!(i=(c=u.next()).done);i=!0){var d=c.value;d.selected&&s.push(d.value)}}catch(m){r=!0,o=m}finally{try{i||null==u.return||u.return()}finally{if(r)throw o}}a.setState({currentVal:s}),t=s.join(n.delimiter),l.findParameterAsync(n.selParam).then(function(e){e?"false"===n.applyButton&&e.changeValueAsync(t).then(console.log):a.setState({currentVal:[S],disabled:!0,list:[S]}),"true"===n.updateOnChange&&(a.state.multiselect||a.getParamData())})},a.apply=function(){var e=w.extensions.settings.getAll();w.extensions.dashboardContent.dashboard.findParameterAsync(e.selParam).then(function(t){t.changeValueAsync(a.state.currentVal.join(e.delimiter)).then(console.log)})},a}return Object(r.a)(t,e),Object(l.a)(t,[{key:"findParameter",value:function(){var e=this,t=w.extensions.settings.getAll();w.extensions.dashboardContent.dashboard.findParameterAsync(t.selParam).then(function(t){t&&"all"===t.allowableValues.type?(e.getParamData(),e.resetListeners()):e.setState({currentVal:[S],disabled:!0,list:[S]})})}},{key:"populateParam",value:function(e){var t=w.extensions.settings.getAll(),a=e.columns.find(function(e){return e.fieldName===t.selField});this.setState({currentVal:[P],disabled:!0,list:[P]}),a?this.createList(a,e):this.setState({currentVal:[S],disabled:!0,list:[S]})}},{key:"createList",value:function(e,t){var a=w.extensions.settings.getAll(),n=t.columns.find(function(e){return e.fieldName===a.displayField}),l=[],s=!0,i=!1,r=void 0;try{for(var o,c=t.data[Symbol.iterator]();!(s=(o=c.next()).done);s=!0){var u=o.value,d="true"===a.useFormattedValues?u[e.index].formattedValue:u[e.index].value,m=d;n&&"true"===a.showDisplayValues&&(m=u[n.index].formattedValue),l.push({displayValue:m,value:d})}}catch(h){i=!0,r=h}finally{try{s||null==c.return||c.return()}finally{if(i)throw r}}l=l.filter(function(e,t,a){return a.indexOf(a.find(function(t){return t.value===e.value}))===t}),!a.dataType||"int"!==a.dataType&&"float"!==a.dataType?a.sort&&"desc"===a.sort?l.sort(function(e,t){return e.value<t.value?1:-1}):l.sort(function(e,t){return e.value>t.value?1:-1}):(l=l.map(function(e){return{value:Number(e.value),displayValue:e.displayValue}}),a.sort&&"desc"===a.sort?l.sort(function(e,t){return t.value-e.value}):l.sort(function(e,t){return e.value-t.value}),"float"===a.dataType&&(l=l.map(function(e){return{value:e.value.toLocaleString(w.extensions.environment.locale),displayValue:e.displayValue}}))),"true"===a.includeAllValue&&l.unshift({value:this.state.allLabel,displayValue:this.state.allLabel}),this.setState({list:l},this.setCurrentValue)}},{key:"registerListeners",value:function(){var e=Object(E.a)(C.a.mark(function e(){var t,a,n,l=this;return C.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=w.extensions.settings.getAll(),a=w.extensions.dashboardContent.dashboard,n=a.worksheets.find(function(e){return e.name===t.selWorksheet}),a.findParameterAsync(t.selParam).then(function(e){n&&e?(k[0]=n.addEventListener(w.TableauEventType.FilterChanged,l.getParamData),k[1]=n.addEventListener(w.TableauEventType.MarkSelectionChanged,l.getParamData),"true"===t.matchParam&&(k[2]=e.addEventListener(w.TableauEventType.ParameterChanged,l.matchListener)),"true"===t.listenParam&&a.findParameterAsync(t.listenParamName).then(function(e){k[3]=e.addEventListener(w.TableauEventType.ParameterChanged,l.getParamData)})):l.setState({currentVal:[S],disabled:!0,list:[S]})});case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()},{key:"resetListeners",value:function(){for(var e=0,t=k;e<t.length;e++){(0,t[e])()}this.registerListeners()}},{key:"setup",value:function(){var e=w.extensions.settings.getAll();document.body.style.backgroundColor=e.bg,document.body.style.color=e.txt,this.setState({allLabel:e.allLabel||"(All)",applyButton:"true"===e.applyButton||!1,applyButtonLabel:e.applyButtonLabel||"Apply",bg:e.bg?N(e.bg):"#ffffff",configured:!0,multiselect:"true"===e.multiselect||!1}),this.findParameter()}},{key:"componentWillMount",value:function(){var e=this;w.extensions.initializeAsync({configure:this.configure}).then(function(){"true"===w.extensions.settings.getAll().configured?e.setup():(e.setState({currentVal:[S],disabled:!0,list:[S]}),e.configure())})}},{key:"render",value:function(){var e=o.createElement("div",{style:{flexDirection:"column"}},o.createElement("select",{multiple:!0,id:"multi-select-parameter",className:"parameter",value:this.state.currentVal,onChange:this.updateParam,disabled:this.state.disabled,style:{backgroundColor:this.state.bg,color:"inherit"}},this.state.list.map(function(e){return o.createElement("option",{key:e.value||e.value,value:e.value},e.displayValue)})),o.createElement(h.Button,{kind:"filled",onClick:this.apply,style:{display:this.state.applyButton?"block":"none",marginTop:"6px",width:"60px",height:"20px",marginLeft:"auto"}},this.state.applyButtonLabel)),t=o.createElement("div",null,o.createElement(h.DropdownSelect,{id:"single-select-parameter",className:"singleParameter",disabled:this.state.disabled||this.state.multiselect,kind:"outline",onChange:this.updateParam,value:this.state.currentVal[0],style:{backgroundColor:this.state.bg,color:"inherit",fontSize:"11px"}},this.state.list.map(function(e){return o.createElement("option",{key:e.value,value:e.value},e.displayValue)})));return o.createElement(o.Fragment,null,this.state.multiselect?e:t)}}]),t}(o.Component),A=(a(138),function(e){function t(){return Object(n.a)(this,t),Object(s.a)(this,Object(i.a)(t).apply(this,arguments))}return Object(r.a)(t,e),Object(l.a)(t,[{key:"render",value:function(){return o.createElement(o.Fragment,null,o.createElement("div",{className:"icontainer"},o.createElement("div",{className:"box"},o.createElement("div",{className:"left"},o.createElement("h1",{className:"iheader"},"Data-Driven Parameters"),o.createElement("span",{className:"tagline"},"Automatically update your parameters based on your data!")),o.createElement("div",{className:"right"},o.createElement("h4",{className:"big"},"What is it?"),o.createElement("p",null,"This extension allows you to add a parameter to a Tableau dashboard whose domain is based on your data. Added a new product line? No longer do you need to manually edit the parameter to update it, with this extension your parameter values update automatically!"),o.createElement("h4",{className:"big"},"Using the Extension"),o.createElement("ol",null,o.createElement("li",null,"Create an open input (All) parameter with a data type matching the field you want to use to populate it."),o.createElement("li",null,"Drag in a new Extension object to your dashboard."),o.createElement("li",null,"Find the manifest (.trex) file you downloaded above."),o.createElement("li",null,"Select the parameter you created above for the extension to manipulate."),o.createElement("li",null,"Select the worksheet that holds the field you want to base your parameter on."),o.createElement("li",null,"Select the field you want to base your parameter on."),o.createElement("li",null,"Optional: Configure your text and background colors."),o.createElement("li",null,"Click 'OK'.")),o.createElement("p",null,o.createElement("b",null,"Note:")," You can add as many instances of this extension as you like!"),o.createElement("div",{className:"gh"},"Get this extension and more in the ",o.createElement("a",{href:"https://extensiongallery.tableau.com/"},"Extension Gallery"),".")))))}}]),t}(o.Component)),_=function(){return o.createElement(o.Fragment,null,o.createElement(u.a,{path:"/",exact:!0,component:A}),o.createElement(u.a,{path:"/parameter",component:V}),o.createElement(u.a,{path:"/config",component:v}))},L=function(e){function t(){return Object(n.a)(this,t),Object(s.a)(this,Object(i.a)(t).apply(this,arguments))}return Object(r.a)(t,e),Object(l.a)(t,[{key:"render",value:function(){return o.createElement(d.a,null,o.createElement(_,null))}}]),t}(o.Component);c.render(o.createElement(L,null),document.getElementById("container"))},76:function(e,t,a){e.exports=a(143)}},[[76,1,2]]]);
  //# sourceMappingURL=main.58897323.chunk.js.map