var __runInitializers=this&&this.__runInitializers||function(thisArg,initializers,value){for(var useValue=arguments.length>2,i=0;i=0;i--){var context={};for(var p in contextIn)context[p]="access"===p?{}:contextIn[p];for(var p in contextIn.access)context.access[p]=contextIn.access[p];context.addInitializer=function(f){if(done)throw new TypeError("Cannot add initializers after decoration has completed");extraInitializers.push(accept(f||null))};var result=(0,decorators[i])("accessor"===kind?{get:descriptor.get,set:descriptor.set}:descriptor[key],context);if("accessor"===kind){if(void 0===result)continue;if(null===result||"object"!=typeof result)throw new TypeError("Object expected");(_=accept(result.get))&&(descriptor.get=_),(_=accept(result.set))&&(descriptor.set=_),(_=accept(result.init))&&initializers.unshift(_)}else(_=accept(result))&&("field"===kind?initializers.unshift(_):descriptor[key]=_)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0};import{TcHmiControl}from"Beckhoff.TwinCAT.HMI.Framework/index.esm.js";let TcHmiLocalizationSelect=(()=>{var _a;let ___onLocalizationChanged_decorators,___onUserInteractionFinished_decorators,___onComboboxPropertyChanged_decorators,___onResolverForLocalizationMappingWatchCallback_decorators,_classSuper=TcHmiControl.Control,_instanceExtraInitializers=[];return class TcHmiLocalizationSelect extends _classSuper{static{const _metadata="function"==typeof Symbol&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0;___onLocalizationChanged_decorators=[TcHmi.EventHandler()],___onUserInteractionFinished_decorators=[TcHmi.EventHandler({checkIsEnabled:!0,checkIsReadOnly:!0,checkAccess:"operate"})],___onComboboxPropertyChanged_decorators=[TcHmi.EventHandler({checkIsEnabled:!0,checkIsReadOnly:!0,checkAccess:"operate"})],___onResolverForLocalizationMappingWatchCallback_decorators=[(_a=TcHmi).CallbackMethod.bind(_a)],__esDecorate(this,null,___onLocalizationChanged_decorators,{kind:"method",name:"__onLocalizationChanged",static:!1,private:!1,access:{has:obj=>"__onLocalizationChanged"in obj,get:obj=>obj.__onLocalizationChanged},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onUserInteractionFinished_decorators,{kind:"method",name:"__onUserInteractionFinished",static:!1,private:!1,access:{has:obj=>"__onUserInteractionFinished"in obj,get:obj=>obj.__onUserInteractionFinished},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onComboboxPropertyChanged_decorators,{kind:"method",name:"__onComboboxPropertyChanged",static:!1,private:!1,access:{has:obj=>"__onComboboxPropertyChanged"in obj,get:obj=>obj.__onComboboxPropertyChanged},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onResolverForLocalizationMappingWatchCallback_decorators,{kind:"method",name:"__onResolverForLocalizationMappingWatchCallback",static:!1,private:!1,access:{has:obj=>"__onResolverForLocalizationMappingWatchCallback"in obj,get:obj=>obj.__onResolverForLocalizationMappingWatchCallback},metadata:_metadata},null,_instanceExtraInitializers),_metadata&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata})}static#tchmiFQN="TcHmi.Controls.Beckhoff."+this.name;constructor(element,pcElement,attrs){super(element,pcElement,attrs)}__elementTemplateRoot=__runInitializers(this,_instanceExtraInitializers);__isReadOnly;__combobox;__localizationReaderMapping;__passThroughPropertyEventDestroyFunction=null;__isEnabledLock={locked:!1,unlockValue:null};__previnit(){super.__previnit(),this.__elementTemplateRoot=this.__element[0].getElementsByClassName("TcHmi_Controls_Beckhoff_TcHmiLocalizationSelect-template")[0];let combobox=TcHmi.Controls.get(this.getId()+"_TcHmiCombobox");if(!combobox||!this.__elementTemplateRoot)throw new Error("Invalid Template.html");this.__combobox=combobox,this.__passThroughPropertyEventDestroyFunction=TcHmi.EventProvider.register(`${this.__id}_TcHmiCombobox.onPropertyChanged`,this.__onComboboxPropertyChanged)}__init(){super.__init(),this.__displayLocalizations()}__attach(){super.__attach(),this.__selectActiveLocalization(),this.__destroyOnDetach.push(TcHmi.EventProvider.register("onLocaleChanged",this.__onLocalizationChanged),TcHmi.EventProvider.register(this.__id+"_TcHmiCombobox.onUserInteractionFinished",this.__onUserInteractionFinished)),TCHMI_ENGINEERING&&this.__destroyOnDetach.push(TcHmi.EventProvider.register("onConfigChanged",(_event,param)=>{tchmi_equal(param.configNew.languages,param.configOld.languages)||this.__displayLocalizations()}))}__detach(){super.__detach()}destroy(){this.__keepAlive||(this.__passThroughPropertyEventDestroyFunction?.(),this.__passThroughPropertyEventDestroyFunction=null,super.destroy())}__displayLocalizations(){let locales=TcHmi.Locale.getRegisteredLocales(),localeData=[];locales.forEach((locale,itemId)=>{let match=this.__localizationReaderMapping?.find(map=>map.code===locale),localeListItem={text:match?.text??locale,id:itemId,value:locale};localeData.push(localeListItem)}),this.__combobox.setSrcData(localeData)}__selectActiveLocalization(){let locale=TcHmi.Locale.get(),srcData=this.__combobox.getSrcData();if(locale&&srcData?.length){for(let i=0;i{this.__displayLocalizations(),this.__selectActiveLocalization(),this.__unlockIsEnabled()})}__lockIsEnabled(){const unlockValue=this.__isEnabledLock.unlockValue;this.setIsEnabled(!1),this.__isEnabledLock.locked=!0,this.__isEnabledLock.unlockValue=unlockValue}__unlockIsEnabled(){this.__isEnabledLock.locked=!1,this.setIsEnabled(this.__isEnabledLock.unlockValue)}setIsEnabled(valueNew){this.__isEnabledLock.unlockValue=valueNew,this.__isEnabledLock.locked||super.setIsEnabled(valueNew)}__onComboboxPropertyChanged(event,data,...args){["BackgroundColor","TextHorizontalAlignment","ContentPadding","DropDownHighlightColor","DropDownHighlightTextColor","DropDownToggleButtonBackgroundColor","DropDownToggleButtonArrowColor","TextColor","TextFontSize","TextFontSizeUnit","TextFontFamily","TextFontStyle","TextFontWeight","DataHeight","MaxListHeight","DropDownStyle","DropDownFontSize","DropDownFontSizeUnit","DropDownFontFamily","DropDownFontStyle","DropDownFontWeight","DropDownHorizontalAlignment","DropDownVerticalAlignment","DropDownTextColor","DropDownBackgroundColor"].includes(data.propertyName)&&TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",data,...args)}setLocalizationMapping(valueNew){let convertedValue=TcHmi.ValueConverter.toObject(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("LocalizationMapping"));let resolverInfo=this.__objectResolvers.get("localizationMapping");resolverInfo&&(resolverInfo.watchDestroyer&&resolverInfo.watchDestroyer(),resolverInfo.resolver.destroy());let resolver=new TcHmi.Symbol.ObjectResolver(convertedValue,{parentControl:this,type:this.getAttributeDescription("LocalizationMapping")?.type});this.__objectResolvers.set("localizationMapping",{resolver,watchCallback:this.__onResolverForLocalizationMappingWatchCallback,watchDestroyer:resolver.watch(this.__onResolverForLocalizationMappingWatchCallback)})}__onResolverForLocalizationMappingWatchCallback(data){this.__isAttached||this.__suspendObjectResolver("localizationMapping"),data.error===TcHmi.Errors.NONE?tchmi_equal(data.value,this.__localizationReaderMapping)||(this.__localizationReaderMapping=data.value||null,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"LocalizationMapping"}),this.__processLocalizationMapping()):TcHmi.Log.Controls.error(this,TcHmiLocalizationSelect.#tchmiFQN,{Attribute:"LocalizationMapping"},`Resolving symbols from object failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}getLocalizationMapping(){return this.__localizationReaderMapping}__processLocalizationMapping(){this.__displayLocalizations()} /** * Sets the background value and calls the associated process function (processBackground). * @param valueNew * @preserve (Part of the public API) */setBackgroundColor(valueNew){this.__combobox.setBackgroundColor(valueNew)} /** * Returns the current background value. * @preserve (Part of the public API) */getBackgroundColor(){return this.__combobox.getBackgroundColor()}setTextHorizontalAlignment(valueNew){this.__combobox.setTextHorizontalAlignment(valueNew)}getTextHorizontalAlignment(){return this.__combobox.getTextHorizontalAlignment()}setContentPadding(valueNew){this.__combobox.setContentPadding(valueNew)}getContentPadding(){return this.__combobox.getContentPadding()}setDropDownHighlightColor(valueNew){this.__combobox.setDropDownHighlightColor(valueNew)}getDropDownHighlightColor(){return this.__combobox.getDropDownHighlightColor()}setDropDownHighlightTextColor(valueNew){this.__combobox.setDropDownHighlightTextColor(valueNew)}getDropDownHighlightTextColor(){return this.__combobox.getDropDownHighlightTextColor()}setDropDownToggleButtonBackgroundColor(valueNew){this.__combobox.setDropDownToggleButtonBackgroundColor(valueNew)}getDropDownToggleButtonBackgroundColor(){return this.__combobox.getDropDownToggleButtonBackgroundColor()}setDropDownToggleButtonArrowColor(valueNew){this.__combobox.setDropDownToggleButtonArrowColor(valueNew)}getDropDownToggleButtonArrowColor(){return this.__combobox.getDropDownToggleButtonArrowColor()}setTextColor(valueNew){this.__combobox.setTextColor(valueNew)}getTextColor(){return this.__combobox.getTextColor()}setTextFontSize(valueNew){this.__combobox.setTextFontSize(valueNew)}getTextFontSize(){return this.__combobox.getTextFontSize()}setTextFontSizeUnit(valueNew){this.__combobox.setTextFontSizeUnit(valueNew)}getTextFontSizeUnit(){return this.__combobox.getTextFontSizeUnit()}setTextFontFamily(valueNew){this.__combobox.setTextFontFamily(valueNew)}getTextFontFamily(){return this.__combobox.getTextFontFamily()}setTextFontStyle(valueNew){this.__combobox.setTextFontStyle(valueNew)}getTextFontStyle(){return this.__combobox.getTextFontStyle()}setTextFontWeight(valueNew){this.__combobox.setTextFontWeight(valueNew)}getTextFontWeight(){return this.__combobox.getTextFontWeight()}setDataHeight(valueNew){this.__combobox.setDataHeight(valueNew)}getDataHeight(){return this.__combobox.getDataHeight()}setMaxListHeight(valueNew){this.__combobox.setMaxListHeight(valueNew)}getMaxListHeight(){return this.__combobox.getMaxListHeight()}setDropDownStyle(valueNew){this.__combobox.setDropDownStyle(valueNew)}getDropDownStyle(){return this.__combobox.getDropDownStyle()}setDropDownFontSize(valueNew){this.__combobox.setDropDownFontSize(valueNew)}getDropDownFontSize(){return this.__combobox.getDropDownFontSize()}setDropDownFontSizeUnit(valueNew){this.__combobox.setDropDownFontSizeUnit(valueNew)}getDropDownFontSizeUnit(){return this.__combobox.getDropDownFontSizeUnit()}setDropDownFontFamily(valueNew){this.__combobox.setDropDownFontFamily(valueNew)}getDropDownFontFamily(){return this.__combobox.getDropDownFontFamily()}setDropDownFontStyle(valueNew){this.__combobox.setDropDownFontStyle(valueNew)}getDropDownFontStyle(){return this.__combobox.getDropDownFontStyle()}setDropDownFontWeight(valueNew){this.__combobox.setDropDownFontWeight(valueNew)}getDropDownFontWeight(){return this.__combobox.getDropDownFontWeight()}setDropDownHorizontalAlignment(valueNew){this.__combobox.setDropDownHorizontalAlignment(valueNew)}getDropDownHorizontalAlignment(){return this.__combobox.getDropDownHorizontalAlignment()}setDropDownVerticalAlignment(valueNew){this.__combobox.setDropDownVerticalAlignment(valueNew)}getDropDownVerticalAlignment(){return this.__combobox.getDropDownVerticalAlignment()}setDropDownTextColor(valueNew){this.__combobox.setDropDownTextColor(valueNew)}getDropDownTextColor(){return this.__combobox.getDropDownTextColor()}setDropDownBackgroundColor(valueNew){this.__combobox.setDropDownBackgroundColor(valueNew)}getDropDownBackgroundColor(){return this.__combobox.getDropDownBackgroundColor()} /** * Sets the isReadOnly attribute and calls the associated process function (processIsReadOnly). * @preserve (Part of the public API) */setIsReadOnly(valueNew){let convertedValue=TcHmi.ValueConverter.toBoolean(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("IsReadOnly")),convertedValue!==this.__isReadOnly&&(this.__isReadOnly=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"IsReadOnly"}),this.__processIsReadOnly())}getIsReadOnly(){return this.__isReadOnly}__processIsReadOnly(){this.__element[0].classList.toggle("read-only",this.__isReadOnly??!1),this.__combobox.setIsReadOnly(this.__isReadOnly??!1)}}})();TcHmi.Controls.registerEx("TcHmiLocalizationSelect","TcHmi.Controls.Beckhoff",TcHmiLocalizationSelect,{injectInGlobalObject:!0});export{TcHmiLocalizationSelect as Control};