Added minimal functionality for Robot teaching
- Added minimal HMI - Added possibility to open and close all chamber doors
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import type { TcHmiControl } from 'Beckhoff.TwinCAT.HMI.Framework/index.esm.js';
|
||||
import { Banner } from './Banner.js';
|
||||
import type { Control as TcHmiButton } from '../../TcHmiButton/TcHmiButton.esm.js';
|
||||
import type { Control as TcHmiCheckbox } from '../../TcHmiCheckbox/TcHmiCheckbox.esm.js';
|
||||
export declare class ApprovalBanner extends Banner {
|
||||
protected readonly __parentControl?: (TcHmiControl.Control | null) | undefined;
|
||||
protected __approveButton: TcHmiButton;
|
||||
protected __repetitionCheckbox: TcHmiCheckbox;
|
||||
protected __storage: TcHmi.LocalStorage<{
|
||||
dontShowAgain: boolean;
|
||||
}> | undefined;
|
||||
/**
|
||||
* Creates a new Banner instance.
|
||||
* @param targetElement The element the banner is placed over.
|
||||
* @param storageId The storage id to rember if the banner should not be displayed anymore
|
||||
* @param __parentControl The control which owns the Banner.
|
||||
*/
|
||||
constructor(targetElement: HTMLElement, storageId: string | null, __parentControl?: (TcHmiControl.Control | null) | undefined);
|
||||
show(): void;
|
||||
/**
|
||||
* Handler for the onPressed event of the OK button.
|
||||
*/
|
||||
protected __onApproved(): void;
|
||||
/**
|
||||
* Sets texts which can either be localizable or static.
|
||||
*/
|
||||
setTexts(texts: Partial<ApprovalBanner.LocalizableTexts>): void;
|
||||
}
|
||||
export declare namespace ApprovalBanner {
|
||||
interface LocalizableTexts extends Banner.LocalizableTexts {
|
||||
buttonText: TcHmi.Localizable;
|
||||
checkboxText: TcHmi.Localizable;
|
||||
}
|
||||
}
|
||||
import _ApprovalBanner = ApprovalBanner;
|
||||
declare global {
|
||||
namespace TcHmi.Controls.Helpers {
|
||||
let ApprovalBanner: typeof _ApprovalBanner;
|
||||
type ApprovalBanner = _ApprovalBanner;
|
||||
namespace ApprovalBanner {
|
||||
type LocalizableTexts = _ApprovalBanner.LocalizableTexts;
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=ApprovalBanner.d.ts.map
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,77 @@
|
||||
export declare class Banner {
|
||||
#private;
|
||||
protected readonly __parentControl?: (TcHmi.Controls.System.TcHmiControl | null) | undefined;
|
||||
protected __name: string;
|
||||
protected __targetElement: HTMLElement;
|
||||
protected __element: HTMLDivElement;
|
||||
protected __elementHeaderContainer: HTMLDivElement;
|
||||
protected __elementHeader: HTMLHeadingElement;
|
||||
protected __elementContent: HTMLDivElement;
|
||||
protected __elementFooter: HTMLDivElement;
|
||||
/** Controls in this array will be destroyed automatically when the popup is destroyed */
|
||||
protected __childControls: TcHmi.Controls.System.TcHmiControl[];
|
||||
/** Destroyers in this array will be called automatically when the popup is destroyed */
|
||||
protected __destroyers: TcHmi.DestroyFunction[];
|
||||
protected __isShowing: boolean;
|
||||
protected __localizationSymbols: Map<string, {
|
||||
symbol: TcHmi.Symbol<string>;
|
||||
destroyWatch: TcHmi.DestroyFunction;
|
||||
}>;
|
||||
protected readonly __className = "TcHmi_Controls_Helpers_Banner";
|
||||
/**
|
||||
* Creates a new Banner instance.
|
||||
* @param targetElement The element the banner is placed over.
|
||||
* @param __parentControl The control which owns the Banner.
|
||||
*/
|
||||
constructor(targetElement: HTMLElement, __parentControl?: (TcHmi.Controls.System.TcHmiControl | null) | undefined);
|
||||
/**
|
||||
* Gets a value indicating if the banner is currently shown to the user.
|
||||
*/
|
||||
isShowing(): boolean;
|
||||
/**
|
||||
* Shows the banner.
|
||||
*/
|
||||
show(): void;
|
||||
/**
|
||||
* Hides the banner.
|
||||
*/
|
||||
hide(): void;
|
||||
/**
|
||||
* Destroys the banner and all its controls.
|
||||
* @param force If true, child controls will be removed from the parent control before destruction, to ensure destruction in case of keepAlive === true.
|
||||
*/
|
||||
destroy(force?: boolean): void;
|
||||
/**
|
||||
* Watch the given symbol and call the onChange callback every time it changes with the resolved and formatted symbol value.
|
||||
* @param name The name for this symbol. Must be unique across all inheritance layers and further calls for the same localization must use the same name.
|
||||
* @param localization The localization to watch.
|
||||
* @param onChange The callback that is called with the localized and formatted text as a parameter.
|
||||
*/
|
||||
protected __watchLocalization(name: string, localization: TcHmi.FormattedLocalizable, onChange: (localizedText: string) => void): void;
|
||||
/**
|
||||
* Destroys the localization watch with the given name, if it exists.
|
||||
* @param name The name that was used with __watchLoclalization to start watching the symbol.
|
||||
*/
|
||||
protected __unwatchLocalization(name: string): void;
|
||||
/**
|
||||
* Sets texts which can either be localizable or static.
|
||||
*/
|
||||
setTexts(texts: Partial<Banner.LocalizableTexts>): void;
|
||||
}
|
||||
export declare namespace Banner {
|
||||
interface LocalizableTexts {
|
||||
headerText: TcHmi.Localizable;
|
||||
contentText: TcHmi.Localizable;
|
||||
}
|
||||
}
|
||||
import _Banner = Banner;
|
||||
declare global {
|
||||
namespace TcHmi.Controls.Helpers {
|
||||
let Banner: typeof _Banner;
|
||||
type Banner = _Banner;
|
||||
namespace Banner {
|
||||
type LocalizableTexts = _Banner.LocalizableTexts;
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=Banner.d.ts.map
|
||||
@@ -0,0 +1 @@
|
||||
export class Banner{__parentControl;static#tchmiFQN="TcHmi.Controls.Helpers."+this.name;__name;__targetElement;__element;__elementHeaderContainer;__elementHeader;__elementContent;__elementFooter;__childControls=[];__destroyers=[];__isShowing=!1;__localizationSymbols=new Map;__className="TcHmi_Controls_Helpers_Banner";constructor(targetElement,__parentControl){this.__parentControl=__parentControl,this.__name=`${this.constructor.name}-${tchmi_create_guid()}`,this.__parentControl&&(this.__name=`${this.__parentControl.getId()}.${this.__name}`),this.__targetElement=targetElement;const controlClass=this.__parentControl?.getType().replace(/\./g,"_");this.__element=document.createElement("div"),this.__element.classList.add(this.__className,`${this.__className}-${this.constructor.name}`),controlClass&&this.__element.classList.add(`${controlClass}-banner`),this.__elementHeaderContainer=document.createElement("div"),this.__elementHeaderContainer.classList.add(`${this.__className}-header-container`),this.__elementHeader=document.createElement("h1"),this.__elementHeaderContainer.appendChild(this.__elementHeader),this.__element.appendChild(this.__elementHeaderContainer),this.__elementContent=document.createElement("div"),this.__elementContent.classList.add(`${this.__className}-content`),this.__element.appendChild(this.__elementContent),this.__elementFooter=document.createElement("div"),this.__elementFooter.classList.add(`${this.__className}-footer`),this.__element.appendChild(this.__elementFooter),this.__parentControl&&this.__destroyers.push(TcHmi.EventProvider.register(this.__parentControl.getId()+".onDestroyed",()=>{this.destroy()}))}isShowing(){return this.__isShowing}show(){this.__isShowing||(this.__isShowing=!0,this.__targetElement.appendChild(this.__element))}hide(){this.__isShowing&&(this.__isShowing=!1,this.__element.remove())}destroy(force=!1){for(const destroy of this.__destroyers)destroy();this.__destroyers=[];for(const control of this.__childControls)force&&this.__parentControl&&this.__parentControl.__removeChild(control),control.destroy();this.__childControls=[];for(const entry of this.__localizationSymbols.values())entry.destroyWatch(),entry.symbol.destroy();this.__localizationSymbols.clear()}__watchLocalization(name,localization,onChange){const existing=this.__localizationSymbols.get(name);existing?.destroyWatch(),existing?.symbol.destroy();const symbol=new TcHmi.Symbol(localization.symbolExpression),destroyWatch=symbol.watch(data=>{if(data.error!==TcHmi.Errors.NONE)return void TcHmi.Log.errorEx(`[Source=ControlHelpers, Module=${Banner.#tchmiFQN}${this.__parentControl?`, Id=${this.__parentControl.getId()}`:""}, TcHmi.SymbolExpression=${localization.symbolExpression}] `+TcHmi.Log.buildMessage(data.details));let text=data.value??"";localization.formatValues.length>0&&(text=tchmi_format_string(text,...localization.formatValues)),onChange(text)});this.__localizationSymbols.set(name,{symbol,destroyWatch})}__unwatchLocalization(name){const existing=this.__localizationSymbols.get(name);existing&&(existing.destroyWatch(),existing.symbol.destroy(),this.__localizationSymbols.delete(name))}setTexts(texts){void 0!==texts.headerText&&null!==texts.headerText&&("object"==typeof texts.headerText||TcHmi.Symbol.isSymbolExpression(texts.headerText)?this.__watchLocalization("headerText","string"==typeof texts.headerText?{symbolExpression:texts.headerText,formatValues:[]}:texts.headerText,text=>this.__elementHeader.textContent=text):(this.__unwatchLocalization("headerText"),this.__elementHeader.textContent=texts.headerText)),void 0!==texts.contentText&&null!==texts.contentText&&("object"==typeof texts.contentText||TcHmi.Symbol.isSymbolExpression(texts.contentText)?this.__watchLocalization("contentText","string"==typeof texts.contentText?{symbolExpression:texts.contentText,formatValues:[]}:texts.contentText,text=>this.__elementContent.textContent=text):(this.__unwatchLocalization("contentText"),this.__elementContent.textContent=texts.contentText))}}TcHmi.Controls.Helpers??={},TcHmi.Controls.Helpers.Banner=Banner;
|
||||
Reference in New Issue
Block a user