@disy/cadenza.js 2.8.0 → 2.8.2

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 (42) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/apidoc/assets/navigation.js +1 -1
  3. package/apidoc/assets/search.js +1 -1
  4. package/apidoc/classes/AbortError.html +2 -2
  5. package/apidoc/classes/CadenzaClient.html +31 -19
  6. package/apidoc/classes/CadenzaError.html +3 -3
  7. package/apidoc/functions/cadenza.html +2 -2
  8. package/apidoc/index.html +5 -1
  9. package/apidoc/interfaces/CadenzaClientOptions.html +5 -5
  10. package/apidoc/interfaces/CadenzaEvent.html +3 -3
  11. package/apidoc/interfaces/ExternalLinkKey.html +3 -3
  12. package/apidoc/interfaces/Feature.html +12 -0
  13. package/apidoc/interfaces/FeatureCollection.html +4 -0
  14. package/apidoc/interfaces/Geometry.html +2 -2
  15. package/apidoc/interfaces/PageSource.html +2 -2
  16. package/apidoc/modules.html +2 -0
  17. package/apidoc/types/CadenzaChangeSelectionEvent.html +1 -1
  18. package/apidoc/types/CadenzaDrillThroughEvent.html +1 -1
  19. package/apidoc/types/CadenzaEditGeometryCancelEvent.html +1 -1
  20. package/apidoc/types/CadenzaEditGeometryOkEvent.html +1 -1
  21. package/apidoc/types/CadenzaEditGeometryUpdateEvent.html +1 -1
  22. package/apidoc/types/CadenzaErrorEvent.html +1 -1
  23. package/apidoc/types/CadenzaEventByType.html +1 -1
  24. package/apidoc/types/CadenzaEventType.html +1 -1
  25. package/apidoc/types/CadenzaObjectInfoEvent.html +1 -1
  26. package/apidoc/types/CadenzaSelectObjectsCancelEvent.html +1 -1
  27. package/apidoc/types/CadenzaSelectObjectsOkEvent.html +1 -1
  28. package/apidoc/types/DataType.html +1 -1
  29. package/apidoc/types/EmbeddingTargetId.html +1 -1
  30. package/apidoc/types/Extent.html +1 -1
  31. package/apidoc/types/FilterVariables.html +1 -1
  32. package/apidoc/types/GeometryType.html +1 -1
  33. package/apidoc/types/GlobalId.html +1 -1
  34. package/apidoc/types/OpaqueString.html +1 -1
  35. package/apidoc/types/OperationMode.html +1 -1
  36. package/apidoc/types/TablePart.html +1 -1
  37. package/apidoc/types/UiFeature.html +1 -1
  38. package/apidoc/types/WorkbookLayerPath.html +1 -1
  39. package/cadenza.d.ts +67 -6
  40. package/cadenza.js +73 -12
  41. package/package.json +1 -1
  42. package/sandbox.html +39 -12
@@ -4,4 +4,4 @@
4
4
  <li><code>&quot;workbook-design&quot;</code> - The workbook designer</li>
5
5
  <li><code>&quot;workbook-view-management&quot;</code> - Add/Edit/Remove workbook views (Is included in &#39;workbook-design&#39;.)</li>
6
6
  </ul>
7
- </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/0a74c9910382d367b1f486ba6f34dbb6bf53fce7/src/cadenza.js#L104">src/cadenza.js:104</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</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>
7
+ </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/ded6b3d12e30793a03df29333dceb95a2229ae4d/src/cadenza.js#L104">src/cadenza.js:104</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</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>
@@ -1,3 +1,3 @@
1
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</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</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/0a74c9910382d367b1f486ba6f34dbb6bf53fce7/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</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/ded6b3d12e30793a03df29333dceb95a2229ae4d/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</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
@@ -148,28 +148,28 @@ export class CadenzaClient {
148
148
  *
149
149
  * @hidden
150
150
  * @param {WorkbookLayerPath | string} layer - The data view layer to set the selection in
151
- * @param {unknown[]} values - The IDs of the objects to select
151
+ * @param {unknown[][]} values - The IDs of the objects to select
152
152
  * @return {Promise<void>} A `Promise` for when the selection was set.
153
153
  */
154
- setSelection(layer: WorkbookLayerPath | string, values: unknown[], ...args: any[]): Promise<void>;
154
+ setSelection(layer: WorkbookLayerPath | string, values: unknown[][], ...args: any[]): Promise<void>;
155
155
  /**
156
156
  * Add to the selection in the currently shown workbook map view.
157
157
  *
158
158
  * @hidden
159
159
  * @param {WorkbookLayerPath | string} layer - The data view layer to change the selection in
160
- * @param {unknown[]} values - The IDs of the objects to select
160
+ * @param {unknown[][]} values - The IDs of the objects to select
161
161
  * @return {Promise<void>} A `Promise` for when the selection was changed.
162
162
  */
163
- addSelection(layer: WorkbookLayerPath | string, values: unknown[], ...args: any[]): Promise<void>;
163
+ addSelection(layer: WorkbookLayerPath | string, values: unknown[][], ...args: any[]): Promise<void>;
164
164
  /**
165
165
  * Remove from the selection in the currently shown workbook map view.
166
166
  *
167
167
  * @hidden
168
168
  * @param {WorkbookLayerPath | string} layer - The data view layer to change the selection in
169
- * @param {unknown[]} values - The IDs of the objects to unselect
169
+ * @param {unknown[][]} values - The IDs of the objects to unselect
170
170
  * @return {Promise<void>} A `Promise` for when the selection was changed.
171
171
  */
172
- removeSelection(layer: WorkbookLayerPath | string, values: unknown[], ...args: any[]): Promise<void>;
172
+ removeSelection(layer: WorkbookLayerPath | string, values: unknown[][], ...args: any[]): Promise<void>;
173
173
  /**
174
174
  * Create a geometry.
175
175
  *
@@ -264,6 +264,12 @@ export class CadenzaClient {
264
264
  * @return {() => void} An unsubscribe function
265
265
  */
266
266
  on<TYPE extends CadenzaEventType>(type: TYPE, subscriber: (event: CadenzaEvent<TYPE, CadenzaEventByType<TYPE>["detail"]>) => void): () => void;
267
+ /**
268
+ * Remove all subscriptions.
269
+ *
270
+ * @see {@link CadenzaClient#on}
271
+ */
272
+ destroy(): void;
267
273
  /**
268
274
  * Fetch data from a workbook view.
269
275
  *
@@ -283,6 +289,27 @@ export class CadenzaClient {
283
289
  parts?: TablePart[] | undefined;
284
290
  signal?: AbortSignal | undefined;
285
291
  } | undefined, ...args: any[]): Promise<Response>;
292
+ /**
293
+ * Fetch object info from a workbook map view.
294
+ *
295
+ * @param {EmbeddingTargetId} source - The workbook view to fetch object info from.
296
+ * @param {(WorkbookLayerPath | string)[]} layerPath - Layer path to identify the layer
297
+ * (identified using layer paths or print names)
298
+ * @param {unknown[][]} objectIds - The IDs of the objects to select
299
+ * @param {object} [options] - Options
300
+ * @param {FilterVariables} [options.filter] - Filter variables
301
+ * @param {AbortSignal} [options.signal] - A signal to abort the data fetching
302
+ * @param {Boolean} [options.useMapSrs] - Use the map SRS instead of WGS84
303
+ * @param {Boolean} [options.fullGeometries] - Return non-simplified geometries
304
+ * @return {Promise<FeatureCollection>} A `Promise` for the fetch response
305
+ * @throws For invalid arguments
306
+ */
307
+ fetchObjectInfo(source: EmbeddingTargetId, layerPath: (WorkbookLayerPath | string)[], objectIds: unknown[][], { filter, signal, useMapSrs, fullGeometries }?: {
308
+ filter?: FilterVariables | undefined;
309
+ signal?: AbortSignal | undefined;
310
+ useMapSrs?: boolean | undefined;
311
+ fullGeometries?: boolean | undefined;
312
+ } | undefined, ...args: any[]): Promise<FeatureCollection>;
286
313
  /**
287
314
  * Download data from a workbook view.
288
315
  *
@@ -523,6 +550,40 @@ export type TablePart = 'columns' | 'values' | 'totals';
523
550
  * for Long variables, the API is currently limited to the Double value range.
524
551
  */
525
552
  export type FilterVariables = Record<string, string | string[] | number | Date | null>;
553
+ /**
554
+ * - A adapted [GeoJSON](https://geojson.org/) feature object.
555
+ */
556
+ export type Feature = {
557
+ /**
558
+ * - The id of the feature
559
+ */
560
+ objectId: any[];
561
+ /**
562
+ * - The geometry
563
+ */
564
+ geometry: Geometry;
565
+ /**
566
+ * - The formated properties
567
+ */
568
+ properties: Record<string, string>;
569
+ /**
570
+ * - The area of a `Polygon` feature
571
+ */
572
+ area?: number | undefined;
573
+ /**
574
+ * - The area of a `LineString` feature
575
+ */
576
+ length?: number | undefined;
577
+ };
578
+ /**
579
+ * - A adapted [GeoJSON](https://geojson.org/) feature collection object
580
+ */
581
+ export type FeatureCollection = {
582
+ /**
583
+ * - The features within this collection
584
+ */
585
+ features: Feature[];
586
+ };
526
587
  /**
527
588
  * - An event type to subscribe to using {@link CadenzaClienton }
528
589
  */
package/cadenza.js CHANGED
@@ -120,6 +120,18 @@ globalThis.cadenza = Object.assign((/** @type Parameters<cadenza> */ ...args) =>
120
120
  * _Note:_ Since numbers in JavaScript are Double values ([more info on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number#number_encoding)),
121
121
  * for Long variables, the API is currently limited to the Double value range.
122
122
  */
123
+ /**
124
+ * @typedef Feature - A adapted [GeoJSON](https://geojson.org/) feature object.
125
+ * @property {any[]} objectId - The id of the feature
126
+ * @property {Geometry} geometry - The geometry
127
+ * @property {Record<string, string>} properties - The formated properties
128
+ * @property {number} [area] - The area of a `Polygon` feature
129
+ * @property {number} [length] - The area of a `LineString` feature
130
+ */
131
+ /**
132
+ * @typedef FeatureCollection - A adapted [GeoJSON](https://geojson.org/) feature collection object
133
+ * @property {Feature[]} features - The features within this collection
134
+ */
123
135
  let hasCadenzaSession = false;
124
136
  /** @type {Promise<void> | undefined} */
125
137
  let firstEmbeddingTargetShown;
@@ -190,12 +202,11 @@ export class CadenzaClient {
190
202
  return this.#iframeElement;
191
203
  }
192
204
  get #targetWindow() {
193
- if (this.#iframe) {
194
- return /** @type {WindowProxy} */ (this.#requiredIframe.contentWindow);
195
- }
196
- const targetWindow = window.opener ?? window.parent;
197
- assert(targetWindow !== window, 'Cannot find target window');
198
- return /** @type {WindowProxy} */ targetWindow;
205
+ const targetWindow = this.#iframe
206
+ ? this.iframe?.contentWindow
207
+ : // If a window does not have a parent, its parent property is a reference to itself.
208
+ window.opener ?? (window.parent !== window ? window.parent : null);
209
+ return /** @type {WindowProxy | null} */ targetWindow;
199
210
  }
200
211
  get #requiredIframe() {
201
212
  const iframe = /** @type {HTMLIFrameElement} */ (this.iframe);
@@ -350,7 +361,7 @@ export class CadenzaClient {
350
361
  *
351
362
  * @hidden
352
363
  * @param {WorkbookLayerPath | string} layer - The data view layer to set the selection in
353
- * @param {unknown[]} values - The IDs of the objects to select
364
+ * @param {unknown[][]} values - The IDs of the objects to select
354
365
  * @return {Promise<void>} A `Promise` for when the selection was set.
355
366
  */
356
367
  setSelection(layer, values) {
@@ -362,7 +373,7 @@ export class CadenzaClient {
362
373
  *
363
374
  * @hidden
364
375
  * @param {WorkbookLayerPath | string} layer - The data view layer to change the selection in
365
- * @param {unknown[]} values - The IDs of the objects to select
376
+ * @param {unknown[][]} values - The IDs of the objects to select
366
377
  * @return {Promise<void>} A `Promise` for when the selection was changed.
367
378
  */
368
379
  addSelection(layer, values) {
@@ -374,7 +385,7 @@ export class CadenzaClient {
374
385
  *
375
386
  * @hidden
376
387
  * @param {WorkbookLayerPath | string} layer - The data view layer to change the selection in
377
- * @param {unknown[]} values - The IDs of the objects to unselect
388
+ * @param {unknown[][]} values - The IDs of the objects to unselect
378
389
  * @return {Promise<void>} A `Promise` for when the selection was changed.
379
390
  */
380
391
  removeSelection(layer, values) {
@@ -611,6 +622,15 @@ export class CadenzaClient {
611
622
  }
612
623
  });
613
624
  };
625
+ /**
626
+ * Remove all subscriptions.
627
+ *
628
+ * @see {@link CadenzaClient#on}
629
+ */
630
+ destroy() {
631
+ this.#subscriptions = [];
632
+ window.removeEventListener('message', this.#onMessage);
633
+ }
614
634
  /**
615
635
  * Posts an event to Cadenza and returns a `Promise` for the response.
616
636
  *
@@ -646,7 +666,9 @@ export class CadenzaClient {
646
666
  #postEvent(type, detail, transfer) {
647
667
  const cadenzaEvent = { type, detail };
648
668
  this.#log('postMessage', cadenzaEvent);
649
- this.#targetWindow.postMessage(cadenzaEvent, {
669
+ const targetWindow = this.#targetWindow;
670
+ assert(targetWindow != null, 'Cannot find target window');
671
+ targetWindow.postMessage(cadenzaEvent, {
650
672
  targetOrigin: this.#origin,
651
673
  transfer,
652
674
  });
@@ -671,13 +693,52 @@ export class CadenzaClient {
671
693
  const params = createParams({ dataType, filter, parts });
672
694
  return this.#fetch(resolvePath(source), params, signal);
673
695
  }
696
+ /**
697
+ * Fetch object info from a workbook map view.
698
+ *
699
+ * @param {EmbeddingTargetId} source - The workbook view to fetch object info from.
700
+ * @param {(WorkbookLayerPath | string)[]} layerPath - Layer path to identify the layer
701
+ * (identified using layer paths or print names)
702
+ * @param {unknown[][]} objectIds - The IDs of the objects to select
703
+ * @param {object} [options] - Options
704
+ * @param {FilterVariables} [options.filter] - Filter variables
705
+ * @param {AbortSignal} [options.signal] - A signal to abort the data fetching
706
+ * @param {Boolean} [options.useMapSrs] - Use the map SRS instead of WGS84
707
+ * @param {Boolean} [options.fullGeometries] - Return non-simplified geometries
708
+ * @return {Promise<FeatureCollection>} A `Promise` for the fetch response
709
+ * @throws For invalid arguments
710
+ */
711
+ fetchObjectInfo(source, layerPath, objectIds, { filter, signal, useMapSrs, fullGeometries } = {}) {
712
+ this.#log('CadenzaClient#fetchObjectInfo', ...arguments);
713
+ const params = createParams({
714
+ filter,
715
+ });
716
+ return this.#fetch(resolvePath(source) + '/objectinfo', params, signal, JSON.stringify({
717
+ objectIds,
718
+ layerPath: array(layerPath),
719
+ useMapSrs,
720
+ fullGeometries,
721
+ })).then((response) => response.json());
722
+ }
674
723
  async #fetch(
675
724
  /** @type string */ path,
676
725
  /** @type URLSearchParams */ params,
677
- /** @type AbortSignal | undefined */ signal) {
726
+ /** @type AbortSignal | undefined */ signal,
727
+ /** @type String | undefined If body is set, the fetch will be a post.*/ body) {
678
728
  const url = this.#createUrl(path, params);
679
729
  this.#log('Fetch', url.toString());
680
- const res = await fetch(url, { signal });
730
+ const method = body ? 'POST' : undefined;
731
+ const headers = new Headers();
732
+ headers.set('X-Requested-With', 'XMLHttpRequest');
733
+ if (body) {
734
+ headers.set('Content-Type', 'application/json');
735
+ }
736
+ const res = await fetch(url, {
737
+ signal,
738
+ method,
739
+ headers,
740
+ body,
741
+ });
681
742
  if (!res.ok) {
682
743
  const errorType = {
683
744
  400: 'bad-request',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@disy/cadenza.js",
3
- "version": "2.8.0",
3
+ "version": "2.8.2",
4
4
  "license": "Apache-2.0",
5
5
  "repository": "github:DisyInformationssysteme/cadenza.js",
6
6
  "type": "module",
package/sandbox.html CHANGED
@@ -158,9 +158,9 @@
158
158
  },
159
159
  setFilter: data => cadenzaClient.setFilter(parseFilterVariables(data.filter)),
160
160
  setLayerVisibility: data => cadenzaClient.setLayerVisibility(JSON.parse(data.layer), data.visibility === 'on'),
161
- setSelection: data => cadenzaClient.setSelection(JSON.parse(data.layer), JSON.parse(data.values)),
162
- addSelection: data => cadenzaClient.addSelection(JSON.parse(data.layer), JSON.parse(data.values)),
163
- removeSelection: data => cadenzaClient.removeSelection(JSON.parse(data.layer), JSON.parse(data.values)),
161
+ setSelection: data => cadenzaClient.setSelection(JSON.parse(data.layer), JSON.parse(data.objectIds)),
162
+ addSelection: data => cadenzaClient.addSelection(JSON.parse(data.layer), JSON.parse(data.objectIds)),
163
+ removeSelection: data => cadenzaClient.removeSelection(JSON.parse(data.layer), JSON.parse(data.objectIds)),
164
164
  createGeometry: data => cadenzaClient.createGeometry(data.embeddingTargetId, data.geometryType, getOptions(data)),
165
165
  editGeometry: ({ geometry, ...data }) => cadenzaClient.editGeometry(data.embeddingTargetId, JSON.parse(geometry), getOptions(data)),
166
166
  selectObjects: data => cadenzaClient.selectObjects(data.embeddingTargetId, getOptions(data)),
@@ -168,6 +168,11 @@
168
168
  console.log('Inspect the fetchData() request in the devtools.');
169
169
  cadenzaClient.fetchData(data.embeddingTargetId, data.dataType, getOptions(data));
170
170
  },
171
+ fetchObjectInfo: data => {
172
+ console.log('Inspect the fetchObjectInfo() request in the devtools.');
173
+ cadenzaClient.fetchObjectInfo(data.embeddingTargetId, JSON.parse(data.layer), JSON.parse(data.objectIds), getOptions(data))
174
+ .then(oi => console.log(oi));
175
+ },
171
176
  downloadData: data => cadenzaClient.downloadData(data.embeddingTargetId, data.dataType, getOptions(data))
172
177
  };
173
178
 
@@ -212,7 +217,8 @@
212
217
  parts,
213
218
  layers,
214
219
  simplifiedOperationMode,
215
- useMapSrs
220
+ useMapSrs,
221
+ fullGeometries
216
222
  }) {
217
223
  return {
218
224
  disabledUiFeatures: disabledUiFeatures && disabledUiFeatures.split(','),
@@ -231,7 +237,8 @@
231
237
  parts: parts && parts.split(','),
232
238
  ...(simplifiedOperationMode === 'on' && { operationMode: 'simplified' }),
233
239
  layers: layers ? JSON.parse(layers) : undefined,
234
- useMapSrs: useMapSrs === 'on'
240
+ useMapSrs: useMapSrs === 'on',
241
+ fullGeometries: fullGeometries === 'on'
235
242
  };
236
243
  }
237
244
 
@@ -280,6 +287,7 @@
280
287
  <optgroup label="Without Iframe">
281
288
  <option value="downloadData">Download data</option>
282
289
  <option value="fetchData">Fetch data</option>
290
+ <option value="fetchObjectInfo">Fetch Object Info</option>
283
291
  </optgroup>
284
292
  </select>
285
293
  </div>
@@ -513,9 +521,9 @@
513
521
  </div>
514
522
  </template>
515
523
 
516
- <template data-action="setSelection" data-common="layer,layer-selection"></template>
517
- <template data-action="addSelection" data-common="layer,layer-selection"></template>
518
- <template data-action="removeSelection" data-common="layer,layer-selection"></template>
524
+ <template data-action="setSelection" data-common="layer,object-ids"></template>
525
+ <template data-action="addSelection" data-common="layer,object-ids"></template>
526
+ <template data-action="removeSelection" data-common="layer,object-ids"></template>
519
527
 
520
528
  <template data-action="reload">
521
529
  <div>
@@ -527,12 +535,12 @@
527
535
  </template>
528
536
  <template data-action="closeMe">No Parameters needed.</template>
529
537
 
530
- <template id="common-layer-selection">
538
+ <template id="common-object-ids">
531
539
  <div>
532
- <label for="values">List of Object IDs *</label>
533
- <textarea name="values" id="values" rows="5" required></textarea>
540
+ <label for="objectids">List of object ID value lists *</label>
541
+ <textarea name="objectIds" id="objectids" rows="5" required></textarea>
534
542
  <small>
535
- <p>A JSON value like <code>["object1","object2"]</code></p>
543
+ <p>A JSON value like <code>[["&lt;object1-id&gt;"],["&lt;object2-id&gt;"]]</code></p>
536
544
  </small>
537
545
  </div>
538
546
  </template>
@@ -568,6 +576,25 @@
568
576
  </div>
569
577
  </template>
570
578
 
579
+ <template data-action="fetchObjectInfo" data-common="layer,object-ids,filter">
580
+ <div>
581
+ <label for="embeddingTargetId">Embedding target ID *</label>
582
+ <input name="embeddingTargetId" id="embeddingTargetId" required>
583
+ </div>
584
+ <div>
585
+ <label>
586
+ <input type="checkbox" name="useMapSrs">
587
+ Use map SRS
588
+ </label>
589
+ </div>
590
+ <div>
591
+ <label>
592
+ <input type="checkbox" name="fullGeometries">
593
+ Return the non-simplified geometries
594
+ </label>
595
+ </div>
596
+ </template>
597
+
571
598
  <template data-action="getData">
572
599
  <div>
573
600
  <label for="dataType">Data type</label>