@openremote/or-rules 1.8.0-snapshot.20250725074716 → 1.8.0-snapshot.20250725120000
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 +30 -30
- package/custom-elements.json +13 -13
- package/dist/umd/index.bundle.js +4744 -4744
- package/dist/umd/index.bundle.js.map +1 -1
- package/lib/flow-viewer/components/confirmation-dialog.js +61 -24
- package/lib/flow-viewer/components/connection-container.js +35 -1
- package/lib/flow-viewer/components/connection-line.js +117 -28
- package/lib/flow-viewer/components/context-menu.js +140 -45
- package/lib/flow-viewer/components/editor-workspace.js +282 -20
- package/lib/flow-viewer/components/flow-editor.js +160 -47
- package/lib/flow-viewer/components/flow-node-socket.js +146 -31
- package/lib/flow-viewer/components/flow-node.js +192 -29
- package/lib/flow-viewer/components/internal-picker.js +271 -54
- package/lib/flow-viewer/components/node-menu-item.js +132 -32
- package/lib/flow-viewer/components/node-panel.js +104 -60
- package/lib/flow-viewer/components/notification-dialog.js +55 -23
- package/lib/flow-viewer/components/popup-modal.js +113 -54
- package/lib/flow-viewer/components/rule-browser.js +119 -30
- package/lib/flow-viewer/components/selectable-element.js +71 -1
- package/lib/flow-viewer/components/selection-box.js +119 -15
- package/lib/flow-viewer/components/top-bar.js +116 -49
- package/lib/flow-viewer/components/workspace-contextmenu-options.js +128 -5
- package/lib/flow-viewer/components/writable-dropdown.js +51 -5
- package/lib/flow-viewer/converters/node-converter.js +10 -1
- package/lib/flow-viewer/flow-viewer.js +19 -1
- package/lib/flow-viewer/models/camera.js +2 -1
- package/lib/flow-viewer/models/context-menu-button.js +2 -1
- package/lib/flow-viewer/models/light-node-collection.js +2 -1
- package/lib/flow-viewer/models/status.js +8 -1
- package/lib/flow-viewer/node-structure/copy.machine.js +34 -1
- package/lib/flow-viewer/node-structure/identity.assigner.js +10 -1
- package/lib/flow-viewer/node-structure/identity.dom.link.js +4 -1
- package/lib/flow-viewer/node-structure/index.js +5 -1
- package/lib/flow-viewer/node-structure/socket.type.matcher.js +50 -1
- package/lib/flow-viewer/node-structure/utils.js +109 -1
- package/lib/flow-viewer/services/copy-paste-manager.js +59 -1
- package/lib/flow-viewer/services/exporter.js +67 -1
- package/lib/flow-viewer/services/input.js +80 -1
- package/lib/flow-viewer/services/integration.js +27 -1
- package/lib/flow-viewer/services/modal.js +29 -8
- package/lib/flow-viewer/services/project.js +222 -1
- package/lib/flow-viewer/services/shortcuts.js +63 -1
- package/lib/flow-viewer/styles/editor-workspace-style.js +55 -53
- package/lib/flow-viewer/styles/flow-node-style.js +95 -93
- package/lib/flow-viewer/styles/picker-styles.js +31 -29
- package/lib/flow-viewer/utils.js +49 -1
- package/lib/index.js +953 -56
- package/lib/json-viewer/forms/or-rule-form-alarm.js +91 -18
- package/lib/json-viewer/forms/or-rule-form-email-message.js +51 -12
- package/lib/json-viewer/forms/or-rule-form-localized.js +269 -43
- package/lib/json-viewer/forms/or-rule-form-push-notification.js +152 -63
- package/lib/json-viewer/forms/or-rule-form-webhook.js +296 -101
- package/lib/json-viewer/modals/or-rule-alarm-modal.js +173 -17
- package/lib/json-viewer/modals/or-rule-notification-modal.js +196 -11
- package/lib/json-viewer/modals/or-rule-radial-modal.js +142 -17
- package/lib/json-viewer/modals/or-rule-webhook-modal.js +78 -8
- package/lib/json-viewer/or-rule-action-alarm.js +97 -5
- package/lib/json-viewer/or-rule-action-attribute.js +235 -33
- package/lib/json-viewer/or-rule-action-notification.js +465 -56
- package/lib/json-viewer/or-rule-action-webhook.js +49 -18
- package/lib/json-viewer/or-rule-asset-query.js +849 -126
- package/lib/json-viewer/or-rule-condition.js +216 -29
- package/lib/json-viewer/or-rule-json-viewer.js +393 -34
- package/lib/json-viewer/or-rule-then-otherwise.js +609 -113
- package/lib/json-viewer/or-rule-trigger-query.js +227 -57
- package/lib/json-viewer/or-rule-when.js +343 -126
- package/lib/or-rule-group-viewer.js +106 -12
- package/lib/or-rule-text-viewer.js +133 -22
- package/lib/or-rule-tree.js +601 -57
- package/lib/or-rule-validity.js +373 -62
- package/lib/or-rule-viewer.js +361 -81
- package/lib/style.js +89 -64
- package/package.json +11 -11
|
@@ -1 +1,71 @@
|
|
|
1
|
-
var __decorate=this&&this.__decorate
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement } from "lit";
|
|
8
|
+
import { property } from "lit/decorators.js";
|
|
9
|
+
import { input } from "./flow-editor";
|
|
10
|
+
import { i18next, translate } from "@openremote/or-translate";
|
|
11
|
+
export class SelectableElement extends translate(i18next)(LitElement) {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.isSelected = false;
|
|
15
|
+
this.onSelected = (e) => {
|
|
16
|
+
if (e === this) {
|
|
17
|
+
this.isSelected = true;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
this.onDeselected = (e) => {
|
|
21
|
+
if (e === this) {
|
|
22
|
+
this.isSelected = false;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
this.handleSelection = (event) => {
|
|
26
|
+
if (event.buttons === 1) {
|
|
27
|
+
input.handleSelection(this);
|
|
28
|
+
event.stopPropagation();
|
|
29
|
+
}
|
|
30
|
+
else if (event.buttons === 2) {
|
|
31
|
+
input.handleSelection(this, true);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
get selected() {
|
|
36
|
+
return this.isSelected;
|
|
37
|
+
}
|
|
38
|
+
get handle() {
|
|
39
|
+
return this.selectableHandle;
|
|
40
|
+
}
|
|
41
|
+
disconnectedCallback() {
|
|
42
|
+
super.disconnectedCallback();
|
|
43
|
+
if (this.selected) {
|
|
44
|
+
input.selected.splice(input.selected.indexOf(this), 1);
|
|
45
|
+
}
|
|
46
|
+
this.isSelected = false;
|
|
47
|
+
input.removeListener("selected", this.onSelected);
|
|
48
|
+
input.removeListener("deselected", this.onDeselected);
|
|
49
|
+
input.selectables.splice(input.selectables.indexOf(this), 1);
|
|
50
|
+
}
|
|
51
|
+
setHandle(element) {
|
|
52
|
+
if (this.selectableHandle) {
|
|
53
|
+
this.selectableHandle.removeEventListener("mousedown", this.handleSelection);
|
|
54
|
+
}
|
|
55
|
+
element.addEventListener("mousedown", this.handleSelection);
|
|
56
|
+
this.selectableHandle = element;
|
|
57
|
+
}
|
|
58
|
+
firstUpdated() {
|
|
59
|
+
this.setHandle(this);
|
|
60
|
+
input.selectables.push(this);
|
|
61
|
+
input.addListener("selected", this.onSelected);
|
|
62
|
+
input.addListener("deselected", this.onDeselected);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
__decorate([
|
|
66
|
+
property({ type: Boolean })
|
|
67
|
+
], SelectableElement.prototype, "isSelected", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
property({ attribute: false })
|
|
70
|
+
], SelectableElement.prototype, "selectableHandle", void 0);
|
|
71
|
+
//# sourceMappingURL=selectable-element.js.map
|
|
@@ -1,16 +1,120 @@
|
|
|
1
|
-
var __decorate=this&&this.__decorate
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, html, css } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
import { Utilities } from "../utils";
|
|
10
|
+
import { input } from "./flow-editor";
|
|
11
|
+
let SelectionBox = class SelectionBox extends LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.distanceTreshold = 20;
|
|
15
|
+
this.isSelecting = false;
|
|
16
|
+
this.selectionStartPosition = { x: 0, y: 0 };
|
|
17
|
+
this.selectionBox = { x: 0, y: 0, width: 0, height: 0 };
|
|
18
|
+
this.workspaceMouseDown = (e) => {
|
|
19
|
+
if (e.buttons !== 1) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
this.selectionBox.x = e.offsetX;
|
|
23
|
+
this.selectionBox.y = e.offsetY;
|
|
24
|
+
this.selectionStartPosition.x = this.selectionBox.x;
|
|
25
|
+
this.selectionStartPosition.y = this.selectionBox.y;
|
|
26
|
+
window.addEventListener("mousemove", this.mouseMove);
|
|
27
|
+
};
|
|
28
|
+
this.mouseMove = (e) => {
|
|
29
|
+
const width = e.pageX - this.workspace.clientRect.left - this.selectionStartPosition.x;
|
|
30
|
+
const height = e.pageY - this.workspace.clientRect.top - this.selectionStartPosition.y;
|
|
31
|
+
if (width < 0) {
|
|
32
|
+
this.selectionBox.x = e.pageX - this.workspace.clientRect.left;
|
|
33
|
+
this.selectionBox.width = Math.abs(this.selectionBox.x - this.selectionStartPosition.x);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this.selectionBox.x = this.selectionStartPosition.x;
|
|
37
|
+
this.selectionBox.width = Math.abs(width);
|
|
38
|
+
}
|
|
39
|
+
if (height < 0) {
|
|
40
|
+
this.selectionBox.y = e.pageY - this.workspace.clientRect.top;
|
|
41
|
+
this.selectionBox.height = Math.abs(this.selectionBox.y - this.selectionStartPosition.y);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
this.selectionBox.y = this.selectionStartPosition.y;
|
|
45
|
+
this.selectionBox.height = Math.abs(height);
|
|
46
|
+
}
|
|
47
|
+
if (this.selectionBox.width + this.selectionBox.height > this.distanceTreshold) {
|
|
48
|
+
this.isSelecting = true;
|
|
49
|
+
}
|
|
50
|
+
this.requestUpdate();
|
|
51
|
+
};
|
|
52
|
+
this.workspaceMouseUp = () => {
|
|
53
|
+
window.removeEventListener("mousemove", this.mouseMove);
|
|
54
|
+
if (this.isSelecting) {
|
|
55
|
+
this.selectInBounds();
|
|
56
|
+
this.isSelecting = false;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
static get styles() {
|
|
61
|
+
return css `
|
|
62
|
+
svg{
|
|
63
|
+
fill: none;
|
|
64
|
+
overflow: visible;
|
|
65
|
+
position: absolute;
|
|
66
|
+
pointer-events: all;
|
|
67
|
+
stroke-linejoin: round;
|
|
68
|
+
transition: stroke-width 120ms;
|
|
69
|
+
z-index: 1000;
|
|
70
|
+
width: 100vw;
|
|
71
|
+
height: 100vh;
|
|
72
|
+
}
|
|
73
|
+
rect{
|
|
74
|
+
fill: var(--highlight-faded);
|
|
75
|
+
outline: solid 1px var(--highlight);
|
|
76
|
+
}`;
|
|
77
|
+
}
|
|
78
|
+
firstUpdated() {
|
|
79
|
+
this.workspace.addEventListener("mousedown", this.workspaceMouseDown);
|
|
80
|
+
window.addEventListener("mouseup", this.workspaceMouseUp);
|
|
81
|
+
}
|
|
82
|
+
render() {
|
|
83
|
+
if (!this.isSelecting) {
|
|
84
|
+
return html ``;
|
|
12
85
|
}
|
|
13
|
-
rect{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
86
|
+
return 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>`;
|
|
87
|
+
}
|
|
88
|
+
selectInBounds() {
|
|
89
|
+
input.clearSelection();
|
|
90
|
+
const offsetBox = {
|
|
91
|
+
x: this.selectionBox.x + this.workspace.clientRect.left,
|
|
92
|
+
y: this.selectionBox.y + this.workspace.clientRect.top,
|
|
93
|
+
width: this.selectionBox.width,
|
|
94
|
+
height: this.selectionBox.height,
|
|
95
|
+
};
|
|
96
|
+
for (const selectable of input.selectables) {
|
|
97
|
+
const rect = selectable.handle.getBoundingClientRect();
|
|
98
|
+
if (Utilities.isBoxInsideBox({ x: rect.left, y: rect.top, width: rect.width, height: rect.height }, offsetBox)) {
|
|
99
|
+
input.select(selectable, true);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
__decorate([
|
|
105
|
+
property({ attribute: false })
|
|
106
|
+
], SelectionBox.prototype, "workspace", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
property({ attribute: false })
|
|
109
|
+
], SelectionBox.prototype, "isSelecting", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
property({ attribute: false })
|
|
112
|
+
], SelectionBox.prototype, "selectionStartPosition", void 0);
|
|
113
|
+
__decorate([
|
|
114
|
+
property({ attribute: false })
|
|
115
|
+
], SelectionBox.prototype, "selectionBox", void 0);
|
|
116
|
+
SelectionBox = __decorate([
|
|
117
|
+
customElement("selection-box")
|
|
118
|
+
], SelectionBox);
|
|
119
|
+
export { SelectionBox };
|
|
120
|
+
//# sourceMappingURL=selection-box.js.map
|
|
@@ -1,51 +1,118 @@
|
|
|
1
|
-
var __decorate=this&&this.__decorate
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, html, css } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
import { InputType } from "@openremote/or-mwc-components/or-mwc-input";
|
|
10
|
+
import { Utilities } from "../utils";
|
|
11
|
+
import { i18next, translate } from "@openremote/or-translate";
|
|
12
|
+
import { project, modal, exporter } from "./flow-editor";
|
|
13
|
+
let TopBar = class TopBar extends translate(i18next)(LitElement) {
|
|
14
|
+
static get styles() {
|
|
15
|
+
return css `
|
|
16
|
+
:host{
|
|
17
|
+
display: flex;
|
|
18
|
+
width: 100%;
|
|
19
|
+
justify-content: flex-start;
|
|
20
|
+
align-items: center;
|
|
21
|
+
box-shadow: rgba(0, 0, 0, 0.2) 0px 5px 5px -5px;
|
|
22
|
+
line-height: var(--topbar-height);
|
|
23
|
+
z-index: 150;
|
|
24
|
+
}
|
|
25
|
+
.button{
|
|
26
|
+
padding: 0 25px 0 25px;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
}
|
|
29
|
+
.button:hover{
|
|
30
|
+
background: #fafafa;
|
|
31
|
+
}
|
|
32
|
+
.button:active{
|
|
33
|
+
background: whitesmoke;
|
|
34
|
+
}
|
|
35
|
+
.debug.button{
|
|
36
|
+
background: yellow;
|
|
37
|
+
}
|
|
38
|
+
.title{
|
|
39
|
+
margin: 0 15px 0 15px;
|
|
40
|
+
text-transform: uppercase;
|
|
41
|
+
font-weight: bold;
|
|
42
|
+
}
|
|
43
|
+
.right{
|
|
44
|
+
margin-left: auto;
|
|
45
|
+
}`;
|
|
46
|
+
}
|
|
47
|
+
firstUpdated() {
|
|
48
|
+
project.addListener("unsavedstateset", () => {
|
|
49
|
+
this.requestUpdate();
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
render() {
|
|
53
|
+
return html `
|
|
54
|
+
<span class="title">${i18next.t("flowEditor")}</span>
|
|
55
|
+
<a class="button" @click="${() => {
|
|
56
|
+
if (project.unsavedState) {
|
|
57
|
+
modal.confirmation(() => { project.clear(true); }, "New project");
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
project.clear(true);
|
|
61
|
+
}
|
|
62
|
+
}}">New</a>
|
|
63
|
+
<a class="button" @click="${this.save}">${i18next.t("save")} <i>${Utilities.ellipsis(project.existingFlowRuleName)}</i>${project.unsavedState && project.existingFlowRuleId !== -1 ? "*" : ""}</a>
|
|
64
|
+
${project.existingFlowRuleId === -1 ? null : html `<a @click="${this.showSaveAsDialog}" class="button">Save as...</a>`}
|
|
65
|
+
<a class="button" @click="${this.showRuleBrowser}">Open</a>
|
|
66
|
+
<a class="button right" @click="${() => {
|
|
67
|
+
this.application.nodePanel.drawer.toggle();
|
|
68
|
+
}}"><or-icon icon="menu"></or-icon></a>
|
|
69
|
+
`;
|
|
70
|
+
}
|
|
71
|
+
save() {
|
|
72
|
+
if (project.existingFlowRuleId === -1) {
|
|
73
|
+
this.showSaveAsDialog();
|
|
10
74
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
cursor: pointer;
|
|
75
|
+
else {
|
|
76
|
+
exporter.exportAsExisting(project.existingFlowRuleId, project.toNodeCollection(project.existingFlowRuleName, project.existingFlowRuleDesc));
|
|
14
77
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
78
|
+
}
|
|
79
|
+
showRuleBrowser() {
|
|
80
|
+
modal.element.content = html `<rule-browser @ruleloaded="${() => modal.element.close()}"></rule-browser>`;
|
|
81
|
+
modal.element.header = "Select a Flow rule";
|
|
82
|
+
modal.element.open();
|
|
83
|
+
}
|
|
84
|
+
showSaveAsDialog() {
|
|
85
|
+
let chosenName = "";
|
|
86
|
+
let chosenDesc = "";
|
|
87
|
+
modal.element.content = html `
|
|
88
|
+
<div style="display: flex; flex-direction: column; width: auto; justify-content: space-between; align-items: stretch;">
|
|
89
|
+
<or-mwc-input style="margin-bottom: 16px; width:100%;" required type="text" label="${i18next.t("name", "Name")}"
|
|
90
|
+
@or-mwc-input-changed="${(e) => { chosenName = e.detail.value; }}"
|
|
91
|
+
></or-mwc-input>
|
|
92
|
+
<or-mwc-input style="margin-bottom: 16px; width:100%;" fullwidth type="textarea" label="${i18next.t("description", "Description")}"
|
|
93
|
+
@or-mwc-input-changed="${(e) => { chosenDesc = e.detail.value; }}"
|
|
94
|
+
></or-mwc-input>
|
|
95
|
+
<div>
|
|
96
|
+
<or-mwc-input style="text-align: left; margin-right: 10px" type="${InputType.BUTTON}" label="${i18next.t("cancel", "Cancel")}" @or-mwc-input-changed="${modal.element.close}"></or-mwc-input>
|
|
97
|
+
<or-mwc-input style="text-align: right" type="${InputType.BUTTON}" unelevated label="${i18next.t("save", "Save")}" @or-mwc-input-changed="${() => {
|
|
98
|
+
if (!chosenName) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
exporter.exportAsNew(project.toNodeCollection(chosenName, chosenDesc));
|
|
102
|
+
modal.element.close();
|
|
103
|
+
}}"></or-mwc-input>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
`;
|
|
107
|
+
modal.element.header = "Save project";
|
|
108
|
+
modal.element.open();
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
__decorate([
|
|
112
|
+
property({ attribute: false })
|
|
113
|
+
], TopBar.prototype, "application", void 0);
|
|
114
|
+
TopBar = __decorate([
|
|
115
|
+
customElement("top-bar")
|
|
116
|
+
], TopBar);
|
|
117
|
+
export { TopBar };
|
|
118
|
+
//# sourceMappingURL=top-bar.js.map
|
|
@@ -1,5 +1,128 @@
|
|
|
1
|
-
import{FlowNode
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { FlowNode } from "./flow-node";
|
|
2
|
+
import { ConnectionLine } from "../flow-viewer";
|
|
3
|
+
import { integration, project, copyPasteManager, input, exporter, modal } from "./flow-editor";
|
|
4
|
+
import i18next from "i18next";
|
|
5
|
+
import { Utilities } from "../utils";
|
|
6
|
+
import { CopyMachine } from "../node-structure";
|
|
7
|
+
import { ContextMenu } from "./context-menu";
|
|
8
|
+
import { html } from "lit";
|
|
9
|
+
export const createContextMenuButtons = (workspace, e) => {
|
|
10
|
+
const selectedNodes = input.selected.filter((s) => s instanceof FlowNode && s.selected);
|
|
11
|
+
const selectedConnections = input.selected.filter((s) => s instanceof ConnectionLine && s.selected);
|
|
12
|
+
const createNodeButtons = (type) => {
|
|
13
|
+
let nB = [
|
|
14
|
+
{
|
|
15
|
+
type: "button",
|
|
16
|
+
label: "",
|
|
17
|
+
icon: "arrow-left",
|
|
18
|
+
action: () => { workspace.dispatchEvent(new MouseEvent("contextmenu", e)); }
|
|
19
|
+
}
|
|
20
|
+
];
|
|
21
|
+
nB = nB.concat(integration.nodes.filter((n) => n.type === type).map((node) => {
|
|
22
|
+
const b = {
|
|
23
|
+
type: "button",
|
|
24
|
+
label: i18next.t("flow." + node.name, Utilities.humanLike(node.name)),
|
|
25
|
+
action: () => {
|
|
26
|
+
const copy = CopyMachine.copy(node);
|
|
27
|
+
copy.position = workspace.offsetToWorld({ x: e.offsetX - workspace.offsetLeft, y: e.offsetY - workspace.offsetTop });
|
|
28
|
+
project.createUndoSnapshot();
|
|
29
|
+
project.addNode(copy);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
return b;
|
|
33
|
+
}));
|
|
34
|
+
return nB;
|
|
35
|
+
};
|
|
36
|
+
let buttons = [
|
|
37
|
+
{
|
|
38
|
+
type: "button",
|
|
39
|
+
label: i18next.t("input", "Input"),
|
|
40
|
+
icon: "arrow-collapse-right",
|
|
41
|
+
action: () => { ContextMenu.open(e.pageX, e.pageY, workspace, createNodeButtons("INPUT" /* NodeType.INPUT */)); }
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: "button",
|
|
45
|
+
label: i18next.t("processors", "Processors"),
|
|
46
|
+
icon: "cog",
|
|
47
|
+
action: () => { ContextMenu.open(e.pageX, e.pageY, workspace, createNodeButtons("PROCESSOR" /* NodeType.PROCESSOR */)); }
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
type: "button",
|
|
51
|
+
label: i18next.t("output", "Output"),
|
|
52
|
+
icon: "arrow-expand-right",
|
|
53
|
+
action: () => { ContextMenu.open(e.pageX, e.pageY, workspace, createNodeButtons("OUTPUT" /* NodeType.OUTPUT */)); }
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
buttons = buttons.concat([
|
|
57
|
+
{ type: "separator" },
|
|
58
|
+
{
|
|
59
|
+
type: "button",
|
|
60
|
+
icon: "content-copy",
|
|
61
|
+
label: i18next.t("copy", "Copy"),
|
|
62
|
+
action: () => {
|
|
63
|
+
const pos = workspace.offsetToWorld({ x: e.offsetX, y: e.offsetY });
|
|
64
|
+
copyPasteManager.copy(pos.x, pos.y);
|
|
65
|
+
},
|
|
66
|
+
disabled: selectedNodes.length === 0
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
type: "button",
|
|
70
|
+
icon: "content-paste",
|
|
71
|
+
label: i18next.t("paste", "Paste"),
|
|
72
|
+
action: () => {
|
|
73
|
+
project.createUndoSnapshot();
|
|
74
|
+
const pos = workspace.offsetToWorld({ x: e.offsetX, y: e.offsetY });
|
|
75
|
+
project.notifyChange();
|
|
76
|
+
workspace.pasteAt(pos.x, pos.y);
|
|
77
|
+
},
|
|
78
|
+
disabled: copyPasteManager.isFull
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
type: "button",
|
|
82
|
+
icon: "delete",
|
|
83
|
+
label: i18next.t("delete", "Delete"),
|
|
84
|
+
action: () => {
|
|
85
|
+
project.createUndoSnapshot();
|
|
86
|
+
selectedNodes.forEach((n) => {
|
|
87
|
+
if (n.frozen) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
project.removeNode(n.node);
|
|
91
|
+
});
|
|
92
|
+
selectedConnections.forEach((n) => project.removeConnection(n.connection));
|
|
93
|
+
project.notifyChange();
|
|
94
|
+
},
|
|
95
|
+
disabled: (selectedNodes.length === 0 && selectedConnections.length === 0) || (selectedNodes.length !== 0 && selectedNodes.every((n) => n.frozen))
|
|
96
|
+
},
|
|
97
|
+
{ type: "separator" },
|
|
98
|
+
{
|
|
99
|
+
type: "button",
|
|
100
|
+
icon: "fit-to-page-outline",
|
|
101
|
+
label: i18next.t("fitViewToSelectedNodes", "Fit view to selected nodes"),
|
|
102
|
+
action: () => workspace.fitCamera(selectedNodes.map((n) => n.node)),
|
|
103
|
+
disabled: selectedNodes.length === 0
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
type: "button",
|
|
107
|
+
icon: "snowflake",
|
|
108
|
+
label: "TOGGLE FROZEN [DEBUG FUNCTION]",
|
|
109
|
+
action: () => selectedNodes.forEach((n) => n.frozen = !n.frozen),
|
|
110
|
+
disabled: selectedNodes.length === 0
|
|
111
|
+
},
|
|
112
|
+
{ type: "separator" },
|
|
113
|
+
{
|
|
114
|
+
type: "button",
|
|
115
|
+
icon: "export",
|
|
116
|
+
label: "Export to JSON",
|
|
117
|
+
action: () => {
|
|
118
|
+
modal.anything("Export result", html `
|
|
119
|
+
<div style="user-select: all;font-family: monospace; padding: 5px; overflow: auto; background: whitesmoke; max-width:50vw; max-height:50vh">
|
|
120
|
+
${exporter.flowToJson(project.toNodeCollection("Exported on " + new Date(), ""))}
|
|
121
|
+
</div>
|
|
122
|
+
`);
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
]);
|
|
126
|
+
return buttons;
|
|
127
|
+
};
|
|
128
|
+
//# sourceMappingURL=workspace-contextmenu-options.js.map
|
|
@@ -1,5 +1,51 @@
|
|
|
1
|
-
var __decorate=this&&this.__decorate
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, html } from "lit";
|
|
8
|
+
import { customElement, property, query } from "lit/decorators.js";
|
|
9
|
+
import { PickerStyle } from "../styles/picker-styles";
|
|
10
|
+
let WritableDropdown = class WritableDropdown extends LitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.options = [];
|
|
14
|
+
}
|
|
15
|
+
static get styles() {
|
|
16
|
+
return PickerStyle;
|
|
17
|
+
}
|
|
18
|
+
firstUpdated() {
|
|
19
|
+
if (this.options.length > 0 && !this.value) {
|
|
20
|
+
this.value = this.options[0].value;
|
|
21
|
+
}
|
|
22
|
+
this.selectElement.value = this.value;
|
|
23
|
+
}
|
|
24
|
+
shouldUpdate(_changedProperties) {
|
|
25
|
+
if (this.selectElement && _changedProperties.has("value")) {
|
|
26
|
+
this.selectElement.value = this.value;
|
|
27
|
+
}
|
|
28
|
+
return super.shouldUpdate(_changedProperties);
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
return html `
|
|
32
|
+
<select id="select-element" @change=${(e) => this.dispatchEvent(new Event("onchange", e))} @input=${(e) => { this.dispatchEvent(new InputEvent("oninput", e)); this.value = this.selectElement.value; }}>
|
|
33
|
+
${this.options.map((o) => html `<option value="${o.value}">${o.name}</option>`)}
|
|
34
|
+
</select>
|
|
35
|
+
`;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
__decorate([
|
|
39
|
+
property({ type: Object, reflect: true })
|
|
40
|
+
], WritableDropdown.prototype, "value", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
property({ type: Array })
|
|
43
|
+
], WritableDropdown.prototype, "options", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
query("#select-element")
|
|
46
|
+
], WritableDropdown.prototype, "selectElement", void 0);
|
|
47
|
+
WritableDropdown = __decorate([
|
|
48
|
+
customElement("writable-dropdown")
|
|
49
|
+
], WritableDropdown);
|
|
50
|
+
export { WritableDropdown };
|
|
51
|
+
//# sourceMappingURL=writable-dropdown.js.map
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
import{project
|
|
1
|
+
import { project } from "../components/flow-editor";
|
|
2
|
+
export const nodeConverter = {
|
|
3
|
+
fromAttribute: (value) => {
|
|
4
|
+
return project.nodes.find((n) => n.id === value);
|
|
5
|
+
},
|
|
6
|
+
toAttribute: (node) => {
|
|
7
|
+
return node.id;
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=node-converter.js.map
|
|
@@ -1 +1,19 @@
|
|
|
1
|
-
export{FlowEditor}from"./components/flow-editor";
|
|
1
|
+
export { FlowEditor } from "./components/flow-editor";
|
|
2
|
+
export { NodePanel } from "./components/node-panel";
|
|
3
|
+
export { EditorWorkspace } from "./components/editor-workspace";
|
|
4
|
+
export { TopBar } from "./components/top-bar";
|
|
5
|
+
export { NodeMenuItem } from "./components/node-menu-item";
|
|
6
|
+
export { SelectableElement } from "./components/selectable-element";
|
|
7
|
+
export { FlowNode } from "./components/flow-node";
|
|
8
|
+
export { FlowNodeSocket } from "./components/flow-node-socket";
|
|
9
|
+
export { ConnectionLine } from "./components/connection-line";
|
|
10
|
+
export { ConnectionContainer } from "./components/connection-container";
|
|
11
|
+
export { SelectionBox } from "./components/selection-box";
|
|
12
|
+
export { ContextMenu } from "./components/context-menu";
|
|
13
|
+
export { InternalPicker } from "./components/internal-picker";
|
|
14
|
+
export { PopupModal } from "./components/popup-modal";
|
|
15
|
+
export { RuleBrowser } from "./components/rule-browser";
|
|
16
|
+
export { WritableDropdown } from "./components/writable-dropdown";
|
|
17
|
+
export { ConfirmationDialog } from "./components/confirmation-dialog";
|
|
18
|
+
export { NotificationDialog } from "./components/notification-dialog";
|
|
19
|
+
//# sourceMappingURL=flow-viewer.js.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=camera.js.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=context-menu-button.js.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=light-node-collection.js.map
|