@disy/cadenza.js 2.14.1 → 3.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 (50) hide show
  1. package/CHANGELOG.md +7 -0
  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 +29 -26
  6. package/apidoc/classes/CadenzaError.html +5 -5
  7. package/apidoc/functions/cadenza.html +3 -3
  8. package/apidoc/index.html +2 -2
  9. package/apidoc/interfaces/CadenzaClientOptions.html +5 -5
  10. package/apidoc/interfaces/CadenzaEvent.html +4 -4
  11. package/apidoc/interfaces/Distance.html +2 -2
  12. package/apidoc/interfaces/ExternalLinkKey.html +4 -4
  13. package/apidoc/interfaces/Feature.html +7 -7
  14. package/apidoc/interfaces/FeatureCollection.html +3 -3
  15. package/apidoc/interfaces/Geometry.html +3 -3
  16. package/apidoc/interfaces/GeometryExtentStrategy.html +6 -0
  17. package/apidoc/interfaces/PageSource.html +3 -3
  18. package/apidoc/modules.html +4 -4
  19. package/apidoc/types/CadenzaActionEvent.html +2 -2
  20. package/apidoc/types/CadenzaChangeSelectionEvent.html +2 -2
  21. package/apidoc/types/CadenzaDrillThroughEvent.html +2 -2
  22. package/apidoc/types/CadenzaEditGeometryCancelEvent.html +2 -2
  23. package/apidoc/types/CadenzaEditGeometryOkEvent.html +2 -2
  24. package/apidoc/types/CadenzaEditGeometryUpdateEvent.html +2 -2
  25. package/apidoc/types/CadenzaErrorEvent.html +2 -2
  26. package/apidoc/types/CadenzaEventByType.html +1 -1
  27. package/apidoc/types/CadenzaEventType.html +2 -2
  28. package/apidoc/types/CadenzaObjectInfoEvent.html +2 -2
  29. package/apidoc/types/CadenzaReloadEvent.html +2 -2
  30. package/apidoc/types/CadenzaSelectObjectsCancelEvent.html +2 -2
  31. package/apidoc/types/CadenzaSelectObjectsOkEvent.html +2 -2
  32. package/apidoc/types/CustomValidityType.html +2 -2
  33. package/apidoc/types/DataType.html +2 -2
  34. package/apidoc/types/EmbeddingTargetId.html +2 -2
  35. package/apidoc/types/Extent.html +2 -2
  36. package/apidoc/types/{ZoomTarget.html → ExtentStrategy.html} +2 -2
  37. package/apidoc/types/FilterVariables.html +2 -2
  38. package/apidoc/types/GeometryType.html +2 -2
  39. package/apidoc/types/GlobalId.html +2 -2
  40. package/apidoc/types/LengthUnit.html +1 -1
  41. package/apidoc/types/OpaqueString.html +2 -2
  42. package/apidoc/types/OperationMode.html +2 -2
  43. package/apidoc/types/TablePart.html +2 -2
  44. package/apidoc/types/UiFeature.html +2 -2
  45. package/apidoc/types/WorkbookLayerPath.html +2 -2
  46. package/cadenza.d.ts +30 -14
  47. package/cadenza.js +45 -15
  48. package/package.json +1 -1
  49. package/sandbox.html +36 -13
  50. package/apidoc/interfaces/GeometryZoomTarget.html +0 -4
@@ -1,3 +1,3 @@
1
- <!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>WorkbookLayerPath | Cadenza JS - v2.14.0</title><meta name="description" content="Documentation for Cadenza JS"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"><a href="https://github.com/DisyInformationssysteme/cadenza.js">Cadenza JS on GitHub</a></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">Cadenza JS - v2.14.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">Cadenza JS</a></li><li><a href="WorkbookLayerPath.html">WorkbookLayerPath</a></li></ul><h1>Type alias WorkbookLayerPath</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">Workbook<wbr/>Layer<wbr/>Path</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></div><div class="tsd-comment tsd-typography"><p>Identifies a layer within a workbook map view
1
+ <!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>WorkbookLayerPath | Cadenza JS - v2.14.2</title><meta name="description" content="Documentation for Cadenza JS"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"><a href="https://github.com/DisyInformationssysteme/cadenza.js">Cadenza JS on GitHub</a></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">Cadenza JS - v2.14.2</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">Cadenza JS</a></li><li><a href="WorkbookLayerPath.html">WorkbookLayerPath</a></li></ul><h1>Type alias WorkbookLayerPath</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">Workbook<wbr/>Layer<wbr/>Path</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></div><div class="tsd-comment tsd-typography"><p>Identifies a layer within a workbook map view
2
2
  using the print names of the layer and - if the layer is grouped - its ancestors</p>
3
- </div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/DisyInformationssysteme/cadenza.js/blob/873411ba535954dfb80b9c203e85584f875cb28e/src/cadenza.js#L93">src/cadenza.js:93</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><h4 class="uppercase">Member Visibility</h4><form><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></form></div><div class="tsd-theme-toggle"><h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>Cadenza JS - v2.14.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
3
+ </div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/DisyInformationssysteme/cadenza.js/blob/aed136426dcab04aac4d8927510b8c8d95fda581/src/cadenza.js#L93">src/cadenza.js:93</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><h4 class="uppercase">Member Visibility</h4><form><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></form></div><div class="tsd-theme-toggle"><h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>Cadenza JS - v2.14.2</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
package/cadenza.d.ts CHANGED
@@ -109,7 +109,7 @@ export class CadenzaClient {
109
109
  * @param {Extent} [options.mapExtent] - A map extent to set
110
110
  * @param {OperationMode} [options.operationMode] - The mode in which a workbook should be operated
111
111
  * @param {boolean} [options.useMapSrs] - Whether the geometry and the extent are in the map's SRS (otherwise EPSG:4326 is assumed)
112
- * @param {ZoomTarget} [options.zoomTarget] - A target Cadenza should zoom to
112
+ * @param {ExtentStrategy} [options.extentStrategy] - Strategy to define the new map extent
113
113
  * @param {AbortSignal} [options.signal] - A signal to abort the iframe loading
114
114
  * @return {Promise<void>} A `Promise` for when the iframe is loaded
115
115
  * @throws For invalid arguments
@@ -118,7 +118,7 @@ export class CadenzaClient {
118
118
  * - {@link CadenzaActionEvent}
119
119
  * @embed
120
120
  */
121
- showMap(mapView: EmbeddingTargetId, { disabledUiFeatures, expandNavigator, filter, geometry, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, locationFinder, mapExtent, operationMode, useMapSrs, zoomTarget, signal, }?: {
121
+ showMap(mapView: EmbeddingTargetId, { disabledUiFeatures, expandNavigator, filter, geometry, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, locationFinder, mapExtent, operationMode, useMapSrs, extentStrategy, signal, }?: {
122
122
  disabledUiFeatures?: UiFeature[] | undefined;
123
123
  expandNavigator?: boolean | undefined;
124
124
  filter?: FilterVariables | undefined;
@@ -130,7 +130,7 @@ export class CadenzaClient {
130
130
  mapExtent?: Extent | undefined;
131
131
  operationMode?: OperationMode | undefined;
132
132
  useMapSrs?: boolean | undefined;
133
- zoomTarget?: GeometryZoomTarget | undefined;
133
+ extentStrategy?: GeometryExtentStrategy | undefined;
134
134
  signal?: AbortSignal | undefined;
135
135
  } | undefined, ...args: any[]): Promise<void>;
136
136
  /**
@@ -181,30 +181,42 @@ export class CadenzaClient {
181
181
  * @hidden
182
182
  * @param {WorkbookLayerPath | string} layer - The data view layer to set the selection in
183
183
  * @param {unknown[][]} values - The IDs of the objects to select
184
+ * @param {object} [__namedParameters]
185
+ * @param {GeometryExtentStrategy} [__namedParameters.extentStrategy] - Strategy to define the new map extent
184
186
  * @return {Promise<void>} A `Promise` for when the selection was set.
185
187
  * @postMessage
186
188
  */
187
- setSelection(layer: WorkbookLayerPath | string, values: unknown[][], ...args: any[]): Promise<void>;
189
+ setSelection(layer: WorkbookLayerPath | string, values: unknown[][], { extentStrategy }?: {
190
+ extentStrategy?: GeometryExtentStrategy | undefined;
191
+ } | undefined, ...args: any[]): Promise<void>;
188
192
  /**
189
193
  * Add to the selection in the currently shown workbook map view.
190
194
  *
191
195
  * @hidden
192
196
  * @param {WorkbookLayerPath | string} layer - The data view layer to change the selection in
193
197
  * @param {unknown[][]} values - The IDs of the objects to select
198
+ * @param {object} [__namedParameters]
199
+ * @param {GeometryExtentStrategy} [__namedParameters.extentStrategy] - Strategy to define the new map extent
194
200
  * @return {Promise<void>} A `Promise` for when the selection was changed.
195
201
  * @postMessage
196
202
  */
197
- addSelection(layer: WorkbookLayerPath | string, values: unknown[][], ...args: any[]): Promise<void>;
203
+ addSelection(layer: WorkbookLayerPath | string, values: unknown[][], { extentStrategy }?: {
204
+ extentStrategy?: GeometryExtentStrategy | undefined;
205
+ } | undefined, ...args: any[]): Promise<void>;
198
206
  /**
199
207
  * Remove from the selection in the currently shown workbook map view.
200
208
  *
201
209
  * @hidden
202
210
  * @param {WorkbookLayerPath | string} layer - The data view layer to change the selection in
203
211
  * @param {unknown[][]} values - The IDs of the objects to unselect
212
+ * @param {object} [__namedParameters]
213
+ * @param {GeometryExtentStrategy} [__namedParameters.extentStrategy] - Strategy to define the new map extent
204
214
  * @return {Promise<void>} A `Promise` for when the selection was changed.
205
215
  * @postMessage
206
216
  */
207
- removeSelection(layer: WorkbookLayerPath | string, values: unknown[][], ...args: any[]): Promise<void>;
217
+ removeSelection(layer: WorkbookLayerPath | string, values: unknown[][], { extentStrategy }?: {
218
+ extentStrategy?: GeometryExtentStrategy | undefined;
219
+ } | undefined, ...args: any[]): Promise<void>;
208
220
  /**
209
221
  * Create a geometry.
210
222
  *
@@ -250,7 +262,7 @@ export class CadenzaClient {
250
262
  * @param {number} [options.minScale] - The minimum scale where the user should work on. A warning is shown when the map is zoomed out above the threshold.
251
263
  * @param {boolean} [options.useMapSrs] - Whether the geometry is in the map's SRS (otherwise EPSG:4326 is assumed)
252
264
  * @param {OperationMode} [options.operationMode] - The mode in which a workbook should be operated
253
- * @param {ZoomTarget} [options.zoomTarget] - A target Cadenza should zoom to
265
+ * @param {ExtentStrategy} [options.extentStrategy] - Strategy to define the new map extent
254
266
  * @param {AbortSignal} [options.signal] - A signal to abort the iframe loading
255
267
  * @return {Promise<void>} A `Promise` for when the iframe is loaded
256
268
  * @throws For invalid arguments
@@ -260,14 +272,14 @@ export class CadenzaClient {
260
272
  * - {@link CadenzaEditGeometryCancelEvent}
261
273
  * @embed
262
274
  */
263
- editGeometry(backgroundMapView: EmbeddingTargetId, geometry: Geometry, { filter, locationFinder, mapExtent, minScale, useMapSrs, zoomTarget, operationMode, signal, }?: {
275
+ editGeometry(backgroundMapView: EmbeddingTargetId, geometry: Geometry, { filter, locationFinder, mapExtent, minScale, useMapSrs, extentStrategy, operationMode, signal, }?: {
264
276
  filter?: FilterVariables | undefined;
265
277
  locationFinder?: string | undefined;
266
278
  mapExtent?: Extent | undefined;
267
279
  minScale?: number | undefined;
268
280
  useMapSrs?: boolean | undefined;
269
281
  operationMode?: OperationMode | undefined;
270
- zoomTarget?: GeometryZoomTarget | undefined;
282
+ extentStrategy?: GeometryExtentStrategy | undefined;
271
283
  signal?: AbortSignal | undefined;
272
284
  } | undefined, ...args: any[]): Promise<void>;
273
285
  /**
@@ -615,17 +627,21 @@ export type GeometryType = 'Point' | 'MultiPoint' | 'LineString' | 'MultiLineStr
615
627
  */
616
628
  export type Extent = [number, number, number, number];
617
629
  /**
618
- * - An object describing a target to zoom to
630
+ * - Options for defining the initial extent
619
631
  */
620
- export type ZoomTarget = GeometryZoomTarget;
632
+ export type ExtentStrategy = GeometryExtentStrategy;
621
633
  /**
622
- * - Instructs Cadenza to zoom to a provided {@Link Geometry}
634
+ * - The given {@link Geometry } defines the initial map extent.
623
635
  */
624
- export type GeometryZoomTarget = {
636
+ export type GeometryExtentStrategy = {
625
637
  /**
626
- * The type of the zoom target
638
+ * - The extent strategy type
627
639
  */
628
640
  type: 'geometry';
641
+ /**
642
+ * - This geometry takes precedence over another geometry that might be given in an API call.
643
+ */
644
+ geometry?: Geometry | undefined;
629
645
  };
630
646
  /**
631
647
  * - A data type
package/cadenza.js CHANGED
@@ -115,11 +115,12 @@ globalThis.cadenza = Object.assign((/** @type Parameters<cadenza> */ ...args) =>
115
115
  */
116
116
  /** @typedef {[number,number,number,number]} Extent - An array of numbers representing an extent: [minx, miny, maxx, maxy] */
117
117
  /**
118
- * @typedef {GeometryZoomTarget} ZoomTarget - An object describing a target to zoom to
118
+ * @typedef {GeometryExtentStrategy} ExtentStrategy - Options for defining the initial extent
119
119
  */
120
120
  /**
121
- * @typedef GeometryZoomTarget - Instructs Cadenza to zoom to a provided {@Link Geometry}
122
- * @property {'geometry'} type The type of the zoom target
121
+ * @typedef GeometryExtentStrategy - The given {@link Geometry} defines the initial map extent.
122
+ * @property {'geometry'} type - The extent strategy type
123
+ * @property {Geometry} [geometry] - This geometry takes precedence over another geometry that might be given in an API call.
123
124
  */
124
125
  /**
125
126
  * @typedef {'csv' | 'excel' | 'json' | 'pdf' | 'png'} DataType - A data type
@@ -318,7 +319,7 @@ export class CadenzaClient {
318
319
  * @param {Extent} [options.mapExtent] - A map extent to set
319
320
  * @param {OperationMode} [options.operationMode] - The mode in which a workbook should be operated
320
321
  * @param {boolean} [options.useMapSrs] - Whether the geometry and the extent are in the map's SRS (otherwise EPSG:4326 is assumed)
321
- * @param {ZoomTarget} [options.zoomTarget] - A target Cadenza should zoom to
322
+ * @param {ExtentStrategy} [options.extentStrategy] - Strategy to define the new map extent
322
323
  * @param {AbortSignal} [options.signal] - A signal to abort the iframe loading
323
324
  * @return {Promise<void>} A `Promise` for when the iframe is loaded
324
325
  * @throws For invalid arguments
@@ -327,12 +328,12 @@ export class CadenzaClient {
327
328
  * - {@link CadenzaActionEvent}
328
329
  * @embed
329
330
  */
330
- async showMap(mapView, { disabledUiFeatures, expandNavigator, filter, geometry, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, locationFinder, mapExtent, operationMode, useMapSrs, zoomTarget, signal, } = {}) {
331
+ async showMap(mapView, { disabledUiFeatures, expandNavigator, filter, geometry, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, locationFinder, mapExtent, operationMode, useMapSrs, extentStrategy, signal, } = {}) {
331
332
  this.#log('CadenzaClient#showMap', ...arguments);
332
333
  if (geometry) {
333
334
  assertValidGeometryType(geometry.type);
334
335
  }
335
- const zoomToGeometry = geometry && zoomTarget?.type === 'geometry';
336
+ const zoomToGeometry = geometry && extentStrategy?.type === 'geometry';
336
337
  const params = createParams({
337
338
  disabledUiFeatures,
338
339
  expandNavigator,
@@ -420,12 +421,30 @@ export class CadenzaClient {
420
421
  * @hidden
421
422
  * @param {WorkbookLayerPath | string} layer - The data view layer to set the selection in
422
423
  * @param {unknown[][]} values - The IDs of the objects to select
424
+ * @param {object} [__namedParameters]
425
+ * @param {GeometryExtentStrategy} [__namedParameters.extentStrategy] - Strategy to define the new map extent
423
426
  * @return {Promise<void>} A `Promise` for when the selection was set.
424
427
  * @postMessage
425
428
  */
426
- setSelection(layer, values) {
429
+ setSelection(layer, values, { extentStrategy } = {}) {
427
430
  this.#log('CadenzaClient#setSelection', ...arguments);
428
- return this.#postRequest('setSelection', { layer: array(layer), values });
431
+ const selectionResult = this.#postRequest('setSelection', {
432
+ layer: array(layer),
433
+ values,
434
+ });
435
+ this.#setExtentStrategy(extentStrategy);
436
+ return selectionResult;
437
+ }
438
+ /**
439
+ * Zooms to the extent provided by the strategy
440
+ *
441
+ * @param {GeometryExtentStrategy} [extentStrategy] - Strategy to define the new map extent
442
+ */
443
+ #setExtentStrategy(extentStrategy) {
444
+ const type = extentStrategy?.type;
445
+ if (type === 'geometry') {
446
+ this.#postEvent('setExtentStrategy', extentStrategy);
447
+ }
429
448
  }
430
449
  /**
431
450
  * Add to the selection in the currently shown workbook map view.
@@ -433,12 +452,19 @@ export class CadenzaClient {
433
452
  * @hidden
434
453
  * @param {WorkbookLayerPath | string} layer - The data view layer to change the selection in
435
454
  * @param {unknown[][]} values - The IDs of the objects to select
455
+ * @param {object} [__namedParameters]
456
+ * @param {GeometryExtentStrategy} [__namedParameters.extentStrategy] - Strategy to define the new map extent
436
457
  * @return {Promise<void>} A `Promise` for when the selection was changed.
437
458
  * @postMessage
438
459
  */
439
- addSelection(layer, values) {
460
+ addSelection(layer, values, { extentStrategy } = {}) {
440
461
  this.#log('CadenzaClient#addSelection', ...arguments);
441
- return this.#postRequest('addSelection', { layer: array(layer), values });
462
+ const selectionResult = this.#postRequest('addSelection', {
463
+ layer: array(layer),
464
+ values,
465
+ });
466
+ this.#setExtentStrategy(extentStrategy);
467
+ return selectionResult;
442
468
  }
443
469
  /**
444
470
  * Remove from the selection in the currently shown workbook map view.
@@ -446,15 +472,19 @@ export class CadenzaClient {
446
472
  * @hidden
447
473
  * @param {WorkbookLayerPath | string} layer - The data view layer to change the selection in
448
474
  * @param {unknown[][]} values - The IDs of the objects to unselect
475
+ * @param {object} [__namedParameters]
476
+ * @param {GeometryExtentStrategy} [__namedParameters.extentStrategy] - Strategy to define the new map extent
449
477
  * @return {Promise<void>} A `Promise` for when the selection was changed.
450
478
  * @postMessage
451
479
  */
452
- removeSelection(layer, values) {
480
+ removeSelection(layer, values, { extentStrategy } = {}) {
453
481
  this.#log('CadenzaClient#removeSelection', ...arguments);
454
- return this.#postRequest('removeSelection', {
482
+ const selectionResult = this.#postRequest('removeSelection', {
455
483
  layer: array(layer),
456
484
  values,
457
485
  });
486
+ this.#setExtentStrategy(extentStrategy);
487
+ return selectionResult;
458
488
  }
459
489
  /**
460
490
  * Create a geometry.
@@ -506,7 +536,7 @@ export class CadenzaClient {
506
536
  * @param {number} [options.minScale] - The minimum scale where the user should work on. A warning is shown when the map is zoomed out above the threshold.
507
537
  * @param {boolean} [options.useMapSrs] - Whether the geometry is in the map's SRS (otherwise EPSG:4326 is assumed)
508
538
  * @param {OperationMode} [options.operationMode] - The mode in which a workbook should be operated
509
- * @param {ZoomTarget} [options.zoomTarget] - A target Cadenza should zoom to
539
+ * @param {ExtentStrategy} [options.extentStrategy] - Strategy to define the new map extent
510
540
  * @param {AbortSignal} [options.signal] - A signal to abort the iframe loading
511
541
  * @return {Promise<void>} A `Promise` for when the iframe is loaded
512
542
  * @throws For invalid arguments
@@ -516,10 +546,10 @@ export class CadenzaClient {
516
546
  * - {@link CadenzaEditGeometryCancelEvent}
517
547
  * @embed
518
548
  */
519
- async editGeometry(backgroundMapView, geometry, { filter, locationFinder, mapExtent, minScale, useMapSrs, zoomTarget, operationMode, signal, } = {}) {
549
+ async editGeometry(backgroundMapView, geometry, { filter, locationFinder, mapExtent, minScale, useMapSrs, extentStrategy, operationMode, signal, } = {}) {
520
550
  this.#log('CadenzaClient#editGeometry', ...arguments);
521
551
  assertValidGeometryType(geometry.type);
522
- const zoomToGeometry = geometry && zoomTarget?.type === 'geometry';
552
+ const zoomToGeometry = geometry && extentStrategy?.type === 'geometry';
523
553
  const params = createParams({
524
554
  action: 'editGeometry',
525
555
  filter,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@disy/cadenza.js",
3
- "version": "2.14.1",
3
+ "version": "3.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": "github:DisyInformationssysteme/cadenza.js",
6
6
  "type": "module",
package/sandbox.html CHANGED
@@ -161,9 +161,9 @@
161
161
  },
162
162
  setFilter: data => cadenzaClient.setFilter(parseFilterVariables(data.filter)),
163
163
  setLayerVisibility: data => cadenzaClient.setLayerVisibility(JSON.parse(data.layer), data.visibility === 'on'),
164
- setSelection: data => cadenzaClient.setSelection(JSON.parse(data.layer), JSON.parse(data.objectIds)),
165
- addSelection: data => cadenzaClient.addSelection(JSON.parse(data.layer), JSON.parse(data.objectIds)),
166
- removeSelection: data => cadenzaClient.removeSelection(JSON.parse(data.layer), JSON.parse(data.objectIds)),
164
+ setSelection: data => cadenzaClient.setSelection(JSON.parse(data.layer), JSON.parse(data.objectIds), {extentStrategy: JSON.parse(data.extentStrategy)}),
165
+ addSelection: data => cadenzaClient.addSelection(JSON.parse(data.layer), JSON.parse(data.objectIds), { extentStrategy: JSON.parse(data.extentStrategy) }),
166
+ removeSelection: data => cadenzaClient.removeSelection(JSON.parse(data.layer), JSON.parse(data.objectIds), { extentStrategy: JSON.parse(data.extentStrategy) }),
167
167
  createGeometry: data => cadenzaClient.createGeometry(data.embeddingTargetId, data.geometryType, getOptions(data)),
168
168
  editGeometry: ({ geometry, ...data }) => cadenzaClient.editGeometry(data.embeddingTargetId, JSON.parse(geometry), getOptions(data)),
169
169
  selectObjects: data => cadenzaClient.selectObjects(data.embeddingTargetId, getOptions(data)),
@@ -229,7 +229,7 @@
229
229
  simplifiedOperationMode,
230
230
  useMapSrs,
231
231
  fullGeometries,
232
- zoomToGeometry,
232
+ extentStrategy,
233
233
  distance,
234
234
  lengthUnit
235
235
  }) {
@@ -252,7 +252,7 @@
252
252
  layers: layers ? JSON.parse(layers) : undefined,
253
253
  useMapSrs: useMapSrs === 'on',
254
254
  fullGeometries: fullGeometries === 'on',
255
- zoomTarget: zoomToGeometry === 'on' ? { type: 'geometry' } : undefined,
255
+ extentStrategy: extentStrategy && JSON.parse(extentStrategy),
256
256
  buffer: distance ? { value: Number(distance), lengthUnit: lengthUnit ? lengthUnit : 'm' } : undefined
257
257
  };
258
258
  }
@@ -463,7 +463,7 @@
463
463
  </div>
464
464
  </template>
465
465
 
466
- <template data-action="showMap" data-common="zoomTo,map,showWorkbook,filter,show">
466
+ <template data-action="showMap" data-common="extentStrategy,map,showWorkbook,filter,show">
467
467
  <div>
468
468
  <label for="embeddingTargetId">Embedding target ID of the map view *</label>
469
469
  <input name="embeddingTargetId" id="embeddingTargetId" required>
@@ -518,7 +518,7 @@
518
518
  </div>
519
519
  </template>
520
520
 
521
- <template data-action="editGeometry" data-common="zoomTo,map,filter">
521
+ <template data-action="editGeometry" data-common="extentStrategy,map,filter">
522
522
  <div>
523
523
  <label for="embeddingTargetId">Embedding target ID of the map view *</label>
524
524
  <input name="embeddingTargetId" id="embeddingTargetId" required>
@@ -571,7 +571,7 @@
571
571
  </div>
572
572
  </template>
573
573
 
574
- <template data-action="setSelection" data-common="layer,object-ids"></template>
574
+ <template data-action="setSelection" data-common="layer,object-ids,extentStrategy"></template>
575
575
  <template data-action="addSelection" data-common="layer,object-ids"></template>
576
576
  <template data-action="removeSelection" data-common="layer,object-ids"></template>
577
577
 
@@ -608,12 +608,35 @@
608
608
  </div>
609
609
  </template>
610
610
 
611
- <template id="common-zoomTo">
611
+ <template id="common-extentStrategy">
612
612
  <div>
613
- <label>
614
- <input type="checkbox" name="zoomToGeometry">
615
- Zoom to geometry
616
- </label>
613
+ <label for="extentStrategy">Extent Strategy</label>
614
+ <textarea name="extentStrategy" id="extentStrategy" rows="5"></textarea>
615
+ <small>
616
+ <p>Optional JSON Object</p>
617
+ <p>
618
+ Hints for some types:
619
+ <ul>
620
+ <li>'geometry' of 'geometry': GeoJSON geometry</li>
621
+ </ul>
622
+ </p>
623
+ <p>
624
+ Supported extent strategies as examples to use:
625
+ <ul>
626
+ <li><pre>{
627
+ "type": "geometry",
628
+ "geometry": {
629
+ "coordinates":[[
630
+ [9.598504509838506,52.70992820638244],
631
+ [8.899110702389294,51.72257425885121],
632
+ [10.906499617840836,51.725944168909365],
633
+ [9.598504509838506,52.70992820638244]]],
634
+ "type":"Polygon"
635
+ }
636
+ }</pre></li>
637
+ </ul>
638
+ </p>
639
+ </small>
617
640
  </div>
618
641
  </template>
619
642
 
@@ -1,4 +0,0 @@
1
- <!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>GeometryZoomTarget | Cadenza JS - v2.14.0</title><meta name="description" content="Documentation for Cadenza JS"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"><a href="https://github.com/DisyInformationssysteme/cadenza.js">Cadenza JS on GitHub</a></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">Cadenza JS - v2.14.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">Cadenza JS</a></li><li><a href="GeometryZoomTarget.html">GeometryZoomTarget</a></li></ul><h1>Interface GeometryZoomTarget</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Instructs Cadenza to zoom to a provided {@Link Geometry}</p>
2
- </div><div class="tsd-comment tsd-typography"></div></section><div class="tsd-signature"><span class="tsd-signature-keyword">interface </span><span class="tsd-kind-interface">GeometryZoomTarget</span> <span class="tsd-signature-symbol">{ </span><br/><span>    </span><a class="tsd-kind-property" href="GeometryZoomTarget.html#type">type</a><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">&quot;geometry&quot;</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/DisyInformationssysteme/cadenza.js/blob/873411ba535954dfb80b9c203e85584f875cb28e/src/cadenza.js#L135">src/cadenza.js:135</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="GeometryZoomTarget.html#type" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>type</span></a>
3
- </div></section></div></details></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties</h2><section class="tsd-panel tsd-member"><a id="type" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>type</span><a href="#type" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">type</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">&quot;geometry&quot;</span></div><div class="tsd-comment tsd-typography"><p>The type of the zoom target</p>
4
- </div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/DisyInformationssysteme/cadenza.js/blob/873411ba535954dfb80b9c203e85584f875cb28e/src/cadenza.js#L136">src/cadenza.js:136</a></li></ul></aside></section></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><h4 class="uppercase">Member Visibility</h4><form><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></form></div><div class="tsd-theme-toggle"><h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-index-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#type" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>type</span></a></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>Cadenza JS - v2.14.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>