@disy/cadenza.js 10.5.3 → 10.5.5

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 (65) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/apidoc/assets/navigation.js +1 -1
  3. package/apidoc/assets/search.js +1 -1
  4. package/apidoc/classes/AbortError.html +3 -3
  5. package/apidoc/classes/CadenzaClient.html +63 -23
  6. package/apidoc/classes/CadenzaError.html +5 -5
  7. package/apidoc/functions/cadenza.html +4 -4
  8. package/apidoc/index.html +4 -4
  9. package/apidoc/interfaces/AreaIntersectionsResult.html +4 -4
  10. package/apidoc/interfaces/CadenzaClientOptions.html +6 -6
  11. package/apidoc/interfaces/CadenzaEvent.html +4 -4
  12. package/apidoc/interfaces/CommonEditGeometryOptions.html +11 -11
  13. package/apidoc/interfaces/Distance.html +2 -2
  14. package/apidoc/interfaces/ExternalLinkKey.html +4 -4
  15. package/apidoc/interfaces/Feature.html +9 -9
  16. package/apidoc/interfaces/FeatureCollection.html +4 -4
  17. package/apidoc/interfaces/Geometry.html +4 -4
  18. package/apidoc/interfaces/GeometryExtentStrategy.html +4 -4
  19. package/apidoc/interfaces/LayerDataExtentStrategy.html +4 -4
  20. package/apidoc/interfaces/LayerDefinition.html +4 -4
  21. package/apidoc/interfaces/LocationFinderExtentStrategy.html +4 -4
  22. package/apidoc/interfaces/PageSource.html +3 -3
  23. package/apidoc/interfaces/ProblemDetails.html +6 -6
  24. package/apidoc/interfaces/SnappingOptions.html +3 -3
  25. package/apidoc/interfaces/SpatialFilterValue.html +4 -4
  26. package/apidoc/interfaces/StaticExtentStrategy.html +4 -4
  27. package/apidoc/modules.html +1 -1
  28. package/apidoc/types/CadenzaActionEvent.html +2 -2
  29. package/apidoc/types/CadenzaChangeExtentEvent.html +3 -0
  30. package/apidoc/types/CadenzaChangeSelectionEvent.html +2 -2
  31. package/apidoc/types/CadenzaDrillThroughEvent.html +2 -2
  32. package/apidoc/types/CadenzaEditGeometryCancelEvent.html +2 -2
  33. package/apidoc/types/CadenzaEditGeometryCreateEvent.html +2 -2
  34. package/apidoc/types/CadenzaEditGeometryDeleteEvent.html +2 -2
  35. package/apidoc/types/CadenzaEditGeometryEditEvent.html +2 -2
  36. package/apidoc/types/CadenzaEditGeometryOkEvent.html +2 -2
  37. package/apidoc/types/CadenzaEditGeometryUpdateEvent.html +2 -2
  38. package/apidoc/types/CadenzaErrorEvent.html +2 -2
  39. package/apidoc/types/CadenzaEventByType.html +1 -1
  40. package/apidoc/types/CadenzaEventType.html +2 -2
  41. package/apidoc/types/CadenzaReloadEvent.html +2 -2
  42. package/apidoc/types/CadenzaSelectObjectsCancelEvent.html +2 -2
  43. package/apidoc/types/CadenzaSelectObjectsOkEvent.html +2 -2
  44. package/apidoc/types/Coordinate.html +2 -2
  45. package/apidoc/types/CustomValidityType.html +2 -2
  46. package/apidoc/types/DataType.html +2 -2
  47. package/apidoc/types/EmbeddingTargetId.html +2 -2
  48. package/apidoc/types/Extent.html +2 -2
  49. package/apidoc/types/ExtentStrategy.html +2 -2
  50. package/apidoc/types/FilterVariables.html +2 -2
  51. package/apidoc/types/GeometryType.html +2 -2
  52. package/apidoc/types/GlobalId.html +2 -2
  53. package/apidoc/types/Layout.html +2 -2
  54. package/apidoc/types/LengthUnit.html +1 -1
  55. package/apidoc/types/OpaqueString.html +2 -2
  56. package/apidoc/types/OperationMode.html +2 -2
  57. package/apidoc/types/Polygon.html +1 -1
  58. package/apidoc/types/SpatialRelation.html +2 -2
  59. package/apidoc/types/TablePart.html +2 -2
  60. package/apidoc/types/UiFeature.html +2 -2
  61. package/apidoc/types/WorkbookLayerPath.html +2 -2
  62. package/apidoc/types/WorksheetPlaceholders.html +2 -2
  63. package/cadenza.d.ts +27 -9
  64. package/cadenza.js +64 -15
  65. package/package.json +1 -1
package/cadenza.d.ts CHANGED
@@ -121,6 +121,8 @@ export class CadenzaClient {
121
121
  * @return {Promise<void>} A `Promise` for when the iframe is loaded
122
122
  * @throws For invalid arguments
123
123
  * @fires
124
+ * - {@link CadenzaChangeExtentEvent}
125
+ * - {@link CadenzaChangeSelectionEvent}
124
126
  * - {@link CadenzaDrillThroughEvent}
125
127
  * - {@link CadenzaActionEvent}
126
128
  * @embed
@@ -168,7 +170,6 @@ export class CadenzaClient {
168
170
  /**
169
171
  * Set filter variables in the currently shown workbook.
170
172
  *
171
- * @hidden
172
173
  * @param {FilterVariables} filter - The variable values
173
174
  * @return {Promise<void>} A `Promise` for when the filter variables were set.
174
175
  * @postMessage
@@ -180,7 +181,6 @@ export class CadenzaClient {
180
181
  * When making a layer visible, its ancestors will be made visible, too.
181
182
  * When hiding a layer, the ancestors are not affected.
182
183
  *
183
- * @hidden
184
184
  * @param {WorkbookLayerPath | string} layer - The layer to show or hide
185
185
  * (identified using a layer path or a print name)
186
186
  * @param {boolean} visible - The visibility state of the layer
@@ -191,7 +191,6 @@ export class CadenzaClient {
191
191
  /**
192
192
  * Set the selection in the currently shown workbook map view.
193
193
  *
194
- * @hidden
195
194
  * @param {WorkbookLayerPath | string} layer - The data view layer to set the selection in
196
195
  * @param {unknown[][]} values - The IDs of the objects to select
197
196
  * @param {object} [__namedParameters]
@@ -205,7 +204,6 @@ export class CadenzaClient {
205
204
  /**
206
205
  * Add to the selection in the currently shown workbook map view.
207
206
  *
208
- * @hidden
209
207
  * @param {WorkbookLayerPath | string} layer - The data view layer to change the selection in
210
208
  * @param {unknown[][]} values - The IDs of the objects to select
211
209
  * @param {object} [__namedParameters]
@@ -219,7 +217,6 @@ export class CadenzaClient {
219
217
  /**
220
218
  * Remove from the selection in the currently shown workbook map view.
221
219
  *
222
- * @hidden
223
220
  * @param {WorkbookLayerPath | string} layer - The data view layer to change the selection in
224
221
  * @param {unknown[][]} values - The IDs of the objects to unselect
225
222
  * @param {object} [__namedParameters]
@@ -241,6 +238,8 @@ export class CadenzaClient {
241
238
  * @param {CommonEditGeometryOptions} [editGeometryOptions] - Options for the initialization of the geometry editor.
242
239
  * @throws For invalid arguments
243
240
  * @fires
241
+ * - {@link CadenzaChangeExtentEvent}
242
+ * - {@link CadenzaChangeSelectionEvent}
244
243
  * - {@link CadenzaEditGeometryUpdateEvent}
245
244
  * - {@link CadenzaEditGeometryOkEvent}
246
245
  * - {@link CadenzaEditGeometryCancelEvent}
@@ -256,6 +255,8 @@ export class CadenzaClient {
256
255
  * @return {Promise<void>} A `Promise` for when the iframe is loaded
257
256
  * @throws For invalid arguments
258
257
  * @fires
258
+ * - {@link CadenzaChangeExtentEvent}
259
+ * - {@link CadenzaChangeSelectionEvent}
259
260
  * - {@link CadenzaEditGeometryUpdateEvent}
260
261
  * - {@link CadenzaEditGeometryOkEvent}
261
262
  * - {@link CadenzaEditGeometryCancelEvent}
@@ -271,6 +272,8 @@ export class CadenzaClient {
271
272
  * @return {Promise<void>} A `Promise` for when the iframe is loaded
272
273
  * @throws For invalid arguments
273
274
  * @fires
275
+ * - {@link CadenzaChangeExtentEvent}
276
+ * - {@link CadenzaChangeSelectionEvent}
274
277
  * - {@link CadenzaEditGeometryUpdateEvent}
275
278
  * - {@link CadenzaEditGeometryOkEvent}
276
279
  * - {@link CadenzaEditGeometryCreateEvent}
@@ -289,6 +292,8 @@ export class CadenzaClient {
289
292
  * @return {Promise<void>} A `Promise` for when the iframe is loaded
290
293
  * @throws For invalid arguments
291
294
  * @fires
295
+ * - {@link CadenzaChangeExtentEvent}
296
+ * - {@link CadenzaChangeSelectionEvent}
292
297
  * - {@link CadenzaEditGeometryUpdateEvent}
293
298
  * - {@link CadenzaEditGeometryOkEvent}
294
299
  * - {@link CadenzaEditGeometryCreateEvent}
@@ -444,6 +449,7 @@ export class CadenzaClient {
444
449
  }
445
450
  /**
446
451
  * @typedef {'action'
452
+ * | 'change:extent'
447
453
  * | 'change:selection'
448
454
  * | 'drillThrough'
449
455
  * | 'editGeometry:ok'
@@ -460,6 +466,7 @@ export class CadenzaClient {
460
466
  /**
461
467
  * @template {CadenzaEventType} T
462
468
  * @typedef {T extends 'action' ? CadenzaActionEvent
469
+ * : T extends 'change:extent' ? CadenzaChangeExtentEvent
463
470
  * : T extends 'change:selection' ? CadenzaChangeSelectionEvent
464
471
  * : T extends 'drillThrough' ? CadenzaDrillThroughEvent
465
472
  * : T extends 'editGeometry:update' ? CadenzaEditGeometryUpdateEvent
@@ -484,6 +491,10 @@ export class CadenzaClient {
484
491
  /**
485
492
  * @typedef {CadenzaEvent<'action', {context: string}>} CadenzaActionEvent - When the user executed a POST message action, which is defined on an external link in the Cadenza management center.
486
493
  */
494
+ /**
495
+ * @typedef {CadenzaEvent<'change:extent', {extent: Extent}>} CadenzaChangeExtentEvent - When the user moved the map.
496
+ * The extent is transformed according to the `useMapSrs` option.
497
+ */
487
498
  /**
488
499
  * @typedef {CadenzaEvent<'change:selection', undefined | {layer: WorkbookLayerPath, values: unknown[][]}>} CadenzaChangeSelectionEvent - When the user changed the selection. `undefined` if no objects were selected.
489
500
  *
@@ -502,7 +513,7 @@ export class CadenzaClient {
502
513
  /** @typedef {CadenzaEvent<'editGeometry:ok', FeatureCollection | Feature>} CadenzaEditGeometryOkEvent - When the user submitted the geometry. `FeatureCollection` if batch editing is enabled. */
503
514
  /** @typedef {CadenzaEvent<'editGeometry:create', FeatureCollection | Feature>} CadenzaEditGeometryCreateEvent - Whenever new geometry features were created. `Feature` if only one feature was created. Only available in batch mode */
504
515
  /** @typedef {CadenzaEvent<'editGeometry:edit', Feature>} CadenzaEditGeometryEditEvent - Whenever a geometry feature was edited. Only available in batch mode */
505
- /** @typedef {CadenzaEvent<'editGeometry:delete', {featureIds: any[][]}>} CadenzaEditGeometryDeleteEvent - Whenever geometry features were deleted. Only available in batch mode */
516
+ /** @typedef {CadenzaEvent<'editGeometry:delete', {objectIds: any[][]}>} CadenzaEditGeometryDeleteEvent - Whenever geometry features were deleted. Only available in batch mode */
506
517
  /** @typedef {CadenzaEvent<'editGeometry:cancel'>} CadenzaEditGeometryCancelEvent - When the user cancelled the geometry editing. */
507
518
  /** @typedef {CadenzaEvent<'error', {type: string, message?: string}>} CadenzaErrorEvent - An error event that is mapped to a {@link CadenzaError} */
508
519
  /**
@@ -934,8 +945,8 @@ export type Layout = 'dashboard' | 'linear';
934
945
  /**
935
946
  * - An event type to subscribe to using {@link CadenzaClienton }
936
947
  */
937
- export type CadenzaEventType = 'action' | 'change:selection' | 'drillThrough' | 'editGeometry:ok' | 'editGeometry:create' | 'editGeometry:edit' | 'editGeometry:delete' | 'editGeometry:update' | 'editGeometry:cancel' | 'reload' | 'selectObjects:ok' | 'selectObjects:cancel';
938
- export type CadenzaEventByType<T extends CadenzaEventType> = T extends 'action' ? CadenzaActionEvent : T extends 'change:selection' ? CadenzaChangeSelectionEvent : T extends 'drillThrough' ? CadenzaDrillThroughEvent : T extends 'editGeometry:update' ? CadenzaEditGeometryUpdateEvent : T extends 'editGeometry:ok' ? CadenzaEditGeometryOkEvent : T extends 'editGeometry:create' ? CadenzaEditGeometryCreateEvent : T extends 'editGeometry:edit' ? CadenzaEditGeometryEditEvent : T extends 'editGeometry:delete' ? CadenzaEditGeometryDeleteEvent : T extends 'editGeometry:cancel' ? CadenzaEditGeometryCancelEvent : T extends 'reload' ? CadenzaReloadEvent : T extends 'selectObjects:ok' ? CadenzaSelectObjectsOkEvent : T extends 'selectObjects:cancel' ? CadenzaSelectObjectsCancelEvent : never;
948
+ export type CadenzaEventType = 'action' | 'change:extent' | 'change:selection' | 'drillThrough' | 'editGeometry:ok' | 'editGeometry:create' | 'editGeometry:edit' | 'editGeometry:delete' | 'editGeometry:update' | 'editGeometry:cancel' | 'reload' | 'selectObjects:ok' | 'selectObjects:cancel';
949
+ export type CadenzaEventByType<T extends CadenzaEventType> = T extends 'action' ? CadenzaActionEvent : T extends 'change:extent' ? CadenzaChangeExtentEvent : T extends 'change:selection' ? CadenzaChangeSelectionEvent : T extends 'drillThrough' ? CadenzaDrillThroughEvent : T extends 'editGeometry:update' ? CadenzaEditGeometryUpdateEvent : T extends 'editGeometry:ok' ? CadenzaEditGeometryOkEvent : T extends 'editGeometry:create' ? CadenzaEditGeometryCreateEvent : T extends 'editGeometry:edit' ? CadenzaEditGeometryEditEvent : T extends 'editGeometry:delete' ? CadenzaEditGeometryDeleteEvent : T extends 'editGeometry:cancel' ? CadenzaEditGeometryCancelEvent : T extends 'reload' ? CadenzaReloadEvent : T extends 'selectObjects:ok' ? CadenzaSelectObjectsOkEvent : T extends 'selectObjects:cancel' ? CadenzaSelectObjectsCancelEvent : never;
939
950
  /**
940
951
  * - A Cadenza `postMessage()` event
941
952
  */
@@ -955,6 +966,13 @@ export type CadenzaEvent<TYPE extends string, DETAIL = unknown> = {
955
966
  export type CadenzaActionEvent = CadenzaEvent<'action', {
956
967
  context: string;
957
968
  }>;
969
+ /**
970
+ * - When the user moved the map.
971
+ * The extent is transformed according to the `useMapSrs` option.
972
+ */
973
+ export type CadenzaChangeExtentEvent = CadenzaEvent<'change:extent', {
974
+ extent: [number, number, number, number];
975
+ }>;
958
976
  /**
959
977
  * - When the user changed the selection. `undefined` if no objects were selected.
960
978
  *
@@ -997,7 +1015,7 @@ export type CadenzaEditGeometryEditEvent = CadenzaEvent<'editGeometry:edit', Fea
997
1015
  * - Whenever geometry features were deleted. Only available in batch mode
998
1016
  */
999
1017
  export type CadenzaEditGeometryDeleteEvent = CadenzaEvent<'editGeometry:delete', {
1000
- featureIds: any[][];
1018
+ objectIds: any[][];
1001
1019
  }>;
1002
1020
  /**
1003
1021
  * - When the user cancelled the geometry editing.
package/cadenza.js CHANGED
@@ -18,7 +18,7 @@
18
18
  */
19
19
  // This placeholder is replaced when Cadenza JS is released,
20
20
  // i.e. during development, the version is not available.
21
- const CADENZAJS_VERSION = '10.5.3';
21
+ const CADENZAJS_VERSION = '10.5.5';
22
22
  /**
23
23
  * Creates an instance of the Cadenza JS client.
24
24
  *
@@ -427,6 +427,8 @@ export class CadenzaClient {
427
427
  * @return {Promise<void>} A `Promise` for when the iframe is loaded
428
428
  * @throws For invalid arguments
429
429
  * @fires
430
+ * - {@link CadenzaChangeExtentEvent}
431
+ * - {@link CadenzaChangeSelectionEvent}
430
432
  * - {@link CadenzaDrillThroughEvent}
431
433
  * - {@link CadenzaActionEvent}
432
434
  * @embed
@@ -497,7 +499,6 @@ export class CadenzaClient {
497
499
  /**
498
500
  * Set filter variables in the currently shown workbook.
499
501
  *
500
- * @hidden
501
502
  * @param {FilterVariables} filter - The variable values
502
503
  * @return {Promise<void>} A `Promise` for when the filter variables were set.
503
504
  * @postMessage
@@ -513,7 +514,6 @@ export class CadenzaClient {
513
514
  * When making a layer visible, its ancestors will be made visible, too.
514
515
  * When hiding a layer, the ancestors are not affected.
515
516
  *
516
- * @hidden
517
517
  * @param {WorkbookLayerPath | string} layer - The layer to show or hide
518
518
  * (identified using a layer path or a print name)
519
519
  * @param {boolean} visible - The visibility state of the layer
@@ -530,7 +530,6 @@ export class CadenzaClient {
530
530
  /**
531
531
  * Set the selection in the currently shown workbook map view.
532
532
  *
533
- * @hidden
534
533
  * @param {WorkbookLayerPath | string} layer - The data view layer to set the selection in
535
534
  * @param {unknown[][]} values - The IDs of the objects to select
536
535
  * @param {object} [__namedParameters]
@@ -550,7 +549,6 @@ export class CadenzaClient {
550
549
  /**
551
550
  * Add to the selection in the currently shown workbook map view.
552
551
  *
553
- * @hidden
554
552
  * @param {WorkbookLayerPath | string} layer - The data view layer to change the selection in
555
553
  * @param {unknown[][]} values - The IDs of the objects to select
556
554
  * @param {object} [__namedParameters]
@@ -570,7 +568,6 @@ export class CadenzaClient {
570
568
  /**
571
569
  * Remove from the selection in the currently shown workbook map view.
572
570
  *
573
- * @hidden
574
571
  * @param {WorkbookLayerPath | string} layer - The data view layer to change the selection in
575
572
  * @param {unknown[][]} values - The IDs of the objects to unselect
576
573
  * @param {object} [__namedParameters]
@@ -598,6 +595,8 @@ export class CadenzaClient {
598
595
  * @param {CommonEditGeometryOptions} [editGeometryOptions] - Options for the initialization of the geometry editor.
599
596
  * @throws For invalid arguments
600
597
  * @fires
598
+ * - {@link CadenzaChangeExtentEvent}
599
+ * - {@link CadenzaChangeSelectionEvent}
601
600
  * - {@link CadenzaEditGeometryUpdateEvent}
602
601
  * - {@link CadenzaEditGeometryOkEvent}
603
602
  * - {@link CadenzaEditGeometryCancelEvent}
@@ -635,6 +634,8 @@ export class CadenzaClient {
635
634
  * @return {Promise<void>} A `Promise` for when the iframe is loaded
636
635
  * @throws For invalid arguments
637
636
  * @fires
637
+ * - {@link CadenzaChangeExtentEvent}
638
+ * - {@link CadenzaChangeSelectionEvent}
638
639
  * - {@link CadenzaEditGeometryUpdateEvent}
639
640
  * - {@link CadenzaEditGeometryOkEvent}
640
641
  * - {@link CadenzaEditGeometryCancelEvent}
@@ -676,6 +677,8 @@ export class CadenzaClient {
676
677
  * @return {Promise<void>} A `Promise` for when the iframe is loaded
677
678
  * @throws For invalid arguments
678
679
  * @fires
680
+ * - {@link CadenzaChangeExtentEvent}
681
+ * - {@link CadenzaChangeSelectionEvent}
679
682
  * - {@link CadenzaEditGeometryUpdateEvent}
680
683
  * - {@link CadenzaEditGeometryOkEvent}
681
684
  * - {@link CadenzaEditGeometryCreateEvent}
@@ -718,6 +721,8 @@ export class CadenzaClient {
718
721
  * @return {Promise<void>} A `Promise` for when the iframe is loaded
719
722
  * @throws For invalid arguments
720
723
  * @fires
724
+ * - {@link CadenzaChangeExtentEvent}
725
+ * - {@link CadenzaChangeSelectionEvent}
721
726
  * - {@link CadenzaEditGeometryUpdateEvent}
722
727
  * - {@link CadenzaEditGeometryOkEvent}
723
728
  * - {@link CadenzaEditGeometryCreateEvent}
@@ -749,8 +754,8 @@ export class CadenzaClient {
749
754
  await this.#setupEditorViaPostRequests({
750
755
  additionalLayers,
751
756
  validExtentStrategy,
752
- features,
753
757
  });
758
+ await this.#createFeaturesAndEditLastCreatedFeature(features);
754
759
  await this.#setEditorStateToReady();
755
760
  }
756
761
  /**
@@ -758,10 +763,9 @@ export class CadenzaClient {
758
763
  * @param [__namedParameters.geometry] {Geometry} - The geometry to edit
759
764
  * @param [__namedParameters.additionalLayers] {LayerDefinition[]} - Layer definitions to be imported and shown in the background, as a basis for the drawing. IMPORTANT: The Cadenza referenced with `cadenzaClient` must be configured to support the import of GeoJSON, and the (system) privileges of the corresponding user must also be set in such a way that the import of GeoJSON is possible.
760
765
  * @param [__namedParameters.validExtentStrategy] {ExtentStrategy} - Defines the initial map extent; If not given, Cadenza's default logic is used.
761
- * @param [__namedParameters.features] {FeatureCollection} - The features to edit. The last feature in this collection is directly set up for editing.
762
766
  * @returns {Promise<Awaited<unknown>[]>}
763
767
  */
764
- #setupEditorViaPostRequests({ geometry, additionalLayers, validExtentStrategy, features, }) {
768
+ #setupEditorViaPostRequests({ geometry, additionalLayers, validExtentStrategy, }) {
765
769
  const postRequests = [];
766
770
  postRequests.push(this.#setExtentStrategy(validExtentStrategy));
767
771
  if (geometry) {
@@ -774,11 +778,41 @@ export class CadenzaClient {
774
778
  postRequests.push(this.#postRequest('importLayer', layer));
775
779
  }
776
780
  }
777
- if (features) {
778
- postRequests.push(this.#postRequest('addFeatures', features));
779
- }
780
781
  return Promise.all(postRequests);
781
782
  }
783
+ /**
784
+ * @param {FeatureCollection} features - The features to edit.
785
+ */
786
+ async #createFeaturesAndEditLastCreatedFeature(features) {
787
+ const editFeaturePromise = new Promise((resolve) => {
788
+ this.#once('editGeometry:create',
789
+ /** @param {CadenzaEditGeometryCreateEvent} event */ async (event) => {
790
+ const featureOrCollection = event.detail;
791
+ let lastAddedFeature;
792
+ if (featureOrCollection.type === 'Feature') {
793
+ lastAddedFeature = featureOrCollection;
794
+ }
795
+ else {
796
+ const addedFeatures = featureOrCollection.features;
797
+ lastAddedFeature = addedFeatures[addedFeatures.length - 1];
798
+ }
799
+ await this.#setEditFeature(lastAddedFeature.objectId);
800
+ resolve(undefined);
801
+ });
802
+ });
803
+ await this.#postRequest('createFeatures', features);
804
+ return editFeaturePromise;
805
+ }
806
+ /**
807
+ * Send a request to the geometry editor to edit the feature with the given ID.
808
+ * If another feature is currently being edited or created,
809
+ * the user is prompted to save (if possible), discard the current changes, or to abort the request.
810
+ *
811
+ * @param {any[]} objectId - The id of the feature
812
+ */
813
+ #setEditFeature(objectId) {
814
+ return this.#postRequest('requestEditFeature', objectId);
815
+ }
782
816
  #setEditorStateToReady() {
783
817
  return this.#postRequest('setEditorState', 'READY');
784
818
  }
@@ -953,6 +987,20 @@ export class CadenzaClient {
953
987
  }
954
988
  };
955
989
  }
990
+ /**
991
+ * @template {CadenzaEventType | string} TYPE
992
+ * @template [DETAIL=unknown]
993
+ * @param {TYPE} type
994
+ * @param {(event: CadenzaEvent<TYPE, DETAIL>) => void} subscriber
995
+ * @return {() => void} An unsubscribe function
996
+ */
997
+ #once(type, subscriber) {
998
+ const unsubscribe = this.#on(type, (event) => {
999
+ subscriber(/** @type {CadenzaEvent<TYPE, DETAIL>} */ (event));
1000
+ unsubscribe();
1001
+ });
1002
+ return unsubscribe;
1003
+ }
956
1004
  // Use arrow function so that it's bound to this.
957
1005
  #onMessage = (
958
1006
  /** @type MessageEvent<CadenzaEvent<never, never>> */ event) => {
@@ -1467,6 +1515,7 @@ function getGeometryTypeFromFeatureCollection(featureCollection) {
1467
1515
  // Please do not add internal event types like 'ready' here.
1468
1516
  /**
1469
1517
  * @typedef {'action'
1518
+ * | 'change:extent'
1470
1519
  * | 'change:selection'
1471
1520
  * | 'drillThrough'
1472
1521
  * | 'editGeometry:ok'
@@ -1483,6 +1532,7 @@ function getGeometryTypeFromFeatureCollection(featureCollection) {
1483
1532
  /**
1484
1533
  * @template {CadenzaEventType} T
1485
1534
  * @typedef {T extends 'action' ? CadenzaActionEvent
1535
+ * : T extends 'change:extent' ? CadenzaChangeExtentEvent
1486
1536
  * : T extends 'change:selection' ? CadenzaChangeSelectionEvent
1487
1537
  * : T extends 'drillThrough' ? CadenzaDrillThroughEvent
1488
1538
  * : T extends 'editGeometry:update' ? CadenzaEditGeometryUpdateEvent
@@ -1507,8 +1557,7 @@ function getGeometryTypeFromFeatureCollection(featureCollection) {
1507
1557
  /**
1508
1558
  * @typedef {CadenzaEvent<'action', {context: string}>} CadenzaActionEvent - When the user executed a POST message action, which is defined on an external link in the Cadenza management center.
1509
1559
  */
1510
- /*
1511
- * @hidden
1560
+ /**
1512
1561
  * @typedef {CadenzaEvent<'change:extent', {extent: Extent}>} CadenzaChangeExtentEvent - When the user moved the map.
1513
1562
  * The extent is transformed according to the `useMapSrs` option.
1514
1563
  */
@@ -1530,7 +1579,7 @@ function getGeometryTypeFromFeatureCollection(featureCollection) {
1530
1579
  /** @typedef {CadenzaEvent<'editGeometry:ok', FeatureCollection | Feature>} CadenzaEditGeometryOkEvent - When the user submitted the geometry. `FeatureCollection` if batch editing is enabled. */
1531
1580
  /** @typedef {CadenzaEvent<'editGeometry:create', FeatureCollection | Feature>} CadenzaEditGeometryCreateEvent - Whenever new geometry features were created. `Feature` if only one feature was created. Only available in batch mode */
1532
1581
  /** @typedef {CadenzaEvent<'editGeometry:edit', Feature>} CadenzaEditGeometryEditEvent - Whenever a geometry feature was edited. Only available in batch mode */
1533
- /** @typedef {CadenzaEvent<'editGeometry:delete', {featureIds: any[][]}>} CadenzaEditGeometryDeleteEvent - Whenever geometry features were deleted. Only available in batch mode */
1582
+ /** @typedef {CadenzaEvent<'editGeometry:delete', {objectIds: any[][]}>} CadenzaEditGeometryDeleteEvent - Whenever geometry features were deleted. Only available in batch mode */
1534
1583
  /** @typedef {CadenzaEvent<'editGeometry:cancel'>} CadenzaEditGeometryCancelEvent - When the user cancelled the geometry editing. */
1535
1584
  /** @typedef {CadenzaEvent<'error', {type: string, message?: string}>} CadenzaErrorEvent - An error event that is mapped to a {@link CadenzaError} */
1536
1585
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@disy/cadenza.js",
3
- "version": "10.5.3",
3
+ "version": "10.5.5",
4
4
  "license": "Apache-2.0",
5
5
  "repository": "github:DisyInformationssysteme/cadenza.js",
6
6
  "type": "module",