@openremote/or-rules 1.8.0-snapshot.20250725120001 → 1.8.0-snapshot.20250725123024
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 +24 -61
- package/lib/flow-viewer/components/connection-container.js +1 -35
- package/lib/flow-viewer/components/connection-line.js +28 -117
- package/lib/flow-viewer/components/context-menu.js +45 -140
- package/lib/flow-viewer/components/editor-workspace.js +20 -282
- package/lib/flow-viewer/components/flow-editor.js +47 -160
- package/lib/flow-viewer/components/flow-node-socket.js +31 -146
- package/lib/flow-viewer/components/flow-node.js +29 -192
- package/lib/flow-viewer/components/internal-picker.js +54 -271
- package/lib/flow-viewer/components/node-menu-item.js +32 -132
- package/lib/flow-viewer/components/node-panel.js +60 -104
- package/lib/flow-viewer/components/notification-dialog.js +23 -55
- package/lib/flow-viewer/components/popup-modal.js +54 -113
- package/lib/flow-viewer/components/rule-browser.js +30 -119
- package/lib/flow-viewer/components/selectable-element.js +1 -71
- package/lib/flow-viewer/components/selection-box.js +15 -119
- package/lib/flow-viewer/components/top-bar.js +49 -116
- package/lib/flow-viewer/components/workspace-contextmenu-options.js +5 -128
- package/lib/flow-viewer/components/writable-dropdown.js +5 -51
- package/lib/flow-viewer/converters/node-converter.js +1 -10
- package/lib/flow-viewer/flow-viewer.js +1 -19
- package/lib/flow-viewer/models/camera.js +1 -2
- package/lib/flow-viewer/models/context-menu-button.js +1 -2
- package/lib/flow-viewer/models/light-node-collection.js +1 -2
- package/lib/flow-viewer/models/status.js +1 -8
- package/lib/flow-viewer/node-structure/copy.machine.js +1 -34
- package/lib/flow-viewer/node-structure/identity.assigner.js +1 -10
- package/lib/flow-viewer/node-structure/identity.dom.link.js +1 -4
- package/lib/flow-viewer/node-structure/index.js +1 -5
- package/lib/flow-viewer/node-structure/socket.type.matcher.js +1 -50
- package/lib/flow-viewer/node-structure/utils.js +1 -109
- package/lib/flow-viewer/services/copy-paste-manager.js +1 -59
- package/lib/flow-viewer/services/exporter.js +1 -67
- package/lib/flow-viewer/services/input.js +1 -80
- package/lib/flow-viewer/services/integration.js +1 -27
- package/lib/flow-viewer/services/modal.js +8 -29
- package/lib/flow-viewer/services/project.js +1 -222
- package/lib/flow-viewer/services/shortcuts.js +1 -63
- package/lib/flow-viewer/styles/editor-workspace-style.js +53 -55
- package/lib/flow-viewer/styles/flow-node-style.js +93 -95
- package/lib/flow-viewer/styles/picker-styles.js +29 -31
- package/lib/flow-viewer/utils.js +1 -49
- package/lib/index.js +56 -953
- package/lib/json-viewer/forms/or-rule-form-alarm.js +18 -91
- package/lib/json-viewer/forms/or-rule-form-email-message.js +12 -51
- package/lib/json-viewer/forms/or-rule-form-localized.js +43 -269
- package/lib/json-viewer/forms/or-rule-form-push-notification.js +63 -152
- package/lib/json-viewer/forms/or-rule-form-webhook.js +101 -296
- package/lib/json-viewer/modals/or-rule-alarm-modal.js +17 -173
- package/lib/json-viewer/modals/or-rule-notification-modal.js +11 -196
- package/lib/json-viewer/modals/or-rule-radial-modal.js +17 -142
- package/lib/json-viewer/modals/or-rule-webhook-modal.js +8 -78
- package/lib/json-viewer/or-rule-action-alarm.js +5 -97
- package/lib/json-viewer/or-rule-action-attribute.js +33 -235
- package/lib/json-viewer/or-rule-action-notification.js +56 -465
- package/lib/json-viewer/or-rule-action-webhook.js +18 -49
- package/lib/json-viewer/or-rule-asset-query.js +126 -849
- package/lib/json-viewer/or-rule-condition.js +29 -216
- package/lib/json-viewer/or-rule-json-viewer.js +34 -393
- package/lib/json-viewer/or-rule-then-otherwise.js +113 -609
- package/lib/json-viewer/or-rule-trigger-query.js +57 -227
- package/lib/json-viewer/or-rule-when.js +126 -343
- package/lib/or-rule-group-viewer.js +12 -106
- package/lib/or-rule-text-viewer.js +22 -133
- package/lib/or-rule-tree.js +57 -601
- package/lib/or-rule-validity.js +62 -373
- package/lib/or-rule-viewer.js +81 -361
- package/lib/style.js +64 -89
- package/package.json +11 -11
|
@@ -1,227 +1,57 @@
|
|
|
1
|
-
var __decorate
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
updated(changedProperties) {
|
|
59
|
-
if (changedProperties.has('condition')) {
|
|
60
|
-
if (this.condition.cron) {
|
|
61
|
-
this.selectedTrigger = { key: TimeTriggerType.TIME_OF_DAY, value: this.triggerToString(TimeTriggerType.TIME_OF_DAY) };
|
|
62
|
-
}
|
|
63
|
-
else if (this.condition.sun) {
|
|
64
|
-
this.selectedTrigger = { key: this.condition.sun.position, value: this.triggerToString(this.condition.sun.position) };
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
/* ---------------------- */
|
|
69
|
-
initMap() {
|
|
70
|
-
const modal = this.shadowRoot.getElementById('map-modal');
|
|
71
|
-
if (!modal)
|
|
72
|
-
return;
|
|
73
|
-
const map = modal.shadowRoot.querySelector('.or-map');
|
|
74
|
-
if (map) {
|
|
75
|
-
map.addEventListener(OrMapClickedEvent.NAME, (evt) => {
|
|
76
|
-
const lngLat = evt.detail.lngLat;
|
|
77
|
-
this.setLocation({ type: 'Point', coordinates: [lngLat.lat, lngLat.lng] });
|
|
78
|
-
const latElement = modal.shadowRoot.querySelector('.location-lat');
|
|
79
|
-
const lngElement = modal.shadowRoot.querySelector('.location-lng');
|
|
80
|
-
latElement.value = lngLat.lat;
|
|
81
|
-
lngElement.value = lngLat.lng;
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
renderDialogHTML(point) {
|
|
86
|
-
const dialog = this.shadowRoot.getElementById("map-modal");
|
|
87
|
-
if (dialog) {
|
|
88
|
-
dialog.content = html `
|
|
89
|
-
<div style="display:grid">
|
|
90
|
-
<or-map class="or-map" type="VECTOR" style="border: 1px solid #d5d5d5; height: 400px; min-width: 300px; margin-bottom: 20px;">
|
|
91
|
-
${(point && point.coordinates) ? html `
|
|
92
|
-
<or-map-marker class="or-map-marker" active color="#FF0000" icon="white-balance-sunny" lat="${point.coordinates[0]}" lng="${point.coordinates[1]}"></or-map-marker>
|
|
93
|
-
` : undefined}
|
|
94
|
-
</or-map>
|
|
95
|
-
<div class="layout horizontal">
|
|
96
|
-
<input hidden class="location-lng" required placeholder=" " type="text" .value="${point && point.coordinates ? point.coordinates[0] : null}" />
|
|
97
|
-
<input hidden class="location-lat" required placeholder=" " type="text" .value="${point && point.coordinates ? point.coordinates[1] : null}" />
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
100
|
-
`;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
/* ----------------------------- */
|
|
104
|
-
render() {
|
|
105
|
-
var _a, _b;
|
|
106
|
-
const modalActions = [
|
|
107
|
-
{ actionName: "close", default: true, content: html `<or-mwc-input class="button" .type="${InputType.BUTTON}" label="close"></or-mwc-input>`, action: () => { } }
|
|
108
|
-
];
|
|
109
|
-
const onMapModalOpen = () => {
|
|
110
|
-
var _a;
|
|
111
|
-
const dialog = this.shadowRoot.getElementById("map-modal");
|
|
112
|
-
if (dialog) {
|
|
113
|
-
dialog.dismissAction = null;
|
|
114
|
-
dialog.open();
|
|
115
|
-
this.renderDialogHTML((_a = this.condition.sun) === null || _a === void 0 ? void 0 : _a.location);
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
// Render dialog on every update (for example when changing location in the modal itself)
|
|
119
|
-
this.renderDialogHTML((_a = this.condition.sun) === null || _a === void 0 ? void 0 : _a.location);
|
|
120
|
-
return html `
|
|
121
|
-
<div class="trigger-group">
|
|
122
|
-
<or-mwc-input class="min-width" type="${InputType.SELECT}" .options="${this.triggerOptions.map((t) => t.value)}" .value="${this.selectedTrigger.value}" label="${i18next.t('triggerType')}"
|
|
123
|
-
@or-mwc-input-changed="${(ev) => { this.setTrigger(this.triggerOptions.find((t) => t.value == ev.detail.value)); }}">
|
|
124
|
-
</or-mwc-input>
|
|
125
|
-
${this.selectedTrigger ? html `
|
|
126
|
-
${this.selectedTrigger.key == this.triggerOptions[0].key ? html `
|
|
127
|
-
<or-mwc-input class="min-width" type="${InputType.TIME}" .value="${(this.condition.cron ? moment(Util.cronStringToISOString(this.condition.cron, true)).format('HH:mm') : undefined)}" label="${i18next.t('timeOfDay')}"
|
|
128
|
-
@or-mwc-input-changed="${(ev) => { this.setTime(ev.detail.value); }}">
|
|
129
|
-
</or-mwc-input>
|
|
130
|
-
` : html `
|
|
131
|
-
<or-mwc-input class="min-width width" type="${InputType.NUMBER}" .value="${(_b = this.condition.sun) === null || _b === void 0 ? void 0 : _b.offsetMins}" label="${i18next.t('offsetInMinutes')}"
|
|
132
|
-
@or-mwc-input-changed="${(ev) => { this.setOffset(ev.detail.value); }}">
|
|
133
|
-
</or-mwc-input>
|
|
134
|
-
<or-mwc-input type="${InputType.BUTTON}" class="min-width" @or-mwc-input-changed="${onMapModalOpen}" label="location"></or-mwc-input>
|
|
135
|
-
<or-mwc-dialog id="map-modal" heading="${i18next.t('pickLocation')}" .actions="${modalActions}"></or-mwc-dialog>
|
|
136
|
-
`}
|
|
137
|
-
` : undefined}
|
|
138
|
-
</div>
|
|
139
|
-
`;
|
|
140
|
-
}
|
|
141
|
-
/* ---------------------------------------------------- */
|
|
142
|
-
// Getters/setters of the file
|
|
143
|
-
setTrigger(trigger) {
|
|
144
|
-
if (trigger) {
|
|
145
|
-
if (trigger.key == TimeTriggerType.TIME_OF_DAY) {
|
|
146
|
-
this.condition.sun = undefined;
|
|
147
|
-
}
|
|
148
|
-
else if (this.getSunPositions().includes(trigger.key)) {
|
|
149
|
-
this.condition.cron = undefined;
|
|
150
|
-
if (this.getSunPositions().includes(this.selectedTrigger.key)) {
|
|
151
|
-
this.condition.sun = { position: trigger.key, offsetMins: this.condition.sun.offsetMins, location: this.condition.sun.location };
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
this.condition.sun = { position: trigger.key, offsetMins: 0 };
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
this.selectedTrigger = trigger;
|
|
158
|
-
this.dispatchEvent(new OrRulesJsonRuleChangedEvent());
|
|
159
|
-
this.requestUpdate();
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
setTime(time) {
|
|
163
|
-
if (time) {
|
|
164
|
-
const splittedTime = time.split(':');
|
|
165
|
-
const date = new Date();
|
|
166
|
-
date.setHours(Number(splittedTime[0]));
|
|
167
|
-
date.setMinutes(Number(splittedTime[1]));
|
|
168
|
-
this.condition.cron = Util.formatCronString(undefined, undefined, undefined, date.getUTCHours().toString(), date.getUTCMinutes().toString());
|
|
169
|
-
this.dispatchEvent(new OrRulesJsonRuleChangedEvent());
|
|
170
|
-
this.requestUpdate();
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
setOffset(offset) {
|
|
174
|
-
var _a, _b;
|
|
175
|
-
this.condition.sun = {
|
|
176
|
-
position: (_a = this.condition.sun) === null || _a === void 0 ? void 0 : _a.position,
|
|
177
|
-
location: (_b = this.condition.sun) === null || _b === void 0 ? void 0 : _b.location,
|
|
178
|
-
offsetMins: offset
|
|
179
|
-
};
|
|
180
|
-
this.dispatchEvent(new OrRulesJsonRuleChangedEvent());
|
|
181
|
-
this.requestUpdate();
|
|
182
|
-
}
|
|
183
|
-
setLocation(point) {
|
|
184
|
-
var _a, _b;
|
|
185
|
-
this.condition.sun = {
|
|
186
|
-
position: (_a = this.condition.sun) === null || _a === void 0 ? void 0 : _a.position,
|
|
187
|
-
location: point,
|
|
188
|
-
offsetMins: (_b = this.condition.sun) === null || _b === void 0 ? void 0 : _b.offsetMins
|
|
189
|
-
};
|
|
190
|
-
this.dispatchEvent(new OrRulesJsonRuleChangedEvent());
|
|
191
|
-
this.requestUpdate();
|
|
192
|
-
}
|
|
193
|
-
getSunPositions() {
|
|
194
|
-
return [
|
|
195
|
-
"TWILIGHT_MORNING_CIVIL" /* SunPositionTriggerPosition.TWILIGHT_MORNING_CIVIL */,
|
|
196
|
-
"SUNRISE" /* SunPositionTriggerPosition.SUNRISE */, "SUNSET" /* SunPositionTriggerPosition.SUNSET */,
|
|
197
|
-
"TWILIGHT_EVENING_CIVIL" /* SunPositionTriggerPosition.TWILIGHT_EVENING_CIVIL */
|
|
198
|
-
];
|
|
199
|
-
}
|
|
200
|
-
/* --------------------------------- */
|
|
201
|
-
// Utility stuff
|
|
202
|
-
triggerToString(position) {
|
|
203
|
-
if (position == TimeTriggerType.TIME_OF_DAY) {
|
|
204
|
-
return i18next.t("timeOfDay");
|
|
205
|
-
}
|
|
206
|
-
else {
|
|
207
|
-
return i18next.t(position.toLowerCase());
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
__decorate([
|
|
212
|
-
property({ type: Object, attribute: false })
|
|
213
|
-
], OrRuleTriggerQuery.prototype, "condition", void 0);
|
|
214
|
-
__decorate([
|
|
215
|
-
property()
|
|
216
|
-
], OrRuleTriggerQuery.prototype, "readonly", void 0);
|
|
217
|
-
__decorate([
|
|
218
|
-
state()
|
|
219
|
-
], OrRuleTriggerQuery.prototype, "selectedTrigger", void 0);
|
|
220
|
-
__decorate([
|
|
221
|
-
state()
|
|
222
|
-
], OrRuleTriggerQuery.prototype, "triggerOptions", void 0);
|
|
223
|
-
OrRuleTriggerQuery = __decorate([
|
|
224
|
-
customElement("or-rule-trigger-query")
|
|
225
|
-
], OrRuleTriggerQuery);
|
|
226
|
-
export { OrRuleTriggerQuery };
|
|
227
|
-
//# sourceMappingURL=or-rule-trigger-query.js.map
|
|
1
|
+
var __decorate=this&&this.__decorate||function(t,e,i,o){var r,n=arguments.length,s=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,o);else for(var l=t.length-1;l>=0;l--)(r=t[l])&&(s=(n<3?r(s):n>3?r(e,i,s):r(e,i))||s);return n>3&&s&&Object.defineProperty(e,i,s),s};import{InputType as t}from"@openremote/or-mwc-components/or-mwc-input";import{css as e,html as i,LitElement as o}from"lit";import{customElement as r,property as n,state as s}from"lit/decorators.js";import l from"moment";import{buttonStyle as a}from"../style";import{OrRulesJsonRuleChangedEvent as d}from"./or-rule-json-viewer";import{TimeTriggerType as c}from"../index";import{Util as p}from"@openremote/core";import{OrMwcDialogOpenedEvent as u}from"@openremote/or-mwc-components/or-mwc-dialog";import{OrMapClickedEvent as g}from"@openremote/or-map";import{i18next as h}from"@openremote/or-translate";let style=e`
|
|
2
|
+
|
|
3
|
+
${a}
|
|
4
|
+
|
|
5
|
+
:host {
|
|
6
|
+
display: block;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.trigger-group {
|
|
10
|
+
flex-grow: 1;
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
flex-direction: row;
|
|
14
|
+
flex-wrap: wrap;
|
|
15
|
+
}
|
|
16
|
+
.min-width {
|
|
17
|
+
min-width: 200px;
|
|
18
|
+
}
|
|
19
|
+
.width {
|
|
20
|
+
width: 200px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.trigger-group > * {
|
|
24
|
+
margin: 10px 3px 6px 3px;
|
|
25
|
+
}
|
|
26
|
+
`,OrRuleTriggerQuery=class extends o{static get styles(){return style}constructor(){super(),this.readonly=!1,this.triggerOptions=[],Object.values(c).forEach(t=>{this.triggerOptions.push({key:t,value:this.triggerToString(t)})}),this.getSunPositions().forEach(t=>{this.triggerOptions.push({key:t,value:this.triggerToString(t)})}),this.selectedTrigger=this.triggerOptions[0],this.addEventListener(u.NAME,this.initMap)}updated(t){t.has("condition")&&(this.condition.cron?this.selectedTrigger={key:c.TIME_OF_DAY,value:this.triggerToString(c.TIME_OF_DAY)}:this.condition.sun&&(this.selectedTrigger={key:this.condition.sun.position,value:this.triggerToString(this.condition.sun.position)}))}initMap(){let t=this.shadowRoot.getElementById("map-modal");if(!t)return;let e=t.shadowRoot.querySelector(".or-map");e&&e.addEventListener(g.NAME,e=>{let i=e.detail.lngLat;this.setLocation({type:"Point",coordinates:[i.lat,i.lng]});let o=t.shadowRoot.querySelector(".location-lat"),r=t.shadowRoot.querySelector(".location-lng");o.value=i.lat,r.value=i.lng})}renderDialogHTML(t){let e=this.shadowRoot.getElementById("map-modal");e&&(e.content=i`
|
|
27
|
+
<div style="display:grid">
|
|
28
|
+
<or-map class="or-map" type="VECTOR" style="border: 1px solid #d5d5d5; height: 400px; min-width: 300px; margin-bottom: 20px;">
|
|
29
|
+
${t&&t.coordinates?i`
|
|
30
|
+
<or-map-marker class="or-map-marker" active color="#FF0000" icon="white-balance-sunny" lat="${t.coordinates[0]}" lng="${t.coordinates[1]}"></or-map-marker>
|
|
31
|
+
`:void 0}
|
|
32
|
+
</or-map>
|
|
33
|
+
<div class="layout horizontal">
|
|
34
|
+
<input hidden class="location-lng" required placeholder=" " type="text" .value="${t&&t.coordinates?t.coordinates[0]:null}" />
|
|
35
|
+
<input hidden class="location-lat" required placeholder=" " type="text" .value="${t&&t.coordinates?t.coordinates[1]:null}" />
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
`)}render(){var e,o;let r=[{actionName:"close",default:!0,content:i`<or-mwc-input class="button" .type="${t.BUTTON}" label="close"></or-mwc-input>`,action:()=>{}}];return this.renderDialogHTML(null==(e=this.condition.sun)?void 0:e.location),i`
|
|
39
|
+
<div class="trigger-group">
|
|
40
|
+
<or-mwc-input class="min-width" type="${t.SELECT}" .options="${this.triggerOptions.map(t=>t.value)}" .value="${this.selectedTrigger.value}" label="${h.t("triggerType")}"
|
|
41
|
+
@or-mwc-input-changed="${t=>{this.setTrigger(this.triggerOptions.find(e=>e.value==t.detail.value))}}">
|
|
42
|
+
</or-mwc-input>
|
|
43
|
+
${this.selectedTrigger?i`
|
|
44
|
+
${this.selectedTrigger.key==this.triggerOptions[0].key?i`
|
|
45
|
+
<or-mwc-input class="min-width" type="${t.TIME}" .value="${this.condition.cron?l(p.cronStringToISOString(this.condition.cron,!0)).format("HH:mm"):void 0}" label="${h.t("timeOfDay")}"
|
|
46
|
+
@or-mwc-input-changed="${t=>{this.setTime(t.detail.value)}}">
|
|
47
|
+
</or-mwc-input>
|
|
48
|
+
`:i`
|
|
49
|
+
<or-mwc-input class="min-width width" type="${t.NUMBER}" .value="${null==(o=this.condition.sun)?void 0:o.offsetMins}" label="${h.t("offsetInMinutes")}"
|
|
50
|
+
@or-mwc-input-changed="${t=>{this.setOffset(t.detail.value)}}">
|
|
51
|
+
</or-mwc-input>
|
|
52
|
+
<or-mwc-input type="${t.BUTTON}" class="min-width" @or-mwc-input-changed="${()=>{var t;let e=this.shadowRoot.getElementById("map-modal");e&&(e.dismissAction=null,e.open(),this.renderDialogHTML(null==(t=this.condition.sun)?void 0:t.location))}}" label="location"></or-mwc-input>
|
|
53
|
+
<or-mwc-dialog id="map-modal" heading="${h.t("pickLocation")}" .actions="${r}"></or-mwc-dialog>
|
|
54
|
+
`}
|
|
55
|
+
`:void 0}
|
|
56
|
+
</div>
|
|
57
|
+
`}setTrigger(t){t&&(t.key==c.TIME_OF_DAY?this.condition.sun=void 0:this.getSunPositions().includes(t.key)&&(this.condition.cron=void 0,this.getSunPositions().includes(this.selectedTrigger.key)?this.condition.sun={position:t.key,offsetMins:this.condition.sun.offsetMins,location:this.condition.sun.location}:this.condition.sun={position:t.key,offsetMins:0}),this.selectedTrigger=t,this.dispatchEvent(new d),this.requestUpdate())}setTime(t){if(t){let e=t.split(":"),i=new Date;i.setHours(Number(e[0])),i.setMinutes(Number(e[1])),this.condition.cron=p.formatCronString(void 0,void 0,void 0,i.getUTCHours().toString(),i.getUTCMinutes().toString()),this.dispatchEvent(new d),this.requestUpdate()}}setOffset(t){var e,i;this.condition.sun={position:null==(e=this.condition.sun)?void 0:e.position,location:null==(i=this.condition.sun)?void 0:i.location,offsetMins:t},this.dispatchEvent(new d),this.requestUpdate()}setLocation(t){var e,i;this.condition.sun={position:null==(e=this.condition.sun)?void 0:e.position,location:t,offsetMins:null==(i=this.condition.sun)?void 0:i.offsetMins},this.dispatchEvent(new d),this.requestUpdate()}getSunPositions(){return["TWILIGHT_MORNING_CIVIL","SUNRISE","SUNSET","TWILIGHT_EVENING_CIVIL"]}triggerToString(t){return t==c.TIME_OF_DAY?h.t("timeOfDay"):h.t(t.toLowerCase())}};__decorate([n({type:Object,attribute:!1})],OrRuleTriggerQuery.prototype,"condition",void 0),__decorate([n()],OrRuleTriggerQuery.prototype,"readonly",void 0),__decorate([s()],OrRuleTriggerQuery.prototype,"selectedTrigger",void 0),__decorate([s()],OrRuleTriggerQuery.prototype,"triggerOptions",void 0),OrRuleTriggerQuery=__decorate([r("or-rule-trigger-query")],OrRuleTriggerQuery);export{OrRuleTriggerQuery};
|