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

1 line
8.3 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 TcHmiProgressBar=(()=>{var _a;let ___onResolverForBarColorWatchCallback_decorators,_classSuper=TcHmiControl.Control,_instanceExtraInitializers=[];return class TcHmiProgressBar extends _classSuper{static{const _metadata="function"==typeof Symbol&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0;___onResolverForBarColorWatchCallback_decorators=[(_a=TcHmi).CallbackMethod.bind(_a)],__esDecorate(this,null,___onResolverForBarColorWatchCallback_decorators,{kind:"method",name:"__onResolverForBarColorWatchCallback",static:!1,private:!1,access:{has:obj=>"__onResolverForBarColorWatchCallback"in obj,get:obj=>obj.__onResolverForBarColorWatchCallback},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);__elementBar;__value;__maxValue;__minValue;__baseAnimationTime;__progressBarAnimation=null;__progress=0;__internalMinValue=0;__internalMaxValue=0;__barColor;__previnit(){if(this.__elementTemplateRoot=this.__element[0].getElementsByClassName("TcHmi_Controls_Beckhoff_TcHmiProgressBar-template")[0],this.__elementBar=this.__elementTemplateRoot.getElementsByClassName("TcHmi_Controls_Beckhoff_TcHmiProgressBar-bar")[0],!this.__elementTemplateRoot||!this.__elementBar)throw new Error("Invalid Template.html");super.__previnit()}__init(){super.__init()}__attach(){super.__attach(),this.__updateProgress(!0)}__detach(){super.__detach()}destroy(){this.__keepAlive||super.destroy()}__updateProgress(skipAnimation=!1){if(this.__isAttached){if(null!==this.__progressBarAnimation&&this.__progressBarAnimation.state()!==TcHmi.Animation.Status.ENDED&&this.__progressBarAnimation.skip(),void 0===this.__value||null===this.__value)this.__elementBar.style.width="0%",this.__progress=0;else{null===this.__progressBarAnimation&&(this.__progressBarAnimation=new TcHmi.Animation(this.__id,".TcHmi_Controls_Beckhoff_TcHmiProgressBar-bar").timingFunction("linear").fillMode("both").cleanup(!0).useCss(!1));let progressValue=this.__value;progressValue=progressValue<this.__internalMinValue?this.__internalMinValue:progressValue,progressValue=progressValue>this.__internalMaxValue?this.__internalMaxValue:progressValue;let oldProgress=this.__progress;if(this.__progress=100*this.__calculatePercentage(progressValue),this.__baseAnimationTime&&!skipAnimation){let difference=Math.abs(this.__progress-oldProgress),animationTime=this.__baseAnimationTime;isNaN(difference)||(animationTime*=difference/100);let from={width:`${Math.abs(oldProgress)}%`},to={width:`${Math.abs(this.__progress)}%`};this.__progressBarAnimation.clearKeyframes().duration(animationTime).addKeyframe(from,0).addKeyframe(to,1).run()}else this.__elementBar.style.width=this.__progress+"%"}TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"Progress"})}}__calculatePercentage(value){return(value-this.__internalMinValue)/(this.__internalMaxValue-this.__internalMinValue)}__setInternalMinMaxValues(){void 0!==this.__minValue&&void 0!==this.__maxValue?(this.__internalMinValue=this.__minValue>this.__maxValue?this.__maxValue:this.__minValue,this.__internalMaxValue=this.__maxValue<this.__minValue?this.__minValue:this.__maxValue):(this.__internalMinValue=0,this.__internalMaxValue=0)}setValue(valueNew){let convertedValue=TcHmi.ValueConverter.toNumber(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("Value")),convertedValue!==this.__value&&(this.__value=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"Value"}),TcHmi.EventProvider.raise(this.__id+".onValueChanged"),this.__processValue())}getValue(){return this.__value}__processValue(){this.__updateProgress()}setMinValue(valueNew){let convertedValue=TcHmi.ValueConverter.toNumber(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("MinValue")),convertedValue!==this.__minValue&&(this.__minValue=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"MinValue"}),this.__processMinValue())}getMinValue(){return this.__minValue}__processMinValue(){void 0!==this.__maxValue&&void 0!==this.__minValue&&(this.__setInternalMinMaxValues(),void 0!==this.__value&&this.__updateProgress())}setMaxValue(valueNew){let convertedValue=TcHmi.ValueConverter.toNumber(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("MaxValue")),convertedValue!==this.__maxValue&&(this.__maxValue=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"MaxValue"}),this.__processMaxValue())}getMaxValue(){return this.__maxValue}__processMaxValue(){void 0!==this.__maxValue&&void 0!==this.__minValue&&(this.__setInternalMinMaxValues(),void 0!==this.__value&&this.__updateProgress())}setBarColor(valueNew){let convertedValue=TcHmi.ValueConverter.toObject(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("BarColor"));let resolverInfo=this.__objectResolvers.get("barColor");resolverInfo&&(resolverInfo.watchDestroyer&&resolverInfo.watchDestroyer(),resolverInfo.resolver.destroy());let resolver=new TcHmi.Symbol.ObjectResolver(convertedValue,{parentControl:this,type:this.getAttributeDescription("BarColor")?.type});this.__objectResolvers.set("barColor",{resolver,watchCallback:this.__onResolverForBarColorWatchCallback,watchDestroyer:resolver.watch(this.__onResolverForBarColorWatchCallback)})}__onResolverForBarColorWatchCallback(data){this.__isAttached||this.__suspendObjectResolver("barColor"),data.error===TcHmi.Errors.NONE?tchmi_equal(data.value,this.__barColor)||(this.__barColor=data.value,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"BarColor"}),this.__processBarColor()):TcHmi.Log.Controls.error(this,TcHmiProgressBar.#tchmiFQN,{Attribute:"BarColor"},`Resolving symbols from object failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}getBarColor(){return this.__barColor}__processBarColor(){TcHmi.StyleProvider.processBackgroundColor(this.__elementBar,this.__barColor)}setBaseAnimationTime(valueNew){let convertedValue=TcHmi.ValueConverter.toNumber(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("BaseAnimationTime")),convertedValue!==this.__baseAnimationTime&&(this.__baseAnimationTime=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"BaseAnimationTime"}))}getBaseAnimationTime(){return this.__baseAnimationTime}}})();TcHmi.Controls.registerEx("TcHmiProgressBar","TcHmi.Controls.Beckhoff",TcHmiProgressBar,{injectInGlobalObject:!0});export{TcHmiProgressBar as Control};