Files
infineon_plc/Packages/Beckhoff.TwinCAT.HMI.Controls.14.4.1/runtimes/native1.12-tchmi/dist/TcHmiTextbox/TcHmiTextbox.esm.js
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

9 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";import{ValueBuffer,InputProcessingPoint}from"../Helpers/TcHmiValueBuffer/ValueBuffer.js";export var ScrollMode;!function(ScrollMode){ScrollMode[ScrollMode.Never=0]="Never",ScrollMode[ScrollMode.Always=1]="Always",ScrollMode[ScrollMode.Auto=2]="Auto"}(ScrollMode||(ScrollMode={}));let TcHmiTextbox=(()=>{var _a,_b;let ___onKeydown_decorators,___onInput_decorators,___onPaste_decorators,___onCut_decorators,___onFocusIn_decorators,___onFocusOut_decorators,___onIndirectInputFinished_decorators,___onIndirectInputCanceled_decorators,___onResolverForContentPaddingWatchCallback_decorators,___onResolverForTextColorWatchCallback_decorators,_classSuper=TcHmiControl.Control,_instanceExtraInitializers=[];return class TcHmiTextbox extends _classSuper{static{const _metadata="function"==typeof Symbol&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0;___onKeydown_decorators=[TcHmi.EventHandler({checkIsEnabled:!0,checkIsReadOnly:!0,checkAccess:"operate"})],___onInput_decorators=[TcHmi.EventHandler({checkIsEnabled:!0,checkIsReadOnly:!0,checkAccess:"operate"})],___onPaste_decorators=[TcHmi.EventHandler({checkIsEnabled:!0,checkIsReadOnly:!0,checkAccess:"operate"})],___onCut_decorators=[TcHmi.EventHandler({checkIsEnabled:!0,checkIsReadOnly:!0,checkAccess:"operate"})],___onFocusIn_decorators=[TcHmi.EventHandler({checkIsEnabled:!0,checkIsReadOnly:!0,checkAccess:"operate"})],___onFocusOut_decorators=[TcHmi.EventHandler({checkIsEnabled:!0,checkIsReadOnly:!0,checkAccess:"operate"})],___onIndirectInputFinished_decorators=[TcHmi.EventHandler({checkIsEnabled:!0,checkIsReadOnly:!0,checkAccess:"operate"})],___onIndirectInputCanceled_decorators=[TcHmi.EventHandler({checkIsEnabled:!0,checkIsReadOnly:!0,checkAccess:"operate"})],___onResolverForContentPaddingWatchCallback_decorators=[(_a=TcHmi).CallbackMethod.bind(_a)],___onResolverForTextColorWatchCallback_decorators=[(_b=TcHmi).CallbackMethod.bind(_b)],__esDecorate(this,null,___onKeydown_decorators,{kind:"method",name:"__onKeydown",static:!1,private:!1,access:{has:obj=>"__onKeydown"in obj,get:obj=>obj.__onKeydown},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onInput_decorators,{kind:"method",name:"__onInput",static:!1,private:!1,access:{has:obj=>"__onInput"in obj,get:obj=>obj.__onInput},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onPaste_decorators,{kind:"method",name:"__onPaste",static:!1,private:!1,access:{has:obj=>"__onPaste"in obj,get:obj=>obj.__onPaste},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onCut_decorators,{kind:"method",name:"__onCut",static:!1,private:!1,access:{has:obj=>"__onCut"in obj,get:obj=>obj.__onCut},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onFocusIn_decorators,{kind:"method",name:"__onFocusIn",static:!1,private:!1,access:{has:obj=>"__onFocusIn"in obj,get:obj=>obj.__onFocusIn},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onFocusOut_decorators,{kind:"method",name:"__onFocusOut",static:!1,private:!1,access:{has:obj=>"__onFocusOut"in obj,get:obj=>obj.__onFocusOut},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onIndirectInputFinished_decorators,{kind:"method",name:"__onIndirectInputFinished",static:!1,private:!1,access:{has:obj=>"__onIndirectInputFinished"in obj,get:obj=>obj.__onIndirectInputFinished},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onIndirectInputCanceled_decorators,{kind:"method",name:"__onIndirectInputCanceled",static:!1,private:!1,access:{has:obj=>"__onIndirectInputCanceled"in obj,get:obj=>obj.__onIndirectInputCanceled},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onResolverForContentPaddingWatchCallback_decorators,{kind:"method",name:"__onResolverForContentPaddingWatchCallback",static:!1,private:!1,access:{has:obj=>"__onResolverForContentPaddingWatchCallback"in obj,get:obj=>obj.__onResolverForContentPaddingWatchCallback},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),_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);__elementBorder;__elementContainer;__elementInput;__elementFocusBorder;__locked=!1;__text;__systemKeyboardInputMode;__ignoreEscapeSequences;__oldText;__textHorizontalAlignment;__contentPadding;__textFontSize;__textFontSizeUnit;__textFontFamily;__textFontStyle;__textFontWeight;__multiline;__wordWrap;__placeholder;__textColor;__autoFocusOut;__autoSelectText;__horizontalScroll;__verticalScroll;__isReadOnly;__maxTextLength;__resetToLastValidValue;__valueBuffer;__localizedCustomValidity={key:"",parameters:[]};__localizationReader=void 0;__elementInvalidNotificationLabel;__triggerUIFinishedOnBlur=!1;__previnit(){if(this.__elementTemplateRoot=this.__element.find(".TcHmi_Controls_Beckhoff_TcHmiTextbox-template"),0===this.__elementTemplateRoot.length&&(this.__elementTemplateRoot=this.__element.find(".tchmi-textbox-template")),this.__elementInvalidNotificationLabel=this.__elementTemplateRoot.find(".TcHmi_Controls_Beckhoff_TcHmiTextbox-template-input-invalid-notification")[0],this.__elementBorder=this.__elementTemplateRoot.find(".TcHmi_Controls_Beckhoff_TcHmiTextbox-template-border"),0===this.__elementBorder.length&&(this.__elementBorder=this.__elementTemplateRoot.find(".tchmi-textbox-template-border")),this.__elementContainer=this.__elementTemplateRoot.find(".TcHmi_Controls_Beckhoff_TcHmiTextbox-template-input-container"),0===this.__elementContainer.length&&(this.__elementContainer=this.__elementTemplateRoot.find(".tchmi-textbox-template-input-container")),this.__elementFocusBorder=this.__elementTemplateRoot.find(".TcHmi_Controls_Beckhoff_TcHmiTextbox-template-focus-border"),0===this.__elementFocusBorder.length&&(this.__elementFocusBorder=this.__elementTemplateRoot.find(".tchmi-textbox-template-focus-border")),0===this.__elementTemplateRoot.length||0===this.__elementBorder.length||0===this.__elementContainer.length||0===this.__elementFocusBorder.length||!this.__elementInvalidNotificationLabel)throw new Error("Invalid Template.html");const inputFromTemplateHtml=this.__elementTemplateRoot.find(".tchmi-textbox-template-input");inputFromTemplateHtml.length&&(this.__elementInput=inputFromTemplateHtml),this.__destroyOnDestroy.push(this.__localization.watch(data=>{if(data.error===TcHmi.Errors.NONE&&data.reader&&(this.__localizationReader=data.reader,""!==this.__localizedCustomValidity.key)){let localizedText=data.reader.get(this.__localizedCustomValidity.key);this.__localizedCustomValidity.parameters.length>0&&(localizedText=tchmi_format_string(localizedText,...this.__localizedCustomValidity.parameters)),TCHMI_DESIGNER||this.__elementInput?.[0].setCustomValidity(tchmi_decode_control_characters(localizedText))}})),super.__previnit()}__init(){super.__init(),this.__elementInput||this.__processMultiline();const passiveEventOptions={passive:!0,capture:!1};this.__destroyOnDestroy.push(TcHmi.EventProvider.registerDomEvent(this.__elementTemplateRoot[0],"focusin",this.__onFocusIn,passiveEventOptions),TcHmi.EventProvider.registerDomEvent(this.__elementTemplateRoot[0],"focusout",this.__onFocusOut,passiveEventOptions),TcHmi.EventProvider.registerDomEvent(this.__elementContainer[0],"keydown",this.__onKeydown,{passive:!1,capture:!1}),TcHmi.EventProvider.registerDomEvent(this.__elementContainer[0],"input",this.__onInput,passiveEventOptions),TcHmi.EventProvider.registerDomEvent(this.__elementContainer[0],"paste",this.__onPaste,passiveEventOptions),TcHmi.EventProvider.registerDomEvent(this.__elementContainer[0],"cut",this.__onCut,passiveEventOptions),TcHmi.EventProvider.registerDomEvent(this.__elementContainer[0],"indirectinputfinished",this.__onIndirectInputFinished),TcHmi.EventProvider.registerDomEvent(this.__elementContainer[0],"indirectinputcanceled",this.__onIndirectInputCanceled))}__attach(){super.__attach()}__detach(){super.__detach()}destroy(){this.__keepAlive||super.destroy()}__onKeydown(event){this.__triggerUIFinishedOnBlur=!0,"Escape"===event.key?(this.__setText(this.__oldText),TcHmi.EventProvider.raise(this.__id+".onUserInteractionCanceled"),this.__triggerUIFinishedOnBlur=!1,this.__autoFocusOut&&this.__elementInput?.[0].blur()):"Enter"!==event.key||this.__multiline&&!event.ctrlKey||(this.__oldText=this.__text,this.__triggerUIFinishedOnBlur=!1,this.__autoFocusOut&&(this.__elementInput?.[0].blur(),this.__unlock()),this.__valueBuffer?.interactionFinished(),TcHmi.EventProvider.raise(this.__id+".onUserInteractionFinished"),this.__resetToLastValidValue&&this.__text&&(this.__elementInput[0].value=this.__text,this.__validateTextValue(this.__text)),event.preventDefault())}__onInput(_event){this.__triggerUIFinishedOnBlur=!0;let text=this.__elementInput[0].value;this.__ignoreEscapeSequences||(text=tchmi_encode_control_characters(text)),this.__validateTextValue(text)&&this.__valueBuffer?.setValue(text)}__onPaste(_event){this.__triggerUIFinishedOnBlur=!0,window.setTimeout(()=>{let text=this.__elementInput[0].value;this.__ignoreEscapeSequences||(text=tchmi_encode_control_characters(text)),this.__validateTextValue(text)&&this.__valueBuffer?.setValue(text)})}__onCut(_event){this.__triggerUIFinishedOnBlur=!0,window.setTimeout(()=>{let text=this.__elementInput[0].value;this.__ignoreEscapeSequences||(text=tchmi_encode_control_characters(text)),this.__validateTextValue(text)&&this.__valueBuffer?.setValue(text)})}__onFocusIn(event){this.__triggerUIFinishedOnBlur=!0,this.__oldText=this.__text,this.__elementFocusBorder[0].classList.add("tchmi-focus"),this.__autoSelectText&&(this.__elementInput[0].setSelectionRange(0,0),this.__elementInput[0].select()),TcHmi.EventProvider.raise(this.__id+".onFocusIn",event),this.__elementInput[0]===document.activeElement&&this.__lock()}__onFocusOut(event){this.__elementInput[0].classList.contains("tchmi-keyboard-user-input")||this.__performFocusOut(event)}__performFocusOut(event){this.__unlock(),this.__elementFocusBorder[0].classList.remove("tchmi-focus"),this.__valueBuffer?.interactionFinished(),TcHmi.EventProvider.raise(this.__id+".onFocusOut",event),this.__resetToLastValidValue&&this.__text&&(this.__elementInput[0].value=this.__text,this.__validateTextValue(this.__text)),this.__oldText=this.__text,this.__triggerUIFinishedOnBlur&&TcHmi.EventProvider.raise(this.__id+".onUserInteractionFinished"),this.__triggerUIFinishedOnBlur=!1}__onIndirectInputFinished(_event){this.__autoFocusOut?(this.__elementInput?.[0].blur(),this.__unlock()):(this.__valueBuffer?.interactionFinished(),TcHmi.EventProvider.raise(this.__id+".onUserInteractionFinished"),this.__triggerUIFinishedOnBlur=!1)}__onIndirectInputCanceled(event){TcHmi.EventProvider.raise(this.__id+".onUserInteractionCanceled"),this.__triggerUIFinishedOnBlur=!1,this.__elementInput?.[0]!==document.activeElement?this.__performFocusOut(event):this.__autoFocusOut&&this.__elementInput?.[0].blur()}setText(valueNew){if(this.__locked&&!this.__isReadOnly)return;let convertedValue=TcHmi.ValueConverter.toString(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("Text")),this.__setText(convertedValue)}__setText(valueNew,process=!0){let convertedValue=TcHmi.ValueConverter.toString(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("Text")),this.__validateTextValue(convertedValue),convertedValue!==this.__text&&(this.__text=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"Text"}),TcHmi.EventProvider.raise(this.__id+".onTextChanged",this.__text),process&&this.__processText())}getText(){return this.__text}__processText(){if(void 0===this.__text)return;if(!this.__elementInput||0===this.__elementInput.length)return;let text=this.__text??"";this.__ignoreEscapeSequences||(text=this.__multiline?tchmi_decode_control_characters(text):tchmi_decode_control_characters(text,{newlineToSpace:!0})),this.__elementInput[0].value=text}setSystemKeyboardInputMode(valueNew){let convertedValue=TcHmi.ValueConverter.toString(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("SystemKeyboardInputMode")),convertedValue!==this.__systemKeyboardInputMode&&(this.__systemKeyboardInputMode=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"SystemKeyboardInputMode"}),this.__processSystemKeyboardInputMode())}getSystemKeyboardInputMode(){return this.__systemKeyboardInputMode}__processSystemKeyboardInputMode(){this.__elementInput?.length&&this.__systemKeyboardInputMode&&this.__elementInput[0].setAttribute("data-tchmi-input-mode",this.__systemKeyboardInputMode)}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}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(){switch(this.__elementInvalidNotificationLabel.classList.remove("orientation-left"),this.__textHorizontalAlignment){case"Left":TcHmi.StyleProvider.setSimpleElementStyle(this.__elementContainer,"text-align","left");break;case"Center":TcHmi.StyleProvider.setSimpleElementStyle(this.__elementContainer,"text-align","center");break;case"Right":TcHmi.StyleProvider.setSimpleElementStyle(this.__elementContainer,"text-align","right"),this.__elementInvalidNotificationLabel.classList.add("orientation-left");break;default:TcHmi.StyleProvider.setSimpleElementStyle(this.__elementContainer,"text-align",null)}}setContentPadding(valueNew){let convertedValue=TcHmi.ValueConverter.toObject(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("ContentPadding"));let resolverInfo=this.__objectResolvers.get("contentPadding");resolverInfo&&(resolverInfo.watchDestroyer&&resolverInfo.watchDestroyer(),resolverInfo.resolver.destroy());let resolver=new TcHmi.Symbol.ObjectResolver(convertedValue,{parentControl:this,type:this.getAttributeDescription("ContentPadding")?.type});this.__objectResolvers.set("contentPadding",{resolver,watchCallback:this.__onResolverForContentPaddingWatchCallback,watchDestroyer:resolver.watch(this.__onResolverForContentPaddingWatchCallback)})}__onResolverForContentPaddingWatchCallback(data){this.__isAttached||this.__suspendObjectResolver("contentPadding"),data.error===TcHmi.Errors.NONE?tchmi_equal(data.value,this.__contentPadding)||(this.__contentPadding=data.value,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"ContentPadding"}),this.__processContentPadding()):TcHmi.Log.Controls.error(this,TcHmiTextbox.#tchmiFQN,{Attribute:"ContentPadding"},`Resolving symbols from object failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}getContentPadding(){return this.__contentPadding}__processContentPadding(){this.__elementInput&&0!==this.__elementInput.length&&TcHmi.StyleProvider.processContentPadding(this.__elementInput,this.__contentPadding)}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.__elementContainer,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.__elementContainer,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.__elementContainer,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.__elementContainer,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.__elementContainer,this.__textFontWeight)}setMultiline(valueNew){let convertedValue=TcHmi.ValueConverter.toBoolean(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("Multiline")),convertedValue!==this.__multiline&&(this.__multiline=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"Multiline"}),this.__processMultiline())}getMultiline(){return this.__multiline}__processMultiline(){const oldElement=this.__elementInput;!0===this.__multiline?void 0!==this.__elementInput&&0!==this.__elementInput.length&&"TEXTAREA"===this.__elementInput[0].tagName||(this.__elementInput=$('<textarea class="TcHmi_Controls_Beckhoff_TcHmiTextbox-template-input tchmi-textbox-template-input" wrap="off" spellcheck="false"></textarea>')):void 0!==this.__elementInput&&0!==this.__elementInput.length&&"INPUT"===this.__elementInput[0].tagName||(this.__elementInput=$('<input class="TcHmi_Controls_Beckhoff_TcHmiTextbox-template-input tchmi-textbox-template-input" spellcheck="false" />')),this.__elementInput!==oldElement&&(this.__processWordWrap(),this.__processText(),this.__processContentPadding(),this.__processPlaceholder(),this.__processHorizontalScroll(),this.__processVerticalScroll(),this.__validateTextValue(this.__text),oldElement&&oldElement.length>0?oldElement.replaceWith(this.__elementInput):this.__elementContainer.append(this.__elementInput),this.__elementInput[0].readOnly=this.__isReadOnly??!1),this.__systemKeyboardInputMode&&this.__elementInput[0].setAttribute("data-tchmi-input-mode",this.__systemKeyboardInputMode)}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.__elementInput&&0!==this.__elementInput.length&&(this.__wordWrap?(TcHmi.StyleProvider.setSimpleElementStyle(this.__elementInput,{"white-space":"pre-wrap","word-wrap":"break-word","overflow-wrap":"break-word"}),this.__elementInput[0].setAttribute("wrap","on")):(TcHmi.StyleProvider.setSimpleElementStyle(this.__elementInput,{"white-space":null,"word-wrap":null,"overflow-wrap":null}),this.__elementInput[0].setAttribute("wrap","off")))}setPlaceholder(valueNew){let convertedValue=TcHmi.ValueConverter.toString(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("Placeholder")),convertedValue!==this.__placeholder&&(this.__placeholder=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"Placeholder"}),this.__processPlaceholder())}getPlaceholder(){return this.__placeholder}__processPlaceholder(){this.__elementInput&&0!==this.__elementInput.length&&(this.__placeholder?this.__elementInput[0].setAttribute("placeholder",this.__placeholder):this.__elementInput[0].removeAttribute("placeholder"))}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,TcHmiTextbox.#tchmiFQN,{Attribute:"TextColor"},`Resolving symbols from object failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}getTextColor(){return this.__textColor}__processTextColor(){TcHmi.StyleProvider.processTextColor(this.__elementContainer,this.__textColor)}setAutoFocusOut(valueNew){let convertedValue=TcHmi.ValueConverter.toBoolean(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("AutoFocusOut")),convertedValue!==this.__autoFocusOut&&(this.__autoFocusOut=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"AutoFocusOut"}),this.__processAutoFocusOut())}getAutoFocusOut(){return this.__autoFocusOut}__processAutoFocusOut(){}setAutoSelectText(valueNew){let convertedValue=TcHmi.ValueConverter.toBoolean(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("AutoSelectText")),convertedValue!==this.__autoSelectText&&(this.__autoSelectText=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"AutoSelectText"}))}getAutoSelectText(){return this.__autoSelectText}setHorizontalScroll(valueNew){let convertedValue=TcHmi.ValueConverter.toEnum(valueNew,ScrollMode)??TcHmi.ValueConverter.toEnum(this.getAttributeDefaultValueInternal("HorizontalScroll"),ScrollMode,ScrollMode.Never);convertedValue!==this.__horizontalScroll&&(this.__horizontalScroll=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"HorizontalScroll"}),this.__processHorizontalScroll())}getHorizontalScroll(){if(void 0!==this.__horizontalScroll)return ScrollMode[this.__horizontalScroll]}__processHorizontalScroll(){if(this.__multiline&&this.__elementInput&&0!==this.__elementInput.length)switch(this.__horizontalScroll){case ScrollMode.Always:this.__elementInput[0].style.overflowX="scroll";break;case ScrollMode.Auto:this.__elementInput[0].style.overflowX="auto";break;default:this.__elementInput[0].style.overflowX="hidden"}}setVerticalScroll(valueNew){let convertedValue=TcHmi.ValueConverter.toEnum(valueNew,ScrollMode)??TcHmi.ValueConverter.toEnum(this.getAttributeDefaultValueInternal("VerticalScroll"),ScrollMode,ScrollMode.Never);convertedValue!==this.__verticalScroll&&(this.__verticalScroll=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"VerticalScroll"}),this.__processVerticalScroll())}getVerticalScroll(){if(void 0!==this.__verticalScroll)return ScrollMode[this.__verticalScroll]}__processVerticalScroll(){if(this.__multiline&&this.__elementInput&&0!==this.__elementInput.length)switch(this.__verticalScroll){case ScrollMode.Always:this.__elementInput[0].style.overflowY="scroll";break;case ScrollMode.Auto:this.__elementInput[0].style.overflowY="auto";break;default:this.__elementInput[0].style.overflowY="hidden"}}__lock(){this.__locked=!0}__unlock(){this.__locked=!1}__processControlActivation(){if(!this.__elementInput||0===this.__elementInput.length)return;const textArea=this.__elementInput[0];TcHmi.Access.checkAccess(this,"operate")&&this.getIsEnabled()?textArea.disabled=!1:(this.__unlock(),textArea.blur(),textArea.disabled=!0)}__processIsEnabled(){super.__processIsEnabled(),this.__processControlActivation()}__processAccessConfig(){super.__processAccessConfig(),this.__processControlActivation()}
/**
* 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.__elementInput?.length&&(this.__elementInput[0].readOnly=this.__isReadOnly??!1)}focus(){this.__elementInput?.[0].focus()}
/**
* Sets the maxTextLength attribute and calls the associated process function (processMaxTextLength).
* @preserve (Part of the public API)
*/setMaxTextLength(valueNew){let convertedValue=TcHmi.ValueConverter.toNumber(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("MaxTextLength")),convertedValue!==this.__maxTextLength&&(this.__maxTextLength=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"MaxTextLength"}),this.__processMaxTextLength())}getMaxTextLength(){return this.__maxTextLength}__processMaxTextLength(){this.__elementInput&&this.__validateTextValue(this.__elementInput[0].value)&&this.__setText(this.__elementInput[0].value)}__validateTextValue(newValue){return!this.__elementInput||(this.__elementInput[0].setCustomValidity(""),void 0===this.__maxTextLength||null===this.__maxTextLength||(!(newValue&&newValue.length>this.__maxTextLength)||(this.__setLocalizedInputValidity("MaxTextLengthReached"),!1)))}setResetToLastValidValue(valueNew){let convertedValue=TcHmi.ValueConverter.toBoolean(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("ResetToLastValidValue")),convertedValue!==this.__resetToLastValidValue&&(this.__resetToLastValidValue=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"ResetToLastValidValue"}),this.__processResetToLastValidValue())}getResetToLastValidValue(){return this.__resetToLastValidValue}__processResetToLastValidValue(){this.__resetToLastValidValue&&this.__elementInput&&(this.__elementInput[0].value=this.__text?this.__text:"",this.__validateTextValue(this.__text))}setInputProcessingPoint(valueNew){let convertedValue=TcHmi.ValueConverter.toEnum(valueNew,InputProcessingPoint);null===convertedValue&&(convertedValue=InputProcessingPoint[this.getAttributeDefaultValueInternal("InputProcessingPoint")]),convertedValue!==this.__valueBuffer?.processingPoint&&(this.__valueBuffer?this.__valueBuffer.processingPoint=convertedValue:this.__valueBuffer=new ValueBuffer(convertedValue,text=>this.__setText(text,!1)),TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"InputProcessingPoint"}),this.__processInputProcessingPoint())}getInputProcessingPoint(){return this.__valueBuffer?.processingPoint}__processInputProcessingPoint(){}__setLocalizedInputValidity(key,...parameters){const elementInput=this.__elementInput?.[0];if(elementInput)if(this.__localizedCustomValidity.key=key,this.__localizedCustomValidity.parameters=parameters,""===key)elementInput.setCustomValidity("");else if(this.__localizationReader){let localizedText=this.__localizationReader.get(key);this.__localizedCustomValidity.parameters.length>0&&(localizedText=tchmi_format_string(localizedText,...this.__localizedCustomValidity.parameters)),TCHMI_DESIGNER||elementInput.setCustomValidity(tchmi_decode_control_characters(localizedText))}else TCHMI_DESIGNER||elementInput.setCustomValidity("Invalid")}static ScrollMode=ScrollMode}})();TcHmi.Controls.registerEx("TcHmiTextbox","TcHmi.Controls.Beckhoff",TcHmiTextbox,{injectInGlobalObject:!0});export{TcHmiTextbox as Control};