ol-wfst 4.0.6 → 4.1.1

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 (71) hide show
  1. package/CHANGELOG.md +123 -0
  2. package/README.md +27 -12
  3. package/dist/Geoserver.d.ts +24 -17
  4. package/dist/Geoserver.d.ts.map +1 -1
  5. package/dist/WfsLayer.d.ts +10 -10
  6. package/dist/WfsLayer.d.ts.map +1 -1
  7. package/dist/WmsLayer.d.ts +11 -11
  8. package/dist/WmsLayer.d.ts.map +1 -1
  9. package/dist/modules/EditControlChanges.d.ts +9 -9
  10. package/dist/modules/EditControlChanges.d.ts.map +1 -1
  11. package/dist/modules/EditFieldsModal.d.ts +3 -2
  12. package/dist/modules/EditFieldsModal.d.ts.map +1 -1
  13. package/dist/modules/EditOverlay.d.ts +4 -3
  14. package/dist/modules/EditOverlay.d.ts.map +1 -1
  15. package/dist/modules/LayersControl.d.ts +2 -3
  16. package/dist/modules/LayersControl.d.ts.map +1 -1
  17. package/dist/modules/Uploads.d.ts +6 -3
  18. package/dist/modules/Uploads.d.ts.map +1 -1
  19. package/dist/modules/base/BaseLayer.d.ts +4 -4
  20. package/dist/modules/base/BaseLayer.d.ts.map +1 -1
  21. package/dist/modules/base/WfsSource.d.ts +1 -1
  22. package/dist/modules/base/WfsSource.d.ts.map +1 -1
  23. package/dist/modules/base/WmsSource.d.ts +1 -1
  24. package/dist/modules/base/WmsSource.d.ts.map +1 -1
  25. package/dist/modules/editLayer.d.ts +2 -2
  26. package/dist/modules/editLayer.d.ts.map +1 -1
  27. package/dist/modules/state.d.ts +2 -2
  28. package/dist/modules/state.d.ts.map +1 -1
  29. package/dist/modules/styleFunction.d.ts +3 -3
  30. package/dist/modules/styleFunction.d.ts.map +1 -1
  31. package/dist/ol-wfst.d.ts +20 -20
  32. package/dist/ol-wfst.d.ts.map +1 -1
  33. package/dist/ol-wfst.js +1431 -2386
  34. package/dist/ol-wfst.js.map +1 -1
  35. package/dist/ol-wfst.min.js +6 -1
  36. package/dist/ol-wfst.min.js.map +1 -1
  37. package/dist/tsconfig.tsbuildinfo +1 -1
  38. package/lib/Geoserver.d.ts +24 -17
  39. package/lib/Geoserver.d.ts.map +1 -1
  40. package/lib/WfsLayer.d.ts +10 -10
  41. package/lib/WfsLayer.d.ts.map +1 -1
  42. package/lib/WmsLayer.d.ts +11 -11
  43. package/lib/WmsLayer.d.ts.map +1 -1
  44. package/lib/modules/EditControlChanges.d.ts +9 -9
  45. package/lib/modules/EditControlChanges.d.ts.map +1 -1
  46. package/lib/modules/EditFieldsModal.d.ts +3 -2
  47. package/lib/modules/EditFieldsModal.d.ts.map +1 -1
  48. package/lib/modules/EditOverlay.d.ts +4 -3
  49. package/lib/modules/EditOverlay.d.ts.map +1 -1
  50. package/lib/modules/LayersControl.d.ts +2 -3
  51. package/lib/modules/LayersControl.d.ts.map +1 -1
  52. package/lib/modules/Uploads.d.ts +6 -3
  53. package/lib/modules/Uploads.d.ts.map +1 -1
  54. package/lib/modules/base/BaseLayer.d.ts +4 -4
  55. package/lib/modules/base/BaseLayer.d.ts.map +1 -1
  56. package/lib/modules/base/WfsSource.d.ts +1 -1
  57. package/lib/modules/base/WfsSource.d.ts.map +1 -1
  58. package/lib/modules/base/WmsSource.d.ts +1 -1
  59. package/lib/modules/base/WmsSource.d.ts.map +1 -1
  60. package/lib/modules/editLayer.d.ts +2 -2
  61. package/lib/modules/editLayer.d.ts.map +1 -1
  62. package/lib/modules/state.d.ts +2 -2
  63. package/lib/modules/state.d.ts.map +1 -1
  64. package/lib/modules/styleFunction.d.ts +3 -3
  65. package/lib/modules/styleFunction.d.ts.map +1 -1
  66. package/lib/ol-wfst.d.ts +20 -20
  67. package/lib/ol-wfst.d.ts.map +1 -1
  68. package/lib/ol-wfst.js +133 -211
  69. package/lib/ol-wfst.js.map +1 -1
  70. package/lib/tsconfig.tsbuildinfo +1 -1
  71. package/package.json +8 -6
package/lib/ol-wfst.js CHANGED
@@ -1,40 +1,44 @@
1
- import CircleStyle from 'ol/style/Circle';
2
- import Fill$1 from 'ol/style/Fill';
3
- import Stroke$1 from 'ol/style/Stroke';
4
- import Style$1 from 'ol/style/Style';
5
- import Control$1 from 'ol/control/Control';
6
- import Draw from 'ol/interaction/Draw';
7
- import Modify from 'ol/interaction/Modify';
8
- import Select from 'ol/interaction/Select';
9
- import Snap from 'ol/interaction/Snap';
10
- import Collection from 'ol/Collection';
11
- import BaseEvent from 'ol/events/Event';
12
- import { primaryAction, never } from 'ol/events/condition';
13
- import { unByKey } from 'ol/Observable';
1
+ /*!
2
+ * ol-wfst - v4.1.1
3
+ * https://github.com/GastonZalba/ol-wfst#readme
4
+ * Built: Tue Aug 29 2023 11:10:12 GMT-0300 (hora estándar de Argentina)
5
+ */
6
+ import CircleStyle from 'ol/style/Circle.js';
7
+ import Fill$1 from 'ol/style/Fill.js';
8
+ import Stroke$1 from 'ol/style/Stroke.js';
9
+ import Style$1 from 'ol/style/Style.js';
10
+ import Control from 'ol/control/Control.js';
11
+ import Draw from 'ol/interaction/Draw.js';
12
+ import Modify from 'ol/interaction/Modify.js';
13
+ import Select from 'ol/interaction/Select.js';
14
+ import Snap from 'ol/interaction/Snap.js';
15
+ import Collection from 'ol/Collection.js';
16
+ import BaseEvent from 'ol/events/Event.js';
17
+ import { primaryAction, never } from 'ol/events/condition.js';
18
+ import Observable, { unByKey } from 'ol/Observable.js';
14
19
  import Modal from 'modal-vanilla';
15
- import VectorLayer from 'ol/layer/Vector';
20
+ import VectorLayer from 'ol/layer/Vector.js';
16
21
  import { Mixin } from 'ts-mixer';
17
- import Layer from 'ol/layer/Base';
18
- import GeoJSON from 'ol/format/GeoJSON';
19
- import VectorSource, { VectorSourceEvent } from 'ol/source/Vector';
20
- import { transformExtent } from 'ol/proj';
21
- import { bbox } from 'ol/loadingstrategy';
22
- import TileLayer from 'ol/layer/Tile';
23
- import TileWMS from 'ol/source/TileWMS';
24
- import TileState from 'ol/TileState';
25
- import { Observable, Overlay } from 'ol';
26
- import { MultiPolygon, MultiLineString, MultiPoint, GeometryCollection, Polygon } from 'ol/geom';
27
- import { WFS, GeoJSON as GeoJSON$1, KML } from 'ol/format';
28
- import { Control } from 'ol/control';
29
- import { Style, Stroke, Fill, Circle } from 'ol/style';
30
- import BaseObject from 'ol/Object';
31
- import Circle$1 from 'ol/geom/Circle';
32
- import GeometryCollection$1 from 'ol/geom/GeometryCollection';
33
- import Feature from 'ol/Feature';
34
- import KML$1 from 'ol/format/KML';
35
- import WFS$1 from 'ol/format/WFS';
36
- import { fromCircle } from 'ol/geom/Polygon';
37
- import { getCenter } from 'ol/extent';
22
+ import Layer from 'ol/layer/Base.js';
23
+ import GeoJSON from 'ol/format/GeoJSON.js';
24
+ import VectorSource, { VectorSourceEvent } from 'ol/source/Vector.js';
25
+ import { transformExtent } from 'ol/proj.js';
26
+ import { bbox } from 'ol/loadingstrategy.js';
27
+ import TileLayer from 'ol/layer/Tile.js';
28
+ import TileWMS from 'ol/source/TileWMS.js';
29
+ import TileState from 'ol/TileState.js';
30
+ import { MultiPolygon, MultiLineString, MultiPoint, GeometryCollection, Polygon } from 'ol/geom.js';
31
+ import KML from 'ol/format/KML.js';
32
+ import WFS from 'ol/format/WFS.js';
33
+ import { Style, Stroke, Fill, Circle } from 'ol/style.js';
34
+ import BaseObject from 'ol/Object.js';
35
+ import Circle$1 from 'ol/geom/Circle.js';
36
+ import GeometryCollection$1 from 'ol/geom/GeometryCollection.js';
37
+ import Feature from 'ol/Feature.js';
38
+ import { fromCircle } from 'ol/geom/Polygon.js';
39
+ import WFSCapabilities from 'ol-wfs-capabilities';
40
+ import { getCenter } from 'ol/extent.js';
41
+ import Overlay from 'ol/Overlay.js';
38
42
 
39
43
  // External
40
44
  let options = {};
@@ -210,7 +214,7 @@ const setLang = (lang = 'en', customI18n = null) => {
210
214
  }
211
215
  // Check if customs translations are provided
212
216
  if (customI18n) {
213
- I18N = { ...I18N, ...customI18n };
217
+ I18N = Object.assign(Object.assign({}, I18N), customI18n);
214
218
  }
215
219
  };
216
220
 
@@ -430,17 +434,8 @@ var BaseLayerProperty;
430
434
  * @param options
431
435
  */
432
436
  class WfsSource extends VectorSource {
433
- urlParams = new URLSearchParams({
434
- SERVICE: 'wfs',
435
- REQUEST: 'GetFeature',
436
- OUTPUTFORMAT: 'application/json',
437
- EXCEPTIONS: 'application/json'
438
- });
439
437
  constructor(options) {
440
- super({
441
- ...options,
442
- format: new GeoJSON(),
443
- loader: async (extent, resolution, projection, success, failure) => {
438
+ super(Object.assign(Object.assign({}, options), { format: new GeoJSON(), loader: async (extent, resolution, projection, success, failure) => {
444
439
  try {
445
440
  // If bbox, add extent to the request
446
441
  if (options.strategy == bbox) {
@@ -478,7 +473,12 @@ class WfsSource extends VectorSource {
478
473
  showError(I18N.errors.geoserver, err, options.name);
479
474
  failure();
480
475
  }
481
- }
476
+ } }));
477
+ this.urlParams = new URLSearchParams({
478
+ SERVICE: 'wfs',
479
+ REQUEST: 'GetFeature',
480
+ OUTPUTFORMAT: 'application/json',
481
+ EXCEPTIONS: 'application/json'
482
482
  });
483
483
  this.urlParams.set('version', options.geoServerAdvanced.getFeatureVersion);
484
484
  this.urlParams.set('typename', options.name);
@@ -495,27 +495,15 @@ class WfsSource extends VectorSource {
495
495
  * @param options
496
496
  */
497
497
  class WfsLayer extends Mixin(BaseLayer, (VectorLayer)) {
498
- _loadingCount = 0;
499
- _loadedCount = 0;
500
- beforeTransactFeature;
501
498
  constructor(options) {
502
- super({
503
- name: options.name,
504
- label: options.label || options.name,
505
- minZoom: options.minZoom,
506
- ...options
507
- });
499
+ super(Object.assign({ name: options.name, label: options.label || options.name, minZoom: options.minZoom }, options));
500
+ this._loadingCount = 0;
501
+ this._loadedCount = 0;
508
502
  if (options.beforeTransactFeature) {
509
503
  this.beforeTransactFeature = options.beforeTransactFeature;
510
504
  }
511
505
  const geoserver = options.geoserver;
512
- const source = new WfsSource({
513
- name: options.name,
514
- geoserverUrl: geoserver.getUrl(),
515
- geoServerAdvanced: geoserver.getAdvanced(),
516
- ...(options.strategy && { strategy: options.strategy }),
517
- geoserverVendor: options.geoserverVendor
518
- });
506
+ const source = new WfsSource(Object.assign(Object.assign({ name: options.name, geoserverUrl: geoserver.getUrl(), geoServerAdvanced: geoserver.getAdvanced() }, (options.strategy && { strategy: options.strategy })), { geoserverVendor: options.geoserverVendor }));
519
507
  this._loadingCount = 0;
520
508
  this._loadedCount = 0;
521
509
  source.on('featuresloadstart', () => {
@@ -584,17 +572,7 @@ class WfsLayer extends Mixin(BaseLayer, (VectorLayer)) {
584
572
  */
585
573
  class WmsSource extends TileWMS {
586
574
  constructor(options) {
587
- super({
588
- url: options.geoserverUrl,
589
- serverType: 'geoserver',
590
- params: {
591
- SERVICE: 'wms',
592
- TILED: true,
593
- LAYERS: options.name,
594
- EXCEPTIONS: 'application/json',
595
- ...(options.geoserverVendor && options.geoserverVendor)
596
- },
597
- tileLoadFunction: async (tile, src) => {
575
+ super(Object.assign({ url: options.geoserverUrl, serverType: 'geoserver', params: Object.assign({ SERVICE: 'wms', TILED: true, LAYERS: options.name, EXCEPTIONS: 'application/json' }, (options.geoserverVendor && options.geoserverVendor)), tileLoadFunction: async (tile, src) => {
598
576
  const blobToJson = (blob) => {
599
577
  return new Promise((resolve) => {
600
578
  const reader = new FileReader();
@@ -624,9 +602,7 @@ class WmsSource extends TileWMS {
624
602
  showError(I18N.errors.geoserver, err, options.name);
625
603
  tile.setState(TileState.ERROR);
626
604
  }
627
- },
628
- ...options
629
- });
605
+ } }, options));
630
606
  }
631
607
  }
632
608
 
@@ -639,18 +615,10 @@ class WmsSource extends TileWMS {
639
615
  * @param options
640
616
  */
641
617
  class WmsLayer extends Mixin(BaseLayer, (TileLayer)) {
642
- _loadingCount = 0;
643
- _loadedCount = 0;
644
- beforeTransactFeature;
645
- // Formats
646
- _formatGeoJSON;
647
618
  constructor(options) {
648
- super({
649
- name: options.name,
650
- label: options.label || options.name,
651
- minZoom: options.minZoom,
652
- ...options
653
- });
619
+ super(Object.assign({ name: options.name, label: options.label || options.name, minZoom: options.minZoom }, options));
620
+ this._loadingCount = 0;
621
+ this._loadedCount = 0;
654
622
  if (options.beforeTransactFeature) {
655
623
  this.beforeTransactFeature = options.beforeTransactFeature;
656
624
  }
@@ -760,6 +728,14 @@ class WmsLayer extends Mixin(BaseLayer, (TileLayer)) {
760
728
  }
761
729
  }
762
730
 
731
+ var img$5 = "data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='512' height='512' viewBox='0 0 512 512'%3e%3cpath d='M240 352h-240v128h480v-128h-240zM448 416h-64v-32h64v32zM112 160l128-128 128 128h-80v160h-96v-160z'%3e%3c/path%3e%3c/svg%3e";
732
+
733
+ var img$4 = "data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='768' height='768' viewBox='0 0 768 768'%3e %3cpath d='M663 225l-58.5 58.5-120-120 58.5-58.5q9-9 22.5-9t22.5 9l75 75q9 9 9 22.5t-9 22.5zM96 552l354-354 120 120-354 354h-120v-120z'%3e%3c/path%3e%3c/svg%3e";
734
+
735
+ var img$3 = "data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='768' height='768' viewBox='0 0 768 768'%3e%3cpath d='M384 288q39 0 67.5 28.5t28.5 67.5-28.5 67.5-67.5 28.5-67.5-28.5-28.5-67.5 28.5-67.5 67.5-28.5zM384 544.5q66 0 113.25-47.25t47.25-113.25-47.25-113.25-113.25-47.25-113.25 47.25-47.25 113.25 47.25 113.25 113.25 47.25zM384 144q118.5 0 214.5 66t138 174q-42 108-138 174t-214.5 66-214.5-66-138-174q42-108 138-174t214.5-66z'%3e%3c/path%3e%3c/svg%3e";
736
+
737
+ var img$2 = "data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='768' height='768' viewBox='0 0 768 768'%3e%3cpath d='M379.5 288h4.5q39 0 67.5 28.5t28.5 67.5v6zM241.5 313.5q-18 36-18 70.5 0 66 47.25 113.25t113.25 47.25q34.5 0 70.5-18l-49.5-49.5q-12 3-21 3-39 0-67.5-28.5t-28.5-67.5q0-9 3-21zM64.5 136.5l40.5-40.5 567 567-40.5 40.5q-7.5-7.5-47.25-46.5t-60.75-60q-64.5 27-139.5 27-118.5 0-214.5-66t-138-174q16.5-39 51.75-86.25t68.25-72.75q-18-18-50.25-51t-36.75-37.5zM384 223.5q-30 0-58.5 12l-69-69q58.5-22.5 127.5-22.5 118.5 0 213.75 66t137.25 174q-36 88.5-109.5 151.5l-93-93q12-28.5 12-58.5 0-66-47.25-113.25t-113.25-47.25z'%3e%3c/path%3e%3c/svg%3e";
738
+
763
739
  function createElement(tagName, attrs = {}, ...children) {
764
740
  if (typeof tagName === 'function')
765
741
  return tagName(attrs, children);
@@ -797,14 +773,6 @@ function createElement(tagName, attrs = {}, ...children) {
797
773
  return elem;
798
774
  }
799
775
 
800
- var img$5 = "data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='512' height='512' viewBox='0 0 512 512'%3e%3cpath d='M240 352h-240v128h480v-128h-240zM448 416h-64v-32h64v32zM112 160l128-128 128 128h-80v160h-96v-160z'%3e%3c/path%3e%3c/svg%3e";
801
-
802
- var img$4 = "data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='768' height='768' viewBox='0 0 768 768'%3e %3cpath d='M663 225l-58.5 58.5-120-120 58.5-58.5q9-9 22.5-9t22.5 9l75 75q9 9 9 22.5t-9 22.5zM96 552l354-354 120 120-354 354h-120v-120z'%3e%3c/path%3e%3c/svg%3e";
803
-
804
- var img$3 = "data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='768' height='768' viewBox='0 0 768 768'%3e%3cpath d='M384 288q39 0 67.5 28.5t28.5 67.5-28.5 67.5-67.5 28.5-67.5-28.5-28.5-67.5 28.5-67.5 67.5-28.5zM384 544.5q66 0 113.25-47.25t47.25-113.25-47.25-113.25-113.25-47.25-113.25 47.25-47.25 113.25 47.25 113.25 113.25 47.25zM384 144q118.5 0 214.5 66t138 174q-42 108-138 174t-214.5 66-214.5-66-138-174q42-108 138-174t214.5-66z'%3e%3c/path%3e%3c/svg%3e";
805
-
806
- var img$2 = "data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='768' height='768' viewBox='0 0 768 768'%3e%3cpath d='M379.5 288h4.5q39 0 67.5 28.5t28.5 67.5v6zM241.5 313.5q-18 36-18 70.5 0 66 47.25 113.25t113.25 47.25q34.5 0 70.5-18l-49.5-49.5q-12 3-21 3-39 0-67.5-28.5t-28.5-67.5q0-9 3-21zM64.5 136.5l40.5-40.5 567 567-40.5 40.5q-7.5-7.5-47.25-46.5t-60.75-60q-64.5 27-139.5 27-118.5 0-214.5-66t-138-174q16.5-39 51.75-86.25t68.25-72.75q-18-18-50.25-51t-36.75-37.5zM384 223.5q-30 0-58.5 12l-69-69q58.5-22.5 127.5-22.5 118.5 0 213.75 66t137.25 174q-36 88.5-109.5 151.5l-93-93q12-28.5 12-58.5 0-66-47.25-113.25t-113.25-47.25z'%3e%3c/path%3e%3c/svg%3e";
807
-
808
776
  /**
809
777
  * Removes in the DOM the class of the tools
810
778
  * @private
@@ -828,8 +796,6 @@ const activateDrawButton = () => {
828
796
  }
829
797
  };
830
798
  class LayersControl extends Observable {
831
- _uploads;
832
- _uploadFormats;
833
799
  constructor(uploads, uploadFormats) {
834
800
  super();
835
801
  this._uploads = uploads;
@@ -843,17 +809,17 @@ class LayersControl extends Observable {
843
809
  addLayerEl(layer) {
844
810
  const container = document.querySelector('.wfst--tools-control--select-layers');
845
811
  const layerName = layer.get(BaseLayerProperty.NAME);
846
- const checked = layer === getActiveLayerToInsertEls() ? { checked: 'checked' } : {};
847
- const input = (createElement("input", { value: layerName, id: `wfst--${layerName}`, type: "radio", className: "ol-wfst--tools-control-input", name: "wfst--select-layer", ...checked, onchange: (evt) => this._layerChangeHandler(evt, layer) }));
812
+ const checked = layer === getActiveLayerToInsertEls() ? { checked: true } : {};
813
+ const input = (createElement("input", Object.assign({ value: layerName, id: `wfst--${layerName}`, type: "radio", className: "ol-wfst--tools-control-input", name: "wfst--select-layer" }, checked, { onChange: (evt) => this._layerChangeHandler(evt, layer) })));
848
814
  const layerDom = (createElement("div", { className: `wfst--layer-control
849
815
  ${layer.getVisible() ? 'ol-wfst--visible-on' : ''}
850
816
  ${layer === getActiveLayerToInsertEls()
851
817
  ? 'ol-wfst--selected-on'
852
818
  : ''}`, "data-layer": layerName },
853
819
  createElement("div", { className: "ol-wfst--tools-control-visible" },
854
- createElement("span", { className: "ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-on", title: I18N.labels.toggleVisibility, onclick: (evt) => this._visibilityClickHandler(evt) },
820
+ createElement("span", { className: "ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-on", title: I18N.labels.toggleVisibility, onClick: (evt) => this._visibilityClickHandler(evt) },
855
821
  createElement("img", { src: img$3 })),
856
- createElement("span", { className: "ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-off", title: I18N.labels.toggleVisibility, onclick: (evt) => this._visibilityClickHandler(evt) },
822
+ createElement("span", { className: "ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-off", title: I18N.labels.toggleVisibility, onClick: (evt) => this._visibilityClickHandler(evt) },
857
823
  createElement("img", { src: img$2 }))),
858
824
  createElement("label", { htmlFor: `wfst--${layerName}` },
859
825
  input,
@@ -952,17 +918,16 @@ class LayersControl extends Observable {
952
918
  return (createElement(null, null,
953
919
  createElement("div", { className: "wfst--tools-control--head" },
954
920
  this._uploads && (createElement("div", null,
955
- createElement("input", { id: "ol-wfst--upload", type: "file", accept: this._uploadFormats, onchange: (evt) => this._uploads.process(evt) }),
921
+ createElement("input", { id: "ol-wfst--upload", type: "file", accept: this._uploadFormats, onChange: (evt) => this._uploads.process(evt) }),
956
922
  createElement("label", { className: "ol-wfst--tools-control-btn ol-wfst--tools-control-btn-upload", htmlFor: "ol-wfst--upload", title: I18N.labels.uploadToLayer },
957
923
  createElement("img", { src: img$5 })))),
958
924
  createElement("div", { className: "ol-wfst--tools-control-draw-cnt" },
959
- createElement("button", { className: "ol-wfst--tools-control-btn ol-wfst--tools-control-btn-draw", type: "button", title: I18N.labels.addElement, onclick: () => {
925
+ createElement("button", { className: "ol-wfst--tools-control-btn ol-wfst--tools-control-btn-draw", type: "button", title: I18N.labels.addElement, onClick: () => {
960
926
  this.dispatchEvent('drawMode');
961
927
  } },
962
928
  createElement("img", { src: img$4 })),
963
- createElement("select", { title: I18N.labels.selectDrawType, className: "wfst--tools-control--select-draw", onchange: (evt) => {
964
- const selectedValue = evt.target
965
- .value;
929
+ createElement("select", { title: I18N.labels.selectDrawType, className: "wfst--tools-control--select-draw", onChange: (evt) => {
930
+ const selectedValue = evt.target.value;
966
931
  this._changeStateSelect(getActiveLayerToInsertEls(), selectedValue);
967
932
  this.dispatchEvent('changeGeom');
968
933
  } }, [
@@ -991,20 +956,13 @@ const getEditLayer = () => {
991
956
 
992
957
  // Ol
993
958
  class Uploads extends Observable {
994
- _options;
995
- // Formats
996
- _formatWFS;
997
- _formatGeoJSON;
998
- _formatKml;
999
- _xs;
1000
- _processUpload;
1001
959
  constructor(options) {
1002
960
  super();
1003
961
  this._options = options;
1004
962
  this._processUpload = options.processUpload;
1005
963
  // Formats
1006
964
  this._formatWFS = new WFS();
1007
- this._formatGeoJSON = new GeoJSON$1();
965
+ this._formatGeoJSON = new GeoJSON();
1008
966
  this._formatKml = new KML({
1009
967
  extractStyles: false,
1010
968
  showPointNames: false
@@ -1177,17 +1135,9 @@ class Uploads extends Observable {
1177
1135
  ${I18N.labels.upload}
1178
1136
  </button>
1179
1137
  `;
1180
- const modal = new Modal({
1181
- ...this._options.modal,
1182
- header: true,
1183
- headerClose: false,
1184
- title: I18N.labels.uploadFeatures +
1138
+ const modal = new Modal(Object.assign(Object.assign({}, this._options.modal), { header: true, headerClose: false, title: I18N.labels.uploadFeatures +
1185
1139
  ' ' +
1186
- getActiveLayerToInsertEls().get(BaseLayerProperty.NAME),
1187
- content: content,
1188
- backdrop: 'static',
1189
- footer: footer
1190
- }).show();
1140
+ getActiveLayerToInsertEls().get(BaseLayerProperty.NAME), content: content, backdrop: 'static', footer: footer })).show();
1191
1141
  modal.on('dismiss', (modal, event) => {
1192
1142
  // On saving changes
1193
1143
  if (event.target.dataset.action === 'save') {
@@ -1257,13 +1207,13 @@ class EditControlChangesEl extends Control {
1257
1207
  " -",
1258
1208
  ' ',
1259
1209
  createElement("i", null, String(feature.getId()))),
1260
- createElement("button", { type: "button", className: "btn btn-sm btn-secondary", onclick: () => {
1210
+ createElement("button", { type: "button", className: "btn btn-sm btn-secondary", onClick: () => {
1261
1211
  this.dispatchEvent(new VectorSourceEvent('cancel', feature));
1262
1212
  } }, I18N.labels.cancel),
1263
- createElement("button", { type: "button", className: "btn btn-sm btn-primary", onclick: () => {
1213
+ createElement("button", { type: "button", className: "btn btn-sm btn-primary", onClick: () => {
1264
1214
  this.dispatchEvent(new VectorSourceEvent('apply', feature));
1265
1215
  } }, I18N.labels.apply),
1266
- createElement("button", { type: "button", className: "btn btn-sm btn-danger-outline", onclick: () => {
1216
+ createElement("button", { type: "button", className: "btn btn-sm btn-danger-outline", onClick: () => {
1267
1217
  this.dispatchEvent(new VectorSourceEvent('delete', feature));
1268
1218
  } }, I18N.labels.delete))))
1269
1219
  });
@@ -1418,9 +1368,6 @@ function styleFunction(feature) {
1418
1368
  * @private
1419
1369
  */
1420
1370
  class EditFieldsModal extends Observable {
1421
- _options;
1422
- _modal;
1423
- _feature;
1424
1371
  constructor(options) {
1425
1372
  super();
1426
1373
  this._options = options;
@@ -1435,14 +1382,7 @@ class EditFieldsModal extends Observable {
1435
1382
  ${I18N.labels.save}
1436
1383
  </button>
1437
1384
  `;
1438
- this._modal = new Modal({
1439
- ...this._options,
1440
- header: true,
1441
- headerClose: true,
1442
- title: '',
1443
- content: '<div></div>',
1444
- footer: footer
1445
- });
1385
+ this._modal = new Modal(Object.assign(Object.assign({}, this._options), { header: true, headerClose: true, title: '', content: '<div></div>', footer: footer }));
1446
1386
  this._modal.on('dismiss', (modal, event) => {
1447
1387
  // On saving changes
1448
1388
  if (event.target.dataset.action === 'save') {
@@ -1510,29 +1450,19 @@ class EditFieldsModal extends Observable {
1510
1450
  // https://docs.geoserver.org/latest/en/user/services/wfs/axis_order.html
1511
1451
  // Axis ordering: latitude/longitude
1512
1452
  const DEFAULT_GEOSERVER_SRS = 'EPSG:3857';
1453
+ const parser = new WFSCapabilities();
1513
1454
  /**
1514
1455
  * @fires change:capabilities
1515
1456
  * @extends {ol/Object~BaseObject}
1516
1457
  * @param options
1517
1458
  */
1518
1459
  class Geoserver extends BaseObject {
1519
- _options;
1520
- _countRequests;
1521
- _insertFeatures;
1522
- _updateFeatures;
1523
- _deleteFeatures;
1524
- // Formats
1525
- _formatWFS;
1526
- _formatGeoJSON;
1527
- _formatKml;
1528
- _xs;
1529
- state_;
1530
1460
  constructor(options) {
1531
1461
  super();
1532
1462
  const defaults = {
1533
1463
  url: null,
1534
1464
  advanced: {
1535
- getCapabilitiesVersion: '1.3.0',
1465
+ getCapabilitiesVersion: '2.0.0',
1536
1466
  getFeatureVersion: '1.0.0',
1537
1467
  describeFeatureTypeVersion: '1.1.0',
1538
1468
  lockFeatureVersion: '1.1.0',
@@ -1559,15 +1489,15 @@ class Geoserver extends BaseObject {
1559
1489
  this._updateFeatures = [];
1560
1490
  this._deleteFeatures = [];
1561
1491
  // Formats
1562
- this._formatWFS = new WFS$1();
1492
+ this._formatWFS = new WFS();
1563
1493
  this._formatGeoJSON = new GeoJSON();
1564
- this._formatKml = new KML$1({
1494
+ this._formatKml = new KML({
1565
1495
  extractStyles: false,
1566
1496
  showPointNames: false
1567
1497
  });
1568
1498
  this._xs = new XMLSerializer();
1569
1499
  this.getAndUpdateCapabilities();
1570
- this.on('change:capabilities', () => {
1500
+ this.on('change:parsedCapabilities', () => {
1571
1501
  this._checkGeoserverCapabilities();
1572
1502
  });
1573
1503
  }
@@ -1579,6 +1509,14 @@ class Geoserver extends BaseObject {
1579
1509
  getCapabilities() {
1580
1510
  return this.get(GeoserverProperty.CAPABILITIES);
1581
1511
  }
1512
+ /**
1513
+ * Only work for `2.0.0` getCapabilities version
1514
+ * @returns
1515
+ * @public
1516
+ */
1517
+ getParsedCapabilities() {
1518
+ return this.get(GeoserverProperty.PARSED_CAPABILITIES);
1519
+ }
1582
1520
  /**
1583
1521
  *
1584
1522
  * @param url
@@ -1719,6 +1657,8 @@ class Geoserver extends BaseObject {
1719
1657
  const data = await response.text();
1720
1658
  const capabilities = new window.DOMParser().parseFromString(data, 'text/xml');
1721
1659
  this.set(GeoserverProperty.CAPABILITIES, capabilities);
1660
+ const parsedCapabilities = parser.read(data);
1661
+ this.set(GeoserverProperty.PARSED_CAPABILITIES, parsedCapabilities);
1722
1662
  this.state_ = capabilities ? 'ready' : 'error';
1723
1663
  return capabilities;
1724
1664
  }
@@ -1733,19 +1673,38 @@ class Geoserver extends BaseObject {
1733
1673
  * @private
1734
1674
  */
1735
1675
  _checkGeoserverCapabilities() {
1736
- // Available operations in the geoserver
1737
- const operations = this.getCapabilities().getElementsByTagName('ows:Operation');
1738
- Array.from(operations).forEach((operation) => {
1739
- if (operation.getAttribute('name') === 'Transaction') {
1740
- this.set(GeoserverProperty.HASTRASNACTION, true);
1741
- }
1742
- else if (operation.getAttribute('name') === 'LockFeature') {
1743
- this.set(GeoserverProperty.HASLOCKFEATURE, true);
1744
- }
1745
- else if (operation.getAttribute('name') === 'DescribeFeatureType') {
1746
- this.set(GeoserverProperty.HASDESCRIBEFEATURETYPE, true);
1676
+ var _a, _b;
1677
+ if (this.getAdvanced().getCapabilitiesVersion === '2.0.0') {
1678
+ // Available operations in the geoserver
1679
+ const operations = (_b = (_a = this.getParsedCapabilities()) === null || _a === void 0 ? void 0 : _a.OperationsMetadata) === null || _b === void 0 ? void 0 : _b.Operation;
1680
+ if (operations) {
1681
+ operations.forEach((operation) => {
1682
+ if (operation.name === 'Transaction') {
1683
+ this.set(GeoserverProperty.HASTRASNACTION, true);
1684
+ }
1685
+ else if (operation.name === 'LockFeature') {
1686
+ this.set(GeoserverProperty.HASLOCKFEATURE, true);
1687
+ }
1688
+ else if (operation.name === 'DescribeFeatureType') {
1689
+ this.set(GeoserverProperty.HASDESCRIBEFEATURETYPE, true);
1690
+ }
1691
+ });
1747
1692
  }
1748
- });
1693
+ }
1694
+ else {
1695
+ const operations = this.getCapabilities().getElementsByTagName('ows:Operation');
1696
+ Array.from(operations).forEach((operation) => {
1697
+ if (operation.getAttribute('name') === 'Transaction') {
1698
+ this.set(GeoserverProperty.HASTRASNACTION, true);
1699
+ }
1700
+ else if (operation.getAttribute('name') === 'LockFeature') {
1701
+ this.set(GeoserverProperty.HASLOCKFEATURE, true);
1702
+ }
1703
+ else if (operation.getAttribute('name') === 'DescribeFeatureType') {
1704
+ this.set(GeoserverProperty.HASDESCRIBEFEATURETYPE, true);
1705
+ }
1706
+ });
1707
+ }
1749
1708
  if (!this.hasTransaction()) {
1750
1709
  throw I18N.errors.wfst;
1751
1710
  }
@@ -1866,10 +1825,7 @@ class Geoserver extends BaseObject {
1866
1825
  transactionType !== TransactionType.Insert) {
1867
1826
  payload = payload.replace(`</Transaction>`, `<LockId>${this._options.advanced.lockFeatureParams.lockId}</LockId></Transaction>`);
1868
1827
  }
1869
- const headers = {
1870
- 'Content-Type': 'text/xml',
1871
- ...this.getHeaders()
1872
- };
1828
+ const headers = Object.assign({ 'Content-Type': 'text/xml' }, this.getHeaders());
1873
1829
  const response = await fetch(this.getUrl(), {
1874
1830
  method: 'POST',
1875
1831
  body: payload,
@@ -2036,6 +1992,7 @@ class Geoserver extends BaseObject {
2036
1992
  var GeoserverProperty;
2037
1993
  (function (GeoserverProperty) {
2038
1994
  GeoserverProperty["CAPABILITIES"] = "capabilities";
1995
+ GeoserverProperty["PARSED_CAPABILITIES"] = "parsedCapabilities";
2039
1996
  GeoserverProperty["URL"] = "url";
2040
1997
  GeoserverProperty["HEADERS"] = "headers";
2041
1998
  GeoserverProperty["CREDENTIALS"] = "credentials";
@@ -2060,12 +2017,12 @@ class EditOverlay extends Overlay {
2060
2017
  offset: [0, -40],
2061
2018
  stopEvent: true,
2062
2019
  element: (createElement("div", null,
2063
- createElement("div", { className: "ol-wfst--edit-button-cnt", onclick: () => {
2020
+ createElement("div", { className: "ol-wfst--edit-button-cnt", onClick: () => {
2064
2021
  this.dispatchEvent('editFields');
2065
2022
  } },
2066
2023
  createElement("button", { className: "ol-wfst--edit-button", type: "button", title: I18N.labels.editFields },
2067
2024
  createElement("img", { src: img$1, alt: I18N.labels.editFields }))),
2068
- createElement("div", { className: "ol-wfst--edit-button-cnt", onclick: () => {
2025
+ createElement("div", { className: "ol-wfst--edit-button-cnt", onClick: () => {
2069
2026
  this.dispatchEvent('editGeom');
2070
2027
  } },
2071
2028
  createElement("button", { class: "ol-wfst--edit-button", type: "button", title: I18N.labels.editGeom },
@@ -2092,39 +2049,7 @@ const controlElement = document.createElement('div');
2092
2049
  * @extends {ol/control/Control~Control}
2093
2050
  * @param options Wfst options, see [Wfst Options](#options) for more details.
2094
2051
  */
2095
- class Wfst extends Control$1 {
2096
- _options;
2097
- _i18n;
2098
- // Ol
2099
- _map;
2100
- _view;
2101
- _viewport;
2102
- _initialized = false;
2103
- _layersControl;
2104
- _overlay;
2105
- // Interactions
2106
- _interactionWfsSelect;
2107
- _interactionSelectModify;
2108
- _collectionModify;
2109
- _interactionModify;
2110
- _interactionSnap;
2111
- _interactionDraw;
2112
- // Obserbable keys
2113
- _keyClickWms;
2114
- _keyRemove;
2115
- _keySelect;
2116
- // Controls
2117
- _controlApplyDiscardChanges;
2118
- _controlWidgetToolsDiv;
2119
- _selectDraw;
2120
- // State
2121
- _currentZoom;
2122
- _lastZoom;
2123
- // Editing
2124
- _editFeature;
2125
- _editFeatureOriginal;
2126
- _uploads;
2127
- _editFields;
2052
+ class Wfst extends Control {
2128
2053
  constructor(options) {
2129
2054
  super({
2130
2055
  target: null,
@@ -2134,6 +2059,7 @@ class Wfst extends Control$1 {
2134
2059
  this._init();
2135
2060
  }
2136
2061
  });
2062
+ this._initialized = false;
2137
2063
  setLang(options.language, options.i18n);
2138
2064
  const defaultOptions = getDefaultOptions();
2139
2065
  this._options = deepObjectAssign(defaultOptions, options);
@@ -2177,7 +2103,7 @@ class Wfst extends Control$1 {
2177
2103
  layers.forEach((layer) => {
2178
2104
  if (layer.getVisible())
2179
2105
  layersNumber++;
2180
- layer.on('layerRendered', () => {
2106
+ layer.once('layerRendered', () => {
2181
2107
  layerRendered++;
2182
2108
  if (layerRendered >= layersNumber) {
2183
2109
  // run only once
@@ -2642,9 +2568,7 @@ class Wfst extends Control$1 {
2642
2568
  }
2643
2569
  };
2644
2570
  if (confirm) {
2645
- const confirmModal = Modal.confirm(I18N.labels.confirmDelete, {
2646
- ...this._options.modal
2647
- });
2571
+ const confirmModal = Modal.confirm(I18N.labels.confirmDelete, Object.assign({}, this._options.modal));
2648
2572
  confirmModal.show().once('dismiss', function (modal, ev, button) {
2649
2573
  if (button && button.value) {
2650
2574
  deleteEl();
@@ -2787,8 +2711,6 @@ class Wfst extends Control$1 {
2787
2711
  }
2788
2712
  }
2789
2713
  class WfstEvent extends BaseEvent {
2790
- data;
2791
- layer;
2792
2714
  constructor(options) {
2793
2715
  super(options.type);
2794
2716
  this.layer = options.layer;