@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.
- 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
package/lib/or-rule-validity.js
CHANGED
|
@@ -1,67 +1,378 @@
|
|
|
1
|
-
var __decorate
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
+
/*
|
|
8
|
+
* Copyright 2025, OpenRemote Inc.
|
|
9
|
+
*
|
|
10
|
+
* See the CONTRIBUTORS.txt file in the distribution for a
|
|
11
|
+
* full listing of individual contributors.
|
|
12
|
+
*
|
|
13
|
+
* This program is free software: you can redistribute it and/or modify
|
|
14
|
+
* it under the terms of the GNU Affero General Public License as
|
|
15
|
+
* published by the Free Software Foundation, either version 3 of the
|
|
16
|
+
* License, or (at your option) any later version.
|
|
17
|
+
*
|
|
18
|
+
* This program is distributed in the hope that it will be useful,
|
|
19
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
21
|
+
* GNU Affero General Public License for more details.
|
|
22
|
+
*
|
|
23
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
24
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
25
|
+
*/
|
|
26
|
+
import { html, LitElement } from "lit";
|
|
27
|
+
import { customElement, property, query } from "lit/decorators.js";
|
|
28
|
+
import { OrRulesRuleChangedEvent } from "./index";
|
|
29
|
+
import "@openremote/or-mwc-components/or-mwc-input";
|
|
30
|
+
import { InputType } from "@openremote/or-mwc-components/or-mwc-input";
|
|
31
|
+
import i18next from "i18next";
|
|
32
|
+
import { translate } from "@openremote/or-translate";
|
|
33
|
+
import { OrMwcDialog, showDialog } from "@openremote/or-mwc-components/or-mwc-dialog";
|
|
34
|
+
import { RRule, Weekday } from 'rrule';
|
|
35
|
+
import moment from "moment";
|
|
36
|
+
let OrRuleValidity = class OrRuleValidity extends translate(i18next)(LitElement) {
|
|
37
|
+
constructor() {
|
|
38
|
+
super();
|
|
39
|
+
}
|
|
40
|
+
updated(changedProps) {
|
|
41
|
+
super.updated(changedProps);
|
|
42
|
+
if (changedProps.has("ruleset") && this.ruleset) {
|
|
43
|
+
this._validity = this.ruleset.meta ? this.ruleset.meta["validity"] : undefined;
|
|
44
|
+
if (this._validity && this._validity.recurrence) {
|
|
45
|
+
this._rrule = RRule.fromString(this._validity.recurrence);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
this._rrule = undefined;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
getWeekDay(weekday) {
|
|
53
|
+
switch (weekday) {
|
|
54
|
+
case "MO":
|
|
55
|
+
return RRule.MO;
|
|
56
|
+
case "TU":
|
|
57
|
+
return RRule.TU;
|
|
58
|
+
case "WE":
|
|
59
|
+
return RRule.WE;
|
|
60
|
+
case "TH":
|
|
61
|
+
return RRule.TH;
|
|
62
|
+
case "FR":
|
|
63
|
+
return RRule.FR;
|
|
64
|
+
case "SA":
|
|
65
|
+
return RRule.SA;
|
|
66
|
+
case "SU":
|
|
67
|
+
return RRule.SU;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
isAllDay() {
|
|
71
|
+
return this._validity && moment(this._validity.start).hours() === 0 && moment(this._validity.start).minutes() === 0
|
|
72
|
+
&& moment(this._validity.end).hours() === 23 && moment(this._validity.end).minutes() === 59;
|
|
73
|
+
}
|
|
74
|
+
setRRuleValue(value, key) {
|
|
75
|
+
let origOptions = this._rrule ? this._rrule.origOptions : undefined;
|
|
76
|
+
const validity = this._validity;
|
|
77
|
+
switch (key) {
|
|
78
|
+
case "all-day":
|
|
79
|
+
if (value) {
|
|
80
|
+
validity.start = moment(validity.start).startOf("day").toDate().getTime();
|
|
81
|
+
validity.end = moment(validity.end).endOf("day").toDate().getTime();
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
validity.start = moment().toDate().getTime();
|
|
85
|
+
validity.end = moment().add(1, 'hour').toDate().getTime();
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
case "start":
|
|
89
|
+
const newStartDate = moment(value);
|
|
90
|
+
if (newStartDate.isValid()) {
|
|
91
|
+
validity.start = newStartDate.set({ hour: 0, minute: 0, second: 0, millisecond: 0 }).toDate().getTime();
|
|
92
|
+
if (this.getValidityType() === "validityRecurrence") {
|
|
93
|
+
origOptions.dtstart = newStartDate.toDate();
|
|
94
|
+
this._rrule = new RRule(origOptions);
|
|
8
95
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
96
|
+
}
|
|
97
|
+
break;
|
|
98
|
+
case "end":
|
|
99
|
+
const newEndDate = moment(value);
|
|
100
|
+
if (newEndDate.isValid()) {
|
|
101
|
+
validity.end = newEndDate.set({ hour: 23, minute: 59, second: 0, millisecond: 0 }).toDate().getTime();
|
|
102
|
+
}
|
|
103
|
+
break;
|
|
104
|
+
case "never-ends":
|
|
105
|
+
if (value) {
|
|
106
|
+
delete origOptions.until;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
origOptions.until = moment().add(1, 'year').toDate();
|
|
110
|
+
}
|
|
111
|
+
if (this.getValidityType() === "validityRecurrence")
|
|
112
|
+
this._rrule = new RRule(origOptions);
|
|
113
|
+
break;
|
|
114
|
+
case "byweekday":
|
|
115
|
+
if (!origOptions.byweekday)
|
|
116
|
+
origOptions.byweekday = [];
|
|
117
|
+
if (!Array.isArray(origOptions.byweekday))
|
|
118
|
+
origOptions.byweekday = [origOptions.byweekday];
|
|
119
|
+
const newDays = value;
|
|
120
|
+
origOptions.byweekday = [];
|
|
121
|
+
newDays.forEach((d) => {
|
|
122
|
+
const weekDay = this.getWeekDay(d);
|
|
123
|
+
if (weekDay) {
|
|
124
|
+
origOptions.byweekday.push(weekDay);
|
|
12
125
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
126
|
+
});
|
|
127
|
+
if (this.getValidityType() === "validityRecurrence")
|
|
128
|
+
this._rrule = new RRule(origOptions);
|
|
129
|
+
break;
|
|
130
|
+
case "until":
|
|
131
|
+
if (this._rrule.options.until) {
|
|
132
|
+
const newDate = moment(value);
|
|
133
|
+
origOptions.until = new Date(moment(origOptions.until).set({ year: newDate.year(), month: newDate.month(), date: newDate.date() }).format());
|
|
134
|
+
}
|
|
135
|
+
if (this.getValidityType() === "validityRecurrence")
|
|
136
|
+
this._rrule = new RRule(origOptions);
|
|
137
|
+
break;
|
|
138
|
+
case "dtstart-time":
|
|
139
|
+
const timeParts = value.split(':');
|
|
140
|
+
if (origOptions) {
|
|
141
|
+
origOptions.dtstart = moment(origOptions.dtstart).set({ hour: timeParts[0], minute: timeParts[1], second: 0, millisecond: 0 }).toDate();
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
origOptions = new RRule({
|
|
145
|
+
dtstart: moment(this._validity.start).set({ hour: timeParts[0], minute: timeParts[1], second: 0, millisecond: 0 }).toDate()
|
|
146
|
+
}).origOptions;
|
|
147
|
+
}
|
|
148
|
+
validity.start = moment(origOptions.dtstart).toDate().getTime();
|
|
149
|
+
if (this.getValidityType() === "validityRecurrence")
|
|
150
|
+
this._rrule = new RRule(origOptions);
|
|
151
|
+
break;
|
|
152
|
+
case "until-time":
|
|
153
|
+
const untilParts = value.split(':');
|
|
154
|
+
if (this._rrule && this._rrule.options.until) {
|
|
155
|
+
if (origOptions) {
|
|
156
|
+
origOptions.until = moment(origOptions.until).set({ hour: untilParts[0], minute: untilParts[1], second: 0, millisecond: 0 }).toDate();
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
origOptions = new RRule({
|
|
160
|
+
until: moment(this._validity.end).set({ hour: untilParts[0], minute: untilParts[1], second: 0, millisecond: 0 }).toDate()
|
|
161
|
+
}).origOptions;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
validity.end = moment(validity.end).set({ hour: untilParts[0], minute: untilParts[1], second: 0, millisecond: 0 }).toDate().getTime();
|
|
165
|
+
if (this.getValidityType() === "validityRecurrence")
|
|
166
|
+
this._rrule = new RRule(origOptions);
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
this._validity = Object.assign({}, validity);
|
|
170
|
+
this._dialog.requestUpdate();
|
|
171
|
+
}
|
|
172
|
+
timeLabel() {
|
|
173
|
+
if (this.getValidityType() === "validityAlways") {
|
|
174
|
+
return i18next.t("validityAlways");
|
|
175
|
+
}
|
|
176
|
+
else if (this._validity && this._rrule) {
|
|
177
|
+
const validity = this._validity;
|
|
178
|
+
const diff = moment(validity.end).diff(validity.start, "days");
|
|
179
|
+
let diffString = "";
|
|
180
|
+
if (this.isAllDay()) {
|
|
181
|
+
if (diff > 0)
|
|
182
|
+
diffString = " " + i18next.t('forDays', { days: diff });
|
|
183
|
+
return this._rrule.toText() + diffString;
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
if (diff > 0)
|
|
187
|
+
diffString = i18next.t("fromToDays", { start: moment(validity.start).format("HH:mm"), end: moment(validity.end).format("HH:mm"), days: diff });
|
|
188
|
+
if (diff === 0)
|
|
189
|
+
diffString = i18next.t("fromTo", { start: moment(validity.start).format("HH:mm"), end: moment(validity.end).format("HH:mm") });
|
|
190
|
+
return this._rrule.toText() + " " + diffString;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
else if (this._validity) {
|
|
194
|
+
let format = "DD-MM-YYYY";
|
|
195
|
+
if (!this.isAllDay())
|
|
196
|
+
format = "DD-MM-YYYY HH:mm";
|
|
197
|
+
return i18next.t("activeFromTo", { start: moment(this._validity.start).format(format), end: moment(this._validity.end).format(format) });
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
setValidityType(value) {
|
|
201
|
+
if (!this.ruleset)
|
|
202
|
+
return;
|
|
203
|
+
if (!this.ruleset.meta)
|
|
204
|
+
this.ruleset.meta = {};
|
|
205
|
+
switch (value) {
|
|
206
|
+
case "validityAlways":
|
|
207
|
+
delete this.ruleset.meta["validity"];
|
|
208
|
+
this._validity = undefined;
|
|
209
|
+
this._rrule = undefined;
|
|
210
|
+
break;
|
|
211
|
+
case "validityPeriod":
|
|
212
|
+
this._validity = {
|
|
213
|
+
start: moment().startOf("day").toDate().getTime(),
|
|
214
|
+
end: moment().endOf("day").toDate().getTime()
|
|
215
|
+
};
|
|
216
|
+
this._rrule = undefined;
|
|
217
|
+
break;
|
|
218
|
+
case "validityRecurrence":
|
|
219
|
+
if (!this._validity) {
|
|
220
|
+
this._validity = {
|
|
221
|
+
start: moment().startOf("day").toDate().getTime(),
|
|
222
|
+
end: moment().endOf("day").toDate().getTime()
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
this._rrule = new RRule({
|
|
226
|
+
freq: RRule.DAILY,
|
|
227
|
+
dtstart: new Date()
|
|
228
|
+
});
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
this._dialog.requestUpdate();
|
|
232
|
+
}
|
|
233
|
+
getValidityType() {
|
|
234
|
+
if (this._validity) {
|
|
235
|
+
if (this._rrule) {
|
|
236
|
+
return "validityRecurrence";
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
return "validityPeriod";
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return "validityAlways";
|
|
243
|
+
}
|
|
244
|
+
render() {
|
|
245
|
+
if (!this.ruleset)
|
|
246
|
+
return html ``;
|
|
247
|
+
return html `
|
|
248
|
+
<or-mwc-input outlined .type="${InputType.BUTTON}" label="${this.timeLabel()}" @or-mwc-input-changed="${() => this.showDialog()}"></or-mwc-input>
|
|
249
|
+
`;
|
|
250
|
+
}
|
|
251
|
+
showDialog() {
|
|
252
|
+
this._dialog = showDialog(new OrMwcDialog()
|
|
253
|
+
.setHeading(i18next.t("scheduleRuleActivity"))
|
|
254
|
+
.setStyles(html `
|
|
255
|
+
<style>
|
|
256
|
+
.mdc-dialog__surface {
|
|
257
|
+
overflow-x: visible !important;
|
|
258
|
+
overflow-y: visible !important;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
#dialog-content {
|
|
262
|
+
overflow: visible;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
@media only screen and (max-width: 1279px) {
|
|
266
|
+
.mdc-dialog__surface {
|
|
267
|
+
overflow-x: auto !important;
|
|
268
|
+
overflow-y: auto !important;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
#dialog-content {
|
|
272
|
+
min-height: 230px;
|
|
273
|
+
overflow: auto;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
</style>`)
|
|
277
|
+
.setActions([
|
|
278
|
+
{
|
|
279
|
+
actionName: "cancel",
|
|
280
|
+
content: html `<or-mwc-input class="button" .type="${InputType.BUTTON}" label="cancel"></or-mwc-input>`,
|
|
281
|
+
action: () => {
|
|
282
|
+
this._dialog = undefined;
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
actionName: "ok",
|
|
287
|
+
default: true,
|
|
288
|
+
content: html `<or-mwc-input class="button" .type="${InputType.BUTTON}" label="apply"></or-mwc-input>`,
|
|
289
|
+
action: () => {
|
|
290
|
+
if (this.ruleset && this.ruleset.meta) {
|
|
291
|
+
if (this.getValidityType() === "validityAlways") {
|
|
292
|
+
delete this.ruleset.meta["validity"];
|
|
18
293
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
294
|
+
else {
|
|
295
|
+
if (this.getValidityType() === "validityRecurrence") {
|
|
296
|
+
this._validity.recurrence = this._rrule.toString().split("RRULE:")[1];
|
|
297
|
+
}
|
|
298
|
+
this.ruleset.meta["validity"] = this._validity;
|
|
23
299
|
}
|
|
300
|
+
this.dispatchEvent(new OrRulesRuleChangedEvent(true));
|
|
301
|
+
this._dialog = undefined;
|
|
24
302
|
}
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
<div class="layout horizontal">
|
|
64
|
-
<or-mwc-input
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
])
|
|
306
|
+
.setContent(() => this.getDialogContent())
|
|
307
|
+
.setDismissAction(null));
|
|
308
|
+
}
|
|
309
|
+
getDialogContent() {
|
|
310
|
+
const options = [RRule.MO.toString(), RRule.TU.toString(), RRule.WE.toString(), RRule.TH.toString(), RRule.FR.toString(), RRule.SA.toString(), RRule.SU.toString()];
|
|
311
|
+
const validityTypes = ["validityAlways", "validityPeriod", "validityRecurrence"];
|
|
312
|
+
const validityType = this.getValidityType();
|
|
313
|
+
const selectedOptions = this._rrule && this._rrule.options && this._rrule.options.byweekday ? this._rrule.options.byweekday.map(day => new Weekday(day).toString()) : [];
|
|
314
|
+
const validity = this._validity;
|
|
315
|
+
return html `
|
|
316
|
+
<div style="min-width: 635px; display:grid; flex-direction: row;">
|
|
317
|
+
<div class="layout horizontal">
|
|
318
|
+
<or-mwc-input style="min-width: 280px;" .value="${validityType}" .type="${InputType.SELECT}" .options="${validityTypes}" @or-mwc-input-changed="${(e) => this.setValidityType(e.detail.value)}" ></or-mwc-input>
|
|
319
|
+
</div>
|
|
320
|
+
|
|
321
|
+
${validity && (validityType === "validityPeriod" || validityType === "validityRecurrence") ? html `
|
|
322
|
+
<label style="display:block; margin-top: 20px;"><or-translate value="period"></or-translate></label>
|
|
323
|
+
<div style="display: flex; justify-content: space-between;" class="layout horizontal">
|
|
324
|
+
<div>
|
|
325
|
+
<or-mwc-input value="${moment(validity.start).format("YYYY-MM-DD")}" .type="${InputType.DATE}" @or-mwc-input-changed="${(e) => this.setRRuleValue(e.detail.value, "start")}" .label="${i18next.t("from")}"></or-mwc-input>
|
|
326
|
+
<or-mwc-input .disabled=${this.isAllDay()} .value="${moment(validity.start).format("HH:mm")}" .type="${InputType.TIME}" @or-mwc-input-changed="${(e) => this.setRRuleValue(e.detail.value, "dtstart-time")}" .label="${i18next.t("from")}"></or-mwc-input>
|
|
327
|
+
</div>
|
|
328
|
+
<div>
|
|
329
|
+
<or-mwc-input .value="${moment(validity.end).format("YYYY-MM-DD")}" .type="${InputType.DATE}" @or-mwc-input-changed="${(e) => this.setRRuleValue(e.detail.value, "end")}" .label="${i18next.t("to")}"></or-mwc-input>
|
|
330
|
+
<or-mwc-input .disabled=${this.isAllDay()} .value="${moment(validity.end).format("HH:mm")}" .type="${InputType.TIME}" @or-mwc-input-changed="${(e) => this.setRRuleValue(e.detail.value, "until-time")}" .label="${i18next.t("to")}"></or-mwc-input>
|
|
331
|
+
</div>
|
|
332
|
+
</div>
|
|
333
|
+
|
|
334
|
+
<div class="layout horizontal">
|
|
335
|
+
<or-mwc-input .value=${this.isAllDay()} @or-mwc-input-changed="${(e) => this.setRRuleValue(e.detail.value, "all-day")}" .type="${InputType.CHECKBOX}" .label="${i18next.t("allDay")}"></or-mwc-input>
|
|
336
|
+
</div>
|
|
337
|
+
` : ``}
|
|
338
|
+
|
|
339
|
+
${validityType === "validityRecurrence" ? html `
|
|
340
|
+
<label style="display: block; margin-top: 20px;"><or-translate value="repeatOccurrenceEvery"></or-translate></label>
|
|
341
|
+
<div class="layout horizontal">
|
|
342
|
+
<or-mwc-input .value="${selectedOptions}"
|
|
343
|
+
.type="${InputType.CHECKBOX_LIST}"
|
|
344
|
+
.options="${options}"
|
|
345
|
+
.label="${i18next.t("daysOfTheWeek")}"
|
|
346
|
+
@or-mwc-input-changed="${(e) => {
|
|
347
|
+
this.setRRuleValue(e.detail.value, "byweekday");
|
|
348
|
+
}}" ></or-mwc-input>
|
|
349
|
+
</div>
|
|
350
|
+
|
|
351
|
+
<label style="display:block; margin-top: 20px;"><or-translate value="repetitionEnds"></or-translate></label>
|
|
352
|
+
<div class="layout horizontal">
|
|
353
|
+
<or-mwc-input .value="${!this._rrule.options.until}" @or-mwc-input-changed="${(e) => this.setRRuleValue(e.detail.value, "never-ends")}" .type="${InputType.CHECKBOX}" .label="${i18next.t("never")}"></or-mwc-input>
|
|
354
|
+
</div>
|
|
355
|
+
<div class="layout horizontal">
|
|
356
|
+
<or-mwc-input ?disabled="${!this._rrule.options.until}" .value="${this._rrule.options.until ? moment(this._rrule.options.until).format("YYYY-MM-DD") : moment().add(1, 'year').format('YYYY-MM-DD')}" .type="${InputType.DATE}" @or-mwc-input-changed="${(e) => this.setRRuleValue(e.detail.value, "until")}" .label="${i18next.t("to")}"></or-mwc-input>
|
|
357
|
+
</div>
|
|
358
|
+
` : ``}
|
|
359
|
+
</div>`;
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
__decorate([
|
|
363
|
+
property({ type: Object })
|
|
364
|
+
], OrRuleValidity.prototype, "ruleset", void 0);
|
|
365
|
+
__decorate([
|
|
366
|
+
query("#radial-modal")
|
|
367
|
+
], OrRuleValidity.prototype, "dialog", void 0);
|
|
368
|
+
__decorate([
|
|
369
|
+
property()
|
|
370
|
+
], OrRuleValidity.prototype, "_validity", void 0);
|
|
371
|
+
__decorate([
|
|
372
|
+
property()
|
|
373
|
+
], OrRuleValidity.prototype, "_rrule", void 0);
|
|
374
|
+
OrRuleValidity = __decorate([
|
|
375
|
+
customElement("or-rule-validity")
|
|
376
|
+
], OrRuleValidity);
|
|
377
|
+
export { OrRuleValidity };
|
|
378
|
+
//# sourceMappingURL=or-rule-validity.js.map
|