16 lines
6.6 KiB
JavaScript
16 lines
6.6 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 TcHmiLoadingSpinner=(()=>{var _a;let ___onResolverForSpinnerColorWatchCallback_decorators,_classSuper=TcHmiControl.Control,_instanceExtraInitializers=[];return class TcHmiLoadingSpinner extends _classSuper{static{const _metadata="function"==typeof Symbol&&Symbol.metadata?Object.create(_classSuper[Symbol.metadata]??null):void 0;___onResolverForSpinnerColorWatchCallback_decorators=[(_a=TcHmi).CallbackMethod.bind(_a)],__esDecorate(this,null,___onResolverForSpinnerColorWatchCallback_decorators,{kind:"method",name:"__onResolverForSpinnerColorWatchCallback",static:!1,private:!1,access:{has:obj=>"__onResolverForSpinnerColorWatchCallback"in obj,get:obj=>obj.__onResolverForSpinnerColorWatchCallback},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;__elementTemplateRoot=__runInitializers(this,_instanceExtraInitializers);__elementLoadingSpinner;__loadingSpinnerDivs;__spinnerColor;__strokeThickness;constructor(element,pcElement,attrs){super(element,pcElement,attrs);let loadingSpinnerDivTempDiv=document.createElement("div");loadingSpinnerDivTempDiv.innerHTML='<div\n class="TcHmi_Controls_Beckhoff_TcHmiLoadingSpinner-loading-spinner-container"\n >\n <div class="TcHmi_Controls_Beckhoff_TcHmiLoadingSpinner-loading-spinner">\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </div>\n </div>',this.__elementLoadingSpinner=loadingSpinnerDivTempDiv.firstElementChild}__previnit(){if(this.__elementTemplateRoot=this.__element.find(".TcHmi_Controls_Beckhoff_TcHmiLoadingSpinner-template")[0],!this.__elementTemplateRoot)throw new Error("Invalid Template.html");this.__elementTemplateRoot.append(this.__elementLoadingSpinner);const loadingSpinnerDivs=this.__elementLoadingSpinner.querySelectorAll(".TcHmi_Controls_Beckhoff_TcHmiLoadingSpinner-loading-spinner div");if(!loadingSpinnerDivs||4!==loadingSpinnerDivs.length)throw new Error("Loading spinner divs not found or incorrect number of divs detected. Expected 4 divs.");this.__loadingSpinnerDivs=loadingSpinnerDivs,super.__previnit()}__init(){super.__init()}__attach(){super.__attach()}__detach(){super.__detach()}destroy(){super.destroy()}setColor(valueNew){let convertedValue=TcHmi.ValueConverter.toObject(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("Color"));let resolverInfo=this.__objectResolvers.get("Color");resolverInfo&&(resolverInfo.watchDestroyer&&resolverInfo.watchDestroyer(),resolverInfo.resolver.destroy());let resolver=new TcHmi.Symbol.ObjectResolver(convertedValue,{parentControl:this,type:this.getAttributeDescription("Color")?.type});this.__objectResolvers.set("Color",{resolver,watchCallback:this.__onResolverForSpinnerColorWatchCallback,watchDestroyer:resolver.watch(this.__onResolverForSpinnerColorWatchCallback)})}__onResolverForSpinnerColorWatchCallback(data){this.__isAttached||this.__suspendObjectResolver("Color"),data.error===TcHmi.Errors.NONE?tchmi_equal(data.value,this.__spinnerColor)||(this.__spinnerColor=data.value,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"Color"}),this.__processColor()):TcHmi.Log.Controls.error(this,TcHmiLoadingSpinner.#tchmiFQN,{Attribute:"Color"},`Resolving symbols from object failed with error: ${TcHmi.Log.buildMessage(data.details)}`)}getColor(){return this.__spinnerColor}__processColor(){for(const div of this.__loadingSpinnerDivs)div.style.borderColor=this.__spinnerColor?TcHmi.StyleProvider.resolveSolidColorAsCssValue(this.__spinnerColor)+" transparent transparent transparent":""}
|
|
/**
|
|
* Sets the value of the stroke thickness attribute.
|
|
* @param valueNew
|
|
* @preserve (Part of the public API)
|
|
*/setStrokeThickness(valueNew){let convertedValue=TcHmi.ValueConverter.toNumber(valueNew);null===convertedValue&&(convertedValue=this.getAttributeDefaultValueInternal("StrokeThickness")),convertedValue!==this.__strokeThickness&&(this.__strokeThickness=convertedValue,TcHmi.EventProvider.raise(this.__id+".onPropertyChanged",{propertyName:"StrokeThickness"}),this.__processStrokeThickness())}
|
|
/**
|
|
* Gets the value of the stroke thickness attribute.
|
|
* @param valueNew
|
|
* @preserve (Part of the public API)
|
|
*/getStrokeThickness(){return this.__strokeThickness}__processStrokeThickness(){const borderWidth=this.__strokeThickness?this.__strokeThickness+"px":"";for(const div of this.__loadingSpinnerDivs)div.style.borderWidth=borderWidth}
|
|
/**
|
|
* Gets the value of the stroke thickness unit attribute.
|
|
* @param valueNew
|
|
* @preserve (Part of the public API)
|
|
*/getStrokeThicknessUnit(){return"px"}}})();TcHmi.Controls.registerEx("TcHmiLoadingSpinner","TcHmi.Controls.Beckhoff",TcHmiLoadingSpinner,{injectInGlobalObject:!0});export{TcHmiLoadingSpinner as Control}; |