@disy/cadenza.js 10.4.3 → 10.4.5
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 +20 -1
- package/apidoc/assets/highlight.css +16 -2
- 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 +26 -25
- package/apidoc/classes/CadenzaError.html +5 -5
- package/apidoc/functions/cadenza.html +4 -4
- package/apidoc/index.html +8 -3
- package/apidoc/interfaces/AreaIntersectionsResult.html +6 -0
- package/apidoc/interfaces/CadenzaClientOptions.html +12 -5
- package/apidoc/interfaces/CadenzaEvent.html +4 -4
- package/apidoc/interfaces/CommonEditGeometryOptions.html +11 -11
- package/apidoc/interfaces/Distance.html +2 -2
- package/apidoc/interfaces/ExternalLinkKey.html +5 -5
- 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 +10 -0
- 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/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/cadenza.d.ts +61 -25
- package/cadenza.js +139 -108
- package/package.json +1 -1
- package/sandbox.html +15 -3
- package/apidoc/types/CadenzaObjectInfoEvent.html +0 -2
package/cadenza.js
CHANGED
|
@@ -8,11 +8,17 @@
|
|
|
8
8
|
* [target origin](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage#targetorigin) when posting events.
|
|
9
9
|
* This is required if Cadenza and your application are not running on the same origin.
|
|
10
10
|
* Please ensure that the user has view privilege for that link!
|
|
11
|
-
* @property {boolean} [options.debug] - Whether to enable debug logging
|
|
11
|
+
* @property {boolean} [options.debug] - Whether to enable debug logging;
|
|
12
|
+
* It can also be enabled/disabled at runtime via the devtools console:
|
|
13
|
+
* ```js
|
|
14
|
+
* localStorage.setItem('cadenzajs.debug', 'true'); // or 'false'
|
|
15
|
+
* ```
|
|
16
|
+
* Then you need to reload the page.
|
|
17
|
+
* @property {boolean} [options.skipGuest] - Whether a configured guest authenticator should be ignored
|
|
12
18
|
*/
|
|
13
19
|
// This placeholder is replaced when Cadenza JS is released,
|
|
14
20
|
// i.e. during development, the version is not available.
|
|
15
|
-
const CADENZAJS_VERSION = '10.4.
|
|
21
|
+
const CADENZAJS_VERSION = '10.4.5';
|
|
16
22
|
/**
|
|
17
23
|
* Creates an instance of the Cadenza JS client.
|
|
18
24
|
*
|
|
@@ -213,6 +219,18 @@ globalThis.cadenza = Object.assign((/** @type Parameters<cadenza> */ ...args) =>
|
|
|
213
219
|
* @property {'FeatureCollection'} type - The object's type
|
|
214
220
|
* @property {Feature[]} features - The features within this collection
|
|
215
221
|
*/
|
|
222
|
+
/**
|
|
223
|
+
* @typedef AreaIntersectionsResult - Result object of function fetchAreaIntersections
|
|
224
|
+
* @property {FeatureCollection} results - Results of the geometry intersection
|
|
225
|
+
* @property {FeatureCollection} errors - Optional listing of corrected geometries including error description
|
|
226
|
+
*/
|
|
227
|
+
/**
|
|
228
|
+
* @typedef ProblemDetails - A adapted [JSOn] IETF RFC 9457 Problem Details for HTTP APIs object
|
|
229
|
+
* @property {string} httpStatus - http status message
|
|
230
|
+
* @property {string} type - The primary identifier for the experienced problem type
|
|
231
|
+
* @property {string} key - Short version of the type
|
|
232
|
+
* @property {string} title - Summary of the problem
|
|
233
|
+
*/
|
|
216
234
|
/** @typedef {'error'|'warning'|'info'|'success'} CustomValidityType - The type of custom validity used for disclose on visual presentation and form submission behavior */
|
|
217
235
|
/**
|
|
218
236
|
* @typedef SnappingOptions
|
|
@@ -253,6 +271,8 @@ export class CadenzaClient {
|
|
|
253
271
|
#iframeElement;
|
|
254
272
|
/** @readonly */
|
|
255
273
|
#debug;
|
|
274
|
+
/** @readonly */
|
|
275
|
+
#skipGuest;
|
|
256
276
|
/** @type {[ CadenzaEventType | string, (event: CadenzaEvent<never>) => void ][]} */
|
|
257
277
|
#subscriptions = [];
|
|
258
278
|
/**
|
|
@@ -260,7 +280,7 @@ export class CadenzaClient {
|
|
|
260
280
|
* @hidden
|
|
261
281
|
* @param {CadenzaClientOptions} [__namedParameters]
|
|
262
282
|
*/
|
|
263
|
-
constructor({ baseUrl, debug = false, iframe, webApplication } = {}) {
|
|
283
|
+
constructor({ baseUrl, debug = false, skipGuest = false, iframe, webApplication, } = {}) {
|
|
264
284
|
if (webApplication) {
|
|
265
285
|
assert(validExternalLinkKey(webApplication), `Invalid webApplication parameter: ${webApplication}`);
|
|
266
286
|
}
|
|
@@ -280,6 +300,7 @@ export class CadenzaClient {
|
|
|
280
300
|
this.#log('Create Cadenza client for parent Cadenza');
|
|
281
301
|
}
|
|
282
302
|
this.#debug = debug;
|
|
303
|
+
this.#skipGuest = skipGuest;
|
|
283
304
|
this.#webApplication = webApplication;
|
|
284
305
|
}
|
|
285
306
|
/** The base URL of the Cadenza server this client is requesting */
|
|
@@ -346,7 +367,7 @@ export class CadenzaClient {
|
|
|
346
367
|
'page' in source &&
|
|
347
368
|
source.page === 'welcome', 'labelSet is only supported on the welcome page');
|
|
348
369
|
}
|
|
349
|
-
const params = createParams({
|
|
370
|
+
const params = this.#createParams({
|
|
350
371
|
dataType,
|
|
351
372
|
disabledUiFeatures,
|
|
352
373
|
expandNavigator,
|
|
@@ -414,7 +435,7 @@ export class CadenzaClient {
|
|
|
414
435
|
extentStrategy,
|
|
415
436
|
geometry,
|
|
416
437
|
});
|
|
417
|
-
const params = createParams({
|
|
438
|
+
const params = this.#createParams({
|
|
418
439
|
disabledUiFeatures,
|
|
419
440
|
expandNavigator,
|
|
420
441
|
filter,
|
|
@@ -582,7 +603,7 @@ export class CadenzaClient {
|
|
|
582
603
|
const validExtentStrategy = sanitizeExtentStrategy({
|
|
583
604
|
extentStrategy,
|
|
584
605
|
});
|
|
585
|
-
const params = createParams({
|
|
606
|
+
const params = this.#createParams({
|
|
586
607
|
action: 'editGeometry',
|
|
587
608
|
disabledUiFeatures,
|
|
588
609
|
filter,
|
|
@@ -622,7 +643,7 @@ export class CadenzaClient {
|
|
|
622
643
|
extentStrategy,
|
|
623
644
|
geometry,
|
|
624
645
|
});
|
|
625
|
-
const params = createParams({
|
|
646
|
+
const params = this.#createParams({
|
|
626
647
|
action: 'editGeometry',
|
|
627
648
|
disabledUiFeatures,
|
|
628
649
|
filter,
|
|
@@ -661,7 +682,7 @@ export class CadenzaClient {
|
|
|
661
682
|
const validExtentStrategy = sanitizeExtentStrategy({
|
|
662
683
|
extentStrategy,
|
|
663
684
|
});
|
|
664
|
-
const params = createParams({
|
|
685
|
+
const params = this.#createParams({
|
|
665
686
|
action: 'editGeometry',
|
|
666
687
|
batchModeEnabled: true,
|
|
667
688
|
disabledUiFeatures,
|
|
@@ -701,7 +722,7 @@ export class CadenzaClient {
|
|
|
701
722
|
extentStrategy,
|
|
702
723
|
geometry: features.features[features.features.length - 1].geometry,
|
|
703
724
|
});
|
|
704
|
-
const params = createParams({
|
|
725
|
+
const params = this.#createParams({
|
|
705
726
|
action: 'editGeometry',
|
|
706
727
|
batchModeEnabled: true,
|
|
707
728
|
disabledUiFeatures,
|
|
@@ -780,7 +801,6 @@ export class CadenzaClient {
|
|
|
780
801
|
* @throws For invalid arguments
|
|
781
802
|
* @fires
|
|
782
803
|
* - {@link CadenzaChangeSelectionEvent}
|
|
783
|
-
* - {@link CadenzaObjectInfoEvent}
|
|
784
804
|
* - {@link CadenzaSelectObjectsOkEvent}
|
|
785
805
|
* - {@link CadenzaSelectObjectsCancelEvent}
|
|
786
806
|
* @embed
|
|
@@ -790,7 +810,7 @@ export class CadenzaClient {
|
|
|
790
810
|
const validExtentStrategy = sanitizeExtentStrategy({
|
|
791
811
|
extentStrategy,
|
|
792
812
|
});
|
|
793
|
-
const params = createParams({
|
|
813
|
+
const params = this.#createParams({
|
|
794
814
|
action: 'selectObjects',
|
|
795
815
|
disabledUiFeatures,
|
|
796
816
|
filter,
|
|
@@ -1006,7 +1026,7 @@ export class CadenzaClient {
|
|
|
1006
1026
|
fetchData(source, dataType, { filter, parts, signal } = {}) {
|
|
1007
1027
|
this.#log('CadenzaClient#fetchData', ...arguments);
|
|
1008
1028
|
assertSupportedDataType(dataType, ['csv', 'excel', 'json', 'pdf']);
|
|
1009
|
-
const params = createParams({ dataType, filter, parts });
|
|
1029
|
+
const params = this.#createParams({ dataType, filter, parts });
|
|
1010
1030
|
return this.#fetch(resolvePath(source), params, signal);
|
|
1011
1031
|
}
|
|
1012
1032
|
/**
|
|
@@ -1026,7 +1046,7 @@ export class CadenzaClient {
|
|
|
1026
1046
|
*/
|
|
1027
1047
|
fetchObjectInfo(source, layerPath, objectIds, { filter, signal, fullGeometries, useMapSrs } = {}) {
|
|
1028
1048
|
this.#log('CadenzaClient#fetchObjectInfo', ...arguments);
|
|
1029
|
-
const params = createParams({
|
|
1049
|
+
const params = this.#createParams({
|
|
1030
1050
|
filter,
|
|
1031
1051
|
});
|
|
1032
1052
|
return this.#fetch(resolvePath(source) + '/objectinfo', params, signal, JSON.stringify({
|
|
@@ -1044,27 +1064,33 @@ export class CadenzaClient {
|
|
|
1044
1064
|
* (identified using layer paths or print names)
|
|
1045
1065
|
* @param {Geometry} geometry - The intersection geometry
|
|
1046
1066
|
* @param {object} [__namedParameters] - Options
|
|
1067
|
+
* @param {boolean} [__namedParameters.useAutoCorrection] - Enables the automatic correction of invalid geometries
|
|
1047
1068
|
* @param {Distance} [__namedParameters.buffer] - Buffer size for geometry of the transition
|
|
1069
|
+
* @param {boolean} [__namedParameters.includeGeometryValidationReport] - Enables the list of corrected geometries, including error descriptions
|
|
1048
1070
|
* @param {AbortSignal} [__namedParameters.signal] - A signal to abort the data fetching
|
|
1049
1071
|
* @param {boolean} [__namedParameters.useMapSrs] - The intersection geometry and the result geometries are in the map's SRS (otherwise EPSG:4326 is assumed)
|
|
1050
|
-
* @return {Promise<
|
|
1072
|
+
* @return {Promise<AreaIntersectionsResult | ProblemDetails>} A `Promise` for the fetch response
|
|
1051
1073
|
* @server
|
|
1052
1074
|
*/
|
|
1053
|
-
fetchAreaIntersections(source, layerPath, geometry, { buffer, signal, useMapSrs } = {}) {
|
|
1075
|
+
fetchAreaIntersections(source, layerPath, geometry, { buffer, includeGeometryValidationReport, signal, useAutoCorrection, useMapSrs, } = {}) {
|
|
1054
1076
|
this.#log('CadenzaClient#areaIntersections', ...arguments);
|
|
1055
|
-
const params = createParams({});
|
|
1077
|
+
const params = this.#createParams({});
|
|
1056
1078
|
return this.#fetch(resolvePath(source) + '/area-intersections', params, signal, JSON.stringify({
|
|
1057
1079
|
buffer,
|
|
1080
|
+
includeGeometryValidationReport,
|
|
1058
1081
|
layerPath: array(layerPath),
|
|
1059
1082
|
geometry,
|
|
1083
|
+
useAutoCorrection,
|
|
1060
1084
|
useMapSrs,
|
|
1085
|
+
isForwardProblemDetailsEnabled: true,
|
|
1061
1086
|
})).then((response) => response.json());
|
|
1062
1087
|
}
|
|
1063
1088
|
async #fetch(
|
|
1064
1089
|
/** @type string */ path,
|
|
1065
1090
|
/** @type URLSearchParams */ params,
|
|
1066
1091
|
/** @type AbortSignal | undefined */ signal,
|
|
1067
|
-
/** @type String | undefined If body is set, the fetch will be a post.*/ body
|
|
1092
|
+
/** @type String | undefined If body is set, the fetch will be a post.*/ body,
|
|
1093
|
+
/** @type boolean */ isForwardProblemDetailsEnabled = false) {
|
|
1068
1094
|
const url = this.#createUrl(path, params);
|
|
1069
1095
|
this.#log('Fetch', url.toString());
|
|
1070
1096
|
const method = body ? 'POST' : undefined;
|
|
@@ -1080,6 +1106,11 @@ export class CadenzaClient {
|
|
|
1080
1106
|
body,
|
|
1081
1107
|
});
|
|
1082
1108
|
if (!res.ok) {
|
|
1109
|
+
const contentType = res.headers.get('content-type');
|
|
1110
|
+
if (isForwardProblemDetailsEnabled &&
|
|
1111
|
+
contentType === 'application/problem+json') {
|
|
1112
|
+
return res;
|
|
1113
|
+
}
|
|
1083
1114
|
const errorType = {
|
|
1084
1115
|
400: 'bad-request',
|
|
1085
1116
|
401: 'unauthorized',
|
|
@@ -1109,7 +1140,7 @@ export class CadenzaClient {
|
|
|
1109
1140
|
downloadData(source, dataType, { fileName, filter, parts } = {}) {
|
|
1110
1141
|
this.#log('CadenzaClient#downloadData', ...arguments);
|
|
1111
1142
|
assertSupportedDataType(dataType, ['csv', 'excel', 'json', 'pdf']);
|
|
1112
|
-
const params = createParams({ dataType, fileName, filter, parts });
|
|
1143
|
+
const params = this.#createParams({ dataType, fileName, filter, parts });
|
|
1113
1144
|
this.#download(resolvePath(source), params);
|
|
1114
1145
|
}
|
|
1115
1146
|
#download(/** @type string */ path, /** @type URLSearchParams */ params) {
|
|
@@ -1133,8 +1164,97 @@ export class CadenzaClient {
|
|
|
1133
1164
|
}
|
|
1134
1165
|
return url;
|
|
1135
1166
|
}
|
|
1167
|
+
/**
|
|
1168
|
+
* @param {object} params
|
|
1169
|
+
* @param {string} [params.action]
|
|
1170
|
+
* @param {boolean} [params.batchModeEnabled]
|
|
1171
|
+
* @param {DataType} [params.dataType]
|
|
1172
|
+
* @param {UiFeature[]} [params.disabledUiFeatures]
|
|
1173
|
+
* @param {boolean} [params.expandNavigator]
|
|
1174
|
+
* @param {string} [params.fileName]
|
|
1175
|
+
* @param {FilterVariables} [params.filter]
|
|
1176
|
+
* @param {GeometryType} [params.geometryType]
|
|
1177
|
+
* @param {boolean} [params.hideMainHeaderAndFooter]
|
|
1178
|
+
* @param {boolean} [params.hideWorkbookToolBar]
|
|
1179
|
+
* @param {GlobalId} [params.highlightGlobalId]
|
|
1180
|
+
* @param {string} [params.labelSet]
|
|
1181
|
+
* @param {WorkbookLayerPath[]} [params.layers]
|
|
1182
|
+
* @param {number} [params.minScale]
|
|
1183
|
+
* @param {OperationMode} [params.operationMode]
|
|
1184
|
+
* @param {TablePart[]} [params.parts]
|
|
1185
|
+
* @param {'MAP'} [params.targetType]
|
|
1186
|
+
* @param {SnappingOptions} [params.snapping]
|
|
1187
|
+
* @param {boolean} [params.useMapSrs]
|
|
1188
|
+
* @param {ExtentStrategy} [params.validExtentStrategy]
|
|
1189
|
+
* @param {Layout} [params.layout]
|
|
1190
|
+
* @return {URLSearchParams}
|
|
1191
|
+
*/
|
|
1192
|
+
#createParams({ action, batchModeEnabled, dataType, disabledUiFeatures, expandNavigator, fileName, filter, geometryType, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, labelSet, layers, minScale, operationMode, parts, targetType, snapping, useMapSrs, validExtentStrategy, layout, }) {
|
|
1193
|
+
if (disabledUiFeatures) {
|
|
1194
|
+
disabledUiFeatures.forEach((feature) => assert(validUiFeature(feature), `Invalid UI feature: ${feature}`));
|
|
1195
|
+
}
|
|
1196
|
+
if (filter) {
|
|
1197
|
+
assertValidFilterVariables(filter);
|
|
1198
|
+
}
|
|
1199
|
+
if (geometryType) {
|
|
1200
|
+
assertValidGeometryType(geometryType);
|
|
1201
|
+
}
|
|
1202
|
+
if (operationMode) {
|
|
1203
|
+
assert(validOperationMode(operationMode), `Invalid operation mode: ${operationMode}`);
|
|
1204
|
+
}
|
|
1205
|
+
if (layout) {
|
|
1206
|
+
assert(validLayout(layout), `Invalid layout: ${layout}`);
|
|
1207
|
+
}
|
|
1208
|
+
if (parts) {
|
|
1209
|
+
parts.forEach((part) => assert(validTablePart(part), `Invalid table part: ${part}`));
|
|
1210
|
+
}
|
|
1211
|
+
let locationFinder;
|
|
1212
|
+
let mapExtent;
|
|
1213
|
+
if (validExtentStrategy) {
|
|
1214
|
+
if (validExtentStrategy.type === 'static') {
|
|
1215
|
+
mapExtent = validExtentStrategy.extent;
|
|
1216
|
+
}
|
|
1217
|
+
else if (validExtentStrategy.type === 'locationFinder') {
|
|
1218
|
+
locationFinder = validExtentStrategy.query;
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
return new URLSearchParams({
|
|
1222
|
+
...(action && { action }),
|
|
1223
|
+
...(batchModeEnabled && { batchModeEnabled: 'true' }),
|
|
1224
|
+
...(dataType && { dataType }),
|
|
1225
|
+
...(disabledUiFeatures && {
|
|
1226
|
+
disabledUiFeatures: disabledUiFeatures.join(),
|
|
1227
|
+
}),
|
|
1228
|
+
...(expandNavigator && { expandNavigator: 'true' }),
|
|
1229
|
+
...(fileName && { fileName }),
|
|
1230
|
+
...(filter &&
|
|
1231
|
+
Object.fromEntries(Object.entries(filter).map(([variable, value]) => [
|
|
1232
|
+
`filter.${variable}`,
|
|
1233
|
+
JSON.stringify(value instanceof Date ? value.toISOString() : value),
|
|
1234
|
+
]))),
|
|
1235
|
+
...(geometryType && { geometryType }),
|
|
1236
|
+
...(hideMainHeaderAndFooter && { hideMainHeaderAndFooter: 'true' }),
|
|
1237
|
+
...(hideWorkbookToolBar && { hideWorkbookToolBar: 'true' }),
|
|
1238
|
+
...(highlightGlobalId && { highlightGlobalId }),
|
|
1239
|
+
...(labelSet && { labelSet }),
|
|
1240
|
+
...(layers?.length && { layers: JSON.stringify(layers) }),
|
|
1241
|
+
...(locationFinder && { locationFinder }),
|
|
1242
|
+
...(mapExtent && { mapExtent: mapExtent.join() }),
|
|
1243
|
+
...(minScale && { minScale: String(minScale) }),
|
|
1244
|
+
...(operationMode && { operationMode }),
|
|
1245
|
+
...(parts && { parts: parts.join() }),
|
|
1246
|
+
...(snapping && { snappingLayer: JSON.stringify(array(snapping.layer)) }),
|
|
1247
|
+
...(snapping?.types?.length && { snappingTypes: snapping.types.join() }),
|
|
1248
|
+
...(targetType && { targetType }),
|
|
1249
|
+
...(useMapSrs && { useMapSrs: 'true' }),
|
|
1250
|
+
...(layout && { layout }),
|
|
1251
|
+
...(this.#skipGuest && { skipGuestAccess: 'true' }),
|
|
1252
|
+
});
|
|
1253
|
+
}
|
|
1136
1254
|
#log(/** @type unknown[] */ ...args) {
|
|
1137
|
-
|
|
1255
|
+
const debugString = localStorage.getItem('cadenzajs.debug');
|
|
1256
|
+
const debug = debugString != null ? debugString === 'true' : this.#debug;
|
|
1257
|
+
if (debug) {
|
|
1138
1258
|
/** @type {unknown[]} */
|
|
1139
1259
|
const redundantValues = [undefined, '', false];
|
|
1140
1260
|
/** @type {(value: unknown) => value is object} */
|
|
@@ -1260,92 +1380,6 @@ function assertValidFilterVariables(/** @type {FilterVariables} */ filter) {
|
|
|
1260
1380
|
validSpatialFilterValue(/** @type {SpatialFilterValue} */ ($spatial)), 'Invalid value for spatial filter value under $spatial property');
|
|
1261
1381
|
Object.keys(otherFilter).forEach((varName) => assert(validKebabCaseString(varName), `Invalid filter variable name: ${varName}`));
|
|
1262
1382
|
}
|
|
1263
|
-
/**
|
|
1264
|
-
* @param {object} params
|
|
1265
|
-
* @param {string} [params.action]
|
|
1266
|
-
* @param {boolean} [params.batchModeEnabled]
|
|
1267
|
-
* @param {DataType} [params.dataType]
|
|
1268
|
-
* @param {UiFeature[]} [params.disabledUiFeatures]
|
|
1269
|
-
* @param {boolean} [params.expandNavigator]
|
|
1270
|
-
* @param {string} [params.fileName]
|
|
1271
|
-
* @param {FilterVariables} [params.filter]
|
|
1272
|
-
* @param {GeometryType} [params.geometryType]
|
|
1273
|
-
* @param {boolean} [params.hideMainHeaderAndFooter]
|
|
1274
|
-
* @param {boolean} [params.hideWorkbookToolBar]
|
|
1275
|
-
* @param {GlobalId} [params.highlightGlobalId]
|
|
1276
|
-
* @param {string} [params.labelSet]
|
|
1277
|
-
* @param {WorkbookLayerPath[]} [params.layers]
|
|
1278
|
-
* @param {number} [params.minScale]
|
|
1279
|
-
* @param {OperationMode} [params.operationMode]
|
|
1280
|
-
* @param {TablePart[]} [params.parts]
|
|
1281
|
-
* @param {'MAP'} [params.targetType]
|
|
1282
|
-
* @param {SnappingOptions} [params.snapping]
|
|
1283
|
-
* @param {boolean} [params.useMapSrs]
|
|
1284
|
-
* @param {ExtentStrategy | undefined} [params.validExtentStrategy]
|
|
1285
|
-
* @param {Layout | undefined} [params.layout]
|
|
1286
|
-
* @return {URLSearchParams}
|
|
1287
|
-
*/
|
|
1288
|
-
function createParams({ action, batchModeEnabled, dataType, disabledUiFeatures, expandNavigator, fileName, filter, geometryType, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, labelSet, layers, minScale, operationMode, parts, targetType, snapping, useMapSrs, validExtentStrategy, layout, }) {
|
|
1289
|
-
if (disabledUiFeatures) {
|
|
1290
|
-
disabledUiFeatures.forEach((feature) => assert(validUiFeature(feature), `Invalid UI feature: ${feature}`));
|
|
1291
|
-
}
|
|
1292
|
-
if (filter) {
|
|
1293
|
-
assertValidFilterVariables(filter);
|
|
1294
|
-
}
|
|
1295
|
-
if (geometryType) {
|
|
1296
|
-
assertValidGeometryType(geometryType);
|
|
1297
|
-
}
|
|
1298
|
-
if (operationMode) {
|
|
1299
|
-
assert(validOperationMode(operationMode), `Invalid operation mode: ${operationMode}`);
|
|
1300
|
-
}
|
|
1301
|
-
if (layout) {
|
|
1302
|
-
assert(validLayout(layout), `Invalid layout: ${layout}`);
|
|
1303
|
-
}
|
|
1304
|
-
if (parts) {
|
|
1305
|
-
parts.forEach((part) => assert(validTablePart(part), `Invalid table part: ${part}`));
|
|
1306
|
-
}
|
|
1307
|
-
let locationFinder;
|
|
1308
|
-
let mapExtent;
|
|
1309
|
-
if (validExtentStrategy) {
|
|
1310
|
-
if (validExtentStrategy.type === 'static') {
|
|
1311
|
-
mapExtent = validExtentStrategy.extent;
|
|
1312
|
-
}
|
|
1313
|
-
else if (validExtentStrategy.type === 'locationFinder') {
|
|
1314
|
-
locationFinder = validExtentStrategy.query;
|
|
1315
|
-
}
|
|
1316
|
-
}
|
|
1317
|
-
return new URLSearchParams({
|
|
1318
|
-
...(action && { action }),
|
|
1319
|
-
...(batchModeEnabled && { batchModeEnabled: 'true' }),
|
|
1320
|
-
...(dataType && { dataType }),
|
|
1321
|
-
...(disabledUiFeatures && {
|
|
1322
|
-
disabledUiFeatures: disabledUiFeatures.join(),
|
|
1323
|
-
}),
|
|
1324
|
-
...(expandNavigator && { expandNavigator: 'true' }),
|
|
1325
|
-
...(fileName && { fileName }),
|
|
1326
|
-
...(filter &&
|
|
1327
|
-
Object.fromEntries(Object.entries(filter).map(([variable, value]) => [
|
|
1328
|
-
`filter.${variable}`,
|
|
1329
|
-
JSON.stringify(value instanceof Date ? value.toISOString() : value),
|
|
1330
|
-
]))),
|
|
1331
|
-
...(geometryType && { geometryType }),
|
|
1332
|
-
...(hideMainHeaderAndFooter && { hideMainHeaderAndFooter: 'true' }),
|
|
1333
|
-
...(hideWorkbookToolBar && { hideWorkbookToolBar: 'true' }),
|
|
1334
|
-
...(highlightGlobalId && { highlightGlobalId }),
|
|
1335
|
-
...(labelSet && { labelSet }),
|
|
1336
|
-
...(layers?.length && { layers: JSON.stringify(layers) }),
|
|
1337
|
-
...(locationFinder && { locationFinder }),
|
|
1338
|
-
...(mapExtent && { mapExtent: mapExtent.join() }),
|
|
1339
|
-
...(minScale && { minScale: String(minScale) }),
|
|
1340
|
-
...(operationMode && { operationMode }),
|
|
1341
|
-
...(parts && { parts: parts.join() }),
|
|
1342
|
-
...(snapping && { snappingLayer: JSON.stringify(array(snapping.layer)) }),
|
|
1343
|
-
...(snapping?.types?.length && { snappingTypes: snapping.types.join() }),
|
|
1344
|
-
...(targetType && { targetType }),
|
|
1345
|
-
...(useMapSrs && { useMapSrs: 'true' }),
|
|
1346
|
-
...(layout && { layout }),
|
|
1347
|
-
});
|
|
1348
|
-
}
|
|
1349
1383
|
function array(/** @type unknown */ value) {
|
|
1350
1384
|
return Array.isArray(value) ? value : [value];
|
|
1351
1385
|
}
|
|
@@ -1412,7 +1446,6 @@ function getGeometryTypeFromFeatureCollection(featureCollection) {
|
|
|
1412
1446
|
* | 'editGeometry:ok'
|
|
1413
1447
|
* | 'editGeometry:update'
|
|
1414
1448
|
* | 'editGeometry:cancel'
|
|
1415
|
-
* | 'objectInfo'
|
|
1416
1449
|
* | 'reload'
|
|
1417
1450
|
* | 'selectObjects:ok'
|
|
1418
1451
|
* | 'selectObjects:cancel'
|
|
@@ -1426,7 +1459,6 @@ function getGeometryTypeFromFeatureCollection(featureCollection) {
|
|
|
1426
1459
|
* : T extends 'editGeometry:update' ? CadenzaEditGeometryUpdateEvent
|
|
1427
1460
|
* : T extends 'editGeometry:ok' ? CadenzaEditGeometryOkEvent
|
|
1428
1461
|
* : T extends 'editGeometry:cancel' ? CadenzaEditGeometryCancelEvent
|
|
1429
|
-
* : T extends 'objectInfo' ? CadenzaObjectInfoEvent
|
|
1430
1462
|
* : T extends 'reload' ? CadenzaReloadEvent
|
|
1431
1463
|
* : T extends 'selectObjects:ok' ? CadenzaSelectObjectsOkEvent
|
|
1432
1464
|
* : T extends 'selectObjects:cancel' ? CadenzaSelectObjectsCancelEvent
|
|
@@ -1466,7 +1498,6 @@ function getGeometryTypeFromFeatureCollection(featureCollection) {
|
|
|
1466
1498
|
/** @typedef {CadenzaEvent<'editGeometry:ok', FeatureCollection | Feature>} CadenzaEditGeometryOkEvent - When the user submitted the geometry. `FeatureCollection` if batch editing is enabled. */
|
|
1467
1499
|
/** @typedef {CadenzaEvent<'editGeometry:cancel'>} CadenzaEditGeometryCancelEvent - When the user cancelled the geometry editing. */
|
|
1468
1500
|
/** @typedef {CadenzaEvent<'error', {type: string, message?: string}>} CadenzaErrorEvent - An error event that is mapped to a {@link CadenzaError} */
|
|
1469
|
-
/** @typedef {CadenzaEvent<'objectInfo', {layer: WorkbookLayerPath, objectInfos: {selectionIndex: number, elements: {attributePrintName: string, formattedValue: string}[]}}>} CadenzaObjectInfoEvent - When the user opened the object info flyout. */
|
|
1470
1501
|
/**
|
|
1471
1502
|
* @typedef {CadenzaEvent<'selectObjects:ok', undefined | {layer: WorkbookLayerPath, values: unknown[][]}>} CadenzaSelectObjectsOkEvent - When the user submitted the selection. `undefined` if no objects were selected.
|
|
1472
1503
|
*
|
package/package.json
CHANGED
package/sandbox.html
CHANGED
|
@@ -163,9 +163,9 @@
|
|
|
163
163
|
},
|
|
164
164
|
setFilter: data => cadenzaClient.setFilter(parseFilterVariables(data.filter)),
|
|
165
165
|
setLayerVisibility: data => cadenzaClient.setLayerVisibility(JSON.parse(data.layer), data.visibility === 'on'),
|
|
166
|
-
setSelection: data => cadenzaClient.setSelection(JSON.parse(data.layer), JSON.parse(data.objectIds), {extentStrategy: JSON.parse(data.extentStrategy)}),
|
|
167
|
-
addSelection: data => cadenzaClient.addSelection(JSON.parse(data.layer), JSON.parse(data.objectIds), {
|
|
168
|
-
removeSelection: data => cadenzaClient.removeSelection(JSON.parse(data.layer), JSON.parse(data.objectIds), {
|
|
166
|
+
setSelection: data => cadenzaClient.setSelection(JSON.parse(data.layer), JSON.parse(data.objectIds), data.extentStrategy ? {extentStrategy: JSON.parse(data.extentStrategy) } : {}),
|
|
167
|
+
addSelection: data => cadenzaClient.addSelection(JSON.parse(data.layer), JSON.parse(data.objectIds), data.extentStrategy ? {extentStrategy: JSON.parse(data.extentStrategy) } : {}),
|
|
168
|
+
removeSelection: data => cadenzaClient.removeSelection(JSON.parse(data.layer), JSON.parse(data.objectIds), data.extentStrategy ? {extentStrategy: JSON.parse(data.extentStrategy) } : {}),
|
|
169
169
|
createGeometry: (data, formData) => cadenzaClient.createGeometry(data.embeddingTargetId, data.geometryType, getOptions(data, formData)),
|
|
170
170
|
editGeometry: (data, formData) => cadenzaClient.editGeometry(data.embeddingTargetId, JSON.parse(data.geometry), getOptions(data, formData)),
|
|
171
171
|
batchCreateGeometry: (data , formData) => cadenzaClient.batchCreateGeometry(data.embeddingTargetId, data.geometryType, getOptions(data, formData)),
|
|
@@ -230,6 +230,7 @@
|
|
|
230
230
|
hideMainHeaderAndFooter,
|
|
231
231
|
hideWorkbookToolBar,
|
|
232
232
|
highlightGlobalId,
|
|
233
|
+
includeGeometryValidationReport,
|
|
233
234
|
labelSet,
|
|
234
235
|
layers,
|
|
235
236
|
lengthUnit,
|
|
@@ -238,6 +239,7 @@
|
|
|
238
239
|
requestAsPdf,
|
|
239
240
|
simplifiedOperationMode,
|
|
240
241
|
snappingLayer,
|
|
242
|
+
useAutoCorrection,
|
|
241
243
|
useMapSrs,
|
|
242
244
|
layout,
|
|
243
245
|
width,
|
|
@@ -259,6 +261,7 @@
|
|
|
259
261
|
hideMainHeaderAndFooter: (hideMainHeaderAndFooter === 'on'),
|
|
260
262
|
hideWorkbookToolBar: (hideWorkbookToolBar === 'on'),
|
|
261
263
|
highlightGlobalId,
|
|
264
|
+
includeGeometryValidationReport: (includeGeometryValidationReport === 'on'),
|
|
262
265
|
labelSet,
|
|
263
266
|
layers: layers ? JSON.parse(layers) : undefined,
|
|
264
267
|
minScale: minScale && Number(minScale),
|
|
@@ -268,6 +271,7 @@
|
|
|
268
271
|
layer: JSON.parse(snappingLayer),
|
|
269
272
|
types: formData?.getAll('snappingTypes')
|
|
270
273
|
}: undefined,
|
|
274
|
+
useAutoCorrection: useAutoCorrection === 'on',
|
|
271
275
|
useMapSrs: useMapSrs === 'on',
|
|
272
276
|
layout: layout || undefined,
|
|
273
277
|
width: Number(width),
|
|
@@ -922,6 +926,14 @@
|
|
|
922
926
|
<input type="checkbox" name="useMapSrs">
|
|
923
927
|
Use map SRS
|
|
924
928
|
</label>
|
|
929
|
+
<label>
|
|
930
|
+
<input type="checkbox" name="useAutoCorrection">
|
|
931
|
+
Enable geometry autocorrection
|
|
932
|
+
</label>
|
|
933
|
+
<label>
|
|
934
|
+
<input type="checkbox" name="includeGeometryValidationReport">
|
|
935
|
+
Enable invalid geometries report
|
|
936
|
+
</label>
|
|
925
937
|
</div>
|
|
926
938
|
<div>
|
|
927
939
|
<label for="distance">Buffer size</label>
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>CadenzaObjectInfoEvent | Cadenza JS - v10.4.3</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"><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" aria-hidden="true"><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 - v10.4.3</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" aria-hidden="true"><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="CadenzaObjectInfoEvent.html">CadenzaObjectInfoEvent</a></li></ul><h1>Type Alias CadenzaObjectInfoEvent</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">CadenzaObjectInfoEvent</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/CadenzaEvent.html" class="tsd-signature-type tsd-kind-interface">CadenzaEvent</a><span class="tsd-signature-symbol"><</span><br/> <span class="tsd-signature-type">"objectInfo"</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">layer</span><span class="tsd-signature-symbol">:</span> <a href="WorkbookLayerPath.html" class="tsd-signature-type tsd-kind-type-alias">WorkbookLayerPath</a><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">objectInfos</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">elements</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">attributePrintName</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">formattedValue</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">selectionIndex</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">></span></div><div class="tsd-comment tsd-typography"><p>When the user opened the object info flyout.</p>
|
|
2
|
-
</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/4522c387f7632af2607b88506d17d5838fbb1d77/src/cadenza.js#L1788">src/cadenza.js:1788</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><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-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></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><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 id="tsd-sidebar-links" class="tsd-navigation"><a href="https://github.com/DisyInformationssysteme/cadenza.js" class="tsd-nav-link">Cadenza JS on GitHub</a></nav><nav class="tsd-navigation"><a href="../modules.html">Cadenza JS - v10.4.3</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><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>
|