@disy/cadenza.js 2.2.3 β 2.3.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.
- package/CHANGELOG.md +15 -4
- package/README.md +1 -322
- package/apidoc/assets/highlight.css +0 -7
- package/apidoc/assets/main.js +2 -2
- package/apidoc/assets/navigation.js +1 -1
- package/apidoc/assets/search.js +1 -1
- package/apidoc/assets/style.css +46 -15
- package/apidoc/classes/AbortError.html +3 -3
- package/apidoc/classes/CadenzaClient.html +68 -89
- package/apidoc/classes/CadenzaError.html +8 -6
- package/apidoc/functions/cadenza.html +4 -4
- package/apidoc/index.html +152 -9
- package/apidoc/interfaces/CadenzaEvent.html +6 -6
- package/apidoc/interfaces/ExternalLinkKey.html +6 -3
- package/apidoc/interfaces/Geometry.html +2 -2
- package/apidoc/interfaces/PageSource.html +2 -2
- package/apidoc/modules.html +14 -2
- package/apidoc/types/CadenzaChangeSelectionEvent.html +2 -0
- package/apidoc/types/CadenzaDrillThroughEvent.html +7 -0
- package/apidoc/types/CadenzaEditGeometryCancelEvent.html +2 -0
- package/apidoc/types/CadenzaEditGeometryOkEvent.html +2 -0
- package/apidoc/types/CadenzaEditGeometryUpdateEvent.html +2 -0
- package/apidoc/types/CadenzaErrorEvent.html +2 -2
- package/apidoc/types/CadenzaEventByType.html +1 -0
- package/apidoc/types/CadenzaEventType.html +2 -0
- package/apidoc/types/CadenzaObjectInfoEvent.html +2 -0
- package/apidoc/types/CadenzaSelectObjectsCancelEvent.html +2 -0
- package/apidoc/types/CadenzaSelectObjectsOkEvent.html +2 -0
- package/apidoc/types/DataType.html +3 -2
- package/apidoc/types/EmbeddingTargetId.html +9 -2
- package/apidoc/types/Extent.html +1 -1
- package/apidoc/types/FilterVariables.html +5 -2
- package/apidoc/types/GeometryType.html +1 -1
- package/apidoc/types/GlobalId.html +2 -2
- package/apidoc/types/OpaqueString.html +6 -0
- package/apidoc/types/OperationMode.html +1 -1
- package/apidoc/types/TablePart.html +1 -1
- package/apidoc/types/UiFeature.html +3 -3
- package/apidoc/types/WorkbookLayerPath.html +3 -0
- package/cadenza.d.ts +320 -56
- package/cadenza.js +344 -69
- package/package.json +6 -6
- package/sandbox.html +197 -31
package/cadenza.d.ts
CHANGED
|
@@ -18,13 +18,42 @@ export function cadenza(baseUrl: string, options?: {
|
|
|
18
18
|
webApplication?: ExternalLinkKey | undefined;
|
|
19
19
|
debug?: boolean | undefined;
|
|
20
20
|
} | undefined): CadenzaClient;
|
|
21
|
-
/**
|
|
22
|
-
|
|
21
|
+
/**
|
|
22
|
+
* @template {string} T
|
|
23
|
+
* @typedef {string & {__type: T}} OpaqueString - A specific `string` type that is not assignable from another string
|
|
24
|
+
*
|
|
25
|
+
* The idea is to have a specific type e.g. for the {@link EmbeddingTargetId} instead of a plain `string`.
|
|
26
|
+
* You don't need to _actually_ add that `__type` property. In TS code, just use a
|
|
27
|
+
* [type assertion](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#type-assertions)
|
|
28
|
+
* (e.g. `cadenzaClient.show('{embeddingTargetId}' as EmbeddingTargetId)`).
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* @typedef {OpaqueString<'EmbeddingTargetId'>} EmbeddingTargetId - The ID of a Cadenza embedding target
|
|
32
|
+
*
|
|
33
|
+
* Embedding targets are called π©πͺ "Einbettbarer Inhalt" / πΊπΈ "Embeddable content" throughout the Cadenza UI and help.
|
|
34
|
+
* They're managed within the respective workbook:
|
|
35
|
+
*
|
|
36
|
+
* - π©πͺ "Mehr" > "Arbeitsmappe verwalten" > "Einbettung"
|
|
37
|
+
* - πΊπΈ "More" > "Manage workbook" > "Embedding"
|
|
38
|
+
*
|
|
39
|
+
* The name of an embedding target (as entered in the UI) is its ID.
|
|
40
|
+
*/
|
|
41
|
+
/** @typedef {OpaqueString<'GlobalId'>} GlobalId - The ID of a navigator item */
|
|
23
42
|
/**
|
|
24
43
|
* @typedef ExternalLinkKey - A tuple qualifying a Cadenza external link
|
|
44
|
+
*
|
|
45
|
+
* You get the `repositoryName` and `externalLinkId` from the URL of the external link's page in the Cadenza management center:
|
|
46
|
+
* ```
|
|
47
|
+
* {baseUrl}/admin/repositories/{repositoryName}/external-links/{externalLinkId}?...
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
25
50
|
* @property {string} repositoryName - The name of the link's repository
|
|
26
51
|
* @property {string} externalLinkId - The ID of the external link
|
|
27
52
|
*/
|
|
53
|
+
/**
|
|
54
|
+
* @typedef {string[]} WorkbookLayerPath - Identifies a layer within a workbook map view
|
|
55
|
+
* using the print names of the layer and - if the layer is grouped - its ancestors
|
|
56
|
+
*/
|
|
28
57
|
/**
|
|
29
58
|
* @typedef PageSource - A well-known Cadenza page
|
|
30
59
|
* @property {'welcome'} page - The name of the page (Only `"welcome"` is currently supported.)
|
|
@@ -34,8 +63,8 @@ export function cadenza(baseUrl: string, options?: {
|
|
|
34
63
|
* @typedef {'workbook-design'|'workbook-view-management'} UiFeature - The name of a Cadenza UI feature
|
|
35
64
|
*
|
|
36
65
|
* _Note:_ Supported features are:
|
|
37
|
-
* *
|
|
38
|
-
* *
|
|
66
|
+
* * `"workbook-design"` - The workbook designer
|
|
67
|
+
* * `"workbook-view-management"` - Add/Edit/Remove workbook views (Is included in 'workbook-design'.)
|
|
39
68
|
* */
|
|
40
69
|
/**
|
|
41
70
|
* @typedef Geometry - A [GeoJSON](https://geojson.org/) geometry object
|
|
@@ -47,9 +76,20 @@ export function cadenza(baseUrl: string, options?: {
|
|
|
47
76
|
* _Note:_ The GeoJSON geometry type "GeometryCollection" is currently not supported.
|
|
48
77
|
*/
|
|
49
78
|
/** @typedef {[number,number,number,number]} Extent - An array of numbers representing an extent: [minx, miny, maxx, maxy] */
|
|
50
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* @typedef {'csv' | 'excel' | 'json' | 'pdf' | 'png'} DataType - A data type
|
|
81
|
+
*
|
|
82
|
+
* See [JSON Representation of Cadenza Object Data](../index.html#md:json-representation-of-cadenza-object-data) for JSON data.
|
|
83
|
+
*/
|
|
51
84
|
/** @typedef {'columns' | 'values' | 'totals'} TablePart - A part of a table to export */
|
|
52
|
-
/**
|
|
85
|
+
/**
|
|
86
|
+
* @typedef {Record<string, string | string[] | number | Date | null>} FilterVariables - Filter variable names and values
|
|
87
|
+
*
|
|
88
|
+
* Variables of type String, Integer, Long, Double and Date can be set.
|
|
89
|
+
*
|
|
90
|
+
* _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)),
|
|
91
|
+
* for Long variables, the API is currently limited to the Double value range.
|
|
92
|
+
*/
|
|
53
93
|
/**
|
|
54
94
|
* _Notes:_
|
|
55
95
|
* * Most public methods can be aborted using an [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal).
|
|
@@ -92,12 +132,9 @@ export class CadenzaClient {
|
|
|
92
132
|
* @param {String} [options.labelSet] - The name of a label set defined in the `basicweb-config.xml` (only supported for the welcome page)
|
|
93
133
|
* @param {OperationMode} [options.operationMode] - The mode in which a workbook should be operated
|
|
94
134
|
* @param {AbortSignal} [options.signal] - A signal to abort the iframe loading
|
|
95
|
-
* @return {Promise<void>} A Promise for when the iframe is loaded
|
|
135
|
+
* @return {Promise<void>} A `Promise` for when the iframe is loaded
|
|
96
136
|
* @throws For invalid arguments
|
|
97
|
-
* @fires
|
|
98
|
-
* The event includes a row of values for each row in the workbook selection, each row consisting of the values of
|
|
99
|
-
* the attributes that were selected for the POST message content. If the drill-through was executed from a map
|
|
100
|
-
* view, each row includes the geometry of the select object as the last value.
|
|
137
|
+
* @fires {@link CadenzaDrillThroughEvent}
|
|
101
138
|
*/
|
|
102
139
|
show(source: PageSource | EmbeddingTargetId, { dataType, disabledUiFeatures, expandNavigator, filter, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, labelSet, operationMode, signal, }?: {
|
|
103
140
|
dataType?: DataType | undefined;
|
|
@@ -106,11 +143,11 @@ export class CadenzaClient {
|
|
|
106
143
|
filter?: FilterVariables | undefined;
|
|
107
144
|
hideMainHeaderAndFooter?: boolean | undefined;
|
|
108
145
|
hideWorkbookToolBar?: boolean | undefined;
|
|
109
|
-
highlightGlobalId?:
|
|
146
|
+
highlightGlobalId?: GlobalId | undefined;
|
|
110
147
|
labelSet?: string | undefined;
|
|
111
148
|
operationMode?: OperationMode | undefined;
|
|
112
149
|
signal?: AbortSignal | undefined;
|
|
113
|
-
} | undefined): Promise<void>;
|
|
150
|
+
} | undefined, ...args: any[]): Promise<void>;
|
|
114
151
|
/**
|
|
115
152
|
* Show a workbook map view in an iframe.
|
|
116
153
|
*
|
|
@@ -128,11 +165,9 @@ export class CadenzaClient {
|
|
|
128
165
|
* @param {OperationMode} [options.operationMode] - The mode in which a workbook should be operated
|
|
129
166
|
* @param {boolean} [options.useMapSrs] - Whether the geometry and the extent are in the map's SRS (otherwise EPSG:4326 is assumed)
|
|
130
167
|
* @param {AbortSignal} [options.signal] - A signal to abort the iframe loading
|
|
131
|
-
* @return {Promise<void>} A Promise for when the iframe is loaded
|
|
168
|
+
* @return {Promise<void>} A `Promise` for when the iframe is loaded
|
|
132
169
|
* @throws For invalid arguments
|
|
133
|
-
* @fires
|
|
134
|
-
* The event includes a row of values for each row in the workbook selection, each row consisting of the values of
|
|
135
|
-
* the attributes that were selected for the POST message content plus the geometry of the select object as the last value.
|
|
170
|
+
* @fires {@link CadenzaDrillThroughEvent}
|
|
136
171
|
*/
|
|
137
172
|
showMap(mapView: EmbeddingTargetId, { disabledUiFeatures, expandNavigator, filter, geometry, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, locationFinder, mapExtent, operationMode, useMapSrs, signal, }?: {
|
|
138
173
|
disabledUiFeatures?: UiFeature[] | undefined;
|
|
@@ -141,19 +176,78 @@ export class CadenzaClient {
|
|
|
141
176
|
geometry?: Geometry | undefined;
|
|
142
177
|
hideMainHeaderAndFooter?: boolean | undefined;
|
|
143
178
|
hideWorkbookToolBar?: boolean | undefined;
|
|
144
|
-
highlightGlobalId?:
|
|
179
|
+
highlightGlobalId?: GlobalId | undefined;
|
|
145
180
|
locationFinder?: string | undefined;
|
|
146
181
|
mapExtent?: Extent | undefined;
|
|
147
182
|
operationMode?: OperationMode | undefined;
|
|
148
183
|
useMapSrs?: boolean | undefined;
|
|
149
184
|
signal?: AbortSignal | undefined;
|
|
150
|
-
} | undefined): Promise<void>;
|
|
185
|
+
} | undefined, ...args: any[]): Promise<void>;
|
|
151
186
|
/**
|
|
152
187
|
* Expand/collapse the navigator.
|
|
153
188
|
*
|
|
154
189
|
* @param {boolean} expanded - The expansion state of the navigator
|
|
155
190
|
*/
|
|
156
|
-
expandNavigator(expanded?: boolean): void;
|
|
191
|
+
expandNavigator(expanded?: boolean, ...args: any[]): void;
|
|
192
|
+
/**
|
|
193
|
+
* Get data from the currently shown workbook view.
|
|
194
|
+
*
|
|
195
|
+
* Currently, only map views are supported.
|
|
196
|
+
*
|
|
197
|
+
* @hidden
|
|
198
|
+
* @template {DataType} T
|
|
199
|
+
* @param {T} dataType - The requested data type. Currently, only `"png"` is supported.
|
|
200
|
+
* @return {Promise<T extends 'png' ? Blob : never>}
|
|
201
|
+
*/
|
|
202
|
+
getData<T extends DataType>(dataType: T, ...args: any[]): Promise<T extends "png" ? Blob : never>;
|
|
203
|
+
/**
|
|
204
|
+
* Set filter variables in the currently shown workbook.
|
|
205
|
+
*
|
|
206
|
+
* @hidden
|
|
207
|
+
* @param {FilterVariables} filter - The variable values
|
|
208
|
+
* @return {Promise<void>} A `Promise` for when the filter variables were set.
|
|
209
|
+
*/
|
|
210
|
+
setFilter(filter: FilterVariables, ...args: any[]): Promise<void>;
|
|
211
|
+
/**
|
|
212
|
+
* Set the visibility of a layer in the currently shown workbook map view.
|
|
213
|
+
*
|
|
214
|
+
* When making a layer visible, its ancestors will be made visible, too.
|
|
215
|
+
* When hiding a layer, the ancestors are not affected.
|
|
216
|
+
*
|
|
217
|
+
* @hidden
|
|
218
|
+
* @param {WorkbookLayerPath | string} layer - The layer to show or hide
|
|
219
|
+
* (identified using a layer path or a print name)
|
|
220
|
+
* @param {boolean} visible - The visibility state of the layer
|
|
221
|
+
* @return {Promise<void>} A `Promise` for when the layer visibility was set.
|
|
222
|
+
*/
|
|
223
|
+
setLayerVisibility(layer: WorkbookLayerPath | string, visible: boolean, ...args: any[]): Promise<void>;
|
|
224
|
+
/**
|
|
225
|
+
* Set the selection in the currently shown workbook map view.
|
|
226
|
+
*
|
|
227
|
+
* @hidden
|
|
228
|
+
* @param {WorkbookLayerPath | string} layer - The data view layer to set the selection in
|
|
229
|
+
* @param {unknown[]} values - The IDs of the objects to select
|
|
230
|
+
* @return {Promise<void>} A `Promise` for when the selection was set.
|
|
231
|
+
*/
|
|
232
|
+
setSelection(layer: WorkbookLayerPath | string, values: unknown[], ...args: any[]): Promise<void>;
|
|
233
|
+
/**
|
|
234
|
+
* Add to the selection in the currently shown workbook map view.
|
|
235
|
+
*
|
|
236
|
+
* @hidden
|
|
237
|
+
* @param {WorkbookLayerPath | string} layer - The data view layer to change the selection in
|
|
238
|
+
* @param {unknown[]} values - The IDs of the objects to select
|
|
239
|
+
* @return {Promise<void>} A `Promise` for when the selection was changed.
|
|
240
|
+
*/
|
|
241
|
+
addSelection(layer: WorkbookLayerPath | string, values: unknown[], ...args: any[]): Promise<void>;
|
|
242
|
+
/**
|
|
243
|
+
* Remove from the selection in the currently shown workbook map view.
|
|
244
|
+
*
|
|
245
|
+
* @hidden
|
|
246
|
+
* @param {WorkbookLayerPath | string} layer - The data view layer to change the selection in
|
|
247
|
+
* @param {unknown[]} values - The IDs of the objects to unselect
|
|
248
|
+
* @return {Promise<void>} A `Promise` for when the selection was changed.
|
|
249
|
+
*/
|
|
250
|
+
removeSelection(layer: WorkbookLayerPath | string, values: unknown[], ...args: any[]): Promise<void>;
|
|
157
251
|
/**
|
|
158
252
|
* Create a geometry.
|
|
159
253
|
*
|
|
@@ -168,11 +262,12 @@ export class CadenzaClient {
|
|
|
168
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.
|
|
169
263
|
* @param {boolean} [options.useMapSrs] - Whether the created geometry should use the map's SRS (otherwise EPSG:4326 will be used)
|
|
170
264
|
* @param {AbortSignal} [options.signal] - A signal to abort the iframe loading
|
|
171
|
-
* @return {Promise<void>} A Promise for when the iframe is loaded
|
|
265
|
+
* @return {Promise<void>} A `Promise` for when the iframe is loaded
|
|
172
266
|
* @throws For invalid arguments
|
|
173
|
-
* @fires
|
|
174
|
-
*
|
|
175
|
-
*
|
|
267
|
+
* @fires
|
|
268
|
+
* - {@link CadenzaEditGeometryUpdateEvent}
|
|
269
|
+
* - {@link CadenzaEditGeometryOkEvent}
|
|
270
|
+
* - {@link CadenzaEditGeometryCancelEvent}
|
|
176
271
|
*/
|
|
177
272
|
createGeometry(backgroundMapView: EmbeddingTargetId, geometryType: GeometryType, { locationFinder, mapExtent, minScale, useMapSrs, signal }?: {
|
|
178
273
|
locationFinder?: string | undefined;
|
|
@@ -180,7 +275,7 @@ export class CadenzaClient {
|
|
|
180
275
|
minScale?: number | undefined;
|
|
181
276
|
useMapSrs?: boolean | undefined;
|
|
182
277
|
signal?: AbortSignal | undefined;
|
|
183
|
-
} | undefined): Promise<void>;
|
|
278
|
+
} | undefined, ...args: any[]): Promise<void>;
|
|
184
279
|
/**
|
|
185
280
|
* Edit a geometry.
|
|
186
281
|
*
|
|
@@ -192,11 +287,12 @@ export class CadenzaClient {
|
|
|
192
287
|
* @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.
|
|
193
288
|
* @param {boolean} [options.useMapSrs] - Whether the geometry is in the map's SRS (otherwise EPSG:4326 is assumed)
|
|
194
289
|
* @param {AbortSignal} [options.signal] - A signal to abort the iframe loading
|
|
195
|
-
* @return {Promise<void>} A Promise for when the iframe is loaded
|
|
290
|
+
* @return {Promise<void>} A `Promise` for when the iframe is loaded
|
|
196
291
|
* @throws For invalid arguments
|
|
197
|
-
* @fires
|
|
198
|
-
*
|
|
199
|
-
*
|
|
292
|
+
* @fires
|
|
293
|
+
* - {@link CadenzaEditGeometryUpdateEvent}
|
|
294
|
+
* - {@link CadenzaEditGeometryOkEvent}
|
|
295
|
+
* - {@link CadenzaEditGeometryCancelEvent}
|
|
200
296
|
*/
|
|
201
297
|
editGeometry(backgroundMapView: EmbeddingTargetId, geometry: Geometry, { locationFinder, mapExtent, minScale, useMapSrs, signal }?: {
|
|
202
298
|
locationFinder?: string | undefined;
|
|
@@ -204,38 +300,68 @@ export class CadenzaClient {
|
|
|
204
300
|
minScale?: number | undefined;
|
|
205
301
|
useMapSrs?: boolean | undefined;
|
|
206
302
|
signal?: AbortSignal | undefined;
|
|
207
|
-
} | undefined): Promise<void>;
|
|
303
|
+
} | undefined, ...args: any[]): Promise<void>;
|
|
304
|
+
/**
|
|
305
|
+
* Select objects in a workbook map.
|
|
306
|
+
*
|
|
307
|
+
* @param {EmbeddingTargetId} backgroundMapView - The workbook map view
|
|
308
|
+
* @param {object} [options] - Options
|
|
309
|
+
* @param {(WorkbookLayerPath | string)[]} [options.layers] - Layers to restrict the selection to
|
|
310
|
+
* (identified using layer paths or print names)
|
|
311
|
+
* @param {string} [options.locationFinder] - A search query for the location finder
|
|
312
|
+
* @param {Extent} [options.mapExtent] - A map extent to set
|
|
313
|
+
* @param {boolean} [options.useMapSrs] - Whether the geometry is in the map's SRS (otherwise EPSG:4326 is assumed)
|
|
314
|
+
* @param {AbortSignal} [options.signal] - A signal to abort the iframe loading
|
|
315
|
+
* @return {Promise<void>} A `Promise` for when the iframe is loaded
|
|
316
|
+
* @throws For invalid arguments
|
|
317
|
+
* @fires
|
|
318
|
+
* - {@link CadenzaChangeSelectionEvent}
|
|
319
|
+
* - {@link CadenzaObjectInfoEvent}
|
|
320
|
+
* - {@link CadenzaSelectObjectsOkEvent}
|
|
321
|
+
* - {@link CadenzaSelectObjectsCancelEvent}
|
|
322
|
+
*/
|
|
323
|
+
selectObjects(backgroundMapView: EmbeddingTargetId, { layers, locationFinder, mapExtent, useMapSrs, signal }?: {
|
|
324
|
+
layers?: (string | WorkbookLayerPath)[] | undefined;
|
|
325
|
+
locationFinder?: string | undefined;
|
|
326
|
+
mapExtent?: Extent | undefined;
|
|
327
|
+
useMapSrs?: boolean | undefined;
|
|
328
|
+
signal?: AbortSignal | undefined;
|
|
329
|
+
} | undefined, ...args: any[]): Promise<void>;
|
|
208
330
|
/**
|
|
209
331
|
* Subscribe to a `postMessage()` event.
|
|
210
332
|
*
|
|
211
|
-
* @template
|
|
212
|
-
* @param {
|
|
213
|
-
* @param {(event: CadenzaEvent<
|
|
333
|
+
* @template {CadenzaEventType} TYPE
|
|
334
|
+
* @param {TYPE} type - The event type
|
|
335
|
+
* @param {(event: CadenzaEvent<TYPE, CadenzaEventByType<TYPE>['detail']>) => void} subscriber - The subscriber function
|
|
214
336
|
* @return {() => void} An unsubscribe function
|
|
215
337
|
*/
|
|
216
|
-
on<
|
|
338
|
+
on<TYPE extends CadenzaEventType>(type: TYPE, subscriber: (event: CadenzaEvent<TYPE, CadenzaEventByType<TYPE>["detail"]>) => void): () => void;
|
|
217
339
|
/**
|
|
218
340
|
* Fetch data from a workbook view.
|
|
219
341
|
*
|
|
220
|
-
* @param {EmbeddingTargetId} source - The workbook view to fetch data from
|
|
221
|
-
*
|
|
342
|
+
* @param {EmbeddingTargetId} source - The workbook view to fetch data from.
|
|
343
|
+
* Currently only table and indicator views are supported.
|
|
344
|
+
* @param {DataType} dataType - The data type you want to get back from the server.
|
|
345
|
+
* Currently, `"csv"`, `"excel"` and `"json"` are supported.
|
|
222
346
|
* @param {object} options - Options
|
|
223
347
|
* @param {TablePart[]} [options.parts] - Table parts to export; If not specified, all parts are exported.
|
|
224
348
|
* @param {AbortSignal} [options.signal] - A signal to abort the data fetching
|
|
225
|
-
* @return {Promise<Response>} A Promise for the fetch response
|
|
349
|
+
* @return {Promise<Response>} A `Promise` for the fetch response
|
|
226
350
|
* @throws For invalid arguments
|
|
227
351
|
*/
|
|
228
352
|
fetchData(source: EmbeddingTargetId, dataType: DataType, { parts, signal }?: {
|
|
229
353
|
parts?: TablePart[] | undefined;
|
|
230
354
|
signal?: AbortSignal | undefined;
|
|
231
|
-
}): Promise<Response>;
|
|
355
|
+
}, ...args: any[]): Promise<Response>;
|
|
232
356
|
/**
|
|
233
357
|
* Download data from a workbook view.
|
|
234
358
|
*
|
|
235
359
|
* _Note:_ The file name, if not provided, is generated from the name of the workbook view and the current date.
|
|
236
360
|
*
|
|
237
|
-
* @param {EmbeddingTargetId} source - The workbook view to download data from
|
|
238
|
-
*
|
|
361
|
+
* @param {EmbeddingTargetId} source - The workbook view to download data from.
|
|
362
|
+
* Currently only table and indicator views are supported.
|
|
363
|
+
* @param {DataType} dataType - The data type you want to get back from the server.
|
|
364
|
+
* Currently, `"csv"`, `"excel"` and `"json"` are supported.
|
|
239
365
|
* @param {object} options - Options
|
|
240
366
|
* @param {string} [options.fileName] - The file name to use; The file extension is appended by Cadenza.
|
|
241
367
|
* @param {TablePart[]} [options.parts] - Table parts to export; If not specified, all parts are exported.
|
|
@@ -244,16 +370,57 @@ export class CadenzaClient {
|
|
|
244
370
|
downloadData(source: EmbeddingTargetId, dataType: DataType, { fileName, parts }: {
|
|
245
371
|
fileName?: string | undefined;
|
|
246
372
|
parts?: TablePart[] | undefined;
|
|
247
|
-
}): void;
|
|
373
|
+
}, ...args: any[]): void;
|
|
248
374
|
#private;
|
|
249
375
|
}
|
|
250
376
|
/**
|
|
251
|
-
* @
|
|
377
|
+
* @typedef {'change:selection'
|
|
378
|
+
* | 'drillThrough'
|
|
379
|
+
* | 'editGeometry:ok'
|
|
380
|
+
* | 'editGeometry:update'
|
|
381
|
+
* | 'editGeometry:cancel'
|
|
382
|
+
* | 'objectInfo'
|
|
383
|
+
* | 'selectObjects:ok'
|
|
384
|
+
* | 'selectObjects:cancel'
|
|
385
|
+
* } CadenzaEventType - An event type to subscribe to using {@link CadenzaClient#on}
|
|
386
|
+
*/
|
|
387
|
+
/**
|
|
388
|
+
* @template {CadenzaEventType} T
|
|
389
|
+
* @typedef {T extends 'change:selection' ? CadenzaChangeSelectionEvent
|
|
390
|
+
* : T extends 'drillThrough' ? CadenzaDrillThroughEvent
|
|
391
|
+
* : T extends 'editGeometry:update' ? CadenzaEditGeometryUpdateEvent
|
|
392
|
+
* : T extends 'editGeometry:ok' ? CadenzaEditGeometryOkEvent
|
|
393
|
+
* : T extends 'editGeometry:cancel' ? CadenzaEditGeometryCancelEvent
|
|
394
|
+
* : T extends 'objectInfo' ? CadenzaObjectInfoEvent
|
|
395
|
+
* : T extends 'selectObjects:ok' ? CadenzaSelectObjectsOkEvent
|
|
396
|
+
* : T extends 'selectObjects:cancel' ? CadenzaSelectObjectsCancelEvent
|
|
397
|
+
* : never
|
|
398
|
+
* } CadenzaEventByType
|
|
399
|
+
*/
|
|
400
|
+
/**
|
|
401
|
+
* @template {CadenzaEventType | string} TYPE
|
|
402
|
+
* @template [DETAIL=unknown]
|
|
252
403
|
* @typedef CadenzaEvent - A Cadenza `postMessage()` event
|
|
253
|
-
* @property {
|
|
254
|
-
* @property {
|
|
404
|
+
* @property {TYPE} type - The event type
|
|
405
|
+
* @property {DETAIL} detail - Optional event details (depending on the event type)
|
|
406
|
+
*/
|
|
407
|
+
/** @typedef {CadenzaEvent<'change:selection', undefined | {layer: WorkbookLayerPath, values: unknown[][]}>} CadenzaChangeSelectionEvent - When the user changed the selection. */
|
|
408
|
+
/**
|
|
409
|
+
* @typedef {CadenzaEvent<'drillThrough', {values: unknown[][]}>} CadenzaDrillThroughEvent - When the user executed a POST message drill-through.
|
|
410
|
+
* <p>
|
|
411
|
+
* The event includes a data row for every item in the workbook selection, each row consisting of the values of
|
|
412
|
+
* the attributes that were selected for the POST message content. If the drill-through was executed from a map
|
|
413
|
+
* view, each row includes the geometry of the selected object as the last value.
|
|
414
|
+
* <p>
|
|
415
|
+
* See also: <a href="../index.html#md:json-representation-of-cadenza-object-data">JSON Representation of Cadenza Object Data</a>
|
|
255
416
|
*/
|
|
256
|
-
/** @typedef {CadenzaEvent<
|
|
417
|
+
/** @typedef {CadenzaEvent<'editGeometry:update', {geometry: Geometry}>} CadenzaEditGeometryUpdateEvent - When the user changed the geometry. */
|
|
418
|
+
/** @typedef {CadenzaEvent<'editGeometry:ok', {geometry: Geometry}>} CadenzaEditGeometryOkEvent - When the user submitted the geometry. */
|
|
419
|
+
/** @typedef {CadenzaEvent<'editGeometry:cancel'>} CadenzaEditGeometryCancelEvent - When the user cancelled the geometry editing. */
|
|
420
|
+
/** @typedef {CadenzaEvent<'error', {type: string, message?: string}>} CadenzaErrorEvent - An error event that is mapped to a {@link CadenzaError} */
|
|
421
|
+
/** @typedef {CadenzaEvent<'objectInfo', {layer: WorkbookLayerPath, objectInfos: {selectionIndex: number, formattedValues: Record<string, string>}[]}>} CadenzaObjectInfoEvent - When the user opened the object info flyout. */
|
|
422
|
+
/** @typedef {CadenzaEvent<'selectObjects:ok', {layer: WorkbookLayerPath, values: unknown[][]}>} CadenzaSelectObjectsOkEvent - When the user submitted the selection. */
|
|
423
|
+
/** @typedef {CadenzaEvent<'selectObjects:cancel'>} CadenzaSelectObjectsCancelEvent - When the user cancelled the selection. */
|
|
257
424
|
export class AbortError extends DOMException {
|
|
258
425
|
constructor();
|
|
259
426
|
}
|
|
@@ -272,15 +439,39 @@ export class CadenzaError extends Error {
|
|
|
272
439
|
#private;
|
|
273
440
|
}
|
|
274
441
|
/**
|
|
275
|
-
* -
|
|
442
|
+
* - A specific `string` type that is not assignable from another string
|
|
443
|
+
*
|
|
444
|
+
* The idea is to have a specific type e.g. for the {@link EmbeddingTargetId } instead of a plain `string`.
|
|
445
|
+
* You don't need to _actually_ add that `__type` property. In TS code, just use a
|
|
446
|
+
* [type assertion](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#type-assertions)
|
|
447
|
+
* (e.g. `cadenzaClient.show('{embeddingTargetId}' as EmbeddingTargetId)`).
|
|
448
|
+
*/
|
|
449
|
+
export type OpaqueString<T extends string> = string & {
|
|
450
|
+
__type: T;
|
|
451
|
+
};
|
|
452
|
+
/**
|
|
453
|
+
* - The ID of a Cadenza embedding target
|
|
454
|
+
*
|
|
455
|
+
* Embedding targets are called π©πͺ "Einbettbarer Inhalt" / πΊπΈ "Embeddable content" throughout the Cadenza UI and help.
|
|
456
|
+
* They're managed within the respective workbook:
|
|
457
|
+
*
|
|
458
|
+
* - π©πͺ "Mehr" > "Arbeitsmappe verwalten" > "Einbettung"
|
|
459
|
+
* - πΊπΈ "More" > "Manage workbook" > "Embedding"
|
|
460
|
+
*
|
|
461
|
+
* The name of an embedding target (as entered in the UI) is its ID.
|
|
276
462
|
*/
|
|
277
|
-
export type EmbeddingTargetId =
|
|
463
|
+
export type EmbeddingTargetId = OpaqueString<'EmbeddingTargetId'>;
|
|
278
464
|
/**
|
|
279
465
|
* - The ID of a navigator item
|
|
280
466
|
*/
|
|
281
|
-
export type GlobalId =
|
|
467
|
+
export type GlobalId = OpaqueString<'GlobalId'>;
|
|
282
468
|
/**
|
|
283
469
|
* - A tuple qualifying a Cadenza external link
|
|
470
|
+
*
|
|
471
|
+
* You get the `repositoryName` and `externalLinkId` from the URL of the external link's page in the Cadenza management center:
|
|
472
|
+
* ```
|
|
473
|
+
* {baseUrl}/admin/repositories/{repositoryName}/external-links/{externalLinkId}?...
|
|
474
|
+
* ```
|
|
284
475
|
*/
|
|
285
476
|
export type ExternalLinkKey = {
|
|
286
477
|
/**
|
|
@@ -292,6 +483,11 @@ export type ExternalLinkKey = {
|
|
|
292
483
|
*/
|
|
293
484
|
externalLinkId: string;
|
|
294
485
|
};
|
|
486
|
+
/**
|
|
487
|
+
* - Identifies a layer within a workbook map view
|
|
488
|
+
* using the print names of the layer and - if the layer is grouped - its ancestors
|
|
489
|
+
*/
|
|
490
|
+
export type WorkbookLayerPath = string[];
|
|
295
491
|
/**
|
|
296
492
|
* - A well-known Cadenza page
|
|
297
493
|
*/
|
|
@@ -309,8 +505,8 @@ export type OperationMode = 'normal' | 'simplified';
|
|
|
309
505
|
* - The name of a Cadenza UI feature
|
|
310
506
|
*
|
|
311
507
|
* _Note:_ Supported features are:
|
|
312
|
-
* *
|
|
313
|
-
* *
|
|
508
|
+
* * `"workbook-design"` - The workbook designer
|
|
509
|
+
* * `"workbook-view-management"` - Add/Edit/Remove workbook views (Is included in 'workbook-design'.)
|
|
314
510
|
*/
|
|
315
511
|
export type UiFeature = 'workbook-design' | 'workbook-view-management';
|
|
316
512
|
/**
|
|
@@ -334,33 +530,101 @@ export type GeometryType = 'Point' | 'MultiPoint' | 'LineString' | 'MultiLineStr
|
|
|
334
530
|
export type Extent = [number, number, number, number];
|
|
335
531
|
/**
|
|
336
532
|
* - A data type
|
|
533
|
+
*
|
|
534
|
+
* See [JSON Representation of Cadenza Object Data](../index.html#md:json-representation-of-cadenza-object-data) for JSON data.
|
|
337
535
|
*/
|
|
338
|
-
export type DataType = 'csv' | 'excel' | 'json' | 'pdf';
|
|
536
|
+
export type DataType = 'csv' | 'excel' | 'json' | 'pdf' | 'png';
|
|
339
537
|
/**
|
|
340
538
|
* - A part of a table to export
|
|
341
539
|
*/
|
|
342
540
|
export type TablePart = 'columns' | 'values' | 'totals';
|
|
343
541
|
/**
|
|
344
542
|
* - Filter variable names and values
|
|
543
|
+
*
|
|
544
|
+
* Variables of type String, Integer, Long, Double and Date can be set.
|
|
545
|
+
*
|
|
546
|
+
* _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)),
|
|
547
|
+
* for Long variables, the API is currently limited to the Double value range.
|
|
345
548
|
*/
|
|
346
|
-
export type FilterVariables = Record<string, string | number | Date>;
|
|
549
|
+
export type FilterVariables = Record<string, string | string[] | number | Date | null>;
|
|
550
|
+
/**
|
|
551
|
+
* - An event type to subscribe to using {@link CadenzaClienton }
|
|
552
|
+
*/
|
|
553
|
+
export type CadenzaEventType = 'change:selection' | 'drillThrough' | 'editGeometry:ok' | 'editGeometry:update' | 'editGeometry:cancel' | 'objectInfo' | 'selectObjects:ok' | 'selectObjects:cancel';
|
|
554
|
+
export type CadenzaEventByType<T extends CadenzaEventType> = T extends 'change:selection' ? CadenzaChangeSelectionEvent : T extends 'drillThrough' ? CadenzaDrillThroughEvent : T extends 'editGeometry:update' ? CadenzaEditGeometryUpdateEvent : T extends 'editGeometry:ok' ? CadenzaEditGeometryOkEvent : T extends 'editGeometry:cancel' ? CadenzaEditGeometryCancelEvent : T extends 'objectInfo' ? CadenzaObjectInfoEvent : T extends 'selectObjects:ok' ? CadenzaSelectObjectsOkEvent : T extends 'selectObjects:cancel' ? CadenzaSelectObjectsCancelEvent : never;
|
|
347
555
|
/**
|
|
348
556
|
* - A Cadenza `postMessage()` event
|
|
349
557
|
*/
|
|
350
|
-
export type CadenzaEvent<
|
|
558
|
+
export type CadenzaEvent<TYPE extends string, DETAIL = unknown> = {
|
|
351
559
|
/**
|
|
352
560
|
* - The event type
|
|
353
561
|
*/
|
|
354
|
-
type:
|
|
562
|
+
type: TYPE;
|
|
355
563
|
/**
|
|
356
564
|
* - Optional event details (depending on the event type)
|
|
357
565
|
*/
|
|
358
|
-
detail:
|
|
566
|
+
detail: DETAIL;
|
|
359
567
|
};
|
|
568
|
+
/**
|
|
569
|
+
* - When the user changed the selection.
|
|
570
|
+
*/
|
|
571
|
+
export type CadenzaChangeSelectionEvent = CadenzaEvent<'change:selection', undefined | {
|
|
572
|
+
layer: string[];
|
|
573
|
+
values: unknown[][];
|
|
574
|
+
}>;
|
|
575
|
+
/**
|
|
576
|
+
* - When the user executed a POST message drill-through.
|
|
577
|
+
* <p>
|
|
578
|
+
* The event includes a data row for every item in the workbook selection, each row consisting of the values of
|
|
579
|
+
* the attributes that were selected for the POST message content. If the drill-through was executed from a map
|
|
580
|
+
* view, each row includes the geometry of the selected object as the last value.
|
|
581
|
+
* <p>
|
|
582
|
+
* See also: <a href="../index.html#md:json-representation-of-cadenza-object-data">JSON Representation of Cadenza Object Data</a>
|
|
583
|
+
*/
|
|
584
|
+
export type CadenzaDrillThroughEvent = CadenzaEvent<'drillThrough', {
|
|
585
|
+
values: unknown[][];
|
|
586
|
+
}>;
|
|
587
|
+
/**
|
|
588
|
+
* - When the user changed the geometry.
|
|
589
|
+
*/
|
|
590
|
+
export type CadenzaEditGeometryUpdateEvent = CadenzaEvent<'editGeometry:update', {
|
|
591
|
+
geometry: Geometry;
|
|
592
|
+
}>;
|
|
593
|
+
/**
|
|
594
|
+
* - When the user submitted the geometry.
|
|
595
|
+
*/
|
|
596
|
+
export type CadenzaEditGeometryOkEvent = CadenzaEvent<'editGeometry:ok', {
|
|
597
|
+
geometry: Geometry;
|
|
598
|
+
}>;
|
|
599
|
+
/**
|
|
600
|
+
* - When the user cancelled the geometry editing.
|
|
601
|
+
*/
|
|
602
|
+
export type CadenzaEditGeometryCancelEvent = CadenzaEvent<'editGeometry:cancel'>;
|
|
360
603
|
/**
|
|
361
604
|
* - An error event that is mapped to a {@link CadenzaError }
|
|
362
605
|
*/
|
|
363
|
-
export type CadenzaErrorEvent = CadenzaEvent<{
|
|
606
|
+
export type CadenzaErrorEvent = CadenzaEvent<'error', {
|
|
364
607
|
type: string;
|
|
365
608
|
message?: string;
|
|
366
609
|
}>;
|
|
610
|
+
/**
|
|
611
|
+
* - When the user opened the object info flyout.
|
|
612
|
+
*/
|
|
613
|
+
export type CadenzaObjectInfoEvent = CadenzaEvent<'objectInfo', {
|
|
614
|
+
layer: string[];
|
|
615
|
+
objectInfos: {
|
|
616
|
+
selectionIndex: number;
|
|
617
|
+
formattedValues: Record<string, string>;
|
|
618
|
+
}[];
|
|
619
|
+
}>;
|
|
620
|
+
/**
|
|
621
|
+
* - When the user submitted the selection.
|
|
622
|
+
*/
|
|
623
|
+
export type CadenzaSelectObjectsOkEvent = CadenzaEvent<'selectObjects:ok', {
|
|
624
|
+
layer: string[];
|
|
625
|
+
values: unknown[][];
|
|
626
|
+
}>;
|
|
627
|
+
/**
|
|
628
|
+
* - When the user cancelled the selection.
|
|
629
|
+
*/
|
|
630
|
+
export type CadenzaSelectObjectsCancelEvent = CadenzaEvent<'selectObjects:cancel'>;
|