@geogirafe/lib-geoportal 1.3.0-dev.3119861801 → 1.3.0-dev.3122808085
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/api/apigeogirafeapp.d.ts +1 -0
- package/api/apigeogirafeapp.js +5 -7
- package/base/GirafeHTMLElement.d.ts +1 -0
- package/base/GirafeHTMLElement.js +12 -1
- package/base/GirafeSingleton.d.ts +1 -0
- package/base/GirafeSingleton.js +18 -1
- package/components/addbookmark/component.js +1 -2
- package/components/drawing/component.js +2 -3
- package/components/edit/component.d.ts +1 -0
- package/components/edit/component.js +4 -2
- package/components/feedbackbutton/component.d.ts +0 -1
- package/components/feedbackbutton/component.js +0 -3
- package/components/getdirections/component.js +1 -0
- package/components/help/component.js +1 -2
- package/components/map-2d/component.d.ts +1 -0
- package/components/map-2d/component.js +19 -21
- package/components/map-3d/component.d.ts +1 -0
- package/components/map-3d/component.js +5 -7
- package/components/news/news-button/component.d.ts +1 -1
- package/components/search/component.d.ts +1 -0
- package/components/search/component.js +3 -5
- package/components/selectiongrid/tools/selectiontabulatormanager.js +3 -6
- package/components/selectiontool/component.d.ts +1 -1
- package/components/share-mobile/component.js +1 -0
- package/components/userpreferences/component.d.ts +1 -0
- package/components/userpreferences/component.js +8 -10
- package/main.js +0 -1
- package/package.json +1 -1
- package/templates/index.html +2 -1
- package/templates/public/about.json +1 -1
- package/templates/public/config.desktop.json +22 -0
- package/templates/public/config.json +0 -20
- package/tools/app/lifecyclemanager.d.ts +2 -0
- package/tools/app/lifecyclemanager.js +18 -7
- package/tools/context/contexthelper.js +1 -1
- package/tools/feedback/feedbackmanager.d.ts +1 -1
- package/tools/feedback/feedbackmanager.js +1 -2
- package/tools/main.d.ts +0 -1
- package/tools/main.js +0 -1
- package/tools/onboarding/onboardingmanager.d.ts +1 -0
- package/tools/onboarding/onboardingmanager.js +12 -7
- package/tools/state/statemanager.js +3 -3
- package/tools/tests/mockcontext.d.ts +1 -0
- package/tools/tests/mockcontext.js +10 -2
- package/tools/tests/mockhelper.js +2 -1
- package/tools/themes/themefavoritesmanager.d.ts +1 -1
- package/tools/themes/themefavoritesmanager.js +1 -2
- package/tools/utils/async.d.ts +0 -1
- package/tools/utils/async.js +0 -1
package/api/apigeogirafeapp.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export default class GeoGirafeApi extends GirafeHTMLElement {
|
|
|
8
8
|
constructor();
|
|
9
9
|
private get config();
|
|
10
10
|
protected connectedCallback(): void;
|
|
11
|
+
protected applicationIsReady(): void;
|
|
11
12
|
static get observedAttributes(): string[];
|
|
12
13
|
protected attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
13
14
|
protected getInheritedContext(): IGirafeContext;
|
package/api/apigeogirafeapp.js
CHANGED
|
@@ -57,16 +57,14 @@ ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
|
57
57
|
this.initialize().then(() => {
|
|
58
58
|
console.log('GeoGirafe API is ready!');
|
|
59
59
|
this.defineApiComponents();
|
|
60
|
-
this.subscribe('application.isReady', (_, isLoaded) => {
|
|
61
|
-
if (isLoaded) {
|
|
62
|
-
this.manageAttributes();
|
|
63
|
-
this.isInitialized = true;
|
|
64
|
-
this.dispatchEvent(new CustomEvent('geogirafe-api-ready'));
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
60
|
this.render();
|
|
68
61
|
});
|
|
69
62
|
}
|
|
63
|
+
applicationIsReady() {
|
|
64
|
+
this.manageAttributes();
|
|
65
|
+
this.isInitialized = true;
|
|
66
|
+
this.dispatchEvent(new CustomEvent('geogirafe-api-ready'));
|
|
67
|
+
}
|
|
70
68
|
static get observedAttributes() {
|
|
71
69
|
return ['center', 'zoom', 'basemap', 'basemapselector', 'crosshair', 'tooltip', 'markers', 'markersfile', 'layers'];
|
|
72
70
|
}
|
|
@@ -123,6 +123,7 @@ declare abstract class GirafeHTMLElement extends HTMLElement {
|
|
|
123
123
|
protected unsubscribe(callback: Callback): void;
|
|
124
124
|
protected unsubscribe(callbacks: Callback[]): void;
|
|
125
125
|
protected connectedCallback(): void;
|
|
126
|
+
protected applicationIsReady(): void;
|
|
126
127
|
/**
|
|
127
128
|
* When the component is disconnected from the DOM
|
|
128
129
|
* all the callbacks will be unregistered
|
|
@@ -131,7 +131,7 @@ class GirafeHTMLElement extends HTMLElement {
|
|
|
131
131
|
// Otherwise, this cause unwanted effects like delay when updating templates
|
|
132
132
|
uRender(this.shadow, this.template);
|
|
133
133
|
if (this.context.stateManager.state.interface.isApi) {
|
|
134
|
-
// For the API, we must ensure that URLs are not relative to the
|
|
134
|
+
// For the API, we must ensure that URLs are not relative to the current page
|
|
135
135
|
// But relative to the page where they are imported from (import.meta.url)
|
|
136
136
|
updateRessourcesPaths(this.shadow);
|
|
137
137
|
}
|
|
@@ -280,6 +280,17 @@ class GirafeHTMLElement extends HTMLElement {
|
|
|
280
280
|
this.subscribe('language', () => this.girafeTranslate());
|
|
281
281
|
this.subscribe('oauth.userInfo', () => this.userInfoChanged());
|
|
282
282
|
this.subscribe('interface.fullscreenMode', (_oldValue, newValue) => this.onFullscreenModeChanged(newValue));
|
|
283
|
+
this.subscribe('application.isReady', (_, isReady) => {
|
|
284
|
+
if (isReady) {
|
|
285
|
+
this.applicationIsReady();
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
applicationIsReady() {
|
|
290
|
+
/*
|
|
291
|
+
* This method does nothing by default, but can be overriden by singletons to add custom code
|
|
292
|
+
* That will be executed when the applciation is ready
|
|
293
|
+
*/
|
|
283
294
|
}
|
|
284
295
|
/**
|
|
285
296
|
* When the component is disconnected from the DOM
|
|
@@ -3,6 +3,7 @@ declare class GirafeSingleton {
|
|
|
3
3
|
protected readonly context: IGirafeContext;
|
|
4
4
|
constructor(context: IGirafeContext);
|
|
5
5
|
initializeSingleton(): Promise<void>;
|
|
6
|
+
protected applicationIsReady(): Promise<void>;
|
|
6
7
|
protected isNullOrUndefinedOrBlank(val: unknown): val is "" | null | undefined;
|
|
7
8
|
}
|
|
8
9
|
export default GirafeSingleton;
|
package/base/GirafeSingleton.js
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
// TODO REG: Transform to interface
|
|
2
1
|
class GirafeSingleton {
|
|
3
2
|
context;
|
|
4
3
|
constructor(context) {
|
|
5
4
|
this.context = context;
|
|
5
|
+
// At this point, the state manager is not initialized for all singletons
|
|
6
|
+
// Because the stateManager depends on other singletons
|
|
7
|
+
if (this.context.stateManager) {
|
|
8
|
+
this.context.stateManager.subscribe('application.isReady', (_, isReady) => {
|
|
9
|
+
if (isReady) {
|
|
10
|
+
void this.applicationIsReady();
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
console.debug(`The StateManager is not initialized yet. Cannot call applicationIsReady() for ${this.constructor.name}.`);
|
|
16
|
+
}
|
|
6
17
|
}
|
|
7
18
|
async initializeSingleton() {
|
|
8
19
|
/*
|
|
@@ -10,6 +21,12 @@ class GirafeSingleton {
|
|
|
10
21
|
* (This prevent overriding the constructor in every songleton and creating a strong dependency to the context object)
|
|
11
22
|
*/
|
|
12
23
|
}
|
|
24
|
+
async applicationIsReady() {
|
|
25
|
+
/*
|
|
26
|
+
* This method does nothing by default, but can be overriden by singletons to add custom code
|
|
27
|
+
* That will be executed when the application is ready
|
|
28
|
+
*/
|
|
29
|
+
}
|
|
13
30
|
isNullOrUndefinedOrBlank(val) {
|
|
14
31
|
return val === undefined || val === null || val === '';
|
|
15
32
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { html as uHtml } from 'uhtml';
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import GirafeHTMLElement from '../../base/GirafeHTMLElement.js';
|
|
4
|
-
import { noop } from '../../tools/utils/async.js';
|
|
5
4
|
class AddBookmarkComponent extends GirafeHTMLElement {
|
|
6
5
|
templateUrl = null;
|
|
7
6
|
styleUrls = null;
|
|
@@ -88,7 +87,7 @@ ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
|
88
87
|
const addBookmarkShortcutPressed = event.key === 'd' && ((!this.isMac && event.ctrlKey) || (this.isMac && event.metaKey));
|
|
89
88
|
if (addBookmarkShortcutPressed && !this.showingModal) {
|
|
90
89
|
event.preventDefault();
|
|
91
|
-
this.addBookmark()
|
|
90
|
+
void this.addBookmark();
|
|
92
91
|
}
|
|
93
92
|
}
|
|
94
93
|
}
|
|
@@ -25,7 +25,6 @@ import visibleIcon from './assets/visible.svg?raw';
|
|
|
25
25
|
import notVisibleIcon from './assets/notVisible.svg?raw';
|
|
26
26
|
import LayerDrawing from '../../models/layers/layerdrawing.js';
|
|
27
27
|
import { UsedInTemplateOnly } from '../../decorators.js';
|
|
28
|
-
import { noop } from '../../tools/utils/async.js';
|
|
29
28
|
export const DrawingStateLocation = 'drawing';
|
|
30
29
|
export default class DrawingComponent extends GirafeHTMLElement {
|
|
31
30
|
templateUrl = null;
|
|
@@ -296,7 +295,7 @@ ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
|
296
295
|
if (this.isPanelVisible == visible)
|
|
297
296
|
return;
|
|
298
297
|
if (this.activeDrawingLayer?.removalRequested) {
|
|
299
|
-
this.deleteAllFeatures()
|
|
298
|
+
void this.deleteAllFeatures();
|
|
300
299
|
}
|
|
301
300
|
this.isPanelVisible = visible;
|
|
302
301
|
if (this.isPanelVisible) {
|
|
@@ -518,7 +517,7 @@ ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
|
518
517
|
}
|
|
519
518
|
onRemovalRequested(_oldValue, value, parents) {
|
|
520
519
|
if (value === true && parents.removalRequested) {
|
|
521
|
-
this.deleteAllFeatures()
|
|
520
|
+
void this.deleteAllFeatures();
|
|
522
521
|
}
|
|
523
522
|
}
|
|
524
523
|
}
|
|
@@ -75,5 +75,6 @@ export default class EditComponent extends GirafeHTMLElement implements IGirafeP
|
|
|
75
75
|
* see https://gitlab.com/geogirafe/gg-viewer/-/work_items/966
|
|
76
76
|
*/
|
|
77
77
|
private controlToolbarButtonVisibility;
|
|
78
|
+
protected applicationIsReady(): void;
|
|
78
79
|
protected connectedCallback(): void;
|
|
79
80
|
}
|
|
@@ -402,9 +402,7 @@ ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
|
402
402
|
}
|
|
403
403
|
registerEvents() {
|
|
404
404
|
this.subscribe('oauth.status', () => void this.collectEditableLayers());
|
|
405
|
-
this.subscribe('application.isReady', () => void this.collectEditableLayers());
|
|
406
405
|
this.subscribe(/layers\.layersList\..*\.activeState/, () => this.filterLayerListByLayersInTree());
|
|
407
|
-
this.subscribe('projection', () => (this.state.application.isReady ? void this.setLayer(this.layer) : undefined));
|
|
408
406
|
this.subscribe('editing.layer', (_, layer) => this.onLayerSelectedInTree(layer));
|
|
409
407
|
}
|
|
410
408
|
/**
|
|
@@ -425,6 +423,10 @@ ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
|
425
423
|
}
|
|
426
424
|
});
|
|
427
425
|
}
|
|
426
|
+
applicationIsReady() {
|
|
427
|
+
void this.collectEditableLayers();
|
|
428
|
+
this.subscribe('projection', () => this.setLayer(this.layer));
|
|
429
|
+
}
|
|
428
430
|
connectedCallback() {
|
|
429
431
|
super.connectedCallback();
|
|
430
432
|
this.registerEvents();
|
|
@@ -16,7 +16,6 @@ declare class FeedbackButtonComponent extends GirafeHTMLElement {
|
|
|
16
16
|
negativeFeedback(): Promise<void>;
|
|
17
17
|
private showThankYouPopup;
|
|
18
18
|
protected connectedCallback(): void;
|
|
19
|
-
protected disconnectedCallback(): void;
|
|
20
19
|
render(): void;
|
|
21
20
|
private calculateMargins;
|
|
22
21
|
private calculatePlacement;
|
|
@@ -52,9 +52,6 @@ ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
|
52
52
|
super.connectedCallback();
|
|
53
53
|
this.render();
|
|
54
54
|
}
|
|
55
|
-
disconnectedCallback() {
|
|
56
|
-
super.disconnectedCallback();
|
|
57
|
-
}
|
|
58
55
|
render() {
|
|
59
56
|
super.render();
|
|
60
57
|
this.question = this.getAttribute('question') ?? 'feedback-question-default';
|
|
@@ -29,6 +29,7 @@ ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
|
29
29
|
this.registerListeners();
|
|
30
30
|
this.render();
|
|
31
31
|
}
|
|
32
|
+
// TODO REG: Should we find a common way to solve this case for all components?
|
|
32
33
|
disconnectedCallback() {
|
|
33
34
|
super.disconnectedCallback();
|
|
34
35
|
this.unregisterListeners();
|
|
@@ -6,7 +6,6 @@ import ArrowWhite from './images/arrow_white.webp';
|
|
|
6
6
|
import CircledBlack from './images/circled_black.webp';
|
|
7
7
|
import CircledWhite from './images/circled_white.webp';
|
|
8
8
|
import { systemIsInDarkMode } from '../../tools/utils/utils.js';
|
|
9
|
-
import { noop } from '../../tools/utils/async.js';
|
|
10
9
|
class HelpComponent extends GirafeHTMLElement {
|
|
11
10
|
templateUrl = null;
|
|
12
11
|
styleUrls = null;
|
|
@@ -91,7 +90,7 @@ ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
|
91
90
|
}
|
|
92
91
|
startOnboardingTour() {
|
|
93
92
|
this.toggleHelp(false);
|
|
94
|
-
this.context.onBoardingManager
|
|
93
|
+
void this.context.onBoardingManager?.restart();
|
|
95
94
|
}
|
|
96
95
|
connectedCallback() {
|
|
97
96
|
super.connectedCallback();
|
|
@@ -97,6 +97,7 @@ export default class Map2dComponent extends GirafeHTMLElement implements IOlComp
|
|
|
97
97
|
select(extent: number[]): void;
|
|
98
98
|
selectNone(): void;
|
|
99
99
|
protected connectedCallback(): void;
|
|
100
|
+
protected applicationIsReady(): void;
|
|
100
101
|
onCustomGirafeEvent(details: {
|
|
101
102
|
action: string;
|
|
102
103
|
layer: Layer;
|
|
@@ -169,27 +169,6 @@ ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
|
169
169
|
this.subscribe(/layers\.layersList\..*\.filter/, (_oldFilter, _newFilter, layer) => this.onChangeFilter(layer));
|
|
170
170
|
this.subscribe(/layers\.layersList\..*\.timeRestriction/, (_oldTime, _newTime, layer) => this.onChangeTime(layer));
|
|
171
171
|
this.subscribe(/layers\.layersList\..*\.order/, () => this.onChangeOrder());
|
|
172
|
-
this.subscribe('application.isReady', (_, isLoaded) => {
|
|
173
|
-
if (isLoaded) {
|
|
174
|
-
// The map component may not be fully ready when other part of the application will be initialized
|
|
175
|
-
// And some operations that need a fuly loaded map need to be first done when the application is ready
|
|
176
|
-
// For example, Permalink needs resolution,
|
|
177
|
-
// If the app is opened from a permalink, prioritize this data over settings in the shared state
|
|
178
|
-
if (this.context.permalinkManager.hasFeatureSelectionQuery()) {
|
|
179
|
-
this.applyFeatureSelectionFromPermalink();
|
|
180
|
-
}
|
|
181
|
-
else if (this.context.permalinkManager.hasMapPosition()) {
|
|
182
|
-
this.applyMapPositionFromPermalink();
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
this.applyFeatureSelectionFromSharedState();
|
|
186
|
-
}
|
|
187
|
-
this.showCrosshair(this.state.position);
|
|
188
|
-
for (const marker of this.state.position.markers) {
|
|
189
|
-
this.addMarker(marker);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
172
|
}
|
|
194
173
|
locateUser() {
|
|
195
174
|
if ('geolocation' in navigator) {
|
|
@@ -484,6 +463,25 @@ ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
|
484
463
|
this.listenOpenLayersEvents();
|
|
485
464
|
this.registerEvents();
|
|
486
465
|
}
|
|
466
|
+
applicationIsReady() {
|
|
467
|
+
// The map component may not be fully ready when other part of the application will be initialized
|
|
468
|
+
// And some operations that need a fuly loaded map need to be first done when the application is ready
|
|
469
|
+
// For example, Permalink needs resolution,
|
|
470
|
+
// If the app is opened from a permalink, prioritize this data over settings in the shared state
|
|
471
|
+
if (this.context.permalinkManager.hasFeatureSelectionQuery()) {
|
|
472
|
+
this.applyFeatureSelectionFromPermalink();
|
|
473
|
+
}
|
|
474
|
+
else if (this.context.permalinkManager.hasMapPosition()) {
|
|
475
|
+
this.applyMapPositionFromPermalink();
|
|
476
|
+
}
|
|
477
|
+
else {
|
|
478
|
+
this.applyFeatureSelectionFromSharedState();
|
|
479
|
+
}
|
|
480
|
+
this.showCrosshair(this.state.position);
|
|
481
|
+
for (const marker of this.state.position.markers) {
|
|
482
|
+
this.addMarker(marker);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
487
485
|
onCustomGirafeEvent(details) {
|
|
488
486
|
if (details.action === GeoEvents.zoomToExtent) {
|
|
489
487
|
this.zoomToExtent(details.extent);
|
|
@@ -36,6 +36,7 @@ export default class Map3dComponent extends GirafeHTMLElement implements ICesium
|
|
|
36
36
|
*/
|
|
37
37
|
protected get isFullscreenComponent(): boolean;
|
|
38
38
|
protected connectedCallback(): void;
|
|
39
|
+
protected applicationIsReady(): void;
|
|
39
40
|
render(): void;
|
|
40
41
|
private registerEvents;
|
|
41
42
|
/**
|
|
@@ -56,6 +56,11 @@ ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
|
56
56
|
this.registerEvents();
|
|
57
57
|
this.onGlobeToggled();
|
|
58
58
|
}
|
|
59
|
+
applicationIsReady() {
|
|
60
|
+
// The globe may not be ready when the rest of the application is initialized.
|
|
61
|
+
// The camera of a shared state can only be applied once everything is loaded.
|
|
62
|
+
this.globe?.setCamera(this.state.globe.camera);
|
|
63
|
+
}
|
|
59
64
|
render() {
|
|
60
65
|
super.render();
|
|
61
66
|
this.map3dTarget = this.shadow.getElementById('cs-map');
|
|
@@ -79,13 +84,6 @@ ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
|
79
84
|
});
|
|
80
85
|
this.subscribe(/layers\.layersList\..*\.opacity/, (_oldOpacity, _newOpacity, layer) => this.globe?.changeOpacity(layer));
|
|
81
86
|
this.subscribe(/layers\.layersList\..*\.filter/, (_oldFilter, _newFilter, layer) => this.globe?.changeFilter(layer));
|
|
82
|
-
this.subscribe('application.isReady', (_, isLoaded) => {
|
|
83
|
-
if (isLoaded) {
|
|
84
|
-
// The globe may not be ready when the rest of the application is initialized.
|
|
85
|
-
// The camera of a shared state can only be applied once everything is loaded.
|
|
86
|
-
this.globe?.setCamera(this.state.globe.camera);
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
87
|
}
|
|
90
88
|
/**
|
|
91
89
|
* Lazily loads Cesium/OLCesium and creates the globe. Does nothing if no 3D configuration
|
|
@@ -8,6 +8,6 @@ declare class NewsButtonComponent extends GirafeHTMLElement {
|
|
|
8
8
|
constructor();
|
|
9
9
|
setWarn(): void;
|
|
10
10
|
getIcon(): "icons/bell-warn.svg" | "icons/bell.svg";
|
|
11
|
-
connectedCallback(): void;
|
|
11
|
+
protected connectedCallback(): void;
|
|
12
12
|
}
|
|
13
13
|
export default NewsButtonComponent;
|
|
@@ -38,6 +38,7 @@ declare class SearchComponent extends GirafeHTMLElement {
|
|
|
38
38
|
render(): void;
|
|
39
39
|
registerEvents(): void;
|
|
40
40
|
protected connectedCallback(): void;
|
|
41
|
+
protected applicationIsReady(): void;
|
|
41
42
|
private flattenResultList;
|
|
42
43
|
protected clearSearch(purge?: boolean): void;
|
|
43
44
|
doSearch(e: Event): Promise<void>;
|
|
@@ -155,12 +155,10 @@ ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
|
155
155
|
console.debug('Translations not loaded');
|
|
156
156
|
}
|
|
157
157
|
});
|
|
158
|
+
}
|
|
159
|
+
applicationIsReady() {
|
|
158
160
|
if (this.context.permalinkManager.hasSearch()) {
|
|
159
|
-
this.
|
|
160
|
-
if (this.state.application.isReady) {
|
|
161
|
-
void this.initialSearch();
|
|
162
|
-
}
|
|
163
|
-
});
|
|
161
|
+
void this.initialSearch();
|
|
164
162
|
}
|
|
165
163
|
}
|
|
166
164
|
flattenResultList(results) {
|
|
@@ -3,7 +3,6 @@ import { TabulatorFull as Tabulator } from 'tabulator-tables';
|
|
|
3
3
|
import { getUid } from 'ol/util.js';
|
|
4
4
|
import ColumnAliasHelper from '../../../tools/utils/aliases.js';
|
|
5
5
|
import { linkify } from '../../../tools/utils/utils.js';
|
|
6
|
-
import { noop } from '../../../tools/utils/async.js';
|
|
7
6
|
import tippy from 'tippy.js';
|
|
8
7
|
import { sanitize } from '../../../tools/utils/sanitize.js';
|
|
9
8
|
const geometryColumns = new Set(['geom', 'the_geom', 'geometry']);
|
|
@@ -175,12 +174,10 @@ export default class SelectionTabulatorManager {
|
|
|
175
174
|
}
|
|
176
175
|
}
|
|
177
176
|
}
|
|
178
|
-
column
|
|
179
|
-
.updateDefinition({
|
|
177
|
+
void column.updateDefinition({
|
|
180
178
|
...columnDefinition,
|
|
181
179
|
frozen: !columnDefinition.frozen
|
|
182
|
-
})
|
|
183
|
-
.then(noop);
|
|
180
|
+
});
|
|
184
181
|
}
|
|
185
182
|
}
|
|
186
183
|
],
|
|
@@ -188,7 +185,7 @@ export default class SelectionTabulatorManager {
|
|
|
188
185
|
{
|
|
189
186
|
label: this.context.i18nManager.getTranslation('copy-cell-content'),
|
|
190
187
|
action: (_e, cell) => {
|
|
191
|
-
navigator.clipboard?.writeText(cell.getElement().textContent);
|
|
188
|
+
void navigator.clipboard?.writeText(cell.getElement().textContent);
|
|
192
189
|
}
|
|
193
190
|
}
|
|
194
191
|
],
|
|
@@ -47,7 +47,7 @@ export default class SelectionToolComponent extends GirafeHTMLElement implements
|
|
|
47
47
|
render(): void;
|
|
48
48
|
renderComponent(): void;
|
|
49
49
|
setTool(tool: SelectionTool | null): void;
|
|
50
|
-
connectedCallback(): void;
|
|
50
|
+
protected connectedCallback(): void;
|
|
51
51
|
togglePanel(visible: boolean): void;
|
|
52
52
|
registerEvents(): void;
|
|
53
53
|
unregisterEvents(): void;
|
|
@@ -20,6 +20,7 @@ export default class UserPreferencesComponent extends GirafeHTMLElement implemen
|
|
|
20
20
|
constructor();
|
|
21
21
|
private initPreferences;
|
|
22
22
|
protected connectedCallback(): void;
|
|
23
|
+
protected applicationIsReady(): void;
|
|
23
24
|
render(): void;
|
|
24
25
|
private renderComponent;
|
|
25
26
|
togglePanel(visible: boolean): void;
|
|
@@ -81,16 +81,6 @@ ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
|
81
81
|
delete this.preferences[key];
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
this.subscribe('application.isReady', (_, isReady) => {
|
|
85
|
-
if (isReady) {
|
|
86
|
-
this.initPreferenceOptions();
|
|
87
|
-
this.initCurrentPreferenceValues();
|
|
88
|
-
this.initDarkModeDefaults();
|
|
89
|
-
this.initColorPicker();
|
|
90
|
-
this.ready = true;
|
|
91
|
-
this.render();
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
84
|
}
|
|
95
85
|
connectedCallback() {
|
|
96
86
|
super.connectedCallback();
|
|
@@ -99,6 +89,14 @@ ${this.htmlUnsafe(this.feedbackTemplateHtml ?? '')}`;
|
|
|
99
89
|
this.subscribe('interface.darkFrontendMode', (_, newValue) => this.onChangeDarkFrontendMode(newValue));
|
|
100
90
|
this.subscribe('interface.darkMapMode', (_, newValue) => this.onChangeDarkMapMode(newValue));
|
|
101
91
|
}
|
|
92
|
+
applicationIsReady() {
|
|
93
|
+
this.initPreferenceOptions();
|
|
94
|
+
this.initCurrentPreferenceValues();
|
|
95
|
+
this.initDarkModeDefaults();
|
|
96
|
+
this.initColorPicker();
|
|
97
|
+
this.ready = true;
|
|
98
|
+
this.render();
|
|
99
|
+
}
|
|
102
100
|
render() {
|
|
103
101
|
if (this.isPanelVisible) {
|
|
104
102
|
this.renderComponent();
|
package/main.js
CHANGED
package/package.json
CHANGED
package/templates/index.html
CHANGED
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
The value of content should be a relative URL to the desired endpoint or page.
|
|
12
12
|
-->
|
|
13
13
|
<meta name="redirect-url" content="mobile.html" />
|
|
14
|
-
<meta name="configs" content="main" />
|
|
14
|
+
<meta name="configs" content="main,desktop" />
|
|
15
15
|
<link rel="config-main-url" href="config.json" />
|
|
16
|
+
<link rel="config-desktop-url" href="config.desktop.json" />
|
|
16
17
|
|
|
17
18
|
<link
|
|
18
19
|
rel="apple-touch-icon"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.3.0-dev.
|
|
1
|
+
{"version":"1.3.0-dev.3122808085", "build":"3122808085", "date":"27/11/2026"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"onboarding": {
|
|
3
|
+
"steps": [
|
|
4
|
+
{
|
|
5
|
+
"element": "[data-tour='theme-selection']",
|
|
6
|
+
"title": "onboarding-theme-selection-title",
|
|
7
|
+
"description": "onboarding-theme-selection-description"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"element": "[data-tour='basemap-selection']",
|
|
11
|
+
"title": "onboarding-basemap-selection-title",
|
|
12
|
+
"description": "onboarding-basemap-selection-description"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"component": "treeviewroot",
|
|
16
|
+
"element": "[data-tour='treeview-filter']",
|
|
17
|
+
"title": "onboarding-treeview-filter-selection-title",
|
|
18
|
+
"description": "onboarding-treeview-filter-selection-description"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -50,26 +50,6 @@
|
|
|
50
50
|
]
|
|
51
51
|
},
|
|
52
52
|
"crs": [],
|
|
53
|
-
"onboarding": {
|
|
54
|
-
"steps": [
|
|
55
|
-
{
|
|
56
|
-
"element": "[data-tour='theme-selection']",
|
|
57
|
-
"title": "onboarding-theme-selection-title",
|
|
58
|
-
"description": "onboarding-theme-selection-description"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
"element": "[data-tour='basemap-selection']",
|
|
62
|
-
"title": "onboarding-basemap-selection-title",
|
|
63
|
-
"description": "onboarding-basemap-selection-description"
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"component": "treeviewroot",
|
|
67
|
-
"element": "[data-tour='treeview-filter']",
|
|
68
|
-
"title": "onboarding-treeview-filter-selection-title",
|
|
69
|
-
"description": "onboarding-treeview-filter-selection-description"
|
|
70
|
-
}
|
|
71
|
-
]
|
|
72
|
-
},
|
|
73
53
|
"news": {
|
|
74
54
|
"urls": ["https://geogirafe.org/feed/atom/"],
|
|
75
55
|
"autoDisplay": false
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import GirafeSingleton from '../../base/GirafeSingleton.js';
|
|
2
2
|
export default class ApplicationLifeCycleManager extends GirafeSingleton {
|
|
3
|
+
private readonly callbacks;
|
|
3
4
|
private get state();
|
|
5
|
+
private subscribe;
|
|
4
6
|
initializeSingleton(): Promise<void>;
|
|
5
7
|
private log;
|
|
6
8
|
/**
|
|
@@ -1,36 +1,42 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
import GirafeSingleton from '../../base/GirafeSingleton.js';
|
|
3
3
|
export default class ApplicationLifeCycleManager extends GirafeSingleton {
|
|
4
|
+
callbacks = [];
|
|
4
5
|
get state() {
|
|
5
6
|
return this.context.stateManager.state;
|
|
6
7
|
}
|
|
8
|
+
subscribe(path, callback) {
|
|
9
|
+
const subscription = this.context.stateManager.subscribe(path, callback);
|
|
10
|
+
this.callbacks.push(subscription);
|
|
11
|
+
return subscription;
|
|
12
|
+
}
|
|
7
13
|
async initializeSingleton() {
|
|
8
|
-
this.
|
|
14
|
+
this.subscribe('themes.isLoaded', (_, isThemesLoaded) => {
|
|
9
15
|
this.log(isThemesLoaded, 'Themes are loaded');
|
|
10
16
|
this.checkApplicationReady();
|
|
11
17
|
});
|
|
12
|
-
this.
|
|
18
|
+
this.subscribe('projection', (_, projection) => {
|
|
13
19
|
this.log(projection, 'Projection is initialized');
|
|
14
20
|
this.checkApplicationReady();
|
|
15
21
|
});
|
|
16
|
-
this.
|
|
22
|
+
this.subscribe('position', (_, position) => {
|
|
17
23
|
this.log(position, 'Position is initialized');
|
|
18
24
|
this.checkApplicationReady();
|
|
19
25
|
});
|
|
20
|
-
this.
|
|
26
|
+
this.subscribe('application.isConfigurationLoaded', (_, isConfigurationLoaded) => {
|
|
21
27
|
this.log(isConfigurationLoaded, 'Configuration is loaded');
|
|
22
28
|
this.checkApplicationReady();
|
|
23
29
|
});
|
|
24
|
-
this.
|
|
30
|
+
this.subscribe('application.isStateInitialized', (_, isStateInitialized) => {
|
|
25
31
|
this.log(isStateInitialized, 'Initial state has been initialized');
|
|
26
32
|
this.checkApplicationReady();
|
|
27
33
|
});
|
|
28
|
-
this.
|
|
34
|
+
this.subscribe('application.isAuthInitialized', (_, isAuthInitialized) => {
|
|
29
35
|
this.log(isAuthInitialized, 'Authentication has been initialized');
|
|
30
36
|
this.checkReadyToLoadThemes();
|
|
31
37
|
this.checkApplicationReady();
|
|
32
38
|
});
|
|
33
|
-
this.
|
|
39
|
+
this.subscribe('application.isCustomSerializerInitialized', (_, isCustomSerializerInitialized) => {
|
|
34
40
|
this.log(isCustomSerializerInitialized, 'Custom Serializers have been initialized');
|
|
35
41
|
this.checkReadyToLoadThemes();
|
|
36
42
|
this.checkApplicationReady();
|
|
@@ -61,6 +67,10 @@ export default class ApplicationLifeCycleManager extends GirafeSingleton {
|
|
|
61
67
|
* - Initial state (shared, session or default)
|
|
62
68
|
*/
|
|
63
69
|
checkApplicationReady() {
|
|
70
|
+
if (this.state.application.isReady) {
|
|
71
|
+
// Already called previously
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
64
74
|
let isReady = true;
|
|
65
75
|
if (!this.state.application.isConfigurationLoaded ||
|
|
66
76
|
!this.state.themes.isLoaded ||
|
|
@@ -73,6 +83,7 @@ export default class ApplicationLifeCycleManager extends GirafeSingleton {
|
|
|
73
83
|
}
|
|
74
84
|
if (isReady) {
|
|
75
85
|
this.state.application.isReady = true;
|
|
86
|
+
this.context.stateManager.unsubscribe(this.callbacks);
|
|
76
87
|
}
|
|
77
88
|
}
|
|
78
89
|
}
|
|
@@ -8,7 +8,7 @@ declare class FeedbackManager extends GirafeSingleton {
|
|
|
8
8
|
private get config();
|
|
9
9
|
private readonly STORAGE_PATH;
|
|
10
10
|
private gaveFeedbackFor;
|
|
11
|
-
|
|
11
|
+
applicationIsReady(): Promise<void>;
|
|
12
12
|
giveFeedback(componentName: string, feedbackResult: FeedbackResult): Promise<void>;
|
|
13
13
|
private initializeFeedbackOnComponents;
|
|
14
14
|
}
|
|
@@ -13,8 +13,7 @@ class FeedbackManager extends GirafeSingleton {
|
|
|
13
13
|
}
|
|
14
14
|
STORAGE_PATH = 'alreadyGaveFeedbackFor';
|
|
15
15
|
gaveFeedbackFor = {};
|
|
16
|
-
async
|
|
17
|
-
await super.initializeSingleton();
|
|
16
|
+
async applicationIsReady() {
|
|
18
17
|
this.gaveFeedbackFor =
|
|
19
18
|
(await this.context.userDataManager.getUserData(this.STORAGE_PATH)) || {};
|
|
20
19
|
this.initializeFeedbackOnComponents();
|
package/tools/main.d.ts
CHANGED
|
@@ -150,7 +150,6 @@ export { default as PermalinkManager } from './url/permalinkmanager.js';
|
|
|
150
150
|
export { default as UrlManager } from './url/urlmanager.js';
|
|
151
151
|
export { default as UserDataManager } from './userdata/userdatamanager.js';
|
|
152
152
|
export { default as ColumnAliasHelper } from './utils/aliases.js';
|
|
153
|
-
export { noop } from './utils/async.js';
|
|
154
153
|
export { default as DateUtils } from './utils/dateutils.js';
|
|
155
154
|
export { debounce } from './utils/debounce.js';
|
|
156
155
|
export { default as GirafeColorPicker } from './utils/girafecolorpicker.js';
|
package/tools/main.js
CHANGED
|
@@ -109,7 +109,6 @@ export { default as PermalinkManager } from './url/permalinkmanager.js';
|
|
|
109
109
|
export { default as UrlManager } from './url/urlmanager.js';
|
|
110
110
|
export { default as UserDataManager } from './userdata/userdatamanager.js';
|
|
111
111
|
export { default as ColumnAliasHelper } from './utils/aliases.js';
|
|
112
|
-
export { noop } from './utils/async.js';
|
|
113
112
|
export { default as DateUtils } from './utils/dateutils.js';
|
|
114
113
|
export { debounce } from './utils/debounce.js';
|
|
115
114
|
export { default as GirafeColorPicker } from './utils/girafecolorpicker.js';
|
|
@@ -11,6 +11,9 @@ export default class OnBoardingManager extends GirafeSingleton {
|
|
|
11
11
|
await this.context.userDataManager.saveUserData(this.STORAGE_PATH, 'false');
|
|
12
12
|
return this.start();
|
|
13
13
|
}
|
|
14
|
+
async applicationIsReady() {
|
|
15
|
+
void this.start();
|
|
16
|
+
}
|
|
14
17
|
async start() {
|
|
15
18
|
if (!this.config.onboarding) {
|
|
16
19
|
// No tour configured
|
|
@@ -34,13 +37,15 @@ export default class OnBoardingManager extends GirafeSingleton {
|
|
|
34
37
|
for (const stepConfig of this.config.onboarding.steps ?? []) {
|
|
35
38
|
let element;
|
|
36
39
|
if (stepConfig.component) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
const components = this.context.componentManager.getComponentsByName(stepConfig.component);
|
|
41
|
+
if (components) {
|
|
42
|
+
// @ts-expect-error getChildElement is protected, but we do not want to make it public,
|
|
43
|
+
// because we should not give access to the shadow from from outside.
|
|
44
|
+
// The onboarding is a very special case, because we want to be able
|
|
45
|
+
// to focus an HTML element inside the shadow dom, to show help text.
|
|
46
|
+
// So this should be the only exception to this protected access.
|
|
47
|
+
element = components[0].getChildElement(stepConfig.element) ?? undefined;
|
|
48
|
+
}
|
|
44
49
|
}
|
|
45
50
|
else {
|
|
46
51
|
element = stepConfig.element;
|
|
@@ -100,7 +100,7 @@ class StateManager extends GirafeSingleton {
|
|
|
100
100
|
return callback;
|
|
101
101
|
}
|
|
102
102
|
unsubscribe(callbacks) {
|
|
103
|
-
(Array.isArray(callbacks) ? callbacks : [callbacks])
|
|
103
|
+
for (const callback of Array.isArray(callbacks) ? callbacks : [callbacks]) {
|
|
104
104
|
let found = false;
|
|
105
105
|
for (const path in this.callbacks) {
|
|
106
106
|
const callbacks = this.callbacks[path];
|
|
@@ -112,9 +112,9 @@ class StateManager extends GirafeSingleton {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
if (!found) {
|
|
115
|
-
throw Error(`Cannot unsubscribe this callback : it does not exist`);
|
|
115
|
+
throw new Error(`Cannot unsubscribe this callback : it does not exist`);
|
|
116
116
|
}
|
|
117
|
-
}
|
|
117
|
+
}
|
|
118
118
|
}
|
|
119
119
|
batchChanges(statechanges) {
|
|
120
120
|
this.stateProxy.delay(statechanges);
|
|
@@ -75,6 +75,7 @@ export default class MockGirafeContext implements IGirafeContext {
|
|
|
75
75
|
private readonly contextHelper;
|
|
76
76
|
constructor();
|
|
77
77
|
initialize(): Promise<void>;
|
|
78
|
+
private applicationIsReady;
|
|
78
79
|
/** The context can contains hook methods that will be called after each manager initialization.
|
|
79
80
|
* The hook method must be named with the property name + the "Hook" suffix.
|
|
80
81
|
* The hook method must be async and will be awaited
|
|
@@ -44,6 +44,14 @@ export default class MockGirafeContext {
|
|
|
44
44
|
}
|
|
45
45
|
async initialize() {
|
|
46
46
|
await this.contextHelper.initializeContext(this);
|
|
47
|
+
await this.applicationIsReady(this);
|
|
48
|
+
}
|
|
49
|
+
async applicationIsReady(context) {
|
|
50
|
+
// @ts-ignore Private method
|
|
51
|
+
for (const [name] of this.contextHelper.Managers) {
|
|
52
|
+
// @ts-ignore Protected method
|
|
53
|
+
await context[name].applicationIsReady();
|
|
54
|
+
}
|
|
47
55
|
}
|
|
48
56
|
/** The context can contains hook methods that will be called after each manager initialization.
|
|
49
57
|
* The hook method must be named with the property name + the "Hook" suffix.
|
|
@@ -62,9 +70,9 @@ export default class MockGirafeContext {
|
|
|
62
70
|
// Do not call the initializeSingleton methode
|
|
63
71
|
// But set hardcoded mock config
|
|
64
72
|
// @ts-ignore
|
|
65
|
-
this.configManager
|
|
73
|
+
this.configManager.config = new GirafeConfig(MockConfig);
|
|
66
74
|
// @ts-ignore
|
|
67
|
-
this.configManager
|
|
75
|
+
this.configManager.defaultConfig = new GirafeConfig(MockConfig);
|
|
68
76
|
}
|
|
69
77
|
async i18nManagerHook() {
|
|
70
78
|
// Do not load translation files
|
|
@@ -3,6 +3,7 @@ import proj4 from 'proj4';
|
|
|
3
3
|
import { register } from 'ol/proj/proj4';
|
|
4
4
|
import MockGirafeContext from './mockcontext';
|
|
5
5
|
import { MockConfig } from './mockconfig';
|
|
6
|
+
import GirafeConfig from '../configuration/girafeconfig';
|
|
6
7
|
class MockHelper {
|
|
7
8
|
static async startMocking() {
|
|
8
9
|
const context = new MockGirafeContext();
|
|
@@ -16,7 +17,7 @@ class MockHelper {
|
|
|
16
17
|
static async stopMocking(context) {
|
|
17
18
|
await context.userDataManager.deleteAllUserData();
|
|
18
19
|
// @ts-ignore
|
|
19
|
-
context.configManager.config =
|
|
20
|
+
context.configManager.config = new GirafeConfig(MockConfig);
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
export default MockHelper;
|
|
@@ -4,7 +4,7 @@ import ThemeLayer from '../../models/layers/themelayer.js';
|
|
|
4
4
|
declare class ThemeFavoritesManager extends GirafeSingleton {
|
|
5
5
|
private themeFavorites;
|
|
6
6
|
private readonly storagePath;
|
|
7
|
-
|
|
7
|
+
applicationIsReady(): Promise<void>;
|
|
8
8
|
private saveThemeFavorites;
|
|
9
9
|
private loadThemeFavorites;
|
|
10
10
|
addThemeToFavorites(theme: ThemeLayer | CustomTheme): Promise<void>;
|
|
@@ -4,8 +4,7 @@ import ThemeLayer from '../../models/layers/themelayer.js';
|
|
|
4
4
|
class ThemeFavoritesManager extends GirafeSingleton {
|
|
5
5
|
themeFavorites = [];
|
|
6
6
|
storagePath = 'themeFavorites';
|
|
7
|
-
async
|
|
8
|
-
await super.initializeSingleton();
|
|
7
|
+
async applicationIsReady() {
|
|
9
8
|
await this.loadThemeFavorites();
|
|
10
9
|
}
|
|
11
10
|
async saveThemeFavorites() {
|
package/tools/utils/async.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const noop: () => void;
|
package/tools/utils/async.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const noop = () => { };
|