100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
or-scheduler: migrate to Vaadin UI (#2512)
Koen3bd4d02ad223
diff --git a/ui/app/manager/src/index.ts b/ui/app/manager/src/index.tsindex dec6771d3..5ff840a63 100644--- a/ui/app/manager/src/index.ts+++ b/ui/app/manager/src/index.ts@@ -2,6 +2,7 @@import {pageProvisioningProvider} from "./pages/page-provisioning";import {combineReducers, configureStore} from "@reduxjs/toolkit";import "@openremote/or-app";+import themeCss from "@openremote/theme";import {AppConfig, appReducer, HeaderConfig, HeaderItem, OrApp, PageProvider, RealmAppConfig} from "@openremote/or-app";import {headerItemAccount,@@ -263,12 +264,19 @@ fetch(configURL).then<ManagerAppConfig>(async (result) => {}}).catch(reason => {console.error("Failed to initialise app: " + reason);- })+ });}- })+ });return orAppConfig;};+ // Apply theme to the Manager app+ const style = document.createElement("style");+ style.id = "orDefaultTheme";+ style.textContent = themeCss;+ document.head.appendChild(style);++ // Load appdocument.body.appendChild(orApp);});diff --git a/ui/app/shared/locales/de/or.json b/ui/app/shared/locales/de/or.jsonindex e741146a9..2f83d934e 100644--- a/ui/app/shared/locales/de/or.json+++ b/ui/app/shared/locales/de/or.json@@ -430,7 +430,7 @@"planPeriod": "Planen Sie einen Zeitraum","planRecurrence": "Planen Sie eine Wiederholung","activeFromTo": "Activ von {{start}} bis {{end}}",- "fromTo": "Von {{start}} bis {{end}}",+ "fromTo": "von {{start}} bis {{end}}","fromToDays": "von {{start}} bis {{days}} Tage später {{end}}","forDays": "für {{days}} Tage","scheduleRuleActivity": "Regelaktivität planen",diff --git a/ui/app/shared/locales/en/or.json b/ui/app/shared/locales/en/or.jsonindex a48bb4b85..4e233950f 100644--- a/ui/app/shared/locales/en/or.json+++ b/ui/app/shared/locales/en/or.json@@ -27,6 +27,18 @@"sort": "Sort","openList": "Open list","closeList": "Close list",+ "january": "January",+ "february": "February",+ "march": "March",+ "april": "April",+ "may": "May",+ "june": "June",+ "july": "July",+ "august": "August",+ "september": "September",+ "october": "October",+ "november": "November",+ "december": "December","monday": "Monday","tuesday": "Tuesday","wednesday": "Wednesday",@@ -618,7 +630,7 @@"planPeriod": "Plan an occurrence","planRecurrence": "Plan a repeating occurrence","activeFromTo": "Active from {{start}} to {{end}}",- "fromTo": "From {{start}} to {{end}}",+ "fromTo": "from {{start}} to {{end}}","fromToDays": "from {{start}} to {{days}} days later {{end}}","forDays": "for {{days}} days","scheduleActivity": "Schedule Activity",@@ -628,12 +640,15 @@"schedule": {"count_one": "occurrence","count_other": "occurrences",+ "delete": "Delete schedule","_ends": "Ends","ends": {"until": "On","count": "After"},"repeat": "Repeat every",+ "repeatOn": "Repeat on",+ "save": "Save schedule","type": "Schedule type"},"rrule": {@@ -652,7 +667,15 @@"MINUTELY_other": "Minutes","SECONDLY_one": "Second","SECONDLY_other": "Seconds"- }+ },+ "bymonth": "Months",+ "byweekno": "Weeks",+ "byyearday": "Days of year",+ "bymonthday": "Days of month",+ "byweekday": "Weekdays",+ "byhour": "Hours",+ "byminute": "Minutes",+ "bysecond": "Seconds"},"allDay": "All day","apply": "apply",diff --git a/ui/app/shared/locales/es/or.json b/ui/app/shared/locales/es/or.jsonindex 1bba60cf7..ee9553163 100644--- a/ui/app/shared/locales/es/or.json+++ b/ui/app/shared/locales/es/or.json@@ -406,7 +406,7 @@"planPeriod": "Planear una ocurrencia","planRecurrence": "Planear una ocurrencia repetida","activeFromTo": "Activo desde {{start}} a {{end}}",- "fromTo": "Desde {{start}} a {{end}}",+ "fromTo": "desde {{start}} a {{end}}","fromToDays": "De {{start}} a {{days}} días después {{end}}","forDays": "por {{days}} dias","scheduleRuleActivity": "Programar Actividad de la regla",diff --git a/ui/app/shared/locales/fr/or.json b/ui/app/shared/locales/fr/or.jsonindex 43e9d23f3..9cc1e660d 100644--- a/ui/app/shared/locales/fr/or.json+++ b/ui/app/shared/locales/fr/or.json@@ -406,7 +406,7 @@"planPeriod": "Planifier une occurrence","planRecurrence": "Planifier une occurrence répétée","activeFromTo": "Actif du {{start}} au {{end}}",- "fromTo": "Du {{start}} au {{end}}",+ "fromTo": "du {{start}} au {{end}}","fromToDays": "de {{start}} à {{days}} jours plus tard {{end}}","forDays": "pour {{days}} jours","scheduleRuleActivity": "Planifier l'activité de la règle",diff --git a/ui/app/shared/locales/it/or.json b/ui/app/shared/locales/it/or.jsonindex e6b881b4b..ba7791286 100644--- a/ui/app/shared/locales/it/or.json+++ b/ui/app/shared/locales/it/or.json@@ -403,7 +403,7 @@"planPeriod": "Pianifica un'occorrenza","planRecurrence": "Pianifica un'occorrenza che si ripete","activeFromTo": "Attivo da {{start}} a {{end}}",- "fromTo": "Da {{start}} a {{end}}",+ "fromTo": "da {{start}} a {{end}}","fromToDays": "da {{start}} a {{days}} giorni dopo{{end}}","forDays": "per {{days}} giorni","scheduleRuleActivity": "Programmare l'attività delle regole",diff --git a/ui/app/shared/locales/nl/or.json b/ui/app/shared/locales/nl/or.jsonindex bbe485b63..76df3e57d 100644--- a/ui/app/shared/locales/nl/or.json+++ b/ui/app/shared/locales/nl/or.json@@ -27,6 +27,18 @@"sort": "Sorteren","openList": "Lijst openen","closeList": "Lijst sluiten",+ "january": "januari",+ "february": "februari",+ "march": "maart",+ "april": "april",+ "may": "mei",+ "june": "juni",+ "july": "juli",+ "august": "augustus",+ "september": "september",+ "october": "oktober",+ "november": "november",+ "december": "december","monday": "maandag","tuesday": "dinsdag","wednesday": "woensdag",@@ -615,7 +627,7 @@"planPeriod": "Eén periode plannen","planRecurrence": "Herhaling plannen","activeFromTo": "Actief van {{start}} tot {{end}}",- "fromTo": "Van {{start}} tot {{end}}",+ "fromTo": "van {{start}} tot {{end}}","fromToDays": "van {{start}} tot {{days}} dagen later {{end}}","forDays": "voor {{days}} dagen","scheduleActivity": "Planner",@@ -625,12 +637,15 @@"schedule": {"count_one": "herhaling","count_other": "herhalingen",+ "delete": "Schema verwijderen","_ends": "Eindigt","ends": {"until": "Op","count": "Na"},"repeat": "Herhaal elke",+ "repeatOn": "Herhaal op",+ "save": "Schema opslaan","type": "Schema type"},"rrule": {@@ -649,7 +664,15 @@"MINUTELY_other": "Minuten","SECONDLY_one": "Seconde","SECONDLY_other": "Seconden"- }+ },+ "bymonth": "Maanden",+ "byweekno": "Weken",+ "byyearday": "Dagen van het jaar",+ "bymonthday": "Dagen van de maand",+ "byweekday": "Weekdagen",+ "byhour": "Uren",+ "byminute": "Minuten",+ "bysecond": "Seconden"},"allDay": "Hele dag","apply": "toepassen",diff --git a/ui/app/shared/locales/pt/or.json b/ui/app/shared/locales/pt/or.jsonindex d80f5496d..6f4e1b582 100644--- a/ui/app/shared/locales/pt/or.json+++ b/ui/app/shared/locales/pt/or.json@@ -404,7 +404,7 @@"planPeriod": "Planeje uma ocorrência","planRecurrence": "Planeje uma ocorrência repetida","activeFromTo": "Ativo de {{start}} a {{end}}",- "fromTo": "De {{start}} a {{end}}",+ "fromTo": "de {{start}} a {{end}}","fromToDays": "De {{start}} a {{days}} dias depois{{end}}","forDays": "por {{days}} dias","scheduleRuleActivity": "Agendar Atividade de Regra",diff --git a/ui/app/shared/locales/ro/or.json b/ui/app/shared/locales/ro/or.jsonindex f220d980a..6a49852e9 100644--- a/ui/app/shared/locales/ro/or.json+++ b/ui/app/shared/locales/ro/or.json@@ -478,7 +478,7 @@"planPeriod": "Planifică un eveniment","planRecurrence": "Planifică un eveniment repetitiv","activeFromTo": "Activ de la {{start}} până la {{end}}",- "fromTo": "De la {{start}} până la {{end}}",+ "fromTo": "de la {{start}} până la {{end}}","fromToDays": "de la {{start}} până peste {{days}} zile mai târziu {{end}}","forDays": "pentru {{days}} zile","scheduleRuleActivity": "Planifică Activitatea Regulii",diff --git a/ui/app/storybook/docs/components/or-scheduler.mdx b/ui/app/storybook/docs/components/or-scheduler.mdxnew file mode 100644index 000000000..00011bc93--- /dev/null+++ b/ui/app/storybook/docs/components/or-scheduler.mdx@@ -0,0 +1,27 @@+{/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+*/}++import { Meta } from '@storybook/addon-docs/blocks';+import * as ComponentStory from "../../../../component/or-scheduler/stories/or-scheduler.stories"; // stories need relative imports+import {ComponentDocs} from "../../util/componentdocs.mdx";++<Meta title="Components/Scheduler" />++<ComponentDocs story={ComponentStory} options={{displayName: "Scheduler"}} elementsjson={ComponentStory.customElements} />diff --git a/ui/app/storybook/rsbuild.config.ts b/ui/app/storybook/rsbuild.config.tsindex 05694e42d..8b0547a0c 100644--- a/ui/app/storybook/rsbuild.config.ts+++ b/ui/app/storybook/rsbuild.config.ts@@ -44,6 +44,7 @@ export default defineConfig({"@openremote/or-icon": "../../component/or-icon/src","@openremote/or-map": "../../component/or-map/src","@openremote/or-mwc-components": "../../component/or-mwc-components/src",+ "@openremote/or-scheduler": "../../component/or-scheduler/src","@openremote/or-translate": "../../component/or-translate/src","@openremote/or-tree-menu": "../../component/or-tree-menu/src","@openremote/or-vaadin-components": "../../component/or-vaadin-components/src",diff --git a/ui/component/or-attribute-input/src/scheduler-renderer.ts b/ui/component/or-attribute-input/src/scheduler-renderer.tsindex 51eba4be1..3546f6cde 100644--- a/ui/component/or-attribute-input/src/scheduler-renderer.ts+++ b/ui/component/or-attribute-input/src/scheduler-renderer.ts@@ -31,25 +31,18 @@ import {isObjectControl,schemaMatches,} from "@openremote/or-json-forms";-import { Frequency, RulePartKey, OrSchedulerChangedEvent } from "@openremote/or-scheduler";import "@openremote/or-scheduler";+import { Frequency, RRulePartKeys, OrSchedulerChangedEvent, INTUITIVE_NOT_APPLICABLE } from "@openremote/or-scheduler";const DISABLED_FREQUENCIES = [// Disallowed as we cannot guarantee second accuracy in the SimulatorProtocol- 'SECONDLY'-] as Frequency[]+ "SECONDLY"+] as Frequency[];const DISABLED_RRULE_PARTS = [- // Disabled for now, to reduce complexity- 'bymonth',- 'byweekno',- 'byyearday',- 'bymonthday',- 'byhour',- 'byminute',// Disallowed as we cannot guarantee second accuracy in the SimulatorProtocol- 'bysecond'-] as RulePartKey[]+ "bysecond"+] as RRulePartKeys[];const schedulerTester: RankedTester = rankWith(6,@@ -95,12 +88,16 @@ const schedulerRenderer = (state: JsonFormsStateContext, props: ControlProps) =><or-schedulerheader="scheduleSimulatorActivity"defaultEventTypeLabel="defaultSimulatorSchedule"+ disableNegativeByPartValues+ removable.defaultSchedule="${defaultEvent}".disabledFrequencies="${DISABLED_FREQUENCIES}".disabledRRuleParts="${DISABLED_RRULE_PARTS}"+ .disabledByPartCombinations="${INTUITIVE_NOT_APPLICABLE}".schedule="${props.data}".timezoneOffset="${new Date().getTimezoneOffset() * 60000}"@or-scheduler-changed="${onSchedulerChanged}"+ @or-scheduler-removed="${deleteHandler}"></or-scheduler>`, deleteHandler);diff --git a/ui/component/or-icon/src/or-icon-set.ts b/ui/component/or-icon/src/or-icon-set.tsindex 03ff1965e..4da97eff1 100644--- a/ui/component/or-icon/src/or-icon-set.ts+++ b/ui/component/or-icon/src/or-icon-set.ts@@ -4,7 +4,8 @@ const orIconSet = {icons: {"logo": "<path style='pointer-events: var(--or-icon-pointer-events, none);' fill=\"#C4D600\" d=\"m11.96125,23.85096c-6.56773,0 -11.90971,-5.34202 -11.90971,-11.90862l2.49411,0c0,5.19176 4.22389,9.41568 9.41561,9.41568c5.19053,0 9.41561,-4.22392 9.41561,-9.41568c0,-5.19176 -4.22389,-9.41568 -9.41561,-9.41568l0,-2.49413c6.56655,0 11.90971,5.34439 11.90971,11.9098c0,6.5666 -5.34316,11.90862 -11.90971,11.90862l0,0z\" /><path fill=\"#4E9D2D\" d=\"m10.25094,20.38647c-2.26848,-0.47231 -4.21822,-1.80199 -5.48741,-3.74009s-1.70892,-4.25777 -1.23545,-6.52625c0.47347,-2.26965 1.80315,-4.21822 3.74242,-5.48857c1.93926,-1.27035 4.25661,-1.70892 6.52625,-1.23545c4.68471,0.97719 7.70121,5.5828 6.72286,10.26635l-2.39994,-0.49907c0.70149,-3.36085 -1.4623,-6.66585 -4.82431,-7.36734c-1.62866,-0.33969 -3.29105,-0.02559 -4.68238,0.88645c-1.39134,0.91088 -2.34526,2.3092 -2.68495,3.93786c-0.33853,1.62633 -0.02443,3.28988 0.88645,4.68122c0.91088,1.39134 2.3092,2.34526 3.93786,2.68379l-0.50139,2.4011l0,0z\"/><path fill=\"#1D5632\"d=\"m12.03064,17.49616c-0.09524,0 -0.19048,-0.00116 -0.28457,-0.00465c-1.49833,-0.0755 -2.87818,-0.72942 -3.88636,-1.84097c-1.00818,-1.11271 -1.52156,-2.54948 -1.44722,-4.05013l2.44378,0.12196c-0.04181,0.84557 0.24856,1.65745 0.81769,2.28466c0.56681,0.62721 1.34733,0.99656 2.1929,1.03838c0.84208,0.03833 1.65629,-0.2474 2.2835,-0.81653c0.62837,-0.56797 0.99656,-1.34617 1.03954,-2.19174c0.08711,-1.74573 -1.26371,-3.23708 -3.00943,-3.3242l0.12196,-2.44378c3.09422,0.15332 5.4869,2.79455 5.33358,5.88877c-0.07434,1.49949 -0.72942,2.87818 -1.84097,3.8852c-1.04186,0.94313 -2.36945,1.45303 -3.7644,1.45303l0,0z\"/>","logo-plain": "m11.9925,23.91349c-6.58498,0 -11.94099,-5.35605 -11.94099,-11.9399l2.50066,0c0,5.20539 4.23498,9.44041 9.44033,9.44041c5.20416,0 9.44033,-4.23502 9.44033,-9.44041c0,-5.20539 -4.23498,-9.44041 -9.44033,-9.44041l0,-2.50068c6.5838,0 11.94099,5.35842 11.94099,11.94108c0,6.58385 -5.35719,11.9399 -11.94099,11.9399l0,0zm-1.80787,-3.27769c-2.31323,-0.48163 -4.30141,-1.83755 -5.59563,-3.81389s-1.74263,-4.34178 -1.25982,-6.65502c0.48281,-2.31443 1.83872,-4.30145 3.81623,-5.59686c1.97751,-1.29542 4.34056,-1.74264 6.65497,-1.25983c4.77711,0.99647 7.8531,5.69295 6.85545,10.46891l-2.44727,-0.50891c0.71532,-3.42716 -1.49114,-6.79738 -4.91946,-7.5127c-1.66078,-0.34639 -3.35596,-0.0261 -4.77474,0.90394c-1.41878,0.92886 -2.39152,2.35476 -2.73791,4.01555c-0.3452,1.65842 -0.02491,3.3548 0.90394,4.77359c0.92885,1.41879 2.35475,2.39154 4.01552,2.73675l-0.51128,2.44848l0,0zm1.81499,-2.92536c-0.09727,0 -0.19455,-0.00119 -0.29064,-0.00475c-1.53029,-0.07711 -2.93958,-0.74498 -3.96926,-1.88025c-1.02968,-1.13646 -1.55401,-2.60388 -1.47809,-4.13655l2.49591,0.12456c-0.04271,0.86361 0.25386,1.69282 0.83513,2.33341c0.5789,0.64059 1.37607,1.01783 2.23968,1.06053c0.86005,0.03915 1.69162,-0.25268 2.33221,-0.83395c0.64177,-0.58009 1.01782,-1.3749 1.06171,-2.23851c0.08897,-1.78298 -1.29066,-3.30616 -3.07362,-3.39513l0.12456,-2.49593c3.16022,0.15659 5.60394,2.85419 5.44735,6.01443c-0.07592,1.53149 -0.74498,2.9396 -1.88024,3.9681c-1.06408,0.96326 -2.41999,1.48403 -3.8447,1.48403l0,0z",- "marker": "<ellipse fill=\"#000\" opacity=\"0.2\" ry=\"1.5\" rx=\"4\" cy=\"22.5\" cx=\"12\" /><path style='pointer-events: var(--or-icon-pointer-events, none);' d=\"m11.999999,0a8.437501,8.344057 0 0 1 8.437501,8.344057c0,6.500779 -5.798864,6.280799 -8.437501,14.412461c-2.638637,-8.131662 -8.437501,-7.911683 -8.437501,-14.412461a8.437501,8.344057 0 0 1 8.437501,-8.344057z\" />"+ "marker": "<ellipse fill=\"#000\" opacity=\"0.2\" ry=\"1.5\" rx=\"4\" cy=\"22.5\" cx=\"12\" /><path style='pointer-events: var(--or-icon-pointer-events, none);' d=\"m11.999999,0a8.437501,8.344057 0 0 1 8.437501,8.344057c0,6.500779 -5.798864,6.280799 -8.437501,14.412461c-2.638637,-8.131662 -8.437501,-7.911683 -8.437501,-14.412461a8.437501,8.344057 0 0 1 8.437501,-8.344057z\" />",+ "trash": "<path d=\"M6 9V19C6 19.5523 6.44772 20 7 20H17C17.5523 20 18 19.5523 18 19V9\" stroke=\"#E21D12\" stroke-width=\"2\"/><path d=\"M14 11L14 16\" stroke=\"#E21D12\" stroke-width=\"2\" stroke-linecap=\"round\"/><path d=\"M10 11V16\" stroke=\"#E21D12\" stroke-width=\"2\" stroke-linecap=\"round\"/><path d=\"M5 6H8.5H19\" stroke=\"#E21D12\" stroke-width=\"2\" stroke-linecap=\"round\"/><path d=\"M8.09516 4.02871L7 6H17L15.9048 4.02871C15.5521 3.39378 14.8829 3 14.1565 3H9.84347C9.11714 3 8.4479 3.39378 8.09516 4.02871Z\" fill=\"#E21D12\"/>"}};diff --git a/ui/component/or-rules/src/or-rule-viewer.ts b/ui/component/or-rules/src/or-rule-viewer.tsindex 8cf1b2e09..61c2836c9 100644--- a/ui/component/or-rules/src/or-rule-viewer.ts+++ b/ui/component/or-rules/src/or-rule-viewer.ts@@ -40,19 +40,18 @@ import {i18next, translate} from "@openremote/or-translate"import {GenericAxiosResponse} from "@openremote/rest";import {showErrorDialog} from "@openremote/or-mwc-components/or-mwc-dialog";import {project} from "./flow-viewer/components/flow-editor";-import { OrSchedulerChangedEvent, RulePartKey } from "@openremote/or-scheduler";+import { INTUITIVE_NOT_APPLICABLE, OrSchedulerChangedEvent, RRulePartKeys } from "@openremote/or-scheduler";const DISABLED_RRULE_PARTS = [- 'interval',- 'bymonth',- 'byweekno',- 'byyearday',- 'bymonthday',- 'byhour',- 'byminute',- 'bysecond',- 'count',-] as RulePartKey[]+ "interval",+ "bymonth",+ "byweekno",+ "byyearday",+ "byhour",+ "byminute",+ "bysecond",+ "count",+] as RRulePartKeys[];// language=CSSexport const style = css`@@ -263,7 +262,9 @@ export class OrRuleViewer extends translate(i18next)(LitElement) {id="rule-header-validity"header="scheduleRuleActivity"defaultEventTypeLabel="validityAlways"+ disableNegativeByPartValues.disabledRRuleParts="${DISABLED_RRULE_PARTS}"+ .disabledByPartCombinations="${INTUITIVE_NOT_APPLICABLE}".schedule="${this.ruleset?.meta?.validity}"@or-scheduler-changed="${this._onSchedulerChanged}"></or-scheduler>diff --git a/ui/component/or-scheduler/.npmignore b/ui/component/or-scheduler/.npmignoreindex b2544e0f1..fb79b653e 100644--- a/ui/component/or-scheduler/.npmignore+++ b/ui/component/or-scheduler/.npmignore@@ -2,6 +2,7 @@ build/build.gradletest/src/+stories/webpack.config.jsrspack.config.jstsconfig.jsondiff --git a/ui/component/or-scheduler/package.json b/ui/component/or-scheduler/package.jsonindex c7bb7ad16..fc7453137 100644--- a/ui/component/or-scheduler/package.json+++ b/ui/component/or-scheduler/package.json@@ -18,10 +18,13 @@},"author": "OpenRemote","license": "AGPL-3.0-or-later",+ "repository": "https://github.com/openremote/openremote","dependencies": {+ "@openremote/core": "workspace:*","@openremote/model": "workspace:*",- "@openremote/or-mwc-components": "workspace:*",+ "@openremote/or-icon": "workspace:*","@openremote/or-translate": "workspace:*",+ "@openremote/or-vaadin-components": "workspace:*","lit": "^3.3.1","moment": "^2.29.4","rrule": "^2.6.4"diff --git a/ui/component/or-scheduler/src/index.ts b/ui/component/or-scheduler/src/index.tsindex 2c787e974..6732c26f8 100644--- a/ui/component/or-scheduler/src/index.ts+++ b/ui/component/or-scheduler/src/index.ts@@ -17,24 +17,51 @@* You should have received a copy of the GNU Affero General Public License* along with this program. If not, see <http://www.gnu.org/licenses/>.*/-import { html, LitElement, PropertyValues, TemplateResult } from "lit";-import { customElement, property, state } from "lit/decorators.js";+import "@openremote/or-icon";+import "@openremote/or-translate";+import "@openremote/or-vaadin-components/or-vaadin-button";+import "@openremote/or-vaadin-components/or-vaadin-checkbox";+import "@openremote/or-vaadin-components/or-vaadin-checkbox-group";+import "@openremote/or-vaadin-components/or-vaadin-date-picker";+import "@openremote/or-vaadin-components/or-vaadin-date-time-picker";+import "@openremote/or-vaadin-components/or-vaadin-dialog";+import "@openremote/or-vaadin-components/or-vaadin-icon";+import "@openremote/or-vaadin-components/or-vaadin-number-field";+import "@openremote/or-vaadin-components/or-vaadin-radio-group";+import "@openremote/or-vaadin-components/or-vaadin-select";+import "@openremote/or-vaadin-components/or-vaadin-multi-select-combo-box";+import "@openremote/or-vaadin-components/or-vaadin-time-picker";+import { css, html, LitElement, PropertyValues, TemplateResult } from "lit";+import { customElement, property, query, state } from "lit/decorators.js";+import { when } from "lit/directives/when.js";+import { Util } from "@openremote/core";import { CalendarEvent } from "@openremote/model";-import { InputType, OrInputChangedEvent } from "@openremote/or-mwc-components/or-mwc-input";+import { InputType } from "@openremote/or-vaadin-components/util";import { translate, i18next } from "@openremote/or-translate";-import { OrMwcDialog, showDialog } from "@openremote/or-mwc-components/or-mwc-dialog";+import {+ dialogRenderer,+ dialogHeaderRenderer,+ dialogFooterRenderer,+ OrVaadinDialog,+} from "@openremote/or-vaadin-components/or-vaadin-dialog";import { Frequency as FrequencyValue, RRule, Weekday, WeekdayStr } from "rrule";+import {+ BY_RRULE_PARTS,+ EventTypes,+ FREQUENCIES,+ MONTHS,+ RFC_STRICT_NOT_APPLICABLE,+ RRULE_ENDS,+ WEEKDAYS,+} from "./util";import moment from "moment";-import { Days } from "rrule/dist/esm/rrule";-import { BY_RRULE_PARTS, EventTypes, FREQUENCIES, MONTHS, NOT_APPLICABLE_BY_RRULE_PARTS, rruleEnds } from "./util";-import type { RulePartKey, RuleParts, LabeledEventTypes, Frequency } from "./types";-import { when } from "lit/directives/when.js";-export { RuleParts, RulePartKey, Frequency, LabeledEventTypes };+import type { PartKeys, RRulePartKeys, Frequency, ByRRuleCombination, ByRRulePartsKeys } from "./types";+export type * from "./types";export * from "./util";function range(start: number, end: number): number[] {- return Array.from({ length: end - start + 1 }, (_, i) => start + i )+ return Array.from({ length: end - start + 1 }, (_, i) => start + i);}// TODO: use es2023@@ -55,14 +82,24 @@ export interface OrSchedulerChangedEventDetail {}export class OrSchedulerChangedEvent extends CustomEvent<OrSchedulerChangedEventDetail> {-public static readonly NAME = "or-scheduler-changed";constructor(value?: CalendarEvent) {super(OrSchedulerChangedEvent.NAME, {detail: { value },bubbles: true,- composed: true+ composed: true,+ });+ }+}++export class OrSchedulerRemovedEvent extends CustomEvent<void> {+ public static readonly NAME = "or-scheduler-removed";++ constructor() {+ super(OrSchedulerRemovedEvent.NAME, {+ bubbles: true,+ composed: true,});}}@@ -70,22 +107,36 @@ export class OrSchedulerChangedEvent extends CustomEvent<OrSchedulerChangedEventdeclare global {export interface HTMLElementEventMap {[OrSchedulerChangedEvent.NAME]: OrSchedulerChangedEvent;+ [OrSchedulerRemovedEvent.NAME]: OrSchedulerRemovedEvent;}}@customElement("or-scheduler")export class OrScheduler extends translate(i18next)(LitElement) {+ static styles = css`+ .capitalize {+ display: inline-block;+ &::first-letter { text-transform: uppercase; }+ }+ `;+@property({ type: Object })public defaultSchedule?: CalendarEvent;@property({ type: String })public defaultEventTypeLabel = "default";+ @property({ type: Boolean })+ public disableNegativeByPartValues = false;+@property({ type: Array })public disabledFrequencies: Frequency[] = [];@property({ type: Array })- public disabledRRuleParts: RulePartKey[] = [];+ public disabledRRuleParts: RRulePartKeys[] = [];++ @property({ type: Object })+ public disabledByPartCombinations: ByRRuleCombination = RFC_STRICT_NOT_APPLICABLE;@property({ type: String })public header = "scheduleActivity";@@ -93,46 +144,85 @@ export class OrScheduler extends translate(i18next)(LitElement) {@property({ type: Boolean })public isAllDay = true;+ @property({ type: Boolean })+ public open = false;++ @property({ type: Boolean })+ public removable = false;+@property({ type: Object })public schedule?: CalendarEvent = this.defaultSchedule;- @property()+ @property({ type: Number })public timezoneOffset = 0;@state()- protected _ends: keyof typeof rruleEnds = "never";+ protected _count = 1;@state()- protected _normalizedSchedule = this.applyTimezoneOffset(this.schedule);+ protected _ends: keyof typeof RRULE_ENDS = "never";@state()protected _rrule?: RRule;- protected _byRRuleParts?: RulePartKey[];- protected _count = 1;- protected _dialog?: OrMwcDialog;+ @query("#scheduler")+ protected _dialog!: OrVaadinDialog;++ protected _byRRuleParts?: RRulePartKeys[];protected _eventType: EventTypes = EventTypes.default;- protected _eventTypes: LabeledEventTypes = EventTypes;protected _until = moment().toDate();- protected firstUpdated(_changedProps: PropertyValues) {- this._eventTypes = {- default: i18next.t(this.defaultEventTypeLabel),- period: i18next.t("planPeriod"),- recurrence: i18next.t("planRecurrence")- };- if (this._normalizedSchedule?.start && this._normalizedSchedule?.end) {- if (this._normalizedSchedule.recurrence) {- this._eventType = EventTypes.recurrence;- } else {- this._eventType = EventTypes.period;+ protected get _scheduleWithOffset(): CalendarEvent | undefined {+ return this._applyTimezoneOffset(this.schedule, this.timezoneOffset);+ }++ protected set _scheduleWithOffset(schedule) {+ this.schedule = this._applyTimezoneOffset(schedule, -this.timezoneOffset);+ }++ protected get _timeLabel(): TemplateResult | undefined {+ if (this._eventType === EventTypes.default) {+ return html`<or-translate value="${this.defaultEventTypeLabel}"></or-translate>`;+ }++ if (this._scheduleWithOffset) {+ const calendarEvent = this._scheduleWithOffset;++ if (calendarEvent.recurrence) {+ const diff = moment(calendarEvent.end).diff(calendarEvent.start, "days");+ const fromTo = { start: moment(calendarEvent.start).format("HH:mm"), end: moment(calendarEvent.end).format("HH:mm") };++ let template: TemplateResult = html``;+ if (this.isAllDay && diff > 0) {+ template = html`<or-translate value="forDays" .options="${{ days: diff }}"></or-translate>`;+ } else if (diff > 0) {+ template = html`<or-translate value="fromToDays" .options="${{ ...fromTo, days: diff }}"></or-translate>`;+ } else if (diff === 0) {+ template = html`<or-translate value="fromTo" .options="${fromTo}"></or-translate>`;+ }+ return html`<span class="capitalize">${this._rrule!.toText()} ${template}</span>`;}- this.isAllDay = this._normalizedSchedule- && moment(this._normalizedSchedule.start).isSame(moment(this._normalizedSchedule.start).clone().startOf("day"))- && moment(this._normalizedSchedule.end).isSame(moment(this._normalizedSchedule.end).clone().endOf("day"));++ const format = this.isAllDay ? "DD-MM-YYYY" : "DD-MM-YYYY HH:mm";+ return html`<or-translate value="activeFromTo" .options="${{+ start: moment(calendarEvent.start).format(format),+ end: moment(calendarEvent.end).format(format)+ }}"></or-translate>`;+ }+ }++ connectedCallback() {+ super.connectedCallback();++ const schedule = this._scheduleWithOffset;+ if (schedule?.start && schedule?.end) {+ const { start, end, recurrence } = schedule;+ this._eventType = recurrence ? EventTypes.recurrence : EventTypes.period;+ this.isAllDay = this._calculateIsAllDay(start, end);}- if (this._normalizedSchedule?.recurrence) {- const origOptions = RRule.fromString(this._normalizedSchedule.recurrence).origOptions;++ if (schedule?.recurrence) {+ const origOptions = RRule.fromString(schedule.recurrence).origOptions;if (origOptions.until) {this._until = moment(origOptions.until).toDate();} else if (origOptions.count) {@@ -141,61 +231,59 @@ export class OrScheduler extends translate(i18next)(LitElement) {}}- protected willUpdate(changedProps: PropertyValues) {+ shouldUpdate(changedProps: PropertyValues) {if (changedProps.has("schedule")) {- this._normalizedSchedule = this.applyTimezoneOffset(this.schedule);+ if (this._scheduleWithOffset?.recurrence) {+ this._rrule = RRule.fromString(this._scheduleWithOffset.recurrence);+ } else if (this._eventType === EventTypes.default && this.defaultSchedule?.recurrence) {+ this._rrule = RRule.fromString(this.defaultSchedule.recurrence);+ }}- }-- protected updated(changedProps: PropertyValues) {- super.updated(changedProps);if (changedProps.has("_rrule") && this._rrule) {this._byRRuleParts = BY_RRULE_PARTS- .filter(p => !NOT_APPLICABLE_BY_RRULE_PARTS[FrequencyValue[this._rrule!.options.freq] as Frequency]?.includes(p.toUpperCase()))+ .filter(p => !this.disabledByPartCombinations[FrequencyValue[this._rrule!.options.freq] as Frequency]?.includes(p)).filter(p => !this.disabledRRuleParts.includes(p));this._ends = (this._rrule?.origOptions?.until && "until") || (this._rrule?.origOptions?.count && "count") || "never";}+ return super.shouldUpdate(changedProps);+ }- if (changedProps.has("_normalizedSchedule")) {- if (this._normalizedSchedule?.recurrence) {- this._rrule = RRule.fromString(this._normalizedSchedule.recurrence);- } else if (this._eventType === EventTypes.default && this.defaultSchedule?.recurrence) {- this._rrule = RRule.fromString(this.defaultSchedule.recurrence);- } else {- this._rrule = undefined;- }- }+ protected _calculateIsAllDay(startInMillis: number, endInMillis: number): boolean {+ const start = moment(startInMillis);+ const end = moment(endInMillis);+ return start.isSame(start.clone().startOf("day")) && end.isSame(end.clone().endOf("day"));}/*** Converts the recurrence rule to string and normalizes it.- *+ ** The UTC timezone offset 'Z' for the UNTIL rule part is removed,- * because the backend uses a `LocalDateTime` object to compare.+ * because the timezone is configurable.* @param rrule The recurrence rule to normalize.* @returns String representation of the defined Recurrence Rule*/- protected getRRule(rrule = this._rrule): string | undefined {+ protected _getRRule(rrule = this._rrule): string | undefined {return rrule?.toString()?.split("RRULE:")?.[1]?.replace(/(UNTIL=\d+T\d+)Z/, "$1");}- protected setRRuleValue(value: any, key: keyof RuleParts | "start" | "end" | "start-time" | "end-time" | "all-day" | "recurrence-ends") {+ protected _setRRuleValue(value: any, key: PartKeys) {let origOptions = this._rrule?.origOptions;- const calendarEvent = this._normalizedSchedule!;+ const calendarEvent = this._scheduleWithOffset!;if (key === "interval" || key === "freq" || key.startsWith("by")) {if (key === "byweekday") {origOptions!.byweekday = (value as WeekdayStr[]).map(d => RRule[d]);+ } else if (key === "freq") {+ for (const part of BY_RRULE_PARTS) delete origOptions![part];+ origOptions![key as RRulePartKeys] = value;} else {- origOptions![key as keyof RuleParts] = value;+ origOptions![key as RRulePartKeys] = value;}- if (this._eventType === EventTypes.recurrence) this._rrule = new RRule(origOptions);} else if (key === "start" && origOptions) {const [year, month, date] = value.split("-").map(Number);origOptions.dtstart = moment(calendarEvent.start).set({ year, month: month - 1, date }).toDate();calendarEvent.start = origOptions.dtstart.getTime();- if (this._eventType === EventTypes.recurrence) this._rrule = new RRule(origOptions);} else if (key === "end") {const [year, month, date] = value.split("-").map(Number);calendarEvent.end = moment(calendarEvent.end).set({ year, month: month - 1, date }).toDate().getTime();@@ -209,110 +297,83 @@ export class OrScheduler extends translate(i18next)(LitElement) {}).origOptions;}calendarEvent.start = moment(origOptions.dtstart).toDate().getTime();- if (this._eventType === EventTypes.recurrence) this._rrule = new RRule(origOptions);} else if (key === "end-time") {const [hour, minute] = value.split(':');calendarEvent.end = moment(calendarEvent.end).set({ hour, minute, second: 0, millisecond: 0 }).toDate().getTime();} else {- switch (key) {- case "all-day":- this.isAllDay = value;- break;- case "recurrence-ends":- if (value === "until") {- origOptions!.until = this._until;- delete origOptions!.count;- } else if (value === "count") {- origOptions!.count = this._count;- delete origOptions!.until;- } else {- delete origOptions!.count;- delete origOptions!.until;- }- this._ends = value;- if (this._eventType === EventTypes.recurrence) this._rrule = new RRule(origOptions);- break;- case "until":- this._until = new Date(value);- origOptions!.until = this._until;- if (this._eventType === EventTypes.recurrence) this._rrule = new RRule(origOptions);- break;- case "count":- this._count = value;- origOptions!.count = this._count;- if (this._eventType === EventTypes.recurrence) this._rrule = new RRule(origOptions);- break;- }+ switch (key) {+ case "all-day":+ this.isAllDay = value;+ break;+ case "recurrence-ends":+ if (value === "until") {+ origOptions!.until = this._until;+ delete origOptions!.count;+ } else if (value === "count") {+ origOptions!.count = this._count;+ delete origOptions!.until;+ } else {+ delete origOptions!.count;+ delete origOptions!.until;+ }+ this._ends = value;+ break;+ case "until":+ this._until = new Date(value);+ origOptions!.until = this._until;+ break;+ case "count":+ this._count = value;+ origOptions!.count = this._count;+ break;+ }}- this._normalizedSchedule = { ...calendarEvent };- this._dialog!.requestUpdate();- this._normalizedSchedule.recurrence = this.getRRule();+ if (this._eventType === EventTypes.recurrence) {+ this._rrule = new RRule(origOptions);+ this._scheduleWithOffset = { ...calendarEvent, recurrence: this._getRRule() };+ } else {+ this._scheduleWithOffset = { ...calendarEvent };+ }}- protected timeLabel(): string | undefined {- if (this._eventType === EventTypes.default) {- return i18next.t(this.defaultEventTypeLabel);- } if (this._normalizedSchedule && this._rrule) {- const calendarEvent = this._normalizedSchedule;- const diff = moment(calendarEvent.end).diff(calendarEvent.start, "days");- let diffString = "";- if (this.isAllDay) {- if(diff > 0) diffString = " "+i18next.t('forDays', {days: diff});- return this._rrule.toText() + diffString;- } else {- if (diff > 0) diffString = i18next.t("fromToDays", { start: moment(calendarEvent.start).format("HH:mm"), end: moment(calendarEvent.end).format("HH:mm"), days: diff });- if (diff === 0) diffString = i18next.t("fromTo", { start: moment(calendarEvent.start).format("HH:mm"), end: moment(calendarEvent.end).format("HH:mm") });- return this._rrule.toText() + " " + diffString;- }- } else if (this._normalizedSchedule) {- let format = "DD-MM-YYYY";- if(!this.isAllDay) format = "DD-MM-YYYY HH:mm";- return i18next.t("activeFromTo", { start: moment(this._normalizedSchedule.start).format(format), end: moment(this._normalizedSchedule.end).format(format) });+ protected _setCalendarEventType(event: any) {+ const value = event.target.value;+ this._eventType = value;++ if (value === EventTypes.default) {+ this.schedule = this.defaultSchedule; // Default is not local time+ const recurrence = this.defaultSchedule?.recurrence;+ this._rrule = recurrence ? RRule.fromString(recurrence) : undefined;+ return;}- }- protected setCalendarEventType(value: any) {- switch (value) {- case EventTypes.default:- this._normalizedSchedule = this.defaultSchedule;- this._rrule = RRule.fromString(this.defaultSchedule?.recurrence ?? "") || undefined;- break;- case EventTypes.period:- this._normalizedSchedule = {- start: this._normalizedSchedule?.start ?? moment().startOf("day").toDate().getTime(),- end: this._normalizedSchedule?.end ?? moment().startOf("day").endOf("day").toDate().getTime()- };- this._rrule = undefined;- break;- case EventTypes.recurrence:- this._normalizedSchedule = {- start: this._normalizedSchedule?.start ?? moment().startOf("day").toDate().getTime(),- end: this._normalizedSchedule?.end ?? moment().startOf("day").endOf("day").toDate().getTime(),- recurrence: "FREQ=DAILY"- };- break;+ const schedule = {+ start: this._scheduleWithOffset?.start ?? moment().startOf("day").toDate().getTime(),+ end: this._scheduleWithOffset?.end ?? moment().startOf("day").endOf("day").toDate().getTime()+ };+ if (value === EventTypes.period) {+ this._scheduleWithOffset = schedule;+ } else {+ this._scheduleWithOffset = { ...schedule, recurrence: this._getRRule() ?? "FREQ=DAILY" };}- this._eventType = value;- this._dialog!.requestUpdate();}/*** Apply the timezone offset to the calendarEvent* @param schedule The schedule for which to add/substract the offset- * @param substract Whether to substract the offset+ * @param offset The timezone offset in millis to apply* @returns The transformed calendar event*/- protected applyTimezoneOffset(schedule?: CalendarEvent, substract = false): CalendarEvent | undefined {+ protected _applyTimezoneOffset(schedule: CalendarEvent | undefined, offset: number): CalendarEvent | undefined {if (schedule) {- const offset = (substract ? -this.timezoneOffset : this.timezoneOffset);let { start, end, recurrence } = { ...schedule };if (start) start += offset;if (end) end += offset;if (recurrence && RRule.fromString(recurrence).origOptions.until) {const origOptions = RRule.fromString(recurrence).origOptions;origOptions.until = new Date(Number(origOptions.until) + offset)- recurrence = this.getRRule(new RRule(origOptions))+ recurrence = this._getRRule(new RRule(origOptions))}return { start, end, recurrence }}@@ -320,117 +381,156 @@ export class OrScheduler extends translate(i18next)(LitElement) {protected render() {return html`- <or-mwc-input outlined .type="${InputType.BUTTON}" label="${this.timeLabel()}" @or-mwc-input-changed="${() => this.showDialog()}"></or-mwc-input>+ <or-vaadin-button @click="${() => this._dialog!.open()}">${this._timeLabel}</or-vaadin-button>+ <or-vaadin-dialog id="scheduler" header-title="${i18next.t(this.header)}" ?opened="${this.open}" @closed="${this._onClose}"+ ${dialogHeaderRenderer(this._getDialogHeader, [])}+ ${dialogRenderer(this._getDialogContent, [+ this.defaultSchedule,+ this.defaultEventTypeLabel,+ this.disabledFrequencies,+ this.disabledRRuleParts,+ this.header,+ this.isAllDay,+ this.schedule,+ this.timezoneOffset,+ this._count,+ this._ends,+ this._rrule,+ ])}+ ${dialogFooterRenderer(this._getDialogFooter, [])}+ ></or-vaadin-dialog>`;}- protected showDialog() {- this._dialog = showDialog(new OrMwcDialog()- .setHeading(i18next.t(this.header))- .setStyles(html`- <style>- #dialog-content {- max-height: 100vh;- overflow: auto;- background-color: #f5f5f5;- }+ protected _getDialogHeader(): TemplateResult {+ return html`+ <vaadin-button theme="tertiary" @click="${this._onClose}">+ <vaadin-icon icon="lumo:cross"></vaadin-icon>+ </vaadin-button>+ `;+ }- .mdc-dialog .mdc-dialog__content {- padding: 8px 16px !important;- }+ protected _getDialogContent(): TemplateResult {+ const eventTypes = [+ { value: "default", label: i18next.t(this.defaultEventTypeLabel) },+ { value: "period", label: i18next.t("planPeriod") },+ { value: "recurrence", label: i18next.t("planRecurrence") },+ ];- @media only screen and (max-width: 1279px) {- .mdc-dialog__surface {- overflow-x: auto !important;- overflow-y: auto !important;- }+ return html`+ <style>+ /* Showing just a number is not intuitive when using numbers as options */+ vaadin-multi-select-combo-box-chip[slot="overflow"]::part(label)::before {+ content: "+";+ }- #dialog-content {- min-height: 230px;- overflow: auto;- }- }+ vaadin-checkbox {+ font-weight: 600;+ }- .section {- background-color: white;- margin-top: 10px;- padding: 8px 16px;- border-radius: 4px;- }- .section > * {- margin: 8px 0;- }- .section:first-child {- margin-top: 0;- }- .section:last-child {- margin-bottom: 0;- }+ .period {+ display: flex;+ flex: 1;+ gap: 2px;+ }- .title {- display: block;- font-weight: bold;- }- </style>`)- .setActions([- {- actionName: "cancel",- content: html`<or-mwc-input class="button" .type="${InputType.BUTTON}" label="cancel"></or-mwc-input>`,- action: () => {- this._dialog = undefined;+ .section {+ background-color: white;+ border-radius: var(--lumo-border-radius-m);+ display: flex;+ flex-direction: column;+ padding: var(--lumo-space-l);+ }++ .title {+ padding-bottom: var(--lumo-space-m);+ font-size: var(--lumo-font-size-l);+ font-style: normal;+ font-weight: 600;+ line-height: 125.303%; /* 22.554px */+ }++ .label {+ margin-left: 10px;+ }+ or-vaadin-number-field[disabled] + .label {+ color: var(--lumo-contrast-20pct);+ user-select: revert;+ -webkit-user-select: none;+ }++ @media only screen and (min-width: 768px) {+ or-vaadin-date-picker[combined] {+ --vaadin-input-field-top-end-radius: 0;+ --vaadin-input-field-bottom-end-radius: 0;}- },- {- actionName: "ok",- default: true,- content: html`<or-mwc-input class="button" .type="${InputType.BUTTON}" label="apply"></or-mwc-input>`,- action: () => {- if (this._normalizedSchedule && this.isAllDay) {- this._normalizedSchedule.start = moment(this._normalizedSchedule.start).startOf("day").toDate().getTime();- this._normalizedSchedule.end = moment(this._normalizedSchedule.end).startOf("day").endOf("day").toDate().getTime();- }- if (this._eventType === EventTypes.default) {- delete this._normalizedSchedule;- } else if (this._eventType === EventTypes.recurrence) {- this._normalizedSchedule!.recurrence = this.getRRule();- }- const schedule = this.applyTimezoneOffset(this._normalizedSchedule ?? this.defaultSchedule, true);- this.dispatchEvent(new OrSchedulerChangedEvent(schedule));- this._dialog = undefined;+ or-vaadin-time-picker {+ --vaadin-input-field-top-start-radius: 0;+ --vaadin-input-field-bottom-start-radius: 0;}- },- ])- .setContent(() => this.getDialogContent())- .setDismissAction(null));- }-- protected getDialogContent(): TemplateResult {- const calendar = this._normalizedSchedule;+ }- return html`- <div style="min-width: 635px; display:grid; flex-direction: row;">+ @media only screen and (max-width: 768px) {+ .period {+ flex-wrap: wrap;+ }+ }+ </style>+ <div style="display: flex; flex-direction: column; gap: var(--lumo-space-m)"><div id="event-type" class="section"><label class="title"><or-translate value="schedule.type"></or-translate></label>- <div class="layout horizontal">- <or-mwc-input style="width: 100%"- .value="${this._eventType}"- .type="${InputType.SELECT}"- .options="${Object.entries(this._eventTypes)}"- @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.setCalendarEventType(e.detail.value)}"></or-mwc-input>- </div>+ <or-vaadin-select style="flex: 1" .value="${this._eventType}" .items="${eventTypes}" @change="${this._setCalendarEventType}"></or-vaadin-select></div>- ${calendar && (this._eventType === EventTypes.period || this._eventType === EventTypes.recurrence) ? this.getPeriodTemplate(calendar) : ``}- ${this._eventType === EventTypes.recurrence ? this.getRepeatTemplate() : ``}- ${this._eventType === EventTypes.recurrence ? this.getEndsTemplate() : ``}+ ${when(this._eventType !== EventTypes.default, () => this._getPeriodTemplate())}+ ${when(this._eventType === EventTypes.recurrence, () => this._getRepeatTemplate())}+ ${when(this._eventType === EventTypes.recurrence, () => this._getEndsTemplate())}</div>`;}+ protected _getDialogFooter(): TemplateResult {+ return html`+ ${when(this.removable, () => html`+ <or-vaadin-button style="background-color: unset; margin-right: auto" theme="error" @click="${this._onDelete}">+ <or-icon icon="or:trash" style="--or-icon-fill: white"></or-icon>+ <or-translate value="schedule.delete"></or-translate>+ </or-vaadin-button>`+ )}+ <or-vaadin-button theme="primary" @click="${this._onSave}"><or-translate value="schedule.save"></or-translate></or-vaadin-button>+ `;+ }++ protected _onClose() {+ this._dialog!.close();+ }++ protected _onDelete() {+ this._dialog!.close();+ this.dispatchEvent(new OrSchedulerRemovedEvent());+ }++ protected _onSave() {+ this.dispatchEvent(new OrSchedulerChangedEvent(this.schedule ?? this.defaultSchedule));+ this._dialog!.close();+ }++ protected _onPartChange(part: PartKeys, valueProp: "checked" | "value" | "detail", value?: any) {+ return (e: any) => {+ if (valueProp === "detail") {+ if (!Util.objectsEqual(e.detail.value, value, true)) {+ this._setRRuleValue(e.detail.value, part);+ }+ return;+ }+ this._setRRuleValue(e.target[valueProp], part);+ }+ }+/*** Check if this frequency is allowed* @param freq The frequency to check* @returns Whether the frequency is allowed*/- protected isAllowedFrequency(freq: Frequency) {+ protected _isAllowedFrequency(freq: Frequency) {// Secondly is disabled because it's not possible to configure the period on a seconds basis// with the current period fieldsreturn freq !== "SECONDLY" && !this.disabledFrequencies.includes(freq);@@ -438,7 +538,7 @@ export class OrScheduler extends translate(i18next)(LitElement) {/*** Displays the interval, frequency and BY_XXX RRule part fields- *+ ** Applicable rule parts* - `interval`* - `freq`@@ -455,122 +555,140 @@ export class OrScheduler extends translate(i18next)(LitElement) {** @returns Inputs for the applicable rule parts*/- protected getRepeatTemplate(): TemplateResult {+ protected _getRepeatTemplate(): TemplateResult {const interval = this._rrule?.origOptions.interval ?? 1;const frequency = this._rrule?.origOptions.freq ?? FrequencyValue.DAILY;const frequencies = Object.entries(FREQUENCIES)- .map(([k,v]) => [String(FrequencyValue[k as Frequency]), i18next.t(v, { count: interval })])- .filter(([k]) => this.isAllowedFrequency(FrequencyValue[k as Frequency] as any))+ .map(([k, v]) => ({ value: String(FrequencyValue[k as Frequency]), label: i18next.t(v, { count: interval }) }))+ .filter(({ value }) => this._isAllowedFrequency(FrequencyValue[value as Frequency] as any))return html`<div id="recurrence" class="section"><label class="title"><or-translate value="schedule.repeat"></or-translate></label>- <div class="layout horizontal" style="display: flex; gap: 8px;">+ <div style="display: flex; gap: 8px">${when(!this.disabledRRuleParts?.includes("interval"), () => html`- <or-mwc-input style="width: 60px;" min="1" max="9" .value="${interval}" .type="${InputType.NUMBER}"- @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "interval")}"></or-mwc-input>+ <or-vaadin-number-field min="1" max="9" step-buttons-visible style="width: 106px" .value="${interval}"+ @change="${this._onPartChange("interval", "value")}">+ </or-vaadin-number-field>`)}- <or-mwc-input style="flex: 1;" .value="${frequency.toString()}" .type="${InputType.SELECT}" .options="${frequencies}"- @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "freq")}"></or-mwc-input>- </div>- <div>${this.getByRulePart("bymonth", InputType.CHECKBOX_LIST, Object.entries(MONTHS))}</div>- <div>- ${this.getByRulePart("byweekno", InputType.SELECT, byWeekNoOptions)}- ${this.getByRulePart("byyearday", InputType.SELECT, byYearDayOptions)}- ${this.getByRulePart("bymonthday", InputType.SELECT, byMonthDayOptions)}- </div>- <div>${this.getByRulePart("byweekday", InputType.CHECKBOX_LIST, Object.keys(Days))}</div>- <div>- ${this.getByRulePart("byhour", InputType.SELECT, byHourOptions)}- ${this.getByRulePart("byminute", InputType.SELECT, byMinuteOrSecondsOptions)}- ${this.getByRulePart("bysecond", InputType.SELECT, byMinuteOrSecondsOptions)}+ <or-vaadin-select style="flex: 1;" .value="${frequency.toString()}" .items="${frequencies}"+ @change="${this._onPartChange("freq", "value")}">+ </or-vaadin-select></div>+ ${when(BY_RRULE_PARTS.some((p) => this._byRRuleParts?.includes(p)), () => html`+ <label class="title" style="margin-top: var(--lumo-space-l)"><or-translate value="schedule.repeatOn"></or-translate></label>+ <div>${this._getByRulePart("bymonth", InputType.CHECKBOX_LIST, Object.entries(MONTHS))}</div>+ <div>+ ${this._getByRulePart("byweekno", InputType.SELECT, byWeekNoOptions)}+ ${this._getByRulePart("byyearday", InputType.SELECT, byYearDayOptions)}+ ${this._getByRulePart("bymonthday", InputType.SELECT, byMonthDayOptions)}+ </div>+ <div>${this._getByRulePart("byweekday", InputType.CHECKBOX_LIST, Object.entries(WEEKDAYS))}</div>+ <div>+ ${this._getByRulePart("byhour", InputType.SELECT, byHourOptions)}+ ${this._getByRulePart("byminute", InputType.SELECT, byMinuteOrSecondsOptions)}+ ${this._getByRulePart("bysecond", InputType.SELECT, byMinuteOrSecondsOptions)}+ </div>+ `)}</div>`;}/*** Displays the BY_XXX RRule part fields if allowed by the frequency- *+ ** @returns The specified BY_XXX RRule part field or undefined if not applicable*/- protected getByRulePart<T>(part: RulePartKey, type: InputType, options: T[]): TemplateResult | undefined {+ protected _getByRulePart<T extends number | [string, string]>(part: ByRRulePartsKeys, type: InputType, options: T[]): TemplateResult | undefined {if (!this._byRRuleParts?.includes(part)) {return undefined}- const value = part === "byweekday"- ? (this._rrule?.origOptions?.byweekday as Weekday[])?.map(String)- : this._rrule?.origOptions[part];-- return html`<or-mwc-input style="min-width: 30%"- .value="${value ?? []}"- .type="${type}"- .options="${options}"- .label="${part}"- multiple- @or-mwc-input-changed="${(e: OrInputChangedEvent) => {- this.setRRuleValue(e.detail.value, part);- }}"></or-mwc-input>`;+ const opts = this._rrule?.origOptions?.[part] ?? [];+ const value = (part === "byweekday"+ ? (opts as Weekday[])?.map(String)+ : Array.isArray(opts) ? opts : [opts]+ );++ return type === InputType.CHECKBOX_LIST ? html`+ <or-vaadin-checkbox-group .value="${value}" @value-changed="${this._onPartChange(part, "detail", value)}">+ ${(options as [string, string][]).map(([value, label]) => html`<vaadin-checkbox theme="button" value="${value}" label="${i18next.t(label).slice(0, 3)}"></vaadin-checkbox>`)}+ </or-vaadin-checkbox-group>+ ` : html`+ <or-vaadin-multi-select-combo-box .selectedItems="${value}" .label="${i18next.t(`rrule.${part}`)}"+ .items="${this.disableNegativeByPartValues ? options.filter((n) => +n > 0) : options}"+ @selected-items-changed="${this._onPartChange(part, "detail", value)}">+ </or-vaadin-multi-select-combo-box>+ `;}/*** Displays the fields that define when and how long the particular event is- *- * @param calendar The specified calendar event+ ** @returns The periods allDay and from/to date and time fields*/- protected getPeriodTemplate(calendar: CalendarEvent): TemplateResult {+ protected _getPeriodTemplate(): TemplateResult {+ const calendar = this._scheduleWithOffset!;return html`<div id="period" class="section"><label class="title"><or-translate value="period"></or-translate></label>- <div style="display: flex; gap: 8px;" class="layout horizontal">- <div style="display: flex; flex: 1; gap: 4px">- <or-mwc-input style="flex: 1" value="${moment(calendar.start).format("YYYY-MM-DD")}" .type="${InputType.DATE}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "start")}" .label="${i18next.t("from")}"></or-mwc-input>- <or-mwc-input ?hidden=${this.isAllDay} .value="${moment(calendar.start).format("HH:mm")}" .type="${InputType.TIME}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "start-time")}" .label="${i18next.t("from")}"></or-mwc-input>+ <div style="display: flex; gap: 8px">+ <div class="period">+ <or-vaadin-date-picker style="text-transform: capitalize" ?combined="${!this.isAllDay}" .value="${moment(calendar.start).format("YYYY-MM-DD")}"+ @change="${this._onPartChange("start", "value")}" label="${i18next.t("from")}"> </or-vaadin-date-picker>+ <or-vaadin-time-picker style="margin-top: auto" ?hidden=${this.isAllDay} .value="${moment(calendar.start).format("HH:mm")}"+ @change="${this._onPartChange("start-time", "value")}">+ </or-vaadin-time-picker></div>- <div style="display: flex; flex: 1; gap: 4px">- <or-mwc-input style="flex: 1" .value="${moment(calendar.end).format("YYYY-MM-DD")}" .type="${InputType.DATE}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "end")}" .label="${i18next.t("to")}"></or-mwc-input>- <or-mwc-input ?hidden=${this.isAllDay} .value="${moment(calendar.end).format("HH:mm")}" .type="${InputType.TIME}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "end-time")}" .label="${i18next.t("to")}"></or-mwc-input>+ <div class="period">+ <or-vaadin-date-picker style="text-transform: capitalize" ?combined="${!this.isAllDay}" .value="${moment(calendar.end).format("YYYY-MM-DD")}"+ @change="${this._onPartChange("end", "value")}" label="${i18next.t("to")}">+ </or-vaadin-date-picker>+ <or-vaadin-time-picker style="margin-top: auto" ?hidden=${this.isAllDay} .value="${moment(calendar.end).format("HH:mm")}"+ @change="${this._onPartChange("end-time", "value")}">+ </or-vaadin-time-picker></div></div>-- <div class="layout horizontal">- <or-mwc-input .value=${this.isAllDay} @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "all-day")}" .type="${InputType.CHECKBOX}" .label="${i18next.t("allDay")}"></or-mwc-input>- </div>+ <or-vaadin-checkbox .checked=${this.isAllDay} @change="${this._onPartChange("all-day", "checked")}" .label="${i18next.t("allDay")}"></or-vaadin-checkbox></div>`;}/*** Displays the fields that define how a recurring event should end- *+ ** Applicable rule parts* - `until`* - `count`* @returns The recurrence ends fields*/- protected getEndsTemplate(): TemplateResult {+ protected _getEndsTemplate(): TemplateResult {return html`<div id="recurrence-ends" class="section"><label class="title"><or-translate value="schedule._ends"></or-translate></label>- <div style="display: flex; gap: 8px;" class="layout horizontal">- <or-mwc-input style="padding-right: 10px" .type="${InputType.RADIO}"- .value="${this._ends}"- .options="${Object.entries(rruleEnds).filter(([k]) => !this.disabledRRuleParts?.includes(k as RulePartKey))}"- @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "recurrence-ends")}">- </or-mwc-input>- <div style="display: flex; flex-direction: column-reverse; flex: 1">- ${when(!this.disabledRRuleParts.includes("count"), () => html`- <or-mwc-input ?disabled="${this._ends !== "count"}" min="1" .type="${InputType.NUMBER}"- .value="${this._count}"- .label="${i18next.t("schedule.count", { count: this._count })}"- @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "count")}">- </or-mwc-input>`- )}+ <div style="display: flex; gap: 8px;">+ <or-vaadin-radio-group style="padding-right: 10px; width: unset" .value="${this._ends}" theme="vertical"+ @change="${this._onPartChange("recurrence-ends", "value")}">+ ${Object.entries(RRULE_ENDS)+ .filter(([k]) => !this.disabledRRuleParts?.includes(k as RRulePartKeys))+ .map(([k, v]) => html`+ <vaadin-radio-button style="margin: 6px 0" value="${k}" label="${i18next.t(v)}"></vaadin-radio-button>+ `)}+ </or-vaadin-radio-group>+ <div style="display: flex; flex-direction: column; flex: 1; ">${when(!this.disabledRRuleParts.includes("until"), () => html`- <or-mwc-input ?disabled="${this._ends !== "until"}" .type="${InputType.DATETIME}"- .value="${moment(this._until).format("YYYY-MM-DD HH:mm")}"- @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.setRRuleValue(e.detail.value, "until")}">- </or-mwc-input>`+ <or-vaadin-date-time-picker style="margin-top: auto; padding: var(--lumo-space-s) 0" ?disabled="${this._ends !== "until"}"+ .value="${moment(this._until).format("YYYY-MM-DDTHH:mm")}"+ @change="${this._onPartChange("until", "value")}">+ </or-vaadin-date-time-picker>`+ )}+ ${when(!this.disabledRRuleParts.includes("count"), () => html`<div style="display: inline-flex">+ <or-vaadin-number-field ?disabled="${this._ends !== "count"}" min="1" style="width: 120px"+ step-buttons-visible+ .value="${this._count}"+ @change="${this._onPartChange("count", "value")}">+ </or-vaadin-number-field><or-translate class="label" value="schedule.count"+ ?disabled="${this._ends !== "count"}" .options="${{ count: +this._count }}">+ </or-translate>+ </div>`)}</div></div>diff --git a/ui/component/or-scheduler/src/types.ts b/ui/component/or-scheduler/src/types.tsindex 53cb82142..37074ce98 100644--- a/ui/component/or-scheduler/src/types.ts+++ b/ui/component/or-scheduler/src/types.ts@@ -18,7 +18,20 @@* along with this program. If not, see <http://www.gnu.org/licenses/>.*/import { Frequency as FrequencyValue, Options } from "rrule";-import { EventTypes } from "./util";++export type ByRRuleParts = Pick<+ Options,+ | "bymonth"+ | "byweekno"+ | "byyearday"+ | "bymonthday"+ | "byweekday"+ | "byhour"+ | "byminute"+ | "bysecond"+>;+export type ByRRulePartsKeys = keyof ByRRuleParts;+export type ByRRuleCombination = Record<keyof typeof FrequencyValue, ByRRulePartsKeys[]>;/*** Supported recurrence rule parts in evaluation order:@@ -46,22 +59,21 @@ import { EventTypes } from "./util";** @see {@link RRule} and {@link https://labix.org/python-dateutil/#head-a65103993a21b717f6702063f3717e6e75b4ba66|python-dateutil}.*/-export type RuleParts = Pick<+export type RRuleParts = Pick<Options,| "interval"| "freq" // Must exist (should default to DAILY?)- | "bymonth"- | "byweekno"- | "byyearday"- | "bymonthday"- | "byweekday"- | "byhour"- | "byminute"- | "bysecond"| "count"| "until"->;+> & ByRRuleParts;-export type LabeledEventTypes = Record<EventTypes, string>;-export type RulePartKey = keyof RuleParts;-export type Frequency = (keyof typeof FrequencyValue);+export type Frequency = keyof typeof FrequencyValue;+export type RRulePartKeys = keyof RRuleParts;+export type PartKeys =+ | RRulePartKeys+ | "start"+ | "start-time"+ | "end"+ | "end-time"+ | "all-day"+ | "recurrence-ends";diff --git a/ui/component/or-scheduler/src/util.ts b/ui/component/or-scheduler/src/util.tsindex 0619bf440..c68d2b405 100644--- a/ui/component/or-scheduler/src/util.ts+++ b/ui/component/or-scheduler/src/util.ts@@ -18,6 +18,7 @@* along with this program. If not, see <http://www.gnu.org/licenses/>.*/import { Frequency } from "rrule";+import { ByRRulePartsKeys } from "./types";export const FREQUENCIES = {YEARLY: "rrule.frequency.YEARLY",@@ -27,11 +28,11 @@ export const FREQUENCIES = {HOURLY: "rrule.frequency.HOURLY",MINUTELY: "rrule.frequency.MINUTELY",SECONDLY: "rrule.frequency.SECONDLY",-} as Record<keyof typeof Frequency, string>;+} as const satisfies Record<keyof typeof Frequency, string>;/**- * Evaluation order: BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY, BYDAY, BYHOUR, BYMINUTE and BYSECOND.- * As per https://datatracker.ietf.org/doc/html/rfc5545#section-3.3.10 page 44+ * Evaluation order in RFC 5545 (Page 44): BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY, BYDAY, BYHOUR, BYMINUTE and BYSECOND.+ * @link https://datatracker.ietf.org/doc/html/rfc5545#section-3.3.10*/export const BY_RRULE_PARTS = ["bymonth",@@ -44,33 +45,62 @@ export const BY_RRULE_PARTS = ["bysecond",] as const;+type ByRRuleCombination = Record<keyof typeof Frequency, ByRRulePartsKeys[]>;++/**+ * Strictly prohibited by RFC 5545 (Page 44).+ * These combinations are invalid according to the specification.+ * @link https://datatracker.ietf.org/doc/html/rfc5545#section-3.3.10+ */+export const RFC_STRICT_NOT_APPLICABLE = {+ SECONDLY: ["byweekno"],+ MINUTELY: ["byweekno"],+ HOURLY: ["byweekno"],+ DAILY: ["byweekno", "byyearday"],+ WEEKLY: ["byweekno", "byyearday", "bymonthday"],+ MONTHLY: ["byweekno", "byyearday"],+ YEARLY: [],+} as const satisfies ByRRuleCombination;++const COMMONLY_NOT_APPLICABLE = ["bymonth", "byweekno", "byyearday", "byhour", "byminute", "bysecond"] as const;/**- * Dependency of by rule parts table- * As per https://datatracker.ietf.org/doc/html/rfc5545#section-3.3.10 page 44+ * Merged rules: RFC prohibitions + non-required/unintuitive parts.+ * Use this to simplify UI options for end-users.*/-export const NOT_APPLICABLE_BY_RRULE_PARTS = {- SECONDLY: ["BYWEEKNO"],- MINUTELY: ["BYWEEKNO"],- HOURLY: ["BYWEEKNO"],- DAILY: ["BYWEEKNO", "BYYEARDAY"],- WEEKLY: ["BYWEEKNO", "BYYEARDAY", "BYMONTHDAY"],- MONTHLY: ["BYWEEKNO", "BYYEARDAY"],-} as Record<keyof typeof Frequency, string[]>;+export const INTUITIVE_NOT_APPLICABLE = {+ SECONDLY: ["bymonthday", "byweekday", ...COMMONLY_NOT_APPLICABLE, ...RFC_STRICT_NOT_APPLICABLE.SECONDLY],+ MINUTELY: ["bymonthday", "byweekday", ...COMMONLY_NOT_APPLICABLE, ...RFC_STRICT_NOT_APPLICABLE.MINUTELY],+ HOURLY: ["bymonthday", "byweekday", ...COMMONLY_NOT_APPLICABLE, ...RFC_STRICT_NOT_APPLICABLE.HOURLY],+ DAILY: ["bymonthday", "byweekday", ...COMMONLY_NOT_APPLICABLE, ...RFC_STRICT_NOT_APPLICABLE.DAILY],+ WEEKLY: ["bymonthday", ...COMMONLY_NOT_APPLICABLE, ...RFC_STRICT_NOT_APPLICABLE.WEEKLY],+ MONTHLY: ["byweekday", ...COMMONLY_NOT_APPLICABLE, ...RFC_STRICT_NOT_APPLICABLE.MONTHLY],+ YEARLY: ["bymonthday", "byweekday", ...COMMONLY_NOT_APPLICABLE, ...RFC_STRICT_NOT_APPLICABLE.YEARLY],+} as const satisfies ByRRuleCombination;++export const WEEKDAYS = {+ MO: "monday",+ TU: "tuesday",+ WE: "wednesday",+ TH: "thursday",+ FR: "friday",+ SA: "saturday",+ SU: "sunday",+} as const;export const MONTHS = {- 1: "JAN",- 2: "FEB",- 3: "MAR",- 4: "APR",- 5: "MAY",- 6: "JUN",- 7: "JUL",- 8: "AUG",- 9: "SEP",- 10: "OCT",- 11: "NOV",- 12: "DEC",-};+ "1": "january",+ "2": "february",+ "3": "march",+ "4": "april",+ "5": "may",+ "6": "june",+ "7": "july",+ "8": "august",+ "9": "september",+ "10": "october",+ "11": "november",+ "12": "december",+} as const;export enum EventTypes {default = "default",@@ -78,8 +108,8 @@ export enum EventTypes {recurrence = "recurrence",}-export const rruleEnds = {+export const RRULE_ENDS = {never: "never",until: "schedule.ends.until",count: "schedule.ends.count",-}+} as const;diff --git a/ui/component/or-scheduler/stories/or-scheduler.stories.ts b/ui/component/or-scheduler/stories/or-scheduler.stories.tsnew file mode 100644index 000000000..b5ea391a8--- /dev/null+++ b/ui/component/or-scheduler/stories/or-scheduler.stories.ts@@ -0,0 +1,107 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+import { html } from "lit";+import { setCustomElementsManifest, type Meta, type StoryObj } from "@storybook/web-components";+import { getStorybookHelpers } from "@wc-toolkit/storybook-helpers";+import customElements from "../custom-elements.json" with { type: "json" };+import packageJson from "../package.json" with { type: "json" };+import manager from "@openremote/core";+import { Frequency, INTUITIVE_NOT_APPLICABLE, type RRulePartKeys } from "../src/index";+import "../src/index";++const tagName = "or-scheduler";+type Story = StoryObj;+setCustomElementsManifest(customElements);++const { events, args, argTypes, template } = getStorybookHelpers(tagName);++const meta: Meta = {+ title: "Playground/or-scheduler",+ component: tagName,+ args: args,+ argTypes: argTypes,+ render: storyArgs => template(storyArgs),+ excludeStories: /^[a-z].*/,+ parameters: {+ actions: {+ handles: events+ },+ docs: {+ subtitle: `<${tagName}>`,+ description: "The scheduler is a web component that implements the Recurrence Rule Standard for single/recurring events (ref rfc5545#section-3.8.5.3)."+ }+ }+};++export const Primary: Story = {+ render: (_args) => {+ // Unused frequencies+ const DISABLED_FREQUENCIES = [+ "SECONDLY"+ ] as Frequency[];+ // Unused rrule parts+ const DISABLED_RRULE_PARTS = [+ "bysecond" // Partially broken+ ] as RRulePartKeys[];+ return html`+ <or-scheduler+ open+ removable+ disableNegativeByPartValues+ .disabledFrequencies="${DISABLED_FREQUENCIES}"+ .disabledRRuleParts="${DISABLED_RRULE_PARTS}"+ .disabledByPartCombinations="${INTUITIVE_NOT_APPLICABLE}"+ ></or-scheduler>+ `;+ },+ parameters: {+ docs: {+ story: {+ height: "1000px"+ }+ }+ },+ loaders: [+ async storyArgs => ({+ orManager: await loadOrManager()+ })+ ]+};++export const examples: Story[] = [];++export { customElements, packageJson };++/* ------------------------------------------------------- */+/* UTILITY FUNCTIONS */+/* ------------------------------------------------------- */++async function loadOrManager() {+ if (await manager.init({ managerUrl: "http://localhost:8080", realm: "master" })) {+ if (!manager.authenticated) {+ manager.login();+ }+ return manager;+ }+ throw new Error("Manager could not be initialized");+}+++export default meta;diff --git a/ui/component/or-scheduler/test/fixtures/index.ts b/ui/component/or-scheduler/test/fixtures/index.tsindex 4253c5942..efe843f57 100644--- a/ui/component/or-scheduler/test/fixtures/index.ts+++ b/ui/component/or-scheduler/test/fixtures/index.ts@@ -17,17 +17,17 @@* You should have received a copy of the GNU Affero General Public License* along with this program. If not, see <http://www.gnu.org/licenses/>.*/-import { MwcDialog, MwcInput } from "../../../or-mwc-components/test/fixtures";+import { VaadinDialog, VaadinInput } from "../../../or-vaadin-components/test/fixtures";import { ct as base, type SharedComponentTestFixtures, withPage } from "@openremote/test";export { expect } from "@openremote/test";interface ComponentFixtures extends SharedComponentTestFixtures {- mwcDialog: MwcDialog;- mwcInput: MwcInput;+ vaadinDialog: VaadinDialog;+ vaadinInput: VaadinInput;}export const ct = base.extend<ComponentFixtures>({// Components- mwcDialog: withPage(MwcDialog),- mwcInput: withPage(MwcInput),+ vaadinDialog: withPage(VaadinDialog),+ vaadinInput: withPage(VaadinInput),});diff --git a/ui/component/or-scheduler/test/or-scheduler.test.ts b/ui/component/or-scheduler/test/or-scheduler.test.tsindex 7178dc4c3..6e48c746e 100644--- a/ui/component/or-scheduler/test/or-scheduler.test.ts+++ b/ui/component/or-scheduler/test/or-scheduler.test.ts@@ -20,12 +20,19 @@import { Locator } from "@openremote/test";import { ct, expect } from "./fixtures";-import { OrScheduler, OrSchedulerChangedEvent } from "@openremote/or-scheduler";-import { MONTHS, BY_RRULE_PARTS, NOT_APPLICABLE_BY_RRULE_PARTS } from "../src/util";-import type { MwcInput } from "../../or-mwc-components/test/fixtures";+import {+ ByRRulePartsKeys,+ OrScheduler,+ OrSchedulerChangedEvent,+ OrSchedulerRemovedEvent,+} from "@openremote/or-scheduler";+import { MONTHS, BY_RRULE_PARTS, RFC_STRICT_NOT_APPLICABLE, WEEKDAYS } from "../src/util";+import type { VaadinInput } from "../../or-vaadin-components/test/fixtures";import { Frequency } from "../src";-const months = new RegExp(Object.values(MONTHS).join("|"));+const slice = (m: string) => m.slice(0, 3);+const months = new RegExp(Object.values(MONTHS).map(slice).join("|"), "i");+const weekdays = new RegExp(Object.values(WEEKDAYS).map(slice).join("|"), "i");const HOUR_IN_MILLIS = 3600 * 1000;const DAY_IN_MILLIS = 24 * HOUR_IN_MILLIS;@@ -58,9 +65,9 @@ function getPeriodValues(time?: { start: number; end: number; date?: boolean })return { start, end, timeLabel: `from ${startDate} to ${endDate}` };}-async function selectEventType(type: string, dialog: Locator, mwcInput: MwcInput) {+async function selectEventType(type: string, dialog: Locator, vaadinInput: VaadinInput) {await dialog.getByRole("button", { name: "Default", exact: true }).click();- const option = mwcInput.getSelectInputOption(type, dialog);+ const option = vaadinInput.getSelectInputOption(type, dialog);await expect(option).toBeVisible();await option.click();}@@ -71,12 +78,12 @@ ct.beforeEach(async ({ shared }) => {});ct.describe("Default event type should", () => {- ct("only show event types select", async ({ mount, mwcDialog }) => {+ ct("only show event types select", async ({ mount, vaadinDialog }) => {const component = await mount(OrScheduler, {props: { header: "Test Calendar Event Component" },});await component.click();- const dialog = mwcDialog.getDialog();+ const dialog = vaadinDialog.getDialog();await expect(dialog.locator("#event-type")).toBeVisible();await expect(dialog.getByRole("button", { name: "Default", exact: true })).toBeVisible();@@ -88,7 +95,7 @@ ct.describe("Default event type should", () => {await expect(dialog.locator("#recurrence-ends")).not.toBeVisible();});- ct("return the default value", async ({ mount, mwcDialog, shared }) => {+ ct("return the default value", async ({ mount, vaadinDialog, shared }) => {const expected = { start: 0, end: 0 };const [promise, handler] = shared.promiseEventDispatch<OrSchedulerChangedEvent>();const component = await mount(OrScheduler, {@@ -99,31 +106,31 @@ ct.describe("Default event type should", () => {on: { "or-scheduler-changed": handler },});await component.click();- await mwcDialog.getDialog().getByRole("button", { name: "apply" }).click();+ await vaadinDialog.getDialog().getByRole("button", { name: "Save schedule" }).click();const actual = (await promise).value;- expect(actual).toStrictEqual({ ...expected, recurrence: undefined });- await expect(component.getByRole("button")).toContainText("Default");+ expect(actual).toStrictEqual(expected);+ await expect(component.getByRole("button", { name: "Default" })).toHaveCount(1);});});ct.describe("Period event type should", () => {- ct("show period inputs", async ({ mount, mwcDialog, mwcInput }) => {+ ct("show period inputs", async ({ mount, vaadinDialog, vaadinInput }) => {const component = await mount(OrScheduler, {props: { header: "Test Calendar Event Component" },});await component.click();- const dialog = mwcDialog.getDialog();- await selectEventType("Plan an occurrence", dialog, mwcInput);+ const dialog = vaadinDialog.getDialog();+ await selectEventType("Plan an occurrence", dialog, vaadinInput);await expect(dialog.locator("#event-type")).toBeVisible();await expect(dialog.getByRole("button", { name: "Plan an occurrence", exact: true })).toBeVisible();await expect(dialog.locator("#period")).toBeVisible();- await expect(dialog.locator("label", { hasText: "from" })).toHaveCount(2);- await expect(dialog.locator("label", { hasText: "from" }).last()).toBeHidden();- await expect(dialog.locator("label", { hasText: "to" })).toHaveCount(2);- await expect(dialog.locator("label", { hasText: "to" }).last()).toBeHidden();+ await expect(dialog.locator("or-vaadin-time-picker").first()).toBeHidden();+ await expect(dialog.locator("or-vaadin-time-picker").last()).toBeHidden();+ await expect(dialog.locator("label", { hasText: "from" })).toBeVisible();+ await expect(dialog.locator("label", { hasText: "to" })).toBeVisible();await expect(dialog.getByRole("checkbox", { checked: true, name: "All day" })).toBeVisible();await expect(dialog.locator("#recurrence")).not.toBeVisible();@@ -131,7 +138,7 @@ ct.describe("Period event type should", () => {await expect(dialog.locator("#recurrence-ends")).not.toBeVisible();});- ct("return the default value", async ({ mount, shared, mwcDialog, mwcInput }) => {+ ct("return the default value", async ({ mount, shared, vaadinDialog, vaadinInput }) => {const [promise, handler] = shared.promiseEventDispatch<OrSchedulerChangedEvent>();const component = await mount(OrScheduler, {props: { header: "Test Calendar Event Component" },@@ -139,18 +146,18 @@ ct.describe("Period event type should", () => {});await component.click();- const dialog = mwcDialog.getDialog();- await selectEventType("Plan an occurrence", dialog, mwcInput);- await dialog.getByRole("button", { name: "apply" }).click();+ const dialog = vaadinDialog.getDialog();+ await selectEventType("Plan an occurrence", dialog, vaadinInput);+ await dialog.getByRole("button", { name: "Save schedule" }).click();const actual = (await promise).value;const { start, end, timeLabel } = getPeriodValues();expect(actual).toStrictEqual({ end, start, recurrence: undefined });- await expect(component.getByRole("button")).toContainText("Active " + timeLabel);+ await expect(component.getByRole("button", { name: "Active " + timeLabel })).toBeVisible();});- ct("return period with time component", async ({ mount, shared, mwcDialog, mwcInput }) => {+ ct("return period with time component", async ({ mount, shared, vaadinDialog, vaadinInput }) => {const [promise, handler] = shared.promiseEventDispatch<OrSchedulerChangedEvent>();const component = await mount(OrScheduler, {props: { header: "Test Calendar Event Component" },@@ -158,16 +165,17 @@ ct.describe("Period event type should", () => {});await component.click();- const dialog = mwcDialog.getDialog();- await selectEventType("Plan an occurrence", dialog, mwcInput);+ const dialog = vaadinDialog.getDialog();+ await selectEventType("Plan an occurrence", dialog, vaadinInput);await dialog.getByRole("checkbox", { name: "All day" }).uncheck();- await expect(dialog.locator("label", { hasText: "from" }).last()).toBeVisible();- await dialog.locator("label", { hasText: "from" }).last().fill("09:00");- await expect(dialog.locator("label", { hasText: "to" }).last()).toBeVisible();- await dialog.locator("label", { hasText: "to" }).last().fill("18:00");-- await dialog.getByRole("button", { name: "apply" }).click();+ await expect(dialog.locator("or-vaadin-time-picker").first()).toBeVisible();+ await expect(dialog.locator("or-vaadin-time-picker").last()).toBeVisible();+ await dialog.locator("or-vaadin-time-picker [slot=input]").first().fill("09:00");+ await dialog.locator("or-vaadin-time-picker [slot=input]").first().press("Enter");+ await dialog.locator("or-vaadin-time-picker [slot=input]").last().fill("18:00");+ await dialog.locator("or-vaadin-time-picker [slot=input]").last().press("Enter");+ await dialog.getByRole("button", { name: "Save schedule" }).click();const actual = (await promise).value;const { start, end, timeLabel } = getPeriodValues({@@ -177,61 +185,69 @@ ct.describe("Period event type should", () => {});expect(actual).toStrictEqual({ end, start, recurrence: undefined });- await expect(component.getByRole("button")).toContainText("Active " + timeLabel);+ await expect(component.getByRole("button", { name: "Active " + timeLabel })).toBeVisible();});});ct.describe("Recurrence event type should", () => {- ct("show recurrence inputs", async ({ mount, mwcDialog, mwcInput }) => {+ ct("show recurrence inputs", async ({ mount, vaadinDialog, vaadinInput, shared }) => {const component = await mount(OrScheduler, {props: { header: "Test Calendar Event Component" },});await component.click();- const dialog = mwcDialog.getDialog();- await selectEventType("Plan a repeating occurrence", dialog, mwcInput);+ const dialog = vaadinDialog.getDialog();+ await selectEventType("Plan a repeating occurrence", dialog, vaadinInput);await expect(dialog.locator("#event-type")).toBeVisible();await expect(dialog.getByRole("button", { name: "Plan a repeating occurrence", exact: true })).toBeVisible();await expect(dialog.locator("#period")).toBeVisible();- await expect(dialog.locator("label", { hasText: "from" })).toHaveCount(2);- await expect(dialog.locator("label", { hasText: "from" }).last()).toBeHidden();- await expect(dialog.locator("label", { hasText: "to" })).toHaveCount(2);- await expect(dialog.locator("label", { hasText: "to" }).last()).toBeHidden();+ await expect(dialog.locator("label", { hasText: "from" })).toBeVisible();+ await expect(dialog.locator("label", { hasText: "to" })).toBeVisible();await expect(dialog.getByRole("checkbox", { checked: true, name: "All day" })).toBeVisible();+ await expect(dialog.locator("or-vaadin-time-picker").first()).toBeHidden();+ await expect(dialog.locator("or-vaadin-time-picker").last()).toBeHidden();await expect(dialog.locator("#recurrence")).toBeVisible();await dialog.getByRole("button", { name: "Day" }).click();- for (const [freq, parts] of Object.entries(NOT_APPLICABLE_BY_RRULE_PARTS)) {++ const weekDaysSelector = dialog+ .locator("or-vaadin-checkbox-group")+ .last()+ .getByRole("checkbox", { name: weekdays });+ const monthsSelector = dialog+ .locator("or-vaadin-checkbox-group")+ .first()+ .getByRole("checkbox", { name: months });++ for (const [freq, parts] of Object.entries(RFC_STRICT_NOT_APPLICABLE)) {if (freq === "SECONDLY") continue; // Intentionally skipped as its partially broken and unused- await mwcInput.getSelectInputOption(FREQUENCIES[freq as Frequency], dialog).click();- for (const part of BY_RRULE_PARTS.filter((p) => !parts.includes(p.toUpperCase()))) {+ await vaadinInput.getSelectInputOption(FREQUENCIES[freq as Frequency], dialog).click();+ for (const part of BY_RRULE_PARTS.filter((p) => !(parts as ByRRulePartsKeys[]).includes(p))) {if (part === "byweekday") {- await expect(- dialog.locator("or-mwc-input > .mdc-checkbox-list label", { hasText: /MO|TU|WE|TH|FR|SA|SU/ })- ).toHaveCount(7);+ await expect(weekDaysSelector).toHaveCount(7);} else if (part === "bymonth") {- await expect(- dialog.locator("or-mwc-input > .mdc-checkbox-list label", { hasText: months })- ).toHaveCount(12);+ await expect(monthsSelector).toHaveCount(12);} else {- await expect(dialog.getByRole("button", { name: part })).toBeVisible();+ await expect(+ dialog.getByRole("combobox", { name: await shared.translate(`rrule.${part}`) })+ ).toBeVisible();}}- for (const part of parts) {+ for (const part of parts as ByRRulePartsKeys[]) {if (part === "byweekday") {- await expect(- dialog.locator("or-mwc-input > .mdc-checkbox-list label", { hasText: /MO|TU|WE|TH|FR|SA|SU/ })- ).not.toBeVisible();+ await expect(weekDaysSelector).not.toBeVisible();} else if (part === "bymonth") {+ await expect(monthsSelector).not.toBeVisible();+ } else {await expect(- dialog.locator("or-mwc-input > .mdc-checkbox-list label", { hasText: months })+ dialog.getByRole("combobox", { name: await shared.translate(`rrule.${part}`) })).not.toBeVisible();- } else {- await expect(dialog.getByRole("button", { name: part })).not.toBeVisible();}}- await dialog.getByRole("button", { name: FREQUENCIES[freq as Frequency], exact: true }).click({ delay: 100 });+ await dialog+ .getByRole("button", { name: FREQUENCIES[freq as Frequency], exact: true })+ .click({ delay: 100 });}const ends = dialog.locator("#recurrence-ends");@@ -239,11 +255,11 @@ ct.describe("Recurrence event type should", () => {await expect(ends.getByRole("radio", { name: "Never" })).toBeChecked();await expect(ends.getByRole("radio", { name: "On" })).not.toBeChecked();await expect(ends.getByRole("radio", { name: "After" })).not.toBeChecked();- await expect(ends.locator("input[type=datetime-local]")).toBeDisabled();- await expect(ends.locator("input[type=number]")).toBeDisabled();+ await expect(ends.locator("or-vaadin-date-time-picker")).toBeDisabled();+ await expect(ends.getByRole("spinbutton")).toBeDisabled();});- ct("return the default value", async ({ mount, shared, mwcDialog, mwcInput }) => {+ ct("return the default value", async ({ mount, shared, vaadinDialog, vaadinInput }) => {const [promise, handler] = shared.promiseEventDispatch<OrSchedulerChangedEvent>();const component = await mount(OrScheduler, {props: { header: "Test Calendar Event Component" },@@ -251,19 +267,19 @@ ct.describe("Recurrence event type should", () => {});await component.click();- const dialog = mwcDialog.getDialog();- await selectEventType("Plan a repeating occurrence", dialog, mwcInput);+ const dialog = vaadinDialog.getDialog();+ await selectEventType("Plan a repeating occurrence", dialog, vaadinInput);- await dialog.getByRole("button", { name: "apply" }).click();+ await dialog.getByRole("button", { name: "Save schedule" }).click();const actual = (await promise).value;const { start, end } = getPeriodValues();expect(actual).toStrictEqual({ end, start, recurrence: "FREQ=DAILY" });- await expect(component.getByRole("button")).toContainText("every day");+ await expect(component.getByRole("button", { name: "every day" })).toBeVisible();});- ct("return recurrence with time components", async ({ mount, shared, mwcDialog, mwcInput }) => {+ ct("return recurrence with time components", async ({ mount, shared, vaadinDialog, vaadinInput }) => {const [promise, handler] = shared.promiseEventDispatch<OrSchedulerChangedEvent>();const component = await mount(OrScheduler, {props: { header: "Test Calendar Event Component" },@@ -271,21 +287,55 @@ ct.describe("Recurrence event type should", () => {});await component.click();- const dialog = mwcDialog.getDialog();- await selectEventType("Plan a repeating occurrence", dialog, mwcInput);+ const dialog = vaadinDialog.getDialog();+ await selectEventType("Plan a repeating occurrence", dialog, vaadinInput);await dialog.getByRole("checkbox", { name: "All day" }).uncheck();- await expect(dialog.locator("label", { hasText: "from" }).last()).toBeVisible();- await dialog.locator("label", { hasText: "from" }).last().fill("09:00");- await expect(dialog.locator("label", { hasText: "to" }).last()).toBeVisible();- await dialog.locator("label", { hasText: "to" }).last().fill("18:00");-- await dialog.getByRole("button", { name: "apply" }).click();+ await expect(dialog.locator("or-vaadin-time-picker").first()).toBeVisible();+ await expect(dialog.locator("or-vaadin-time-picker").last()).toBeVisible();+ await dialog.locator("or-vaadin-time-picker [slot=input]").first().fill("09:00");+ await dialog.locator("or-vaadin-time-picker [slot=input]").first().press("Enter");+ await dialog.locator("or-vaadin-time-picker [slot=input]").last().fill("18:00");+ await dialog.locator("or-vaadin-time-picker [slot=input]").last().press("Enter");+ await dialog.getByRole("button", { name: "Save schedule" }).click();const actual = (await promise).value;const { start, end, timeLabel } = getPeriodValues({ start: 9 * HOUR_IN_MILLIS, end: 18 * HOUR_IN_MILLIS });expect(actual).toStrictEqual({ end, start, recurrence: "FREQ=DAILY" });- await expect(component.getByRole("button")).toContainText("every day " + timeLabel, { ignoreCase: true });+ await expect(component.getByRole("button", { name: "every day " + timeLabel })).toBeVisible();+ });+});++ct.describe("Removable button", () => {+ ct("should show when enabled", async ({ mount, vaadinDialog }) => {+ const component = await mount(OrScheduler, {+ props: { header: "Test Calendar Event Component", removable: true },+ });+ await component.click();+ const dialog = vaadinDialog.getDialog();+ await expect(dialog.getByRole("button", { name: "Delete schedule" })).toBeVisible();+ });++ ct("should not show when disabled", async ({ mount, vaadinDialog }) => {+ const component = await mount(OrScheduler, {+ props: { header: "Test Calendar Event Component", removable: false },+ });+ await component.click();+ const dialog = vaadinDialog.getDialog();+ await expect(dialog.getByRole("button", { name: "Delete schedule" })).toBeHidden();+ });++ ct("should fire removed event when clicked", async ({ mount, vaadinDialog, shared }) => {+ const [promise, handler] = shared.promiseEventDispatch<OrSchedulerRemovedEvent>();+ const component = await mount(OrScheduler, {+ props: { header: "Test Calendar Event Component", removable: true },+ on: { "or-scheduler-removed": handler },+ });+ await component.click();+ const dialog = vaadinDialog.getDialog();+ await dialog.getByRole("button", { name: "Delete schedule" }).click();+ await expect(promise).resolves.toBeNull();+ await expect(dialog).toBeHidden();});});diff --git a/ui/component/or-scheduler/tsconfig.json b/ui/component/or-scheduler/tsconfig.jsonindex 67127e1ab..3b50d5ef2 100644--- a/ui/component/or-scheduler/tsconfig.json+++ b/ui/component/or-scheduler/tsconfig.json@@ -8,7 +8,9 @@"./src"],"references": [+ { "path": "../model" },+ { "path": "../core" },{ "path": "../or-translate" },- { "path": "../or-mwc-components" }+ { "path": "../or-vaadin-components" }]}diff --git a/ui/component/or-vaadin-components/README.md b/ui/component/or-vaadin-components/README.mdindex 79a31294c..982f00e81 100644--- a/ui/component/or-vaadin-components/README.md+++ b/ui/component/or-vaadin-components/README.md@@ -14,15 +14,30 @@ yarn add @openremote/or-vaadin-components### JavaScript / TypeScript example using a Text FieldNote: using the `document.createElement()` API is an example here. Please check the documentation of your JavaScript framework for proper installation of Lit web components.```typescript-import "@openremote/or-vaadin-components/or-vaadin-textfield";+import "@openremote/or-vaadin-components/or-vaadin-text-field";// Load text field into the app-const textField = document.createElement("or-vaadin-textfield");+const textField = document.createElement("or-vaadin-text-field");textField.setAttribute("label", "Company name");textField.setAttribute("value", "OpenRemote");document.body.appendChild(textField);```+### Group fields+The group fields `or-vaadin-checkbox-group` and `or-vaadin-radio-group` should use the "native" Vaadin child components, `vaadin-checkbox` and `vaadin-radio-button`, respectively. These are registered when importing the group fields.++```html+<or-vaadin-checkbox-group>+ <vaadin-checkbox></vaadin-checkbox>+ <vaadin-checkbox></vaadin-checkbox>+</or-vaadin-checkbox-group>++<or-vaadin-radio-group>+ <vaadin-radio-button></vaadin-radio-button>+ <vaadin-radio-button></vaadin-radio-button>+</or-vaadin-radio-group>+```+## License[GNU AGPL](https://www.gnu.org/licenses/agpl-3.0.en.html)diff --git a/ui/component/or-vaadin-components/package.json b/ui/component/or-vaadin-components/package.jsonindex 813b0a50e..12e14e4ee 100644--- a/ui/component/or-vaadin-components/package.json+++ b/ui/component/or-vaadin-components/package.json@@ -35,12 +35,20 @@"@openremote/model": "workspace:*","@vaadin/button": "~25.0.3","@vaadin/checkbox": "~25.0.3",+ "@vaadin/checkbox-group": "~25.0.3",+ "@vaadin/date-picker": "~25.0.3",+ "@vaadin/date-time-picker": "~25.0.3","@vaadin/dialog": "~25.0.3",+ "@vaadin/icon": "~25.0.3",+ "@vaadin/icons": "~25.0.3",+ "@vaadin/multi-select-combo-box": "~25.0.3","@vaadin/number-field": "~25.0.3","@vaadin/password-field": "~25.0.3",+ "@vaadin/radio-group": "~25.0.3","@vaadin/select": "~25.0.3","@vaadin/text-area": "~25.0.3","@vaadin/text-field": "~25.0.3",+ "@vaadin/time-picker": "~25.0.3","lit": "^3.3.1"},"publishConfig": {diff --git a/ui/component/or-vaadin-components/src/or-vaadin-button.ts b/ui/component/or-vaadin-components/src/or-vaadin-button.tsindex 3a3b6fba9..8866c9887 100644--- a/ui/component/or-vaadin-components/src/or-vaadin-button.ts+++ b/ui/component/or-vaadin-components/src/or-vaadin-button.ts@@ -17,11 +17,9 @@* You should have received a copy of the GNU Affero General Public License* along with this program. If not, see <http://www.gnu.org/licenses/>.*/-import {customElement} from "lit/decorators.js";-import {Button} from "@vaadin/button";-import {OrVaadinComponent} from "./util";+import { customElement } from "lit/decorators.js";+import { Button } from "@vaadin/button";+import { OrVaadinComponent } from "./util";@customElement("or-vaadin-button")-export class OrVaadinButton extends Button implements OrVaadinComponent {--}+export class OrVaadinButton extends Button implements OrVaadinComponent {}diff --git a/ui/component/or-vaadin-components/src/or-vaadin-checkbox-group.ts b/ui/component/or-vaadin-components/src/or-vaadin-checkbox-group.tsnew file mode 100644index 000000000..02340bde2--- /dev/null+++ b/ui/component/or-vaadin-components/src/or-vaadin-checkbox-group.ts@@ -0,0 +1,28 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+import { customElement } from "lit/decorators.js";+import { CheckboxGroup } from "@vaadin/checkbox-group";+import { OrVaadinComponent } from "./util";+import "@vaadin/checkbox";++export type * from "@vaadin/checkbox-group";++@customElement("or-vaadin-checkbox-group")+export class OrVaadinCheckboxGroup extends CheckboxGroup implements OrVaadinComponent {}diff --git a/ui/component/or-vaadin-components/src/or-vaadin-date-picker.ts b/ui/component/or-vaadin-components/src/or-vaadin-date-picker.tsnew file mode 100644index 000000000..d3ebbb2e5--- /dev/null+++ b/ui/component/or-vaadin-components/src/or-vaadin-date-picker.ts@@ -0,0 +1,25 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+import { customElement } from "lit/decorators.js";+import { DatePicker } from "@vaadin/date-picker";+import { OrVaadinComponent } from "./util";++@customElement("or-vaadin-date-picker")+export class OrVaadinDatePicker extends DatePicker implements OrVaadinComponent {}diff --git a/ui/component/or-vaadin-components/src/or-vaadin-date-time-picker.ts b/ui/component/or-vaadin-components/src/or-vaadin-date-time-picker.tsnew file mode 100644index 000000000..3425e6bc7--- /dev/null+++ b/ui/component/or-vaadin-components/src/or-vaadin-date-time-picker.ts@@ -0,0 +1,25 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+import { customElement } from "lit/decorators.js";+import { DateTimePicker } from "@vaadin/date-time-picker";+import { OrVaadinComponent } from "./util";++@customElement("or-vaadin-date-time-picker")+export class OrVaadinDateTimePicker extends DateTimePicker implements OrVaadinComponent {}diff --git a/ui/component/or-vaadin-components/src/or-vaadin-dialog.ts b/ui/component/or-vaadin-components/src/or-vaadin-dialog.tsindex 0174752ee..eedf06873 100644--- a/ui/component/or-vaadin-components/src/or-vaadin-dialog.ts+++ b/ui/component/or-vaadin-components/src/or-vaadin-dialog.ts@@ -17,19 +17,47 @@* You should have received a copy of the GNU Affero General Public License* along with this program. If not, see <http://www.gnu.org/licenses/>.*/-import {Dialog} from "@vaadin/dialog";-import {OrVaadinComponent} from "./util";-import {customElement} from "lit/decorators.js";+import { Dialog } from "@vaadin/dialog";+import { OrVaadinComponent } from "./util";+import { customElement } from "lit/decorators.js";+import { css, LitElement } from "lit";/*** Vaadin uses custom directives for rendering the dialog content.* https://lit.dev/docs/templates/custom-directives/* https://vaadin.com/docs/latest/components/dialog/*/-export {dialogHeaderRenderer, DialogHeaderRendererDirective, dialogRenderer, DialogRendererDirective, dialogFooterRenderer, DialogFooterRendererDirective} from "@vaadin/dialog/lit.js";+export {+ dialogHeaderRenderer,+ DialogHeaderRendererDirective,+ dialogRenderer,+ DialogRendererDirective,+ dialogFooterRenderer,+ DialogFooterRendererDirective,+} from "@vaadin/dialog/lit.js";++type WithLit<T> = T & typeof LitElement;@customElement("or-vaadin-dialog")export class OrVaadinDialog extends Dialog implements OrVaadinComponent {+ static get styles() {+ return [+ (Dialog as WithLit<typeof Dialog>).styles,+ css`+ ::part(header),+ ::part(content) {+ background-color: var(--lumo-contrast-5pct);+ }+ ::part(header),+ ::part(footer) {+ padding: var(--lumo-space-l);+ }+ ::part(content) {+ padding: 0 var(--lumo-space-l);+ }+ `,+ ];+ }public open() {this.setAttribute("opened", "true");diff --git a/ui/component/or-vaadin-components/src/or-vaadin-icon.ts b/ui/component/or-vaadin-components/src/or-vaadin-icon.tsnew file mode 100644index 000000000..350b8da60--- /dev/null+++ b/ui/component/or-vaadin-components/src/or-vaadin-icon.ts@@ -0,0 +1,27 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+import { customElement } from "lit/decorators.js";+import { Icon } from "@vaadin/icon";+import { OrVaadinComponent } from "./util";+import "@vaadin/icons";+import "@vaadin/vaadin-lumo-styles/vaadin-iconset.js";++@customElement("or-vaadin-icon")+export class OrVaadinIcon extends Icon implements OrVaadinComponent {}diff --git a/ui/component/or-vaadin-components/src/or-vaadin-input.ts b/ui/component/or-vaadin-components/src/or-vaadin-input.tsindex d9330907d..7b7abd23b 100644--- a/ui/component/or-vaadin-components/src/or-vaadin-input.ts+++ b/ui/component/or-vaadin-components/src/or-vaadin-input.ts@@ -21,11 +21,10 @@ import {css, html, LitElement, PropertyValues, TemplateResult} from "lit";import {customElement, property, query} from "lit/decorators.js";import {InputType} from "./util";import "./or-vaadin-checkbox";-import "./or-vaadin-numberfield";-import "./or-vaadin-passwordfield";-import "./or-vaadin-textfield";-import "./or-vaadin-textarea";-import "./or-vaadin-select";+import "./or-vaadin-number-field";+import "./or-vaadin-password-field";+import "./or-vaadin-text-field";+import "./or-vaadin-text-area";/*** Function to register properties (get/setter) of a CustomElement to the child Vaadin element.@@ -56,11 +55,11 @@ export class OrVaadinInput extends LitElement {* Be aware: all CustomElements defined here need to be imported during initialization; dynamic imports are not expected to work.*/public static readonly VAADIN_CLASSES: (CustomElementConstructor | undefined)[] = [- customElements.get("or-vaadin-numberfield"),- customElements.get("or-vaadin-passwordfield"),+ customElements.get("or-vaadin-number-field"),+ customElements.get("or-vaadin-password-field"),customElements.get("or-vaadin-select"),- customElements.get("or-vaadin-textarea"),- customElements.get("or-vaadin-textfield")+ customElements.get("or-vaadin-text-area"),+ customElements.get("or-vaadin-text-field")];/**@@ -69,13 +68,13 @@ export class OrVaadinInput extends LitElement {* The map value contains a function, with an {@link onChange} callback parameter for handling events.*/public static readonly TEMPLATES = new Map<InputType, (onChange: (ev: Event) => void) => TemplateResult>([- [InputType.CHECKBOX, OrVaadinInput.getCheckboxTemplate],[InputType.BIG_INT, OrVaadinInput.getNumberFieldTemplate],+ [InputType.CHECKBOX, OrVaadinInput.getCheckboxTemplate],[InputType.NUMBER, OrVaadinInput.getNumberFieldTemplate],- [InputType.TEXTAREA, OrVaadinInput.getTextAreaTemplate],- [InputType.TEXT, OrVaadinInput.getTextFieldTemplate],[InputType.PASSWORD, OrVaadinInput.getPasswordFieldTemplate],- [InputType.SELECT, OrVaadinInput.getSelectTemplate]+ [InputType.SELECT, OrVaadinInput.getSelectTemplate],+ [InputType.TEXT, OrVaadinInput.getTextFieldTemplate],+ [InputType.TEXTAREA, OrVaadinInput.getTextAreaTemplate],]);/**@@ -92,7 +91,7 @@ export class OrVaadinInput extends LitElement {/*** List of forbidden attributes that are not processed nor "bubbled down" to the child Vaadin component.- * So `<or-vaadin-input id="myId" type="text">`, wouldn't render `<or-vaadin-textfield id="myId">`, but `<or-vaadin-textfield>`.+ * So `<or-vaadin-input id="myId" type="text">`, wouldn't render `<or-vaadin-text-field id="myId">`, but `<or-vaadin-text-field>`.*/public static readonly FORBIDDEN_ATTRIBUTES = ["id"];@@ -248,23 +247,23 @@ export class OrVaadinInput extends LitElement {}public static getNumberFieldTemplate(onChange?: (e: Event) => void) {- return html`<or-vaadin-numberfield id="elem" @change=${onChange}></or-vaadin-numberfield>`;+ return html`<or-vaadin-number-field id="elem" @change=${onChange}></or-vaadin-number-field>`;}- public static getTextAreaTemplate(onChange?: (e: Event) => void) {- return html`<or-vaadin-textarea id="elem" @change=${onChange}></or-vaadin-textarea>`;+ public static getPasswordFieldTemplate(onChange?: (e: Event) => void) {+ return html`<or-vaadin-password-field id="elem" @change=${onChange}></or-vaadin-password-field>`;}- public static getTextFieldTemplate(onChange?: (e: Event) => void) {- return html`<or-vaadin-textfield id="elem" @change=${onChange}></or-vaadin-textfield>`;+ public static getSelectTemplate(onChange?: (e: Event) => void) {+ return html`<or-vaadin-select id="elem" @change=${onChange}></or-vaadin-select>`;}- public static getPasswordFieldTemplate(onChange?: (e: Event) => void) {- return html`<or-vaadin-passwordfield id="elem" @change=${onChange}></or-vaadin-passwordfield>`;+ public static getTextAreaTemplate(onChange?: (e: Event) => void) {+ return html`<or-vaadin-text-area id="elem" @change=${onChange}></or-vaadin-text-area>`;}- public static getSelectTemplate(onChange?: (e: Event) => void) {- return html`<or-vaadin-select id="elem" @change=${onChange}></or-vaadin-select>`;+ public static getTextFieldTemplate(onChange?: (e: Event) => void) {+ return html`<or-vaadin-text-field id="elem" @change=${onChange}></or-vaadin-text-field>`;}}diff --git a/ui/component/or-vaadin-components/src/or-vaadin-multi-select-combo-box.ts b/ui/component/or-vaadin-components/src/or-vaadin-multi-select-combo-box.tsnew file mode 100644index 000000000..f29993d9f--- /dev/null+++ b/ui/component/or-vaadin-components/src/or-vaadin-multi-select-combo-box.ts@@ -0,0 +1,26 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+import { customElement } from "lit/decorators.js";+import { MultiSelectComboBox } from "@vaadin/multi-select-combo-box";+import { OrVaadinComponent } from "./util";++@customElement("or-vaadin-multi-select-combo-box")+export class OrVaadinMultiSelectComboBox extends MultiSelectComboBox implements OrVaadinComponent {+}diff --git a/ui/component/or-vaadin-components/src/or-vaadin-numberfield.ts b/ui/component/or-vaadin-components/src/or-vaadin-number-field.tssimilarity index 92%rename from ui/component/or-vaadin-components/src/or-vaadin-numberfield.tsrename to ui/component/or-vaadin-components/src/or-vaadin-number-field.tsindex d3b1f3f99..8ecd4962f 100644--- a/ui/component/or-vaadin-components/src/or-vaadin-numberfield.ts+++ b/ui/component/or-vaadin-components/src/or-vaadin-number-field.ts@@ -22,8 +22,8 @@ import {NumberField} from "@vaadin/number-field";import {OrVaadinComponent} from "./util";import {LitElement} from "lit";-@customElement("or-vaadin-numberfield")-export class OrVaadinNumberfield extends (NumberField as new () => NumberField & LitElement) implements OrVaadinComponent {+@customElement("or-vaadin-number-field")+export class OrVaadinNumberField extends (NumberField as new () => NumberField & LitElement) implements OrVaadinComponent {override _onEnter(ev: KeyboardEvent) {this.dispatchEvent(new CustomEvent("submit", {bubbles: true, composed: true}));diff --git a/ui/component/or-vaadin-components/src/or-vaadin-passwordfield.ts b/ui/component/or-vaadin-components/src/or-vaadin-password-field.tssimilarity index 96%rename from ui/component/or-vaadin-components/src/or-vaadin-passwordfield.tsrename to ui/component/or-vaadin-components/src/or-vaadin-password-field.tsindex bcf20824e..62f44f14f 100644--- a/ui/component/or-vaadin-components/src/or-vaadin-passwordfield.ts+++ b/ui/component/or-vaadin-components/src/or-vaadin-password-field.ts@@ -22,7 +22,7 @@ import {PasswordField} from "@vaadin/password-field";import {OrVaadinComponent} from "./util";import {LitElement} from "lit";-@customElement("or-vaadin-passwordfield")+@customElement("or-vaadin-password-field")export class OrVaadinPasswordField extends (PasswordField as new () => PasswordField & LitElement) implements OrVaadinComponent {override _onEnter(ev: KeyboardEvent) {diff --git a/ui/component/or-vaadin-components/src/or-vaadin-radio-group.ts b/ui/component/or-vaadin-components/src/or-vaadin-radio-group.tsnew file mode 100644index 000000000..27b01273d--- /dev/null+++ b/ui/component/or-vaadin-components/src/or-vaadin-radio-group.ts@@ -0,0 +1,25 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+import { customElement } from "lit/decorators.js";+import { RadioGroup } from "@vaadin/radio-group";+import { OrVaadinComponent } from "./util";++@customElement("or-vaadin-radio-group")+export class OrVaadinRadioGroup extends RadioGroup implements OrVaadinComponent {}diff --git a/ui/component/or-vaadin-components/src/or-vaadin-select.ts b/ui/component/or-vaadin-components/src/or-vaadin-select.tsindex ce44eecd4..874d48828 100644--- a/ui/component/or-vaadin-components/src/or-vaadin-select.ts+++ b/ui/component/or-vaadin-components/src/or-vaadin-select.ts@@ -23,5 +23,4 @@ import {OrVaadinComponent} from "./util";@customElement("or-vaadin-select")export class OrVaadinSelect extends Select implements OrVaadinComponent {-}diff --git a/ui/component/or-vaadin-components/src/or-vaadin-textarea.ts b/ui/component/or-vaadin-components/src/or-vaadin-text-area.tssimilarity index 92%rename from ui/component/or-vaadin-components/src/or-vaadin-textarea.tsrename to ui/component/or-vaadin-components/src/or-vaadin-text-area.tsindex 96e99ffa9..55d44ba11 100644--- a/ui/component/or-vaadin-components/src/or-vaadin-textarea.ts+++ b/ui/component/or-vaadin-components/src/or-vaadin-text-area.ts@@ -22,8 +22,8 @@ import {TextArea} from "@vaadin/text-area";import {OrVaadinComponent} from "./util";import {LitElement} from "lit";-@customElement("or-vaadin-textarea")-export class OrVaadinTextarea extends (TextArea as new () => TextArea & LitElement) implements OrVaadinComponent {+@customElement("or-vaadin-text-area")+export class OrVaadinTextArea extends (TextArea as new () => TextArea & LitElement) implements OrVaadinComponent {override _onEnter(ev: KeyboardEvent) {this.dispatchEvent(new CustomEvent("submit", {bubbles: true, composed: true}));diff --git a/ui/component/or-vaadin-components/src/or-vaadin-textfield.ts b/ui/component/or-vaadin-components/src/or-vaadin-text-field.tssimilarity index 92%rename from ui/component/or-vaadin-components/src/or-vaadin-textfield.tsrename to ui/component/or-vaadin-components/src/or-vaadin-text-field.tsindex 88626e2e0..0e23fe514 100644--- a/ui/component/or-vaadin-components/src/or-vaadin-textfield.ts+++ b/ui/component/or-vaadin-components/src/or-vaadin-text-field.ts@@ -22,8 +22,8 @@ import {TextField} from "@vaadin/text-field";import {LitElement} from "lit";import {OrVaadinComponent} from "./util";-@customElement("or-vaadin-textfield")-export class OrVaadinTextfield extends (TextField as new () => TextField & LitElement) implements OrVaadinComponent {+@customElement("or-vaadin-text-field")+export class OrVaadinTextField extends (TextField as new () => TextField & LitElement) implements OrVaadinComponent {override _onEnter(ev: KeyboardEvent) {this.dispatchEvent(new CustomEvent("submit", {bubbles: true, composed: true}));diff --git a/ui/component/or-vaadin-components/src/or-vaadin-time-picker.ts b/ui/component/or-vaadin-components/src/or-vaadin-time-picker.tsnew file mode 100644index 000000000..824ac9dc6--- /dev/null+++ b/ui/component/or-vaadin-components/src/or-vaadin-time-picker.ts@@ -0,0 +1,25 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+import { customElement } from "lit/decorators.js";+import { TimePicker } from "@vaadin/time-picker";+import { OrVaadinComponent } from "./util";++@customElement("or-vaadin-time-picker")+export class OrVaadinTimePicker extends TimePicker implements OrVaadinComponent {}diff --git a/ui/component/or-vaadin-components/src/util.ts b/ui/component/or-vaadin-components/src/util.tsindex 57aa7e758..f2b6ecf5a 100644--- a/ui/component/or-vaadin-components/src/util.ts+++ b/ui/component/or-vaadin-components/src/util.ts@@ -17,39 +17,6 @@* You should have received a copy of the GNU Affero General Public License* along with this program. If not, see <http://www.gnu.org/licenses/>.*/-import {Util} from "@openremote/core";-import {WellknownMetaItems, WellknownValueTypes} from "@openremote/model";-import type {- AssetDescriptor,- Attribute,- AttributeDescriptor,- MetaHolder,- NameHolder,- NameValueHolder,- ValueConstraint,- ValueConstraintAllowedValues,- ValueConstraintFuture,- ValueConstraintFutureOrPresent,- ValueConstraintMax,- ValueConstraintMin,- ValueConstraintNotBlank,- ValueConstraintNotEmpty,- ValueConstraintNotNull,- ValueConstraintPast,- ValueConstraintPastOrPresent,- ValueConstraintPattern,- ValueConstraintSize,- ValueDescriptor,- ValueDescriptorHolder,- ValueFormat,- ValueHolder-} from "@openremote/model";-import {html, TemplateResult} from "lit";-import {Ref, ref, createRef} from "lit/directives/ref.js";-import {ifDefined} from "lit/directives/if-defined.js";-import {styleMap} from "lit/directives/style-map.js";-import {OrVaadinInput} from "./or-vaadin-input";-export enum InputType {BUTTON = "button",BUTTON_TOGGLE = "button-toggle",@@ -87,38 +54,12 @@ export interface OrVaadinComponent {getAttributeNames(): string[];}-export interface ValueInputProviderOptions {- label?: string;- required?: boolean;- readonly?: boolean;- disabled?: boolean;- compact?: boolean;- rounded?: boolean;- outlined?: boolean;- comfortable?: boolean;- resizeVertical?: boolean;- inputType?: InputType;-}--export interface ValueInputProvider {- templateFunction: ValueInputTemplateFunction;- supportsHelperText: boolean;- supportsLabel: boolean;- supportsSendButton: boolean;- validator?: () => boolean;-}--export type ValueInputTemplateFunction = ((value: any, focused: boolean, loading: boolean, sending: boolean, error: boolean, helperText: string | undefined) => TemplateResult | PromiseLike<TemplateResult>) | undefined;--export type ValueInputProviderGenerator = (assetDescriptor: AssetDescriptor | string, valueHolder: NameHolder & ValueHolder<any> | undefined, valueHolderDescriptor: ValueDescriptorHolder | undefined, valueDescriptor: ValueDescriptor- , valueChangeNotifier: (value: any, updateImmediately?: boolean) => void, options: ValueInputProviderOptions) => ValueInputProvider;-/*** Returns whether the {@link InputType} should show a "send" button within the attribute input UI.* Some input types have internal mechanics for updating attributes, which is why they should return `false`.* Generic input types, like a text field, "support a send button", so should return `true`*/-function inputTypeSupportsSendButton(inputType: InputType): boolean {+export function inputTypeSupportsSendButton(inputType: InputType): boolean {return inputType === InputType.NUMBER|| inputType === InputType.BIG_INT|| inputType === InputType.TELEPHONE@@ -136,309 +77,10 @@ function inputTypeSupportsSendButton(inputType: InputType): boolean {|| inputType === InputType.WEEK;}-function inputTypeSupportsHelperText(inputType: InputType) {+export function inputTypeSupportsHelperText(inputType: InputType) {return inputTypeSupportsSendButton(inputType) || inputType === InputType.SELECT;}-function inputTypeSupportsLabel(inputType: InputType) {+export function inputTypeSupportsLabel(inputType: InputType) {return inputTypeSupportsHelperText(inputType) || inputType === InputType.CHECKBOX || inputType === InputType.BUTTON_MOMENTARY;}--/**- * Internal function to retrieve HTML template based on the Asset-, attribute-, and value descriptors- * It generates a template using `or-vaadin-input`, together with respective HTML attributes like min/max, pattern, and of course 'input type'.- * For example, a 'positive number' attribute will render a `<or-vaadin-input type="number" min="0">`.- * If the Vaadin input doesn't support the 'input type', it will automatically fall back to the older `or-mwc-input`.- *- * This is mostly copied over from `or-mwc-input`, so this will need optimizing once that has been deprecated.- */-export const getValueHolderInputTemplateProvider: ValueInputProviderGenerator = (assetDescriptor, valueHolder, valueHolderDescriptor, valueDescriptor, valueChangeNotifier, options) => {-- let inputType: InputType | undefined = options.inputType;- let step: number | undefined;- let pattern: string | undefined;- let min: any;- let max: any;- let multiple: any;- let required: boolean | undefined;- let selectOptions: { label: string, value: string }[] | undefined;- let valueConverter: (v: any) => any | undefined;- const styles = {} as any;-- const assetType = typeof assetDescriptor === "string" ? assetDescriptor : assetDescriptor.name;- const constraints: ValueConstraint[] = (valueHolder && ((valueHolder as MetaHolder).meta) || (valueDescriptor && (valueDescriptor as MetaHolder).meta) ? Util.getAttributeValueConstraints(valueHolder as Attribute<any>, valueHolderDescriptor as AttributeDescriptor, assetType) : Util.getMetaValueConstraints(valueHolder as NameValueHolder<any>, valueHolderDescriptor as AttributeDescriptor, assetType)) || [];- const format: ValueFormat | undefined = (valueHolder && ((valueHolder as MetaHolder).meta) || (valueDescriptor && (valueDescriptor as MetaHolder).meta) ? Util.getAttributeValueFormat(valueHolder as Attribute<any>, valueHolderDescriptor as AttributeDescriptor, assetType) : Util.getMetaValueFormat(valueHolder as Attribute<any>, valueHolderDescriptor as AttributeDescriptor, assetType));-- const supportsVaadinInput = (type: InputType) => (OrVaadinInput.TEMPLATES.has(type) && !format?.asSlider && !format?.asOnOff);-- // Determine input type- if (!inputType) {- switch (valueDescriptor.name) {- case WellknownValueTypes.TEXT:- case WellknownValueTypes.EMAIL:- case WellknownValueTypes.UUID:- case WellknownValueTypes.ASSETID:- case WellknownValueTypes.HOSTORIPADDRESS:- case WellknownValueTypes.IPADDRESS:- inputType = Util.getMetaValue(WellknownMetaItems.MULTILINE, valueHolder, valueHolderDescriptor) === true ? InputType.TEXTAREA : InputType.TEXT;- break;- case WellknownValueTypes.BOOLEAN:- if (format && format.asNumber) {- inputType = InputType.NUMBER;- step = 1;- min = 0;- max = 1;- valueConverter = v => !!v;- break;- }- if (format && (format.asOnOff || format.asOpenClosed)) {- inputType = InputType.SWITCH;- } else {- inputType = InputType.CHECKBOX;- }-- if ((format && format.asMomentary) || (Util.getMetaValue(WellknownMetaItems.MOMENTARY, valueHolder, valueHolderDescriptor) === true) ) {- inputType = InputType.BUTTON_MOMENTARY;- }- break;- case WellknownValueTypes.BIGNUMBER:- case WellknownValueTypes.NUMBER:- case WellknownValueTypes.POSITIVEINTEGER:- case WellknownValueTypes.POSITIVENUMBER:- case WellknownValueTypes.LONG:- case WellknownValueTypes.INTEGER:- case WellknownValueTypes.BYTE:- case WellknownValueTypes.INTEGERBYTE:- case WellknownValueTypes.DIRECTION:- case WellknownValueTypes.TCPIPPORTNUMBER:- if (valueDescriptor.name === WellknownValueTypes.BYTE || valueDescriptor.name === WellknownValueTypes.INTEGERBYTE) {- min = 0;- max = 255;- step = 1;- } else if (valueDescriptor.name === WellknownValueTypes.INTEGER || valueDescriptor.name === WellknownValueTypes.LONG) {- step = 1;- }- if (format && format.asDate) {- inputType = InputType.DATETIME;- } else if (format && format.asBoolean) {- inputType = InputType.CHECKBOX;- valueConverter = v => v ? 1 : 0;- } else if (format && format.asSlider) {- inputType = InputType.RANGE;- } else {- inputType = InputType.NUMBER;- }- break;- case WellknownValueTypes.BIGINTEGER:- inputType = InputType.BIG_INT;- step = 1;- break;- case WellknownValueTypes.COLOURRGB:- inputType = InputType.COLOUR;- break;- case WellknownValueTypes.DATEANDTIME:- case WellknownValueTypes.TIMESTAMP:- case WellknownValueTypes.TIMESTAMPISO8601:- inputType = InputType.DATETIME;- break;- case WellknownValueTypes.CRONEXPRESSION:- inputType = InputType.CRON;- break;- case WellknownValueTypes.TIMEDURATIONISO8601:- inputType = InputType.DURATION_TIME;- break;- case WellknownValueTypes.PERIODDURATIONISO8601:- inputType = InputType.DURATION_PERIOD;- break;- case WellknownValueTypes.TIMEANDPERIODDURATIONISO8601:- inputType = InputType.DURATION;- break;- case WellknownValueTypes.JSONOBJECT:- inputType = InputType.JSON_OBJECT;- break;- }-- if (valueDescriptor.arrayDimensions && valueDescriptor.arrayDimensions > 0) {- inputType = InputType.JSON;- }- }-- if (!inputType) {- switch (valueDescriptor.jsonType) {- case "number":- case "bigint":- inputType = InputType.NUMBER;- break;- case "boolean":- inputType = InputType.CHECKBOX;- break;- case "string":- inputType = InputType.TEXT;- break;- case "date":- inputType = InputType.DATETIME;- break;- default:- break;- }- }-- if (!inputType) {- inputType = InputType.JSON;- }-- // Apply any constraints- const sizeConstraint = constraints?.find(c => c.type === "size") as ValueConstraintSize;- const patternConstraint = constraints?.find(c => c.type === "pattern") as ValueConstraintPattern;- const minConstraint = constraints?.find(c => c.type === "min") as ValueConstraintMin;- const maxConstraint = constraints?.find(c => c.type === "max") as ValueConstraintMax;- const allowedValuesConstraint = constraints?.find(c => c.type === "allowedValues") as ValueConstraintAllowedValues;- const pastConstraint = constraints?.find(c => c.type === "past") as ValueConstraintPast;- const pastOrPresentConstraint = constraints?.find(c => c.type === "pastOrPresent") as ValueConstraintPastOrPresent;- const futureConstraint = constraints?.find(c => c.type === "future") as ValueConstraintFuture;- const futureOrPresentConstraint = constraints?.find(c => c.type === "futureOrPresent") as ValueConstraintFutureOrPresent;- const notEmptyConstraint = constraints?.find(c => c.type === "notEmpty") as ValueConstraintNotEmpty;- const notBlankConstraint = constraints?.find(c => c.type === "notBlank") as ValueConstraintNotBlank;- const notNullConstraint = constraints?.find(c => c.type === "notNull") as ValueConstraintNotNull;-- if (sizeConstraint) {- min = sizeConstraint.min;- max = sizeConstraint.max;- }- if (minConstraint) {- min = minConstraint.min;- }- if (maxConstraint) {- max = maxConstraint.max;- }- if (patternConstraint) {- pattern = patternConstraint.regexp;- }- if (notNullConstraint) {- required = true;- }- if (notBlankConstraint && !pattern) {- pattern = String.raw`\S+`;- } else if (notEmptyConstraint && !pattern) {- pattern = ".+";- }- if (allowedValuesConstraint?.allowedValues) {- const allowedLabels = allowedValuesConstraint.allowedValueNames && allowedValuesConstraint.allowedValueNames.length === allowedValuesConstraint.allowedValues.length ? allowedValuesConstraint.allowedValueNames : undefined;- selectOptions = allowedValuesConstraint.allowedValues.map((v, i) => {- let label = allowedLabels ? allowedLabels[i] : "" + v;- label = Util.getAllowedValueLabel(label)!;- return {- value: v,- label: label || "" + v- };- });- inputType = InputType.SELECT;-- if (valueDescriptor.arrayDimensions && valueDescriptor.arrayDimensions > 0) {- multiple = true;- }- }-- if (inputType === InputType.DATETIME) {- if (pastConstraint || pastOrPresentConstraint) {- min = undefined;- max = new Date();- } else if (futureConstraint || futureOrPresentConstraint) {- min = new Date();- max = undefined;- }-- // Refine the input type based on formatting- if (format) {- if (format.timeStyle && !format.dateStyle) {- inputType = InputType.TIME;- } else if (format.dateStyle && !format.timeStyle) {- inputType = InputType.DATE;- }- }- }-- if (inputType === InputType.NUMBER && format?.resolution) {- step = format.resolution;- }-- if (inputType === InputType.COLOUR) {- styles.marginLeft = "24px";- }-- const supportsHelperText = inputTypeSupportsHelperText(inputType);- const supportsLabel = inputTypeSupportsLabel(inputType);- const supportsSendButton = inputTypeSupportsSendButton(inputType);- const readonly = options.readonly;- required = required || options.required;- const comfortable = options.comfortable;- const resizeVertical = options.resizeVertical;- const inputRef: Ref<OrVaadinInput> = createRef();-- const templateFunction: ValueInputTemplateFunction = (value, focused, loading, sending, _error, helperText) => {-- const disabled = options.disabled || loading || sending;- const label = supportsLabel ? options.label : undefined;- const inputStyle = styles ? styleMap(styles) : undefined;-- const onValueChange = (ev: Event) => {- ev.stopPropagation();- const elem = ev.currentTarget as OrVaadinInput | undefined;- if (elem?.checkValidity()) {- const doRemoteUpdate = (!OrVaadinInput.CHANGE_EVENTS.has(inputType) || (OrVaadinInput.CHANGE_EVENTS.get(inputType) === ev.type));- valueChangeNotifier(valueConverter?.(elem.nativeValue) ?? elem.nativeValue, doRemoteUpdate);- }- };-- if (supportsVaadinInput(inputType)) {-- // or-vaadin-checkbox has multiple states (like indeterminate), so it uses the 'checked' HTML attribute instead of 'value'.- let checked = false;- if (inputType === InputType.CHECKBOX) {- checked = Boolean(value);- value = undefined;- }-- return html`- <or-vaadin-input ${ref(inputRef)} id="input" style="${ifDefined(inputStyle)}" type=${ifDefined(inputType)}- label=${ifDefined(label)} value=${ifDefined(value)} ?checked="${checked}" pattern=${ifDefined(pattern)}- min=${ifDefined(min)} max=${ifDefined(max)} ?multiple=${multiple} .format=${ifDefined(format)}- ?autofocus=${focused} ?required=${required} ?readonly=${readonly} ?disabled=${disabled}- .items=${ifDefined(selectOptions)} step=${ifDefined(step)}- helper-text="${ifDefined(helperText)}" ?resizeVertical="${resizeVertical}"- ?rounded="${options.rounded}" ?outlined="${options.outlined}"- @change="${onValueChange}"- @submit="${onValueChange}"- ></or-vaadin-input>- `;- } else {- // Fallback code to use deprecated or-mwc-input. This should be removed in the future, once all input types are supported and mapped.- // Be aware: this function only creates the template, so it does not import or-mwc-input by default.- return html`- <or-mwc-input ${ref(inputRef)} id="input" style="${styleMap(styles)}" .type="${inputType}" .label="${label}" .value="${value}" .pattern="${pattern}"- .min="${min}" .max="${max}" .format="${format}" .focused="${focused}" .required="${required}" .multiple="${multiple}"- .options="${selectOptions}" .comfortable="${comfortable}" .readonly="${readonly}" .disabled="${disabled}" .step="${step}"- .helperText="${helperText}" .helperPersistent="${true}" .resizeVertical="${resizeVertical}"- .rounded="${options.rounded}" .outlined="${options.outlined}"- @or-mwc-input-changed="${(e: CustomEvent) => {- e.stopPropagation();- valueChangeNotifier(valueConverter ? valueConverter(e.detail.value) : e.detail.value);- }}"- ></or-mwc-input>- `;- }- };-- return {- templateFunction: templateFunction,- supportsHelperText: supportsHelperText,- supportsSendButton: supportsSendButton,- supportsLabel: supportsLabel,- validator: () => {- if (!inputRef.value) {- return false;- }- return inputRef.value.checkValidity();- }- };-};diff --git a/ui/component/or-vaadin-components/src/value-input-provider.ts b/ui/component/or-vaadin-components/src/value-input-provider.tsnew file mode 100644index 000000000..ab9ec41b1--- /dev/null+++ b/ui/component/or-vaadin-components/src/value-input-provider.ts@@ -0,0 +1,377 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+import {Util} from "@openremote/core";+import {WellknownMetaItems, WellknownValueTypes} from "@openremote/model";+import type {+ AssetDescriptor,+ Attribute,+ AttributeDescriptor,+ MetaHolder,+ NameHolder,+ NameValueHolder,+ ValueConstraint,+ ValueConstraintAllowedValues,+ ValueConstraintFuture,+ ValueConstraintFutureOrPresent,+ ValueConstraintMax,+ ValueConstraintMin,+ ValueConstraintNotBlank,+ ValueConstraintNotEmpty,+ ValueConstraintNotNull,+ ValueConstraintPast,+ ValueConstraintPastOrPresent,+ ValueConstraintPattern,+ ValueConstraintSize,+ ValueDescriptor,+ ValueDescriptorHolder,+ ValueFormat,+ ValueHolder+} from "@openremote/model";+import {html, TemplateResult} from "lit";+import {Ref, ref, createRef} from "lit/directives/ref.js";+import {ifDefined} from "lit/directives/if-defined.js";+import {styleMap} from "lit/directives/style-map.js";+import {InputType, inputTypeSupportsHelperText, inputTypeSupportsLabel, inputTypeSupportsSendButton} from "./util";+import {OrVaadinInput} from "./or-vaadin-input";++export interface ValueInputProviderOptions {+ label?: string;+ required?: boolean;+ readonly?: boolean;+ disabled?: boolean;+ compact?: boolean;+ rounded?: boolean;+ outlined?: boolean;+ comfortable?: boolean;+ resizeVertical?: boolean;+ inputType?: InputType;+}++export interface ValueInputProvider {+ templateFunction: ValueInputTemplateFunction;+ supportsHelperText: boolean;+ supportsLabel: boolean;+ supportsSendButton: boolean;+ validator?: () => boolean;+}++export type ValueInputTemplateFunction = ((value: any, focused: boolean, loading: boolean, sending: boolean, error: boolean, helperText: string | undefined) => TemplateResult | PromiseLike<TemplateResult>) | undefined;++export type ValueInputProviderGenerator = (assetDescriptor: AssetDescriptor | string, valueHolder: NameHolder & ValueHolder<any> | undefined, valueHolderDescriptor: ValueDescriptorHolder | undefined, valueDescriptor: ValueDescriptor+ , valueChangeNotifier: (value: any, updateImmediately?: boolean) => void, options: ValueInputProviderOptions) => ValueInputProvider;++/**+ * Internal function to retrieve HTML template based on the Asset-, attribute-, and value descriptors+ * It generates a template using `or-vaadin-input`, together with respective HTML attributes like min/max, pattern, and of course 'input type'.+ * For example, a 'positive number' attribute will render a `<or-vaadin-input type="number" min="0">`.+ * If the Vaadin input doesn't support the 'input type', it will automatically fall back to the older `or-mwc-input`.+ *+ * This is mostly copied over from `or-mwc-input`, so this will need optimizing once that has been deprecated.+ */+export const getValueHolderInputTemplateProvider: ValueInputProviderGenerator = (assetDescriptor, valueHolder, valueHolderDescriptor, valueDescriptor, valueChangeNotifier, options) => {++ let inputType: InputType | undefined = options.inputType;+ let step: number | undefined;+ let pattern: string | undefined;+ let min: any;+ let max: any;+ let multiple: any;+ let required: boolean | undefined;+ let selectOptions: { label: string, value: string }[] | undefined;+ let valueConverter: (v: any) => any | undefined;+ const styles = {} as any;++ const assetType = typeof assetDescriptor === "string" ? assetDescriptor : assetDescriptor.name;+ const constraints: ValueConstraint[] = (valueHolder && ((valueHolder as MetaHolder).meta) || (valueDescriptor && (valueDescriptor as MetaHolder).meta) ? Util.getAttributeValueConstraints(valueHolder as Attribute<any>, valueHolderDescriptor as AttributeDescriptor, assetType) : Util.getMetaValueConstraints(valueHolder as NameValueHolder<any>, valueHolderDescriptor as AttributeDescriptor, assetType)) || [];+ const format: ValueFormat | undefined = (valueHolder && ((valueHolder as MetaHolder).meta) || (valueDescriptor && (valueDescriptor as MetaHolder).meta) ? Util.getAttributeValueFormat(valueHolder as Attribute<any>, valueHolderDescriptor as AttributeDescriptor, assetType) : Util.getMetaValueFormat(valueHolder as Attribute<any>, valueHolderDescriptor as AttributeDescriptor, assetType));++ const supportsVaadinInput = (type: InputType) => (OrVaadinInput.TEMPLATES.has(type) && !format?.asSlider && !format?.asOnOff);++ // Determine input type+ if (!inputType) {+ switch (valueDescriptor.name) {+ case WellknownValueTypes.TEXT:+ case WellknownValueTypes.EMAIL:+ case WellknownValueTypes.UUID:+ case WellknownValueTypes.ASSETID:+ case WellknownValueTypes.HOSTORIPADDRESS:+ case WellknownValueTypes.IPADDRESS:+ inputType = Util.getMetaValue(WellknownMetaItems.MULTILINE, valueHolder, valueHolderDescriptor) === true ? InputType.TEXTAREA : InputType.TEXT;+ break;+ case WellknownValueTypes.BOOLEAN:+ if (format && format.asNumber) {+ inputType = InputType.NUMBER;+ step = 1;+ min = 0;+ max = 1;+ valueConverter = v => !!v;+ break;+ }+ if (format && (format.asOnOff || format.asOpenClosed)) {+ inputType = InputType.SWITCH;+ } else {+ inputType = InputType.CHECKBOX;+ }++ if ((format && format.asMomentary) || (Util.getMetaValue(WellknownMetaItems.MOMENTARY, valueHolder, valueHolderDescriptor) === true) ) {+ inputType = InputType.BUTTON_MOMENTARY;+ }+ break;+ case WellknownValueTypes.BIGNUMBER:+ case WellknownValueTypes.NUMBER:+ case WellknownValueTypes.POSITIVEINTEGER:+ case WellknownValueTypes.POSITIVENUMBER:+ case WellknownValueTypes.LONG:+ case WellknownValueTypes.INTEGER:+ case WellknownValueTypes.BYTE:+ case WellknownValueTypes.INTEGERBYTE:+ case WellknownValueTypes.DIRECTION:+ case WellknownValueTypes.TCPIPPORTNUMBER:+ if (valueDescriptor.name === WellknownValueTypes.BYTE || valueDescriptor.name === WellknownValueTypes.INTEGERBYTE) {+ min = 0;+ max = 255;+ step = 1;+ } else if (valueDescriptor.name === WellknownValueTypes.INTEGER || valueDescriptor.name === WellknownValueTypes.LONG) {+ step = 1;+ }+ if (format && format.asDate) {+ inputType = InputType.DATETIME;+ } else if (format && format.asBoolean) {+ inputType = InputType.CHECKBOX;+ valueConverter = v => v ? 1 : 0;+ } else if (format && format.asSlider) {+ inputType = InputType.RANGE;+ } else {+ inputType = InputType.NUMBER;+ }+ break;+ case WellknownValueTypes.BIGINTEGER:+ inputType = InputType.BIG_INT;+ step = 1;+ break;+ case WellknownValueTypes.COLOURRGB:+ inputType = InputType.COLOUR;+ break;+ case WellknownValueTypes.DATEANDTIME:+ case WellknownValueTypes.TIMESTAMP:+ case WellknownValueTypes.TIMESTAMPISO8601:+ inputType = InputType.DATETIME;+ break;+ case WellknownValueTypes.CRONEXPRESSION:+ inputType = InputType.CRON;+ break;+ case WellknownValueTypes.TIMEDURATIONISO8601:+ inputType = InputType.DURATION_TIME;+ break;+ case WellknownValueTypes.PERIODDURATIONISO8601:+ inputType = InputType.DURATION_PERIOD;+ break;+ case WellknownValueTypes.TIMEANDPERIODDURATIONISO8601:+ inputType = InputType.DURATION;+ break;+ case WellknownValueTypes.JSONOBJECT:+ inputType = InputType.JSON_OBJECT;+ break;+ }++ if (valueDescriptor.arrayDimensions && valueDescriptor.arrayDimensions > 0) {+ inputType = InputType.JSON;+ }+ }++ if (!inputType) {+ switch (valueDescriptor.jsonType) {+ case "number":+ case "bigint":+ inputType = InputType.NUMBER;+ break;+ case "boolean":+ inputType = InputType.CHECKBOX;+ break;+ case "string":+ inputType = InputType.TEXT;+ break;+ case "date":+ inputType = InputType.DATETIME;+ break;+ default:+ break;+ }+ }++ if (!inputType) {+ inputType = InputType.JSON;+ }++ // Apply any constraints+ const sizeConstraint = constraints?.find(c => c.type === "size") as ValueConstraintSize;+ const patternConstraint = constraints?.find(c => c.type === "pattern") as ValueConstraintPattern;+ const minConstraint = constraints?.find(c => c.type === "min") as ValueConstraintMin;+ const maxConstraint = constraints?.find(c => c.type === "max") as ValueConstraintMax;+ const allowedValuesConstraint = constraints?.find(c => c.type === "allowedValues") as ValueConstraintAllowedValues;+ const pastConstraint = constraints?.find(c => c.type === "past") as ValueConstraintPast;+ const pastOrPresentConstraint = constraints?.find(c => c.type === "pastOrPresent") as ValueConstraintPastOrPresent;+ const futureConstraint = constraints?.find(c => c.type === "future") as ValueConstraintFuture;+ const futureOrPresentConstraint = constraints?.find(c => c.type === "futureOrPresent") as ValueConstraintFutureOrPresent;+ const notEmptyConstraint = constraints?.find(c => c.type === "notEmpty") as ValueConstraintNotEmpty;+ const notBlankConstraint = constraints?.find(c => c.type === "notBlank") as ValueConstraintNotBlank;+ const notNullConstraint = constraints?.find(c => c.type === "notNull") as ValueConstraintNotNull;++ if (sizeConstraint) {+ min = sizeConstraint.min;+ max = sizeConstraint.max;+ }+ if (minConstraint) {+ min = minConstraint.min;+ }+ if (maxConstraint) {+ max = maxConstraint.max;+ }+ if (patternConstraint) {+ pattern = patternConstraint.regexp;+ }+ if (notNullConstraint) {+ required = true;+ }+ if (notBlankConstraint && !pattern) {+ pattern = String.raw`\S+`;+ } else if (notEmptyConstraint && !pattern) {+ pattern = ".+";+ }+ if (allowedValuesConstraint?.allowedValues) {+ const allowedLabels = allowedValuesConstraint.allowedValueNames && allowedValuesConstraint.allowedValueNames.length === allowedValuesConstraint.allowedValues.length ? allowedValuesConstraint.allowedValueNames : undefined;+ selectOptions = allowedValuesConstraint.allowedValues.map((v, i) => {+ let label = allowedLabels ? allowedLabels[i] : "" + v;+ label = Util.getAllowedValueLabel(label)!;+ return {+ value: v,+ label: label || "" + v+ };+ });+ inputType = InputType.SELECT;++ if (valueDescriptor.arrayDimensions && valueDescriptor.arrayDimensions > 0) {+ multiple = true;+ }+ }++ if (inputType === InputType.DATETIME) {+ if (pastConstraint || pastOrPresentConstraint) {+ min = undefined;+ max = new Date();+ } else if (futureConstraint || futureOrPresentConstraint) {+ min = new Date();+ max = undefined;+ }++ // Refine the input type based on formatting+ if (format) {+ if (format.timeStyle && !format.dateStyle) {+ inputType = InputType.TIME;+ } else if (format.dateStyle && !format.timeStyle) {+ inputType = InputType.DATE;+ }+ }+ }++ if (inputType === InputType.NUMBER && format?.resolution) {+ step = format.resolution;+ }++ if (inputType === InputType.COLOUR) {+ styles.marginLeft = "24px";+ }++ const supportsHelperText = inputTypeSupportsHelperText(inputType);+ const supportsLabel = inputTypeSupportsLabel(inputType);+ const supportsSendButton = inputTypeSupportsSendButton(inputType);+ const readonly = options.readonly;+ required = required || options.required;+ const comfortable = options.comfortable;+ const resizeVertical = options.resizeVertical;+ const inputRef: Ref<OrVaadinInput> = createRef();++ const templateFunction: ValueInputTemplateFunction = (value, focused, loading, sending, _error, helperText) => {++ const disabled = options.disabled || loading || sending;+ const label = supportsLabel ? options.label : undefined;+ const inputStyle = styles ? styleMap(styles) : undefined;++ const onValueChange = (ev: Event) => {+ ev.stopPropagation();+ const elem = ev.currentTarget as OrVaadinInput | undefined;+ if (elem?.checkValidity()) {+ const doRemoteUpdate = (!OrVaadinInput.CHANGE_EVENTS.has(inputType) || (OrVaadinInput.CHANGE_EVENTS.get(inputType) === ev.type));+ valueChangeNotifier(valueConverter?.(elem.nativeValue) ?? elem.nativeValue, doRemoteUpdate);+ }+ };++ if (supportsVaadinInput(inputType)) {++ // or-vaadin-checkbox has multiple states (like indeterminate), so it uses the 'checked' HTML attribute instead of 'value'.+ let checked = false;+ if (inputType === InputType.CHECKBOX) {+ checked = Boolean(value);+ value = undefined;+ }++ return html`+ <or-vaadin-input ${ref(inputRef)} id="input" style="${ifDefined(inputStyle)}" type=${ifDefined(inputType)}+ label=${ifDefined(label)} value=${ifDefined(value)} ?checked="${checked}" pattern=${ifDefined(pattern)}+ min=${ifDefined(min)} max=${ifDefined(max)} ?multiple=${multiple} .format=${ifDefined(format)}+ ?autofocus=${focused} ?required=${required} ?readonly=${readonly} ?disabled=${disabled}+ .items=${ifDefined(selectOptions)} step=${ifDefined(step)}+ helper-text="${ifDefined(helperText)}" ?resizeVertical="${resizeVertical}"+ ?rounded="${options.rounded}" ?outlined="${options.outlined}"+ @change="${onValueChange}"+ @submit="${onValueChange}"+ ></or-vaadin-input>+ `;+ } else {+ // Fallback code to use deprecated or-mwc-input. This should be removed in the future, once all input types are supported and mapped.+ // Be aware: this function only creates the template, so it does not import or-mwc-input by default.+ return html`+ <or-mwc-input ${ref(inputRef)} id="input" style="${styleMap(styles)}" .type="${inputType}" .label="${label}" .value="${value}" .pattern="${pattern}"+ .min="${min}" .max="${max}" .format="${format}" .focused="${focused}" .required="${required}" .multiple="${multiple}"+ .options="${selectOptions}" .comfortable="${comfortable}" .readonly="${readonly}" .disabled="${disabled}" .step="${step}"+ .helperText="${helperText}" .helperPersistent="${true}" .resizeVertical="${resizeVertical}"+ .rounded="${options.rounded}" .outlined="${options.outlined}"+ @or-mwc-input-changed="${(e: CustomEvent) => {+ e.stopPropagation();+ valueChangeNotifier(valueConverter ? valueConverter(e.detail.value) : e.detail.value);+ }}"+ ></or-mwc-input>+ `;+ }+ };++ return {+ templateFunction: templateFunction,+ supportsHelperText: supportsHelperText,+ supportsSendButton: supportsSendButton,+ supportsLabel: supportsLabel,+ validator: () => {+ if (!inputRef.value) {+ return false;+ }+ return inputRef.value.checkValidity();+ }+ };+};diff --git a/ui/component/or-vaadin-components/stories/or-vaadin-dialog.stories.ts b/ui/component/or-vaadin-components/stories/or-vaadin-dialog.stories.tsindex 84683979c..101904262 100644--- a/ui/component/or-vaadin-components/stories/or-vaadin-dialog.stories.ts+++ b/ui/component/or-vaadin-components/stories/or-vaadin-dialog.stories.ts@@ -26,7 +26,7 @@ import {dialogFooterRenderer, dialogHeaderRenderer, dialogRenderer, OrVaadinDialimport manager from "@openremote/core";import "../src/or-vaadin-button";import "../src/or-vaadin-dialog";-import "../src/or-vaadin-numberfield";+import "../src/or-vaadin-number-field";import "@openremote/or-map";const tagName = "or-vaadin-dialog";@@ -82,7 +82,7 @@ export const MapExample: Story = {<or-vaadin-dialog header-title="Configure area" ${dialogFooterRenderer(footer)}><div><or-map style="aspect-ratio: 1/1;"></or-map>- <or-vaadin-numberfield label="Radius (min. 100m)" min="100" value="100"></or-vaadin-numberfield>+ <or-vaadin-number-field label="Radius (min. 100m)" min="100" value="100"></or-vaadin-number-field></div></or-vaadin-dialog><or-vaadin-button @click="${() => (document.querySelector('or-vaadin-dialog') as OrVaadinDialog).open()}">Show dialog</or-vaadin-button>diff --git a/ui/component/or-vaadin-components/stories/or-vaadin-textfield.stories.ts b/ui/component/or-vaadin-components/stories/or-vaadin-text-field.stories.tssimilarity index 93%rename from ui/component/or-vaadin-components/stories/or-vaadin-textfield.stories.tsrename to ui/component/or-vaadin-components/stories/or-vaadin-text-field.stories.tsindex afe68781d..f1f10ffd9 100644--- a/ui/component/or-vaadin-components/stories/or-vaadin-textfield.stories.ts+++ b/ui/component/or-vaadin-components/stories/or-vaadin-text-field.stories.ts@@ -21,16 +21,16 @@ import {setCustomElementsManifest, type Meta, type StoryObj } from "@storybook/wimport {getStorybookHelpers} from "@wc-toolkit/storybook-helpers";import customElements from "../custom-elements.json" with { type: "json" };import packageJson from "../package.json" with { type: "json" };-import "../src/or-vaadin-textfield";+import "../src/or-vaadin-text-field";-const tagName = "or-vaadin-textfield";+const tagName = "or-vaadin-text-field";type Story = StoryObj;setCustomElementsManifest(customElements);const { events, args, argTypes, template } = getStorybookHelpers(tagName);const meta: Meta = {- title: "Playground/or-vaadin-components/textfield",+ title: "Playground/or-vaadin-components/text-field",component: tagName,args: args,argTypes: argTypes,diff --git a/ui/component/or-vaadin-components/test/fixtures/index.ts b/ui/component/or-vaadin-components/test/fixtures/index.tsnew file mode 100644index 000000000..85ce15ad8--- /dev/null+++ b/ui/component/or-vaadin-components/test/fixtures/index.ts@@ -0,0 +1,24 @@+import type { InputType } from "@openremote/or-vaadin-components/util";+import type { Page, Locator } from "@openremote/test";++export class VaadinInput {+ constructor(private readonly page: Page) {}++ /**+ * Returns the locator for the specified {@link InputType.SELECT|select input} option+ */+ getSelectInputOption(option: string, locator?: Locator): Locator {+ return (locator ?? this.page).locator("or-vaadin-select").getByRole("option").getByText(option, { exact: true });+ }+}++export class VaadinDialog {+ constructor(private readonly page: Page) {}++ /**+ * Returns a locator of the or-vaadin-dialog+ */+ getDialog(): Locator {+ return this.page.locator("or-vaadin-dialog");+ }+}diff --git a/ui/component/theme/README.md b/ui/component/theme/README.mdindex d1cd4607c..c1da35a5d 100644--- a/ui/component/theme/README.md+++ b/ui/component/theme/README.md@@ -21,7 +21,7 @@ yarn add @openremote/theme### Using JavaScript / TypeScript:Note: using the `<style>` tag is an example here. Please check the documentation of your JavaScript bundler for proper installation of CSS files.```typescript-import themeCss from "@openremote/theme/default.css";+import themeCss from "@openremote/theme";// Apply theme to the appconst style = document.createElement("style");diff --git a/ui/component/theme/package.json b/ui/component/theme/package.jsonindex b4392c78b..d334db0a5 100644--- a/ui/component/theme/package.json+++ b/ui/component/theme/package.json@@ -2,11 +2,13 @@"name": "@openremote/theme","version": "1.14.0-snapshot","description": "CSS themes for OpenRemote components",- "main": "src/index.css",- "module": "src/index.css",+ "main": "src/index.js","types": "src/index.d.ts","exports": {- ".": "./src/index.css",+ ".": {+ "types": "./src/index.d.ts",+ "import": "./src/index.js"+ },"./*.css": "./src/*.css","./*": "./*"},@@ -17,7 +19,7 @@"repository": "https://github.com/openremote/openremote","license": "AGPL-3.0-or-later","dependencies": {- "@vaadin/vaadin-lumo-styles": "~25.0.1"+ "@vaadin/vaadin-lumo-styles": "~25.0.3"},"publishConfig": {"access": "public"diff --git a/ui/component/theme/rspack.config.js b/ui/component/theme/rspack.config.jsindex 2dd010151..48072a09e 100644--- a/ui/component/theme/rspack.config.js+++ b/ui/component/theme/rspack.config.js@@ -1,8 +1,9 @@-export default {- experiments: {- css: true- },- resolve: {- extensions: ['.css']- }-}+const util = require("@openremote/util");++bundles = {+ "index.bundle": {+ excludeOr: true,+ },+};++module.exports = util.generateExports(__dirname);diff --git a/ui/component/theme/src/components/index.css b/ui/component/theme/src/components/index.cssnew file mode 100644index 000000000..fab9484d8--- /dev/null+++ b/ui/component/theme/src/components/index.css@@ -0,0 +1,39 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>+ */++/* IMPORTANT:+ * The import order can affect whether styling will be applied or not. This only+ * seems to be an issue when using Rspack.+ */+@import "./or-vaadin-button.css";+@import "./or-vaadin-checkbox-group.css";+@import "./or-vaadin-checkbox.css"; /* Must be after the checkbox-group */+@import "./or-vaadin-date-time-picker.css";+@import "./or-vaadin-date-picker.css"; /* Must be after the date-time-picker */+@import "./or-vaadin-dialog.css";+@import "./or-vaadin-icon.css";+@import "./or-vaadin-multi-select-combo-box.css";+@import "./or-vaadin-number-field.css";+@import "./or-vaadin-password-field.css";+@import "./or-vaadin-radio-group.css";+@import "./or-vaadin-select.css";+@import "./or-vaadin-text-area.css";+@import "./or-vaadin-text-field.css";+@import "./or-vaadin-time-picker.css"; /* Must be after the date-time-picker */diff --git a/ui/component/theme/src/components/or-vaadin-button.css b/ui/component/theme/src/components/or-vaadin-button.cssnew file mode 100644index 000000000..73fe579c1--- /dev/null+++ b/ui/component/theme/src/components/or-vaadin-button.css@@ -0,0 +1,26 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+@import "@vaadin/vaadin-lumo-styles/components/button.css";++:root::before,+:host::before {+ --_lumo-vaadin-button-inject: 1;+ --_lumo-vaadin-button-inject-modules: lumo_components_button;+}diff --git a/ui/component/theme/src/components/or-vaadin-checkbox-group.css b/ui/component/theme/src/components/or-vaadin-checkbox-group.cssnew file mode 100644index 000000000..42a54b187--- /dev/null+++ b/ui/component/theme/src/components/or-vaadin-checkbox-group.css@@ -0,0 +1,45 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+@import "@vaadin/vaadin-lumo-styles/components/checkbox-group.css";++@media lumo_components_checkbox-group-internal {+ :host {+ [part="group-field"] ::slotted([theme~="button"]) {+ margin-left: 6px;+ }+ [part="group-field"] ::slotted([theme~="button"]:first-child) {+ margin-left: 0;+ }+ }+}++:root::before,+:host::before {+ --_lumo-vaadin-checkbox-group-inject: 1;+ --_lumo-vaadin-checkbox-group-inject-modules:+ lumo_mixins_group-field,+ lumo_mixins_field-label,+ lumo_mixins_field-required,+ lumo_mixins_field-error-message,+ lumo_mixins_field-helper,+ lumo_components_checkbox-group,+ lumo_components_checkbox-group-internal,+ lumo_mixins_field-internal;+}diff --git a/ui/component/theme/src/components/or-vaadin-checkbox.css b/ui/component/theme/src/components/or-vaadin-checkbox.cssnew file mode 100644index 000000000..4e6afac82--- /dev/null+++ b/ui/component/theme/src/components/or-vaadin-checkbox.css@@ -0,0 +1,73 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+@import "@vaadin/vaadin-lumo-styles/components/checkbox.css";++@media lumo_checkbox_toggle_button {+ :host([theme~='button']) {+ &::part(checkbox),+ &::part(required-indicator) {+ display: none;+ }+ &::part(label) {+ background: var(--lumo-contrast-5pct);+ border-radius: var(--lumo-border-radius-m);+ color: var(--lumo-primary-color);+ cursor: var(--lumo-clickable-cursor);+ transition:+ background-color 0.2s,+ color 0.2s,+ filter 0.2s,+ transform 0.1s,+ box-shadow 0.2s;+ user-select: none;+ --vaadin-checkbox-label-padding: 8px 14px;+ }+ &:active:not([disabled])::part(label) {+ filter: brightness(0.9);+ transform: scale(0.96);+ transition: transform 0.05s;+ }+ }++ :host([theme~='button'][checked])::part(label) {+ background: var(--lumo-primary-color);+ color: white;+ }++ @media (hover: hover) {+ :host([theme~='button']:hover:not([checked]))::part(label) {+ background: var(--lumo-contrast-10pct);+ }++ :host([theme~='button'][checked]:hover)::part(label) {+ filter: brightness(1.1);+ }+ }++}++:root::before,+:host::before {+ --_lumo-vaadin-checkbox-inject: 1;+ --_lumo-vaadin-checkbox-inject-modules:+ lumo_mixins_checkable-field,+ lumo_components_checkbox,+ lumo_checkbox_toggle_button;+}diff --git a/ui/component/theme/src/components/or-vaadin-date-picker.css b/ui/component/theme/src/components/or-vaadin-date-picker.cssnew file mode 100644index 000000000..89f005207--- /dev/null+++ b/ui/component/theme/src/components/or-vaadin-date-picker.css@@ -0,0 +1,50 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+@import "@vaadin/vaadin-lumo-styles/components/date-picker.css";++:root::before,+:host::before {+ --_lumo-vaadin-date-picker-inject: 1;+ --_lumo-vaadin-date-picker-inject-modules:+ lumo_mixins_field-label,+ lumo_mixins_field-required,+ lumo_mixins_field-error-message,+ lumo_mixins_field-button,+ lumo_mixins_field-helper,+ lumo_mixins_field-base,+ lumo_components_date-picker,+ lumo_mixins_field-internal;++ --_lumo-vaadin-date-picker-year-inject: 1;+ --_lumo-vaadin-date-picker-year-inject-modules: lumo_components_date-picker-year;++ --_lumo-vaadin-date-picker-overlay-inject: 1;+ --_lumo-vaadin-date-picker-overlay-inject-modules:+ lumo_mixins_overlay,+ lumo_mixins_menu-overlay-core,+ lumo_mixins_menu-overlay-ext,+ lumo_components_date-picker-overlay;++ --_lumo-vaadin-date-picker-overlay-content-inject: 1;+ --_lumo-vaadin-date-picker-overlay-content-inject-modules: lumo_components_date-picker-overlay-content;++ --_lumo-vaadin-month-calendar-inject: 1;+ --_lumo-vaadin-month-calendar-inject-modules: lumo_components_date-picker-month-calendar;+}diff --git a/ui/component/theme/src/components/or-vaadin-date-time-picker.css b/ui/component/theme/src/components/or-vaadin-date-time-picker.cssnew file mode 100644index 000000000..82d8fefd4--- /dev/null+++ b/ui/component/theme/src/components/or-vaadin-date-time-picker.css@@ -0,0 +1,45 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+@import "@vaadin/vaadin-lumo-styles/components/date-time-picker.css";++@media lumo_components_space-evenly {+ :host {+ [part="input-fields"] ::slotted([slot="time-picker"]) {+ flex: 1 1 auto;+ min-width: 0;+ }+ }+}++:root::before,+:host::before {+ --_lumo-vaadin-date-time-picker-inject: 1;+ --_lumo-vaadin-date-time-picker-inject-modules:+ lumo_mixins_field-label,+ lumo_mixins_field-required,+ lumo_mixins_field-error-message,+ lumo_mixins_field-button,+ lumo_mixins_field-helper,+ lumo_mixins_field-base,+ lumo_components_custom-field,+ lumo_components_date-time-picker,+ lumo_components_space-evenly,+ lumo_mixins_field-internal;+}diff --git a/ui/component/theme/src/components/or-vaadin-dialog.css b/ui/component/theme/src/components/or-vaadin-dialog.cssnew file mode 100644index 000000000..9328ba96d--- /dev/null+++ b/ui/component/theme/src/components/or-vaadin-dialog.css@@ -0,0 +1,37 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+@import "@vaadin/vaadin-lumo-styles/components/dialog.css";++@media lumo_components_dialog-overlay-internal {+ :host::part(overlay) {+ max-width: 600px;+ width: 100%;+ }+}++:root::before,+:host::before {+ --_lumo-vaadin-dialog-overlay-inject: 1;+ --_lumo-vaadin-dialog-overlay-inject-modules:+ lumo_mixins_overlay,+ lumo_mixins_resizable-overlay,+ lumo_components_dialog-overlay,+ lumo_components_dialog-overlay-internal;+}diff --git a/ui/component/theme/src/components/or-vaadin-icon.css b/ui/component/theme/src/components/or-vaadin-icon.cssnew file mode 100644index 000000000..4f8f35609--- /dev/null+++ b/ui/component/theme/src/components/or-vaadin-icon.css@@ -0,0 +1,26 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+@import "@vaadin/vaadin-lumo-styles/components/icon.css";++:root::before,+:host::before {+ --_lumo-vaadin-icon-inject: 1;+ --_lumo-vaadin-icon-inject-modules: lumo_components_icon;+}diff --git a/ui/component/theme/src/components/or-vaadin-multi-select-combo-box.css b/ui/component/theme/src/components/or-vaadin-multi-select-combo-box.cssnew file mode 100644index 000000000..96bc7f4e9--- /dev/null+++ b/ui/component/theme/src/components/or-vaadin-multi-select-combo-box.css@@ -0,0 +1,59 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+@import "@vaadin/vaadin-lumo-styles/components/multi-select-combo-box.css";++:root::before,+:host::before {+ --_lumo-vaadin-multi-select-combo-box-container-inject: 1;+ --_lumo-vaadin-multi-select-combo-box-container-inject-modules:+ lumo_components_input-container,+ lumo_components_multi-select-combo-box-container;++ --_lumo-vaadin-multi-select-combo-box-overlay-inject: 1;+ --_lumo-vaadin-multi-select-combo-box-overlay-inject-modules:+ lumo_mixins_loader,+ lumo_mixins_combo-box-loader,+ lumo_mixins_overlay,+ lumo_mixins_menu-overlay-core,+ lumo_mixins_combo-box-overlay,+ lumo_components_multi-select-combo-box-overlay;++ --_lumo-vaadin-multi-select-combo-box-chip-inject: 1;+ --_lumo-vaadin-multi-select-combo-box-chip-inject-modules:+ lumo_mixins_field-button,+ lumo_components_multi-select-combo-box-chip;++ --_lumo-vaadin-multi-select-combo-box-item-inject: 1;+ --_lumo-vaadin-multi-select-combo-box-item-inject-modules:+ lumo_components_item,+ lumo_components_combo-box-item,+ lumo_components_multi-select-combo-box-item;++ --_lumo-vaadin-multi-select-combo-box-inject: 1;+ --_lumo-vaadin-multi-select-combo-box-inject-modules:+ lumo_mixins_field-label,+ lumo_mixins_field-required,+ lumo_mixins_field-error-message,+ lumo_mixins_field-button,+ lumo_mixins_field-helper,+ lumo_mixins_field-base,+ lumo_components_multi-select-combo-box,+ lumo_mixins_field-internal;+}diff --git a/ui/component/theme/src/components/or-vaadin-number-field.css b/ui/component/theme/src/components/or-vaadin-number-field.cssnew file mode 100644index 000000000..f4b297156--- /dev/null+++ b/ui/component/theme/src/components/or-vaadin-number-field.css@@ -0,0 +1,34 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+@import "@vaadin/vaadin-lumo-styles/components/number-field.css";++:root::before,+:host::before {+ --_lumo-vaadin-number-field-inject: 1;+ --_lumo-vaadin-number-field-inject-modules:+ lumo_mixins_field-label,+ lumo_mixins_field-required,+ lumo_mixins_field-error-message,+ lumo_mixins_field-button,+ lumo_mixins_field-helper,+ lumo_mixins_field-base,+ lumo_components_number-field,+ lumo_mixins_field-internal;+}diff --git a/ui/component/theme/src/components/or-vaadin-password-field.css b/ui/component/theme/src/components/or-vaadin-password-field.cssnew file mode 100644index 000000000..d106f3627--- /dev/null+++ b/ui/component/theme/src/components/or-vaadin-password-field.css@@ -0,0 +1,39 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+@import "@vaadin/vaadin-lumo-styles/components/password-field.css";++:root::before,+:host::before {+ --_lumo-vaadin-password-field-inject: 1;+ --_lumo-vaadin-password-field-inject-modules:+ lumo_mixins_field-label,+ lumo_mixins_field-required,+ lumo_mixins_field-error-message,+ lumo_mixins_field-button,+ lumo_mixins_field-helper,+ lumo_mixins_field-base,+ lumo_components_password-field,+ lumo_mixins_field-internal;++ --_lumo-vaadin-password-field-button-inject: 1;+ --_lumo-vaadin-password-field-button-inject-modules:+ lumo_components_button,+ lumo_components_password-field-button;+}diff --git a/ui/component/theme/src/components/or-vaadin-radio-group.css b/ui/component/theme/src/components/or-vaadin-radio-group.cssnew file mode 100644index 000000000..936aeedea--- /dev/null+++ b/ui/component/theme/src/components/or-vaadin-radio-group.css@@ -0,0 +1,33 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+@import "@vaadin/vaadin-lumo-styles/components/radio-group.css";++:root::before,+:host::before {+ --_lumo-vaadin-radio-group-inject: 1;+ --_lumo-vaadin-radio-group-inject-modules:+ lumo_mixins_group-field,+ lumo_mixins_field-label,+ lumo_mixins_field-required,+ lumo_mixins_field-error-message,+ lumo_mixins_field-helper,+ lumo_components_radio-group,+ lumo_mixins_field-internal;+}diff --git a/ui/component/theme/src/components/or-vaadin-select.css b/ui/component/theme/src/components/or-vaadin-select.cssnew file mode 100644index 000000000..3b7c13527--- /dev/null+++ b/ui/component/theme/src/components/or-vaadin-select.css@@ -0,0 +1,50 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+@import "@vaadin/vaadin-lumo-styles/components/select.css";++:root::before,+:host::before {+ --_lumo-vaadin-select-inject: 1;+ --_lumo-vaadin-select-inject-modules:+ lumo_mixins_field-label,+ lumo_mixins_field-required,+ lumo_mixins_field-error-message,+ lumo_mixins_field-button,+ lumo_mixins_field-helper,+ lumo_mixins_field-base,+ lumo_components_select,+ lumo_mixins_field-internal;++ --_lumo-vaadin-select-item-inject: 1;+ --_lumo-vaadin-select-item-inject-modules: lumo_components_item;++ --_lumo-vaadin-select-overlay-inject: 1;+ --_lumo-vaadin-select-overlay-inject-modules:+ lumo_mixins_overlay,+ lumo_mixins_menu-overlay-core,+ lumo_mixins_menu-overlay-ext,+ lumo_components_select-overlay;++ --_lumo-vaadin-select-list-box-inject: 1;+ --_lumo-vaadin-select-list-box-inject-modules: lumo_components_list-box;++ --_lumo-vaadin-select-value-button-inject: 1;+ --_lumo-vaadin-select-value-button-inject-modules: lumo_components_select-value-button;+}diff --git a/ui/component/theme/src/components/or-vaadin-text-area.css b/ui/component/theme/src/components/or-vaadin-text-area.cssnew file mode 100644index 000000000..407e872d0--- /dev/null+++ b/ui/component/theme/src/components/or-vaadin-text-area.css@@ -0,0 +1,34 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+@import "@vaadin/vaadin-lumo-styles/components/text-area.css";++:root::before,+:host::before {+ --_lumo-vaadin-text-area-inject: 1;+ --_lumo-vaadin-text-area-inject-modules:+ lumo_mixins_field-label,+ lumo_mixins_field-required,+ lumo_mixins_field-error-message,+ lumo_mixins_field-button,+ lumo_mixins_field-helper,+ lumo_mixins_field-base,+ lumo_components_text-area,+ lumo_mixins_field-internal;+}diff --git a/ui/component/theme/src/components/or-vaadin-text-field.css b/ui/component/theme/src/components/or-vaadin-text-field.cssnew file mode 100644index 000000000..7af4d0c35--- /dev/null+++ b/ui/component/theme/src/components/or-vaadin-text-field.css@@ -0,0 +1,33 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+@import "@vaadin/vaadin-lumo-styles/components/text-field.css";++:root::before,+:host::before {+ --_lumo-vaadin-text-field-inject: 1;+ --_lumo-vaadin-text-field-inject-modules:+ lumo_mixins_field-label,+ lumo_mixins_field-required,+ lumo_mixins_field-error-message,+ lumo_mixins_field-button,+ lumo_mixins_field-helper,+ lumo_mixins_field-base,+ lumo_mixins_field-internal;+}diff --git a/ui/component/theme/src/components/or-vaadin-time-picker.css b/ui/component/theme/src/components/or-vaadin-time-picker.cssnew file mode 100644index 000000000..c61882dd9--- /dev/null+++ b/ui/component/theme/src/components/or-vaadin-time-picker.css@@ -0,0 +1,46 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+@import "@vaadin/vaadin-lumo-styles/components/time-picker.css";++:root::before,+:host::before {+ --_lumo-vaadin-time-picker-inject: 1;+ --_lumo-vaadin-time-picker-inject-modules:+ lumo_mixins_field-label,+ lumo_mixins_field-required,+ lumo_mixins_field-error-message,+ lumo_mixins_field-button,+ lumo_mixins_field-helper,+ lumo_mixins_field-base,+ lumo_components_time-picker,+ lumo_mixins_field-internal;++ --_lumo-vaadin-time-picker-item-inject: 1;+ --_lumo-vaadin-time-picker-item-inject-modules:+ lumo_components_item,+ lumo_components_combo-box-item;++ --_lumo-vaadin-time-picker-overlay-inject: 1;+ --_lumo-vaadin-time-picker-overlay-inject-modules:+ lumo_mixins_overlay,+ lumo_mixins_menu-overlay-core,+ lumo_mixins_combo-box-overlay,+ lumo_components_time-picker-overlay;+}diff --git a/ui/component/theme/src/default.css b/ui/component/theme/src/default.cssindex ab6381891..2fd1231a8 100644--- a/ui/component/theme/src/default.css+++ b/ui/component/theme/src/default.css@@ -17,10 +17,17 @@* You should have received a copy of the GNU Affero General Public License* along with this program. If not, see <http://www.gnu.org/licenses/>.*/-@import "@vaadin/vaadin-lumo-styles/lumo.css";+@import "@vaadin/vaadin-lumo-styles/src/props/index.css";+@import "@vaadin/vaadin-lumo-styles/src/global/index.css";+@import "components/index.css";+@import "mixins/index.css";++:where(:root),+:where(:host) {+ --vaadin-lumo-theme: 1;+}:root[theme~="dark"] {-/* Dark theme - Base colors */--or-color-base: hsla(120, 20%, 1%);--or-color-base-5pct: hsla(120, 6%, 14%);@@ -75,7 +82,6 @@}:root {-/* Light theme - Base colors */--or-color-base: hsl(0, 0%, 100%);--or-color-base-5pct: hsla(118, 10%, 25%, 0.16);@@ -165,4 +171,11 @@--lumo-secondary-text-color: var(--or-color-text-secondary);--lumo-tertiary-text-color: var(--or-color-text-tertiary);--lumo-disabled-text-color: var(--or-color-text-disabled);++ /* OpenRemote */+ --lumo-border-radius-m: 0.5em;+ --lumo-border-radius-l: 0.75em;+ --vaadin-field-default-width: 100%;+ --vaadin-button-margin: 0;+ --lumo-clickable-cursor: pointer;}diff --git a/ui/component/theme/src/index.d.ts b/ui/component/theme/src/index.d.tsindex ee2478e1f..1e1c46e24 100644--- a/ui/component/theme/src/index.d.ts+++ b/ui/component/theme/src/index.d.ts@@ -33,3 +33,6 @@ declare module "*.css" {const css: string;export default css;}++declare const theme: string;+export default theme;diff --git a/ui/component/theme/src/index.js b/ui/component/theme/src/index.jsnew file mode 100644index 000000000..18155cc82--- /dev/null+++ b/ui/component/theme/src/index.js@@ -0,0 +1,21 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+import css from "./index.css";+export default css;diff --git a/ui/component/theme/src/mixins/field-internal.css b/ui/component/theme/src/mixins/field-internal.cssnew file mode 100644index 000000000..aa2459b72--- /dev/null+++ b/ui/component/theme/src/mixins/field-internal.css@@ -0,0 +1,34 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+/* We intentionally remove paddings around fields so we only need to deal with+ * our own paddings, margins and gaps.+ */+@media lumo_mixins_field-internal {+ :host {+ padding: 0;+ width: 100%;+ }+ :host([has-label]) {+ padding-top: 0;+ }+ [class$="container"] {+ width: 100%; /* Lumo sets default field container width as 12em */+ }+}diff --git a/ui/component/theme/src/mixins/index.css b/ui/component/theme/src/mixins/index.cssnew file mode 100644index 000000000..7a815631b--- /dev/null+++ b/ui/component/theme/src/mixins/index.css@@ -0,0 +1,20 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */+@import "./field-internal.css";diff --git a/ui/test/fixtures/component.ts b/ui/test/fixtures/component.tsindex dec5f082b..3a153f804 100644--- a/ui/test/fixtures/component.ts+++ b/ui/test/fixtures/component.ts@@ -87,6 +87,10 @@ export class CtShared extends Shared {}, resources);}+ async translate(message: string) {+ return this.page.evaluate(async (m) => window._i18next.t(m), message);+ }+/*** Register assets to the window object to be resolved by components* subscribed to the `manager` instance from `@openremote/core`.diff --git a/ui/test/playwright/index.html b/ui/test/playwright/index.htmlindex 5ed6602a4..a81922cf9 100644--- a/ui/test/playwright/index.html+++ b/ui/test/playwright/index.html@@ -1,13 +1,13 @@<!DOCTYPE html><html lang="en">- <head>- <meta charset="UTF-8" />- <meta http-equiv="X-UA-Compatible" content="IE=edge" />- <meta name="viewport" content="width=device-width,initial-scale=1.0" />- <title>OpenRemote - Playwright Components Test App</title>- </head>- <body>- <div id="root"></div>- <script type="module" src="./index.js"></script>- </body>+ <head>+ <meta charset="UTF-8" />+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />+ <meta name="viewport" content="width=device-width,initial-scale=1.0" />+ <title>OpenRemote - Playwright Components Test App</title>+ </head>+ <body>+ <div id="root"></div>+ <script type="module" src="./index.js"></script>+ </body></html>diff --git a/ui/test/playwright/index.js b/ui/test/playwright/index.jsindex d9e5c2c18..910a49a2a 100644--- a/ui/test/playwright/index.js+++ b/ui/test/playwright/index.js@@ -1,3 +1,4 @@+import themeCss from "@openremote/theme";import manager from "@openremote/core";import { thingAssetInfo, metaItemDescriptors, valueDescriptors } from "@openremote/test/data";@@ -7,6 +8,10 @@ import HttpBackend from "i18next-http-backend";import { IconSets, OrIconSet, createMdiIconSet, createSvgIconSet } from "@openremote/or-icon";import { AssetEventCause, AssetModelUtil, ClientRole } from "@openremote/model";+const style = document.createElement("style");+style.textContent = themeCss;+document.head.appendChild(style);+IconSets.addIconSet("mdi", createMdiIconSet(""));IconSets.addIconSet("or", createSvgIconSet(OrIconSet.size, OrIconSet.icons));diff --git a/yarn.lock b/yarn.lockindex c9f8e0687..72e5b792d 100644--- a/yarn.lock+++ b/yarn.lock@@ -2114,9 +2114,11 @@ __metadata:version: 0.0.0-use.localresolution: "@openremote/or-scheduler@workspace:ui/component/or-scheduler"dependencies:+ "@openremote/core": "workspace:*""@openremote/model": "workspace:*"- "@openremote/or-mwc-components": "workspace:*"+ "@openremote/or-icon": "workspace:*""@openremote/or-translate": "workspace:*"+ "@openremote/or-vaadin-components": "workspace:*"lit: "npm:^3.3.1"moment: "npm:^2.29.4"rrule: "npm:^2.6.4"@@ -2157,7 +2159,7 @@ __metadata:languageName: unknownlinkType: soft-"@openremote/or-vaadin-components@workspace:ui/component/or-vaadin-components":+"@openremote/or-vaadin-components@workspace:*, @openremote/or-vaadin-components@workspace:ui/component/or-vaadin-components":version: 0.0.0-use.localresolution: "@openremote/or-vaadin-components@workspace:ui/component/or-vaadin-components"dependencies:@@ -2165,12 +2167,20 @@ __metadata:"@openremote/model": "workspace:*""@vaadin/button": "npm:~25.0.3""@vaadin/checkbox": "npm:~25.0.3"+ "@vaadin/checkbox-group": "npm:~25.0.3"+ "@vaadin/date-picker": "npm:~25.0.3"+ "@vaadin/date-time-picker": "npm:~25.0.3""@vaadin/dialog": "npm:~25.0.3"+ "@vaadin/icon": "npm:~25.0.3"+ "@vaadin/icons": "npm:~25.0.3"+ "@vaadin/multi-select-combo-box": "npm:~25.0.3""@vaadin/number-field": "npm:~25.0.3""@vaadin/password-field": "npm:~25.0.3"+ "@vaadin/radio-group": "npm:~25.0.3""@vaadin/select": "npm:~25.0.3""@vaadin/text-area": "npm:~25.0.3""@vaadin/text-field": "npm:~25.0.3"+ "@vaadin/time-picker": "npm:~25.0.3"lit: "npm:^3.3.1"languageName: unknownlinkType: soft@@ -2228,7 +2238,7 @@ __metadata:version: 0.0.0-use.localresolution: "@openremote/theme@workspace:ui/component/theme"dependencies:- "@vaadin/vaadin-lumo-styles": "npm:~25.0.1"+ "@vaadin/vaadin-lumo-styles": "npm:~25.0.3"languageName: unknownlinkType: soft@@ -3547,6 +3557,21 @@ __metadata:languageName: nodelinkType: hard+"@vaadin/checkbox-group@npm:~25.0.3":+ version: 25.0.3+ resolution: "@vaadin/checkbox-group@npm:25.0.3"+ dependencies:+ "@open-wc/dedupe-mixin": "npm:^1.3.0"+ "@vaadin/a11y-base": "npm:~25.0.3"+ "@vaadin/checkbox": "npm:~25.0.3"+ "@vaadin/component-base": "npm:~25.0.3"+ "@vaadin/field-base": "npm:~25.0.3"+ "@vaadin/vaadin-themable-mixin": "npm:~25.0.3"+ lit: "npm:^3.0.0"+ checksum: 10c0/8f18a62f56610cdae707aacfb625c4189bf264ad48e699441b61a304d9931171133d993c92372c63cad4bc58428cefcf897ba87c5fbc3c6e44712644a7e6e80b+ languageName: node+ linkType: hard+"@vaadin/checkbox@npm:~25.0.3":version: 25.0.3resolution: "@vaadin/checkbox@npm:25.0.3"@@ -3561,15 +3586,21 @@ __metadata:languageName: nodelinkType: hard-"@vaadin/component-base@npm:~25.0.1":- version: 25.0.1- resolution: "@vaadin/component-base@npm:25.0.1"+"@vaadin/combo-box@npm:~25.0.3":+ version: 25.0.3+ resolution: "@vaadin/combo-box@npm:25.0.3"dependencies:"@open-wc/dedupe-mixin": "npm:^1.3.0"- "@vaadin/vaadin-development-mode-detector": "npm:^2.0.0"- "@vaadin/vaadin-usage-statistics": "npm:^2.1.0"+ "@vaadin/a11y-base": "npm:~25.0.3"+ "@vaadin/component-base": "npm:~25.0.3"+ "@vaadin/field-base": "npm:~25.0.3"+ "@vaadin/input-container": "npm:~25.0.3"+ "@vaadin/item": "npm:~25.0.3"+ "@vaadin/lit-renderer": "npm:~25.0.3"+ "@vaadin/overlay": "npm:~25.0.3"+ "@vaadin/vaadin-themable-mixin": "npm:~25.0.3"lit: "npm:^3.0.0"- checksum: 10c0/063a7f5300f9c20040471fa12df04b452cf36e3b618499a7e1008f906f81304729b8b6ce3ae630411af9f0c6addfc7edeee834568d058b06819192f21ef25674+ checksum: 10c0/e67d5b750b47524f0132d010f7d389c9f89b0bb06964facacfed2b6c8a3d9a03cafa120cf6a3a8c593e25de1c108ad38f9b41466c48d4ee2d3077f442d344215languageName: nodelinkType: hard@@ -3585,6 +3616,54 @@ __metadata:languageName: nodelinkType: hard+"@vaadin/custom-field@npm:~25.0.3":+ version: 25.0.3+ resolution: "@vaadin/custom-field@npm:25.0.3"+ dependencies:+ "@open-wc/dedupe-mixin": "npm:^1.3.0"+ "@vaadin/a11y-base": "npm:~25.0.3"+ "@vaadin/component-base": "npm:~25.0.3"+ "@vaadin/field-base": "npm:~25.0.3"+ "@vaadin/vaadin-themable-mixin": "npm:~25.0.3"+ lit: "npm:^3.0.0"+ checksum: 10c0/e350f881049d47fdb95e0a7dc448da8329171cf7758a3b00e122979c54900dcdb589ac0cab8e063e2eb3c1a6d58708b4c6f06ca3f6289732fa0545b3f42a540c+ languageName: node+ linkType: hard++"@vaadin/date-picker@npm:~25.0.3":+ version: 25.0.3+ resolution: "@vaadin/date-picker@npm:25.0.3"+ dependencies:+ "@open-wc/dedupe-mixin": "npm:^1.3.0"+ "@vaadin/a11y-base": "npm:~25.0.3"+ "@vaadin/button": "npm:~25.0.3"+ "@vaadin/component-base": "npm:~25.0.3"+ "@vaadin/field-base": "npm:~25.0.3"+ "@vaadin/input-container": "npm:~25.0.3"+ "@vaadin/overlay": "npm:~25.0.3"+ "@vaadin/vaadin-themable-mixin": "npm:~25.0.3"+ lit: "npm:^3.0.0"+ checksum: 10c0/a5510509b848448e5f9657458d85cc6f227d91bfedb5f211276ad0695a7a2050c93b0def5903710c4c7c89f6dddf9e00c5da5e613525d84333191ef53165844a+ languageName: node+ linkType: hard++"@vaadin/date-time-picker@npm:~25.0.3":+ version: 25.0.3+ resolution: "@vaadin/date-time-picker@npm:25.0.3"+ dependencies:+ "@open-wc/dedupe-mixin": "npm:^1.3.0"+ "@vaadin/a11y-base": "npm:~25.0.3"+ "@vaadin/component-base": "npm:~25.0.3"+ "@vaadin/custom-field": "npm:~25.0.3"+ "@vaadin/date-picker": "npm:~25.0.3"+ "@vaadin/field-base": "npm:~25.0.3"+ "@vaadin/time-picker": "npm:~25.0.3"+ "@vaadin/vaadin-themable-mixin": "npm:~25.0.3"+ lit: "npm:^3.0.0"+ checksum: 10c0/b154294e8ccc32e633fc3f2a3798b6c19f4e3a9beadedd33c9e96435a55da922c017547d4495d63b3596e9bad5c9f248bafd626faaaf600c02d90eb61bb9731a+ languageName: node+ linkType: hard+"@vaadin/dialog@npm:~25.0.3":version: 25.0.3resolution: "@vaadin/dialog@npm:25.0.3"@@ -3611,15 +3690,24 @@ __metadata:languageName: nodelinkType: hard-"@vaadin/icon@npm:~25.0.1":- version: 25.0.1- resolution: "@vaadin/icon@npm:25.0.1"+"@vaadin/icon@npm:~25.0.3":+ version: 25.0.3+ resolution: "@vaadin/icon@npm:25.0.3"dependencies:"@open-wc/dedupe-mixin": "npm:^1.3.0"- "@vaadin/component-base": "npm:~25.0.1"- "@vaadin/vaadin-themable-mixin": "npm:~25.0.1"+ "@vaadin/component-base": "npm:~25.0.3"+ "@vaadin/vaadin-themable-mixin": "npm:~25.0.3"lit: "npm:^3.0.0"- checksum: 10c0/8a87e7f64082d79fa68522ed97f5a4c4fdb1bfdbc66745a5d2fbef75183c105b9398e4db021f3f42f137e997fe96abecdf33531df7f01af86fac29869d2dc4d8+ checksum: 10c0/3c2c9173757543e51751ad6104b66c5c4e7f24997e97101f7800b1d4bf916ce849dc99693619ddeb1d29e1446e751010e8dd95bd27b0216a1667f12fb3981f30+ languageName: node+ linkType: hard++"@vaadin/icons@npm:~25.0.3":+ version: 25.0.3+ resolution: "@vaadin/icons@npm:25.0.3"+ dependencies:+ "@vaadin/icon": "npm:~25.0.3"+ checksum: 10c0/e6471832a63cf0d445e99b5f7b183f7865eac5714bb9601231b0ee64e3f4e100cbcd566b0085c7f1884abbaecf03767e1998caa4807ede5cda78d6c6839127dalanguageName: nodelinkType: hard@@ -3670,6 +3758,25 @@ __metadata:languageName: nodelinkType: hard+"@vaadin/multi-select-combo-box@npm:~25.0.3":+ version: 25.0.3+ resolution: "@vaadin/multi-select-combo-box@npm:25.0.3"+ dependencies:+ "@open-wc/dedupe-mixin": "npm:^1.3.0"+ "@vaadin/a11y-base": "npm:~25.0.3"+ "@vaadin/combo-box": "npm:~25.0.3"+ "@vaadin/component-base": "npm:~25.0.3"+ "@vaadin/field-base": "npm:~25.0.3"+ "@vaadin/input-container": "npm:~25.0.3"+ "@vaadin/item": "npm:~25.0.3"+ "@vaadin/lit-renderer": "npm:~25.0.3"+ "@vaadin/overlay": "npm:~25.0.3"+ "@vaadin/vaadin-themable-mixin": "npm:~25.0.3"+ lit: "npm:^3.0.0"+ checksum: 10c0/232cec2d83c4d515b63e1c4164353405db8e9eed4bbfffb976f79e007c2e7cda17ba6a9fc908a05186dc6b0ab13839deb87f1d1420ee2c525b64e7a89c4d843e+ languageName: node+ linkType: hard+"@vaadin/number-field@npm:~25.0.3":version: 25.0.3resolution: "@vaadin/number-field@npm:25.0.3"@@ -3714,6 +3821,20 @@ __metadata:languageName: nodelinkType: hard+"@vaadin/radio-group@npm:~25.0.3":+ version: 25.0.3+ resolution: "@vaadin/radio-group@npm:25.0.3"+ dependencies:+ "@open-wc/dedupe-mixin": "npm:^1.3.0"+ "@vaadin/a11y-base": "npm:~25.0.3"+ "@vaadin/component-base": "npm:~25.0.3"+ "@vaadin/field-base": "npm:~25.0.3"+ "@vaadin/vaadin-themable-mixin": "npm:~25.0.3"+ lit: "npm:^3.0.0"+ checksum: 10c0/97e66e1fdf54ab931c42e26cd6ab26494dcf24ee1402e2d06164d9b363d521f644c1654c75e38ebfddf3c4d501915ecb460a309005156d0969a6359c17b52da7+ languageName: node+ linkType: hard+"@vaadin/select@npm:~25.0.3":version: 25.0.3resolution: "@vaadin/select@npm:25.0.3"@@ -3764,6 +3885,23 @@ __metadata:languageName: nodelinkType: hard+"@vaadin/time-picker@npm:~25.0.3":+ version: 25.0.3+ resolution: "@vaadin/time-picker@npm:25.0.3"+ dependencies:+ "@open-wc/dedupe-mixin": "npm:^1.3.0"+ "@vaadin/combo-box": "npm:~25.0.3"+ "@vaadin/component-base": "npm:~25.0.3"+ "@vaadin/field-base": "npm:~25.0.3"+ "@vaadin/input-container": "npm:~25.0.3"+ "@vaadin/item": "npm:~25.0.3"+ "@vaadin/overlay": "npm:~25.0.3"+ "@vaadin/vaadin-themable-mixin": "npm:~25.0.3"+ lit: "npm:^3.0.0"+ checksum: 10c0/ee1656153ce8692ded9a000d508f6da2a6c19000f589cd12fc9b0ad1a747d6248e0b4965824d00eafb22d1b3e89ea09be58fa26bac85f1bad6f9b0ac477627d0+ languageName: node+ linkType: hard+"@vaadin/vaadin-development-mode-detector@npm:^2.0.0":version: 2.0.7resolution: "@vaadin/vaadin-development-mode-detector@npm:2.0.7"@@ -3771,25 +3909,14 @@ __metadata:languageName: nodelinkType: hard-"@vaadin/vaadin-lumo-styles@npm:~25.0.1":- version: 25.0.1- resolution: "@vaadin/vaadin-lumo-styles@npm:25.0.1"- dependencies:- "@vaadin/component-base": "npm:~25.0.1"- "@vaadin/icon": "npm:~25.0.1"- "@vaadin/vaadin-themable-mixin": "npm:~25.0.1"- checksum: 10c0/4ecce43381dbc8660f2428df5b1a053608411114b3c919c90b7aae3edfdda30d7e2d2de8762ca29152eafec2abea8044e522f47d9d381da6eca868549e095fa4- languageName: node- linkType: hard--"@vaadin/vaadin-themable-mixin@npm:~25.0.1":- version: 25.0.1- resolution: "@vaadin/vaadin-themable-mixin@npm:25.0.1"+"@vaadin/vaadin-lumo-styles@npm:~25.0.3":+ version: 25.0.3+ resolution: "@vaadin/vaadin-lumo-styles@npm:25.0.3"dependencies:- "@open-wc/dedupe-mixin": "npm:^1.3.0"- "@vaadin/component-base": "npm:~25.0.1"- lit: "npm:^3.0.0"- checksum: 10c0/4b7dfb7f5c49c8757634ac7bda85daca552ddd8d57ef1f9c0569a345313e02eddd63986e8ac8cae557bf76fcaed1cb390221a7c3f0fcb9a849d865610d8a31f3+ "@vaadin/component-base": "npm:~25.0.3"+ "@vaadin/icon": "npm:~25.0.3"+ "@vaadin/vaadin-themable-mixin": "npm:~25.0.3"+ checksum: 10c0/be792133987a84d9b2562e47f22a4bdec4415e8f9db1ec1c01c2d98ae9f43b8c766316d5960b53fec14b80a09af96cd913b9c65895378aa44cd922bf0c6e5367languageName: nodelinkType: hard