@disy/cadenza.js 1.5.0 → 1.7.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 +11 -0
- package/README.md +5 -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 +20 -16
- package/apidoc/classes/CadenzaError.html +4 -4
- package/apidoc/functions/cadenza.html +1 -1
- package/apidoc/index.html +3 -3
- package/apidoc/interfaces/CadenzaEvent.html +3 -3
- package/apidoc/interfaces/ExternalLinkKey.html +3 -3
- package/apidoc/interfaces/Geometry.html +2 -2
- package/apidoc/interfaces/PageSource.html +2 -2
- package/apidoc/interfaces/WorkbookKey.html +3 -3
- package/apidoc/interfaces/WorkbookViewKey.html +4 -4
- package/apidoc/interfaces/WorksheetKey.html +4 -4
- package/apidoc/modules.html +2 -1
- package/apidoc/types/CadenzaErrorEvent.html +1 -1
- package/apidoc/types/EmbeddingTargetId.html +1 -1
- package/apidoc/types/Extent.html +1 -1
- package/apidoc/types/FilterVariables.html +2 -0
- package/apidoc/types/GeometryType.html +1 -1
- package/apidoc/types/GlobalId.html +1 -1
- package/apidoc/types/MediaType.html +1 -1
- package/apidoc/types/OperationMode.html +1 -1
- package/apidoc/types/TablePart.html +1 -1
- package/apidoc/types/UiFeature.html +1 -1
- package/apidoc/types/WorkbookSource.html +1 -1
- package/apidoc/types/WorkbookViewSource.html +1 -1
- package/apidoc/types/WorksheetSource.html +1 -1
- package/cadenza.d.ts +15 -2
- package/cadenza.js +25 -6
- package/package.json +1 -1
- package/sandbox.html +123 -157
package/cadenza.d.ts
CHANGED
|
@@ -68,6 +68,9 @@ export function cadenza(baseUrl: string, options?: {
|
|
|
68
68
|
* See {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types}
|
|
69
69
|
*/
|
|
70
70
|
/** @typedef {'columns' | 'values' | 'totals'} TablePart - A part of a table to export. */
|
|
71
|
+
/**
|
|
72
|
+
* @typedef {Record<string, string | number | Date>} FilterVariables - Filter variable values
|
|
73
|
+
*/
|
|
71
74
|
/**
|
|
72
75
|
* _Notes:_
|
|
73
76
|
* * Most public methods can be aborted using an [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal).
|
|
@@ -101,6 +104,8 @@ export class CadenzaClient {
|
|
|
101
104
|
* @param {object} [options]
|
|
102
105
|
* @param {UiFeature[]} [options.disabledUiFeatures] - Cadenza UI features to disable
|
|
103
106
|
* @param {boolean} [options.expandNavigator] - Indicates if the navigator should be expanded.
|
|
107
|
+
* @param {FilterVariables} [options.filter] - Filter variables. The keys should contain the
|
|
108
|
+
* filter variable names and the values the filter variable values.
|
|
104
109
|
* @param {boolean} [options.hideMainHeaderAndFooter] - Whether to hide the main Cadenza header and footer
|
|
105
110
|
* @param {boolean} [options.hideWorkbookToolBar] - Whether to hide the workbook toolbar
|
|
106
111
|
* @param {GlobalId} [options.highlightGlobalId] - The ID of an item to highlight / expand in the navigator
|
|
@@ -112,9 +117,10 @@ export class CadenzaClient {
|
|
|
112
117
|
* @return {Promise<void>} A Promise for when the iframe is loaded
|
|
113
118
|
* @throws For invalid arguments
|
|
114
119
|
*/
|
|
115
|
-
show(source: PageSource | WorkbookSource | WorksheetSource | WorkbookViewSource, { disabledUiFeatures, expandNavigator, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, labelSet, mediaType, operationMode, signal, }?: {
|
|
120
|
+
show(source: PageSource | WorkbookSource | WorksheetSource | WorkbookViewSource, { disabledUiFeatures, expandNavigator, filter, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, labelSet, mediaType, operationMode, signal, }?: {
|
|
116
121
|
disabledUiFeatures?: UiFeature[] | undefined;
|
|
117
122
|
expandNavigator?: boolean | undefined;
|
|
123
|
+
filter?: FilterVariables | undefined;
|
|
118
124
|
hideMainHeaderAndFooter?: boolean | undefined;
|
|
119
125
|
hideWorkbookToolBar?: boolean | undefined;
|
|
120
126
|
highlightGlobalId?: string | undefined;
|
|
@@ -130,6 +136,8 @@ export class CadenzaClient {
|
|
|
130
136
|
* @param {object} [options] - Options
|
|
131
137
|
* @param {UiFeature[]} [options.disabledUiFeatures] - Cadenza UI features to disable
|
|
132
138
|
* @param {boolean} [options.expandNavigator] - Indicates if the navigator should be expanded.
|
|
139
|
+
* @param {FilterVariables} [options.filter] - Filter variables. The keys should contain the
|
|
140
|
+
* filter variable names and the values the filter variable values.
|
|
133
141
|
* @param {Geometry} [options.geometry] - A geometry to show on the map
|
|
134
142
|
* @param {boolean} [options.hideMainHeaderAndFooter] - Whether to hide the main Cadenza header and footer
|
|
135
143
|
* @param {boolean} [options.hideWorkbookToolBar] - Whether to hide the workbook toolbar
|
|
@@ -142,9 +150,10 @@ export class CadenzaClient {
|
|
|
142
150
|
* @return {Promise<void>} A Promise for when the iframe is loaded
|
|
143
151
|
* @throws For invalid arguments
|
|
144
152
|
*/
|
|
145
|
-
showMap(mapView: WorkbookViewSource, { disabledUiFeatures, expandNavigator, geometry, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, locationFinder, mapExtent, operationMode, useMapSrs, signal, }?: {
|
|
153
|
+
showMap(mapView: WorkbookViewSource, { disabledUiFeatures, expandNavigator, filter, geometry, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, locationFinder, mapExtent, operationMode, useMapSrs, signal, }?: {
|
|
146
154
|
disabledUiFeatures?: UiFeature[] | undefined;
|
|
147
155
|
expandNavigator?: boolean | undefined;
|
|
156
|
+
filter?: FilterVariables | undefined;
|
|
148
157
|
geometry?: Geometry | undefined;
|
|
149
158
|
hideMainHeaderAndFooter?: boolean | undefined;
|
|
150
159
|
hideWorkbookToolBar?: boolean | undefined;
|
|
@@ -416,6 +425,10 @@ export type MediaType = string;
|
|
|
416
425
|
* - A part of a table to export.
|
|
417
426
|
*/
|
|
418
427
|
export type TablePart = 'columns' | 'values' | 'totals';
|
|
428
|
+
/**
|
|
429
|
+
* - Filter variable values
|
|
430
|
+
*/
|
|
431
|
+
export type FilterVariables = Record<string, string | number | Date>;
|
|
419
432
|
/**
|
|
420
433
|
* - A Cadenza `postMessage()` event
|
|
421
434
|
*/
|
package/cadenza.js
CHANGED
|
@@ -74,6 +74,9 @@ globalThis.cadenza = Object.assign((/** @type Parameters<cadenza> */ ...args) =>
|
|
|
74
74
|
* See {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types}
|
|
75
75
|
*/
|
|
76
76
|
/** @typedef {'columns' | 'values' | 'totals'} TablePart - A part of a table to export. */
|
|
77
|
+
/**
|
|
78
|
+
* @typedef {Record<string, string | number | Date>} FilterVariables - Filter variable values
|
|
79
|
+
*/
|
|
77
80
|
/**
|
|
78
81
|
* _Notes:_
|
|
79
82
|
* * Most public methods can be aborted using an [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal).
|
|
@@ -149,6 +152,8 @@ export class CadenzaClient {
|
|
|
149
152
|
* @param {object} [options]
|
|
150
153
|
* @param {UiFeature[]} [options.disabledUiFeatures] - Cadenza UI features to disable
|
|
151
154
|
* @param {boolean} [options.expandNavigator] - Indicates if the navigator should be expanded.
|
|
155
|
+
* @param {FilterVariables} [options.filter] - Filter variables. The keys should contain the
|
|
156
|
+
* filter variable names and the values the filter variable values.
|
|
152
157
|
* @param {boolean} [options.hideMainHeaderAndFooter] - Whether to hide the main Cadenza header and footer
|
|
153
158
|
* @param {boolean} [options.hideWorkbookToolBar] - Whether to hide the workbook toolbar
|
|
154
159
|
* @param {GlobalId} [options.highlightGlobalId] - The ID of an item to highlight / expand in the navigator
|
|
@@ -160,7 +165,7 @@ export class CadenzaClient {
|
|
|
160
165
|
* @return {Promise<void>} A Promise for when the iframe is loaded
|
|
161
166
|
* @throws For invalid arguments
|
|
162
167
|
*/
|
|
163
|
-
show(source, { disabledUiFeatures, expandNavigator, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, labelSet, mediaType, operationMode, signal, } = {}) {
|
|
168
|
+
show(source, { disabledUiFeatures, expandNavigator, filter, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, labelSet, mediaType, operationMode, signal, } = {}) {
|
|
164
169
|
this.#log('CadenzaClient#show', source);
|
|
165
170
|
if (mediaType) {
|
|
166
171
|
assertSupportedMediaType(mediaType, [MediaType.PDF]);
|
|
@@ -173,6 +178,7 @@ export class CadenzaClient {
|
|
|
173
178
|
const params = createParams({
|
|
174
179
|
disabledUiFeatures,
|
|
175
180
|
expandNavigator,
|
|
181
|
+
filter,
|
|
176
182
|
hideMainHeaderAndFooter,
|
|
177
183
|
hideWorkbookToolBar,
|
|
178
184
|
highlightGlobalId,
|
|
@@ -190,6 +196,8 @@ export class CadenzaClient {
|
|
|
190
196
|
* @param {object} [options] - Options
|
|
191
197
|
* @param {UiFeature[]} [options.disabledUiFeatures] - Cadenza UI features to disable
|
|
192
198
|
* @param {boolean} [options.expandNavigator] - Indicates if the navigator should be expanded.
|
|
199
|
+
* @param {FilterVariables} [options.filter] - Filter variables. The keys should contain the
|
|
200
|
+
* filter variable names and the values the filter variable values.
|
|
193
201
|
* @param {Geometry} [options.geometry] - A geometry to show on the map
|
|
194
202
|
* @param {boolean} [options.hideMainHeaderAndFooter] - Whether to hide the main Cadenza header and footer
|
|
195
203
|
* @param {boolean} [options.hideWorkbookToolBar] - Whether to hide the workbook toolbar
|
|
@@ -202,7 +210,7 @@ export class CadenzaClient {
|
|
|
202
210
|
* @return {Promise<void>} A Promise for when the iframe is loaded
|
|
203
211
|
* @throws For invalid arguments
|
|
204
212
|
*/
|
|
205
|
-
async showMap(mapView, { disabledUiFeatures, expandNavigator, geometry, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, locationFinder, mapExtent, operationMode, useMapSrs, signal, } = {}) {
|
|
213
|
+
async showMap(mapView, { disabledUiFeatures, expandNavigator, filter, geometry, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, locationFinder, mapExtent, operationMode, useMapSrs, signal, } = {}) {
|
|
206
214
|
this.#log('CadenzaClient#showMap', mapView, geometry);
|
|
207
215
|
if (geometry) {
|
|
208
216
|
assertValidGeometryType(geometry.type);
|
|
@@ -210,6 +218,7 @@ export class CadenzaClient {
|
|
|
210
218
|
const params = createParams({
|
|
211
219
|
disabledUiFeatures,
|
|
212
220
|
expandNavigator,
|
|
221
|
+
filter,
|
|
213
222
|
hideMainHeaderAndFooter,
|
|
214
223
|
hideWorkbookToolBar,
|
|
215
224
|
highlightGlobalId,
|
|
@@ -475,7 +484,7 @@ export class CadenzaClient {
|
|
|
475
484
|
function resolvePath(
|
|
476
485
|
/** @type PageSource | WorkbookSource | WorksheetSource | WorkbookViewSource */ source) {
|
|
477
486
|
if (typeof source === 'string') {
|
|
478
|
-
assert(
|
|
487
|
+
assert(validKebabCaseString(source), `Invalid embedding target ID: ${source}`);
|
|
479
488
|
return `/w/${source}`;
|
|
480
489
|
}
|
|
481
490
|
else if ('page' in source) {
|
|
@@ -518,7 +527,7 @@ function validUrl(/** @type string */ value) {
|
|
|
518
527
|
function validPageName(/** @type string */ value) {
|
|
519
528
|
return ['welcome'].includes(value);
|
|
520
529
|
}
|
|
521
|
-
function
|
|
530
|
+
function validKebabCaseString(/** @type string */ value) {
|
|
522
531
|
return /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(value);
|
|
523
532
|
}
|
|
524
533
|
function validRepositoryName(/** @type string */ value) {
|
|
@@ -578,6 +587,8 @@ function assertSupportedMediaType(
|
|
|
578
587
|
* @param {UiFeature[]} [params.disabledUiFeatures]
|
|
579
588
|
* @param {boolean} [params.expandNavigator]
|
|
580
589
|
* @param {string} [params.fileName]
|
|
590
|
+
* @param {FilterVariables} [params.filter] - Filter variables. The keys should contain the filter
|
|
591
|
+
* variable names and the values the filter variable values.
|
|
581
592
|
* @param {GeometryType} [params.geometryType]
|
|
582
593
|
* @param {boolean} [params.hideMainHeaderAndFooter]
|
|
583
594
|
* @param {boolean} [params.hideWorkbookToolBar]
|
|
@@ -593,7 +604,7 @@ function assertSupportedMediaType(
|
|
|
593
604
|
* @param {ExternalLinkKey} [params.webApplication]
|
|
594
605
|
* @return {URLSearchParams}
|
|
595
606
|
*/
|
|
596
|
-
function createParams({ action, expandNavigator, fileName, geometryType, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, labelSet, locationFinder, mapExtent, mediaType, minScale, parts, useMapSrs, webApplication, operationMode,
|
|
607
|
+
function createParams({ action, disabledUiFeatures, expandNavigator, fileName, filter, geometryType, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, labelSet, locationFinder, mapExtent, mediaType, minScale, parts, useMapSrs, webApplication, operationMode, }) {
|
|
597
608
|
if (disabledUiFeatures) {
|
|
598
609
|
disabledUiFeatures.forEach((feature) => assert(validUiFeature(feature), `Invalid UI feature: ${feature}`));
|
|
599
610
|
}
|
|
@@ -606,6 +617,9 @@ function createParams({ action, expandNavigator, fileName, geometryType, hideMai
|
|
|
606
617
|
if (parts) {
|
|
607
618
|
parts.forEach((part) => assert(validTablePart(part), `Invalid table part: ${part}`));
|
|
608
619
|
}
|
|
620
|
+
if (filter) {
|
|
621
|
+
Object.keys(filter).forEach((varName) => assert(validKebabCaseString(varName), `Invalid filter variable name: ${varName}`));
|
|
622
|
+
}
|
|
609
623
|
return new URLSearchParams({
|
|
610
624
|
...(action && { action }),
|
|
611
625
|
...(disabledUiFeatures && {
|
|
@@ -622,13 +636,18 @@ function createParams({ action, expandNavigator, fileName, geometryType, hideMai
|
|
|
622
636
|
...(mapExtent && { mapExtent: mapExtent.join() }),
|
|
623
637
|
...(mediaType && { mediaType }),
|
|
624
638
|
...(minScale && { minScale: String(minScale) }),
|
|
625
|
-
...(operationMode && { operationMode }),
|
|
639
|
+
...(operationMode && operationMode !== 'normal' && { operationMode }),
|
|
626
640
|
...(parts && { parts: parts.join() }),
|
|
627
641
|
...(useMapSrs && { useMapSrs: 'true' }),
|
|
628
642
|
...(webApplication && {
|
|
629
643
|
webApplicationLink: webApplication.externalLinkId,
|
|
630
644
|
webApplicationLinkRepository: webApplication.repositoryName,
|
|
631
645
|
}),
|
|
646
|
+
...(filter &&
|
|
647
|
+
Object.fromEntries(Object.entries(filter).map(([variable, value]) => [
|
|
648
|
+
`filter.${variable}`,
|
|
649
|
+
JSON.stringify(value instanceof Date ? value.toISOString() : value),
|
|
650
|
+
]))),
|
|
632
651
|
});
|
|
633
652
|
}
|
|
634
653
|
/**
|
package/package.json
CHANGED
package/sandbox.html
CHANGED
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
label {
|
|
42
42
|
font-weight: 600;
|
|
43
43
|
}
|
|
44
|
-
select, input:is(:not([type]), [type=text], [type=number]), textarea {
|
|
44
|
+
select, input:is(:not([type]), [type=text], [type=number]), textarea, hr {
|
|
45
45
|
display: block;
|
|
46
46
|
width: 100%
|
|
47
47
|
}
|
|
@@ -57,6 +57,12 @@
|
|
|
57
57
|
const action = actionSelect.value;
|
|
58
58
|
const settingsTemplate = document.querySelector(`[data-action=${action}]`);
|
|
59
59
|
settingsContainer.append(settingsTemplate.content.cloneNode(true));
|
|
60
|
+
const commonSettingsTemplate = document.getElementById(`common-${settingsTemplate.dataset.common}`);
|
|
61
|
+
if (commonSettingsTemplate) {
|
|
62
|
+
settingsContainer.append(
|
|
63
|
+
document.createElement('hr'),
|
|
64
|
+
commonSettingsTemplate.content.cloneNode(true));
|
|
65
|
+
}
|
|
60
66
|
|
|
61
67
|
const data = localStorage.getItem(`cadenzajs-sandbox-${action}`);
|
|
62
68
|
if (data) {
|
|
@@ -68,67 +74,21 @@
|
|
|
68
74
|
history.replaceState(null, '', url);
|
|
69
75
|
};
|
|
70
76
|
|
|
71
|
-
const contextPath = new URLSearchParams(location.search).get('contextPath')
|
|
77
|
+
const contextPath = new URLSearchParams(location.search).get('contextPath')
|
|
78
|
+
?? location.pathname.slice(0, location.pathname.indexOf('/sandbox'));
|
|
72
79
|
const cadenzaClient = cadenza(location.origin + contextPath, { iframe: 'iframe', debug: true });
|
|
73
80
|
const actionHandlers = {
|
|
74
|
-
show (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
...(operationMode === 'on' && { operationMode: 'normal' }),
|
|
82
|
-
disabledUiFeatures: disabledUiFeatures && disabledUiFeatures.split(',')
|
|
83
|
-
});
|
|
84
|
-
},
|
|
85
|
-
showPage ({ page, expandNavigator, highlightGlobalId, labelSet }) {
|
|
86
|
-
cadenzaClient.show({ page: page }, {
|
|
87
|
-
expandNavigator: (expandNavigator === 'on'),
|
|
88
|
-
highlightGlobalId,
|
|
89
|
-
labelSet
|
|
90
|
-
});
|
|
91
|
-
},
|
|
92
|
-
expandNavigator ({ expandNavigator }) {
|
|
93
|
-
cadenzaClient.expandNavigator(expandNavigator === 'on');
|
|
94
|
-
},
|
|
95
|
-
showMap ({ embeddingTargetId, useMapSrs, geometry, mapExtent, locationFinder, highlightGlobalId }) {
|
|
96
|
-
cadenzaClient.showMap(embeddingTargetId, {
|
|
97
|
-
useMapSrs: useMapSrs === 'on',
|
|
98
|
-
geometry: geometry && JSON.parse(geometry),
|
|
99
|
-
mapExtent: mapExtent && mapExtent.split(','),
|
|
100
|
-
locationFinder,
|
|
101
|
-
highlightGlobalId
|
|
102
|
-
});
|
|
103
|
-
},
|
|
104
|
-
createGeometry ({ embeddingTargetId, geometryType, useMapSrs, minScale, mapExtent, locationFinder }) {
|
|
105
|
-
cadenzaClient.createGeometry(embeddingTargetId, geometryType, {
|
|
106
|
-
useMapSrs: useMapSrs === 'on',
|
|
107
|
-
minScale,
|
|
108
|
-
mapExtent: mapExtent && mapExtent.split(','),
|
|
109
|
-
locationFinder
|
|
110
|
-
});
|
|
111
|
-
},
|
|
112
|
-
editGeometry ({ embeddingTargetId, geometry, useMapSrs, minScale, mapExtent, locationFinder }) {
|
|
113
|
-
cadenzaClient.editGeometry(embeddingTargetId, JSON.parse(geometry), {
|
|
114
|
-
useMapSrs: useMapSrs === 'on',
|
|
115
|
-
minScale,
|
|
116
|
-
mapExtent: mapExtent && mapExtent.split(','),
|
|
117
|
-
locationFinder
|
|
118
|
-
});
|
|
119
|
-
},
|
|
120
|
-
fetchData ({ embeddingTargetId, mediaType, parts }) {
|
|
81
|
+
show: data => cadenzaClient.show(data.embeddingTargetId, getOptions(data)),
|
|
82
|
+
showPage: data => cadenzaClient.show({ page: data.page }, getOptions(data)),
|
|
83
|
+
expandNavigator: data => cadenzaClient.expandNavigator(data.expandNavigator === 'on'),
|
|
84
|
+
showMap: data => cadenzaClient.showMap(data.embeddingTargetId, getOptions(data)),
|
|
85
|
+
createGeometry: data => cadenzaClient.createGeometry(data.embeddingTargetId, data.geometryType, getOptions(data)),
|
|
86
|
+
editGeometry: data => cadenzaClient.editGeometry(data.embeddingTargetId, JSON.parse(data.geometry), getOptions(data)),
|
|
87
|
+
fetchData: data => {
|
|
121
88
|
console.log('Inspect the fetchData() request in the devtools.');
|
|
122
|
-
cadenzaClient.fetchData(embeddingTargetId, mediaType,
|
|
123
|
-
parts: parts && parts.split(',')
|
|
124
|
-
});
|
|
89
|
+
cadenzaClient.fetchData(data.embeddingTargetId, data.mediaType, getOptions(data));
|
|
125
90
|
},
|
|
126
|
-
downloadData (
|
|
127
|
-
cadenzaClient.downloadData(embeddingTargetId, mediaType, {
|
|
128
|
-
fileName,
|
|
129
|
-
parts: parts && parts.split(',')
|
|
130
|
-
});
|
|
131
|
-
}
|
|
91
|
+
downloadData: data => cadenzaClient.downloadData(data.embeddingTargetId, data.mediaType, getOptions(data))
|
|
132
92
|
};
|
|
133
93
|
|
|
134
94
|
const form = document.getElementById('form');
|
|
@@ -154,6 +114,54 @@
|
|
|
154
114
|
}
|
|
155
115
|
}
|
|
156
116
|
}
|
|
117
|
+
|
|
118
|
+
function getOptions ({
|
|
119
|
+
disabledUiFeatures,
|
|
120
|
+
expandNavigator,
|
|
121
|
+
geometry,
|
|
122
|
+
hideMainHeaderAndFooter,
|
|
123
|
+
hideWorkbookToolBar,
|
|
124
|
+
highlightGlobalId,
|
|
125
|
+
jasperReportAsPdf,
|
|
126
|
+
labelSet,
|
|
127
|
+
locationFinder,
|
|
128
|
+
mapExtent,
|
|
129
|
+
minScale,
|
|
130
|
+
parts,
|
|
131
|
+
simplifiedOperationMode,
|
|
132
|
+
useMapSrs,
|
|
133
|
+
filter
|
|
134
|
+
}) {
|
|
135
|
+
return {
|
|
136
|
+
disabledUiFeatures: disabledUiFeatures && disabledUiFeatures.split(','),
|
|
137
|
+
expandNavigator: (expandNavigator === 'on'),
|
|
138
|
+
geometry: geometry && JSON.parse(geometry),
|
|
139
|
+
hideMainHeaderAndFooter: (hideMainHeaderAndFooter === 'on'),
|
|
140
|
+
hideWorkbookToolBar: (hideWorkbookToolBar === 'on'),
|
|
141
|
+
highlightGlobalId,
|
|
142
|
+
...(jasperReportAsPdf === 'on' && { mediaType: 'application/pdf' }),
|
|
143
|
+
labelSet,
|
|
144
|
+
locationFinder,
|
|
145
|
+
mapExtent: mapExtent && mapExtent.split(','),
|
|
146
|
+
minScale,
|
|
147
|
+
parts: parts && parts.split(','),
|
|
148
|
+
...(simplifiedOperationMode === 'on' && { operationMode: 'simplified' }),
|
|
149
|
+
useMapSrs: useMapSrs === 'on',
|
|
150
|
+
filter: filter && parseFilterVariables(filter)
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function parseFilterVariables (filterString) {
|
|
155
|
+
return JSON.parse(filterString, (_, value) => {
|
|
156
|
+
if (value === '{{currentDate}}') { // convenience for current date
|
|
157
|
+
return new Date();
|
|
158
|
+
}
|
|
159
|
+
if (value.match?.(/....-..-..T..:..:..\....Z/)) {
|
|
160
|
+
return new Date(value);
|
|
161
|
+
}
|
|
162
|
+
return value;
|
|
163
|
+
});
|
|
164
|
+
}
|
|
157
165
|
</script>
|
|
158
166
|
</head>
|
|
159
167
|
<body>
|
|
@@ -185,17 +193,7 @@
|
|
|
185
193
|
<iframe id="iframe"></iframe>
|
|
186
194
|
</main>
|
|
187
195
|
|
|
188
|
-
<template
|
|
189
|
-
<div>
|
|
190
|
-
<label for="embeddingTargetId">Embedding target ID *</label>
|
|
191
|
-
<input name="embeddingTargetId" id="embeddingTargetId" required>
|
|
192
|
-
</div>
|
|
193
|
-
<div>
|
|
194
|
-
<label>
|
|
195
|
-
<input type="checkbox" name="jasperReportAsPdf" id="jasperReportAsPdf"/>
|
|
196
|
-
Show Jasper Report as PDF
|
|
197
|
-
</label>
|
|
198
|
-
</div>
|
|
196
|
+
<template id="common-show">
|
|
199
197
|
<div>
|
|
200
198
|
<label>
|
|
201
199
|
<input type="checkbox" name="expandNavigator">
|
|
@@ -216,8 +214,8 @@
|
|
|
216
214
|
</div>
|
|
217
215
|
<div>
|
|
218
216
|
<label>
|
|
219
|
-
<input type="checkbox" name="
|
|
220
|
-
|
|
217
|
+
<input type="checkbox" name="simplifiedOperationMode">
|
|
218
|
+
Simplified operation mode
|
|
221
219
|
</label>
|
|
222
220
|
</div>
|
|
223
221
|
<div>
|
|
@@ -228,25 +226,65 @@
|
|
|
228
226
|
<label for="disabledUiFeatures">Disabled UI features</label>
|
|
229
227
|
<input name="disabledUiFeatures" id="disabledUiFeatures" placeholder="feature1,feature2...">
|
|
230
228
|
</div>
|
|
229
|
+
<div>
|
|
230
|
+
<label for="filter">Filter</label>
|
|
231
|
+
<input name="filter" id="filter" placeholder='{ "textvar": "foo", "numbervar": 42.0, "datevar1": "2000-01-01T00.000Z", "datevar2": "{{currentDate}}" }'>
|
|
232
|
+
</div>
|
|
231
233
|
</template>
|
|
232
234
|
|
|
233
|
-
<template
|
|
235
|
+
<template id="common-map">
|
|
234
236
|
<div>
|
|
235
|
-
<label
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
<label>
|
|
238
|
+
<input type="checkbox" name="useMapSrs">
|
|
239
|
+
Use map SRS
|
|
240
|
+
</label>
|
|
241
|
+
</div>
|
|
242
|
+
<div>
|
|
243
|
+
<label for="mapExtent">Map extent coordinates</label>
|
|
244
|
+
<input name="mapExtent" id="mapExtent" placeholder="minX,minY,maxX,maxY">
|
|
245
|
+
</div>
|
|
246
|
+
<div>
|
|
247
|
+
<label for="locationFinder">Location finder search query</label>
|
|
248
|
+
<input name="locationFinder" id="locationFinder">
|
|
249
|
+
</div>
|
|
250
|
+
</template>
|
|
251
|
+
|
|
252
|
+
<template id="common-data">
|
|
253
|
+
<div>
|
|
254
|
+
<label for="mediaType">Media type *</label>
|
|
255
|
+
<select name="mediaType" id="mediaType" required>
|
|
256
|
+
<option>text/csv</option>
|
|
257
|
+
<option>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</option>
|
|
258
|
+
<option>application/json</option>
|
|
259
|
+
<option>application/pdf</option>
|
|
239
260
|
</select>
|
|
240
261
|
</div>
|
|
262
|
+
<div>
|
|
263
|
+
<label for="parts">Parts</label>
|
|
264
|
+
<input name="parts" id="parts" placeholder="columns,values,totals">
|
|
265
|
+
</div>
|
|
266
|
+
</template>
|
|
267
|
+
|
|
268
|
+
<template data-action="show" data-common="show">
|
|
269
|
+
<div>
|
|
270
|
+
<label for="embeddingTargetId">Embedding target ID *</label>
|
|
271
|
+
<input name="embeddingTargetId" id="embeddingTargetId" required>
|
|
272
|
+
</div>
|
|
241
273
|
<div>
|
|
242
274
|
<label>
|
|
243
|
-
<input type="checkbox" name="
|
|
244
|
-
|
|
275
|
+
<input type="checkbox" name="jasperReportAsPdf" id="jasperReportAsPdf"/>
|
|
276
|
+
Show Jasper Report as PDF
|
|
245
277
|
</label>
|
|
246
278
|
</div>
|
|
279
|
+
</template>
|
|
280
|
+
|
|
281
|
+
<template data-action="showPage" data-common="show">
|
|
247
282
|
<div>
|
|
248
|
-
<label for="
|
|
249
|
-
<
|
|
283
|
+
<label for="page">Page *</label>
|
|
284
|
+
<select name="page" id="page" required>
|
|
285
|
+
<option>welcome</option>
|
|
286
|
+
<option>an-invalid-page-name</option>
|
|
287
|
+
</select>
|
|
250
288
|
</div>
|
|
251
289
|
<div>
|
|
252
290
|
<label for="labelSet">Label Set</label>
|
|
@@ -263,46 +301,22 @@
|
|
|
263
301
|
</div>
|
|
264
302
|
</template>
|
|
265
303
|
|
|
266
|
-
<template data-action="showMap">
|
|
304
|
+
<template data-action="showMap" data-common="show">
|
|
267
305
|
<div>
|
|
268
306
|
<label for="embeddingTargetId">Embedding target ID of the map view *</label>
|
|
269
307
|
<input name="embeddingTargetId" id="embeddingTargetId" required>
|
|
270
308
|
</div>
|
|
271
|
-
<div>
|
|
272
|
-
<label>
|
|
273
|
-
<input type="checkbox" name="useMapSrs">
|
|
274
|
-
Use map SRS
|
|
275
|
-
</label>
|
|
276
|
-
</div>
|
|
277
309
|
<div>
|
|
278
310
|
<label for="geometry">Geometry (GeoJSON)</label>
|
|
279
311
|
<textarea name="geometry" id="geometry" rows="5"></textarea>
|
|
280
312
|
</div>
|
|
281
|
-
<div>
|
|
282
|
-
<label for="mapExtent">Map extent coordinates</label>
|
|
283
|
-
<input name="mapExtent" id="mapExtent" placeholder="minX,minY,maxX,maxY">
|
|
284
|
-
</div>
|
|
285
|
-
<div>
|
|
286
|
-
<label for="locationFinder">Location finder search query</label>
|
|
287
|
-
<input name="locationFinder" id="locationFinder">
|
|
288
|
-
</div>
|
|
289
|
-
<div>
|
|
290
|
-
<label for="highlightGlobalId">Highlighted Global ID</label>
|
|
291
|
-
<input name="highlightGlobalId" id="highlightGlobalId">
|
|
292
|
-
</div>
|
|
293
313
|
</template>
|
|
294
314
|
|
|
295
|
-
<template data-action="createGeometry">
|
|
315
|
+
<template data-action="createGeometry" data-common="map">
|
|
296
316
|
<div>
|
|
297
317
|
<label for="embeddingTargetId">Embedding target ID of the map view *</label>
|
|
298
318
|
<input name="embeddingTargetId" id="embeddingTargetId" required>
|
|
299
319
|
</div>
|
|
300
|
-
<div>
|
|
301
|
-
<label>
|
|
302
|
-
<input type="checkbox" name="useMapSrs">
|
|
303
|
-
Use map SRS
|
|
304
|
-
</label>
|
|
305
|
-
</div>
|
|
306
320
|
<div>
|
|
307
321
|
<label for="geometryType">Geometry type</label>
|
|
308
322
|
<select name="geometryType" id="geometryType">
|
|
@@ -318,27 +332,13 @@
|
|
|
318
332
|
<label for="minScale">Minimum Scale</label>
|
|
319
333
|
<input type="number" name="minScale" id="minScale">
|
|
320
334
|
</div>
|
|
321
|
-
<div>
|
|
322
|
-
<label for="mapExtent">Map extent coordinates</label>
|
|
323
|
-
<input name="mapExtent" id="mapExtent" placeholder="minX,minY,maxX,maxY">
|
|
324
|
-
</div>
|
|
325
|
-
<div>
|
|
326
|
-
<label for="locationFinder">Location finder search query</label>
|
|
327
|
-
<input name="locationFinder" id="locationFinder">
|
|
328
|
-
</div>
|
|
329
335
|
</template>
|
|
330
336
|
|
|
331
|
-
<template data-action="editGeometry">
|
|
337
|
+
<template data-action="editGeometry" data-common="map">
|
|
332
338
|
<div>
|
|
333
339
|
<label for="embeddingTargetId">Embedding target ID of the map view *</label>
|
|
334
340
|
<input name="embeddingTargetId" id="embeddingTargetId" required>
|
|
335
341
|
</div>
|
|
336
|
-
<div>
|
|
337
|
-
<label>
|
|
338
|
-
<input type="checkbox" name="useMapSrs">
|
|
339
|
-
Use map SRS
|
|
340
|
-
</label>
|
|
341
|
-
</div>
|
|
342
342
|
<div>
|
|
343
343
|
<label for="geometry">Geometry (GeoJSON) *</label>
|
|
344
344
|
<textarea name="geometry" id="geometry" rows="5" required></textarea>
|
|
@@ -347,58 +347,24 @@
|
|
|
347
347
|
<label for="minScale">Minimum Scale</label>
|
|
348
348
|
<input type="number" name="minScale" id="minScale">
|
|
349
349
|
</div>
|
|
350
|
-
<div>
|
|
351
|
-
<label for="mapExtent">Map extent coordinates</label>
|
|
352
|
-
<input name="mapExtent" id="mapExtent" placeholder="minX,minY,maxX,maxY">
|
|
353
|
-
</div>
|
|
354
|
-
<div>
|
|
355
|
-
<label for="locationFinder">Location finder search query</label>
|
|
356
|
-
<input name="locationFinder" id="locationFinder">
|
|
357
|
-
</div>
|
|
358
350
|
</template>
|
|
359
351
|
|
|
360
|
-
<template data-action="downloadData">
|
|
352
|
+
<template data-action="downloadData" data-common="data">
|
|
361
353
|
<div>
|
|
362
354
|
<label for="embeddingTargetId">Embedding target ID *</label>
|
|
363
355
|
<input name="embeddingTargetId" id="embeddingTargetId" required>
|
|
364
356
|
</div>
|
|
365
|
-
<div>
|
|
366
|
-
<label for="parts">Parts</label>
|
|
367
|
-
<input name="parts" id="parts" placeholder="columns,values,totals">
|
|
368
|
-
</div>
|
|
369
|
-
<div>
|
|
370
|
-
<label for="mediaType">Media type *</label>
|
|
371
|
-
<select name="mediaType" id="mediaType" required>
|
|
372
|
-
<option>text/csv</option>
|
|
373
|
-
<option>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</option>
|
|
374
|
-
<option>application/json</option>
|
|
375
|
-
<option>application/pdf</option>
|
|
376
|
-
</select>
|
|
377
|
-
</div>
|
|
378
357
|
<div>
|
|
379
358
|
<label for="fileName">Filename</label>
|
|
380
359
|
<input name="fileName" id="fileName">
|
|
381
360
|
</div>
|
|
382
361
|
</template>
|
|
383
362
|
|
|
384
|
-
<template data-action="fetchData">
|
|
363
|
+
<template data-action="fetchData" data-common="data">
|
|
385
364
|
<div>
|
|
386
365
|
<label for="embeddingTargetId">Embedding target ID *</label>
|
|
387
366
|
<input name="embeddingTargetId" id="embeddingTargetId" required>
|
|
388
367
|
</div>
|
|
389
|
-
<div>
|
|
390
|
-
<label for="parts">Parts</label>
|
|
391
|
-
<input name="parts" id="parts" placeholder="columns,values,totals">
|
|
392
|
-
</div>
|
|
393
|
-
<div>
|
|
394
|
-
<label for="mediaType">Media type *</label>
|
|
395
|
-
<select name="mediaType" id="mediaType" required>
|
|
396
|
-
<option>text/csv</option>
|
|
397
|
-
<option>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</option>
|
|
398
|
-
<option>application/json</option>
|
|
399
|
-
<option>application/pdf</option>
|
|
400
|
-
</select>
|
|
401
|
-
</div>
|
|
402
368
|
</template>
|
|
403
369
|
|
|
404
370
|
</body>
|