@openremote/or-rules 1.8.0-snapshot.20250725074716 → 1.8.0-snapshot.20250725120001

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.
Files changed (73) hide show
  1. package/README.md +30 -30
  2. package/custom-elements.json +13 -13
  3. package/dist/umd/index.bundle.js +4744 -4744
  4. package/dist/umd/index.bundle.js.map +1 -1
  5. package/lib/flow-viewer/components/confirmation-dialog.js +61 -24
  6. package/lib/flow-viewer/components/connection-container.js +35 -1
  7. package/lib/flow-viewer/components/connection-line.js +117 -28
  8. package/lib/flow-viewer/components/context-menu.js +140 -45
  9. package/lib/flow-viewer/components/editor-workspace.js +282 -20
  10. package/lib/flow-viewer/components/flow-editor.js +160 -47
  11. package/lib/flow-viewer/components/flow-node-socket.js +146 -31
  12. package/lib/flow-viewer/components/flow-node.js +192 -29
  13. package/lib/flow-viewer/components/internal-picker.js +271 -54
  14. package/lib/flow-viewer/components/node-menu-item.js +132 -32
  15. package/lib/flow-viewer/components/node-panel.js +104 -60
  16. package/lib/flow-viewer/components/notification-dialog.js +55 -23
  17. package/lib/flow-viewer/components/popup-modal.js +113 -54
  18. package/lib/flow-viewer/components/rule-browser.js +119 -30
  19. package/lib/flow-viewer/components/selectable-element.js +71 -1
  20. package/lib/flow-viewer/components/selection-box.js +119 -15
  21. package/lib/flow-viewer/components/top-bar.js +116 -49
  22. package/lib/flow-viewer/components/workspace-contextmenu-options.js +128 -5
  23. package/lib/flow-viewer/components/writable-dropdown.js +51 -5
  24. package/lib/flow-viewer/converters/node-converter.js +10 -1
  25. package/lib/flow-viewer/flow-viewer.js +19 -1
  26. package/lib/flow-viewer/models/camera.js +2 -1
  27. package/lib/flow-viewer/models/context-menu-button.js +2 -1
  28. package/lib/flow-viewer/models/light-node-collection.js +2 -1
  29. package/lib/flow-viewer/models/status.js +8 -1
  30. package/lib/flow-viewer/node-structure/copy.machine.js +34 -1
  31. package/lib/flow-viewer/node-structure/identity.assigner.js +10 -1
  32. package/lib/flow-viewer/node-structure/identity.dom.link.js +4 -1
  33. package/lib/flow-viewer/node-structure/index.js +5 -1
  34. package/lib/flow-viewer/node-structure/socket.type.matcher.js +50 -1
  35. package/lib/flow-viewer/node-structure/utils.js +109 -1
  36. package/lib/flow-viewer/services/copy-paste-manager.js +59 -1
  37. package/lib/flow-viewer/services/exporter.js +67 -1
  38. package/lib/flow-viewer/services/input.js +80 -1
  39. package/lib/flow-viewer/services/integration.js +27 -1
  40. package/lib/flow-viewer/services/modal.js +29 -8
  41. package/lib/flow-viewer/services/project.js +222 -1
  42. package/lib/flow-viewer/services/shortcuts.js +63 -1
  43. package/lib/flow-viewer/styles/editor-workspace-style.js +55 -53
  44. package/lib/flow-viewer/styles/flow-node-style.js +95 -93
  45. package/lib/flow-viewer/styles/picker-styles.js +31 -29
  46. package/lib/flow-viewer/utils.js +49 -1
  47. package/lib/index.js +953 -56
  48. package/lib/json-viewer/forms/or-rule-form-alarm.js +91 -18
  49. package/lib/json-viewer/forms/or-rule-form-email-message.js +51 -12
  50. package/lib/json-viewer/forms/or-rule-form-localized.js +269 -43
  51. package/lib/json-viewer/forms/or-rule-form-push-notification.js +152 -63
  52. package/lib/json-viewer/forms/or-rule-form-webhook.js +296 -101
  53. package/lib/json-viewer/modals/or-rule-alarm-modal.js +173 -17
  54. package/lib/json-viewer/modals/or-rule-notification-modal.js +196 -11
  55. package/lib/json-viewer/modals/or-rule-radial-modal.js +142 -17
  56. package/lib/json-viewer/modals/or-rule-webhook-modal.js +78 -8
  57. package/lib/json-viewer/or-rule-action-alarm.js +97 -5
  58. package/lib/json-viewer/or-rule-action-attribute.js +235 -33
  59. package/lib/json-viewer/or-rule-action-notification.js +465 -56
  60. package/lib/json-viewer/or-rule-action-webhook.js +49 -18
  61. package/lib/json-viewer/or-rule-asset-query.js +849 -126
  62. package/lib/json-viewer/or-rule-condition.js +216 -29
  63. package/lib/json-viewer/or-rule-json-viewer.js +393 -34
  64. package/lib/json-viewer/or-rule-then-otherwise.js +609 -113
  65. package/lib/json-viewer/or-rule-trigger-query.js +227 -57
  66. package/lib/json-viewer/or-rule-when.js +343 -126
  67. package/lib/or-rule-group-viewer.js +106 -12
  68. package/lib/or-rule-text-viewer.js +133 -22
  69. package/lib/or-rule-tree.js +601 -57
  70. package/lib/or-rule-validity.js +373 -62
  71. package/lib/or-rule-viewer.js +361 -81
  72. package/lib/style.js +89 -64
  73. package/package.json +11 -11
@@ -1,63 +1,152 @@
1
- var __decorate=this&&this.__decorate||function(t,e,o,n){var i,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var l=t.length-1;l>=0;l--)(i=t[l])&&(a=(r<3?i(a):r>3?i(e,o,a):i(e,o))||a);return r>3&&a&&Object.defineProperty(e,o,a),a},__awaiter=this&&this.__awaiter||function(t,e,o,n){return new(o||(o=Promise))(function(i,r){function a(t){try{c(n.next(t))}catch(t){r(t)}}function l(t){try{c(n.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):((e=t.value)instanceof o?e:new o(function(t){t(e)})).then(a,l)}c((n=n.apply(t,e||[])).next())})};import{html as t,LitElement as e,css as o}from"lit";import{customElement as n,property as i}from"lit/decorators.js";import"@openremote/or-mwc-components/or-mwc-input";import r from"i18next";import{translate as a}from"@openremote/or-translate";import{InputType as l}from"@openremote/or-mwc-components/or-mwc-input";import{OrRulesJsonRuleChangedEvent as c}from"../or-rule-json-viewer";import{until as u}from"lit/directives/until.js";import{when as s}from"lit/directives/when.js";let OrRuleFormPushNotification=class extends a(r)(e){static get styles(){return o`
2
- .input-small {
3
- min-width: auto;
4
- }
5
-
6
- or-mwc-input {
7
- margin-bottom: 20px;
8
- min-width: 420px;
9
- width: 100%;
10
- }
11
-
12
- .divider {
13
- margin-bottom: 20px;
14
- border-top: 1px solid rgba(0, 0, 0, 12%);
15
- }
16
- `}render(){return t`
17
- ${s(this.message,()=>u(this._getPushNotificationForm(this.message),t`Loading...`),()=>t`<or-translate value="errorOccurred"></or-translate>`)}
18
- `}_getPushNotificationForm(e){return __awaiter(this,arguments,void 0,function*(e,o=(t,e)=>__awaiter(this,void 0,void 0,function*(){return e})){var n,i,a,c,u,s;return t`
19
- <form style="display:grid">
20
- <or-mwc-input .value="${e.title}"
21
- @or-mwc-input-changed="${t=>o(t,e).then(e=>this._onTitleChange(t,e))}"
22
- .label="${r.t("subject")}"
23
- type="${l.TEXT}"
24
- required
25
- placeholder=" "></or-mwc-input>
26
-
27
- <or-mwc-input .value="${e.body}"
28
- @or-mwc-input-changed="${t=>o(t,e).then(e=>this._onBodyChange(t,e))}"
29
- .label="${r.t("message")}"
30
- type="${l.TEXTAREA}"
31
- required
32
- placeholder=" "></or-mwc-input>
33
- <or-mwc-input .value="${null==(n=e.action)?void 0:n.url}"
34
- @or-mwc-input-changed="${t=>o(t,e).then(e=>this._onActionUrlChange(t,e))}"
35
- .label="${r.t("openWebsiteUrl")}"
36
- type="${l.TEXT}"
37
- placeholder=" "></or-mwc-input>
38
-
39
- <!-- Open in browser switch -->
40
- <or-mwc-input .value="${null==(i=e.action)?void 0:i.openInBrowser}"
41
- @or-mwc-input-changed="${t=>o(t,e).then(e=>this._onOpenInBrowserChange(t,e))}"
42
- .label="${r.t("openInBrowser")}"
43
- type="${l.SWITCH}"
44
- fullWidth
45
- placeholder=" "></or-mwc-input>
46
-
47
- <!-- Button controls -->
48
- <div style="display: flex; gap: 20px;">
49
- <or-mwc-input .value="${null==(c=null==(a=e.buttons)?void 0:a[0])?void 0:c.title}"
50
- @or-mwc-input-changed="${t=>o(t,e).then(e=>this._onButtonTitleChange(t,0,e))}"
51
- .label="${r.t("buttonTextConfirm")}"
52
- type="${l.TEXT}"
53
- class="input-small"
54
- placeholder=" "></or-mwc-input>
55
- <or-mwc-input .value="${null==(s=null==(u=e.buttons)?void 0:u[1])?void 0:s.title}"
56
- @or-mwc-input-changed="${t=>o(t,e).then(e=>this._onButtonTitleChange(t,1,e))}"
57
- .label="${r.t("buttonTextDecline")}"
58
- type="${l.TEXT}"
59
- class="input-small"
60
- placeholder=" "></or-mwc-input>
61
- </div>
62
- </form>
63
- `})}_onTitleChange(t,e){e.title=t.detail.value,this.dispatchEvent(new c)}_onBodyChange(t,e){e.body=t.detail.value,this.dispatchEvent(new c)}_onActionUrlChange(t,e){e.action=e.action||{},e.action.url=t.detail.value,this.dispatchEvent(new c)}_onOpenInBrowserChange(t,e){e.action=e.action||{},e.action.openInBrowser=t.detail.value,this.dispatchEvent(new c)}_onButtonTitleChange(t,e,o){o.buttons=o.buttons||[],o.buttons[e]={title:t.detail.value},this.dispatchEvent(new c)}};__decorate([i({type:Object})],OrRuleFormPushNotification.prototype,"message",void 0),OrRuleFormPushNotification=__decorate([n("or-rule-form-push-notification")],OrRuleFormPushNotification);export{OrRuleFormPushNotification};
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
8
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
9
+ return new (P || (P = Promise))(function (resolve, reject) {
10
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
12
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
13
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
14
+ });
15
+ };
16
+ import { html, LitElement, css } from "lit";
17
+ import { customElement, property } from "lit/decorators.js";
18
+ import "@openremote/or-mwc-components/or-mwc-input";
19
+ import i18next from "i18next";
20
+ import { translate } from "@openremote/or-translate";
21
+ import { InputType } from "@openremote/or-mwc-components/or-mwc-input";
22
+ import { OrRulesJsonRuleChangedEvent } from "../or-rule-json-viewer";
23
+ import { until } from "lit/directives/until.js";
24
+ import { when } from "lit/directives/when.js";
25
+ let OrRuleFormPushNotification = class OrRuleFormPushNotification extends translate(i18next)(LitElement) {
26
+ static get styles() {
27
+ return css `
28
+ .input-small {
29
+ min-width: auto;
30
+ }
31
+
32
+ or-mwc-input {
33
+ margin-bottom: 20px;
34
+ min-width: 420px;
35
+ width: 100%;
36
+ }
37
+
38
+ .divider {
39
+ margin-bottom: 20px;
40
+ border-top: 1px solid rgba(0, 0, 0, 12%);
41
+ }
42
+ `;
43
+ }
44
+ render() {
45
+ return html `
46
+ ${when(this.message, () => until(this._getPushNotificationForm(this.message), html `Loading...`), () => html `<or-translate value="errorOccurred"></or-translate>`)}
47
+ `;
48
+ }
49
+ /**
50
+ * Internal function that returns a form for configuring a {@link PushNotificationMessage}.
51
+ * {@link onchange} is a callback function can be used to process changes before they are applied.
52
+ */
53
+ _getPushNotificationForm(message_1) {
54
+ return __awaiter(this, arguments, void 0, function* (message, onchange = (_ev, msg) => __awaiter(this, void 0, void 0, function* () { return msg; })) {
55
+ var _a, _b, _c, _d, _e, _f;
56
+ return html `
57
+ <form style="display:grid">
58
+ <or-mwc-input .value="${message.title}"
59
+ @or-mwc-input-changed="${(ev) => onchange(ev, message).then(msg => this._onTitleChange(ev, msg))}"
60
+ .label="${i18next.t("subject")}"
61
+ type="${InputType.TEXT}"
62
+ required
63
+ placeholder=" "></or-mwc-input>
64
+
65
+ <or-mwc-input .value="${message.body}"
66
+ @or-mwc-input-changed="${(ev) => onchange(ev, message).then(msg => this._onBodyChange(ev, msg))}"
67
+ .label="${i18next.t("message")}"
68
+ type="${InputType.TEXTAREA}"
69
+ required
70
+ placeholder=" "></or-mwc-input>
71
+ <or-mwc-input .value="${(_a = message.action) === null || _a === void 0 ? void 0 : _a.url}"
72
+ @or-mwc-input-changed="${(ev) => onchange(ev, message).then(msg => this._onActionUrlChange(ev, msg))}"
73
+ .label="${i18next.t("openWebsiteUrl")}"
74
+ type="${InputType.TEXT}"
75
+ placeholder=" "></or-mwc-input>
76
+
77
+ <!-- Open in browser switch -->
78
+ <or-mwc-input .value="${(_b = message.action) === null || _b === void 0 ? void 0 : _b.openInBrowser}"
79
+ @or-mwc-input-changed="${(ev) => onchange(ev, message).then(msg => this._onOpenInBrowserChange(ev, msg))}"
80
+ .label="${i18next.t("openInBrowser")}"
81
+ type="${InputType.SWITCH}"
82
+ fullWidth
83
+ placeholder=" "></or-mwc-input>
84
+
85
+ <!-- Button controls -->
86
+ <div style="display: flex; gap: 20px;">
87
+ <or-mwc-input .value="${(_d = (_c = message.buttons) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.title}"
88
+ @or-mwc-input-changed="${(ev) => onchange(ev, message).then(msg => this._onButtonTitleChange(ev, 0, msg))}"
89
+ .label="${i18next.t("buttonTextConfirm")}"
90
+ type="${InputType.TEXT}"
91
+ class="input-small"
92
+ placeholder=" "></or-mwc-input>
93
+ <or-mwc-input .value="${(_f = (_e = message.buttons) === null || _e === void 0 ? void 0 : _e[1]) === null || _f === void 0 ? void 0 : _f.title}"
94
+ @or-mwc-input-changed="${(ev) => onchange(ev, message).then(msg => this._onButtonTitleChange(ev, 1, msg))}"
95
+ .label="${i18next.t("buttonTextDecline")}"
96
+ type="${InputType.TEXT}"
97
+ class="input-small"
98
+ placeholder=" "></or-mwc-input>
99
+ </div>
100
+ </form>
101
+ `;
102
+ });
103
+ }
104
+ /**
105
+ * HTML callback function when the subject of a notification message has changed.
106
+ */
107
+ _onTitleChange(ev, message) {
108
+ message.title = ev.detail.value;
109
+ this.dispatchEvent(new OrRulesJsonRuleChangedEvent());
110
+ }
111
+ /**
112
+ * HTML callback function when the body of a notification message has changed.
113
+ */
114
+ _onBodyChange(ev, message) {
115
+ message.body = ev.detail.value;
116
+ this.dispatchEvent(new OrRulesJsonRuleChangedEvent());
117
+ }
118
+ /**
119
+ * HTML callback function when the "click here to open URL" of a notification has changed.
120
+ */
121
+ _onActionUrlChange(ev, message) {
122
+ message.action = message.action || {};
123
+ message.action.url = ev.detail.value;
124
+ this.dispatchEvent(new OrRulesJsonRuleChangedEvent());
125
+ }
126
+ /**
127
+ * HTML callback function when the "open in browser switch" of a notification has changed.
128
+ */
129
+ _onOpenInBrowserChange(ev, message) {
130
+ message.action = message.action || {};
131
+ message.action.openInBrowser = ev.detail.value;
132
+ this.dispatchEvent(new OrRulesJsonRuleChangedEvent());
133
+ }
134
+ /**
135
+ * HTML callback function when any button text of the notification has changed.
136
+ */
137
+ _onButtonTitleChange(ev, key, message) {
138
+ message.buttons = message.buttons || [];
139
+ message.buttons[key] = {
140
+ title: ev.detail.value
141
+ };
142
+ this.dispatchEvent(new OrRulesJsonRuleChangedEvent());
143
+ }
144
+ };
145
+ __decorate([
146
+ property({ type: Object })
147
+ ], OrRuleFormPushNotification.prototype, "message", void 0);
148
+ OrRuleFormPushNotification = __decorate([
149
+ customElement("or-rule-form-push-notification")
150
+ ], OrRuleFormPushNotification);
151
+ export { OrRuleFormPushNotification };
152
+ //# sourceMappingURL=or-rule-form-push-notification.js.map