(window.dataViewFieldEditor_bundle_jsonpfunction=window.dataViewFieldEditor_bundle_jsonpfunction||[]).push([[14],{97:function(e,t,a){"use strict";a.r(t),a.d(t,"StaticLookupFormatEditor",(function(){return StaticLookupFormatEditor}));var o=a(4),i=a.n(o),n=a(1),s=a(2),r=a(3),d=a(14),u=a(7),l=a(35),c=a(0);class StaticLookupFormatEditor extends u.DefaultFormatEditor{constructor(...e){super(...e),i()(this,"onLookupChange",((e,t)=>{const a=[...this.props.formatParams.lookupEntries];a[t]={...a[t],...e},this.onChange({lookupEntries:a})})),i()(this,"addLookup",(()=>{const e=[...this.props.formatParams.lookupEntries||[]];this.onChange({lookupEntries:[...e,{}]})})),i()(this,"removeLookup",(e=>{const t=[...this.props.formatParams.lookupEntries];t.splice(e,1),this.onChange({lookupEntries:t})}))}render(){const{formatParams:e}=this.props,t=e.lookupEntries&&e.lookupEntries.length&&e.lookupEntries.map(((e,t)=>({...e,index:t})))||[],a=[{field:"key",name:Object(c.jsx)(d.FormattedMessage,{id:"indexPatternFieldEditor.staticLookup.keyLabel",defaultMessage:"Key"}),render:(e,t)=>Object(c.jsx)(s.EuiFieldText,{value:e||"","data-test-subj":`staticLookupEditorKey ${t.index}`,onChange:e=>{this.onLookupChange({key:e.target.value},t.index)}})},{field:"value",name:Object(c.jsx)(d.FormattedMessage,{id:"indexPatternFieldEditor.staticLookup.valueLabel",defaultMessage:"Value"}),render:(e,t)=>Object(c.jsx)(s.EuiFieldText,{value:e||"","data-test-subj":`staticLookupEditorValue ${t.index}`,onChange:e=>{this.onLookupChange({value:e.target.value},t.index)}})},{field:"actions",name:r.i18n.translate("indexPatternFieldEditor.staticLookup.actions",{defaultMessage:"actions"}),actions:[{name:r.i18n.translate("indexPatternFieldEditor.staticLookup.deleteAria",{defaultMessage:"Delete"}),description:r.i18n.translate("indexPatternFieldEditor.staticLookup.deleteTitle",{defaultMessage:"Delete entry"}),onClick:e=>{this.removeLookup(e.index)},type:"icon",icon:"trash",color:"danger","data-test-subj":"staticLookupEditorRemoveEntry",available:()=>t.length>1}],width:"30px"}];return Object(c.jsx)(n.Fragment,null,Object(c.jsx)(s.EuiBasicTable,{items:t,columns:a,style:{maxWidth:"400px"}}),Object(c.jsx)(s.EuiSpacer,{size:"m"}),Object(c.jsx)(s.EuiButton,{iconType:"plusInCircle",size:"s",onClick:this.addLookup,"data-test-subj":"staticLookupEditorAddEntry"},Object(c.jsx)(d.FormattedMessage,{id:"indexPatternFieldEditor.staticLookup.addEntryButton",defaultMessage:"Add entry"})),Object(c.jsx)(s.EuiSpacer,{size:"l"}),Object(c.jsx)(s.EuiFormRow,{label:Object(c.jsx)(d.FormattedMessage,{id:"indexPatternFieldEditor.staticLookup.unknownKeyLabel",defaultMessage:"Value for unknown key"})},Object(c.jsx)(s.EuiFieldText,{value:e.unknownKeyValue||"","data-test-subj":"staticLookupEditorUnknownValue",placeholder:r.i18n.translate("indexPatternFieldEditor.staticLookup.leaveBlankPlaceholder",{defaultMessage:"Leave blank to keep value as-is"}),onChange:e=>{this.onChange({unknownKeyValue:e.target.value})}})),Object(c.jsx)(s.EuiSpacer,{size:"m"}))}}i()(StaticLookupFormatEditor,"formatId",l.a)}}]);