@eox/drawtools 0.14.3 → 1.0.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 (32) hide show
  1. package/dist/eox-drawtools.js +3004 -2909
  2. package/dist/eox-drawtools.umd.cjs +190 -109
  3. package/dist/material-symbols-outlined.woff2 +0 -0
  4. package/dist/material-symbols-rounded.woff2 +0 -0
  5. package/dist/material-symbols-sharp.woff2 +0 -0
  6. package/dist/material-symbols-subset.woff2 +0 -0
  7. package/package.json +4 -3
  8. package/src/components/controller.js +124 -18
  9. package/src/components/list.js +40 -24
  10. package/src/main.js +14 -2
  11. package/src/methods/draw/init-layer.js +23 -8
  12. package/src/methods/draw/start-drawing.js +9 -0
  13. package/src/style.eox.js +11 -42
  14. package/types/drawtools/src/components/controller.d.ts +9 -0
  15. package/types/drawtools/src/components/controller.d.ts.map +1 -1
  16. package/types/drawtools/src/components/list.d.ts +9 -0
  17. package/types/drawtools/src/components/list.d.ts.map +1 -1
  18. package/types/drawtools/src/main.d.ts +8 -0
  19. package/types/drawtools/src/main.d.ts.map +1 -1
  20. package/types/drawtools/src/methods/draw/init-layer.d.ts.map +1 -1
  21. package/types/drawtools/src/methods/draw/start-drawing.d.ts.map +1 -1
  22. package/types/drawtools/src/style.eox.d.ts +1 -1
  23. package/types/drawtools/src/style.eox.d.ts.map +1 -1
  24. package/types/map/src/components/compare.d.ts.map +1 -1
  25. package/types/map/src/components/tooltip.d.ts.map +1 -1
  26. package/types/map/src/controls/geo-location.d.ts.map +1 -1
  27. package/types/map/src/helpers/generate.d.ts.map +1 -1
  28. package/types/map/src/helpers/select.d.ts +1 -1
  29. package/types/map/src/helpers/select.d.ts.map +1 -1
  30. package/types/map/src/main.d.ts +1 -1
  31. package/types/map/src/main.d.ts.map +1 -1
  32. package/types/map/src/methods/map/setters.d.ts.map +1 -1
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@eox/drawtools",
3
- "version": "0.14.3",
3
+ "version": "1.0.0",
4
4
  "type": "module",
5
5
  "devDependencies": {
6
- "@eox/map": "^1.19.3",
6
+ "@eox/map": "*",
7
7
  "vite": "^6.0.3"
8
8
  },
9
9
  "engines": {
@@ -34,7 +34,8 @@
34
34
  "watch": "vite build --watch"
35
35
  },
36
36
  "dependencies": {
37
- "@eox/elements-utils": "^0.1.5",
37
+ "@eox/elements-utils": "^1.0.0",
38
+ "@eox/ui": "^0.3.6",
38
39
  "lit": "^3.2.0",
39
40
  "ol": "^10.4.0"
40
41
  }
@@ -1,7 +1,5 @@
1
1
  import { LitElement, html, nothing } from "lit";
2
2
  import { updateButtonStatesMethod } from "../methods/controller";
3
- import buttonStyle from "@eox/elements-utils/styles/dist/button.style";
4
- import inputStyle from "@eox/elements-utils/styles/dist/input.style";
5
3
  import { copyTextToClipboard } from "../helpers/index.js";
6
4
  import { when } from "lit/directives/when.js";
7
5
 
@@ -21,6 +19,7 @@ export class EOxDrawToolsController extends LitElement {
21
19
  importFeatures: { attribute: "import-features", type: Boolean },
22
20
  showEditor: { attribute: "show-editor", type: Boolean },
23
21
  geoJSON: { attribute: "geo-json", type: String },
22
+ type: { attribute: "type", type: String },
24
23
  unstyled: { type: Boolean },
25
24
  };
26
25
 
@@ -78,6 +77,12 @@ export class EOxDrawToolsController extends LitElement {
78
77
  */
79
78
  this.geoJSON = "";
80
79
 
80
+ /**
81
+ * Type of the drawn feature
82
+ * @type {"Polygon" | "Point" | "LineString" | "Circle" | "Box"}
83
+ */
84
+ this.type = "Polygon";
85
+
81
86
  /**
82
87
  * Render the element without additional styles
83
88
  */
@@ -110,32 +115,121 @@ export class EOxDrawToolsController extends LitElement {
110
115
  this.updateButtonStates();
111
116
  const drawLabel = this.currentlyDrawing ? "drawing" : "draw";
112
117
 
118
+ const shapeIcons = {
119
+ Polygon: html`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
120
+ <title>shape-polygon-plus</title>
121
+ <path
122
+ d="M17,15.7V13H19V17L10,21L3,14L7,5H11V7H8.3L5.4,13.6L10.4,18.6L17,15.7M22,5V7H19V10H17V7H14V5H17V2H19V5H22Z"
123
+ />
124
+ </svg>`,
125
+ Point: html`
126
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
127
+ <title>vector-point-plus</title>
128
+ <path
129
+ d="M9 9V15H15V9H9M11 11H13V13H11V11M18 15V18H15V20H18V23H20V20H23V18H20V15H18Z"
130
+ />
131
+ </svg>
132
+ `,
133
+ Circle: html`
134
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
135
+ <title>shape-circle-plus</title>
136
+ <path
137
+ d="M11,19A6,6 0 0,0 17,13H19A8,8 0 0,1 11,21A8,8 0 0,1 3,13A8,8 0 0,1 11,5V7A6,6 0 0,0 5,13A6,6 0 0,0 11,19M19,5H22V7H19V10H17V7H14V5H17V2H19V5Z"
138
+ />
139
+ </svg>
140
+ `,
141
+ LineString: html`
142
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
143
+ <title>vector-polyline-plus</title>
144
+ <path
145
+ d="M2 3V9H4.95L6.95 15H6V21H12V16.41L17.41 11H22V5H16V9.57L10.59 15H9.06L7.06 9H8V3H2M4 5H6V7H4V5M18 7H20V9H18V7M18 15V18H15V20H18V23H20V20H23V18H20V15H18M8 17H10V19H8V17Z"
146
+ />
147
+ </svg>
148
+ `,
149
+ Box: html`
150
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
151
+ <title>shape-rectangle-plus</title>
152
+ <path
153
+ d="M19,6H22V8H19V11H17V8H14V6H17V3H19V6M17,17V14H19V19H3V6H11V8H5V17H17Z"
154
+ />
155
+ </svg>
156
+ `,
157
+ };
158
+ const pointerIcon = html`<svg
159
+ xmlns="http://www.w3.org/2000/svg"
160
+ viewBox="0 0 24 24"
161
+ >
162
+ <title>cursor-default-click</title>
163
+ <path
164
+ d="M10.76,8.69A0.76,0.76 0 0,0 10,9.45V20.9C10,21.32 10.34,21.66 10.76,21.66C10.95,21.66 11.11,21.6 11.24,21.5L13.15,19.95L14.81,23.57C14.94,23.84 15.21,24 15.5,24C15.61,24 15.72,24 15.83,23.92L18.59,22.64C18.97,22.46 19.15,22 18.95,21.63L17.28,18L19.69,17.55C19.85,17.5 20,17.43 20.12,17.29C20.39,16.97 20.35,16.5 20,16.21L11.26,8.86L11.25,8.87C11.12,8.76 10.95,8.69 10.76,8.69M15,10V8H20V10H15M13.83,4.76L16.66,1.93L18.07,3.34L15.24,6.17L13.83,4.76M10,0H12V5H10V0M3.93,14.66L6.76,11.83L8.17,13.24L5.34,16.07L3.93,14.66M3.93,3.34L5.34,1.93L8.17,4.76L6.76,6.17L3.93,3.34M7,10H2V8H7V10"
165
+ />
166
+ </svg>`;
167
+ const discardIcon = html`<svg
168
+ xmlns="http://www.w3.org/2000/svg"
169
+ viewBox="0 0 24 24"
170
+ >
171
+ <title>trash-can-outline</title>
172
+ <path
173
+ d="M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z"
174
+ />
175
+ </svg>`;
176
+ const importIcon = html`<svg
177
+ xmlns="http://www.w3.org/2000/svg"
178
+ viewBox="0 0 24 24"
179
+ >
180
+ <title>import</title>
181
+ <path
182
+ d="M14,12L10,8V11H2V13H10V16M20,18V6C20,4.89 19.1,4 18,4H6A2,2 0 0,0 4,6V9H6V6H18V18H6V15H4V18A2,2 0 0,0 6,20H18A2,2 0 0,0 20,18Z"
183
+ />
184
+ </svg>`;
185
+ const copyIcon = html`<svg
186
+ xmlns="http://www.w3.org/2000/svg"
187
+ viewBox="0 0 24 24"
188
+ >
189
+ <title>content-copy</title>
190
+ <path
191
+ d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"
192
+ />
193
+ </svg>`;
194
+
113
195
  return html`
114
- <style>
115
- ${!this.unstyled && buttonStyle}
116
- ${!this.unstyled && inputStyle}
117
- </style>
118
- <div class="wrap-btn">
196
+ <nav>
119
197
  <slot></slot>
120
- <div>
198
+ <div class="max">
121
199
  <!-- Draw Button -->
122
200
  <button
123
201
  data-cy="drawBtn"
124
- class="${this.select ? "pointer" : "polygon"} icon"
202
+ class="transparent square primary-text no-margin small"
203
+ title="${this.unstyled ? (this.select ? "Select" : "Draw") : ""}"
125
204
  ?disabled="${this.#drawDisabled || nothing}"
126
205
  @click="${() => this.drawFunc.start()}"
127
206
  >
128
- ${drawLabel}
207
+ ${this.unstyled
208
+ ? drawLabel
209
+ : html`
210
+ <i class="small"
211
+ >${this.select ? pointerIcon : shapeIcons[this.type]}</i
212
+ >
213
+ <div class="tooltip bottom">
214
+ ${this.select ? "Select" : "Draw"}
215
+ </div>
216
+ `}
129
217
  </button>
130
218
 
131
219
  <!-- Discard Button -->
132
220
  <button
133
221
  data-cy="discardBtn"
134
- class="discard icon"
222
+ class="transparent square error-text no-margin small"
223
+ title="${this.unstyled ? "Discard" : ""}"
135
224
  ?disabled="${this.#discardDisabled || nothing}"
136
225
  @click="${() => this.drawFunc.discard()}"
137
226
  >
138
- discard
227
+ ${this.unstyled
228
+ ? "discard"
229
+ : html`
230
+ <i class="small">${discardIcon}</i>
231
+ <div class="tooltip bottom">Discard</div>
232
+ `}
139
233
  </button>
140
234
  </div>
141
235
 
@@ -154,25 +248,32 @@ export class EOxDrawToolsController extends LitElement {
154
248
  <!-- Main Import Button -->
155
249
  <button
156
250
  data-cy="importBtn"
157
- class="import icon"
251
+ class="transparent circle primary-text no-margin small"
252
+ title="${this.unstyled ? "Import features" : ""}"
158
253
  @click=${() =>
159
254
  /**@type {HTMLElement}*/ (
160
255
  this.querySelector("#import-file")
161
256
  ).click()}
162
257
  >
163
- import
258
+ ${this.unstyled
259
+ ? "import"
260
+ : html`
261
+ <i class="small">${importIcon}</i>
262
+ <div class="tooltip left">Import features</div>
263
+ `}
164
264
  </button>
165
265
  `,
166
266
  )}
167
- </div>
267
+ </nav>
168
268
 
169
269
  <!-- Geo JSON Wrapper -->
170
270
  ${when(
171
271
  this.showEditor,
172
272
  () => html`
173
- <div class="json-wrapper">
273
+ <div class="field textarea border extra">
174
274
  <!-- Geo JSON Editor -->
175
275
  <textarea
276
+ style="font-family: monospace"
176
277
  @drop=${this.drawFunc.import}
177
278
  @input=${this.drawFunc.editor}
178
279
  .value=${this.geoJSON}
@@ -181,10 +282,15 @@ export class EOxDrawToolsController extends LitElement {
181
282
  <!-- Geo JSON Copy Button -->
182
283
  <button
183
284
  data-cy="copyBtn"
184
- class="icon-copy"
285
+ class="circle absolute bottom right medium-margin"
185
286
  @click=${() => copyTextToClipboard(this.geoJSON)}
186
287
  >
187
- ${this.unstyled ? "copy" : nothing}
288
+ ${this.unstyled
289
+ ? "copy"
290
+ : html`
291
+ <i class="tiny">${copyIcon}</i>
292
+ <div class="tooltip top">Copy</div>
293
+ `}
188
294
  </button>
189
295
  </div>
190
296
  `,
@@ -6,7 +6,6 @@ import {
6
6
  hoverFeatureMethod,
7
7
  selectAndDeselectFeatureMethod,
8
8
  } from "../methods/list";
9
- import listStyle from "@eox/elements-utils/styles/dist/list.style";
10
9
 
11
10
  /**
12
11
  * Display list of features
@@ -22,6 +21,7 @@ export class EOxDrawToolsList extends LitElement {
22
21
  drawLayer: { attribute: false, state: true },
23
22
  drawnFeatures: { attribute: false, state: true, type: Array },
24
23
  featureName: { attribute: false, state: true, type: String },
24
+ featureNameKey: { attribute: false, state: true, type: String },
25
25
  modify: { attribute: false, state: true },
26
26
  unstyled: { type: Boolean },
27
27
  };
@@ -91,6 +91,11 @@ export class EOxDrawToolsList extends LitElement {
91
91
  */
92
92
  this.featureName = "Feature";
93
93
 
94
+ /**
95
+ * The key of the property to display in the feature list.
96
+ */
97
+ this.featureNameKey = null;
98
+
94
99
  /**
95
100
  * The current native OpenLayers `modify` interaction
96
101
  * @type import("ol/interaction").Modify
@@ -151,11 +156,18 @@ export class EOxDrawToolsList extends LitElement {
151
156
  this.hoverId = this.hoverInteraction?.selectedFids[0];
152
157
  this.clickId = this.clickInteraction?.selectedFids[0];
153
158
 
159
+ const discardIcon = html`<svg
160
+ xmlns="http://www.w3.org/2000/svg"
161
+ viewBox="0 0 24 24"
162
+ >
163
+ <title>trash-can-outline</title>
164
+ <path
165
+ d="M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z"
166
+ />
167
+ </svg>`;
168
+
154
169
  return html`
155
- <style>
156
- ${!this.unstyled && listStyle}
157
- </style>
158
- <ul class="list-wrap">
170
+ <ul class="list no-space">
159
171
  ${this.drawnFeatures.map((feature, i) => {
160
172
  // Determine feature number and ID
161
173
  const featureNumber = i + 1;
@@ -166,34 +178,38 @@ export class EOxDrawToolsList extends LitElement {
166
178
  // Check if the feature is hovered or clicked
167
179
  const isFeatureHovered = this.hoverId === featureId;
168
180
  const isFeatureClicked = this.clickId === featureId;
169
- const isSelected = isFeatureHovered || isFeatureClicked;
170
- const selectionClass = isSelected ? "selected" : nothing;
181
+ const selectionClass = isFeatureHovered
182
+ ? "surface-container-low"
183
+ : isFeatureClicked
184
+ ? "fill"
185
+ : nothing;
186
+ const propertyName = feature.get(this.featureNameKey);
187
+ const title = propertyName
188
+ ? propertyName
189
+ : `${this.featureName} ${featureNumber}`;
171
190
 
172
191
  return keyed(
173
192
  featureNumber,
174
193
  html`
175
194
  <li
176
- class="${selectionClass}"
195
+ class="${selectionClass} no-round"
177
196
  @mouseover=${() => this._handleHoverFeature(featureId)}
178
197
  @mouseout=${() => this._handleHoverFeature(featureId, true)}
198
+ @click="${() => this._handleFeatureSelectAndDeselect(feature)}"
179
199
  >
180
- <div
181
- class="list"
182
- @click="${() =>
183
- this._handleFeatureSelectAndDeselect(feature)}"
184
- >
185
- <span class="title"
186
- >${this.featureName} ${featureNumber}</span
187
- >
188
- <button
189
- index=${i}
190
- data-cy="deleteFeatureBtn"
191
- class="icon smallest discard"
192
- @click="${this._handleDelete}"
193
- >
194
- x
195
- </button>
200
+ <div class="max">
201
+ <span class="title">${title}</span>
196
202
  </div>
203
+ <button
204
+ index=${i}
205
+ data-cy="deleteFeatureBtn"
206
+ class="transparent square small error-text front"
207
+ @click="${this._handleDelete}"
208
+ >
209
+ ${this.unstyled
210
+ ? "x"
211
+ : html`<i class="small">${discardIcon}</i>`}
212
+ </button>
197
213
  </li>
198
214
  `,
199
215
  );
package/src/main.js CHANGED
@@ -10,7 +10,6 @@ import {
10
10
  createSelectHandler,
11
11
  handleLayerId,
12
12
  } from "./methods/draw";
13
- import mainStyle from "@eox/elements-utils/styles/dist/main.style";
14
13
  import { DUMMY_GEO_JSON } from "./enums/index.js";
15
14
  import {
16
15
  initMapDragDropImport,
@@ -34,6 +33,7 @@ export class EOxDrawTools extends LitElement {
34
33
  drawLayer: { attribute: false, state: true },
35
34
  drawnFeatures: { attribute: false, state: true, type: Array },
36
35
  featureName: { attribute: "feature-name", type: String },
36
+ featureNameKey: { attribute: "feature-name-key", type: String },
37
37
  layerId: { attribute: "layer-id", type: String },
38
38
  featureStyles: { attribute: false },
39
39
  modify: { attribute: false, state: true },
@@ -123,6 +123,11 @@ export class EOxDrawTools extends LitElement {
123
123
  */
124
124
  this.featureName = "Feature";
125
125
 
126
+ /**
127
+ * The key of the property to display in the feature list.
128
+ */
129
+ this.featureNameKey = null;
130
+
126
131
  /**
127
132
  * Flat styles for the drawn/selected features
128
133
  * @type {{
@@ -350,10 +355,15 @@ export class EOxDrawTools extends LitElement {
350
355
  return html`
351
356
  <style>
352
357
  :host { display: block; }
353
- ${!this.unstyled && mainStyle}
354
358
  ${!this.unstyled && styleEOX}
355
359
  </style>
356
360
 
361
+ <div class="drawtitle">
362
+ <slot name="drawtitle"
363
+ ><p><strong>Draw</strong></p></slot
364
+ >
365
+ </div>
366
+
357
367
  <!-- Controller Component -->
358
368
  <eox-drawtools-controller
359
369
  .drawFunc=${{
@@ -371,6 +381,7 @@ export class EOxDrawTools extends LitElement {
371
381
  .importFeatures=${this.importFeatures}
372
382
  .showEditor=${this.showEditor}
373
383
  .geoJSON=${this.#geoJSON}
384
+ .type=${this.type}
374
385
  ></eox-drawtools-controller>
375
386
 
376
387
  <!-- List Component -->
@@ -383,6 +394,7 @@ export class EOxDrawTools extends LitElement {
383
394
  .drawLayer=${this.drawLayer}
384
395
  .drawnFeatures=${this.drawnFeatures}
385
396
  .featureName=${this.featureName}
397
+ .featureNameKey=${this.featureNameKey}
386
398
  .modify=${this.modify}
387
399
  .unstyled=${this.unstyled}
388
400
  @changed=${() => {
@@ -16,6 +16,8 @@ const initLayerMethod = (EoxDrawTool, multipleFeatures) => {
16
16
 
17
17
  const OlMap = EoxMap.map;
18
18
 
19
+ const primaryColor = "0, 65, 112";
20
+
19
21
  EoxDrawTool.drawLayer = EoxMap.addOrUpdateLayer({
20
22
  zIndex: 100,
21
23
  type: "Vector",
@@ -28,7 +30,13 @@ const initLayerMethod = (EoxDrawTool, multipleFeatures) => {
28
30
  source: {
29
31
  type: "Vector",
30
32
  },
31
- style: EoxDrawTool.featureStyles?.["layer"],
33
+ style: EoxDrawTool.featureStyles?.["layer"] || {
34
+ "fill-color": `rgba(${primaryColor}, 0.1)`,
35
+ "stroke-color": `rgba(${primaryColor}, 1)`,
36
+ "stroke-width": 2,
37
+ "circle-radius": 5,
38
+ "circle-fill-color": `rgba(${primaryColor}, 1)`,
39
+ },
32
40
  interactions: [
33
41
  {
34
42
  type: "draw",
@@ -38,7 +46,14 @@ const initLayerMethod = (EoxDrawTool, multipleFeatures) => {
38
46
  type: EoxDrawTool.type,
39
47
  modify: EoxDrawTool.allowModify,
40
48
  stopClick: true,
41
- style: EoxDrawTool.featureStyles?.["layer"],
49
+ style: EoxDrawTool.featureStyles?.["layer"] || {
50
+ "fill-color": `rgba(${primaryColor}, 0.1)`,
51
+ "stroke-color": `rgba(${primaryColor}, 1)`,
52
+ "stroke-width": 1,
53
+ "stroke-line-dash": [7, 3],
54
+ "circle-radius": 5,
55
+ "circle-fill-color": `rgba(${primaryColor}, 1)`,
56
+ },
42
57
  },
43
58
  },
44
59
  {
@@ -47,9 +62,9 @@ const initLayerMethod = (EoxDrawTool, multipleFeatures) => {
47
62
  id: "SelectLayerHoverInteraction",
48
63
  condition: "pointermove",
49
64
  style: EoxDrawTool.featureStyles?.["hover"] || {
50
- "fill-color": "rgba(51, 153, 204,0.5)",
51
- "stroke-color": "#3399CC",
52
- "stroke-width": 2.5,
65
+ "fill-color": `rgba(${primaryColor}, 0.2)`,
66
+ "stroke-color": `rgba(${primaryColor}, 1)`,
67
+ "stroke-width": 2,
53
68
  },
54
69
  tooltip: false,
55
70
  },
@@ -61,9 +76,9 @@ const initLayerMethod = (EoxDrawTool, multipleFeatures) => {
61
76
  condition: "click",
62
77
  panIn: true,
63
78
  style: EoxDrawTool.featureStyles?.["click"] || {
64
- "fill-color": "rgba(51, 153, 204,0.5)",
65
- "stroke-color": "#3399CC",
66
- "stroke-width": 2.5,
79
+ "fill-color": `rgba(${primaryColor}, 0.2)`,
80
+ "stroke-color": `rgba(${primaryColor}, 1)`,
81
+ "stroke-width": 2,
67
82
  },
68
83
  },
69
84
  },
@@ -23,6 +23,15 @@ const startDrawingMethod = (EoxDrawTool) => {
23
23
  initializeDrawing();
24
24
  // Update the drawing status
25
25
  updateDrawingStatus();
26
+
27
+ // Abort drawing on Esc key
28
+ document.addEventListener("keydown", ({ key }) => {
29
+ if (key === "Escape" && EoxDrawTool.currentlyDrawing) {
30
+ EoxDrawTool.draw.setActive(false);
31
+ EoxDrawTool.currentlyDrawing = false;
32
+ EoxDrawTool.requestUpdate();
33
+ }
34
+ });
26
35
  };
27
36
 
28
37
  export default startDrawingMethod;
package/src/style.eox.js CHANGED
@@ -1,46 +1,15 @@
1
+ import eoxStyle from "@eox/ui/style.css?inline";
2
+ import { addCommonStylesheet } from "@eox/elements-utils";
3
+
4
+ addCommonStylesheet();
5
+
1
6
  export const styleEOX = `
2
- button.discard:before {
3
- content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23FF5252' viewBox='0 0 24 24'%3E%3Ctitle%3Etrash-can-outline%3C/title%3E%3Cpath d='M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z' /%3E%3C/svg%3E")
7
+ ${eoxStyle}
8
+ :host {
9
+ --padding: 0.5rem;
4
10
  }
5
- button.pointer:before {
6
- content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23004170' viewBox='0 0 24 24'%3E%3Ctitle%3Ecursor-default-click%3C/title%3E%3Cpath d='M10.76,8.69A0.76,0.76 0 0,0 10,9.45V20.9C10,21.32 10.34,21.66 10.76,21.66C10.95,21.66 11.11,21.6 11.24,21.5L13.15,19.95L14.81,23.57C14.94,23.84 15.21,24 15.5,24C15.61,24 15.72,24 15.83,23.92L18.59,22.64C18.97,22.46 19.15,22 18.95,21.63L17.28,18L19.69,17.55C19.85,17.5 20,17.43 20.12,17.29C20.39,16.97 20.35,16.5 20,16.21L11.26,8.86L11.25,8.87C11.12,8.76 10.95,8.69 10.76,8.69M15,10V8H20V10H15M13.83,4.76L16.66,1.93L18.07,3.34L15.24,6.17L13.83,4.76M10,0H12V5H10V0M3.93,14.66L6.76,11.83L8.17,13.24L5.34,16.07L3.93,14.66M3.93,3.34L5.34,1.93L8.17,4.76L6.76,6.17L3.93,3.34M7,10H2V8H7V10' /%3E%3C/svg%3E");
11
+ .drawtitle {
12
+ padding-left: var(--padding);
13
+ padding-right: var(--padding);
7
14
  }
8
- button.polygon:before {
9
- content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23004170' viewBox='0 0 24 24'%3E%3Ctitle%3Eshape-polygon-plus%3C/title%3E%3Cpath d='M17,15.7V13H19V17L10,21L3,14L7,5H11V7H8.3L5.4,13.6L10.4,18.6L17,15.7M22,5V7H19V10H17V7H14V5H17V2H19V5H22Z' /%3E%3C/svg%3E");
10
- }
11
- button.import:before {
12
- content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ctitle%3Eupload%3C/title%3E%3Cpath fill='%23004170' d='M9,16V10H5L12,3L19,10H15V16H9M5,20V18H19V20H5Z' /%3E%3C/svg%3E");
13
- }
14
- .wrap-btn {
15
- display: flex;
16
- justify-content: space-between;
17
- }
18
- eox-drawtools-list {
19
- width: 100%;
20
- }
21
- .json-wrapper {
22
- margin: 0.4rem 0rem;
23
- padding: 0.75rem;
24
- background: var(--secondary-color-hover);
25
- position: relative;
26
- }
27
- .json-wrapper textarea {
28
- height: 200px;
29
- }
30
- .icon-copy {
31
- position: absolute;
32
- bottom: 26px;
33
- right: 26px;
34
- border-radius: 4px;
35
- height: 26px;
36
- padding: 4px 6px;
37
- }
38
- .icon-copy:before {
39
- width: 14px;
40
- min-width: 14px;
41
- height: 14px;
42
- display: flex margin-right: 6px;
43
- color: white;
44
- content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ctitle%3Econtent-copy%3C/title%3E%3Cpath d='M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z' fill='white' /%3E%3C/svg%3E")
45
- }
46
15
  `;
@@ -38,6 +38,10 @@ export class EOxDrawToolsController extends LitElement {
38
38
  attribute: string;
39
39
  type: StringConstructor;
40
40
  };
41
+ type: {
42
+ attribute: string;
43
+ type: StringConstructor;
44
+ };
41
45
  unstyled: {
42
46
  type: BooleanConstructor;
43
47
  };
@@ -76,6 +80,11 @@ export class EOxDrawToolsController extends LitElement {
76
80
  * @type String
77
81
  */
78
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";
79
88
  /**
80
89
  * Render the element without additional styles
81
90
  */
@@ -1 +1 @@
1
- {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../../src/components/controller.js"],"names":[],"mappings":"AAOA;;;;GAIG;AACH;IAEE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAUE;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;;OAEG;IACH,kBAAqB;IAErB;;OAEG;IACH,gBAAmB;IAGrB;;OAEG;IACH,2BAKC;IAED;;OAEG;IACH,yBAEC;IAED,+CAoFC;;CACF;2BAjMyC,KAAK"}
1
+ {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../../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,+CAyLC;;CACF;2BA3SyC,KAAK"}
@@ -35,6 +35,11 @@ export class EOxDrawToolsList extends LitElement {
35
35
  state: boolean;
36
36
  type: StringConstructor;
37
37
  };
38
+ featureNameKey: {
39
+ attribute: boolean;
40
+ state: boolean;
41
+ type: StringConstructor;
42
+ };
38
43
  modify: {
39
44
  attribute: boolean;
40
45
  state: boolean;
@@ -92,6 +97,10 @@ export class EOxDrawToolsList extends LitElement {
92
97
  * Default display name for features
93
98
  */
94
99
  featureName: string;
100
+ /**
101
+ * The key of the property to display in the feature list.
102
+ */
103
+ featureNameKey: any;
95
104
  /**
96
105
  * The current native OpenLayers `modify` interaction
97
106
  * @type import("ol/interaction").Modify
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/components/list.js"],"names":[],"mappings":"AAUA;;;;GAIG;AACH;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAUE;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;IAE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,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,+CAiEC;CACF;2BA3NyC,KAAK"}
@@ -37,6 +37,10 @@ export class EOxDrawTools extends LitElement {
37
37
  attribute: string;
38
38
  type: StringConstructor;
39
39
  };
40
+ featureNameKey: {
41
+ attribute: string;
42
+ type: StringConstructor;
43
+ };
40
44
  layerId: {
41
45
  attribute: string;
42
46
  type: StringConstructor;
@@ -120,6 +124,10 @@ export class EOxDrawTools extends LitElement {
120
124
  * The display name of drawn features, shown e.g. in the feature list.
121
125
  */
122
126
  featureName: string;
127
+ /**
128
+ * The key of the property to display in the feature list.
129
+ */
130
+ featureNameKey: any;
123
131
  /**
124
132
  * Flat styles for the drawn/selected features
125
133
  * @type {{
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/main.js"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH;IAEE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAuBC;IA6BC;;OAEG;IACH,qBAAwB;IAEx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B;;OAEG;IACH,oBAAuB;IAEvB;;OAEG;IACH,kBAAqB;IACrB;;OAEG;IACH,mBAA6B;IAE7B;;;OAGG;IACH,MAFU,SAAS,GAAG,OAAO,GAAG,YAAY,GAAG,QAAQ,GAAG,KAAK,CAE1C;IAErB;;OAEG;IACH,iBAFU,UAAU,CAAC,cAAc,sCAAsC,EAAE,OAAO,CAAC,CAExD;IAE3B;;;;;OAKG;IACH,QAFU,SAAS,GAAE,SAAS,GAAG,KAAK,CAEf;IAEvB;;OAEG;IACH,kBAAqB;IAErB;;;;OAIG;IACH,kBAAqB;IAGvB;;;;OAIG;IACH,+BAGC;IAED,0BAEC;IAeD;;OAEG;IACH,qBAEC;IAED;;;OAGG;IACH,uBAEC;IAED;;;;OAIG;IACH,0BAJW,MAAM,oBACN,OAAO,YACP,OAAO,QAcjB;IAED;;OAEG;IACH,uBAFW,SAAS,QAInB;IAED;;OAEG;IACH,oBAEC;IAED;;OAEG;IACH,sBAMC;IAED;;OAEG;IACH,0BAaC;IASD;;;;OAIG;IACH,qBAUC;IAcD,6CAIC;IARD,wCAEC;IAVD,sCAMC;IAiBD,+CAqDC;;CACF;2BAvZyC,KAAK"}
@@ -1 +1 @@
1
- {"version":3,"file":"init-layer.d.ts","sourceRoot":"","sources":["../../../../../src/methods/draw/init-layer.js"],"names":[],"mappings":";AAIA;;;;;;GAMG;AACH,8CAJW,OAAO,YAAY,EAAE,YAAY,8BAE/B;IAAC,MAAM,EAAE,OAAO,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,IAAI,EAAE,GAAG,CAAA;CAAC,CA+ExE"}
1
+ {"version":3,"file":"init-layer.d.ts","sourceRoot":"","sources":["../../../../../src/methods/draw/init-layer.js"],"names":[],"mappings":";AAIA;;;;;;GAMG;AACH,8CAJW,OAAO,YAAY,EAAE,YAAY,8BAE/B;IAAC,MAAM,EAAE,OAAO,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,IAAI,EAAE,GAAG,CAAA;CAAC,CA8FxE"}
@@ -1 +1 @@
1
- {"version":3,"file":"start-drawing.d.ts","sourceRoot":"","sources":["../../../../../src/methods/draw/start-drawing.js"],"names":[],"mappings":";AAAA;;;;;GAKG;AACH,iDAFW,OAAO,YAAY,EAAE,YAAY,QAqB3C"}
1
+ {"version":3,"file":"start-drawing.d.ts","sourceRoot":"","sources":["../../../../../src/methods/draw/start-drawing.js"],"names":[],"mappings":";AAAA;;;;;GAKG;AACH,iDAFW,OAAO,YAAY,EAAE,YAAY,QA8B3C"}