@disy/cadenza.js 10.5.1 → 10.5.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.
- package/CHANGELOG.md +6 -0
- package/apidoc/assets/navigation.js +1 -1
- package/apidoc/assets/search.js +1 -1
- package/apidoc/classes/AbortError.html +3 -3
- package/apidoc/classes/CadenzaClient.html +31 -24
- package/apidoc/classes/CadenzaError.html +5 -5
- package/apidoc/functions/cadenza.html +4 -4
- package/apidoc/index.html +18 -7
- package/apidoc/interfaces/AreaIntersectionsResult.html +4 -4
- package/apidoc/interfaces/CadenzaClientOptions.html +6 -6
- package/apidoc/interfaces/CadenzaEvent.html +4 -4
- package/apidoc/interfaces/CommonEditGeometryOptions.html +12 -12
- package/apidoc/interfaces/Distance.html +2 -2
- package/apidoc/interfaces/ExternalLinkKey.html +4 -4
- package/apidoc/interfaces/Feature.html +9 -9
- package/apidoc/interfaces/FeatureCollection.html +4 -4
- package/apidoc/interfaces/Geometry.html +4 -4
- package/apidoc/interfaces/GeometryExtentStrategy.html +4 -4
- package/apidoc/interfaces/LayerDataExtentStrategy.html +4 -4
- package/apidoc/interfaces/LayerDefinition.html +4 -4
- package/apidoc/interfaces/LocationFinderExtentStrategy.html +4 -4
- package/apidoc/interfaces/PageSource.html +3 -3
- package/apidoc/interfaces/ProblemDetails.html +6 -6
- package/apidoc/interfaces/SnappingOptions.html +3 -3
- package/apidoc/interfaces/SpatialFilterValue.html +4 -4
- package/apidoc/interfaces/StaticExtentStrategy.html +4 -4
- package/apidoc/modules.html +1 -1
- package/apidoc/types/CadenzaActionEvent.html +2 -2
- package/apidoc/types/CadenzaChangeSelectionEvent.html +2 -2
- package/apidoc/types/CadenzaDrillThroughEvent.html +2 -2
- package/apidoc/types/CadenzaEditGeometryCancelEvent.html +2 -2
- package/apidoc/types/CadenzaEditGeometryCreateEvent.html +2 -0
- package/apidoc/types/CadenzaEditGeometryDeleteEvent.html +2 -0
- package/apidoc/types/CadenzaEditGeometryEditEvent.html +2 -0
- package/apidoc/types/CadenzaEditGeometryOkEvent.html +2 -2
- package/apidoc/types/CadenzaEditGeometryUpdateEvent.html +2 -2
- package/apidoc/types/CadenzaErrorEvent.html +2 -2
- package/apidoc/types/CadenzaEventByType.html +1 -1
- package/apidoc/types/CadenzaEventType.html +2 -2
- package/apidoc/types/CadenzaReloadEvent.html +2 -2
- package/apidoc/types/CadenzaSelectObjectsCancelEvent.html +2 -2
- package/apidoc/types/CadenzaSelectObjectsOkEvent.html +2 -2
- package/apidoc/types/Coordinate.html +2 -2
- package/apidoc/types/CustomValidityType.html +2 -2
- package/apidoc/types/DataType.html +2 -2
- package/apidoc/types/EmbeddingTargetId.html +2 -2
- package/apidoc/types/Extent.html +2 -2
- package/apidoc/types/ExtentStrategy.html +2 -2
- package/apidoc/types/FilterVariables.html +2 -2
- package/apidoc/types/GeometryType.html +2 -2
- package/apidoc/types/GlobalId.html +2 -2
- package/apidoc/types/Layout.html +2 -2
- package/apidoc/types/LengthUnit.html +1 -1
- package/apidoc/types/OpaqueString.html +2 -2
- package/apidoc/types/OperationMode.html +2 -2
- package/apidoc/types/Polygon.html +1 -1
- package/apidoc/types/SpatialRelation.html +2 -2
- package/apidoc/types/TablePart.html +2 -2
- package/apidoc/types/UiFeature.html +2 -2
- package/apidoc/types/WorkbookLayerPath.html +2 -2
- package/apidoc/types/WorksheetPlaceholders.html +2 -0
- package/cadenza.d.ts +36 -4
- package/cadenza.js +38 -6
- package/package.json +1 -1
- package/sandbox.html +24 -3
package/cadenza.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
// This placeholder is replaced when Cadenza JS is released,
|
|
20
20
|
// i.e. during development, the version is not available.
|
|
21
|
-
const CADENZAJS_VERSION = '10.5.
|
|
21
|
+
const CADENZAJS_VERSION = '10.5.2';
|
|
22
22
|
/**
|
|
23
23
|
* Creates an instance of the Cadenza JS client.
|
|
24
24
|
*
|
|
@@ -169,7 +169,7 @@ globalThis.cadenza = Object.assign((/** @type Parameters<cadenza> */ ...args) =>
|
|
|
169
169
|
*/
|
|
170
170
|
/**
|
|
171
171
|
* @typedef CommonEditGeometryOptions - Common options for the initialization of the geometry editor.
|
|
172
|
-
* @property {LayerDefinition[]} [additionalLayers] - Layer definitions to be imported and shown in the background, as a basis for the drawing.
|
|
172
|
+
* @property {LayerDefinition[]} [additionalLayers] - Layer definitions to be imported and shown in the background, as a basis for the drawing. IMPORTANT: The Cadenza referenced with `cadenzaClient` must be configured to support the import of GeoJSON, and the (system) privileges of the corresponding user must also be set in such a way that the import of GeoJSON is possible.
|
|
173
173
|
* @property {UiFeature[]} [disabledUiFeatures] - Cadenza UI features to disable
|
|
174
174
|
* @property {ExtentStrategy} [extentStrategy] - Defines the initial map extent; If not given, Cadenza's default logic is used.
|
|
175
175
|
* @property {FilterVariables} [filter] - Filter variables
|
|
@@ -219,6 +219,9 @@ globalThis.cadenza = Object.assign((/** @type Parameters<cadenza> */ ...args) =>
|
|
|
219
219
|
* @property {'FeatureCollection'} type - The object's type
|
|
220
220
|
* @property {Feature[]} features - The features within this collection
|
|
221
221
|
*/
|
|
222
|
+
/**
|
|
223
|
+
* @typedef {Record<string, string>} WorksheetPlaceholders - Maps the worksheet placeholder IDs in report embeddings to the print names of the worksheets to replace them with.
|
|
224
|
+
*/
|
|
222
225
|
/**
|
|
223
226
|
* @typedef AreaIntersectionsResult - Result object of function fetchAreaIntersections
|
|
224
227
|
* @property {FeatureCollection} results - Results of the geometry intersection
|
|
@@ -348,6 +351,7 @@ export class CadenzaClient {
|
|
|
348
351
|
* @param {GlobalId} [__namedParameters.highlightGlobalId] - The ID of an item to highlight / expand in the navigator
|
|
349
352
|
* @param {String} [__namedParameters.labelSet] - The name of a label set defined in the `basicweb-config.xml` (only supported for the welcome page)
|
|
350
353
|
* @param {OperationMode} [__namedParameters.operationMode] - The mode in which a workbook should be operated
|
|
354
|
+
* @param {WorksheetPlaceholders} [__namedParameters.worksheetPlaceholders] - Maps the worksheet placeholder IDs in report embeddings to the print names of the worksheets to replace them with.
|
|
351
355
|
* @param {Layout} [__namedParameters.layout] - The layout to be used; the dashboard layout is used by default or the linear layout if there is not enough space.
|
|
352
356
|
* @param {AbortSignal} [__namedParameters.signal] - A signal to abort the iframe loading
|
|
353
357
|
* @return {Promise<void>} A `Promise` for when the iframe is loaded
|
|
@@ -357,7 +361,7 @@ export class CadenzaClient {
|
|
|
357
361
|
* - {@link CadenzaActionEvent}
|
|
358
362
|
* @embed
|
|
359
363
|
*/
|
|
360
|
-
show(source, { dataType, disabledUiFeatures, expandNavigator, filter, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, labelSet, operationMode, layout, signal, } = {}) {
|
|
364
|
+
show(source, { dataType, disabledUiFeatures, expandNavigator, filter, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, labelSet, operationMode, worksheetPlaceholders, layout, signal, } = {}) {
|
|
361
365
|
this.#log('CadenzaClient#show', ...arguments);
|
|
362
366
|
if (dataType) {
|
|
363
367
|
assertSupportedDataType(dataType, ['pdf']);
|
|
@@ -378,6 +382,7 @@ export class CadenzaClient {
|
|
|
378
382
|
labelSet,
|
|
379
383
|
operationMode,
|
|
380
384
|
layout,
|
|
385
|
+
worksheetPlaceholders,
|
|
381
386
|
});
|
|
382
387
|
return this.#show(resolvePath(source), params, signal);
|
|
383
388
|
}
|
|
@@ -407,7 +412,7 @@ export class CadenzaClient {
|
|
|
407
412
|
*
|
|
408
413
|
* @param {EmbeddingTargetId} mapView - The workbook map view to show
|
|
409
414
|
* @param {object} [__namedParameters] - Options
|
|
410
|
-
* @param {LayerDefinition[]} [__namedParameters.additionalLayers] - Layer definitions to be imported and shown in the background, as a basis for the drawing.
|
|
415
|
+
* @param {LayerDefinition[]} [__namedParameters.additionalLayers] - Layer definitions to be imported and shown in the background, as a basis for the drawing. IMPORTANT: The Cadenza referenced with `cadenzaClient` must be configured to support the import of GeoJSON, and the (system) privileges of the corresponding user must also be set in such a way that the import of GeoJSON is possible.
|
|
411
416
|
* @param {UiFeature[]} [__namedParameters.disabledUiFeatures] - Cadenza UI features to disable
|
|
412
417
|
* @param {boolean} [__namedParameters.expandNavigator] - Indicates if the navigator should be expanded.
|
|
413
418
|
* @param {ExtentStrategy} [__namedParameters.extentStrategy] - Defines the initial map extent; If not given, Cadenza's default logic is used.
|
|
@@ -673,6 +678,9 @@ export class CadenzaClient {
|
|
|
673
678
|
* @fires
|
|
674
679
|
* - {@link CadenzaEditGeometryUpdateEvent}
|
|
675
680
|
* - {@link CadenzaEditGeometryOkEvent}
|
|
681
|
+
* - {@link CadenzaEditGeometryCreateEvent}
|
|
682
|
+
* - {@link CadenzaEditGeometryEditEvent}
|
|
683
|
+
* - {@link CadenzaEditGeometryDeleteEvent}
|
|
676
684
|
* - {@link CadenzaEditGeometryCancelEvent}
|
|
677
685
|
* @embed
|
|
678
686
|
*/
|
|
@@ -712,6 +720,9 @@ export class CadenzaClient {
|
|
|
712
720
|
* @fires
|
|
713
721
|
* - {@link CadenzaEditGeometryUpdateEvent}
|
|
714
722
|
* - {@link CadenzaEditGeometryOkEvent}
|
|
723
|
+
* - {@link CadenzaEditGeometryCreateEvent}
|
|
724
|
+
* - {@link CadenzaEditGeometryEditEvent}
|
|
725
|
+
* - {@link CadenzaEditGeometryDeleteEvent}
|
|
715
726
|
* - {@link CadenzaEditGeometryCancelEvent}
|
|
716
727
|
* @embed
|
|
717
728
|
*/
|
|
@@ -745,7 +756,7 @@ export class CadenzaClient {
|
|
|
745
756
|
/**
|
|
746
757
|
* @param {object} __namedParameters - Options
|
|
747
758
|
* @param [__namedParameters.geometry] {Geometry} - The geometry to edit
|
|
748
|
-
* @param [__namedParameters.additionalLayers] {LayerDefinition[]} - Layer definitions to be imported and shown in the background, as a basis for the drawing.
|
|
759
|
+
* @param [__namedParameters.additionalLayers] {LayerDefinition[]} - Layer definitions to be imported and shown in the background, as a basis for the drawing. IMPORTANT: The Cadenza referenced with `cadenzaClient` must be configured to support the import of GeoJSON, and the (system) privileges of the corresponding user must also be set in such a way that the import of GeoJSON is possible.
|
|
749
760
|
* @param [__namedParameters.validExtentStrategy] {ExtentStrategy} - Defines the initial map extent; If not given, Cadenza's default logic is used.
|
|
750
761
|
* @param [__namedParameters.features] {FeatureCollection} - The features to edit. The last feature in this collection is directly set up for editing.
|
|
751
762
|
* @returns {Promise<Awaited<unknown>[]>}
|
|
@@ -1181,6 +1192,7 @@ export class CadenzaClient {
|
|
|
1181
1192
|
* @param {WorkbookLayerPath[]} [params.layers]
|
|
1182
1193
|
* @param {number} [params.minScale]
|
|
1183
1194
|
* @param {OperationMode} [params.operationMode]
|
|
1195
|
+
* @param {WorksheetPlaceholders} [params.worksheetPlaceholders]
|
|
1184
1196
|
* @param {TablePart[]} [params.parts]
|
|
1185
1197
|
* @param {'MAP'} [params.targetType]
|
|
1186
1198
|
* @param {SnappingOptions} [params.snapping]
|
|
@@ -1189,7 +1201,7 @@ export class CadenzaClient {
|
|
|
1189
1201
|
* @param {Layout} [params.layout]
|
|
1190
1202
|
* @return {URLSearchParams}
|
|
1191
1203
|
*/
|
|
1192
|
-
#createParams({ action, batchModeEnabled, dataType, disabledUiFeatures, expandNavigator, fileName, filter, geometryType, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, labelSet, layers, minScale, operationMode, parts, targetType, snapping, useMapSrs, validExtentStrategy, layout, }) {
|
|
1204
|
+
#createParams({ action, batchModeEnabled, dataType, disabledUiFeatures, expandNavigator, fileName, filter, geometryType, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, labelSet, layers, minScale, operationMode, worksheetPlaceholders, parts, targetType, snapping, useMapSrs, validExtentStrategy, layout, }) {
|
|
1193
1205
|
if (disabledUiFeatures) {
|
|
1194
1206
|
disabledUiFeatures.forEach((feature) => assert(validUiFeature(feature), `Invalid UI feature: ${feature}`));
|
|
1195
1207
|
}
|
|
@@ -1208,6 +1220,9 @@ export class CadenzaClient {
|
|
|
1208
1220
|
if (parts) {
|
|
1209
1221
|
parts.forEach((part) => assert(validTablePart(part), `Invalid table part: ${part}`));
|
|
1210
1222
|
}
|
|
1223
|
+
if (worksheetPlaceholders) {
|
|
1224
|
+
assertValidWorksheetPlaceholdersValues(worksheetPlaceholders);
|
|
1225
|
+
}
|
|
1211
1226
|
let locationFinder;
|
|
1212
1227
|
let mapExtent;
|
|
1213
1228
|
if (validExtentStrategy) {
|
|
@@ -1232,6 +1247,11 @@ export class CadenzaClient {
|
|
|
1232
1247
|
`filter.${variable}`,
|
|
1233
1248
|
JSON.stringify(value instanceof Date ? value.toISOString() : value),
|
|
1234
1249
|
]))),
|
|
1250
|
+
...(worksheetPlaceholders &&
|
|
1251
|
+
Object.fromEntries(Object.entries(worksheetPlaceholders).map(([placeholderId, worksheetPrintName]) => [
|
|
1252
|
+
`worksheetPlaceholder.${placeholderId}`,
|
|
1253
|
+
JSON.stringify(worksheetPrintName),
|
|
1254
|
+
]))),
|
|
1235
1255
|
...(geometryType && { geometryType }),
|
|
1236
1256
|
...(hideMainHeaderAndFooter && { hideMainHeaderAndFooter: 'true' }),
|
|
1237
1257
|
...(hideWorkbookToolBar && { hideWorkbookToolBar: 'true' }),
|
|
@@ -1380,6 +1400,12 @@ function assertValidFilterVariables(/** @type {FilterVariables} */ filter) {
|
|
|
1380
1400
|
validSpatialFilterValue(/** @type {SpatialFilterValue} */ ($spatial)), 'Invalid value for spatial filter value under $spatial property');
|
|
1381
1401
|
Object.keys(otherFilter).forEach((varName) => assert(validKebabCaseString(varName), `Invalid filter variable name: ${varName}`));
|
|
1382
1402
|
}
|
|
1403
|
+
function assertValidWorksheetPlaceholdersValues(
|
|
1404
|
+
/** @type {WorksheetPlaceholders} */ worksheetPlaceholders) {
|
|
1405
|
+
Object.keys(worksheetPlaceholders).forEach((placeholderId) => {
|
|
1406
|
+
assert(validKebabCaseString(placeholderId), `Invalid worksheeet placeholderId value: ${placeholderId}`);
|
|
1407
|
+
});
|
|
1408
|
+
}
|
|
1383
1409
|
function array(/** @type unknown */ value) {
|
|
1384
1410
|
return Array.isArray(value) ? value : [value];
|
|
1385
1411
|
}
|
|
@@ -1458,6 +1484,9 @@ function getGeometryTypeFromFeatureCollection(featureCollection) {
|
|
|
1458
1484
|
* : T extends 'drillThrough' ? CadenzaDrillThroughEvent
|
|
1459
1485
|
* : T extends 'editGeometry:update' ? CadenzaEditGeometryUpdateEvent
|
|
1460
1486
|
* : T extends 'editGeometry:ok' ? CadenzaEditGeometryOkEvent
|
|
1487
|
+
* : T extends 'editGeometry:create' ? CadenzaEditGeometryCreateEvent
|
|
1488
|
+
* : T extends 'editGeometry:edit' ? CadenzaEditGeometryEditEvent
|
|
1489
|
+
* : T extends 'editGeometry:delete' ? CadenzaEditGeometryDeleteEvent
|
|
1461
1490
|
* : T extends 'editGeometry:cancel' ? CadenzaEditGeometryCancelEvent
|
|
1462
1491
|
* : T extends 'reload' ? CadenzaReloadEvent
|
|
1463
1492
|
* : T extends 'selectObjects:ok' ? CadenzaSelectObjectsOkEvent
|
|
@@ -1496,6 +1525,9 @@ function getGeometryTypeFromFeatureCollection(featureCollection) {
|
|
|
1496
1525
|
*/
|
|
1497
1526
|
/** @typedef {CadenzaEvent<'editGeometry:update', FeatureCollection | Feature | undefined>} CadenzaEditGeometryUpdateEvent - When the user changed the geometry. `FeatureCollection` if multiple features are present on the edit layer, but the original defined type is not multi-geometry. This is also the case if the dialog was instantiated from a geometry and the original defined type is inherited. `undefined` if no feature is present on the edit layer. */
|
|
1498
1527
|
/** @typedef {CadenzaEvent<'editGeometry:ok', FeatureCollection | Feature>} CadenzaEditGeometryOkEvent - When the user submitted the geometry. `FeatureCollection` if batch editing is enabled. */
|
|
1528
|
+
/** @typedef {CadenzaEvent<'editGeometry:create', FeatureCollection | Feature>} CadenzaEditGeometryCreateEvent - Whenever new geometry features were created. `Feature` if only one feature was created. Only available in batch mode */
|
|
1529
|
+
/** @typedef {CadenzaEvent<'editGeometry:edit', Feature>} CadenzaEditGeometryEditEvent - Whenever a geometry feature was edited. Only available in batch mode */
|
|
1530
|
+
/** @typedef {CadenzaEvent<'editGeometry:delete', {featureIds: any[][]}>} CadenzaEditGeometryDeleteEvent - Whenever geometry features were deleted. Only available in batch mode */
|
|
1499
1531
|
/** @typedef {CadenzaEvent<'editGeometry:cancel'>} CadenzaEditGeometryCancelEvent - When the user cancelled the geometry editing. */
|
|
1500
1532
|
/** @typedef {CadenzaEvent<'error', {type: string, message?: string}>} CadenzaErrorEvent - An error event that is mapped to a {@link CadenzaError} */
|
|
1501
1533
|
/**
|
package/package.json
CHANGED
package/sandbox.html
CHANGED
|
@@ -250,12 +250,12 @@
|
|
|
250
250
|
layout,
|
|
251
251
|
width,
|
|
252
252
|
withScale,
|
|
253
|
+
worksheetPlaceholders
|
|
253
254
|
}, formData) {
|
|
254
255
|
return {
|
|
255
256
|
additionalLayers: additionalLayers && JSON.parse(additionalLayers),
|
|
256
257
|
buffer: distance ? { value: Number(distance), lengthUnit: lengthUnit ? lengthUnit : 'm' } : undefined,
|
|
257
|
-
|
|
258
|
-
dataType: dataType,
|
|
258
|
+
dataType: dataType ?? (requestAsPdf === 'on' ? 'pdf' : undefined),
|
|
259
259
|
disabledUiFeatures: disabledUiFeatures && disabledUiFeatures.split(','),
|
|
260
260
|
expandNavigator: (expandNavigator === 'on'),
|
|
261
261
|
extentStrategy: extentStrategy && JSON.parse(extentStrategy),
|
|
@@ -282,6 +282,7 @@
|
|
|
282
282
|
layout: layout || undefined,
|
|
283
283
|
width: Number(width),
|
|
284
284
|
withScale: Boolean(withScale),
|
|
285
|
+
worksheetPlaceholders: (worksheetPlaceholders && JSON.parse(worksheetPlaceholders.trim())) || undefined,
|
|
285
286
|
};
|
|
286
287
|
}
|
|
287
288
|
|
|
@@ -418,6 +419,26 @@
|
|
|
418
419
|
</div>
|
|
419
420
|
</template>
|
|
420
421
|
|
|
422
|
+
<template id="common-worksheetPlaceholders">
|
|
423
|
+
<div>
|
|
424
|
+
<label for="worksheetPlaceholders">Worksheet placeholder IDs</label>
|
|
425
|
+
<textarea name="worksheetPlaceholders" id="worksheetPlaceholders" rows="5"></textarea>
|
|
426
|
+
<small>
|
|
427
|
+
<p>A JSON object with a mapping of (placeholderId -> worksheetPrintName).
|
|
428
|
+
Placeholder ID is defined in the worksheet placeholder element in the report template.
|
|
429
|
+
The placeholders are then replaced with worksheet elements.</p>
|
|
430
|
+
<p>Example:</p>
|
|
431
|
+
<pre>
|
|
432
|
+
{
|
|
433
|
+
"first": "Informationen zur Arbeitsmappe",
|
|
434
|
+
"second": "Häufigkeit der Messungen"
|
|
435
|
+
}
|
|
436
|
+
</pre>
|
|
437
|
+
</small>
|
|
438
|
+
|
|
439
|
+
</div>
|
|
440
|
+
</template>
|
|
441
|
+
|
|
421
442
|
<template id="common-filter">
|
|
422
443
|
<div>
|
|
423
444
|
<label for="filter">Filter</label>
|
|
@@ -496,7 +517,7 @@
|
|
|
496
517
|
</div>
|
|
497
518
|
</template>
|
|
498
519
|
|
|
499
|
-
<template data-action="show" data-common="showWorkbook,disabledUiFeatures,filter,show">
|
|
520
|
+
<template data-action="show" data-common="showWorkbook,disabledUiFeatures,worksheetPlaceholders,filter,show">
|
|
500
521
|
<div>
|
|
501
522
|
<label for="embeddingTargetId">Embedding target ID *</label>
|
|
502
523
|
<input name="embeddingTargetId" id="embeddingTargetId" required>
|