Files
m.heisig 2d11c43579 Added minimal functionality for Robot teaching
- Added minimal HMI
- Added possibility to open and close all chamber doors
2026-01-17 09:20:39 +01:00

5 lines
31 KiB
JavaScript

var __runInitializers=this&&this.__runInitializers||function(thisArg,initializers,value){for(var useValue=arguments.length>2,i=0;i<initializers.length;i++)value=useValue?initializers[i].call(thisArg,value):initializers[i].call(thisArg);return useValue?value:void 0},__esDecorate=this&&this.__esDecorate||function(ctor,descriptorIn,decorators,contextIn,initializers,extraInitializers){function accept(f){if(void 0!==f&&"function"!=typeof f)throw new TypeError("Function expected");return f}for(var _,kind=contextIn.kind,key="getter"===kind?"get":"setter"===kind?"set":"value",target=!descriptorIn&&ctor?contextIn.static?ctor:ctor.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor(target,contextIn.name):{}),done=!1,i=decorators.length-1;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 TcHmiButton=(()=>{var _a,_b,_c,_d;let ___onPropertyIsEnabledChanged_decorators,___onContextMenu_decorators,___onMouseDown_decorators,___onMouseUp_decorators,___onMouseEnter_decorators,___onMouseLeave_decorators,___onTouchStart_decorators,___onTouchEndOrCancel_decorators,___onResolverForTextPaddingWatchCallback_decorators,___onResolverForIconPaddingWatchCallback_decorators,___onResolverForTextColorWatchCallback_decorators,___onStateSymbolWatch_decorators,_classSuper=TcHmiControl.Control,_instanceExtraInitializers=[];return class TcHmiButton extends _classSuper{static{const _metadata="function"==typeof Symbol&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0;___onPropertyIsEnabledChanged_decorators=[TcHmi.EventHandler()],___onContextMenu_decorators=[TcHmi.EventHandler()],___onMouseDown_decorators=[TcHmi.EventHandler({checkIsEnabled:!0,checkIsReadOnly:!0,checkAccess:"operate"})],___onMouseUp_decorators=[TcHmi.EventHandler({checkIsEnabled:!0,checkIsReadOnly:!0,checkAccess:"operate"})],___onMouseEnter_decorators=[TcHmi.EventHandler()],___onMouseLeave_decorators=[TcHmi.EventHandler()],___onTouchStart_decorators=[TcHmi.EventHandler({checkIsEnabled:!0,checkIsReadOnly:!0,checkAccess:"operate"})],___onTouchEndOrCancel_decorators=[TcHmi.EventHandler({checkIsEnabled:!0,checkIsReadOnly:!0,checkAccess:"operate"})],___onResolverForTextPaddingWatchCallback_decorators=[(_a=TcHmi).CallbackMethod.bind(_a)],___onResolverForIconPaddingWatchCallback_decorators=[(_b=TcHmi).CallbackMethod.bind(_b)],___onResolverForTextColorWatchCallback_decorators=[(_c=TcHmi).CallbackMethod.bind(_c)],___onStateSymbolWatch_decorators=[(_d=TcHmi).CallbackMethod.bind(_d)],__esDecorate(this,null,___onPropertyIsEnabledChanged_decorators,{kind:"method",name:"__onPropertyIsEnabledChanged",static:!1,private:!1,access:{has:obj=>"__onPropertyIsEnabledChanged"in obj,get:obj=>obj.__onPropertyIsEnabledChanged},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onContextMenu_decorators,{kind:"method",name:"__onContextMenu",static:!1,private:!1,access:{has:obj=>"__onContextMenu"in obj,get:obj=>obj.__onContextMenu},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onMouseDown_decorators,{kind:"method",name:"__onMouseDown",static:!1,private:!1,access:{has:obj=>"__onMouseDown"in obj,get:obj=>obj.__onMouseDown},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onMouseUp_decorators,{kind:"method",name:"__onMouseUp",static:!1,private:!1,access:{has:obj=>"__onMouseUp"in obj,get:obj=>obj.__onMouseUp},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onMouseEnter_decorators,{kind:"method",name:"__onMouseEnter",static:!1,private:!1,access:{has:obj=>"__onMouseEnter"in obj,get:obj=>obj.__onMouseEnter},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onMouseLeave_decorators,{kind:"method",name:"__onMouseLeave",static:!1,private:!1,access:{has:obj=>"__onMouseLeave"in obj,get:obj=>obj.__onMouseLeave},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onTouchStart_decorators,{kind:"method",name:"__onTouchStart",static:!1,private:!1,access:{has:obj=>"__onTouchStart"in obj,get:obj=>obj.__onTouchStart},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onTouchEndOrCancel_decorators,{kind:"method",name:"__onTouchEndOrCancel",static:!1,private:!1,access:{has:obj=>"__onTouchEndOrCancel"in obj,get:obj=>obj.__onTouchEndOrCancel},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onResolverForTextPaddingWatchCallback_decorators,{kind:"method",name:"__onResolverForTextPaddingWatchCallback",static:!1,private:!1,access:{has:obj=>"__onResolverForTextPaddingWatchCallback"in obj,get:obj=>obj.__onResolverForTextPaddingWatchCallback},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onResolverForIconPaddingWatchCallback_decorators,{kind:"method",name:"__onResolverForIconPaddingWatchCallback",static:!1,private:!1,access:{has:obj=>"__onResolverForIconPaddingWatchCallback"in obj,get:obj=>obj.__onResolverForIconPaddingWatchCallback},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onResolverForTextColorWatchCallback_decorators,{kind:"method",name:"__onResolverForTextColorWatchCallback",static:!1,private:!1,access:{has:obj=>"__onResolverForTextColorWatchCallback"in obj,get:obj=>obj.__onResolverForTextColorWatchCallback},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onStateSymbolWatch_decorators,{kind:"method",name:"__onStateSymbolWatch",static:!1,private:!1,access:{has:obj=>"__onStateSymbolWatch"in obj,get:obj=>obj.__onStateSymbolWatch},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);__elementContentTextSpan;__text;__ignoreEscapeSequences;__textPadding;__textHorizontalAlignment;__textVerticalAlignment;__icon={};__textColor;__textFontSize;__textFontSizeUnit;__textFontFamily;__textFontStyle;__textFontWeight;__wordWrap;__stateSymbol;__stateSymbolInitialized=!1;__isReadOnly;__mousedown=!1;__touches=[];__state=!1;__stateLock=!1;__touchLock=!1;__touchLockTimeoutId=0;__destroyStateSymbolWatch=null;__isDown=!1;__interactionLockRefCount=0;__interactionLock=!1;__previnit(){if(this.__elementTemplateRoot=this.__element.find(".TcHmi_Controls_Beckhoff_TcHmiButton-template"),0===this.__elementTemplateRoot.length&&(this.__elementTemplateRoot=this.__element.find(".tchmi-button-template")),this.__elementContentTextSpan=this.__elementTemplateRoot.find(".TcHmi_Controls_Beckhoff_TcHmiButton-template-content-text"),0===this.__elementContentTextSpan.length&&(this.__elementContentTextSpan=this.__elementTemplateRoot.find(".tchmi-button-template-content-text")),0===this.__elementTemplateRoot.length||0===this.__elementContentTextSpan.length)throw new Error("Invalid Template.html");super.__previnit()}__init(){super.__init(),this.__processIcon(),this.__destroyOnDestroy.push(TcHmi.EventProvider.registerDomEvent(this.__element,"mousedown",this.__onMouseDown),TcHmi.EventProvider.registerDomEvent(this.__element,"mouseenter",this.__onMouseEnter),TcHmi.EventProvider.registerDomEvent(this.__element,"mouseleave",this.__onMouseLeave),TcHmi.EventProvider.registerDomEvent(this.__element,"touchstart",this.__onTouchStart,{passive:!1}),TcHmi.EventProvider.registerDomEvent(this.__element,"touchend",this.__onTouchEndOrCancel,{passive:!1}),TcHmi.EventProvider.registerDomEvent(this.__element,"touchcancel",this.__onTouchEndOrCancel,{passive:!1}),TcHmi.EventProvider.registerDomEvent(this.__element,"contextmenu",this.__onContextMenu,{passive:!1}))}__attach(){super.__attach(),this.__destroyOnDetach.push(TcHmi.EventProvider.registerDomEvent(document,"mouseup",this.__onMouseUp)),this.__destroyOnDetach.push(TcHmi.EventProvider.register(this.getId()+".onPropertyChanged<IsEnabled>",this.__onPropertyIsEnabledChanged)),this.__stateSymbol&&!this.__destroyStateSymbolWatch&&(this.__destroyStateSymbolWatch=this.__stateSymbol.watch(this.__onStateSymbolWatch))}__detach(){super.__detach(),this.__destroyStateSymbolWatch&&(this.__destroyStateSymbolWatch(),this.__destroyStateSymbolWatch=null)}destroy(){this.__keepAlive||(this.__destroyStateSymbolWatch&&(this.__destroyStateSymbolWatch(),this.__destroyStateSymbolWatch=null),this.__stateSymbol&&this.__stateSymbol.destroy(),super.destroy())}__writeState(state,source){return this.__setIsDown(state),this.__stateSymbol&&this.__stateSymbolInitialized?new Promise(resolve=>{this.__stateSymbol.write(state,data=>{if(data.error!==TcHmi.Errors.NONE){const details=data.details??{code:data.error,message:TcHmi.Errors[data.error]};return TcHmi.Log.Controls.error(this,TcHmiButton.#tchmiFQN,{Attribute:"StateSymbol",Symbol:this.__stateSymbol?.getExpression().toString()},TcHmi.Log.buildMessage(details)),this.__setIsDown(this.__state),void resolve(this.__state)}if(void 0===data.value&&this.__stateSymbol.getExpression().getType()===TcHmi.SymbolType.Server){const details={code:TcHmi.Errors.E_SERVER_READVALUE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_READVALUE_MISSING],domain:this.__type,reason:"Read value is missing from state symbol write command."};return TcHmi.Log.Controls.error(this,TcHmiButton.#tchmiFQN,{Attribute:"StateSymbol",Symbol:this.__stateSymbol?.getExpression().toString()},TcHmi.Log.buildMessage(details)),this.__setIsDown(this.__state),void resolve(this.__state)}this.__setInternalState(data.value??state,source),resolve(this.__state)})}):(this.__setInternalState(state,source),Promise.resolve(this.__state))}__setInternalState(state,source){this.__state!==state?(this.__state=state,this.__setIsDown(state),TcHmi.EventProvider.raise(this.getId()+(state?".onStatePressed":".onStateReleased"),{control:this}),TcHmi.EventProvider.raise(this.getId()+".onStateChanged",{control:this,state,stateOld:!state})):this.__setIsDown(this.__state)}__processState(state,forwardStateSymbol,source){forwardStateSymbol?this.__writeState(state,source):this.__setInternalState(state,source)}__setIsDown(valueNew){this.__isDown!==valueNew&&(this.__isDown=valueNew,this.__element[0].classList.toggle("down",this.__isDown))}__onPropertyIsEnabledChanged(_event,_data){this.getIsEnabled()?!this.__destroyStateSymbolWatch&&this.__stateSymbol&&(this.__destroyStateSymbolWatch=this.__stateSymbol.watch(this.__onStateSymbolWatch)):(this.__destroyStateSymbolWatch&&(this.__destroyStateSymbolWatch(),this.__destroyStateSymbolWatch=null),this.__stateLock&&this.__state?this.__writeState(!1,"attribute"):!this.__stateLock&&this.__state&&this.__setInternalState(!1,"attribute"),this.__mousedown=!1,this.__stateLock=!1,this.__touches=[])}__onContextMenu(event){event.cancelable&&event.preventDefault()}__onMouseDown(event){this.__touchLock||0===event.button&&(this.__mousedown=!0,this.__stateLock||(this.__stateLock=!0,this.__interactionLock=!0,this.__interactionLockRefCount++,this.__writeState(!0,"userInteraction")))}__onMouseUp(event){if(!this.__touchLock&&0===event.button&&this.__mousedown&&(this.__mousedown=!1,this.__stateLock)){this.__writeState(!1,"userInteraction").finally(()=>{this.__interactionLockRefCount>0&&(this.__interactionLockRefCount--,0===this.__interactionLockRefCount&&(this.__interactionLock=!1))}),this.__stateLock=!1}}__onMouseEnter(event){this.__mousedown&&(1===event.buttons?this.getIsEnabled()&&!this.__isReadOnly&&TcHmi.Access.checkAccess(this,"operate")&&(this.__stateLock||(this.__stateLock=!0,this.__interactionLock=!0,this.__interactionLockRefCount++,this.__writeState(!0,"userInteraction"))):this.__mousedown=!1)}__onMouseLeave(event){if(this.__mousedown&&(1!==event.buttons&&(this.__mousedown=!1),this.getIsEnabled()&&!this.__isReadOnly&&TcHmi.Access.checkAccess(this,"operate")&&this.__stateLock)){this.__writeState(!1,"userInteraction").finally(()=>{this.__interactionLockRefCount>0&&(this.__interactionLockRefCount--,0===this.__interactionLockRefCount&&(this.__interactionLock=!1))}),this.__stateLock=!1}}__onTouchStart(event){let changedTouches=Array.from(event.changedTouches).filter(touch=>touch.target===event.target);0!==changedTouches.length&&(this.__touches=this.__touches.concat(changedTouches),this.__stateLock||(this.__stateLock=!0,this.__interactionLock=!0,this.__interactionLockRefCount++,this.__writeState(!0,"userInteraction")),this.__touchLockTimeoutId&&(clearTimeout(this.__touchLockTimeoutId),this.__touchLockTimeoutId=0),this.__touchLock=!0)}__onTouchEndOrCancel(event){if(0===this.__touches.length)return;const activeTouchIds=Array.from(event.touches).map(touch=>touch.identifier);if(this.__touches=this.__touches.filter(touch=>activeTouchIds.includes(touch.identifier)),!(this.__touches.length>0)){if(this.__stateLock){this.__writeState(!1,"userInteraction").finally(()=>{this.__interactionLockRefCount>0&&(this.__interactionLockRefCount--,0===this.__interactionLockRefCount&&(this.__interactionLock=!1))}),this.__stateLock=!1}this.__touchLockTimeoutId&&(clearTimeout(this.__touchLockTimeoutId),this.__touchLockTimeoutId=0),this.__touchLockTimeoutId=setTimeout(()=>{this.__touchLock=!1},500)}}setWidthMode(valueNew){let convertedValue=TcHmi.ValueConverter.toSizeModeWithContent(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("WidthMode")),convertedValue!==this.__widthMode&&(this.__widthMode=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"WidthMode"}),this.__processWidthMode())}__processWidth(){"Content"===this.getWidthMode()&&(this.__element[0].style.width="auto"),super.__processWidth()}__getContentWidth(){return"Content"!==this.getWidthMode()?super.__getContentWidth():this.__isAttached&&this.__text?this.__element[0].getBoundingClientRect().width:null}setHeightMode(valueNew){let convertedValue=TcHmi.ValueConverter.toSizeModeWithContent(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("HeightMode")),convertedValue!==this.__heightMode&&(this.__heightMode=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"HeightMode"}),this.__processHeightMode())}__processHeight(){"Content"===this.getHeightMode()&&(this.__intHeight="auto",this.__element[0].style.height="auto"),super.__processHeight()}__getContentHeight(){return"Content"!==this.getHeightMode()?super.__getContentHeight():this.__isAttached&&this.__text?this.__element[0].getBoundingClientRect().height:null}setText(valueNew){let convertedValue=TcHmi.ValueConverter.toString(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("Text")),convertedValue!==this.__text&&(this.__text=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"Text"}),this.__processText())}getText(){return this.__text}__processText(){if(void 0===this.__text)return;let text=this.__text??"";this.__ignoreEscapeSequences||(text=tchmi_decode_control_characters(text)),this.__elementContentTextSpan[0].textContent=text}setIgnoreEscapeSequences(valueNew){let convertedValue=TcHmi.ValueConverter.toBoolean(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("IgnoreEscapeSequences")),convertedValue!==this.__ignoreEscapeSequences&&(this.__ignoreEscapeSequences=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"IgnoreEscapeSequences"}),this.__processText())}getIgnoreEscapeSequences(){return this.__ignoreEscapeSequences}setTextPadding(valueNew){let convertedValue=TcHmi.ValueConverter.toObject(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("TextPadding"));let resolverInfo=this.__objectResolvers.get("textPadding");resolverInfo&&(resolverInfo.watchDestroyer&&resolverInfo.watchDestroyer(),resolverInfo.resolver.destroy());let resolver=new TcHmi.Symbol.ObjectResolver(convertedValue,{parentControl:this,type:this.getAttributeDescription("TextPadding")?.type});this.__objectResolvers.set("textPadding",{resolver,watchCallback:this.__onResolverForTextPaddingWatchCallback,watchDestroyer:resolver.watch(this.__onResolverForTextPaddingWatchCallback)})}__onResolverForTextPaddingWatchCallback(data){this.__isAttached||this.__suspendObjectResolver("textPadding"),data.error===TcHmi.Errors.NONE?tchmi_equal(data.value,this.__textPadding)||(this.__textPadding=data.value,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"TextPadding"}),this.__processTextPadding()):TcHmi.Log.Controls.error(this,TcHmiButton.#tchmiFQN,{Attribute:"TextPadding",Symbol:this.__stateSymbol?.getExpression().toString()},`Resolving symbols from object failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}getTextPadding(){return this.__textPadding}__processTextPadding(){TcHmi.StyleProvider.processContentPadding(this.__elementContentTextSpan,this.__textPadding)}setTextHorizontalAlignment(valueNew){let convertedValue=TcHmi.ValueConverter.toHorizontalAlignment(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("TextHorizontalAlignment")),convertedValue!==this.__textHorizontalAlignment&&(this.__textHorizontalAlignment=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"TextHorizontalAlignment"}),this.__processTextHorizontalAlignment())}getTextHorizontalAlignment(){return this.__textHorizontalAlignment}__processTextHorizontalAlignment(){this.__textHorizontalAlignment?this.__elementContentTextSpan[0].style.textAlign=this.__textHorizontalAlignment.toLowerCase():this.__elementContentTextSpan[0].style.textAlign=""}setTextVerticalAlignment(valueNew){let convertedValue=TcHmi.ValueConverter.toVerticalAlignment(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("TextVerticalAlignment")),convertedValue!==this.__textVerticalAlignment&&(this.__textVerticalAlignment=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"TextVerticalAlignment"}),this.__processTextVerticalAlignment())}getTextVerticalAlignment(){return this.__textVerticalAlignment}__processTextVerticalAlignment(){TcHmi.StyleProvider.processContentVerticalAlignment(this.__elementTemplateRoot,this.__textVerticalAlignment)}setIcon(valueNew){let convertedValue=TcHmi.ValueConverter.toString(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("Icon")),convertedValue!==this.__icon.image&&(this.__icon.image=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"Icon"}),this.__processIcon())}getIcon(){return this.__icon.image}__processIcon(){this.__attributesInitialized&&TcHmi.StyleProvider.processBackground(this.__elementTemplateRoot,this.__icon)}setIconPadding(valueNew){let convertedValue=TcHmi.ValueConverter.toObject(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("IconPadding"));let resolverInfo=this.__objectResolvers.get("iconPadding");resolverInfo&&(resolverInfo.watchDestroyer&&resolverInfo.watchDestroyer(),resolverInfo.resolver.destroy());let resolver=new TcHmi.Symbol.ObjectResolver(convertedValue,{parentControl:this,type:this.getAttributeDescription("IconPadding")?.type});this.__objectResolvers.set("iconPadding",{resolver,watchCallback:this.__onResolverForIconPaddingWatchCallback,watchDestroyer:resolver.watch(this.__onResolverForIconPaddingWatchCallback)})}__onResolverForIconPaddingWatchCallback(data){this.__isAttached||this.__suspendObjectResolver("iconPadding"),data.error===TcHmi.Errors.NONE?tchmi_equal(data.value,this.__icon.imagePadding)||(this.__icon.imagePadding=data.value,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"IconPadding"}),this.__processIconPadding()):TcHmi.Log.Controls.error(this,TcHmiButton.#tchmiFQN,{Attribute:"IconPadding"},`Resolving symbols from object failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}getIconPadding(){return this.__icon.imagePadding}__processIconPadding(){this.__processIcon()}setIconWidth(valueNew){let convertedValue=TcHmi.ValueConverter.toNumber(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("IconWidth")),convertedValue!==this.__icon.imageWidth&&(this.__icon.imageWidth=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"IconWidth"}),this.__processIconWidth())}getIconWidth(){return this.__icon.imageWidth}__processIconWidth(){this.__processIcon()}setIconWidthUnit(valueNew){let convertedValue=TcHmi.ValueConverter.toDimensionUnit(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("IconWidthUnit")),convertedValue!==this.__icon.imageWidthUnit&&(this.__icon.imageWidthUnit=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"IconWidthUnit"}),this.__processIconWidthUnit())}getIconWidthUnit(){return this.__icon.imageWidthUnit}__processIconWidthUnit(){this.__processIcon()}setIconHeight(valueNew){let convertedValue=TcHmi.ValueConverter.toNumber(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("IconHeight")),convertedValue!==this.__icon.imageHeight&&(this.__icon.imageHeight=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"IconHeight"}),this.__processIconHeight())}getIconHeight(){return this.__icon.imageHeight}__processIconHeight(){this.__processIcon()}setIconHeightUnit(valueNew){let convertedValue=TcHmi.ValueConverter.toDimensionUnit(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("IconHeightUnit")),convertedValue!==this.__icon.imageHeightUnit&&(this.__icon.imageHeightUnit=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"IconHeightUnit"}),this.__processIconHeightUnit())}getIconHeightUnit(){return this.__icon.imageHeightUnit}__processIconHeightUnit(){this.__processIcon()}setIconHorizontalAlignment(valueNew){let convertedValue=TcHmi.ValueConverter.toHorizontalAlignment(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("IconHorizontalAlignment")),convertedValue!==this.__icon.imageHorizontalAlignment&&(this.__icon.imageHorizontalAlignment=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"IconHorizontalAlignment"}),this.__processIconHorizontalAlignment())}getIconHorizontalAlignment(){return this.__icon.imageHorizontalAlignment}__processIconHorizontalAlignment(){this.__processIcon()}setIconVerticalAlignment(valueNew){let convertedValue=TcHmi.ValueConverter.toVerticalAlignment(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("IconVerticalAlignment")),convertedValue!==this.__icon.imageVerticalAlignment&&(this.__icon.imageVerticalAlignment=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"IconVerticalAlignment"}),this.__processIconVerticalAlignment())}getIconVerticalAlignment(){return this.__icon.imageVerticalAlignment}__processIconVerticalAlignment(){this.__processIcon()}setTextColor(valueNew){let convertedValue=TcHmi.ValueConverter.toObject(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("TextColor"));let resolverInfo=this.__objectResolvers.get("textColor");resolverInfo&&(resolverInfo.watchDestroyer&&resolverInfo.watchDestroyer(),resolverInfo.resolver.destroy());let resolver=new TcHmi.Symbol.ObjectResolver(convertedValue,{parentControl:this,type:this.getAttributeDescription("TextColor")?.type});this.__objectResolvers.set("textColor",{resolver,watchCallback:this.__onResolverForTextColorWatchCallback,watchDestroyer:resolver.watch(this.__onResolverForTextColorWatchCallback)})}__onResolverForTextColorWatchCallback(data){this.__isAttached||this.__suspendObjectResolver("textColor"),data.error===TcHmi.Errors.NONE?tchmi_equal(data.value,this.__textColor)||(this.__textColor=data.value,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"TextColor"}),this.__processTextColor()):TcHmi.Log.Controls.error(this,TcHmiButton.#tchmiFQN,{Attribute:"TextColor"},`Resolving symbols from object failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}getTextColor(){return this.__textColor}__processTextColor(){TcHmi.StyleProvider.processTextColor(this.__element,this.__textColor)}setTextFontSize(valueNew){let convertedValue=TcHmi.ValueConverter.toNumber(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("TextFontSize")),convertedValue!==this.__textFontSize&&(this.__textFontSize=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"TextFontSize"}),this.__processTextFontSize())}getTextFontSize(){return this.__textFontSize}__processTextFontSize(){TcHmi.StyleProvider.processFontSize(this.__elementContentTextSpan,this.__textFontSize,this.__textFontSizeUnit)}setTextFontSizeUnit(valueNew){let convertedValue=TcHmi.ValueConverter.toFontSizeUnit(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("TextFontSizeUnit")),convertedValue!==this.__textFontSizeUnit&&(this.__textFontSizeUnit=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"TextFontSizeUnit"}),this.__processTextFontSizeUnit())}getTextFontSizeUnit(){return this.__textFontSizeUnit}__processTextFontSizeUnit(){TcHmi.StyleProvider.processFontSize(this.__elementContentTextSpan,this.__textFontSize,this.__textFontSizeUnit)}setTextFontFamily(valueNew){let convertedValue=TcHmi.ValueConverter.toFontFamily(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("TextFontFamily")),convertedValue!==this.__textFontFamily&&(this.__textFontFamily=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"TextFontFamily"}),this.__processTextFontFamily())}getTextFontFamily(){return this.__textFontFamily}__processTextFontFamily(){TcHmi.StyleProvider.processFontFamily(this.__elementContentTextSpan,this.__textFontFamily)}setTextFontStyle(valueNew){let convertedValue=TcHmi.ValueConverter.toFontStyle(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("TextFontStyle")),convertedValue!==this.__textFontStyle&&(this.__textFontStyle=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"TextFontStyle"}),this.__processTextFontStyle())}getTextFontStyle(){return this.__textFontStyle}__processTextFontStyle(){TcHmi.StyleProvider.processFontStyle(this.__elementContentTextSpan,this.__textFontStyle)}setTextFontWeight(valueNew){let convertedValue=TcHmi.ValueConverter.toFontWeight(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("TextFontWeight")),convertedValue!==this.__textFontWeight&&(this.__textFontWeight=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"TextFontWeight"}),this.__processTextFontWeight())}getTextFontWeight(){return this.__textFontWeight}__processTextFontWeight(){TcHmi.StyleProvider.processFontWeight(this.__elementContentTextSpan,this.__textFontWeight)}setWordWrap(valueNew){let convertedValue=TcHmi.ValueConverter.toBoolean(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("WordWrap")),convertedValue!==this.__wordWrap&&(this.__wordWrap=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"WordWrap"}),this.__processWordWrap())}getWordWrap(){return this.__wordWrap}__processWordWrap(){this.__wordWrap?(this.__elementContentTextSpan[0].style.whiteSpace="pre-wrap",this.__elementContentTextSpan[0].style.wordWrap="break-word",this.__elementContentTextSpan[0].style.overflowWrap="break-word"):(this.__elementContentTextSpan[0].style.whiteSpace="",this.__elementContentTextSpan[0].style.wordWrap="",this.__elementContentTextSpan[0].style.overflowWrap="")}__processStateSymbolResult(data){data.error===TcHmi.Errors.NONE?!1!==data.value&&!0!==data.value||this.__setInternalState(data.value,this.__stateSymbol.getExpression().toString()):data.details&&TcHmi.Log.Controls.error(this,TcHmiButton.#tchmiFQN,{Attribute:"StateSymbol",Symbol:this.__stateSymbol?.getExpression().toString()},TcHmi.Log.buildMessage(data.details))}__onStateSymbolWatch(data){this.__interactionLock||(this.__processStateSymbolResult(data),this.__stateSymbolInitialized=!0)}setStateSymbol(valueNew){let newSymbol=valueNew;if(null===newSymbol){let symbolExpression=this.getAttributeDefaultValueInternal("StateSymbol");symbolExpression&&(newSymbol=new TcHmi.Symbol(symbolExpression))}if(this.__stateSymbol!==newSymbol){if(this.__destroyStateSymbolWatch&&(this.__destroyStateSymbolWatch(),this.__destroyStateSymbolWatch=null),this.__stateSymbol&&this.__stateSymbol.destroy(),newSymbol instanceof TcHmi.Symbol)if(this.__stateSymbolInitialized=!1,this.__stateSymbol=newSymbol,this.__isAttached)this.__destroyStateSymbolWatch=this.__stateSymbol.watch(this.__onStateSymbolWatch);else{let referenceDelegation=this.__stateSymbol.getReferenceDelegation();referenceDelegation&&(referenceDelegation.preload=done=>{this.__stateSymbol?.readEx2({forceParallel:!0,forceReadWriteGroup:"TCHMI_BINDING_PRELOAD"},data=>{this.__processStateSymbolResult(data),this.__stateSymbolInitialized=!0,done()})})}else void 0===this.__stateSymbol?this.__stateSymbol=null:(this.__stateSymbol=null,this.__setInternalState(!1,"attribute"));TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"StateSymbol"})}}getStateSymbol(){return this.__stateSymbol}
/**
* 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)}}})();TcHmi.Controls.registerEx("TcHmiButton","TcHmi.Controls.Beckhoff",TcHmiButton,{injectInGlobalObject:!0});export{TcHmiButton as Control};