1 line
32 KiB
JavaScript
1 line
32 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 TcHmiEventLine=(()=>{var _a,_b,_c,_d,_e;let ___serverResponseHandler_decorators,___onPressed_decorators,___onMouseUp_decorators,___onMouseEnter_decorators,___onMouseDown_decorators,___onMouseLeave_decorators,___onTouchStart_decorators,___onTouchEndOrCancel_decorators,___onDocumentMouseUp_decorators,___onResized_decorators,___onResolverForMessageFormatWatchCallback_decorators,___onResolverForFilterWatchCallback_decorators,___onResolverForSortingWatchCallback_decorators,___onResolverForTextColorWatchCallback_decorators,_classSuper=TcHmiControl.Control,_instanceExtraInitializers=[];return class TcHmiEventLine extends _classSuper{static{const _metadata="function"==typeof Symbol&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0;___serverResponseHandler_decorators=[(_a=TcHmi).CallbackMethod.bind(_a)],___onPressed_decorators=[TcHmi.EventHandler()],___onMouseUp_decorators=[TcHmi.EventHandler({checkIsEnabled:!0,checkAccess:"operate"})],___onMouseEnter_decorators=[TcHmi.EventHandler({checkIsEnabled:!0,checkAccess:"operate"})],___onMouseDown_decorators=[TcHmi.EventHandler({checkIsEnabled:!0,checkAccess:"operate"})],___onMouseLeave_decorators=[TcHmi.EventHandler({checkIsEnabled:!0,checkAccess:"operate"})],___onTouchStart_decorators=[TcHmi.EventHandler({checkIsEnabled:!0,checkAccess:"operate"})],___onTouchEndOrCancel_decorators=[TcHmi.EventHandler({checkIsEnabled:!0,checkAccess:"operate"})],___onDocumentMouseUp_decorators=[TcHmi.EventHandler()],___onResized_decorators=[TcHmi.EventHandler()],___onResolverForMessageFormatWatchCallback_decorators=[(_b=TcHmi).CallbackMethod.bind(_b)],___onResolverForFilterWatchCallback_decorators=[(_c=TcHmi).CallbackMethod.bind(_c)],___onResolverForSortingWatchCallback_decorators=[(_d=TcHmi).CallbackMethod.bind(_d)],___onResolverForTextColorWatchCallback_decorators=[(_e=TcHmi).CallbackMethod.bind(_e)],__esDecorate(this,null,___serverResponseHandler_decorators,{kind:"method",name:"__serverResponseHandler",static:!1,private:!1,access:{has:obj=>"__serverResponseHandler"in obj,get:obj=>obj.__serverResponseHandler},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onPressed_decorators,{kind:"method",name:"__onPressed",static:!1,private:!1,access:{has:obj=>"__onPressed"in obj,get:obj=>obj.__onPressed},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,___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,___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,___onDocumentMouseUp_decorators,{kind:"method",name:"__onDocumentMouseUp",static:!1,private:!1,access:{has:obj=>"__onDocumentMouseUp"in obj,get:obj=>obj.__onDocumentMouseUp},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onResized_decorators,{kind:"method",name:"__onResized",static:!1,private:!1,access:{has:obj=>"__onResized"in obj,get:obj=>obj.__onResized},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onResolverForMessageFormatWatchCallback_decorators,{kind:"method",name:"__onResolverForMessageFormatWatchCallback",static:!1,private:!1,access:{has:obj=>"__onResolverForMessageFormatWatchCallback"in obj,get:obj=>obj.__onResolverForMessageFormatWatchCallback},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onResolverForFilterWatchCallback_decorators,{kind:"method",name:"__onResolverForFilterWatchCallback",static:!1,private:!1,access:{has:obj=>"__onResolverForFilterWatchCallback"in obj,get:obj=>obj.__onResolverForFilterWatchCallback},metadata:_metadata},null,_instanceExtraInitializers),__esDecorate(this,null,___onResolverForSortingWatchCallback_decorators,{kind:"method",name:"__onResolverForSortingWatchCallback",static:!1,private:!1,access:{has:obj=>"__onResolverForSortingWatchCallback"in obj,get:obj=>obj.__onResolverForSortingWatchCallback},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);__elementIcon;__elementMessageContainer;__elementMessage;__messageContent="";__elementButton;__messageFormat;__mouseDown=!1;__textColor;__textFontSize;__textFontSizeUnit;__textFontFamily;__textFontStyle;__textFontWeight;__targetRegion;__targetContent;__ignoreEscapeSequences;__showMessageIfEmpty;__filter;__sorting;__event;__subscriptionId=0;__serverInterval;__textOverflow;__marqueeSpeedFactor;__localizedElements=new Map;__localizationReader=void 0;__previnit(){if(this.__elementTemplateRoot=this.__element[0].getElementsByClassName("TcHmi_Controls_Beckhoff_TcHmiEventLine-Template")[0],!this.__elementTemplateRoot)throw new Error("Invalid Template.html");if(this.__elementIcon=this.__element[0].getElementsByClassName("TcHmi_Controls_Beckhoff_TcHmiEventLine-Icon")[0],!this.__elementIcon)throw new Error("Invalid Template.html");if(this.__elementMessageContainer=this.__element[0].getElementsByClassName("TcHmi_Controls_Beckhoff_TcHmiEventLine-Message-Container")[0],!this.__elementMessageContainer)throw new Error("Invalid Template.html");if(this.__elementMessage=this.__element[0].getElementsByClassName("TcHmi_Controls_Beckhoff_TcHmiEventLine-Message")[0],!this.__elementMessage)throw new Error("Invalid Template.html");if(this.__elementButton=this.__element[0].getElementsByClassName("TcHmi_Controls_Beckhoff_TcHmiEventLine-Button")[0],!this.__elementButton)throw new Error("Invalid Template.html");this.__destroyOnDestroy.push(this.__localization.watch(data=>{if(data.error===TcHmi.Errors.NONE&&data.reader){this.__localizationReader=data.reader;for(const[element,info]of this.__localizedElements){let localizedText=data.reader.get(info.key);info.parameters&&(localizedText=tchmi_format_string(localizedText,...info.parameters));const text=tchmi_decode_control_characters(localizedText);element.setAttribute("title",text),element.textContent=text}this.__updateEventLine()}})),this.__destroyOnDestroy.push(TcHmi.EventProvider.registerDomEvent(this.__elementTemplateRoot,"mouseenter",this.__onMouseEnter),TcHmi.EventProvider.registerDomEvent(this.__elementTemplateRoot,"mouseleave",this.__onMouseLeave),TcHmi.EventProvider.registerDomEvent(this.__elementTemplateRoot,"mousedown",this.__onMouseDown),TcHmi.EventProvider.registerDomEvent(this.__elementTemplateRoot,"mouseup",this.__onMouseUp),TcHmi.EventProvider.registerDomEvent(this.__elementTemplateRoot,"touchcancel",this.__onTouchEndOrCancel),TcHmi.EventProvider.registerDomEvent(this.__elementTemplateRoot,"touchstart",this.__onTouchStart),TcHmi.EventProvider.registerDomEvent(this.__elementTemplateRoot,"touchend",this.__onTouchEndOrCancel)),super.__previnit()}__init(){super.__init()}__attach(){super.__attach(),this.__destroyOnDetach.push(TcHmi.EventProvider.register(this.getId()+".onPressed",this.__onPressed),TcHmi.EventProvider.register(this.__id+".onResized",this.__onResized),TcHmi.EventProvider.registerDomEvent(document,"mouseup",this.__onDocumentMouseUp)),this.__updateSubscription()}__detach(){super.__detach(),0!==this.__subscriptionId&&TcHmi.Server.unsubscribeEx(this.__subscriptionId,null,data=>{data.error!==TcHmi.Errors.NONE&&TcHmi.Log.Controls.error(this,TcHmiEventLine.#tchmiFQN,{Symbol:"ListEvents"},TcHmi.Log.buildMessage(data.details))}),this.__subscriptionId=0}destroy(){this.__keepAlive||super.destroy()}__updateSubscription(){TCHMI_DESIGNER||(0!==this.__subscriptionId&&TcHmi.Server.unsubscribeEx(this.__subscriptionId,null,data=>{data.error!==TcHmi.Errors.NONE&&TcHmi.Log.Controls.error(this,TcHmiEventLine.#tchmiFQN,{Symbol:"ListEvents"},TcHmi.Log.buildMessage(data.details))}),this.__subscriptionId=0,this.__isAttached&&(this.__subscriptionId=TcHmi.Server.subscribeEx([{commandOptions:["SendErrorMessage"],symbol:"ListEvents",limit:1,filter:this.__filter??void 0,orderBy:this.__sorting?.map(info=>(info.name??"{value}")+" "+("Descending"===info.order?"DESC":"ASC")).join(", ")}],this.__serverInterval??TcHmi.Config.get().tcHmiServer.websocketIntervalTime,null,this.__serverResponseHandler)??0))}__serverResponseHandler(data){return data.error!==TcHmi.Errors.NONE?(TcHmi.Log.Controls.error(this,TcHmiEventLine.#tchmiFQN,{Symbol:"ListEvents"},TcHmi.Log.buildMessage(data.details)),this.__removeLocalizedElement(this.__elementMessage),void this.__addLocalizedElement(this.__elementMessage,"Browser_Console_Could_Have_More_Information")):data.response?data.response.error?(TcHmi.Log.Controls.error(this,TcHmiEventLine.#tchmiFQN,{Symbol:"ListEvents"},TcHmi.Log.buildMessage(data.response.error)),this.__removeLocalizedElement(this.__elementMessage),void this.__addLocalizedElement(this.__elementMessage,"Browser_Console_Could_Have_More_Information")):data.response.commands&&0!==data.response.commands.length?(data.response.commands[0].readValue?.length>0?this.__event=TcHmi.Server.Events.parseServerEvent(data.response.commands[0].readValue[0]):this.__event=void 0,void this.__updateEventLine()):(TcHmi.Log.Controls.error(this,TcHmiEventLine.#tchmiFQN,{Symbol:"ListEvents"},TcHmi.Log.buildMessage({code:TcHmi.Errors.E_SERVER_COMMANDS_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_COMMANDS_MISSING],reason:"Missing commands in response from server with id: "+data.response.id,domain:this.__type})),this.__removeLocalizedElement(this.__elementMessage),void this.__addLocalizedElement(this.__elementMessage,"Browser_Console_Could_Have_More_Information")):(TcHmi.Log.Controls.error(this,TcHmiEventLine.#tchmiFQN,{Symbol:"ListEvents"},TcHmi.Log.buildMessage({code:TcHmi.Errors.E_SERVER_RESPONSE_MISSING,message:TcHmi.Errors[TcHmi.Errors.E_SERVER_RESPONSE_MISSING],reason:"Missing response from server.",domain:this.__type})),this.__removeLocalizedElement(this.__elementMessage),void this.__addLocalizedElement(this.__elementMessage,"Browser_Console_Could_Have_More_Information"))}__updateEventLine(){if(!TcHmi.Access.checkAccess(this,"observe"))return;this.__removeLocalizedElement(this.__elementMessage);let currentEvent=this.__event;if(TCHMI_DESIGNER&&(currentEvent={name:"Placeholder Event",text:"This is a placeholder event text",timeCleared:new Date,timeConfirmed:new Date,timeRaised:new Date,timeReceived:new Date,type:TcHmi.Server.Events.Type.Alarm,alarmState:TcHmi.Server.Events.AlarmState.Raised,severity:TcHmi.Server.Events.Severity.Info,sessionId:"Placeholder session ID",confirmationState:TcHmi.Server.Events.ConfirmationState.WaitForConfirmation,domain:"Placeholder domain",sourceDomain:"Placeholder source domain"}),this.__elementMessage.classList.toggle("tchmi-designer-control-message",!this.__messageFormat?.length&&TCHMI_DESIGNER),this.__messageFormat?.length)if(currentEvent){(TcHmi.Server.Events.isAlarm(currentEvent)||TcHmi.Server.Events.isMessage(currentEvent))&&this.__setIconBySeverity(currentEvent.severity);let messageParts=[];for(let element of this.__messageFormat)if(this.__isEventProperty(element)){let messageFormat=" - ";switch(element.name){case"timeRaised":case"timeConfirmed":case"timeCleared":case"timeReceived":let time=currentEvent[element.name];null!=time&&(messageFormat=TcHmi.Localization.formatDate(time)??" - ");break;case"severity":if(TcHmi.Server.Events.isPayload(currentEvent))break;let severity=currentEvent[element.name];null!=severity&&(messageFormat=this.__localizationReader?.get("Severity_"+TcHmi.Server.Events.Severity[severity])??" - ");break;case"type":let type=currentEvent[element.name];null!=type&&(messageFormat=this.__localizationReader?.get("Type_"+TcHmi.Server.Events.Type[type])??" - ");break;case"alarmState":if(!TcHmi.Server.Events.isAlarm(currentEvent))break;let alarmState=currentEvent[element.name];null!=alarmState&&(messageFormat=this.__localizationReader?.get("AlarmState_"+TcHmi.Server.Events.AlarmState[alarmState])??" - ");break;case"confirmationState":if(TcHmi.Server.Events.isMessage(currentEvent)||TcHmi.Server.Events.isPayload(currentEvent))break;let confirmationState=currentEvent[element.name];null!=confirmationState&&(messageFormat=this.__localizationReader?.get("ConfirmationState_"+TcHmi.Server.Events.ConfirmationState[confirmationState])??" - ");break;default:const path=new TcHmi.ObjectPath(element.name);if(path.length>0){let value;try{value=path.readFrom(currentEvent)}catch(ex){value=" - "}messageFormat=TcHmi.ValueConverter.toString(value," - "),TCHMI_DESIGNER&&" - "===messageFormat&&(messageFormat=path.toPathTokens().join(" "))}}this.__ignoreEscapeSequences||(messageFormat=tchmi_decode_control_characters(messageFormat)),element.format&&(messageFormat=this.__executeFormatFunction(element.format,messageFormat)??messageFormat),messageParts.push(messageFormat)}else if(this.__isVerbatimText(element)){let text=element.text;this.__ignoreEscapeSequences||(text=tchmi_decode_control_characters(text)),element.format&&(text=this.__executeFormatFunction(element.format,text)??text),messageParts.push(text)}let eventMessage=messageParts.join("");this.__elementMessage.setAttribute("title",eventMessage),this.__elementMessage.innerText=eventMessage}else this.__showMessageIfEmpty?this.__addLocalizedElement(this.__elementMessage,"NoEventsReceived"):(this.__elementMessage.setAttribute("title",""),this.__elementMessage.textContent=""),this.__setIconBySeverity(null);else this.__addLocalizedElement(this.__elementMessage,"NoElementsDefined"),this.__setIconBySeverity(null);this.__messageContent=this.__elementMessage.innerText,this.__processTextOverflow()}__executeFormatFunction(format,value){if(!1!==format.active){const args=[value];let res=null,f=new TcHmi.Function(format);if(f.isProcessedAsync())TcHmi.Log.Controls.error(this,TcHmiEventLine.#tchmiFQN,{Symbol:"ListEvents"},`Execution of function=${format.fn} was aborted because it will be processed asynchronous and a synchronous running function call is required. Either the function is running asynchronous by definition or asynchronous running symbols were added to the list of parameters.`);else{const parameters=f.getDescription()?.function.arguments;if(parameters?.length){const schema=tchmi_clone_object(TcHmi.Type.getSchema(parameters[0].type));if(schema&&TcHmi.Type.Schema.matchesSchemaType(value,schema))return f.executeEx(args,data=>{data.error===TcHmi.Errors.NONE&&void 0!==data.result?res=data.result:TcHmi.Log.Controls.error(this,TcHmiEventLine.#tchmiFQN,`Execution of function=${format.fn} failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}),f.destroy(),res}}}return null!=value?value:""}__setIconBySeverity(severity){this.__elementIcon.classList.toggle("severity-verbose",severity===TcHmi.Server.Events.Severity.Verbose),this.__elementIcon.classList.toggle("severity-info",severity===TcHmi.Server.Events.Severity.Info),this.__elementIcon.classList.toggle("severity-warning",severity===TcHmi.Server.Events.Severity.Warning),this.__elementIcon.classList.toggle("severity-error",severity===TcHmi.Server.Events.Severity.Error),this.__elementIcon.classList.toggle("severity-critical",severity===TcHmi.Server.Events.Severity.Critical)}__isEventProperty(obj){return"name"in obj}__isVerbatimText(obj){return"text"in obj}__onPressed(_event){this.__targetRegion&&this.__targetContent&&this.__targetRegion.setTargetContent(this.__targetContent)}__onMouseUp(_event){this.__element.removeClass("down")}__onMouseEnter(_event){this.__mouseDown&&this.__element.addClass("down")}__onMouseDown(_event){this.__mouseDown=!0,this.__element.addClass("down")}__onMouseLeave(_event){this.__element.removeClass("down")}__onTouchStart(_event){this.__element.addClass("down")}__onTouchEndOrCancel(_event){this.__element.removeClass("down")}__onDocumentMouseUp(_event){this.__mouseDown=!1}__onResized(_event){let height=this.getRenderedHeight();height&&(this.__borderWidth&&this.__borderStyle&&("None"!==this.__borderStyle.top&&(height-=this.__borderWidth.top),"None"!==this.__borderStyle.bottom&&(height-=this.__borderWidth.bottom)),this.__element[0].style.setProperty("--tchmi-icon-size",height+"px"),this.__processTextOverflow())}__addLocalizedElement(element,key,...parameters){let info={key};if(0!==parameters.length&&(info.parameters=parameters),this.__localizedElements.set(element,info),this.__localizationReader){let localizedText=this.__localizationReader.get(key);info.parameters&&(localizedText=tchmi_format_string(localizedText,...info.parameters));const text=tchmi_decode_control_characters(localizedText);element.setAttribute("title",text),element.textContent=text}}__removeLocalizedElement(element){this.__localizedElements.delete(element)}setMessageFormat(valueNew){let convertedValue=TcHmi.ValueConverter.toObject(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("MessageFormat"));let resolverInfo=this.__objectResolvers.get("messageFormat");resolverInfo&&(resolverInfo.watchDestroyer&&resolverInfo.watchDestroyer(),resolverInfo.resolver.destroy());let resolver=new TcHmi.Symbol.ObjectResolver(convertedValue,{parentControl:this,type:this.getAttributeDescription("MessageFormat")?.type});this.__objectResolvers.set("messageFormat",{resolver,watchCallback:this.__onResolverForMessageFormatWatchCallback,watchDestroyer:resolver.watch(this.__onResolverForMessageFormatWatchCallback)})}__onResolverForMessageFormatWatchCallback(data){this.__isAttached||this.__suspendObjectResolver("messageFormat"),data.error===TcHmi.Errors.NONE?tchmi_equal(data.value,this.__messageFormat)||(this.__messageFormat=data.value,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"MessageFormat"}),this.__processMessageFormat()):TcHmi.Log.Controls.error(this,TcHmiEventLine.#tchmiFQN,{Attribute:"MessageFormat"},`Resolving symbols from object failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}getMessageFormat(){return this.__messageFormat}__processMessageFormat(){this.__updateEventLine()}setServerInterval(valueNew){let convertedValue=TcHmi.ValueConverter.toNumber(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("ServerInterval")),convertedValue!==this.__serverInterval&&(this.__serverInterval=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"ServerInterval"}),this.__processServerInterval())}getServerInterval(){return this.__serverInterval}__processServerInterval(){this.__isAttached&&this.__updateSubscription()}setFilter(valueNew){let convertedValue=TcHmi.ValueConverter.toObject(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("Filter"));let resolverInfo=this.__objectResolvers.get("filter");resolverInfo&&(resolverInfo.watchDestroyer&&resolverInfo.watchDestroyer(),resolverInfo.resolver.destroy());let resolver=new TcHmi.Symbol.ObjectResolver(convertedValue,{parentControl:this,type:this.getAttributeDescription("Filter")?.type});this.__objectResolvers.set("filter",{resolver,watchCallback:this.__onResolverForFilterWatchCallback,watchDestroyer:resolver.watch(this.__onResolverForFilterWatchCallback)})}__onResolverForFilterWatchCallback(data){this.__isAttached||this.__suspendObjectResolver("filter"),data.error===TcHmi.Errors.NONE?tchmi_equal(data.value,this.__filter)||(this.__filter=data.value,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"Filter"}),this.__processFilter()):TcHmi.Log.Controls.error(this,TcHmiEventLine.#tchmiFQN,{Attribute:"Filter"},`Resolving symbols from object failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}getFilter(){return this.__filter}__processFilter(){this.__isAttached&&this.__updateSubscription()}setSorting(valueNew){let convertedValue=TcHmi.ValueConverter.toObject(valueNew)??this.getAttributeDefaultValueInternal("Sorting"),resolverInfo=this.__objectResolvers.get("sorting");resolverInfo&&(resolverInfo.watchDestroyer&&resolverInfo.watchDestroyer(),resolverInfo.resolver.destroy());let resolver=new TcHmi.Symbol.ObjectResolver(convertedValue,{parentControl:this,type:this.getAttributeDescription("Sorting")?.type});this.__objectResolvers.set("sorting",{resolver,watchCallback:this.__onResolverForSortingWatchCallback,watchDestroyer:resolver.watch(this.__onResolverForSortingWatchCallback)})}__onResolverForSortingWatchCallback(data){this.__isAttached||this.__suspendObjectResolver("sorting"),data.error===TcHmi.Errors.NONE?tchmi_equal(data.value,this.__sorting)||(this.__sorting=data.value,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"Sorting"}),this.__processSorting()):TcHmi.Log.Controls.error(this,TcHmiEventLine.#tchmiFQN,{Attribute:"Sorting"},`Resolving symbols from object failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}getSorting(){return this.__sorting}__processSorting(){this.__isAttached&&this.__updateSubscription()}setTargetRegion(valueNew){let convertedValue=valueNew instanceof TcHmi.Controls.System.TcHmiRegion?valueNew:null;null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("TargetRegion")),convertedValue!==this.__targetRegion&&(this.__targetRegion=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"TargetRegion"}),this.__processTargetRegion())}getTargetRegion(){return this.__targetRegion}__processTargetRegion(){this.__elementButton.style.display=this.__targetRegion&&this.__targetContent?"":"none"}setTargetContent(valueNew){let convertedValue=TcHmi.ValueConverter.toString(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("TargetContent")),convertedValue!==this.__targetContent&&(this.__targetContent=valueNew,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"TargetContent"}),this.__processTargetContent())}getTargetContent(){return this.__targetContent}__processTargetContent(){this.__processTargetRegion()}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,TcHmiEventLine.#tchmiFQN,{Attribute:"TextColor"},`Resolving symbols from object failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}getTextColor(){return this.__textColor}__processTextColor(){this.__elementMessage&&void 0!==this.__textColor&&TcHmi.StyleProvider.processTextColor(this.__elementMessage,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(){this.__elementMessage&&TcHmi.StyleProvider.processFontSize(this.__elementMessage,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(){this.__elementMessage&&TcHmi.StyleProvider.processFontSize(this.__elementMessage,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.__elementMessage,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.__elementMessage,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.__elementMessage,this.__textFontWeight)}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.__processIgnoreEscapeSequences())}getIgnoreEscapeSequences(){return this.__ignoreEscapeSequences}__processIgnoreEscapeSequences(){this.__updateEventLine()}setShowMessageIfEmpty(valueNew){let convertedValue=TcHmi.ValueConverter.toBoolean(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("ShowMessageIfEmpty")),convertedValue!==this.__showMessageIfEmpty&&(this.__showMessageIfEmpty=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"ShowMessageIfEmpty"}),this.__processShowMessageIfEmpty())}getShowMessageIfEmpty(){return this.__showMessageIfEmpty}__processShowMessageIfEmpty(){this.__updateEventLine()}setTextOverflow(valueNew){let convertedValue=TcHmi.ValueConverter.toString(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("TextOverflow")),convertedValue!==this.__textOverflow&&(this.__textOverflow=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"TextOverflow"}),this.__processTextOverflow())}getTextOverflow(){return this.__textOverflow}__processTextOverflow(){if(this.__elementMessageContainer.classList.toggle("ellipsis","Ellipsis"===this.__textOverflow),this.__elementMessageContainer.classList.remove("marquee-left-to-right"),this.__elementMessageContainer.classList.remove("marquee-right-to-left"),this.__elementMessage.innerText=this.__messageContent,"Ellipsis"===this.__textOverflow)return;let messageWidth=this.__elementMessage.getBoundingClientRect().width;if(this.__elementMessageContainer.getBoundingClientRect().width>=messageWidth)return;"MarqueeLeftToRight"===this.__textOverflow?(this.__elementMessageContainer.classList.add("marquee-left-to-right"),this.__elementMessage.innerText=this.__messageContent+" "+this.__messageContent+" "):"MarqueeRightToLeft"===this.__textOverflow&&(this.__elementMessageContainer.classList.add("marquee-right-to-left"),this.__elementMessage.innerText=" "+this.__messageContent+" "+this.__messageContent),this.__elementMessage.style.animationDuration=messageWidth/25/(this.__marqueeSpeedFactor??1)+"s"}setMarqueeSpeedFactor(valueNew){let convertedValue=TcHmi.ValueConverter.toNumber(valueNew);(null===convertedValue||convertedValue<=0)&&(convertedValue=this.getAttributeDefaultValueInternal("MarqueeSpeedFactor")),convertedValue!==this.__marqueeSpeedFactor&&(this.__marqueeSpeedFactor=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"MarqueeSpeedFactor"}),this.__processMarqueeSpeedFactor())}getMarqueeSpeedFactor(){return this.__marqueeSpeedFactor}__processMarqueeSpeedFactor(){this.__processTextOverflow()}}})();TcHmi.Controls.registerEx("TcHmiEventLine","TcHmi.Controls.Beckhoff",TcHmiEventLine,{injectInGlobalObject:!0});export{TcHmiEventLine as Control}; |