@openremote/or-vaadin-components 1.13.1 → 1.14.0-snapshot

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/README.md +17 -2
  2. package/custom-elements-jsx.d.ts +6398 -192
  3. package/custom-elements-manifest.config.mjs +116 -0
  4. package/custom-elements.json +108678 -512
  5. package/lib/or-vaadin-button.d.ts +8 -0
  6. package/lib/or-vaadin-button.d.ts.map +1 -0
  7. package/lib/or-vaadin-button.js +1 -0
  8. package/lib/or-vaadin-button.js.map +1 -0
  9. package/lib/or-vaadin-checkbox-group.d.ts +7 -0
  10. package/lib/or-vaadin-checkbox-group.d.ts.map +1 -0
  11. package/lib/or-vaadin-checkbox-group.js +1 -0
  12. package/lib/or-vaadin-checkbox-group.js.map +1 -0
  13. package/lib/or-vaadin-checkbox.d.ts +4 -1
  14. package/lib/or-vaadin-checkbox.d.ts.map +1 -1
  15. package/lib/or-vaadin-checkbox.js +1 -34
  16. package/lib/or-vaadin-checkbox.js.map +1 -1
  17. package/lib/or-vaadin-date-picker.d.ts +5 -0
  18. package/lib/or-vaadin-date-picker.d.ts.map +1 -0
  19. package/lib/or-vaadin-date-picker.js +1 -0
  20. package/lib/or-vaadin-date-picker.js.map +1 -0
  21. package/lib/or-vaadin-date-time-picker.d.ts +5 -0
  22. package/lib/or-vaadin-date-time-picker.d.ts.map +1 -0
  23. package/lib/or-vaadin-date-time-picker.js +1 -0
  24. package/lib/or-vaadin-date-time-picker.js.map +1 -0
  25. package/lib/or-vaadin-dialog.d.ts +12 -2
  26. package/lib/or-vaadin-dialog.d.ts.map +1 -1
  27. package/lib/or-vaadin-dialog.js +13 -35
  28. package/lib/or-vaadin-dialog.js.map +1 -1
  29. package/lib/or-vaadin-icon.d.ts +7 -0
  30. package/lib/or-vaadin-icon.d.ts.map +1 -0
  31. package/lib/or-vaadin-icon.js +1 -0
  32. package/lib/or-vaadin-icon.js.map +1 -0
  33. package/lib/or-vaadin-input.d.ts +7 -8
  34. package/lib/or-vaadin-input.d.ts.map +1 -1
  35. package/lib/or-vaadin-input.js +2 -258
  36. package/lib/or-vaadin-input.js.map +1 -1
  37. package/lib/or-vaadin-multi-select-combo-box.d.ts +5 -0
  38. package/lib/or-vaadin-multi-select-combo-box.d.ts.map +1 -0
  39. package/lib/or-vaadin-multi-select-combo-box.js +1 -0
  40. package/lib/or-vaadin-multi-select-combo-box.js.map +1 -0
  41. package/lib/or-vaadin-number-field.d.ts +9 -0
  42. package/lib/or-vaadin-number-field.d.ts.map +1 -0
  43. package/lib/or-vaadin-number-field.js +1 -0
  44. package/lib/or-vaadin-number-field.js.map +1 -0
  45. package/lib/{or-vaadin-passwordfield.d.ts → or-vaadin-password-field.d.ts} +2 -2
  46. package/lib/or-vaadin-password-field.d.ts.map +1 -0
  47. package/lib/or-vaadin-password-field.js +1 -0
  48. package/lib/or-vaadin-password-field.js.map +1 -0
  49. package/lib/or-vaadin-radio-group.d.ts +5 -0
  50. package/lib/or-vaadin-radio-group.d.ts.map +1 -0
  51. package/lib/or-vaadin-radio-group.js +1 -0
  52. package/lib/or-vaadin-radio-group.js.map +1 -0
  53. package/lib/or-vaadin-select.d.ts +4 -1
  54. package/lib/or-vaadin-select.d.ts.map +1 -1
  55. package/lib/or-vaadin-select.js +1 -34
  56. package/lib/or-vaadin-select.js.map +1 -1
  57. package/lib/or-vaadin-text-area.d.ts +9 -0
  58. package/lib/or-vaadin-text-area.d.ts.map +1 -0
  59. package/lib/or-vaadin-text-area.js +1 -0
  60. package/lib/or-vaadin-text-area.js.map +1 -0
  61. package/lib/or-vaadin-text-field.d.ts +9 -0
  62. package/lib/or-vaadin-text-field.d.ts.map +1 -0
  63. package/lib/or-vaadin-text-field.js +1 -0
  64. package/lib/or-vaadin-text-field.js.map +1 -0
  65. package/lib/or-vaadin-time-picker.d.ts +5 -0
  66. package/lib/or-vaadin-time-picker.d.ts.map +1 -0
  67. package/lib/or-vaadin-time-picker.js +1 -0
  68. package/lib/or-vaadin-time-picker.js.map +1 -0
  69. package/lib/util.d.ts +6 -30
  70. package/lib/util.d.ts.map +1 -1
  71. package/lib/util.js +1 -372
  72. package/lib/util.js.map +1 -1
  73. package/lib/value-input-provider.d.ts +34 -0
  74. package/lib/value-input-provider.d.ts.map +1 -0
  75. package/lib/value-input-provider.js +20 -0
  76. package/lib/value-input-provider.js.map +1 -0
  77. package/package.json +20 -13
  78. package/stories/or-vaadin-button.stories.ts +79 -0
  79. package/stories/or-vaadin-checkbox.stories.ts +59 -0
  80. package/stories/or-vaadin-dialog.stories.ts +124 -0
  81. package/stories/or-vaadin-number-field.stories.ts +60 -0
  82. package/stories/{or-vaadin-textfield.stories.ts → or-vaadin-text-field.stories.ts} +6 -6
  83. package/lib/or-vaadin-numberfield.d.ts +0 -9
  84. package/lib/or-vaadin-numberfield.d.ts.map +0 -1
  85. package/lib/or-vaadin-numberfield.js +0 -38
  86. package/lib/or-vaadin-numberfield.js.map +0 -1
  87. package/lib/or-vaadin-passwordfield.d.ts.map +0 -1
  88. package/lib/or-vaadin-passwordfield.js +0 -38
  89. package/lib/or-vaadin-passwordfield.js.map +0 -1
  90. package/lib/or-vaadin-textarea.d.ts +0 -9
  91. package/lib/or-vaadin-textarea.d.ts.map +0 -1
  92. package/lib/or-vaadin-textarea.js +0 -38
  93. package/lib/or-vaadin-textarea.js.map +0 -1
  94. package/lib/or-vaadin-textfield.d.ts +0 -9
  95. package/lib/or-vaadin-textfield.d.ts.map +0 -1
  96. package/lib/or-vaadin-textfield.js +0 -38
  97. package/lib/or-vaadin-textfield.js.map +0 -1
@@ -0,0 +1,9 @@
1
+ import { NumberField } from "@vaadin/number-field";
2
+ import { OrVaadinComponent } from "./util";
3
+ import { type LitElement } from "lit";
4
+ declare const OrVaadinNumberField_base: new () => NumberField & LitElement;
5
+ export declare class OrVaadinNumberField extends OrVaadinNumberField_base implements OrVaadinComponent {
6
+ _onEnter(ev: KeyboardEvent): void;
7
+ }
8
+ export {};
9
+ //# sourceMappingURL=or-vaadin-number-field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"or-vaadin-number-field.d.ts","sourceRoot":"","sources":["../src/or-vaadin-number-field.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,WAAW,EAAC,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAC,iBAAiB,EAAC,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAC,KAAK,UAAU,EAAC,MAAM,KAAK,CAAC;wCAGqB,UAAU,WAAW,GAAG,UAAU;AAD3F,qBACa,mBAAoB,SAAQ,wBAAoD,YAAW,iBAAiB;IAE5G,QAAQ,CAAC,EAAE,EAAE,aAAa;CAItC"}
@@ -0,0 +1 @@
1
+ var __decorate=this&&this.__decorate||function(e,r,t,n){var o,i=arguments.length,a=i<3?r:null===n?n=Object.getOwnPropertyDescriptor(r,t):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,r,t,n);else for(var d=e.length-1;d>=0;d--)(o=e[d])&&(a=(i<3?o(a):i>3?o(r,t,a):o(r,t))||a);return i>3&&a&&Object.defineProperty(r,t,a),a};import{customElement as e}from"lit/decorators.js";import{NumberField as r}from"@vaadin/number-field";let OrVaadinNumberField=class extends r{_onEnter(e){return this.dispatchEvent(new CustomEvent("submit",{bubbles:!0,composed:!0})),super._onEnter(e)}};OrVaadinNumberField=__decorate([e("or-vaadin-number-field")],OrVaadinNumberField);export{OrVaadinNumberField};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"or-vaadin-number-field.js","sourceRoot":"","sources":["../src/or-vaadin-number-field.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAC,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAK1C,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAS,WAAkD;IAE/E,QAAQ,CAAC,EAAiB;QAC/B,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC,CAAC;QAC/E,OAAO,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC9B,CAAC;CACJ,CAAA;AANY,mBAAmB;IAD/B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,mBAAmB,CAM/B"}
@@ -1,9 +1,9 @@
1
1
  import { PasswordField } from "@vaadin/password-field";
2
2
  import { OrVaadinComponent } from "./util";
3
- import { LitElement } from "lit";
3
+ import { type LitElement } from "lit";
4
4
  declare const OrVaadinPasswordField_base: new () => PasswordField & LitElement;
5
5
  export declare class OrVaadinPasswordField extends OrVaadinPasswordField_base implements OrVaadinComponent {
6
6
  _onEnter(ev: KeyboardEvent): void;
7
7
  }
8
8
  export {};
9
- //# sourceMappingURL=or-vaadin-passwordfield.d.ts.map
9
+ //# sourceMappingURL=or-vaadin-password-field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"or-vaadin-password-field.d.ts","sourceRoot":"","sources":["../src/or-vaadin-password-field.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAC,iBAAiB,EAAC,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAC,KAAK,UAAU,EAAC,MAAM,KAAK,CAAC;0CAGyB,UAAU,aAAa,GAAG,UAAU;AADjG,qBACa,qBAAsB,SAAQ,0BAAwD,YAAW,iBAAiB;IAElH,QAAQ,CAAC,EAAE,EAAE,aAAa;CAItC"}
@@ -0,0 +1 @@
1
+ var __decorate=this&&this.__decorate||function(e,r,t,o){var a,d=arguments.length,s=d<3?r:null===o?o=Object.getOwnPropertyDescriptor(r,t):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,r,t,o);else for(var i=e.length-1;i>=0;i--)(a=e[i])&&(s=(d<3?a(s):d>3?a(r,t,s):a(r,t))||s);return d>3&&s&&Object.defineProperty(r,t,s),s};import{customElement as e}from"lit/decorators.js";import{PasswordField as r}from"@vaadin/password-field";let OrVaadinPasswordField=class extends r{_onEnter(e){return this.dispatchEvent(new CustomEvent("submit",{bubbles:!0,composed:!0})),super._onEnter(e)}};OrVaadinPasswordField=__decorate([e("or-vaadin-password-field")],OrVaadinPasswordField);export{OrVaadinPasswordField};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"or-vaadin-password-field.js","sourceRoot":"","sources":["../src/or-vaadin-password-field.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAC;AAK9C,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAS,aAAsD;IAErF,QAAQ,CAAC,EAAiB;QAC/B,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC,CAAC;QAC/E,OAAO,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC9B,CAAC;CACJ,CAAA;AANY,qBAAqB;IADjC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,qBAAqB,CAMjC"}
@@ -0,0 +1,5 @@
1
+ import { RadioGroup } from "@vaadin/radio-group";
2
+ import { OrVaadinComponent } from "./util";
3
+ export declare class OrVaadinRadioGroup extends RadioGroup implements OrVaadinComponent {
4
+ }
5
+ //# sourceMappingURL=or-vaadin-radio-group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"or-vaadin-radio-group.d.ts","sourceRoot":"","sources":["../src/or-vaadin-radio-group.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAE3C,qBACa,kBAAmB,SAAQ,UAAW,YAAW,iBAAiB;CAAG"}
@@ -0,0 +1 @@
1
+ var __decorate=this&&this.__decorate||function(e,r,o,t){var a,i=arguments.length,d=i<3?r:null===t?t=Object.getOwnPropertyDescriptor(r,o):t;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)d=Reflect.decorate(e,r,o,t);else for(var n=e.length-1;n>=0;n--)(a=e[n])&&(d=(i<3?a(d):i>3?a(r,o,d):a(r,o))||d);return i>3&&d&&Object.defineProperty(r,o,d),d};import{customElement as e}from"lit/decorators.js";import{RadioGroup as r}from"@vaadin/radio-group";let OrVaadinRadioGroup=class extends r{};OrVaadinRadioGroup=__decorate([e("or-vaadin-radio-group")],OrVaadinRadioGroup);export{OrVaadinRadioGroup};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"or-vaadin-radio-group.js","sourceRoot":"","sources":["../src/or-vaadin-radio-group.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAI1C,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,UAAU;CAAgC,CAAA;AAArE,kBAAkB;IAD9B,aAAa,CAAC,uBAAuB,CAAC;GAC1B,kBAAkB,CAAmD"}
@@ -1,5 +1,8 @@
1
1
  import { Select } from "@vaadin/select";
2
2
  import { OrVaadinComponent } from "./util";
3
- export declare class OrVaadinSelect extends Select implements OrVaadinComponent {
3
+ import { type LitElement } from "lit";
4
+ declare const OrVaadinSelect_base: new () => Select & LitElement;
5
+ export declare class OrVaadinSelect extends OrVaadinSelect_base implements OrVaadinComponent {
4
6
  }
7
+ export {};
5
8
  //# sourceMappingURL=or-vaadin-select.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"or-vaadin-select.d.ts","sourceRoot":"","sources":["../src/or-vaadin-select.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAC,iBAAiB,EAAC,MAAM,QAAQ,CAAC;AAEzC,qBACa,cAAe,SAAQ,MAAO,YAAW,iBAAiB;CAEtE"}
1
+ {"version":3,"file":"or-vaadin-select.d.ts","sourceRoot":"","sources":["../src/or-vaadin-select.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAC,iBAAiB,EAAC,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAC,KAAK,UAAU,EAAC,MAAM,KAAK,CAAC;mCAGW,UAAU,MAAM,GAAG,UAAU;AAD5E,qBACa,cAAe,SAAQ,mBAA0C,YAAW,iBAAiB;CAEzG"}
@@ -1,34 +1 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- /*
8
- * Copyright 2025, OpenRemote Inc.
9
- *
10
- * See the CONTRIBUTORS.txt file in the distribution for a
11
- * full listing of individual contributors.
12
- *
13
- * This program is free software: you can redistribute it and/or modify
14
- * it under the terms of the GNU Affero General Public License as
15
- * published by the Free Software Foundation, either version 3 of the
16
- * License, or (at your option) any later version.
17
- *
18
- * This program is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- * GNU Affero General Public License for more details.
22
- *
23
- * You should have received a copy of the GNU Affero General Public License
24
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
25
- */
26
- import { Select } from "@vaadin/select";
27
- import { customElement } from "lit/decorators.js";
28
- let OrVaadinSelect = class OrVaadinSelect extends Select {
29
- };
30
- OrVaadinSelect = __decorate([
31
- customElement("or-vaadin-select")
32
- ], OrVaadinSelect);
33
- export { OrVaadinSelect };
34
- //# sourceMappingURL=or-vaadin-select.js.map
1
+ var __decorate=this&&this.__decorate||function(e,t,r,a){var c,o=arguments.length,l=o<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,a);else for(var n=e.length-1;n>=0;n--)(c=e[n])&&(l=(o<3?c(l):o>3?c(t,r,l):c(t,r))||l);return o>3&&l&&Object.defineProperty(t,r,l),l};import{Select as e}from"@vaadin/select";import{customElement as t}from"lit/decorators.js";let OrVaadinSelect=class extends e{};OrVaadinSelect=__decorate([t("or-vaadin-select")],OrVaadinSelect);export{OrVaadinSelect};
@@ -1 +1 @@
1
- {"version":3,"file":"or-vaadin-select.js","sourceRoot":"","sources":["../src/or-vaadin-select.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAIzC,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,MAAM;CAEzC,CAAA;AAFY,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAE1B"}
1
+ {"version":3,"file":"or-vaadin-select.js","sourceRoot":"","sources":["../src/or-vaadin-select.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAKzC,IAAM,cAAc,GAApB,MAAM,cAAe,SAAS,MAAwC;CAE5E,CAAA;AAFY,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAE1B"}
@@ -0,0 +1,9 @@
1
+ import { TextArea } from "@vaadin/text-area";
2
+ import { OrVaadinComponent } from "./util";
3
+ import { type LitElement } from "lit";
4
+ declare const OrVaadinTextArea_base: new () => TextArea & LitElement;
5
+ export declare class OrVaadinTextArea extends OrVaadinTextArea_base implements OrVaadinComponent {
6
+ _onEnter(ev: KeyboardEvent): void;
7
+ }
8
+ export {};
9
+ //# sourceMappingURL=or-vaadin-text-area.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"or-vaadin-text-area.d.ts","sourceRoot":"","sources":["../src/or-vaadin-text-area.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,iBAAiB,EAAC,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAC,KAAK,UAAU,EAAC,MAAM,KAAK,CAAC;qCAGe,UAAU,QAAQ,GAAG,UAAU;AADlF,qBACa,gBAAiB,SAAQ,qBAA8C,YAAW,iBAAiB;IAEnG,QAAQ,CAAC,EAAE,EAAE,aAAa;CAItC"}
@@ -0,0 +1 @@
1
+ var __decorate=this&&this.__decorate||function(e,t,r,a){var o,n=arguments.length,i=n<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,a);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(n<3?o(i):n>3?o(t,r,i):o(t,r))||i);return n>3&&i&&Object.defineProperty(t,r,i),i};import{customElement as e}from"lit/decorators.js";import{TextArea as t}from"@vaadin/text-area";let OrVaadinTextArea=class extends t{_onEnter(e){return this.dispatchEvent(new CustomEvent("submit",{bubbles:!0,composed:!0})),super._onEnter(e)}};OrVaadinTextArea=__decorate([e("or-vaadin-text-area")],OrVaadinTextArea);export{OrVaadinTextArea};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"or-vaadin-text-area.js","sourceRoot":"","sources":["../src/or-vaadin-text-area.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAKpC,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAS,QAA4C;IAEtE,QAAQ,CAAC,EAAiB;QAC/B,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC,CAAC;QAC/E,OAAO,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC9B,CAAC;CACJ,CAAA;AANY,gBAAgB;IAD5B,aAAa,CAAC,qBAAqB,CAAC;GACxB,gBAAgB,CAM5B"}
@@ -0,0 +1,9 @@
1
+ import { TextField } from "@vaadin/text-field";
2
+ import { type LitElement } from "lit";
3
+ import { OrVaadinComponent } from "./util";
4
+ declare const OrVaadinTextField_base: new () => TextField & LitElement;
5
+ export declare class OrVaadinTextField extends OrVaadinTextField_base implements OrVaadinComponent {
6
+ _onEnter(ev: KeyboardEvent): void;
7
+ }
8
+ export {};
9
+ //# sourceMappingURL=or-vaadin-text-field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"or-vaadin-text-field.d.ts","sourceRoot":"","sources":["../src/or-vaadin-text-field.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAC,KAAK,UAAU,EAAC,MAAM,KAAK,CAAC;AACpC,OAAO,EAAC,iBAAiB,EAAC,MAAM,QAAQ,CAAC;sCAGY,UAAU,SAAS,GAAG,UAAU;AADrF,qBACa,iBAAkB,SAAQ,sBAAgD,YAAW,iBAAiB;IAEtG,QAAQ,CAAC,EAAE,EAAE,aAAa;CAItC"}
@@ -0,0 +1 @@
1
+ var __decorate=this&&this.__decorate||function(e,t,r,o){var i,n=arguments.length,a=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,o);else for(var d=e.length-1;d>=0;d--)(i=e[d])&&(a=(n<3?i(a):n>3?i(t,r,a):i(t,r))||a);return n>3&&a&&Object.defineProperty(t,r,a),a};import{customElement as e}from"lit/decorators.js";import{TextField as t}from"@vaadin/text-field";let OrVaadinTextField=class extends t{_onEnter(e){return this.dispatchEvent(new CustomEvent("submit",{bubbles:!0,composed:!0})),super._onEnter(e)}};OrVaadinTextField=__decorate([e("or-vaadin-text-field")],OrVaadinTextField);export{OrVaadinTextField};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"or-vaadin-text-field.js","sourceRoot":"","sources":["../src/or-vaadin-text-field.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAKtC,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAS,SAA8C;IAEzE,QAAQ,CAAC,EAAiB;QAC/B,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC,CAAC;QAC/E,OAAO,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC9B,CAAC;CACJ,CAAA;AANY,iBAAiB;IAD7B,aAAa,CAAC,sBAAsB,CAAC;GACzB,iBAAiB,CAM7B"}
@@ -0,0 +1,5 @@
1
+ import { TimePicker } from "@vaadin/time-picker";
2
+ import { OrVaadinComponent } from "./util";
3
+ export declare class OrVaadinTimePicker extends TimePicker implements OrVaadinComponent {
4
+ }
5
+ //# sourceMappingURL=or-vaadin-time-picker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"or-vaadin-time-picker.d.ts","sourceRoot":"","sources":["../src/or-vaadin-time-picker.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAE3C,qBACa,kBAAmB,SAAQ,UAAW,YAAW,iBAAiB;CAAG"}
@@ -0,0 +1 @@
1
+ var __decorate=this&&this.__decorate||function(e,r,t,i){var a,c=arguments.length,o=c<3?r:null===i?i=Object.getOwnPropertyDescriptor(r,t):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,r,t,i);else for(var n=e.length-1;n>=0;n--)(a=e[n])&&(o=(c<3?a(o):c>3?a(r,t,o):a(r,t))||o);return c>3&&o&&Object.defineProperty(r,t,o),o};import{customElement as e}from"lit/decorators.js";import{TimePicker as r}from"@vaadin/time-picker";let OrVaadinTimePicker=class extends r{};OrVaadinTimePicker=__decorate([e("or-vaadin-time-picker")],OrVaadinTimePicker);export{OrVaadinTimePicker};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"or-vaadin-time-picker.js","sourceRoot":"","sources":["../src/or-vaadin-time-picker.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAI1C,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,UAAU;CAAgC,CAAA;AAArE,kBAAkB;IAD9B,aAAa,CAAC,uBAAuB,CAAC;GAC1B,kBAAkB,CAAmD"}
package/lib/util.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import type { AssetDescriptor, NameHolder, ValueDescriptor, ValueDescriptorHolder, ValueHolder } from "@openremote/model";
2
- import { TemplateResult } from "lit";
3
1
  export declare enum InputType {
4
2
  BUTTON = "button",
5
3
  BUTTON_TOGGLE = "button-toggle",
@@ -35,34 +33,12 @@ export declare enum InputType {
35
33
  export interface OrVaadinComponent {
36
34
  getAttributeNames(): string[];
37
35
  }
38
- export interface ValueInputProviderOptions {
39
- label?: string;
40
- required?: boolean;
41
- readonly?: boolean;
42
- disabled?: boolean;
43
- compact?: boolean;
44
- rounded?: boolean;
45
- outlined?: boolean;
46
- comfortable?: boolean;
47
- resizeVertical?: boolean;
48
- inputType?: InputType;
49
- }
50
- export interface ValueInputProvider {
51
- templateFunction: ValueInputTemplateFunction;
52
- supportsHelperText: boolean;
53
- supportsLabel: boolean;
54
- supportsSendButton: boolean;
55
- validator?: () => boolean;
56
- }
57
- export type ValueInputTemplateFunction = ((value: any, focused: boolean, loading: boolean, sending: boolean, error: boolean, helperText: string | undefined) => TemplateResult | PromiseLike<TemplateResult>) | undefined;
58
- 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;
59
36
  /**
60
- * Internal function to retrieve HTML template based on the Asset-, attribute-, and value descriptors
61
- * It generates a template using `or-vaadin-input`, together with respective HTML attributes like min/max, pattern, and of course 'input type'.
62
- * For example, a 'positive number' attribute will render a `<or-vaadin-input type="number" min="0">`.
63
- * If the Vaadin input doesn't support the 'input type', it will automatically fall back to the older `or-mwc-input`.
64
- *
65
- * This is mostly copied over from `or-mwc-input`, so this will need optimizing once that has been deprecated.
37
+ * Returns whether the {@link InputType} should show a "send" button within the attribute input UI.
38
+ * Some input types have internal mechanics for updating attributes, which is why they should return `false`.
39
+ * Generic input types, like a text field, "support a send button", so should return `true`
66
40
  */
67
- export declare const getValueHolderInputTemplateProvider: ValueInputProviderGenerator;
41
+ export declare function inputTypeSupportsSendButton(inputType: InputType): boolean;
42
+ export declare function inputTypeSupportsHelperText(inputType: InputType): boolean;
43
+ export declare function inputTypeSupportsLabel(inputType: InputType): boolean;
68
44
  //# sourceMappingURL=util.d.ts.map
package/lib/util.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EACR,eAAe,EAIf,UAAU,EAeV,eAAe,EACf,qBAAqB,EAErB,WAAW,EACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAO,cAAc,EAAC,MAAM,KAAK,CAAC;AAMzC,oBAAY,SAAS;IACjB,MAAM,WAAW;IACjB,aAAa,kBAAkB;IAC/B,gBAAgB,qBAAqB;IACrC,QAAQ,aAAa;IACrB,aAAa,kBAAkB;IAC/B,MAAM,UAAU;IAChB,IAAI,SAAS;IACb,QAAQ,mBAAmB;IAC3B,KAAK,UAAU;IACf,IAAI,SAAS;IACb,WAAW,gBAAgB;IAC3B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,SAAS,QAAQ;IACjB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,aAAa,kBAAkB;IAC/B,eAAe,oBAAoB;CACtC;AAED,MAAM,WAAW,iBAAiB;IAC9B,iBAAiB,IAAI,MAAM,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,yBAAyB;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,SAAS,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IAC/B,gBAAgB,EAAE,0BAA0B,CAAC;IAC7C,kBAAkB,EAAE,OAAO,CAAC;IAC5B,aAAa,EAAE,OAAO,CAAC;IACvB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC;CAC7B;AAED,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,KAAK,cAAc,GAAG,WAAW,CAAC,cAAc,CAAC,CAAC,GAAG,SAAS,CAAC;AAE1N,MAAM,MAAM,2BAA2B,GAAG,CAAC,eAAe,EAAE,eAAe,GAAG,MAAM,EAAE,WAAW,EAAE,UAAU,GAAG,WAAW,CAAC,GAAG,CAAC,GAAG,SAAS,EAAE,qBAAqB,EAAE,qBAAqB,GAAG,SAAS,EAAE,eAAe,EAAE,eAAe,EAC3L,mBAAmB,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,iBAAiB,CAAC,EAAE,OAAO,KAAK,IAAI,EAAE,OAAO,EAAE,yBAAyB,KAAK,kBAAkB,CAAC;AAiC/K;;;;;;;GAOG;AACH,eAAO,MAAM,mCAAmC,EAAE,2BAiSjD,CAAC"}
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAmBA,oBAAY,SAAS;IACjB,MAAM,WAAW;IACjB,aAAa,kBAAkB;IAC/B,gBAAgB,qBAAqB;IACrC,QAAQ,aAAa;IACrB,aAAa,kBAAkB;IAC/B,MAAM,UAAU;IAChB,IAAI,SAAS;IACb,QAAQ,mBAAmB;IAC3B,KAAK,UAAU;IACf,IAAI,SAAS;IACb,WAAW,gBAAgB;IAC3B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,SAAS,QAAQ;IACjB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,aAAa,kBAAkB;IAC/B,eAAe,oBAAoB;CACtC;AAED,MAAM,WAAW,iBAAiB;IAC9B,iBAAiB,IAAI,MAAM,EAAE,CAAC;CACjC;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAgBzE;AAED,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,SAAS,WAE/D;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,SAAS,WAE1D"}
package/lib/util.js CHANGED
@@ -1,372 +1 @@
1
- /*
2
- * Copyright 2025, OpenRemote Inc.
3
- *
4
- * See the CONTRIBUTORS.txt file in the distribution for a
5
- * full listing of individual contributors.
6
- *
7
- * This program is free software: you can redistribute it and/or modify
8
- * it under the terms of the GNU Affero General Public License as
9
- * published by the Free Software Foundation, either version 3 of the
10
- * License, or (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU Affero General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU Affero General Public License
18
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
- */
20
- import { Util } from "@openremote/core";
21
- import { html } from "lit";
22
- import { ref, createRef } from "lit/directives/ref.js";
23
- import { ifDefined } from "lit/directives/if-defined.js";
24
- import { styleMap } from "lit/directives/style-map.js";
25
- import { OrVaadinInput } from "./or-vaadin-input";
26
- export var InputType;
27
- (function (InputType) {
28
- InputType["BUTTON"] = "button";
29
- InputType["BUTTON_TOGGLE"] = "button-toggle";
30
- InputType["BUTTON_MOMENTARY"] = "button-momentary";
31
- InputType["CHECKBOX"] = "checkbox";
32
- InputType["CHECKBOX_LIST"] = "checkbox-list";
33
- InputType["COLOUR"] = "color";
34
- InputType["DATE"] = "date";
35
- InputType["DATETIME"] = "datetime-local";
36
- InputType["EMAIL"] = "email";
37
- InputType["JSON"] = "json";
38
- InputType["JSON_OBJECT"] = "json-object";
39
- InputType["MONTH"] = "month";
40
- InputType["NUMBER"] = "number";
41
- InputType["BIG_INT"] = "big-int";
42
- InputType["PASSWORD"] = "password";
43
- InputType["RADIO"] = "radio";
44
- InputType["SWITCH"] = "switch";
45
- InputType["RANGE"] = "range";
46
- InputType["TELEPHONE"] = "tel";
47
- InputType["TEXT"] = "text";
48
- InputType["TEXTAREA"] = "textarea";
49
- InputType["TIME"] = "time";
50
- InputType["URL"] = "url";
51
- InputType["WEEK"] = "week";
52
- InputType["SELECT"] = "select";
53
- InputType["LIST"] = "list";
54
- InputType["CRON"] = "cron";
55
- InputType["DURATION"] = "duration";
56
- InputType["DURATION_TIME"] = "duration-time";
57
- InputType["DURATION_PERIOD"] = "duration-period";
58
- })(InputType || (InputType = {}));
59
- /**
60
- * Returns whether the {@link InputType} should show a "send" button within the attribute input UI.
61
- * Some input types have internal mechanics for updating attributes, which is why they should return `false`.
62
- * Generic input types, like a text field, "support a send button", so should return `true`
63
- */
64
- function inputTypeSupportsSendButton(inputType) {
65
- return inputType === InputType.NUMBER
66
- || inputType === InputType.BIG_INT
67
- || inputType === InputType.TELEPHONE
68
- || inputType === InputType.TEXT
69
- || inputType === InputType.PASSWORD
70
- || inputType === InputType.DATE
71
- || inputType === InputType.DATETIME
72
- || inputType === InputType.EMAIL
73
- || inputType === InputType.JSON
74
- || inputType === InputType.JSON_OBJECT
75
- || inputType === InputType.MONTH
76
- || inputType === InputType.TEXTAREA
77
- || inputType === InputType.TIME
78
- || inputType === InputType.URL
79
- || inputType === InputType.WEEK;
80
- }
81
- function inputTypeSupportsHelperText(inputType) {
82
- return inputTypeSupportsSendButton(inputType) || inputType === InputType.SELECT;
83
- }
84
- function inputTypeSupportsLabel(inputType) {
85
- return inputTypeSupportsHelperText(inputType) || inputType === InputType.CHECKBOX || inputType === InputType.BUTTON_MOMENTARY;
86
- }
87
- /**
88
- * Internal function to retrieve HTML template based on the Asset-, attribute-, and value descriptors
89
- * It generates a template using `or-vaadin-input`, together with respective HTML attributes like min/max, pattern, and of course 'input type'.
90
- * For example, a 'positive number' attribute will render a `<or-vaadin-input type="number" min="0">`.
91
- * If the Vaadin input doesn't support the 'input type', it will automatically fall back to the older `or-mwc-input`.
92
- *
93
- * This is mostly copied over from `or-mwc-input`, so this will need optimizing once that has been deprecated.
94
- */
95
- export const getValueHolderInputTemplateProvider = (assetDescriptor, valueHolder, valueHolderDescriptor, valueDescriptor, valueChangeNotifier, options) => {
96
- let inputType = options.inputType;
97
- let step;
98
- let pattern;
99
- let min;
100
- let max;
101
- let multiple;
102
- let required;
103
- let selectOptions;
104
- let valueConverter;
105
- const styles = {};
106
- const assetType = typeof assetDescriptor === "string" ? assetDescriptor : assetDescriptor.name;
107
- const constraints = (valueHolder && (valueHolder.meta) || (valueDescriptor && valueDescriptor.meta) ? Util.getAttributeValueConstraints(valueHolder, valueHolderDescriptor, assetType) : Util.getMetaValueConstraints(valueHolder, valueHolderDescriptor, assetType)) || [];
108
- const format = (valueHolder && (valueHolder.meta) || (valueDescriptor && valueDescriptor.meta) ? Util.getAttributeValueFormat(valueHolder, valueHolderDescriptor, assetType) : Util.getMetaValueFormat(valueHolder, valueHolderDescriptor, assetType));
109
- const supportsVaadinInput = (type) => (OrVaadinInput.TEMPLATES.has(type) && !(format === null || format === void 0 ? void 0 : format.asSlider) && !(format === null || format === void 0 ? void 0 : format.asOnOff));
110
- // Determine input type
111
- if (!inputType) {
112
- switch (valueDescriptor.name) {
113
- case "text" /* WellknownValueTypes.TEXT */:
114
- case "email" /* WellknownValueTypes.EMAIL */:
115
- case "UUID" /* WellknownValueTypes.UUID */:
116
- case "assetID" /* WellknownValueTypes.ASSETID */:
117
- case "hostOrIPAddress" /* WellknownValueTypes.HOSTORIPADDRESS */:
118
- case "IPAddress" /* WellknownValueTypes.IPADDRESS */:
119
- inputType = Util.getMetaValue("multiline" /* WellknownMetaItems.MULTILINE */, valueHolder, valueHolderDescriptor) === true ? InputType.TEXTAREA : InputType.TEXT;
120
- break;
121
- case "boolean" /* WellknownValueTypes.BOOLEAN */:
122
- if (format && format.asNumber) {
123
- inputType = InputType.NUMBER;
124
- step = 1;
125
- min = 0;
126
- max = 1;
127
- valueConverter = v => !!v;
128
- break;
129
- }
130
- if (format && (format.asOnOff || format.asOpenClosed)) {
131
- inputType = InputType.SWITCH;
132
- }
133
- else {
134
- inputType = InputType.CHECKBOX;
135
- }
136
- if ((format && format.asMomentary) || (Util.getMetaValue("momentary" /* WellknownMetaItems.MOMENTARY */, valueHolder, valueHolderDescriptor) === true)) {
137
- inputType = InputType.BUTTON_MOMENTARY;
138
- }
139
- break;
140
- case "bigNumber" /* WellknownValueTypes.BIGNUMBER */:
141
- case "number" /* WellknownValueTypes.NUMBER */:
142
- case "positiveInteger" /* WellknownValueTypes.POSITIVEINTEGER */:
143
- case "positiveNumber" /* WellknownValueTypes.POSITIVENUMBER */:
144
- case "long" /* WellknownValueTypes.LONG */:
145
- case "integer" /* WellknownValueTypes.INTEGER */:
146
- case "byte" /* WellknownValueTypes.BYTE */:
147
- case "integerByte" /* WellknownValueTypes.INTEGERBYTE */:
148
- case "direction" /* WellknownValueTypes.DIRECTION */:
149
- case "TCP_IPPortNumber" /* WellknownValueTypes.TCPIPPORTNUMBER */:
150
- if (valueDescriptor.name === "byte" /* WellknownValueTypes.BYTE */ || valueDescriptor.name === "integerByte" /* WellknownValueTypes.INTEGERBYTE */) {
151
- min = 0;
152
- max = 255;
153
- step = 1;
154
- }
155
- else if (valueDescriptor.name === "integer" /* WellknownValueTypes.INTEGER */ || valueDescriptor.name === "long" /* WellknownValueTypes.LONG */) {
156
- step = 1;
157
- }
158
- if (format && format.asDate) {
159
- inputType = InputType.DATETIME;
160
- }
161
- else if (format && format.asBoolean) {
162
- inputType = InputType.CHECKBOX;
163
- valueConverter = v => v ? 1 : 0;
164
- }
165
- else if (format && format.asSlider) {
166
- inputType = InputType.RANGE;
167
- }
168
- else {
169
- inputType = InputType.NUMBER;
170
- }
171
- break;
172
- case "bigInteger" /* WellknownValueTypes.BIGINTEGER */:
173
- inputType = InputType.BIG_INT;
174
- step = 1;
175
- break;
176
- case "colourRGB" /* WellknownValueTypes.COLOURRGB */:
177
- inputType = InputType.COLOUR;
178
- break;
179
- case "dateAndTime" /* WellknownValueTypes.DATEANDTIME */:
180
- case "timestamp" /* WellknownValueTypes.TIMESTAMP */:
181
- case "timestampISO8601" /* WellknownValueTypes.TIMESTAMPISO8601 */:
182
- inputType = InputType.DATETIME;
183
- break;
184
- case "CRONExpression" /* WellknownValueTypes.CRONEXPRESSION */:
185
- inputType = InputType.CRON;
186
- break;
187
- case "timeDurationISO8601" /* WellknownValueTypes.TIMEDURATIONISO8601 */:
188
- inputType = InputType.DURATION_TIME;
189
- break;
190
- case "periodDurationISO8601" /* WellknownValueTypes.PERIODDURATIONISO8601 */:
191
- inputType = InputType.DURATION_PERIOD;
192
- break;
193
- case "timeAndPeriodDurationISO8601" /* WellknownValueTypes.TIMEANDPERIODDURATIONISO8601 */:
194
- inputType = InputType.DURATION;
195
- break;
196
- case "JSONObject" /* WellknownValueTypes.JSONOBJECT */:
197
- inputType = InputType.JSON_OBJECT;
198
- break;
199
- }
200
- if (valueDescriptor.arrayDimensions && valueDescriptor.arrayDimensions > 0) {
201
- inputType = InputType.JSON;
202
- }
203
- }
204
- if (!inputType) {
205
- switch (valueDescriptor.jsonType) {
206
- case "number":
207
- case "bigint":
208
- inputType = InputType.NUMBER;
209
- break;
210
- case "boolean":
211
- inputType = InputType.CHECKBOX;
212
- break;
213
- case "string":
214
- inputType = InputType.TEXT;
215
- break;
216
- case "date":
217
- inputType = InputType.DATETIME;
218
- break;
219
- default:
220
- break;
221
- }
222
- }
223
- if (!inputType) {
224
- inputType = InputType.JSON;
225
- }
226
- // Apply any constraints
227
- const sizeConstraint = constraints === null || constraints === void 0 ? void 0 : constraints.find(c => c.type === "size");
228
- const patternConstraint = constraints === null || constraints === void 0 ? void 0 : constraints.find(c => c.type === "pattern");
229
- const minConstraint = constraints === null || constraints === void 0 ? void 0 : constraints.find(c => c.type === "min");
230
- const maxConstraint = constraints === null || constraints === void 0 ? void 0 : constraints.find(c => c.type === "max");
231
- const allowedValuesConstraint = constraints === null || constraints === void 0 ? void 0 : constraints.find(c => c.type === "allowedValues");
232
- const pastConstraint = constraints === null || constraints === void 0 ? void 0 : constraints.find(c => c.type === "past");
233
- const pastOrPresentConstraint = constraints === null || constraints === void 0 ? void 0 : constraints.find(c => c.type === "pastOrPresent");
234
- const futureConstraint = constraints === null || constraints === void 0 ? void 0 : constraints.find(c => c.type === "future");
235
- const futureOrPresentConstraint = constraints === null || constraints === void 0 ? void 0 : constraints.find(c => c.type === "futureOrPresent");
236
- const notEmptyConstraint = constraints === null || constraints === void 0 ? void 0 : constraints.find(c => c.type === "notEmpty");
237
- const notBlankConstraint = constraints === null || constraints === void 0 ? void 0 : constraints.find(c => c.type === "notBlank");
238
- const notNullConstraint = constraints === null || constraints === void 0 ? void 0 : constraints.find(c => c.type === "notNull");
239
- if (sizeConstraint) {
240
- min = sizeConstraint.min;
241
- max = sizeConstraint.max;
242
- }
243
- if (minConstraint) {
244
- min = minConstraint.min;
245
- }
246
- if (maxConstraint) {
247
- max = maxConstraint.max;
248
- }
249
- if (patternConstraint) {
250
- pattern = patternConstraint.regexp;
251
- }
252
- if (notNullConstraint) {
253
- required = true;
254
- }
255
- if (notBlankConstraint && !pattern) {
256
- pattern = String.raw `\S+`;
257
- }
258
- else if (notEmptyConstraint && !pattern) {
259
- pattern = ".+";
260
- }
261
- if (allowedValuesConstraint === null || allowedValuesConstraint === void 0 ? void 0 : allowedValuesConstraint.allowedValues) {
262
- const allowedLabels = allowedValuesConstraint.allowedValueNames && allowedValuesConstraint.allowedValueNames.length === allowedValuesConstraint.allowedValues.length ? allowedValuesConstraint.allowedValueNames : undefined;
263
- selectOptions = allowedValuesConstraint.allowedValues.map((v, i) => {
264
- let label = allowedLabels ? allowedLabels[i] : "" + v;
265
- label = Util.getAllowedValueLabel(label);
266
- return {
267
- value: v,
268
- label: label || "" + v
269
- };
270
- });
271
- inputType = InputType.SELECT;
272
- if (valueDescriptor.arrayDimensions && valueDescriptor.arrayDimensions > 0) {
273
- multiple = true;
274
- }
275
- }
276
- if (inputType === InputType.DATETIME) {
277
- if (pastConstraint || pastOrPresentConstraint) {
278
- min = undefined;
279
- max = new Date();
280
- }
281
- else if (futureConstraint || futureOrPresentConstraint) {
282
- min = new Date();
283
- max = undefined;
284
- }
285
- // Refine the input type based on formatting
286
- if (format) {
287
- if (format.timeStyle && !format.dateStyle) {
288
- inputType = InputType.TIME;
289
- }
290
- else if (format.dateStyle && !format.timeStyle) {
291
- inputType = InputType.DATE;
292
- }
293
- }
294
- }
295
- if (inputType === InputType.NUMBER && (format === null || format === void 0 ? void 0 : format.resolution)) {
296
- step = format.resolution;
297
- }
298
- if (inputType === InputType.COLOUR) {
299
- styles.marginLeft = "24px";
300
- }
301
- const supportsHelperText = inputTypeSupportsHelperText(inputType);
302
- const supportsLabel = inputTypeSupportsLabel(inputType);
303
- const supportsSendButton = inputTypeSupportsSendButton(inputType);
304
- const readonly = options.readonly;
305
- required = required || options.required;
306
- const comfortable = options.comfortable;
307
- const resizeVertical = options.resizeVertical;
308
- const inputRef = createRef();
309
- const templateFunction = (value, focused, loading, sending, _error, helperText) => {
310
- const disabled = options.disabled || loading || sending;
311
- const label = supportsLabel ? options.label : undefined;
312
- const inputStyle = styles ? styleMap(styles) : undefined;
313
- const onValueChange = (ev) => {
314
- var _a;
315
- ev.stopPropagation();
316
- const elem = ev.currentTarget;
317
- if (elem === null || elem === void 0 ? void 0 : elem.checkValidity()) {
318
- const doRemoteUpdate = (!OrVaadinInput.CHANGE_EVENTS.has(inputType) || (OrVaadinInput.CHANGE_EVENTS.get(inputType) === ev.type));
319
- valueChangeNotifier((_a = valueConverter === null || valueConverter === void 0 ? void 0 : valueConverter(elem.nativeValue)) !== null && _a !== void 0 ? _a : elem.nativeValue, doRemoteUpdate);
320
- }
321
- };
322
- if (supportsVaadinInput(inputType)) {
323
- // or-vaadin-checkbox has multiple states (like indeterminate), so it uses the 'checked' HTML attribute instead of 'value'.
324
- let checked = false;
325
- if (inputType === InputType.CHECKBOX) {
326
- checked = Boolean(value);
327
- value = undefined;
328
- }
329
- return html `
330
- <or-vaadin-input ${ref(inputRef)} id="input" style="${ifDefined(inputStyle)}" type=${ifDefined(inputType)}
331
- label=${ifDefined(label)} value=${ifDefined(value)} ?checked="${checked}" pattern=${ifDefined(pattern)}
332
- min=${ifDefined(min)} max=${ifDefined(max)} ?multiple=${multiple} .format=${ifDefined(format)}
333
- ?autofocus=${focused} ?required=${required} ?readonly=${readonly} ?disabled=${disabled}
334
- .items=${ifDefined(selectOptions)} step=${ifDefined(step)}
335
- helper-text="${ifDefined(helperText)}" ?resizeVertical="${resizeVertical}"
336
- ?rounded="${options.rounded}" ?outlined="${options.outlined}"
337
- @change="${onValueChange}"
338
- @submit="${onValueChange}"
339
- ></or-vaadin-input>
340
- `;
341
- }
342
- else {
343
- // Fallback code to use deprecated or-mwc-input. This should be removed in the future, once all input types are supported and mapped.
344
- // Be aware: this function only creates the template, so it does not import or-mwc-input by default.
345
- return html `
346
- <or-mwc-input ${ref(inputRef)} id="input" style="${styleMap(styles)}" .type="${inputType}" .label="${label}" .value="${value}" .pattern="${pattern}"
347
- .min="${min}" .max="${max}" .format="${format}" .focused="${focused}" .required="${required}" .multiple="${multiple}"
348
- .options="${selectOptions}" .comfortable="${comfortable}" .readonly="${readonly}" .disabled="${disabled}" .step="${step}"
349
- .helperText="${helperText}" .helperPersistent="${true}" .resizeVertical="${resizeVertical}"
350
- .rounded="${options.rounded}" .outlined="${options.outlined}"
351
- @or-mwc-input-changed="${(e) => {
352
- e.stopPropagation();
353
- valueChangeNotifier(valueConverter ? valueConverter(e.detail.value) : e.detail.value);
354
- }}"
355
- ></or-mwc-input>
356
- `;
357
- }
358
- };
359
- return {
360
- templateFunction: templateFunction,
361
- supportsHelperText: supportsHelperText,
362
- supportsSendButton: supportsSendButton,
363
- supportsLabel: supportsLabel,
364
- validator: () => {
365
- if (!inputRef.value) {
366
- return false;
367
- }
368
- return inputRef.value.checkValidity();
369
- }
370
- };
371
- };
372
- //# sourceMappingURL=util.js.map
1
+ export var InputType;!function(t){t.BUTTON="button",t.BUTTON_TOGGLE="button-toggle",t.BUTTON_MOMENTARY="button-momentary",t.CHECKBOX="checkbox",t.CHECKBOX_LIST="checkbox-list",t.COLOUR="color",t.DATE="date",t.DATETIME="datetime-local",t.EMAIL="email",t.JSON="json",t.JSON_OBJECT="json-object",t.MONTH="month",t.NUMBER="number",t.BIG_INT="big-int",t.PASSWORD="password",t.RADIO="radio",t.SWITCH="switch",t.RANGE="range",t.TELEPHONE="tel",t.TEXT="text",t.TEXTAREA="textarea",t.TIME="time",t.URL="url",t.WEEK="week",t.SELECT="select",t.LIST="list",t.CRON="cron",t.DURATION="duration",t.DURATION_TIME="duration-time",t.DURATION_PERIOD="duration-period"}(InputType||(InputType={}));export function inputTypeSupportsSendButton(t){return t===InputType.NUMBER||t===InputType.BIG_INT||t===InputType.TELEPHONE||t===InputType.TEXT||t===InputType.PASSWORD||t===InputType.DATE||t===InputType.DATETIME||t===InputType.EMAIL||t===InputType.JSON||t===InputType.JSON_OBJECT||t===InputType.MONTH||t===InputType.TEXTAREA||t===InputType.TIME||t===InputType.URL||t===InputType.WEEK}export function inputTypeSupportsHelperText(t){return inputTypeSupportsSendButton(t)||t===InputType.SELECT}export function inputTypeSupportsLabel(t){return inputTypeSupportsHelperText(t)||t===InputType.CHECKBOX||t===InputType.BUTTON_MOMENTARY}