@disy/cadenza.js 2.13.0 → 2.14.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 +10 -1
- 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 +34 -26
- package/apidoc/classes/CadenzaError.html +5 -5
- package/apidoc/functions/cadenza.html +3 -3
- package/apidoc/index.html +4 -4
- package/apidoc/interfaces/CadenzaClientOptions.html +5 -5
- package/apidoc/interfaces/CadenzaEvent.html +4 -4
- package/apidoc/interfaces/Distance.html +2 -2
- package/apidoc/interfaces/ExternalLinkKey.html +4 -4
- package/apidoc/interfaces/Feature.html +7 -7
- package/apidoc/interfaces/FeatureCollection.html +3 -3
- package/apidoc/interfaces/Geometry.html +3 -3
- package/apidoc/interfaces/GeometryZoomTarget.html +3 -3
- package/apidoc/interfaces/PageSource.html +3 -3
- package/apidoc/modules.html +3 -2
- 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/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/CadenzaObjectInfoEvent.html +2 -2
- package/apidoc/types/CadenzaSelectObjectsCancelEvent.html +2 -2
- package/apidoc/types/CadenzaSelectObjectsOkEvent.html +2 -2
- package/apidoc/types/CustomValidityType.html +2 -0
- package/apidoc/types/DataType.html +2 -2
- package/apidoc/types/EmbeddingTargetId.html +2 -2
- package/apidoc/types/Extent.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/LengthUnit.html +1 -1
- package/apidoc/types/OpaqueString.html +2 -2
- package/apidoc/types/OperationMode.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/ZoomTarget.html +2 -2
- package/cadenza.d.ts +23 -3
- package/cadenza.js +24 -4
- package/package.json +1 -1
- package/sandbox.html +36 -2
package/cadenza.js
CHANGED
|
@@ -147,6 +147,7 @@ globalThis.cadenza = Object.assign((/** @type Parameters<cadenza> */ ...args) =>
|
|
|
147
147
|
* @typedef FeatureCollection - A adapted [GeoJSON](https://geojson.org/) feature collection object
|
|
148
148
|
* @property {Feature[]} features - The features within this collection
|
|
149
149
|
*/
|
|
150
|
+
/** @typedef {'error'|'warning'|'info'|'success'} CustomValidityType - The type of custom validity used for disclose on visual presentation and form submission behavior */
|
|
150
151
|
let hasCadenzaSession = false;
|
|
151
152
|
/** @type {Promise<void> | undefined} */
|
|
152
153
|
let firstEmbeddingTargetShown;
|
|
@@ -469,6 +470,7 @@ export class CadenzaClient {
|
|
|
469
470
|
* @param {Extent} [options.mapExtent] - A map extent to set
|
|
470
471
|
* @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.
|
|
471
472
|
* @param {boolean} [options.useMapSrs] - Whether the created geometry should use the map's SRS (otherwise EPSG:4326 will be used)
|
|
473
|
+
* @param {OperationMode} [options.operationMode] - The mode in which a workbook should be operated
|
|
472
474
|
* @param {AbortSignal} [options.signal] - A signal to abort the iframe loading
|
|
473
475
|
* @return {Promise<void>} A `Promise` for when the iframe is loaded
|
|
474
476
|
* @throws For invalid arguments
|
|
@@ -478,7 +480,7 @@ export class CadenzaClient {
|
|
|
478
480
|
* - {@link CadenzaEditGeometryCancelEvent}
|
|
479
481
|
* @embed
|
|
480
482
|
*/
|
|
481
|
-
createGeometry(backgroundMapView, geometryType, { filter, locationFinder, mapExtent, minScale, useMapSrs, signal } = {}) {
|
|
483
|
+
createGeometry(backgroundMapView, geometryType, { filter, locationFinder, mapExtent, minScale, useMapSrs, operationMode, signal, } = {}) {
|
|
482
484
|
this.#log('CadenzaClient#createGeometry', ...arguments);
|
|
483
485
|
const params = createParams({
|
|
484
486
|
action: 'editGeometry',
|
|
@@ -488,6 +490,7 @@ export class CadenzaClient {
|
|
|
488
490
|
mapExtent,
|
|
489
491
|
minScale,
|
|
490
492
|
useMapSrs,
|
|
493
|
+
operationMode,
|
|
491
494
|
});
|
|
492
495
|
return this.#show(resolvePath(backgroundMapView), params, signal);
|
|
493
496
|
}
|
|
@@ -502,6 +505,7 @@ export class CadenzaClient {
|
|
|
502
505
|
* @param {Extent} [options.mapExtent] - A map extent to set
|
|
503
506
|
* @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.
|
|
504
507
|
* @param {boolean} [options.useMapSrs] - Whether the geometry is in the map's SRS (otherwise EPSG:4326 is assumed)
|
|
508
|
+
* @param {OperationMode} [options.operationMode] - The mode in which a workbook should be operated
|
|
505
509
|
* @param {ZoomTarget} [options.zoomTarget] - A target Cadenza should zoom to
|
|
506
510
|
* @param {AbortSignal} [options.signal] - A signal to abort the iframe loading
|
|
507
511
|
* @return {Promise<void>} A `Promise` for when the iframe is loaded
|
|
@@ -512,7 +516,7 @@ export class CadenzaClient {
|
|
|
512
516
|
* - {@link CadenzaEditGeometryCancelEvent}
|
|
513
517
|
* @embed
|
|
514
518
|
*/
|
|
515
|
-
async editGeometry(backgroundMapView, geometry, { filter, locationFinder, mapExtent, minScale, useMapSrs, zoomTarget, signal, } = {}) {
|
|
519
|
+
async editGeometry(backgroundMapView, geometry, { filter, locationFinder, mapExtent, minScale, useMapSrs, zoomTarget, operationMode, signal, } = {}) {
|
|
516
520
|
this.#log('CadenzaClient#editGeometry', ...arguments);
|
|
517
521
|
assertValidGeometryType(geometry.type);
|
|
518
522
|
const zoomToGeometry = geometry && zoomTarget?.type === 'geometry';
|
|
@@ -525,6 +529,7 @@ export class CadenzaClient {
|
|
|
525
529
|
mapExtent,
|
|
526
530
|
minScale,
|
|
527
531
|
useMapSrs,
|
|
532
|
+
operationMode,
|
|
528
533
|
});
|
|
529
534
|
await this.#show(resolvePath(backgroundMapView), params, signal);
|
|
530
535
|
if (geometry) {
|
|
@@ -534,6 +539,19 @@ export class CadenzaClient {
|
|
|
534
539
|
});
|
|
535
540
|
}
|
|
536
541
|
}
|
|
542
|
+
/**
|
|
543
|
+
* Set custom validity state of the geometry editor in addition to the default validation state (including errors and
|
|
544
|
+
* warnings). When set to error the dialog submission is blocked.
|
|
545
|
+
* If there already is a custom state set it will override it.
|
|
546
|
+
* Passing '' will reset the custom state to undefined, meaning no custom state is displayed.
|
|
547
|
+
* If no geometry editing is started, the method call has no effect.
|
|
548
|
+
* @param {string} message The message to show in the dialog
|
|
549
|
+
* @param {CustomValidityType} [type] The type of message (defaults to 'error')
|
|
550
|
+
*/
|
|
551
|
+
setCustomValidity(message, type = 'error') {
|
|
552
|
+
assert(['error', 'warning', 'info', 'success'].includes(type), `Invalid validity type: ${type}`);
|
|
553
|
+
this.#postEvent('setCustomValidity', { message, type });
|
|
554
|
+
}
|
|
537
555
|
/**
|
|
538
556
|
* Select objects in a workbook map.
|
|
539
557
|
*
|
|
@@ -545,6 +563,7 @@ export class CadenzaClient {
|
|
|
545
563
|
* @param {string} [options.locationFinder] - A search query for the location finder
|
|
546
564
|
* @param {Extent} [options.mapExtent] - A map extent to set
|
|
547
565
|
* @param {boolean} [options.useMapSrs] - Whether the geometry is in the map's SRS (otherwise EPSG:4326 is assumed)
|
|
566
|
+
* @param {OperationMode} [options.operationMode] - The mode in which a workbook should be operated
|
|
548
567
|
* @param {AbortSignal} [options.signal] - A signal to abort the iframe loading
|
|
549
568
|
* @return {Promise<void>} A `Promise` for when the iframe is loaded
|
|
550
569
|
* @throws For invalid arguments
|
|
@@ -555,7 +574,7 @@ export class CadenzaClient {
|
|
|
555
574
|
* - {@link CadenzaSelectObjectsCancelEvent}
|
|
556
575
|
* @embed
|
|
557
576
|
*/
|
|
558
|
-
selectObjects(backgroundMapView, { filter, layers, locationFinder, mapExtent, useMapSrs, signal } = {}) {
|
|
577
|
+
selectObjects(backgroundMapView, { filter, layers, locationFinder, mapExtent, useMapSrs, operationMode, signal, } = {}) {
|
|
559
578
|
this.#log('CadenzaClient#selectObjects', ...arguments);
|
|
560
579
|
const params = createParams({
|
|
561
580
|
action: 'selectObjects',
|
|
@@ -564,6 +583,7 @@ export class CadenzaClient {
|
|
|
564
583
|
locationFinder,
|
|
565
584
|
mapExtent,
|
|
566
585
|
useMapSrs,
|
|
586
|
+
operationMode,
|
|
567
587
|
});
|
|
568
588
|
return this.#show(resolvePath(backgroundMapView), params, signal);
|
|
569
589
|
}
|
|
@@ -1046,7 +1066,7 @@ function createParams({ action, dataType, disabledUiFeatures, expandNavigator, f
|
|
|
1046
1066
|
...(locationFinder && { locationFinder }),
|
|
1047
1067
|
...(mapExtent && { mapExtent: mapExtent.join() }),
|
|
1048
1068
|
...(minScale && { minScale: String(minScale) }),
|
|
1049
|
-
...(operationMode &&
|
|
1069
|
+
...(operationMode && { operationMode }),
|
|
1050
1070
|
...(parts && { parts: parts.join() }),
|
|
1051
1071
|
...(targetType && { targetType }),
|
|
1052
1072
|
...(useMapSrs && { useMapSrs: 'true' }),
|
package/package.json
CHANGED
package/sandbox.html
CHANGED
|
@@ -181,7 +181,8 @@
|
|
|
181
181
|
cadenzaClient.fetchAreaIntersections(data.embeddingTargetId, JSON.parse(data.layer), JSON.parse(data.geometry), getOptions(data))
|
|
182
182
|
.then(console.log);
|
|
183
183
|
},
|
|
184
|
-
downloadData: data => cadenzaClient.downloadData(data.embeddingTargetId, data.dataType, getOptions(data))
|
|
184
|
+
downloadData: data => cadenzaClient.downloadData(data.embeddingTargetId, data.dataType, getOptions(data)),
|
|
185
|
+
setCustomValidity: data => cadenzaClient.setCustomValidity(data.message, data.type || undefined)
|
|
185
186
|
};
|
|
186
187
|
|
|
187
188
|
const form = document.getElementById('form');
|
|
@@ -247,7 +248,7 @@
|
|
|
247
248
|
mapExtent: mapExtent && mapExtent.split(',').map(Number),
|
|
248
249
|
minScale: minScale && Number(minScale),
|
|
249
250
|
parts: parts && parts.split(','),
|
|
250
|
-
|
|
251
|
+
operationMode: (simplifiedOperationMode === 'on' ? 'simplified' : 'normal' ),
|
|
251
252
|
layers: layers ? JSON.parse(layers) : undefined,
|
|
252
253
|
useMapSrs: useMapSrs === 'on',
|
|
253
254
|
fullGeometries: fullGeometries === 'on',
|
|
@@ -297,6 +298,7 @@
|
|
|
297
298
|
<option value="createGeometry">Create Geometry</option>
|
|
298
299
|
<option value="editGeometry">Edit Geometry</option>
|
|
299
300
|
<option value="selectObjects">Select Objects</option>
|
|
301
|
+
<option value="setCustomValidity">Set Custom Validity</option>
|
|
300
302
|
</optgroup>
|
|
301
303
|
<optgroup label="Without Iframe">
|
|
302
304
|
<option value="downloadData">Download data</option>
|
|
@@ -472,6 +474,20 @@
|
|
|
472
474
|
</div>
|
|
473
475
|
</template>
|
|
474
476
|
|
|
477
|
+
<template data-action="setCustomValidity">
|
|
478
|
+
<p>Requires a geometry editing UI (Create / Edit Geometry actions) to be opened first.</p>
|
|
479
|
+
<label for="message">Message</label>
|
|
480
|
+
<input type="text" name="message" id="message">
|
|
481
|
+
<label for="type">Type</label>
|
|
482
|
+
<select name="type" id="type">
|
|
483
|
+
<option selected></option>
|
|
484
|
+
<option>success</option>
|
|
485
|
+
<option>info</option>
|
|
486
|
+
<option>warning</option>
|
|
487
|
+
<option>error</option>
|
|
488
|
+
</select>
|
|
489
|
+
</template>
|
|
490
|
+
|
|
475
491
|
<template data-action="setFilter" data-common="filter"></template>
|
|
476
492
|
|
|
477
493
|
<template data-action="createGeometry" data-common="map,filter">
|
|
@@ -490,6 +506,12 @@
|
|
|
490
506
|
<option>MultiPolygon</option>
|
|
491
507
|
</select>
|
|
492
508
|
</div>
|
|
509
|
+
<div>
|
|
510
|
+
<label>
|
|
511
|
+
<input type="checkbox" name="simplifiedOperationMode">
|
|
512
|
+
Simplified operation mode
|
|
513
|
+
</label>
|
|
514
|
+
</div>
|
|
493
515
|
<div>
|
|
494
516
|
<label for="minScale">Minimum Scale</label>
|
|
495
517
|
<input type="number" name="minScale" id="minScale">
|
|
@@ -505,6 +527,12 @@
|
|
|
505
527
|
<label for="geometry">Geometry (GeoJSON) *</label>
|
|
506
528
|
<textarea name="geometry" id="geometry" rows="5" required></textarea>
|
|
507
529
|
</div>
|
|
530
|
+
<div>
|
|
531
|
+
<label>
|
|
532
|
+
<input type="checkbox" name="simplifiedOperationMode">
|
|
533
|
+
Simplified operation mode
|
|
534
|
+
</label>
|
|
535
|
+
</div>
|
|
508
536
|
<div>
|
|
509
537
|
<label for="minScale">Minimum Scale</label>
|
|
510
538
|
<input type="number" name="minScale" id="minScale">
|
|
@@ -516,6 +544,12 @@
|
|
|
516
544
|
<label for="embeddingTargetId">Embedding target ID of the map view *</label>
|
|
517
545
|
<input name="embeddingTargetId" id="embeddingTargetId" required>
|
|
518
546
|
</div>
|
|
547
|
+
<div>
|
|
548
|
+
<label>
|
|
549
|
+
<input type="checkbox" name="simplifiedOperationMode">
|
|
550
|
+
Simplified operation mode
|
|
551
|
+
</label>
|
|
552
|
+
</div>
|
|
519
553
|
<div>
|
|
520
554
|
<label for="layers">Layers</label>
|
|
521
555
|
<input name="layers" id="layers">
|