@openremote/or-rules 1.2.0-snapshot.20240512160221
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/lib/flow-viewer/components/confirmation-dialog.d.ts +18 -0
- package/lib/flow-viewer/components/confirmation-dialog.js +24 -0
- package/lib/flow-viewer/components/confirmation-dialog.js.map +1 -0
- package/lib/flow-viewer/components/connection-container.d.ts +6 -0
- package/lib/flow-viewer/components/connection-container.js +1 -0
- package/lib/flow-viewer/components/connection-container.js.map +1 -0
- package/lib/flow-viewer/components/connection-line.d.ts +22 -0
- package/lib/flow-viewer/components/connection-line.js +30 -0
- package/lib/flow-viewer/components/connection-line.js.map +1 -0
- package/lib/flow-viewer/components/context-menu.d.ts +28 -0
- package/lib/flow-viewer/components/context-menu.js +49 -0
- package/lib/flow-viewer/components/context-menu.js.map +1 -0
- package/lib/flow-viewer/components/editor-workspace.d.ts +66 -0
- package/lib/flow-viewer/components/editor-workspace.js +20 -0
- package/lib/flow-viewer/components/editor-workspace.js.map +1 -0
- package/lib/flow-viewer/components/flow-editor.d.ts +47 -0
- package/lib/flow-viewer/components/flow-editor.js +45 -0
- package/lib/flow-viewer/components/flow-editor.js.map +1 -0
- package/lib/flow-viewer/components/flow-node-socket.d.ts +31 -0
- package/lib/flow-viewer/components/flow-node-socket.js +36 -0
- package/lib/flow-viewer/components/flow-node-socket.js.map +1 -0
- package/lib/flow-viewer/components/flow-node.d.ts +23 -0
- package/lib/flow-viewer/components/flow-node.js +7 -0
- package/lib/flow-viewer/components/flow-node.js.map +1 -0
- package/lib/flow-viewer/components/internal-picker.d.ts +36 -0
- package/lib/flow-viewer/components/internal-picker.js +48 -0
- package/lib/flow-viewer/components/internal-picker.js.map +1 -0
- package/lib/flow-viewer/components/node-menu-item.d.ts +29 -0
- package/lib/flow-viewer/components/node-menu-item.js +34 -0
- package/lib/flow-viewer/components/node-menu-item.js.map +1 -0
- package/lib/flow-viewer/components/node-panel.d.ts +24 -0
- package/lib/flow-viewer/components/node-panel.js +60 -0
- package/lib/flow-viewer/components/node-panel.js.map +1 -0
- package/lib/flow-viewer/components/notification-dialog.d.ts +17 -0
- package/lib/flow-viewer/components/notification-dialog.js +23 -0
- package/lib/flow-viewer/components/notification-dialog.js.map +1 -0
- package/lib/flow-viewer/components/popup-modal.d.ts +23 -0
- package/lib/flow-viewer/components/popup-modal.js +55 -0
- package/lib/flow-viewer/components/popup-modal.js.map +1 -0
- package/lib/flow-viewer/components/rule-browser.d.ts +20 -0
- package/lib/flow-viewer/components/rule-browser.js +32 -0
- package/lib/flow-viewer/components/rule-browser.js.map +1 -0
- package/lib/flow-viewer/components/selectable-element.d.ts +23 -0
- package/lib/flow-viewer/components/selectable-element.js +1 -0
- package/lib/flow-viewer/components/selectable-element.js.map +1 -0
- package/lib/flow-viewer/components/selection-box.d.ts +16 -0
- package/lib/flow-viewer/components/selection-box.js +16 -0
- package/lib/flow-viewer/components/selection-box.js.map +1 -0
- package/lib/flow-viewer/components/top-bar.d.ts +21 -0
- package/lib/flow-viewer/components/top-bar.js +51 -0
- package/lib/flow-viewer/components/top-bar.js.map +1 -0
- package/lib/flow-viewer/components/workspace-contextmenu-options.d.ts +3 -0
- package/lib/flow-viewer/components/workspace-contextmenu-options.js +5 -0
- package/lib/flow-viewer/components/workspace-contextmenu-options.js.map +1 -0
- package/lib/flow-viewer/components/writable-dropdown.d.ts +13 -0
- package/lib/flow-viewer/components/writable-dropdown.js +5 -0
- package/lib/flow-viewer/components/writable-dropdown.js.map +1 -0
- package/lib/flow-viewer/converters/node-converter.d.ts +2 -0
- package/lib/flow-viewer/converters/node-converter.js +1 -0
- package/lib/flow-viewer/converters/node-converter.js.map +1 -0
- package/lib/flow-viewer/flow-viewer.d.ts +18 -0
- package/lib/flow-viewer/flow-viewer.js +1 -0
- package/lib/flow-viewer/flow-viewer.js.map +1 -0
- package/lib/flow-viewer/models/camera.d.ts +5 -0
- package/lib/flow-viewer/models/camera.js +1 -0
- package/lib/flow-viewer/models/camera.js.map +1 -0
- package/lib/flow-viewer/models/context-menu-button.d.ts +13 -0
- package/lib/flow-viewer/models/context-menu-button.js +1 -0
- package/lib/flow-viewer/models/context-menu-button.js.map +1 -0
- package/lib/flow-viewer/models/light-node-collection.d.ts +5 -0
- package/lib/flow-viewer/models/light-node-collection.js +1 -0
- package/lib/flow-viewer/models/light-node-collection.js.map +1 -0
- package/lib/flow-viewer/models/status.d.ts +6 -0
- package/lib/flow-viewer/models/status.js +1 -0
- package/lib/flow-viewer/models/status.js.map +1 -0
- package/lib/flow-viewer/node-structure/copy.machine.d.ts +4 -0
- package/lib/flow-viewer/node-structure/copy.machine.js +1 -0
- package/lib/flow-viewer/node-structure/copy.machine.js.map +1 -0
- package/lib/flow-viewer/node-structure/identity.assigner.d.ts +5 -0
- package/lib/flow-viewer/node-structure/identity.assigner.js +1 -0
- package/lib/flow-viewer/node-structure/identity.assigner.js.map +1 -0
- package/lib/flow-viewer/node-structure/identity.dom.link.d.ts +5 -0
- package/lib/flow-viewer/node-structure/identity.dom.link.js +1 -0
- package/lib/flow-viewer/node-structure/identity.dom.link.js.map +1 -0
- package/lib/flow-viewer/node-structure/index.d.ts +5 -0
- package/lib/flow-viewer/node-structure/index.js +1 -0
- package/lib/flow-viewer/node-structure/index.js.map +1 -0
- package/lib/flow-viewer/node-structure/socket.type.matcher.d.ts +5 -0
- package/lib/flow-viewer/node-structure/socket.type.matcher.js +1 -0
- package/lib/flow-viewer/node-structure/socket.type.matcher.js.map +1 -0
- package/lib/flow-viewer/node-structure/utils.d.ts +13 -0
- package/lib/flow-viewer/node-structure/utils.js +1 -0
- package/lib/flow-viewer/node-structure/utils.js.map +1 -0
- package/lib/flow-viewer/services/copy-paste-manager.d.ts +11 -0
- package/lib/flow-viewer/services/copy-paste-manager.js +1 -0
- package/lib/flow-viewer/services/copy-paste-manager.js.map +1 -0
- package/lib/flow-viewer/services/exporter.d.ts +9 -0
- package/lib/flow-viewer/services/exporter.js +1 -0
- package/lib/flow-viewer/services/exporter.js.map +1 -0
- package/lib/flow-viewer/services/input.d.ts +17 -0
- package/lib/flow-viewer/services/input.js +1 -0
- package/lib/flow-viewer/services/input.js.map +1 -0
- package/lib/flow-viewer/services/integration.d.ts +7 -0
- package/lib/flow-viewer/services/integration.js +1 -0
- package/lib/flow-viewer/services/integration.js.map +1 -0
- package/lib/flow-viewer/services/modal.d.ts +8 -0
- package/lib/flow-viewer/services/modal.js +8 -0
- package/lib/flow-viewer/services/modal.js.map +1 -0
- package/lib/flow-viewer/services/project.d.ts +39 -0
- package/lib/flow-viewer/services/project.js +1 -0
- package/lib/flow-viewer/services/project.js.map +1 -0
- package/lib/flow-viewer/services/shortcuts.d.ts +8 -0
- package/lib/flow-viewer/services/shortcuts.js +1 -0
- package/lib/flow-viewer/services/shortcuts.js.map +1 -0
- package/lib/flow-viewer/styles/editor-workspace-style.d.ts +1 -0
- package/lib/flow-viewer/styles/editor-workspace-style.js +53 -0
- package/lib/flow-viewer/styles/editor-workspace-style.js.map +1 -0
- package/lib/flow-viewer/styles/flow-node-style.d.ts +1 -0
- package/lib/flow-viewer/styles/flow-node-style.js +101 -0
- package/lib/flow-viewer/styles/flow-node-style.js.map +1 -0
- package/lib/flow-viewer/styles/picker-styles.d.ts +1 -0
- package/lib/flow-viewer/styles/picker-styles.js +25 -0
- package/lib/flow-viewer/styles/picker-styles.js.map +1 -0
- package/lib/flow-viewer/utils.d.ts +25 -0
- package/lib/flow-viewer/utils.js +1 -0
- package/lib/flow-viewer/utils.js.map +1 -0
- package/lib/index.d.ts +259 -0
- package/lib/index.js +52 -0
- package/lib/index.js.map +1 -0
- package/lib/json-viewer/forms/or-rule-form-email-message.d.ts +20 -0
- package/lib/json-viewer/forms/or-rule-form-email-message.js +12 -0
- package/lib/json-viewer/forms/or-rule-form-email-message.js.map +1 -0
- package/lib/json-viewer/forms/or-rule-form-push-notification.d.ts +21 -0
- package/lib/json-viewer/forms/or-rule-form-push-notification.js +47 -0
- package/lib/json-viewer/forms/or-rule-form-push-notification.js.map +1 -0
- package/lib/json-viewer/forms/or-rule-form-webhook.d.ts +19 -0
- package/lib/json-viewer/forms/or-rule-form-webhook.js +102 -0
- package/lib/json-viewer/forms/or-rule-form-webhook.js.map +1 -0
- package/lib/json-viewer/modals/or-rule-notification-modal.d.ts +24 -0
- package/lib/json-viewer/modals/or-rule-notification-modal.js +5 -0
- package/lib/json-viewer/modals/or-rule-notification-modal.js.map +1 -0
- package/lib/json-viewer/modals/or-rule-radial-modal.d.ts +25 -0
- package/lib/json-viewer/modals/or-rule-radial-modal.js +17 -0
- package/lib/json-viewer/modals/or-rule-radial-modal.js.map +1 -0
- package/lib/json-viewer/modals/or-rule-webhook-modal.d.ts +12 -0
- package/lib/json-viewer/modals/or-rule-webhook-modal.js +8 -0
- package/lib/json-viewer/modals/or-rule-webhook-modal.js.map +1 -0
- package/lib/json-viewer/or-rule-action-attribute.d.ts +32 -0
- package/lib/json-viewer/or-rule-action-attribute.js +33 -0
- package/lib/json-viewer/or-rule-action-attribute.js.map +1 -0
- package/lib/json-viewer/or-rule-action-notification.d.ts +20 -0
- package/lib/json-viewer/or-rule-action-notification.js +44 -0
- package/lib/json-viewer/or-rule-action-notification.js.map +1 -0
- package/lib/json-viewer/or-rule-action-webhook.d.ts +10 -0
- package/lib/json-viewer/or-rule-action-webhook.js +20 -0
- package/lib/json-viewer/or-rule-action-webhook.js.map +1 -0
- package/lib/json-viewer/or-rule-asset-query.d.ts +50 -0
- package/lib/json-viewer/or-rule-asset-query.js +98 -0
- package/lib/json-viewer/or-rule-asset-query.js.map +1 -0
- package/lib/json-viewer/or-rule-condition.d.ts +10 -0
- package/lib/json-viewer/or-rule-condition.js +29 -0
- package/lib/json-viewer/or-rule-condition.js.map +1 -0
- package/lib/json-viewer/or-rule-json-viewer.d.ts +54 -0
- package/lib/json-viewer/or-rule-json-viewer.js +34 -0
- package/lib/json-viewer/or-rule-json-viewer.js.map +1 -0
- package/lib/json-viewer/or-rule-then-otherwise.d.ts +11 -0
- package/lib/json-viewer/or-rule-then-otherwise.js +113 -0
- package/lib/json-viewer/or-rule-then-otherwise.js.map +1 -0
- package/lib/json-viewer/or-rule-trigger-query.d.ts +26 -0
- package/lib/json-viewer/or-rule-trigger-query.js +57 -0
- package/lib/json-viewer/or-rule-trigger-query.js.map +1 -0
- package/lib/json-viewer/or-rule-when.d.ts +1 -0
- package/lib/json-viewer/or-rule-when.js +136 -0
- package/lib/json-viewer/or-rule-when.js.map +1 -0
- package/lib/or-rule-list.d.ts +56 -0
- package/lib/or-rule-list.js +111 -0
- package/lib/or-rule-list.js.map +1 -0
- package/lib/or-rule-text-viewer.d.ts +27 -0
- package/lib/or-rule-text-viewer.js +25 -0
- package/lib/or-rule-text-viewer.js.map +1 -0
- package/lib/or-rule-validity.d.ts +34 -0
- package/lib/or-rule-validity.js +71 -0
- package/lib/or-rule-validity.js.map +1 -0
- package/lib/or-rule-viewer.d.ts +47 -0
- package/lib/or-rule-viewer.js +88 -0
- package/lib/or-rule-viewer.js.map +1 -0
- package/lib/style.d.ts +2 -0
- package/lib/style.js +64 -0
- package/lib/style.js.map +1 -0
- package/package.json +42 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,o,i){var n,s=arguments.length,r=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,o,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(r=(s<3?n(r):s>3?n(t,o,r):n(t,o))||r);return s>3&&r&&Object.defineProperty(t,o,r),r},__awaiter=this&&this.__awaiter||function(e,t,o,i){return new(o||(o=Promise))((function(n,s){function r(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(r,a)}d((i=i.apply(e,t||[])).next())}))};import{html}from"lit";import{customElement,property}from"lit/decorators.js";import{IdentityDomLink}from"../node-structure";import{FlowNodeStyle}from"../styles/flow-node-style";import{i18next}from"@openremote/or-translate";import{nodeConverter}from"../converters/node-converter";import{SelectableElement}from"./selectable-element";import{project,newIds}from"./flow-editor";let FlowNode=class extends SelectableElement{constructor(){super(),this.frozen=!1,this.minimal=!1,this.isBeingDragged=!1,this.forceUpdate=()=>{this.requestUpdate()},this.setTranslate=()=>{const e=this.workspace.worldToOffset(this.node.position);this.style.transform=`translate(${e.x}px, ${e.y}px) scale(${this.workspace.camera.zoom})`,this.dispatchEvent(new CustomEvent("updated"))},this.startDrag=e=>{this.frozen||1===e.buttons&&(project.createUndoSnapshot(),this.bringToFront(),window.addEventListener("mouseup",this.stopDrag),window.addEventListener("mousemove",this.onDrag),this.isBeingDragged=!0)},this.onDrag=e=>{this.node.position={x:this.node.position.x+e.movementX/this.workspace.camera.zoom,y:this.node.position.y+e.movementY/this.workspace.camera.zoom},this.setTranslate()},this.stopDrag=()=>{window.removeEventListener("mouseup",this.stopDrag),window.removeEventListener("mousemove",this.onDrag),this.isBeingDragged=!1,project.notifyChange()},this.linkIdentity=()=>{IdentityDomLink.map[this.node.id]=this}}static get styles(){return FlowNodeStyle}disconnectedCallback(){this.workspace.removeEventListener("pan",this.setTranslate),this.workspace.removeEventListener("zoom",this.setTranslate),project.removeListener("cleared",this.forceUpdate),project.removeListener("connectionremoved",this.linkIdentity),super.disconnectedCallback()}bringToFront(){this.frozen||(this.style.zIndex=""+this.workspace.topNodeZindex++)}firstUpdated(){const e=Object.create(null,{firstUpdated:{get:()=>super.firstUpdated}});return __awaiter(this,void 0,void 0,(function*(){if(e.firstUpdated.call(this),this.linkIdentity(),this.workspace.addEventListener("pan",this.setTranslate),this.workspace.addEventListener("zoom",this.setTranslate),project.addListener("cleared",this.forceUpdate),project.addListener("connectionremoved",this.linkIdentity),this.minimal=0!==(this.node.displayCharacter||"").length,this.bringToFront(),newIds.has(this.node.id)){yield this.updateComplete,yield this.updateComplete;const e=this.getBoundingClientRect();this.node.position.x-=e.width/2/this.workspace.camera.zoom,this.node.position.y-=e.height/2/this.workspace.camera.zoom,this.setTranslate(),newIds.delete(this.node.id)}this.minimal&&this.addEventListener("mousedown",this.startDrag)}))}updated(){return __awaiter(this,void 0,void 0,(function*(){this.linkIdentity(),this.dispatchEvent(new CustomEvent("updated"))}))}render(){this.minimal?this.style.background=`var(--${this.node.type.toLowerCase()}-color)`:this.style.background="",this.setTranslate(),this.style.boxShadow=this.selected?"var(--highlight) 0 0 0 3px":"";const e=this.minimal?html`<div class="title minimal" ?singlechar="${1===this.node.displayCharacter.length}">${i18next.t(this.node.displayCharacter)}</div>`:html`<div class="title ${this.node.type.toLowerCase()}" @mousedown="${this.startDrag}">${i18next.t(this.node.name)||"invalid"}</div>`,t=html`<div class="socket-side inputs">${this.node.inputs.map((e=>html`<flow-node-socket ?renderlabel="${!this.minimal}" .socket="${e}" side="input"></flow-node-socket>`))}</div>`,o=html`<div class="socket-side outputs">${this.node.outputs.map((e=>html`<flow-node-socket ?renderlabel="${!this.minimal}" .socket="${e}" side="output"></flow-node-socket>`))}</div>`,i=html`<div style="width: 10px"></div>`;return html`
|
|
2
|
+
${e}
|
|
3
|
+
${this.node.inputs.length>0?t:i}
|
|
4
|
+
${this.minimal?null:html`<div class="internal-container">${this.node.internals.map((e=>html`<internal-picker style="pointer-events: ${this.frozen?"none":"normal"}" @picked="${()=>__awaiter(this,void 0,void 0,(function*(){this.forceUpdate(),yield this.updateComplete,project.removeInvalidConnections()}))}" .node="${this.node}" .internalIndex="${this.node.internals.indexOf(e)}"></internal-picker>`))}</div>`}
|
|
5
|
+
${this.node.outputs.length>0?o:i}
|
|
6
|
+
${this.frozen?html`<or-icon class="lock-icon ${this.node.type.toLowerCase()}" icon="lock"></or-icon>`:""}
|
|
7
|
+
`}};__decorate([property({converter:nodeConverter})],FlowNode.prototype,"node",void 0),__decorate([property({attribute:!1})],FlowNode.prototype,"workspace",void 0),__decorate([property({type:Boolean,reflect:!0})],FlowNode.prototype,"frozen",void 0),__decorate([property({type:Boolean,reflect:!0})],FlowNode.prototype,"minimal",void 0),__decorate([property({attribute:!1})],FlowNode.prototype,"isBeingDragged",void 0),FlowNode=__decorate([customElement("flow-node")],FlowNode);export{FlowNode};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-node.js","sourceRoot":"","sources":["../../../src/flow-viewer/components/flow-node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAO,MAAM,KAAK,CAAC;AAChC,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAGzC,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,iBAAiB;IAQ3C;QACI,KAAK,EAAE,CAAC;QANuC,WAAM,GAAG,KAAK,CAAC;QAEd,YAAO,GAAG,KAAK,CAAC;QAC5B,mBAAc,GAAG,KAAK,CAAC;QAmFvD,gBAAW,GAAG,GAAG,EAAE,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC;QAE9C,iBAAY,GAAG,GAAG,EAAE;YACxB,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,QAAS,CAAC,CAAC;YAC9D,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,aAAa,GAAG,CAAC,CAAC,OAAO,GAAG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AE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAAyB;AAC5B;IAAvC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;gDAAgC;AANtD,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CA6HpB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { LitElement, TemplateResult } from "lit";
|
|
2
|
+
import { Node } from "@openremote/model";
|
|
3
|
+
import "@openremote/or-asset-tree";
|
|
4
|
+
declare const InternalPicker_base: (new (...args: any[]) => {
|
|
5
|
+
_i18nextJustInitialized: boolean;
|
|
6
|
+
connectedCallback(): void;
|
|
7
|
+
disconnectedCallback(): void;
|
|
8
|
+
shouldUpdate(changedProps: import("lit").PropertyValueMap<any> | Map<PropertyKey, unknown>): any;
|
|
9
|
+
initCallback: (options: import("i18next").InitOptions) => void;
|
|
10
|
+
langChangedCallback: () => void;
|
|
11
|
+
readonly isConnected: boolean;
|
|
12
|
+
}) & typeof LitElement;
|
|
13
|
+
export declare class InternalPicker extends InternalPicker_base {
|
|
14
|
+
node: Node;
|
|
15
|
+
internalIndex: number;
|
|
16
|
+
private selectedAsset;
|
|
17
|
+
private resizeObserver;
|
|
18
|
+
constructor();
|
|
19
|
+
get internal(): import("@openremote/model").NodeInternal;
|
|
20
|
+
static get styles(): import("lit").CSSResult[];
|
|
21
|
+
protected firstUpdated(): void;
|
|
22
|
+
protected render(): TemplateResult;
|
|
23
|
+
private setSocketTypeDynamically;
|
|
24
|
+
private setSelectedAssetFromInternalValue;
|
|
25
|
+
private get assetAttributeInput();
|
|
26
|
+
private get colorInput();
|
|
27
|
+
private get doubleDropdownInput();
|
|
28
|
+
private get dropdownInput();
|
|
29
|
+
private get checkBoxInput();
|
|
30
|
+
private get multilineInput();
|
|
31
|
+
private get numberInput();
|
|
32
|
+
private get textInput();
|
|
33
|
+
private setValue;
|
|
34
|
+
private onPicked;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,r,s){var i,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,s);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(o=(n<3?i(o):n>3?i(t,r,o):i(t,r))||o);return n>3&&o&&Object.defineProperty(t,r,o),o},__awaiter=this&&this.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{a(s.next(e))}catch(e){n(e)}}function l(e){try{a(s.throw(e))}catch(e){n(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,l)}a((s=s.apply(e,t||[])).next())}))};import{LitElement,html,css}from"lit";import{customElement,property}from"lit/decorators.js";import{AssetModelUtil}from"@openremote/model";import{nodeConverter}from"../converters/node-converter";import{InputType}from"@openremote/or-mwc-components/or-mwc-input";import rest from"@openremote/rest";import"@openremote/or-asset-tree";import{ResizeObserver}from"resize-observer";import{project}from"./flow-editor";import{NodeUtilities}from"../node-structure";import{translate,i18next}from"@openremote/or-translate";import{PickerStyle}from"../styles/picker-styles";import{Util}from"@openremote/core";import{OrAttributePicker,OrAttributePickerPickedEvent}from"@openremote/or-attribute-picker";import{showDialog}from"@openremote/or-mwc-components/or-mwc-dialog";import{getAssetDescriptorIconTemplate}from"@openremote/or-icon";let InternalPicker=class extends(translate(i18next)(LitElement)){constructor(){super()}get internal(){return this.node.internals[this.internalIndex]}static get styles(){return[css`
|
|
2
|
+
:host{
|
|
3
|
+
padding: 0;
|
|
4
|
+
margin: 0;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
--or-app-color4: var(--or-mwc-input-color);
|
|
8
|
+
}`,PickerStyle,css`.attribute-label-white {
|
|
9
|
+
background: #ffffff;
|
|
10
|
+
}
|
|
11
|
+
.selected-asset-container {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
}
|
|
15
|
+
.selected-asset-container:hover {
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
background-color: #F9F9F9;
|
|
18
|
+
}
|
|
19
|
+
.selected-asset-label {
|
|
20
|
+
padding: 5px;
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
line-height: 16px;
|
|
24
|
+
justify-content: flex-start;
|
|
25
|
+
font-size: 14px;
|
|
26
|
+
text-align: left;
|
|
27
|
+
}
|
|
28
|
+
.selected-asset-label .asset {
|
|
29
|
+
color: rgb(76, 76, 76);
|
|
30
|
+
}
|
|
31
|
+
.selected-asset-label .asset-attribute {
|
|
32
|
+
color: grey;
|
|
33
|
+
}
|
|
34
|
+
.selected-asset-icon {
|
|
35
|
+
display: flex;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
padding: 0px 5px 0px 5px;
|
|
38
|
+
--or-icon-width: 20px;
|
|
39
|
+
}`]}firstUpdated(){this.addEventListener("contextmenu",(e=>e.stopPropagation())),this.addEventListener("mousedown",(e=>(project.createUndoSnapshot(),project.notifyChange()))),this.resizeObserver=new ResizeObserver(((e,t)=>{const r=e[0].contentRect;this.node.size={x:r.width-20,y:r.height-20}})),this.resizeObserver.observe(this)}render(){switch(this.internal.picker.type){case"ASSET_ATTRIBUTE":return this.internal.value&&!this.selectedAsset&&this.setSelectedAssetFromInternalValue(),this.assetAttributeInput;case"COLOR":return this.colorInput;case"DOUBLE_DROPDOWN":return this.doubleDropdownInput;case"CHECKBOX":return this.checkBoxInput;case"DROPDOWN":return this.dropdownInput;case"MULTILINE":return this.multilineInput;case"NUMBER":return this.numberInput;case"TEXT":return this.textInput;default:return html`unimplemented picker`}}setSocketTypeDynamically(e){return __awaiter(this,void 0,void 0,(function*(){const t=(yield rest.api.AssetResource.queryAssets({ids:[e.assetId],select:{attributes:[e.attributeName]}})).data,r=this.node.outputs[0]||this.node.inputs[0];if(r.type="ANY",null!=t&&null!=t[0]&&null!=t[0].attributes)try{const s=t[0].attributes[e.attributeName],i=AssetModelUtil.getValueDescriptors().find((e=>e.name===s.type));r.type=NodeUtilities.convertValueTypeToSocketType(i)}catch(e){console.error(e)}}))}setSelectedAssetFromInternalValue(){return __awaiter(this,void 0,void 0,(function*(){const e=yield rest.api.AssetResource.queryAssets({ids:[this.internal.value.assetId]});0!==e.data.length?this.selectedAsset=e.data[0]:console.warn(`Asset with id ${this.internal.value.assetId} is missing`)}))}get assetAttributeInput(){var e,t,r,s;const i=()=>{let e=[],t=[],r=this.node.internals[this.internalIndex].value;r&&(e=[{id:r.assetId,name:r.attributeName}]),this.selectedAsset&&this.selectedAsset.id&&(t=[this.selectedAsset.id]),showDialog((new OrAttributePicker).setShowOnlyRuleStateAttrs(!0).setShowOnlyDatapointAttrs(!1).setMultiSelect(!1).setSelectedAttributes(e)).setSelectedAssets(t).addEventListener(OrAttributePickerPickedEvent.NAME,(e=>__awaiter(this,void 0,void 0,(function*(){const t={assetId:e.detail[0].id,attributeName:e.detail[0].name};yield this.setSocketTypeDynamically(t),this.setValue(t),yield this.setSelectedAssetFromInternalValue()}))))};let n="?";if(this.selectedAsset&&this.selectedAsset.attributes&&(null===(t=null===(e=this.internal)||void 0===e?void 0:e.value)||void 0===t?void 0:t.attributeName)){const e=null===(s=null===(r=this.internal)||void 0===r?void 0:r.value)||void 0===s?void 0:s.attributeName,t=AssetModelUtil.getAttributeDescriptor(e,this.selectedAsset.type);let i=this.selectedAsset.attributes[e];i&&(n=Util.getAttributeLabel(i,t,this.selectedAsset.type,!0))}const o=this.selectedAsset?AssetModelUtil.getAssetDescriptor(this.selectedAsset.type):void 0,l=getAssetDescriptorIconTemplate(o);return html`<div>
|
|
40
|
+
${this.selectedAsset?html`<div class="attribute-label attribute-label-white selected-asset-container" @click="${()=>i()}">
|
|
41
|
+
<div class="selected-asset-icon">${l}</div>
|
|
42
|
+
<div class="selected-asset-label">
|
|
43
|
+
<div class="asset">${this.selectedAsset.name}</div>
|
|
44
|
+
<div class="asset-attribute">${n}</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>`:html`<or-mwc-input class="attribute-label-white" .type="${InputType.BUTTON}" label="attribute" icon="plus" @or-mwc-input-changed="${()=>i()}"></or-mwc-input>`}
|
|
47
|
+
</div>`}get colorInput(){return html`<or-mwc-input type="color"></or-mwc-input>`}get doubleDropdownInput(){return html`unimplemented`}get dropdownInput(){return html`<writable-dropdown @input="${e=>this.setValue(e.target.value)}" .value="${this.internal.value}" .options="${this.internal.picker.options}">
|
|
48
|
+
</writable-dropdown>`}get checkBoxInput(){return html`<input type="checkbox" ?checked="${this.internal.value||!1}" @input="${e=>this.setValue(e.target.checked)}"/>`}get multilineInput(){const e=this.node.size?`width:${this.node.size.x}px; height:${this.node.size.y}px`:"";return html`<textarea @wheel="${e=>{if(e.target.clientHeight<e.target.scrollHeight)return e.stopPropagation()}}" style="${e}" @input="${e=>this.setValue(e.target.value)}" placeholder="${this.internal.name}">${this.internal.value||""}</textarea>`}get numberInput(){return html`<input @wheel="${e=>{if(e.target===this.shadowRoot.activeElement)return e.stopPropagation()}}" @input="${e=>this.setValue(parseFloat(e.target.value))}" value="${this.internal.value||0}" type="number" placeholder="${this.internal.name}"/>`}get textInput(){return html`<input @input="${e=>this.setValue(e.target.value)}" value="${this.internal.value||""}" type="text" placeholder="${this.internal.name}"/>`}setValue(e){this.node.internals[this.internalIndex].value=e,this.onPicked()}onPicked(){return __awaiter(this,void 0,void 0,(function*(){yield this.updateComplete,this.dispatchEvent(new CustomEvent("picked"))}))}};__decorate([property({converter:nodeConverter,reflect:!0})],InternalPicker.prototype,"node",void 0),__decorate([property({type:Number,reflect:!0})],InternalPicker.prototype,"internalIndex",void 0),__decorate([property({type:Object})],InternalPicker.prototype,"selectedAsset",void 0),InternalPicker=__decorate([customElement("internal-picker")],InternalPicker);export{InternalPicker};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-picker.js","s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AAC,IAAK,KAAK,CAAC;IACpK,CAAC;IAED,IAAY,SAAS;QACjB,OAAO,IAAI,CAAA,kBAAkB,CAAC,CAAM,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE,8BAA8B,IAAI,CAAC,QAAQ,CAAC,IAAK,KAAK,CAAC;IACtK,CAAC;IAEO,QAAQ,CAAC,KAAU;QACvB,IAAI,CAAC,IAAI,CAAC,SAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,KAAK,GAAG,KAAK,CAAC;QACvD,IAAI,CAAC,QAAQ,EAAE,CAAC;IACpB,CAAC;IAEa,QAAQ;;YAClB,MAAM,IAAI,CAAC,cAAc,CAAC;YAC1B,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;QAClD,CAAC;KAAA;CACJ,CAAA;AA3PiE;IAA7D,QAAQ,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAAoB;AACxB;IAAjD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;qDAA+B;AAErC;IAAnC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAA+B;AAJjD,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CA4P1B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import { Node } from "@openremote/model";
|
|
3
|
+
declare const NodeMenuItem_base: (new (...args: any[]) => {
|
|
4
|
+
_i18nextJustInitialized: boolean;
|
|
5
|
+
connectedCallback(): void;
|
|
6
|
+
disconnectedCallback(): void;
|
|
7
|
+
shouldUpdate(changedProps: import("lit").PropertyValueMap<any> | Map<PropertyKey, unknown>): any;
|
|
8
|
+
initCallback: (options: import("i18next").InitOptions) => void;
|
|
9
|
+
langChangedCallback: () => void;
|
|
10
|
+
readonly isConnected: boolean;
|
|
11
|
+
}) & typeof LitElement;
|
|
12
|
+
export declare class NodeMenuItem extends NodeMenuItem_base {
|
|
13
|
+
node: Node;
|
|
14
|
+
private isDragging;
|
|
15
|
+
private x;
|
|
16
|
+
private y;
|
|
17
|
+
private workspace;
|
|
18
|
+
private xOffset;
|
|
19
|
+
private yOffset;
|
|
20
|
+
constructor();
|
|
21
|
+
static get styles(): import("lit").CSSResult;
|
|
22
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
23
|
+
private get dragNodeTemplate();
|
|
24
|
+
private get flowNodeName();
|
|
25
|
+
private startDrag;
|
|
26
|
+
private onMove;
|
|
27
|
+
private stopDrag;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};import{LitElement,html,css}from"lit";import{customElement,property}from"lit/decorators.js";import{Utilities}from"../utils";import{i18next,translate}from"@openremote/or-translate";import{newIds,project}from"./flow-editor";import{CopyMachine}from"../node-structure";let NodeMenuItem=class extends(translate(i18next)(LitElement)){constructor(){super(),this.isDragging=!1,this.x=0,this.y=0,this.xOffset=0,this.yOffset=0,this.startDrag=e=>{this.xOffset=e.offsetX,this.yOffset=e.offsetY,this.x=e.clientX,this.y=e.clientY,this.isDragging=!0,window.addEventListener("mouseup",this.stopDrag),window.addEventListener("mousemove",this.onMove)},this.onMove=e=>{this.x=e.clientX,this.y=e.clientY},this.stopDrag=e=>{if(window.removeEventListener("mouseup",this.stopDrag),window.removeEventListener("mousemove",this.onMove),this.isDragging=!1,Utilities.isPointInsideBox(e.offsetX,e.offsetY,{x:this.workspace.clientRect.left,y:this.workspace.clientRect.top,width:this.workspace.clientRect.width,height:this.workspace.clientRect.height})){const t=CopyMachine.copy(this.node);newIds.add(t.id),t.position=this.workspace.offsetToWorld({x:e.offsetX-this.workspace.clientRect.left,y:e.offsetY-this.workspace.clientRect.top}),project.createUndoSnapshot(),project.addNode(t),project.notifyChange()}},this.addEventListener("mousedown",this.startDrag)}static get styles(){return css`
|
|
2
|
+
:host, .node-drag-item{
|
|
3
|
+
padding: 4px;
|
|
4
|
+
margin: 0 0 15px 0;
|
|
5
|
+
display: inline-block;
|
|
6
|
+
text-align: center;
|
|
7
|
+
color: white;
|
|
8
|
+
border-radius: var(--roundness);
|
|
9
|
+
box-shadow: rgba(0, 0, 0, 0.2) 0px 5px 5px -5px;
|
|
10
|
+
|
|
11
|
+
width: calc(var(--nodepanel-width) - 4px * 2);
|
|
12
|
+
height: 22px;
|
|
13
|
+
line-height: 22px;
|
|
14
|
+
cursor:grab;
|
|
15
|
+
transition: box-shadow 150ms;
|
|
16
|
+
}
|
|
17
|
+
:host(.small), .small{
|
|
18
|
+
width: 26px;
|
|
19
|
+
height: 26px;
|
|
20
|
+
line-height: 26px;
|
|
21
|
+
margin: 0;
|
|
22
|
+
}
|
|
23
|
+
.node-drag-item{
|
|
24
|
+
z-index: 5000;
|
|
25
|
+
position: fixed;
|
|
26
|
+
background: inherit;
|
|
27
|
+
box-shadow: rgba(0, 0, 0, 0.2) 0 2px 15px;
|
|
28
|
+
filter: opacity(90%);
|
|
29
|
+
pointer-events: none;
|
|
30
|
+
}
|
|
31
|
+
`}render(){switch(this.node.type){case"INPUT":this.classList.add("input-node");break;case"PROCESSOR":this.classList.add("processor-node");break;case"OUTPUT":this.classList.add("output-node")}return this.node.displayCharacter&&this.classList.add("small"),this.title=i18next.t(this.node.name,Utilities.humanLike(this.node.name)),html`
|
|
32
|
+
<div class="label">${this.flowNodeName}</div>
|
|
33
|
+
${this.isDragging?this.dragNodeTemplate:null}
|
|
34
|
+
`}get dragNodeTemplate(){return html`<div class="node-drag-item ${this.node.displayCharacter?"small":null}" style="top: ${this.y-this.yOffset}px; left: ${this.x-this.xOffset}px"><div class="label">${this.flowNodeName}</div></div>`}get flowNodeName(){return i18next.t(this.node.displayCharacter||this.node.name,this.node.displayCharacter||Utilities.humanLike(this.node.name||"invalid node name"))}};__decorate([property({attribute:!1})],NodeMenuItem.prototype,"node",void 0),__decorate([property({attribute:!1})],NodeMenuItem.prototype,"isDragging",void 0),__decorate([property({attribute:!1})],NodeMenuItem.prototype,"x",void 0),__decorate([property({attribute:!1})],NodeMenuItem.prototype,"y",void 0),__decorate([property({attribute:!1})],NodeMenuItem.prototype,"workspace",void 0),NodeMenuItem=__decorate([customElement("node-menu-item")],NodeMenuItem);export{NodeMenuItem};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-menu-item.js","sourceRoot":"","sources":["../../../src/flow-viewer/components/node-menu-item.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAG1D,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGzC,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,SAAS,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAY5D;QACI,KAAK,EAAE,CAAC;QAX4B,eAAU,GAAG,KAAK,CAAC;QAEnB,MAAC,GAAG,CAA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AAe;AAEN;IAAvC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;+CAAsC;AAP5D,YAAY;IADxB,aAAa,CAAC,gBAAgB,CAAC;GACnB,YAAY,CAqHxB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import { Node } from "@openremote/model";
|
|
3
|
+
import { OrMwcDrawer } from "@openremote/or-mwc-components/or-mwc-drawer";
|
|
4
|
+
import { FlowEditor } from "./flow-editor";
|
|
5
|
+
declare const NodePanel_base: (new (...args: any[]) => {
|
|
6
|
+
_i18nextJustInitialized: boolean;
|
|
7
|
+
connectedCallback(): void;
|
|
8
|
+
disconnectedCallback(): void;
|
|
9
|
+
shouldUpdate(changedProps: import("lit").PropertyValueMap<any> | Map<PropertyKey, unknown>): any;
|
|
10
|
+
initCallback: (options: import("i18next").InitOptions) => void;
|
|
11
|
+
langChangedCallback: () => void;
|
|
12
|
+
readonly isConnected: boolean;
|
|
13
|
+
}) & typeof LitElement;
|
|
14
|
+
export declare class NodePanel extends NodePanel_base {
|
|
15
|
+
nodes: Node[];
|
|
16
|
+
static get styles(): import("lit").CSSResult;
|
|
17
|
+
drawer: OrMwcDrawer;
|
|
18
|
+
application: FlowEditor;
|
|
19
|
+
protected firstUpdated(): void;
|
|
20
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
21
|
+
private nodeTemplate;
|
|
22
|
+
private get listTemplate();
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,r,o){var a,n=arguments.length,i=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(n<3?a(i):n>3?a(t,r,i):a(t,r))||i);return n>3&&i&&Object.defineProperty(t,r,i),i};import{LitElement,html,css}from"lit";import{customElement,property,query}from"lit/decorators.js";import{i18next,translate}from"@openremote/or-translate";let NodePanel=class extends(translate(i18next)(LitElement)){constructor(){super(...arguments),this.nodes=[]}static get styles(){return css`
|
|
2
|
+
.list{
|
|
3
|
+
overflow-x: hidden;
|
|
4
|
+
overflow-y: auto;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
align-items: center;
|
|
8
|
+
height: 100%;
|
|
9
|
+
background: #F9F9F9;
|
|
10
|
+
}
|
|
11
|
+
.category{
|
|
12
|
+
display: flex;
|
|
13
|
+
width: 80%;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
align-items: center;
|
|
16
|
+
text-align: center;
|
|
17
|
+
padding: 15px 15px 0 15px;
|
|
18
|
+
}
|
|
19
|
+
.category span{
|
|
20
|
+
margin:0;
|
|
21
|
+
color: rgb(125,125,125);
|
|
22
|
+
padding: 0 0 15px 0 ;
|
|
23
|
+
}
|
|
24
|
+
.small-node-grid{
|
|
25
|
+
display: grid;
|
|
26
|
+
grid-template-columns: repeat(5, 1fr);
|
|
27
|
+
grid-template-rows: repeat(2, 1fr);
|
|
28
|
+
grid-gap: 6px;
|
|
29
|
+
justify-items: stretch;
|
|
30
|
+
align-items: stretch;
|
|
31
|
+
margin-bottom: 15px;
|
|
32
|
+
width: var(--nodepanel-width);
|
|
33
|
+
}
|
|
34
|
+
.input-node{ background-color: var(--input-color); }
|
|
35
|
+
.processor-node{ background-color: var(--processor-color); }
|
|
36
|
+
.output-node{ background-color: var(--output-color); }
|
|
37
|
+
.input-node:hover{ background-color: var(--input-color-h); }
|
|
38
|
+
.processor-node:hover{ background-color: var(--processor-color-h); }
|
|
39
|
+
.output-node:hover{ background-color: var(--output-color-h); }`}firstUpdated(){this.drawer&&(this.drawer.open=!0)}render(){return html`
|
|
40
|
+
<!-- <or-mwc-drawer rightsided dismissible transparent> -->
|
|
41
|
+
${this.listTemplate}
|
|
42
|
+
<!-- </or-mwc-drawer> -->
|
|
43
|
+
`}nodeTemplate(e){return html`<node-menu-item class="node-item" .node="${e}" .workspace="${this.application.editorWorkspace}"></node-menu-item>`}get listTemplate(){return html`
|
|
44
|
+
<div class="list">
|
|
45
|
+
<div class="category"> <span>${i18next.t("input","Input")}</span>
|
|
46
|
+
${this.nodes.filter((e=>"INPUT"===e.type)).map((e=>this.nodeTemplate(e)))}
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<div class="category"><span>${i18next.t("processors","Processors")}</span>
|
|
50
|
+
<div class="small-node-grid">
|
|
51
|
+
${this.nodes.filter((e=>"PROCESSOR"===e.type&&e.displayCharacter)).map((e=>this.nodeTemplate(e)))}
|
|
52
|
+
</div>
|
|
53
|
+
${this.nodes.filter((e=>"PROCESSOR"===e.type&&!e.displayCharacter)).map((e=>this.nodeTemplate(e)))}
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<div class="category"> <span>${i18next.t("output","Output")}</span>
|
|
57
|
+
${this.nodes.filter((e=>"OUTPUT"===e.type)).map((e=>this.nodeTemplate(e)))}
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
`}};__decorate([property({type:Array})],NodePanel.prototype,"nodes",void 0),__decorate([query("or-mwc-drawer")],NodePanel.prototype,"drawer",void 0),__decorate([property({attribute:!1})],NodePanel.prototype,"application",void 0),NodePanel=__decorate([customElement("node-panel")],NodePanel);export{NodePanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-panel.js","sourceRoot":"","sources":["../../../src/flow-viewer/components/node-panel.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAEjE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAMvD,IAAM,SAAS,GAAf,M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AAuB,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;;;2CAGtF,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC;kBACtD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,mCAAoB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;;;SAG9F,CAAC;IACN,CAAC;CACJ,CAAA;AAlFqC;IAAjC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;wCAA2B;AA2CtB;IAA9B,KAAK,CAAC,eAAe,CAAC;yCAA6B;AACb;IAAtC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;8CAAiC;AA7CvD,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAmFrB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
declare const NotificationDialog_base: (new (...args: any[]) => {
|
|
3
|
+
_i18nextJustInitialized: boolean;
|
|
4
|
+
connectedCallback(): void;
|
|
5
|
+
disconnectedCallback(): void;
|
|
6
|
+
shouldUpdate(changedProps: import("lit").PropertyValueMap<any> | Map<PropertyKey, unknown>): any;
|
|
7
|
+
initCallback: (options: import("i18next").InitOptions) => void;
|
|
8
|
+
langChangedCallback: () => void;
|
|
9
|
+
readonly isConnected: boolean;
|
|
10
|
+
}) & typeof LitElement;
|
|
11
|
+
export declare class NotificationDialog extends NotificationDialog_base {
|
|
12
|
+
buttonText: string;
|
|
13
|
+
message: string;
|
|
14
|
+
static get styles(): import("lit").CSSResult;
|
|
15
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var __decorate=this&&this.__decorate||function(t,e,o,i){var n,r=arguments.length,a=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(r<3?n(a):r>3?n(e,o,a):n(e,o))||a);return r>3&&a&&Object.defineProperty(e,o,a),a};import{LitElement,html,css}from"lit";import{customElement,property}from"lit/decorators.js";import{i18next,translate}from"@openremote/or-translate";let NotificationDialog=class extends(translate(i18next)(LitElement)){constructor(){super(...arguments),this.buttonText=i18next.t("ok"),this.message=" "}static get styles(){return css`
|
|
2
|
+
.message{
|
|
3
|
+
width: 100%;
|
|
4
|
+
padding: 15px 5px 25px 5px;
|
|
5
|
+
text-align: center;
|
|
6
|
+
max-width: 50vw;
|
|
7
|
+
overflow: auto;
|
|
8
|
+
user-select: text;
|
|
9
|
+
}
|
|
10
|
+
.container{
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: row;
|
|
13
|
+
justify-content: space-between;
|
|
14
|
+
justify-content: space-evenly;
|
|
15
|
+
justify-content: space-around;
|
|
16
|
+
}`}render(){return html`
|
|
17
|
+
<div class="message">${this.message}</div>
|
|
18
|
+
<div class="container">
|
|
19
|
+
<or-mwc-input type="button" unElevated label="${this.buttonText}"
|
|
20
|
+
@click="${()=>{this.dispatchEvent(new CustomEvent("closed"))}}">
|
|
21
|
+
</or-mwc-input>
|
|
22
|
+
</div>
|
|
23
|
+
`}};__decorate([property({type:String})],NotificationDialog.prototype,"buttonText",void 0),__decorate([property({type:String})],NotificationDialog.prototype,"message",void 0),NotificationDialog=__decorate([customElement("notification-dialog")],NotificationDialog);export{NotificationDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-dialog.js","sourceRoot":"","sources":["../../../src/flow-viewer/components/notification-dialog.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAGvD,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,SAAS,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAA/D;;QACgC,eAAU,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC7B,YAAO,GAAG,GAAG,CAAC;IA+BrD,CAAC;IA7BU,MAAM,KAAK,MAAM;QACpB,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;UAeR,CAAC;IACP,CAAC;IAES,MAAM;QACZ,OAAO,IAAI,CAAA;+BACY,IAAI,CAAC,OAAO;;4DAEiB,IAAI,CAAC,UAAU;0BACjD,GAAG,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;;;SAGzE,CAAC;IACN,CAAC;CACJ,CAAA;AAhCsC;IAAlC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAqC;AAC7B;IAAlC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAAsB;AAFxC,kBAAkB;IAD9B,aAAa,CAAC,qBAAqB,CAAC;GACxB,kBAAkB,CAiC9B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LitElement, TemplateResult } from "lit";
|
|
2
|
+
declare const PopupModal_base: (new (...args: any[]) => {
|
|
3
|
+
_i18nextJustInitialized: boolean;
|
|
4
|
+
connectedCallback(): void;
|
|
5
|
+
disconnectedCallback(): void;
|
|
6
|
+
shouldUpdate(changedProps: import("lit").PropertyValueMap<any> | Map<PropertyKey, unknown>): any;
|
|
7
|
+
initCallback: (options: import("i18next").InitOptions) => void;
|
|
8
|
+
langChangedCallback: () => void;
|
|
9
|
+
readonly isConnected: boolean;
|
|
10
|
+
}) & typeof LitElement;
|
|
11
|
+
export declare class PopupModal extends PopupModal_base {
|
|
12
|
+
closeButton: boolean;
|
|
13
|
+
header?: string;
|
|
14
|
+
content?: TemplateResult;
|
|
15
|
+
private isOpen;
|
|
16
|
+
constructor();
|
|
17
|
+
close(): void;
|
|
18
|
+
open(): void;
|
|
19
|
+
static get styles(): import("lit").CSSResult;
|
|
20
|
+
protected firstUpdated(): void;
|
|
21
|
+
protected render(): TemplateResult<1>;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var __decorate=this&&this.__decorate||function(t,e,o,i){var r,n=arguments.length,p=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)p=Reflect.decorate(t,e,o,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(p=(n<3?r(p):n>3?r(e,o,p):r(e,o))||p);return n>3&&p&&Object.defineProperty(e,o,p),p};import{LitElement,css,html}from"lit";import{customElement,property}from"lit/decorators.js";import{modal}from"./flow-editor";import{translate,i18next}from"@openremote/or-translate";let PopupModal=class extends(translate(i18next)(LitElement)){constructor(){super(),this.closeButton=!0,this.isOpen=!1}close(){this.isOpen=!1}open(){this.isOpen=!0}static get styles(){return css`
|
|
2
|
+
:host{
|
|
3
|
+
position: absolute;
|
|
4
|
+
left: 0;
|
|
5
|
+
right: 0;
|
|
6
|
+
top: 0;
|
|
7
|
+
bottom: 0;
|
|
8
|
+
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
align-items: center;
|
|
12
|
+
|
|
13
|
+
background: rgba(0, 0, 0, 0.2);
|
|
14
|
+
z-index: 10000;
|
|
15
|
+
|
|
16
|
+
--topbar-height: 42px;
|
|
17
|
+
--closebutton-padding: 12px;
|
|
18
|
+
--modal-padding: 10px;
|
|
19
|
+
}
|
|
20
|
+
:host(:not([isopen])){
|
|
21
|
+
display: none;
|
|
22
|
+
}
|
|
23
|
+
.modal{
|
|
24
|
+
min-width: 300px;
|
|
25
|
+
min-height: 64px;
|
|
26
|
+
width: auto;
|
|
27
|
+
height: auto;
|
|
28
|
+
display: inline-block;
|
|
29
|
+
background: white;
|
|
30
|
+
border-radius: var(--roundness);
|
|
31
|
+
position: relative;
|
|
32
|
+
padding: var(--modal-padding);
|
|
33
|
+
}
|
|
34
|
+
.close-button{
|
|
35
|
+
position: absolute;
|
|
36
|
+
top: 0;
|
|
37
|
+
right: 0;
|
|
38
|
+
width: calc(var(--topbar-height) - var(--closebutton-padding) * 2);
|
|
39
|
+
height: calc(var(--topbar-height) - var(--closebutton-padding) * 2);
|
|
40
|
+
padding: var(--closebutton-padding);
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
}
|
|
43
|
+
.title{
|
|
44
|
+
margin: 0;
|
|
45
|
+
height: calc(var(--topbar-height) - var(--modal-padding));
|
|
46
|
+
width: 100%;
|
|
47
|
+
text-transform: uppercase;
|
|
48
|
+
font-weight: bold;
|
|
49
|
+
}`}firstUpdated(){modal.element=this,this.addEventListener("mousedown",this.close),window.addEventListener("keyup",(t=>{"Escape"===t.key&&this.close()}))}render(){return this.isOpen?(this.style.display="",html`
|
|
50
|
+
<div class="modal" @mousedown="${t=>{t.stopPropagation()}}">
|
|
51
|
+
<div class="title">${this.header}</div>
|
|
52
|
+
${this.content}
|
|
53
|
+
${this.closeButton?html`<or-icon class="close-button" icon="window-close" @click="${this.close}"></or-icon>`:null}
|
|
54
|
+
</div>
|
|
55
|
+
`):(this.style.display="none",html``)}};__decorate([property({type:Boolean})],PopupModal.prototype,"closeButton",void 0),__decorate([property({type:String})],PopupModal.prototype,"header",void 0),__decorate([property({attribute:!1})],PopupModal.prototype,"content",void 0),__decorate([property({type:Boolean,reflect:!0})],PopupModal.prototype,"isOpen",void 0),PopupModal=__decorate([customElement("popup-modal")],PopupModal);export{PopupModal};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popup-modal.js","sourceRoot":"","sources":["../../../src/flow-viewer/components/popup-modal.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAGvD,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,SAAS,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAO1D;QACI,KAAK,EAAE,CAAC;QAPwB,gBAAW,GAAG,IAAI,CAAC;QAIH,WAAM,GAAG,KAAK,CAAC;IAInE,CAAC;IAEM,KAAK;QACR,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACxB,CAAC;IAEM,IAAI;QACP,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACvB,CAAC;IAEM,MAAM,KAAK,MAAM;QACpB,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAgDR,CAAC;IACP,CAAC;IAES,YAAY;QAClB,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/C,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAgB,EAAE,EAAE;YAClD,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;gBACrB,IAAI,CAAC,KAAK,EAAE,CAAC;YACjB,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAES,MAAM;QACZ,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;YAC5B,OAAO,IAAI,CAAA,EAAE,CAAC;QAClB,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC;QACxB,OAAO,IAAI,CAAA;yCACsB,CAAC,CAAa,EAAE,EAAE,GAAG,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC;iCACnD,IAAI,CAAC,MAAM;cAC9B,IAAI,CAAC,OAAO;cACZ,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAA,6DAA6D,IAAI,CAAC,KAAK,cAAc,CAAC,CAAC,CAAC,IAAI;;SAExH,CAAC;IACN,CAAC;CACJ,CAAA;AA9FuC;IAAnC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CAA2B;AACpB;IAAlC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAwB;AACZ;IAAtC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2CAAiC;AAEZ;IAAnD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAwB;AAL1D,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CA+FtB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
declare const RuleBrowser_base: (new (...args: any[]) => {
|
|
3
|
+
_i18nextJustInitialized: boolean;
|
|
4
|
+
connectedCallback(): void;
|
|
5
|
+
disconnectedCallback(): void;
|
|
6
|
+
shouldUpdate(changedProps: import("lit").PropertyValueMap<any> | Map<PropertyKey, unknown>): any;
|
|
7
|
+
initCallback: (options: import("i18next").InitOptions) => void;
|
|
8
|
+
langChangedCallback: () => void;
|
|
9
|
+
readonly isConnected: boolean;
|
|
10
|
+
}) & typeof LitElement;
|
|
11
|
+
export declare class RuleBrowser extends RuleBrowser_base {
|
|
12
|
+
private status;
|
|
13
|
+
private retrievedRules;
|
|
14
|
+
static get styles(): import("lit").CSSResult;
|
|
15
|
+
protected firstUpdated(): Promise<void>;
|
|
16
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
17
|
+
private loadRule;
|
|
18
|
+
private getButton;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __decorate=this&&this.__decorate||function(t,e,o,i){var r,s=arguments.length,n=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,o,i);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(n=(s<3?r(n):s>3?r(e,o,n):r(e,o))||n);return s>3&&n&&Object.defineProperty(e,o,n),n},__awaiter=this&&this.__awaiter||function(t,e,o,i){return new(o||(o=Promise))((function(r,s){function n(t){try{l(i.next(t))}catch(t){s(t)}}function a(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof o?e:new o((function(t){t(e)}))).then(n,a)}l((i=i.apply(t,e||[])).next())}))};import{LitElement,css,html}from"lit";import{customElement,property}from"lit/decorators.js";import rest from"@openremote/rest";import{i18next,translate}from"@openremote/or-translate";import{Utilities}from"../utils";import{Status}from"../models/status";import{exporter,project,modal}from"./flow-editor";let RuleBrowser=class extends(translate(i18next)(LitElement)){constructor(){super(...arguments),this.status=Status.Idle,this.retrievedRules=[],this.loadRule=t=>__awaiter(this,void 0,void 0,(function*(){let e;this.status=Status.Loading;try{e=yield rest.api.RulesResource.getGlobalRuleset(t.id)}catch(e){return modal.notification("Failure","Something went wrong loading "+t.name),void(this.status=Status.Failure)}const o=e.data,i=exporter.jsonToFlow(o.rules);project.fromNodeCollection(i),project.setCurrentProject(t.id,t.name,i.description),this.dispatchEvent(new CustomEvent("ruleloaded"))})),this.getButton=t=>html`<div class="list-button" @click="${()=>{this.loadRule(t)}}">${Utilities.ellipsis(t.name,50)}
|
|
2
|
+
${t.error?html`<or-icon title="${Utilities.humanLike(t.status)}" icon="alert-outline"></or-icon>`:null}
|
|
3
|
+
${t.enabled?null:html`<or-icon title="${i18next.t("disabled")}" icon="sleep"></or-icon>`}
|
|
4
|
+
</div>`}static get styles(){return css`
|
|
5
|
+
.list-button {
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
padding: 8px 0 8px 8px;
|
|
8
|
+
}
|
|
9
|
+
.list-button:hover {
|
|
10
|
+
background: whitesmoke;
|
|
11
|
+
}
|
|
12
|
+
.list-button:active {
|
|
13
|
+
background: none;
|
|
14
|
+
}
|
|
15
|
+
or-icon{
|
|
16
|
+
width: 18px;
|
|
17
|
+
vertical-align: text-top;
|
|
18
|
+
}
|
|
19
|
+
or-icon[icon=loading]{
|
|
20
|
+
animation: spin 600ms infinite linear;
|
|
21
|
+
}
|
|
22
|
+
@keyframes spin{
|
|
23
|
+
0%{
|
|
24
|
+
transform: rotateZ(0deg);
|
|
25
|
+
}
|
|
26
|
+
100%{
|
|
27
|
+
transform: rotateZ(360deg);
|
|
28
|
+
}
|
|
29
|
+
}`}firstUpdated(){return __awaiter(this,void 0,void 0,(function*(){this.status=Status.Loading;try{const t=yield rest.api.RulesResource.getGlobalRulesets();this.retrievedRules=t.data,this.status=Status.Success}catch(t){this.status=Status.Failure}}))}render(){let t=html``;switch(this.status){case Status.Loading:t=html`<span style="text-align: center;"><or-icon icon="loading"></or-icon></span>`;break;case Status.Success:t=html`${0===this.retrievedRules.length?html`<span>No rules to display</span>`:this.retrievedRules.map((t=>this.getButton(t)))}`;break;case Status.Failure:t=html`<span>Failed to load rules</span>`}return html`
|
|
30
|
+
<div style="display: flex; flex-direction: column; width: auto; align-items: stretch;">
|
|
31
|
+
${t}
|
|
32
|
+
</div>`}};__decorate([property({type:Number})],RuleBrowser.prototype,"status",void 0),RuleBrowser=__decorate([customElement("rule-browser")],RuleBrowser);export{RuleBrowser};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rule-browser.js","sourceRoot":"","sources":["../../../src/flow-viewer/components/rule-browser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAE1D,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGlD,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,SAAS,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAAxD;;QACiC,WAAM,GAAG,MAAM,CAAC,IAAI,CAAC;QACjD,mBAAc,GAAoB,EAAE,CAAC;QA+DrC,aAAQ,GAAG,CAAO,CAAgB,EAAE,EAAE;YAC1C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC;YAC7B,IAAI,QAAiC,CAAC;YACtC,IAAI,CAAC;gBACD,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAG,CAAC,CAAC;YACpE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE,+BAA+B,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;gBACxE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC;gBAC7B,OAAO;YACX,CAAC;YACD,MAAM,OAAO,GA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;gBACpC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC;YACjC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC;YACjC,CAAC;QACL,CAAC;KAAA;IAES,MAAM;QACZ,IAAI,MAAM,GAAG,IAAI,CAAA,EAAE,CAAC;QACpB,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;YAClB,KAAK,MAAM,CAAC,OAAO;gBACf,MAAM,GAAG,IAAI,CAAA,6EAA6E,CAAC;gBAC3F,MAAM;YACV,KAAK,MAAM,CAAC,OAAO;gBACf,MAAM,GAAG,IAAI,CAAA,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC;oBAC9C,IAAI,CAAA,kCAAkC,CAAC,CAAC;oBACxC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAgB,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvE,MAAM;YACV,KAAK,MAAM,CAAC,OAAO;gBACf,MAAM,GAAG,IAAI,CAAA,mCAAmC,CAAC;gBACjD,MAAM;QACd,CAAC;QACD,OAAO,IAAI,CAAA;;UAET,MAAM;eACD,CAAC;IACZ,CAAC;CAyBJ,CAAA;AAvFuC;IAAnC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAA8B;AADhD,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAwFvB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
declare const SelectableElement_base: (new (...args: any[]) => {
|
|
3
|
+
_i18nextJustInitialized: boolean;
|
|
4
|
+
connectedCallback(): void;
|
|
5
|
+
disconnectedCallback(): void;
|
|
6
|
+
shouldUpdate(changedProps: import("lit").PropertyValueMap<any> | Map<PropertyKey, unknown>): any;
|
|
7
|
+
initCallback: (options: import("i18next").InitOptions) => void;
|
|
8
|
+
langChangedCallback: () => void;
|
|
9
|
+
readonly isConnected: boolean;
|
|
10
|
+
}) & typeof LitElement;
|
|
11
|
+
export declare class SelectableElement extends SelectableElement_base {
|
|
12
|
+
get selected(): boolean;
|
|
13
|
+
get handle(): HTMLElement;
|
|
14
|
+
private isSelected;
|
|
15
|
+
private selectableHandle;
|
|
16
|
+
disconnectedCallback(): void;
|
|
17
|
+
setHandle(element: HTMLElement): void;
|
|
18
|
+
protected firstUpdated(): void;
|
|
19
|
+
private readonly onSelected;
|
|
20
|
+
private readonly onDeselected;
|
|
21
|
+
private readonly handleSelection;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,s,l){var i,n=arguments.length,o=n<3?t:null===l?l=Object.getOwnPropertyDescriptor(t,s):l;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,s,l);else for(var c=e.length-1;c>=0;c--)(i=e[c])&&(o=(n<3?i(o):n>3?i(t,s,o):i(t,s))||o);return n>3&&o&&Object.defineProperty(t,s,o),o};import{LitElement}from"lit";import{property}from"lit/decorators.js";import{input}from"./flow-editor";import{i18next,translate}from"@openremote/or-translate";export class SelectableElement extends(translate(i18next)(LitElement)){constructor(){super(...arguments),this.isSelected=!1,this.onSelected=e=>{e===this&&(this.isSelected=!0)},this.onDeselected=e=>{e===this&&(this.isSelected=!1)},this.handleSelection=e=>{1===e.buttons?(input.handleSelection(this),e.stopPropagation()):2===e.buttons&&input.handleSelection(this,!0)}}get selected(){return this.isSelected}get handle(){return this.selectableHandle}disconnectedCallback(){super.disconnectedCallback(),this.selected&&input.selected.splice(input.selected.indexOf(this),1),this.isSelected=!1,input.removeListener("selected",this.onSelected),input.removeListener("deselected",this.onDeselected),input.selectables.splice(input.selectables.indexOf(this),1)}setHandle(e){this.selectableHandle&&this.selectableHandle.removeEventListener("mousedown",this.handleSelection),e.addEventListener("mousedown",this.handleSelection),this.selectableHandle=e}firstUpdated(){this.setHandle(this),input.selectables.push(this),input.addListener("selected",this.onSelected),input.addListener("deselected",this.onDeselected)}}__decorate([property({type:Boolean})],SelectableElement.prototype,"isSelected",void 0),__decorate([property({attribute:!1})],SelectableElement.prototype,"selectableHandle",void 0);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectable-element.js","sourceRoot":"","sources":["../../../src/flow-viewer/components/selectable-element.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE9D,MAAM,OAAO,iBAAkB,SAAQ,SAAS,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAArE;;QAQyC,eAAU,GAAG,KAAK,CAAC;QA6BvC,eAAU,GAAG,CAAC,CAAc,EAAE,EAAE;YAC7C,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;gBACb,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YAC3B,CAAC;QACL,CAAC,CAAA;QAEgB,iBAAY,GAAG,CAAC,CAAc,EAAE,EAAE;YAC/C,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;gBACb,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;YAC5B,CAAC;QACL,CAAC,CAAA;QAEgB,oBAAe,GAAG,CAAC,KAAiB,EAAE,EAAE;YACrD,IAAI,KAAK,CAAC,OAAO,KAAK,CAAC,EAAE,CAAC;gBACtB,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;gBAC5B,KAAK,CAAC,eAAe,EAAE,CAAC;YAC5B,CAAC;iBAAM,IAAI,KAAK,CAAC,OAAO,KAAK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AC,WAAW,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC/C,KAAK,CAAC,WAAW,CAAC,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IACvD,CAAC;CAsBJ;AAjDwC;IAApC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;qDAA4B;AAChB;IAAvC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2DAAwC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import { EditorWorkspace } from "./editor-workspace";
|
|
3
|
+
export declare class SelectionBox extends LitElement {
|
|
4
|
+
static get styles(): import("lit").CSSResult;
|
|
5
|
+
workspace: EditorWorkspace;
|
|
6
|
+
readonly distanceTreshold = 20;
|
|
7
|
+
private isSelecting;
|
|
8
|
+
private selectionStartPosition;
|
|
9
|
+
private selectionBox;
|
|
10
|
+
protected firstUpdated(): void;
|
|
11
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
12
|
+
private workspaceMouseDown;
|
|
13
|
+
private mouseMove;
|
|
14
|
+
private workspaceMouseUp;
|
|
15
|
+
private selectInBounds;
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var __decorate=this&&this.__decorate||function(t,e,i,o){var s,n=arguments.length,c=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,e,i,o);else for(var h=t.length-1;h>=0;h--)(s=t[h])&&(c=(n<3?s(c):n>3?s(e,i,c):s(e,i))||c);return n>3&&c&&Object.defineProperty(e,i,c),c};import{LitElement,html,css}from"lit";import{customElement,property}from"lit/decorators.js";import{Utilities}from"../utils";import{input}from"./flow-editor";let SelectionBox=class extends LitElement{constructor(){super(...arguments),this.distanceTreshold=20,this.isSelecting=!1,this.selectionStartPosition={x:0,y:0},this.selectionBox={x:0,y:0,width:0,height:0},this.workspaceMouseDown=t=>{1===t.buttons&&(this.selectionBox.x=t.offsetX,this.selectionBox.y=t.offsetY,this.selectionStartPosition.x=this.selectionBox.x,this.selectionStartPosition.y=this.selectionBox.y,window.addEventListener("mousemove",this.mouseMove))},this.mouseMove=t=>{const e=t.pageX-this.workspace.clientRect.left-this.selectionStartPosition.x,i=t.pageY-this.workspace.clientRect.top-this.selectionStartPosition.y;e<0?(this.selectionBox.x=t.pageX-this.workspace.clientRect.left,this.selectionBox.width=Math.abs(this.selectionBox.x-this.selectionStartPosition.x)):(this.selectionBox.x=this.selectionStartPosition.x,this.selectionBox.width=Math.abs(e)),i<0?(this.selectionBox.y=t.pageY-this.workspace.clientRect.top,this.selectionBox.height=Math.abs(this.selectionBox.y-this.selectionStartPosition.y)):(this.selectionBox.y=this.selectionStartPosition.y,this.selectionBox.height=Math.abs(i)),this.selectionBox.width+this.selectionBox.height>this.distanceTreshold&&(this.isSelecting=!0),this.requestUpdate()},this.workspaceMouseUp=()=>{window.removeEventListener("mousemove",this.mouseMove),this.isSelecting&&(this.selectInBounds(),this.isSelecting=!1)}}static get styles(){return css`
|
|
2
|
+
svg{
|
|
3
|
+
fill: none;
|
|
4
|
+
overflow: visible;
|
|
5
|
+
position: absolute;
|
|
6
|
+
pointer-events: all;
|
|
7
|
+
stroke-linejoin: round;
|
|
8
|
+
transition: stroke-width 120ms;
|
|
9
|
+
z-index: 1000;
|
|
10
|
+
width: 100vw;
|
|
11
|
+
height: 100vh;
|
|
12
|
+
}
|
|
13
|
+
rect{
|
|
14
|
+
fill: var(--highlight-faded);
|
|
15
|
+
outline: solid 1px var(--highlight);
|
|
16
|
+
}`}firstUpdated(){this.workspace.addEventListener("mousedown",this.workspaceMouseDown),window.addEventListener("mouseup",this.workspaceMouseUp)}render(){return this.isSelecting?html`<svg><rect x="${this.selectionBox.x}px" y="${this.selectionBox.y}px" width="${this.selectionBox.width}px" height="${this.selectionBox.height}px"></rect></svg>`:html``}selectInBounds(){input.clearSelection();const t={x:this.selectionBox.x+this.workspace.clientRect.left,y:this.selectionBox.y+this.workspace.clientRect.top,width:this.selectionBox.width,height:this.selectionBox.height};for(const e of input.selectables){const i=e.handle.getBoundingClientRect();Utilities.isBoxInsideBox({x:i.left,y:i.top,width:i.width,height:i.height},t)&&input.select(e,!0)}}};__decorate([property({attribute:!1})],SelectionBox.prototype,"workspace",void 0),__decorate([property({attribute:!1})],SelectionBox.prototype,"isSelecting",void 0),__decorate([property({attribute:!1})],SelectionBox.prototype,"selectionStartPosition",void 0),__decorate([property({attribute:!1})],SelectionBox.prototype,"selectionBox",void 0),SelectionBox=__decorate([customElement("selection-box")],SelectionBox);export{SelectionBox};
|