@eox/feedback 1.0.1 → 1.1.0

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 (191) hide show
  1. package/dist/eox-feedback.js +2451 -2402
  2. package/dist/eox-feedback.umd.cjs +49 -56
  3. package/package.json +10 -3
  4. package/src/feedback-button.js +22 -1
  5. package/src/main.js +153 -24
  6. package/types/drawtools/src/components/controller.d.ts +108 -0
  7. package/types/drawtools/src/components/controller.d.ts.map +1 -0
  8. package/types/drawtools/src/components/list.d.ts +144 -0
  9. package/types/drawtools/src/components/list.d.ts.map +1 -0
  10. package/types/drawtools/src/enums/draw.d.ts +9 -0
  11. package/types/drawtools/src/enums/draw.d.ts.map +1 -0
  12. package/types/drawtools/src/enums/index.d.ts +4 -0
  13. package/types/drawtools/src/enums/index.d.ts.map +1 -0
  14. package/types/drawtools/src/enums/stories.d.ts +26 -0
  15. package/types/drawtools/src/enums/stories.d.ts.map +1 -0
  16. package/types/drawtools/src/enums/test.d.ts +11 -0
  17. package/types/drawtools/src/enums/test.d.ts.map +1 -0
  18. package/types/drawtools/src/helpers/copy-text-to-clipboard.d.ts +7 -0
  19. package/types/drawtools/src/helpers/copy-text-to-clipboard.d.ts.map +1 -0
  20. package/types/drawtools/src/helpers/features-to-geojson.d.ts +12 -0
  21. package/types/drawtools/src/helpers/features-to-geojson.d.ts.map +1 -0
  22. package/types/drawtools/src/helpers/features-to-wkt.d.ts +9 -0
  23. package/types/drawtools/src/helpers/features-to-wkt.d.ts.map +1 -0
  24. package/types/drawtools/src/helpers/generate-upload-events.d.ts +19 -0
  25. package/types/drawtools/src/helpers/generate-upload-events.d.ts.map +1 -0
  26. package/types/drawtools/src/helpers/index.d.ts +4 -0
  27. package/types/drawtools/src/helpers/index.d.ts.map +1 -0
  28. package/types/drawtools/src/main.d.ts +270 -0
  29. package/types/drawtools/src/main.d.ts.map +1 -0
  30. package/types/drawtools/src/methods/controller/index.d.ts +2 -0
  31. package/types/drawtools/src/methods/controller/index.d.ts.map +1 -0
  32. package/types/drawtools/src/methods/controller/update-button-states.d.ts +12 -0
  33. package/types/drawtools/src/methods/controller/update-button-states.d.ts.map +1 -0
  34. package/types/drawtools/src/methods/draw/create-select-handler.d.ts +6 -0
  35. package/types/drawtools/src/methods/draw/create-select-handler.d.ts.map +1 -0
  36. package/types/drawtools/src/methods/draw/discard-drawing.d.ts +9 -0
  37. package/types/drawtools/src/methods/draw/discard-drawing.d.ts.map +1 -0
  38. package/types/drawtools/src/methods/draw/emit-drawn-features.d.ts +20 -0
  39. package/types/drawtools/src/methods/draw/emit-drawn-features.d.ts.map +1 -0
  40. package/types/drawtools/src/methods/draw/handle-layer-id.d.ts +12 -0
  41. package/types/drawtools/src/methods/draw/handle-layer-id.d.ts.map +1 -0
  42. package/types/drawtools/src/methods/draw/index.d.ts +9 -0
  43. package/types/drawtools/src/methods/draw/index.d.ts.map +1 -0
  44. package/types/drawtools/src/methods/draw/init-layer.d.ts +13 -0
  45. package/types/drawtools/src/methods/draw/init-layer.d.ts.map +1 -0
  46. package/types/drawtools/src/methods/draw/init-selection.d.ts +10 -0
  47. package/types/drawtools/src/methods/draw/init-selection.d.ts.map +1 -0
  48. package/types/drawtools/src/methods/draw/on-draw-end.d.ts +9 -0
  49. package/types/drawtools/src/methods/draw/on-draw-end.d.ts.map +1 -0
  50. package/types/drawtools/src/methods/draw/start-drawing.d.ts +9 -0
  51. package/types/drawtools/src/methods/draw/start-drawing.d.ts.map +1 -0
  52. package/types/drawtools/src/methods/list/delete-feature.d.ts +11 -0
  53. package/types/drawtools/src/methods/list/delete-feature.d.ts.map +1 -0
  54. package/types/drawtools/src/methods/list/first-update.d.ts +8 -0
  55. package/types/drawtools/src/methods/list/first-update.d.ts.map +1 -0
  56. package/types/drawtools/src/methods/list/hover-feature.d.ts +10 -0
  57. package/types/drawtools/src/methods/list/hover-feature.d.ts.map +1 -0
  58. package/types/drawtools/src/methods/list/index.d.ts +5 -0
  59. package/types/drawtools/src/methods/list/index.d.ts.map +1 -0
  60. package/types/drawtools/src/methods/list/select-deselect-feature.d.ts +9 -0
  61. package/types/drawtools/src/methods/list/select-deselect-feature.d.ts.map +1 -0
  62. package/types/drawtools/src/style.eox.d.ts.map +1 -0
  63. package/types/{enums → feedback/src/enums}/index.d.ts.map +1 -1
  64. package/types/{enums → feedback/src/enums}/test.d.ts.map +1 -1
  65. package/types/{feedback-button.d.ts → feedback/src/feedback-button.d.ts} +7 -1
  66. package/types/feedback/src/feedback-button.d.ts.map +1 -0
  67. package/types/{main.d.ts → feedback/src/main.d.ts} +15 -1
  68. package/types/feedback/src/main.d.ts.map +1 -0
  69. package/types/{style.d.ts.map → feedback/src/style.d.ts.map} +1 -1
  70. package/types/feedback/src/style.eox.d.ts +2 -0
  71. package/types/{style.eox.d.ts.map → feedback/src/style.eox.d.ts.map} +1 -1
  72. package/types/jsonform/src/custom-inputs/buttons.d.ts +20 -0
  73. package/types/jsonform/src/custom-inputs/buttons.d.ts.map +1 -0
  74. package/types/jsonform/src/custom-inputs/index.d.ts +5 -0
  75. package/types/jsonform/src/custom-inputs/index.d.ts.map +1 -0
  76. package/types/jsonform/src/custom-inputs/minmax.d.ts +16 -0
  77. package/types/jsonform/src/custom-inputs/minmax.d.ts.map +1 -0
  78. package/types/jsonform/src/custom-inputs/spatial/editor.d.ts +19 -0
  79. package/types/jsonform/src/custom-inputs/spatial/editor.d.ts.map +1 -0
  80. package/types/jsonform/src/custom-inputs/spatial/index.d.ts +3 -0
  81. package/types/jsonform/src/custom-inputs/spatial/index.d.ts.map +1 -0
  82. package/types/jsonform/src/custom-inputs/spatial/utils.d.ts +22 -0
  83. package/types/jsonform/src/custom-inputs/spatial/utils.d.ts.map +1 -0
  84. package/types/jsonform/src/custom-inputs/spatial/validator.d.ts +16 -0
  85. package/types/jsonform/src/custom-inputs/spatial/validator.d.ts.map +1 -0
  86. package/types/jsonform/src/enums/editor.d.ts +11 -0
  87. package/types/jsonform/src/enums/editor.d.ts.map +1 -0
  88. package/types/jsonform/src/enums/index.d.ts +4 -0
  89. package/types/jsonform/src/enums/index.d.ts.map +1 -0
  90. package/types/jsonform/src/enums/stories.d.ts +38 -0
  91. package/types/jsonform/src/enums/stories.d.ts.map +1 -0
  92. package/types/jsonform/src/enums/test.d.ts +4 -0
  93. package/types/jsonform/src/enums/test.d.ts.map +1 -0
  94. package/types/jsonform/src/helpers/editor.d.ts +18 -0
  95. package/types/jsonform/src/helpers/editor.d.ts.map +1 -0
  96. package/types/jsonform/src/helpers/index.d.ts +2 -0
  97. package/types/jsonform/src/helpers/index.d.ts.map +1 -0
  98. package/types/jsonform/src/main.d.ts +157 -0
  99. package/types/jsonform/src/main.d.ts.map +1 -0
  100. package/types/jsonform/src/style.d.ts +2 -0
  101. package/types/jsonform/src/style.d.ts.map +1 -0
  102. package/types/jsonform/src/style.eox.d.ts +2 -0
  103. package/types/jsonform/src/style.eox.d.ts.map +1 -0
  104. package/types/map/src/components/compare.d.ts +31 -0
  105. package/types/map/src/components/compare.d.ts.map +1 -0
  106. package/types/map/src/components/tooltip.d.ts +41 -0
  107. package/types/map/src/components/tooltip.d.ts.map +1 -0
  108. package/types/map/src/controls/controls.d.ts +21 -0
  109. package/types/map/src/controls/controls.d.ts.map +1 -0
  110. package/types/map/src/controls/geo-location.d.ts +41 -0
  111. package/types/map/src/controls/geo-location.d.ts.map +1 -0
  112. package/types/map/src/controls/loading-indicator.d.ts +20 -0
  113. package/types/map/src/controls/loading-indicator.d.ts.map +1 -0
  114. package/types/map/src/custom/layers/MapboxStyle.d.ts +13 -0
  115. package/types/map/src/custom/layers/MapboxStyle.d.ts.map +1 -0
  116. package/types/map/src/custom/sources/Cluster.d.ts +20 -0
  117. package/types/map/src/custom/sources/Cluster.d.ts.map +1 -0
  118. package/types/map/src/custom/sources/FlatGeoBuf.d.ts +28 -0
  119. package/types/map/src/custom/sources/FlatGeoBuf.d.ts.map +1 -0
  120. package/types/map/src/custom/sources/WMTSCapabilities.d.ts +35 -0
  121. package/types/map/src/custom/sources/WMTSCapabilities.d.ts.map +1 -0
  122. package/types/map/src/enums/index.d.ts +2 -0
  123. package/types/map/src/enums/index.d.ts.map +1 -0
  124. package/types/map/src/enums/map.d.ts +5 -0
  125. package/types/map/src/enums/map.d.ts.map +1 -0
  126. package/types/map/src/helpers/add-new-feature.d.ts +15 -0
  127. package/types/map/src/helpers/add-new-feature.d.ts.map +1 -0
  128. package/types/map/src/helpers/cancel-animation.d.ts +7 -0
  129. package/types/map/src/helpers/cancel-animation.d.ts.map +1 -0
  130. package/types/map/src/helpers/center.d.ts +12 -0
  131. package/types/map/src/helpers/center.d.ts.map +1 -0
  132. package/types/map/src/helpers/cluster-explode.d.ts +38 -0
  133. package/types/map/src/helpers/cluster-explode.d.ts.map +1 -0
  134. package/types/map/src/helpers/coordinates-roughly-equals.d.ts +12 -0
  135. package/types/map/src/helpers/coordinates-roughly-equals.d.ts.map +1 -0
  136. package/types/map/src/helpers/draw.d.ts +22 -0
  137. package/types/map/src/helpers/draw.d.ts.map +1 -0
  138. package/types/map/src/helpers/generate.d.ts +32 -0
  139. package/types/map/src/helpers/generate.d.ts.map +1 -0
  140. package/types/map/src/helpers/index.d.ts +17 -0
  141. package/types/map/src/helpers/index.d.ts.map +1 -0
  142. package/types/map/src/helpers/interactions.d.ts +16 -0
  143. package/types/map/src/helpers/interactions.d.ts.map +1 -0
  144. package/types/map/src/helpers/layer.d.ts +24 -0
  145. package/types/map/src/helpers/layer.d.ts.map +1 -0
  146. package/types/map/src/helpers/parse-feature.d.ts +8 -0
  147. package/types/map/src/helpers/parse-feature.d.ts.map +1 -0
  148. package/types/map/src/helpers/parse-text.d.ts +45 -0
  149. package/types/map/src/helpers/parse-text.d.ts.map +1 -0
  150. package/types/map/src/helpers/register-projection-from-code.d.ts +8 -0
  151. package/types/map/src/helpers/register-projection-from-code.d.ts.map +1 -0
  152. package/types/map/src/helpers/register-projection.d.ts +11 -0
  153. package/types/map/src/helpers/register-projection.d.ts.map +1 -0
  154. package/types/map/src/helpers/select.d.ts +95 -0
  155. package/types/map/src/helpers/select.d.ts.map +1 -0
  156. package/types/map/src/helpers/tile-grid.d.ts +10 -0
  157. package/types/map/src/helpers/tile-grid.d.ts.map +1 -0
  158. package/types/map/src/helpers/transform.d.ts +19 -0
  159. package/types/map/src/helpers/transform.d.ts.map +1 -0
  160. package/types/map/src/layers.d.ts +125 -0
  161. package/types/map/src/layers.d.ts.map +1 -0
  162. package/types/map/src/main.d.ts +459 -0
  163. package/types/map/src/main.d.ts.map +1 -0
  164. package/types/map/src/methods/map/add-update-layer.d.ts +13 -0
  165. package/types/map/src/methods/map/add-update-layer.d.ts.map +1 -0
  166. package/types/map/src/methods/map/animate-to-state.d.ts +7 -0
  167. package/types/map/src/methods/map/animate-to-state.d.ts.map +1 -0
  168. package/types/map/src/methods/map/first-updated.d.ts +9 -0
  169. package/types/map/src/methods/map/first-updated.d.ts.map +1 -0
  170. package/types/map/src/methods/map/getters.d.ts +22 -0
  171. package/types/map/src/methods/map/getters.d.ts.map +1 -0
  172. package/types/map/src/methods/map/index.d.ts +7 -0
  173. package/types/map/src/methods/map/index.d.ts.map +1 -0
  174. package/types/map/src/methods/map/remove.d.ts +22 -0
  175. package/types/map/src/methods/map/remove.d.ts.map +1 -0
  176. package/types/map/src/methods/map/setters.d.ts +82 -0
  177. package/types/map/src/methods/map/setters.d.ts.map +1 -0
  178. package/types/map/src/plugins/globe/index.d.ts +6 -0
  179. package/types/map/src/plugins/globe/index.d.ts.map +1 -0
  180. package/types/map/src/plugins/globe/methods.d.ts +8 -0
  181. package/types/map/src/plugins/globe/methods.d.ts.map +1 -0
  182. package/types/map/src/plugins/globe/openglobus.d.ts +16 -0
  183. package/types/map/src/plugins/globe/openglobus.d.ts.map +1 -0
  184. package/types/map/src/types.d.ts +178 -0
  185. package/types/map/src/types.d.ts.map +1 -0
  186. package/types/feedback-button.d.ts.map +0 -1
  187. package/types/main.d.ts.map +0 -1
  188. /package/types/{style.eox.d.ts → drawtools/src/style.eox.d.ts} +0 -0
  189. /package/types/{enums → feedback/src/enums}/index.d.ts +0 -0
  190. /package/types/{enums → feedback/src/enums}/test.d.ts +0 -0
  191. /package/types/{style.d.ts → feedback/src/style.d.ts} +0 -0
package/package.json CHANGED
@@ -1,13 +1,17 @@
1
1
  {
2
2
  "name": "@eox/feedback",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git@github.com:EOX-A/EOxElements.git"
8
+ },
5
9
  "devDependencies": {
6
- "vite": "^6.0.3"
10
+ "vite": "^7.1.12"
7
11
  },
8
12
  "dependencies": {
9
13
  "@eox/elements-utils": "^1.1.0",
10
- "@eox/ui": "^0.3.6",
14
+ "@eox/ui": "^0.5.0",
11
15
  "region-screenshot-js": "^1.1.0"
12
16
  },
13
17
  "files": [
@@ -32,5 +36,8 @@
32
36
  "prepack": "npm run types:generate",
33
37
  "build": "vite build",
34
38
  "watch": "vite build --watch"
39
+ },
40
+ "peerDependencies": {
41
+ "@eox/jsonform": "*"
35
42
  }
36
43
  }
@@ -15,9 +15,25 @@ export class EOxFeedbackButton extends HTMLElement {
15
15
  super();
16
16
  this.attachShadow({ mode: "open" });
17
17
 
18
+ /**
19
+ * @type {import("./main").EOxFeedback}
20
+ */
18
21
  this.modal = null;
19
22
 
20
23
  this.position = "top-right";
24
+
25
+ this._schema = null;
26
+ }
27
+
28
+ get schema() {
29
+ return this._schema;
30
+ }
31
+
32
+ set schema(newSchema) {
33
+ this._schema = newSchema;
34
+ if (this.modal) {
35
+ this.modal.schema = this._schema;
36
+ }
21
37
  }
22
38
 
23
39
  attributeChangedCallback(name, oldValue, newValue) {
@@ -44,10 +60,15 @@ export class EOxFeedbackButton extends HTMLElement {
44
60
 
45
61
  onButtonClick() {
46
62
  if (!this.modal) {
47
- this.modal = document.createElement("eox-feedback");
63
+ this.modal = /** @type {import("./main").EOxFeedback} */ (
64
+ document.createElement("eox-feedback")
65
+ );
48
66
  if (this.getAttribute("unstyled") !== null) {
49
67
  this.modal.setAttribute("unstyled", this.getAttribute("unstyled"));
50
68
  }
69
+ if (this.schema) {
70
+ this.modal.schema = this.schema;
71
+ }
51
72
  document.body.appendChild(this.modal);
52
73
  this.modal.addEventListener("close", () => (this.modal = null));
53
74
  } else {
package/src/main.js CHANGED
@@ -4,6 +4,11 @@ import { styleEOX } from "./style.eox";
4
4
  import "./feedback-button.js";
5
5
 
6
6
  /**
7
+ * The `eox-feedback` element provides a modal dialog for collecting user feedback. It supports screenshot capture, customizable endpoint, and flexible styling.
8
+ * The feedback modal (`<eox-feedback></eox-feedback>`) can be included in the DOM directly or via a floating button (`<eox-feedback-button></eox-feedback-button>`), which can be positioned in any corner of the viewport.
9
+ *
10
+ * @element eox-feedback
11
+ *
7
12
  * @attr {string} endpoint - The endpoint to send the feedback to as POST message.
8
13
  * @attr {string|null} [unstyled=undefined] - If provided, the element will not be styled with EOX styles.
9
14
  *
@@ -24,12 +29,34 @@ export class EOxFeedback extends HTMLElement {
24
29
 
25
30
  this.screenShotFile = null;
26
31
 
32
+ this.endpoint = null;
33
+
34
+ this._schema = null;
35
+
36
+ this._submitted = false;
37
+ }
38
+
39
+ get schema() {
40
+ return this._schema;
41
+ }
42
+
43
+ set schema(newSchema) {
44
+ this._schema = newSchema;
45
+ this.render();
46
+ }
47
+
48
+ /**
49
+ * @returns {import("@eox/jsonform").EOxJSONForm}
50
+ */
51
+ get jsonForm() {
52
+ return this.shadowRoot.querySelector("eox-jsonform");
53
+ }
54
+
55
+ connectedCallback() {
27
56
  this.endpoint =
28
57
  this.getAttribute("endpoint") ||
29
58
  document.querySelector("eox-feedback-button")?.getAttribute("endpoint");
30
- }
31
59
 
32
- connectedCallback() {
33
60
  this.render();
34
61
  this.shadowRoot
35
62
  .querySelector("input[type=checkbox]")
@@ -40,9 +67,17 @@ export class EOxFeedback extends HTMLElement {
40
67
  this.shadowRoot
41
68
  .querySelector("button#cancel")
42
69
  .addEventListener("click", () => this.onCancel());
43
- this.shadowRoot
44
- .querySelector("textarea")
45
- .addEventListener("input", (e) => this.onTextInput(e));
70
+
71
+ const jsonForm = this.shadowRoot.querySelector("eox-jsonform");
72
+ if (jsonForm) {
73
+ jsonForm.addEventListener("change", () => this.onJsonFormChange());
74
+ }
75
+
76
+ const textarea = this.shadowRoot.querySelector("textarea#message");
77
+ if (textarea) {
78
+ textarea.addEventListener("input", () => this.onTextareaInput());
79
+ }
80
+
46
81
  document.addEventListener("keyup", (e) => this.onKeyboardInput(e));
47
82
  }
48
83
 
@@ -56,9 +91,17 @@ export class EOxFeedback extends HTMLElement {
56
91
  this.shadowRoot
57
92
  .querySelector("button#cancel")
58
93
  .removeEventListener("click", () => this.onCancel());
59
- this.shadowRoot
60
- .querySelector("textarea")
61
- .removeEventListener("input", (e) => this.onTextInput(e));
94
+
95
+ const jsonForm = this.shadowRoot.querySelector("eox-jsonform");
96
+ if (jsonForm) {
97
+ jsonForm.removeEventListener("change", () => this.onJsonFormChange());
98
+ }
99
+
100
+ const textarea = this.shadowRoot.querySelector("textarea#message");
101
+ if (textarea) {
102
+ textarea.removeEventListener("input", () => this.onTextareaInput());
103
+ }
104
+
62
105
  document.removeEventListener("keyup", (e) => this.onKeyboardInput(e));
63
106
  }
64
107
 
@@ -67,22 +110,38 @@ export class EOxFeedback extends HTMLElement {
67
110
  this.onCancel();
68
111
  }
69
112
  if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
70
- if (this.shadowRoot.querySelector("textarea").value.length > 0) {
113
+ const submitButton = this.shadowRoot.querySelector("button#submit");
114
+ if (!submitButton.classList.contains("disabled")) {
71
115
  this.onSubmit();
72
116
  }
73
117
  }
74
118
  }
75
119
 
120
+ onTextareaInput() {
121
+ const submitButton = this.shadowRoot.querySelector("button#submit");
122
+ const textarea = this.shadowRoot.querySelector("textarea#message");
123
+ if (/** @type {HTMLTextAreaElement} */ (textarea).value.length >= 10) {
124
+ submitButton.classList.remove("disabled");
125
+ } else {
126
+ submitButton.classList.add("disabled");
127
+ }
128
+ }
129
+
76
130
  onOverlayDraw(e) {
77
131
  this.areaSelection = e.detail;
78
132
  }
79
133
 
80
- onTextInput(e) {
134
+ onJsonFormChange() {
135
+ /** @type {import("@eox/jsonform").EOxJSONForm} */
136
+ const jsonForm = this.shadowRoot.querySelector("eox-jsonform");
81
137
  const submitButton = this.shadowRoot.querySelector("button#submit");
82
- if (e.target.value.length > 0) {
83
- submitButton.classList.remove("disabled");
84
- } else {
85
- submitButton.classList.add("disabled");
138
+ if (jsonForm.editor) {
139
+ const errors = jsonForm.editor.validate();
140
+ if (errors.length === 0) {
141
+ submitButton.classList.remove("disabled");
142
+ } else {
143
+ submitButton.classList.add("disabled");
144
+ }
86
145
  }
87
146
  }
88
147
 
@@ -105,7 +164,6 @@ export class EOxFeedback extends HTMLElement {
105
164
  return;
106
165
  }
107
166
 
108
- const inputField = this.shadowRoot.querySelector("textarea");
109
167
  const submitButton = this.shadowRoot.querySelector("button#submit");
110
168
  submitButton.classList.add("disabled");
111
169
 
@@ -117,7 +175,16 @@ export class EOxFeedback extends HTMLElement {
117
175
  if (!(checkbox instanceof HTMLInputElement)) return;
118
176
  checkbox.checked = false;
119
177
  this.includeScreenshot = false;
120
- if (inputField.value.length > 0) {
178
+
179
+ const jsonForm = this.shadowRoot.querySelector("eox-jsonform");
180
+ const textarea = this.shadowRoot.querySelector("textarea#message");
181
+
182
+ if (jsonForm) {
183
+ submitButton.classList.remove("disabled");
184
+ } else if (
185
+ textarea &&
186
+ /** @type {HTMLTextAreaElement} */ (textarea).value.length >= 10
187
+ ) {
121
188
  submitButton.classList.remove("disabled");
122
189
  }
123
190
  });
@@ -158,10 +225,39 @@ export class EOxFeedback extends HTMLElement {
158
225
  requestBody.append("file", this.screenShotFile);
159
226
  }
160
227
 
161
- requestBody.append(
162
- "message",
163
- this.shadowRoot.querySelector("textarea").value,
164
- );
228
+ /** @type {import("@eox/jsonform").EOxJSONForm} */
229
+ const jsonForm = this.shadowRoot.querySelector("eox-jsonform");
230
+ const textarea = this.shadowRoot.querySelector("textarea#message");
231
+
232
+ if (jsonForm) {
233
+ this._submitted = true;
234
+ if (jsonForm.editor) {
235
+ jsonForm.editor.options.show_errors = "always";
236
+
237
+ // Remove the style that hides errors
238
+ if (jsonForm.shadowRoot) {
239
+ const style = jsonForm.shadowRoot.querySelector("#hide-errors");
240
+ if (style) {
241
+ style.remove();
242
+ }
243
+ }
244
+
245
+ const errors = jsonForm.editor.validate();
246
+ if (errors.length > 0) {
247
+ jsonForm.editor.showValidationErrors(errors);
248
+ return;
249
+ }
250
+ }
251
+ const value = jsonForm.value;
252
+ Object.keys(value).forEach((key) => {
253
+ requestBody.append(key, value[key]);
254
+ });
255
+ } else if (textarea) {
256
+ requestBody.append(
257
+ "message",
258
+ /** @type {HTMLTextAreaElement} */ (textarea).value,
259
+ );
260
+ }
165
261
 
166
262
  requestBody.append("userAgent", window.navigator.userAgent);
167
263
 
@@ -210,6 +306,33 @@ export class EOxFeedback extends HTMLElement {
210
306
  * @type {import("./feedback-button").EOxFeedbackButton}
211
307
  */
212
308
  const feedbackButton = document.querySelector("eox-feedback-button");
309
+
310
+ const hasSchema = !!this.schema;
311
+ const hasJsonForm = !!customElements.get("eox-jsonform");
312
+
313
+ let formContent = "";
314
+
315
+ if (hasSchema) {
316
+ if (hasJsonForm) {
317
+ formContent = `<eox-jsonform></eox-jsonform>`;
318
+ } else {
319
+ console.error(
320
+ "eox-feedback: Schema provided but eox-jsonform not registered. Please import @eox/jsonform.",
321
+ );
322
+ formContent = `<p style="color: red; padding: 1rem;">Error: Schema provided but eox-jsonform not available.</p>`;
323
+ }
324
+ } else {
325
+ formContent = `
326
+ <div class="field textarea border">
327
+ <textarea id="message" placeholder="${
328
+ !this.endpoint
329
+ ? "Missing endpoint attribute!"
330
+ : "Type your feedback here! Also include some contact info if you'd like us to reach out to you."
331
+ }"></textarea>
332
+ </div>
333
+ `;
334
+ }
335
+
213
336
  this.shadowRoot.innerHTML = `
214
337
  <style>
215
338
  ${style}
@@ -263,19 +386,25 @@ export class EOxFeedback extends HTMLElement {
263
386
  </div>
264
387
  </nav>
265
388
  <div id="screenshot" class="middle-align center-align"></div>
266
- <div class="field textarea border">
267
- <textarea placeholder="${!this.endpoint ? "Missing endpoint attribute!" : "Type your feedback here! Also include some contact info if you'd like us to reach out to you."}"></textarea>
268
- </div>
389
+ ${formContent}
269
390
  <nav>
270
391
  <progress class="circle small hidden"></progress>
271
392
  <div class="max"></div>
272
393
  <button id="cancel" class="border">Cancel</button>
273
- <button id="submit" class="disabled">Submit</button>
394
+ <button id="submit" class="${
395
+ hasSchema && hasJsonForm ? "" : "disabled"
396
+ }">Submit</button>
274
397
  </nav>
275
398
  </div>
276
399
  </div>
277
400
  </article>
278
401
  `;
402
+
403
+ if (hasSchema && hasJsonForm) {
404
+ /** @type {import("@eox/jsonform").EOxJSONForm} */
405
+ const jsonForm = this.shadowRoot.querySelector("eox-jsonform");
406
+ jsonForm.schema = this.schema;
407
+ }
279
408
  }
280
409
  }
281
410
 
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Controller component for drawing features
3
+ *
4
+ * @element eox-drawtools-controller
5
+ */
6
+ export class EOxDrawToolsController extends LitElement {
7
+ static properties: {
8
+ multipleFeatures: {
9
+ attribute: boolean;
10
+ type: BooleanConstructor;
11
+ };
12
+ drawnFeatures: {
13
+ attribute: boolean;
14
+ state: boolean;
15
+ type: ArrayConstructor;
16
+ };
17
+ currentlyDrawing: {
18
+ attribute: boolean;
19
+ state: boolean;
20
+ type: BooleanConstructor;
21
+ };
22
+ drawFunc: {
23
+ attribute: boolean;
24
+ type: ObjectConstructor;
25
+ };
26
+ select: {
27
+ type: BooleanConstructor;
28
+ };
29
+ importFeatures: {
30
+ attribute: string;
31
+ type: BooleanConstructor;
32
+ };
33
+ showEditor: {
34
+ attribute: string;
35
+ type: BooleanConstructor;
36
+ };
37
+ geoJSON: {
38
+ attribute: string;
39
+ type: StringConstructor;
40
+ };
41
+ type: {
42
+ attribute: string;
43
+ type: StringConstructor;
44
+ };
45
+ unstyled: {
46
+ type: BooleanConstructor;
47
+ };
48
+ };
49
+ /**
50
+ * Allow adding more than one feature at a time
51
+ */
52
+ multipleFeatures: boolean;
53
+ /**
54
+ * The array of drawn native OpenLayers features. Normally includes only one feature,
55
+ * until multiple feature drawing is enabled.
56
+ *
57
+ * @type Array<import("ol").Feature>
58
+ */
59
+ drawnFeatures: Array<import("ol").Feature>;
60
+ /**
61
+ * Allow import features using drag-drop and upload button
62
+ * @type Boolean
63
+ */
64
+ importFeatures: boolean;
65
+ /**
66
+ * Show geo-json editor for draw tool
67
+ * @type Boolean
68
+ */
69
+ showEditor: boolean;
70
+ /**
71
+ * Whether the user is currently in the process of drawing or not
72
+ */
73
+ currentlyDrawing: boolean;
74
+ /**
75
+ * List of draw function object like start, discard etc.
76
+ */
77
+ drawFunc: any;
78
+ /**
79
+ * Parsed and Stringify Geo JSON
80
+ * @type String
81
+ */
82
+ geoJSON: string;
83
+ /**
84
+ * Type of the drawn feature
85
+ * @type {"Polygon" | "Point" | "LineString" | "Circle" | "Box"}
86
+ */
87
+ type: "Polygon" | "Point" | "LineString" | "Circle" | "Box";
88
+ /**
89
+ * Render the element without additional styles
90
+ */
91
+ unstyled: boolean;
92
+ /**
93
+ *
94
+ */
95
+ select: boolean;
96
+ /**
97
+ * Updates button states based on conditions
98
+ */
99
+ updateButtonStates(): void;
100
+ /**
101
+ * Overrides createRenderRoot to handle shadow DOM
102
+ */
103
+ createRenderRoot(): this;
104
+ render(): import("lit-html").TemplateResult<1>;
105
+ #private;
106
+ }
107
+ import { LitElement } from "lit";
108
+ //# sourceMappingURL=controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../../../drawtools/src/components/controller.js"],"names":[],"mappings":"AAKA;;;;GAIG;AACH;IAEE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAWE;IAeA;;OAEG;IACH,0BAA6B;IAE7B;;;;;OAKG;IACH,eAFS,KAAK,CAAC,OAAO,IAAI,EAAE,OAAO,CAAC,CAEb;IAEvB;;;OAGG;IACH,wBAA2B;IAE3B;;;OAGG;IACH,oBAAuB;IAEvB;;OAEG;IACH,0BAA6B;IAE7B;;OAEG;IACH,cAAoB;IAEpB;;;OAGG;IACH,gBAAiB;IAEjB;;;OAGG;IACH,MAFU,SAAS,GAAG,OAAO,GAAG,YAAY,GAAG,QAAQ,GAAG,KAAK,CAE1C;IAErB;;OAEG;IACH,kBAAqB;IAErB;;OAEG;IACH,gBAAmB;IAGrB;;OAEG;IACH,2BAKC;IAED;;OAEG;IACH,yBAEC;IAED,+CA0NC;;CACF;2BA5UyC,KAAK"}
@@ -0,0 +1,144 @@
1
+ /**
2
+ * Display list of features
3
+ *
4
+ * @element eox-drawtools-list
5
+ */
6
+ export class EOxDrawToolsList extends LitElement {
7
+ static properties: {
8
+ eoxDrawTools: {
9
+ attribute: boolean;
10
+ state: boolean;
11
+ };
12
+ eoxMap: {
13
+ attribute: boolean;
14
+ state: boolean;
15
+ };
16
+ olMap: {
17
+ attribute: boolean;
18
+ state: boolean;
19
+ };
20
+ draw: {
21
+ attribute: boolean;
22
+ state: boolean;
23
+ };
24
+ drawLayer: {
25
+ attribute: boolean;
26
+ state: boolean;
27
+ };
28
+ drawnFeatures: {
29
+ attribute: boolean;
30
+ state: boolean;
31
+ type: ArrayConstructor;
32
+ };
33
+ featureName: {
34
+ attribute: boolean;
35
+ state: boolean;
36
+ type: StringConstructor;
37
+ };
38
+ featureNameKey: {
39
+ attribute: boolean;
40
+ state: boolean;
41
+ type: StringConstructor;
42
+ };
43
+ modify: {
44
+ attribute: boolean;
45
+ state: boolean;
46
+ };
47
+ unstyled: {
48
+ type: BooleanConstructor;
49
+ };
50
+ };
51
+ /**
52
+ * @type {import("@eox/map").EOxMap["selectInteractions"][string]}
53
+ */
54
+ hoverInteraction: import("@eox/map").EOxMap["selectInteractions"][string];
55
+ /**
56
+ * @type {import("@eox/map").EOxMap["selectInteractions"][string]}
57
+ */
58
+ clickInteraction: import("@eox/map").EOxMap["selectInteractions"][string];
59
+ /**
60
+ * @type string | number
61
+ */
62
+ hoverId: string | number;
63
+ /**
64
+ * @type string | number
65
+ */
66
+ clickId: string | number;
67
+ /**
68
+ * @type import("../main").EOxDrawTools;
69
+ */
70
+ eoxDrawTools: import("../main").EOxDrawTools;
71
+ /**
72
+ * @type import("@eox/map").EOxMap
73
+ */
74
+ eoxMap: import("@eox/map").EOxMap;
75
+ /**
76
+ * @type import("ol").Map
77
+ */
78
+ olMap: import("ol").Map;
79
+ /**
80
+ * The current native OpenLayers `draw` interaction
81
+ * @type import("ol/interaction").Draw
82
+ */
83
+ draw: import("ol/interaction").Draw;
84
+ /**
85
+ * The current native OpenLayers draw `layer`
86
+ * @type import("ol/layer").Vector<import("ol/source").Vector>
87
+ */
88
+ drawLayer: import("ol/layer").Vector<import("ol/source").Vector>;
89
+ /**
90
+ * The array of drawn native OpenLayers features. Normally includes only one feature,
91
+ * until multiple feature drawing is enabled.
92
+ *
93
+ * @type Array<import("ol").Feature>
94
+ */
95
+ drawnFeatures: Array<import("ol").Feature>;
96
+ /**
97
+ * Default display name for features
98
+ */
99
+ featureName: string;
100
+ /**
101
+ * The key of the property to display in the feature list.
102
+ */
103
+ featureNameKey: any;
104
+ /**
105
+ * The current native OpenLayers `modify` interaction
106
+ * @type import("ol/interaction").Modify
107
+ */
108
+ modify: import("ol/interaction").Modify;
109
+ /**
110
+ * Render the element without additional styles
111
+ */
112
+ unstyled: boolean;
113
+ /**
114
+ * Handles the deletion of an individual feature.
115
+ *
116
+ * @param {Event & { target: HTMLButtonElement }} evt - Event object containing button target.
117
+ */
118
+ _handleDelete(evt: Event & {
119
+ target: HTMLButtonElement;
120
+ }): void;
121
+ /**
122
+ * Handles the selection and deselection of a feature from the list.
123
+ *
124
+ * @param {import("ol").Feature} feature - The selected feature.
125
+ */
126
+ _handleFeatureSelectAndDeselect(feature: import("ol").Feature): void;
127
+ /**
128
+ *
129
+ * @param {number | string | undefined} featureId - The ID of the feature to hover.
130
+ * @param {Boolean} mouseOut - Flag indicating mouse out event.
131
+ */
132
+ _handleHoverFeature(featureId: number | string | undefined, mouseOut?: boolean): void;
133
+ /**
134
+ * Initiates initial settings and event triggers upon the component's first update.
135
+ */
136
+ firstUpdated(): void;
137
+ /**
138
+ * Overrides createRenderRoot to handle shadow DOM.
139
+ */
140
+ createRenderRoot(): this;
141
+ render(): import("lit-html").TemplateResult<1>;
142
+ }
143
+ import { LitElement } from "lit";
144
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../../drawtools/src/components/list.js"],"names":[],"mappings":"AASA;;;;GAIG;AACH;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAWE;IAEF;;OAEG;IACH,kBAFU,OAAO,UAAU,EAAE,MAAM,CAAC,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAEhD;IAEjB;;OAEG;IACH,kBAFU,OAAO,UAAU,EAAE,MAAM,CAAC,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAEhD;IAEjB;;OAEG;IACH,SAFS,MAAM,GAAG,MAAM,CAEhB;IAER;;OAEG;IACH,SAFS,MAAM,GAAG,MAAM,CAEhB;IAKN;;OAEG;IACH,cAFS,OAAO,SAAS,EAAE,YAAY,CAEf;IAExB;;OAEG;IACH,QAFS,OAAO,UAAU,EAAE,MAAM,CAEhB;IAElB;;OAEG;IACH,OAFS,OAAO,IAAI,EAAE,GAAG,CAER;IAEjB;;;OAGG;IAEH,MAHS,OAAO,gBAAgB,EAAE,IAAI,CAGtB;IAEhB;;;OAGG;IAEH,WAHS,OAAO,UAAU,EAAE,MAAM,CAAC,OAAO,WAAW,EAAE,MAAM,CAAC,CAGzC;IAErB;;;;;OAKG;IACH,eAFS,KAAK,CAAC,OAAO,IAAI,EAAE,OAAO,CAAC,CAEb;IAEvB;;OAEG;IACH,oBAA4B;IAE5B;;OAEG;IACH,oBAA0B;IAE1B;;;OAGG;IAEH,QAHS,OAAO,gBAAgB,EAAE,MAAM,CAGtB;IAElB;;OAEG;IACH,kBAAqB;IAGvB;;;;OAIG;IACH,mBAFW,KAAK,GAAG;QAAE,MAAM,EAAE,iBAAiB,CAAA;KAAE,QAK/C;IAED;;;;OAIG;IACH,yCAFW,OAAO,IAAI,EAAE,OAAO,QAI9B;IAED;;;;OAIG;IACH,+BAHW,MAAM,GAAG,MAAM,GAAG,SAAS,4BAKrC;IAED;;OAEG;IACH,qBAEC;IAED;;OAEG;IACH,yBAEC;IAED,+CAwEC;CACF;2BAlOyC,KAAK"}
@@ -0,0 +1,9 @@
1
+ export namespace FIT_OPTIONS {
2
+ let duration: number;
3
+ let padding: number[];
4
+ }
5
+ export namespace DUMMY_GEO_JSON {
6
+ let type: string;
7
+ let features: any[];
8
+ }
9
+ //# sourceMappingURL=draw.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"draw.d.ts","sourceRoot":"","sources":["../../../../../drawtools/src/enums/draw.js"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export { TEST_SELECTORS } from "./test";
2
+ export { STORIES_MAP_STYLE, STORIES_LAYERS_ARRAY, STORIES_VECTOR_LAYERS } from "./stories";
3
+ export { FIT_OPTIONS, DUMMY_GEO_JSON } from "./draw";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../drawtools/src/enums/index.js"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ export const STORIES_LAYERS_ARRAY: {
2
+ type: string;
3
+ source: {
4
+ type: string;
5
+ };
6
+ }[];
7
+ export const STORIES_VECTOR_LAYERS: {
8
+ type: string;
9
+ background: string;
10
+ properties: {
11
+ id: string;
12
+ };
13
+ source: {
14
+ type: string;
15
+ url: string;
16
+ format: string;
17
+ attributions: string;
18
+ };
19
+ style: {
20
+ "stroke-color": string;
21
+ "stroke-width": number;
22
+ "fill-color": string;
23
+ };
24
+ }[];
25
+ export const STORIES_MAP_STYLE: "width: 400px; height: 300px;";
26
+ //# sourceMappingURL=stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stories.d.ts","sourceRoot":"","sources":["../../../../../drawtools/src/enums/stories.js"],"names":[],"mappings":"AAAA;;;;;IAOE;AAEF;;;;;;;;;;;;;;;;;IAmBE;AAEF,gCAAiC,8BAA8B,CAAC"}
@@ -0,0 +1,11 @@
1
+ export namespace TEST_SELECTORS {
2
+ let drawTools: string;
3
+ let controller: string;
4
+ let drawBtn: string;
5
+ let editorBtn: string;
6
+ let copyBtn: string;
7
+ let discardBtn: string;
8
+ let list: string;
9
+ let deleteFeatureBtn: string;
10
+ }
11
+ //# sourceMappingURL=test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../../../drawtools/src/enums/test.js"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copy a given text string to the clipboard
3
+ *
4
+ * @param {string} text - The text to be copied to the clipboard.
5
+ */
6
+ export default function copyTextToClipboard(text: string): void;
7
+ //# sourceMappingURL=copy-text-to-clipboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy-text-to-clipboard.d.ts","sourceRoot":"","sources":["../../../../../drawtools/src/helpers/copy-text-to-clipboard.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kDAFW,MAAM,QAShB"}