@vcmap/ui 6.1.0-rc.6 → 6.1.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.
Files changed (149) hide show
  1. package/config/base.config.json +7 -3
  2. package/config/cluster.config.json +5 -14
  3. package/config/dev.config.json +175 -56
  4. package/config/projects.config.json +2 -1
  5. package/config/splashscreen.config.json +6 -10
  6. package/config/vectorTile.config.json +42 -1
  7. package/dist/assets/{cesium-f5e8e354.js → cesium-664ad022.js} +53 -23
  8. package/dist/assets/cesium.js +1 -1
  9. package/dist/assets/{core-c134a524.js → core-841b71a4.js} +8458 -5828
  10. package/dist/assets/core.js +1 -1
  11. package/dist/assets/{ol-2752311f.js → ol-2e095c08.js} +87 -37
  12. package/dist/assets/ol.js +1 -1
  13. package/dist/assets/ui-2fd6f47d.css +1 -0
  14. package/dist/assets/{ui-83514586.js → ui-2fd6f47d.js} +21376 -20063
  15. package/dist/assets/ui.js +1 -1
  16. package/dist/assets/vue.js +1 -1
  17. package/dist/assets/{vuetify-5dbe2644.css → vuetify-4bc77ff7.css} +2 -2
  18. package/dist/assets/{vuetify-5dbe2644.js → vuetify-4bc77ff7.js} +7520 -7373
  19. package/dist/assets/vuetify.js +1 -1
  20. package/dist/index.html +1 -1
  21. package/index.d.ts +15 -5
  22. package/index.html +1 -1
  23. package/index.js +14 -5
  24. package/package.json +12 -8
  25. package/plugins/@vcmap-show-case/theming-example/src/index.js +1 -0
  26. package/plugins/@vcmap-show-case/vector-properties-example/src/LayerSettings.vue +39 -0
  27. package/plugins/@vcmap-show-case/vector-properties-example/src/VectorPropertiesExample.vue +3 -0
  28. package/plugins/@vcmap-show-case/vector-properties-example/src/lib.js +13 -0
  29. package/plugins/@vcmap-show-case/window-tester/src/WindowExample.vue +9 -0
  30. package/plugins/package.json +7 -5
  31. package/src/actions/actionHelper.d.ts +6 -0
  32. package/src/actions/actionHelper.js +22 -0
  33. package/src/actions/deepPickingAction.d.ts +23 -0
  34. package/src/actions/deepPickingAction.js +399 -0
  35. package/src/application/MapsGroupMobileMenu.vue +105 -0
  36. package/src/application/MapsGroupMobileMenu.vue.d.ts +7 -0
  37. package/src/application/VcsApp.vue +51 -24
  38. package/src/application/VcsApp.vue.d.ts +9 -2
  39. package/src/application/VcsAttributionsFooter.vue +1 -0
  40. package/src/application/VcsContainer.vue +36 -13
  41. package/src/application/VcsContainer.vue.d.ts +7 -0
  42. package/src/application/VcsMobileMenuList.vue +111 -0
  43. package/src/application/VcsMobileMenuList.vue.d.ts +2 -0
  44. package/src/application/VcsNavbar.vue +15 -3
  45. package/src/application/VcsNavbarMobile.vue +206 -0
  46. package/src/application/VcsNavbarMobile.vue.d.ts +42 -0
  47. package/src/application/VcsPositionDisplay.vue +1 -0
  48. package/src/application/VcsSplashScreen.vue +39 -7
  49. package/src/application/VcsSplashScreen.vue.d.ts +6 -0
  50. package/src/application/uiConfigHelper.d.ts +12 -0
  51. package/src/application/uiConfigHelper.js +37 -0
  52. package/src/components/buttons/VcsActionButtonList.vue +1 -0
  53. package/src/components/buttons/VcsToolButton.vue +8 -1
  54. package/src/components/buttons/VcsToolButton.vue.d.ts +1 -0
  55. package/src/components/form-inputs-controls/VcsSelect.vue +8 -6
  56. package/src/components/form-output/VcsTemplateMarkdown.vue +43 -0
  57. package/src/components/form-output/VcsTemplateMarkdown.vue.d.ts +9 -0
  58. package/src/components/icons/+all.d.ts +5 -0
  59. package/src/components/icons/+all.js +14 -0
  60. package/src/components/lists/VcsActionList.vue +1 -0
  61. package/src/components/lists/VcsGroupedList.vue +2 -1
  62. package/src/components/lists/VcsListItemComponent.vue +1 -0
  63. package/src/components/lists/VcsTreeNode.vue +11 -2
  64. package/src/components/lists/VcsTreeview.vue +40 -3
  65. package/src/components/lists/VcsTreeview.vue.d.ts +1 -0
  66. package/src/components/lists/VcsTreeviewTitle.vue +8 -1
  67. package/src/components/style/{MenuWrapper.vue → StyleMenuWrapper.vue} +2 -1
  68. package/src/components/style/VcsFillMenu.vue +4 -4
  69. package/src/components/style/VcsImageMenu.vue +4 -4
  70. package/src/components/style/VcsStrokeMenu.vue +4 -4
  71. package/src/components/style/VcsTextMenu.vue +4 -4
  72. package/src/contentTree/LayerTree.vue +8 -46
  73. package/src/contentTree/LayerTree.vue.d.ts +1 -3
  74. package/src/contentTree/contentTreeCollection.d.ts +7 -0
  75. package/src/contentTree/contentTreeCollection.js +31 -10
  76. package/src/contentTree/contentTreeItem.d.ts +4 -4
  77. package/src/contentTree/contentTreeItem.js +2 -2
  78. package/src/contentTree/flightContentTreeItem.d.ts +8 -1
  79. package/src/contentTree/flightContentTreeItem.js +26 -3
  80. package/src/contentTree/groupContentTreeItem.d.ts +21 -0
  81. package/src/contentTree/groupContentTreeItem.js +32 -2
  82. package/src/contentTree/layerContentTreeItem.d.ts +8 -1
  83. package/src/contentTree/layerContentTreeItem.js +26 -4
  84. package/src/contentTree/layerGroupContentTreeItem.d.ts +6 -0
  85. package/src/contentTree/layerGroupContentTreeItem.js +27 -3
  86. package/src/contentTree/nodeContentTreeItem.d.ts +21 -0
  87. package/src/contentTree/nodeContentTreeItem.js +31 -2
  88. package/src/contentTree/obliqueCollectionContentTreeItem.d.ts +6 -0
  89. package/src/contentTree/obliqueCollectionContentTreeItem.js +22 -2
  90. package/src/contentTree/wmsChildContentTreeItem.d.ts +56 -0
  91. package/src/contentTree/wmsChildContentTreeItem.js +159 -0
  92. package/src/contentTree/wmsGroupContentTreeItem.d.ts +171 -0
  93. package/src/contentTree/wmsGroupContentTreeItem.js +619 -0
  94. package/src/featureInfo/BalloonComponent.vue +6 -6
  95. package/src/featureInfo/ClusterFeatureComponent.vue +47 -11
  96. package/src/featureInfo/ClusterFeatureComponent.vue.d.ts +1 -0
  97. package/src/featureInfo/MarkdownBalloonComponent.vue +3 -9
  98. package/src/featureInfo/MarkdownBalloonComponent.vue.d.ts +1 -11
  99. package/src/featureInfo/balloonFeatureInfoView.d.ts +3 -0
  100. package/src/featureInfo/balloonFeatureInfoView.js +78 -11
  101. package/src/featureInfo/balloonHelper.js +9 -13
  102. package/src/featureInfo/featureInfo.d.ts +32 -7
  103. package/src/featureInfo/featureInfo.js +192 -93
  104. package/src/featureInfo/markdownBalloonFeatureInfoView.d.ts +0 -6
  105. package/src/featureInfo/markdownBalloonFeatureInfoView.js +5 -14
  106. package/src/featureInfo/markdownFeatureInfoView.d.ts +2 -8
  107. package/src/featureInfo/markdownFeatureInfoView.js +6 -15
  108. package/src/i18n/de.d.ts +64 -50
  109. package/src/i18n/de.js +9 -0
  110. package/src/i18n/en.d.ts +64 -50
  111. package/src/i18n/en.js +9 -0
  112. package/src/legend/VcsLegend.vue +21 -2
  113. package/src/legend/VcsLegend.vue.d.ts +1 -0
  114. package/src/legend/legendHelper.d.ts +0 -13
  115. package/src/legend/legendHelper.js +3 -27
  116. package/src/manager/navbarManager.d.ts +14 -1
  117. package/src/manager/navbarManager.js +22 -2
  118. package/src/manager/toolbox/GroupToolboxComponent.vue +17 -3
  119. package/src/manager/toolbox/GroupToolboxComponent.vue.d.ts +1 -0
  120. package/src/manager/toolbox/SelectToolboxComponent.vue +17 -3
  121. package/src/manager/toolbox/SelectToolboxComponent.vue.d.ts +1 -0
  122. package/src/manager/toolbox/ToolboxManagerComponent.vue +45 -14
  123. package/src/manager/toolbox/ToolboxManagerComponent.vue.d.ts +9 -0
  124. package/src/manager/toolbox/toolboxManager.d.ts +2 -1
  125. package/src/manager/toolbox/toolboxManager.js +13 -1
  126. package/src/manager/window/WindowComponent.vue +3 -2
  127. package/src/manager/window/WindowComponentHeader.vue +9 -1
  128. package/src/manager/window/WindowComponentHeader.vue.d.ts +1 -0
  129. package/src/manager/window/WindowManager.vue +175 -30
  130. package/src/manager/window/WindowManager.vue.d.ts +5 -0
  131. package/src/manager/window/windowManager.d.ts +2 -2
  132. package/src/manager/window/windowManager.js +12 -10
  133. package/src/navigation/MapNavigation.vue +29 -19
  134. package/src/navigation/MapNavigation.vue.d.ts +1 -0
  135. package/src/notifier/NotifierComponent.vue +1 -0
  136. package/src/search/ResultsComponent.vue +44 -17
  137. package/src/search/ResultsComponent.vue.d.ts +11 -1
  138. package/src/search/SearchComponent.vue +60 -9
  139. package/src/search/SearchComponent.vue.d.ts +2 -0
  140. package/src/search/search.js +3 -16
  141. package/src/state.d.ts +2 -1
  142. package/src/state.js +2 -1
  143. package/src/uiConfig.d.ts +9 -0
  144. package/src/uiConfig.js +1 -0
  145. package/src/vuePlugins/vuetify.d.ts +4 -0
  146. package/src/vuePlugins/vuetify.js +49 -3
  147. package/dist/assets/ui-83514586.css +0 -1
  148. /package/dist/assets/{vue-f8b1b5f8.js → vue-71fd14e8.js} +0 -0
  149. /package/src/components/style/{MenuWrapper.vue.d.ts → StyleMenuWrapper.vue.d.ts} +0 -0
@@ -1,9 +1,15 @@
1
1
  import { watch } from 'vue';
2
+ import { parseBoolean } from '@vcsuite/parsers';
2
3
  import ContentTreeItem, {
3
4
  contentTreeClassRegistry,
4
5
  } from './contentTreeItem.js';
5
6
  import { StateActionState } from '../actions/stateRefAction.js';
6
7
 
8
+ /**
9
+ * @typedef {import("./contentTreeItem.js").ContentTreeItemOptions & { disableIfChildrenDisabled?: boolean }} GroupContentTreeItemOptions
10
+ * @property {boolean} [disableIfChildrenDisabled=false] - optional flag to disable the contentTreeItem if all children are disabled.
11
+ */
12
+
7
13
  /**
8
14
  * A clickable group item. When clicked, every child with a state not NONE will also be clicked.
9
15
  * @class
@@ -18,12 +24,21 @@ class GroupContentTreeItem extends ContentTreeItem {
18
24
  }
19
25
 
20
26
  /**
21
- * @param {import("./contentTreeItem.js").ContentTreeItemOptions} options
27
+ * @param {GroupContentTreeItemOptions} options
22
28
  * @param {import("@src/vcsUiApp.js").default} app
23
29
  */
24
30
  constructor(options, app) {
25
31
  super(options, app);
26
32
 
33
+ /**
34
+ * @type {boolean}
35
+ * @private
36
+ */
37
+ this._disableIfChildrenDisabled = parseBoolean(
38
+ options.disableIfChildrenDisabled,
39
+ false,
40
+ );
41
+
27
42
  /**
28
43
  * @type {function():void}
29
44
  * @private
@@ -33,6 +48,10 @@ class GroupContentTreeItem extends ContentTreeItem {
33
48
  () => {
34
49
  const children = this._children.value;
35
50
  this.visible = children.some((c) => c.visible);
51
+
52
+ if (this._disableIfChildrenDisabled) {
53
+ this.disabled = children.every((c) => c.disabled);
54
+ }
36
55
  if (
37
56
  children.every((c) => c.state === StateActionState.NONE || !c.visible)
38
57
  ) {
@@ -74,11 +93,22 @@ class GroupContentTreeItem extends ContentTreeItem {
74
93
  state !== StateActionState.ACTIVE;
75
94
 
76
95
  const promises = this._children.value
77
- .filter((c) => c.visible && statePredicate(c.state))
96
+ .filter((c) => c.visible && !c.disabled && statePredicate(c.state))
78
97
  .map((c) => c.clicked());
79
98
  await Promise.all(promises);
80
99
  }
81
100
 
101
+ /**
102
+ * @returns {GroupContentTreeItemOptions}
103
+ */
104
+ toJSON() {
105
+ const config = super.toJSON();
106
+ if (this._disableIfChildrenDisabled) {
107
+ config.disableIfChildrenDisabled = this._disableIfChildrenDisabled;
108
+ }
109
+ return config;
110
+ }
111
+
82
112
  destroy() {
83
113
  this._childWatcher();
84
114
  super.destroy();
@@ -1,5 +1,6 @@
1
1
  /**
2
- * @typedef {import("./contentTreeItem.js").ContentTreeItemOptions & { layerName: string }} LayerContentTreeItemOptions
2
+ * @typedef {import("./contentTreeItem.js").ContentTreeItemOptions & { layerName: string, showWhenNotSupported?: boolean }} LayerContentTreeItemOptions
3
+ * @property {boolean} [showWhenNotSupported=false] - optional flag to show the item even if it is not supported by the activeMap.
3
4
  */
4
5
  /**
5
6
  * @typedef {import("./vcsObjectContentTreeItem.js").VcsObjectContentTreeItemProperties & { availableStyles?: string[], defaultViewpoint?: string }} LayerContentTreeItemProperties
@@ -27,6 +28,7 @@ export function getStateFromLayer(layer: import("@vcmap/core").Layer): StateActi
27
28
  export default LayerContentTreeItem;
28
29
  export type LayerContentTreeItemOptions = import("./contentTreeItem.js").ContentTreeItemOptions & {
29
30
  layerName: string;
31
+ showWhenNotSupported?: boolean;
30
32
  };
31
33
  export type LayerContentTreeItemProperties = import("./vcsObjectContentTreeItem.js").VcsObjectContentTreeItemProperties & {
32
34
  availableStyles?: string[];
@@ -49,6 +51,11 @@ declare class LayerContentTreeItem extends VcsObjectContentTreeItem<LayerContent
49
51
  * @private
50
52
  */
51
53
  private _layerName;
54
+ /**
55
+ * @type {boolean}
56
+ * @private
57
+ */
58
+ private _showWhenNotSupported;
52
59
  /**
53
60
  * @type {Array<Function>}
54
61
  * @private
@@ -1,4 +1,5 @@
1
1
  import { Viewpoint } from '@vcmap/core';
2
+ import { parseBoolean } from '@vcsuite/parsers';
2
3
  import { reactive } from 'vue';
3
4
  import { StateActionState } from '../actions/stateRefAction.js';
4
5
  import {
@@ -12,7 +13,8 @@ import { contentTreeClassRegistry } from './contentTreeItem.js';
12
13
  import { executeCallbacks } from '../callback/vcsCallback.js';
13
14
 
14
15
  /**
15
- * @typedef {import("./contentTreeItem.js").ContentTreeItemOptions & { layerName: string }} LayerContentTreeItemOptions
16
+ * @typedef {import("./contentTreeItem.js").ContentTreeItemOptions & { layerName: string, showWhenNotSupported?: boolean }} LayerContentTreeItemOptions
17
+ * @property {boolean} [showWhenNotSupported=false] - optional flag to show the item even if it is not supported by the activeMap.
16
18
  */
17
19
 
18
20
  /**
@@ -33,7 +35,7 @@ export function setViewpointAction(item, app, viewpoint) {
33
35
  const action = createGoToViewpointAction(
34
36
  {
35
37
  name,
36
- icon: 'mdi-crosshairs-gps',
38
+ icon: 'mdi-target',
37
39
  },
38
40
  viewpoint,
39
41
  app.viewpoints,
@@ -125,6 +127,15 @@ class LayerContentTreeItem extends VcsObjectContentTreeItem {
125
127
  */
126
128
  this._layerName = options.layerName;
127
129
 
130
+ /**
131
+ * @type {boolean}
132
+ * @private
133
+ */
134
+ this._showWhenNotSupported = parseBoolean(
135
+ options.showWhenNotSupported,
136
+ false,
137
+ );
138
+
128
139
  /**
129
140
  * @type {Array<Function>}
130
141
  * @private
@@ -215,7 +226,11 @@ class LayerContentTreeItem extends VcsObjectContentTreeItem {
215
226
  this._app.layers.added.addEventListener(resetHandler),
216
227
  );
217
228
  } else {
218
- this.visible = this._layer.isSupported(this._app.maps.activeMap);
229
+ let isSupported = this._layer.isSupported(this._app.maps.activeMap);
230
+ this.visible = isSupported || this._showWhenNotSupported;
231
+ if (this._showWhenNotSupported) {
232
+ this.disabled = !isSupported;
233
+ }
219
234
  this.state = getStateFromLayer(this._layer);
220
235
  this._setLayerExtentAction();
221
236
  this.setPropertiesFromObject(this._layer);
@@ -235,7 +250,11 @@ class LayerContentTreeItem extends VcsObjectContentTreeItem {
235
250
 
236
251
  this._listeners.push(
237
252
  this._app.maps.mapActivated.addEventListener(() => {
238
- this.visible = this._layer.isSupported(this._app.maps.activeMap);
253
+ isSupported = this._layer.isSupported(this._app.maps.activeMap);
254
+ this.visible = isSupported || this._showWhenNotSupported;
255
+ if (this._showWhenNotSupported) {
256
+ this.disabled = !isSupported;
257
+ }
239
258
  }),
240
259
  );
241
260
  }
@@ -260,6 +279,9 @@ class LayerContentTreeItem extends VcsObjectContentTreeItem {
260
279
  toJSON() {
261
280
  const config = super.toJSON();
262
281
  config.layerName = this._layerName;
282
+ if (this._showWhenNotSupported) {
283
+ config.showWhenNotSupported = this._showWhenNotSupported;
284
+ }
263
285
  return config;
264
286
  }
265
287
 
@@ -1,6 +1,7 @@
1
1
  export default LayerGroupContentTreeItem;
2
2
  export type LayerGroupContentTreeItemOptions = import("./contentTreeItem.js").ContentTreeItemOptions & {
3
3
  layerNames: string[];
4
+ showWhenNotSupported?: boolean;
4
5
  defaultViewpoint?: string;
5
6
  availableStyles?: string[];
6
7
  };
@@ -20,6 +21,11 @@ declare class LayerGroupContentTreeItem extends ContentTreeItem {
20
21
  * @private
21
22
  */
22
23
  private _layerNames;
24
+ /**
25
+ * @type {boolean}
26
+ * @private
27
+ */
28
+ private _showWhenNotSupported;
23
29
  /**
24
30
  * @type {Array<function():void>}
25
31
  * @private
@@ -1,3 +1,4 @@
1
+ import { parseBoolean } from '@vcsuite/parsers';
1
2
  import ContentTreeItem, {
2
3
  contentTreeClassRegistry,
3
4
  } from './contentTreeItem.js';
@@ -10,8 +11,9 @@ import { StateActionState } from '../actions/stateRefAction.js';
10
11
  import { executeCallbacks } from '../callback/vcsCallback.js';
11
12
 
12
13
  /**
13
- * @typedef {import("./contentTreeItem.js").ContentTreeItemOptions & { layerNames: string[], defaultViewpoint?: string, availableStyles?: string[] }} LayerGroupContentTreeItemOptions
14
+ * @typedef {import("./contentTreeItem.js").ContentTreeItemOptions & { layerNames: string[], showWhenNotSupported?: boolean, defaultViewpoint?: string, availableStyles?: string[] }} LayerGroupContentTreeItemOptions
14
15
  * @property {Array<string>} layerNames list of LayerNames which should be activated on click
16
+ * @property {boolean} [showWhenNotSupported=false] - optional flag to show the item even if it is not supported by the activeMap.
15
17
  * @property {string} [defaultViewpoint] - the name of an optional default viewpoint
16
18
  */
17
19
 
@@ -63,6 +65,15 @@ class LayerGroupContentTreeItem extends ContentTreeItem {
63
65
  ? options.layerNames.slice()
64
66
  : [];
65
67
 
68
+ /**
69
+ * @type {boolean}
70
+ * @private
71
+ */
72
+ this._showWhenNotSupported = parseBoolean(
73
+ options.showWhenNotSupported,
74
+ false,
75
+ );
76
+
66
77
  /**
67
78
  * @type {Array<function():void>}
68
79
  * @private
@@ -121,8 +132,14 @@ class LayerGroupContentTreeItem extends ContentTreeItem {
121
132
  }
122
133
  };
123
134
  const layers = this._layers;
135
+ let isSupported = layers.some((l) =>
136
+ l.isSupported(this._app.maps.activeMap),
137
+ );
124
138
 
125
- this.visible = layers.some((l) => l.isSupported(this._app.maps.activeMap));
139
+ this.visible = isSupported || this._showWhenNotSupported;
140
+ if (this._showWhenNotSupported) {
141
+ this.disabled = !isSupported;
142
+ }
126
143
  this.state = getStateFromLayers(layers);
127
144
  setViewpointAction(this, this._app, this._defaultViewpoint);
128
145
  setStyleAction(
@@ -148,9 +165,13 @@ class LayerGroupContentTreeItem extends ContentTreeItem {
148
165
 
149
166
  this._listeners.push(
150
167
  this._app.maps.mapActivated.addEventListener(() => {
151
- this.visible = !!layers.find((l) =>
168
+ isSupported = layers.some((l) =>
152
169
  l.isSupported(this._app.maps.activeMap),
153
170
  );
171
+ this.visible = isSupported || this._showWhenNotSupported;
172
+ if (this._showWhenNotSupported) {
173
+ this.disabled = !isSupported;
174
+ }
154
175
  }),
155
176
  );
156
177
  }
@@ -179,6 +200,9 @@ class LayerGroupContentTreeItem extends ContentTreeItem {
179
200
  toJSON() {
180
201
  const config = super.toJSON();
181
202
  config.layerNames = this._layerNames.slice();
203
+ if (this._showWhenNotSupported) {
204
+ config.showWhenNotSupported = this._showWhenNotSupported;
205
+ }
182
206
  if (this._defaultViewpoint) {
183
207
  config.defaultViewpoint = this._defaultViewpoint;
184
208
  }
@@ -1,10 +1,31 @@
1
1
  export default NodeContentTreeItem;
2
+ export type NodeContentTreeItemOptions = import("./contentTreeItem.js").ContentTreeItemOptions & {
3
+ disableIfChildrenDisabled?: boolean;
4
+ };
5
+ /**
6
+ * @typedef {import("./contentTreeItem.js").ContentTreeItemOptions & { disableIfChildrenDisabled?: boolean }} NodeContentTreeItemOptions
7
+ * @property {boolean} [disableIfChildrenDisabled=false] - optional flag to disable the contentTreeItem if all children are disabled.
8
+ */
2
9
  /**
3
10
  * A group item which has _no click handler_
4
11
  * @class
5
12
  * @extends {ContentTreeItem}
6
13
  */
7
14
  declare class NodeContentTreeItem extends ContentTreeItem {
15
+ /**
16
+ * @param {NodeContentTreeItemOptions} options
17
+ * @param {import("@src/vcsUiApp.js").default} app
18
+ */
19
+ constructor(options: NodeContentTreeItemOptions, app: import("@src/vcsUiApp.js").default);
20
+ /**
21
+ * @type {boolean}
22
+ * @private
23
+ */
24
+ private _disableIfChildrenDisabled;
8
25
  _childWatcher: import("vue").WatchStopHandle;
26
+ /**
27
+ * @returns {NodeContentTreeItemOptions}
28
+ */
29
+ toJSON(): NodeContentTreeItemOptions;
9
30
  }
10
31
  import ContentTreeItem from './contentTreeItem.js';
@@ -1,8 +1,14 @@
1
1
  import { watch } from 'vue';
2
+ import { parseBoolean } from '@vcsuite/parsers';
2
3
  import ContentTreeItem, {
3
4
  contentTreeClassRegistry,
4
5
  } from './contentTreeItem.js';
5
6
 
7
+ /**
8
+ * @typedef {import("./contentTreeItem.js").ContentTreeItemOptions & { disableIfChildrenDisabled?: boolean }} NodeContentTreeItemOptions
9
+ * @property {boolean} [disableIfChildrenDisabled=false] - optional flag to disable the contentTreeItem if all children are disabled.
10
+ */
11
+
6
12
  /**
7
13
  * A group item which has _no click handler_
8
14
  * @class
@@ -17,7 +23,7 @@ class NodeContentTreeItem extends ContentTreeItem {
17
23
  }
18
24
 
19
25
  /**
20
- * @param {import("./contentTreeItem.js").ContentTreeItemOptions} options
26
+ * @param {NodeContentTreeItemOptions} options
21
27
  * @param {import("@src/vcsUiApp.js").default} app
22
28
  */
23
29
  constructor(options, app) {
@@ -25,16 +31,39 @@ class NodeContentTreeItem extends ContentTreeItem {
25
31
 
26
32
  this.clickable = false;
27
33
 
34
+ /**
35
+ * @type {boolean}
36
+ * @private
37
+ */
38
+ this._disableIfChildrenDisabled = parseBoolean(
39
+ options.disableIfChildrenDisabled,
40
+ false,
41
+ );
42
+
28
43
  this._childWatcher = watch(
29
44
  this._children,
30
45
  () => {
31
46
  const children = this._children.value;
32
47
  this.visible = children.some((c) => c.visible);
48
+ if (this._disableIfChildrenDisabled) {
49
+ this.disabled = children.every((c) => c.disabled);
50
+ }
33
51
  },
34
- { deep: true },
52
+ { deep: true, immediate: true },
35
53
  );
36
54
  }
37
55
 
56
+ /**
57
+ * @returns {NodeContentTreeItemOptions}
58
+ */
59
+ toJSON() {
60
+ const config = super.toJSON();
61
+ if (this._disableIfChildrenDisabled) {
62
+ config.disableIfChildrenDisabled = this._disableIfChildrenDisabled;
63
+ }
64
+ return config;
65
+ }
66
+
38
67
  destroy() {
39
68
  this._childWatcher();
40
69
  super.destroy();
@@ -1,6 +1,7 @@
1
1
  export default ObliqueCollectionContentTreeItem;
2
2
  export type ObliqueCollectionContentTreeItemOptions = import("./contentTreeItem.js").ContentTreeItemOptions & {
3
3
  collectionName: string;
4
+ showWhenNotSupported?: boolean;
4
5
  };
5
6
  export type ObliqueCollectionContentTreeItemProperties = import("./vcsObjectContentTreeItem.js").VcsObjectContentTreeItemProperties & {
6
7
  defaultViewpoint: string;
@@ -20,6 +21,11 @@ declare class ObliqueCollectionContentTreeItem extends VcsObjectContentTreeItem<
20
21
  * @private
21
22
  */
22
23
  private _collectionName;
24
+ /**
25
+ * @type {boolean}
26
+ * @private
27
+ */
28
+ private _showWhenNotSupported;
23
29
  /**
24
30
  * @type {Array<function():void>}
25
31
  * @private
@@ -1,4 +1,5 @@
1
1
  import { ObliqueMap, DefaultObliqueCollection } from '@vcmap/core';
2
+ import { parseBoolean } from '@vcsuite/parsers';
2
3
  import VcsObjectContentTreeItem from './vcsObjectContentTreeItem.js';
3
4
  import { setViewpointAction } from './layerContentTreeItem.js';
4
5
  import { StateActionState } from '../actions/stateRefAction.js';
@@ -6,7 +7,8 @@ import { contentTreeClassRegistry } from './contentTreeItem.js';
6
7
  import { executeCallbacks } from '../callback/vcsCallback.js';
7
8
 
8
9
  /**
9
- * @typedef {import("./contentTreeItem.js").ContentTreeItemOptions & { collectionName: string }} ObliqueCollectionContentTreeItemOptions
10
+ * @typedef {import("./contentTreeItem.js").ContentTreeItemOptions & { collectionName: string, showWhenNotSupported?: boolean }} ObliqueCollectionContentTreeItemOptions
11
+ * @property {boolean} [showWhenNotSupported=false] - optional flag to show the item even if it is not supported by the activeMap.
10
12
  */
11
13
 
12
14
  /**
@@ -43,6 +45,15 @@ class ObliqueCollectionContentTreeItem extends VcsObjectContentTreeItem {
43
45
  */
44
46
  this._collectionName = options.collectionName;
45
47
 
48
+ /**
49
+ * @type {boolean}
50
+ * @private
51
+ */
52
+ this._showWhenNotSupported = parseBoolean(
53
+ options.showWhenNotSupported,
54
+ false,
55
+ );
56
+
46
57
  /**
47
58
  * @type {Array<function():void>}
48
59
  * @private
@@ -105,6 +116,9 @@ class ObliqueCollectionContentTreeItem extends VcsObjectContentTreeItem {
105
116
  const map = this._app.maps.activeMap;
106
117
  if (map instanceof ObliqueMap) {
107
118
  this.visible = true;
119
+ if (this._showWhenNotSupported) {
120
+ this.disabled = false;
121
+ }
108
122
  this.state =
109
123
  map.collection === this._collection
110
124
  ? StateActionState.ACTIVE
@@ -118,7 +132,10 @@ class ObliqueCollectionContentTreeItem extends VcsObjectContentTreeItem {
118
132
  }),
119
133
  );
120
134
  } else {
121
- this.visible = false;
135
+ this.visible = this._showWhenNotSupported;
136
+ if (this._showWhenNotSupported) {
137
+ this.disabled = this._showWhenNotSupported;
138
+ }
122
139
  }
123
140
 
124
141
  this.setPropertiesFromObject(this._collection);
@@ -171,6 +188,9 @@ class ObliqueCollectionContentTreeItem extends VcsObjectContentTreeItem {
171
188
  toJSON() {
172
189
  const config = super.toJSON();
173
190
  config.collectionName = this._collectionName;
191
+ if (this._showWhenNotSupported) {
192
+ config.showWhenNotSupported = this._showWhenNotSupported;
193
+ }
174
194
  return config;
175
195
  }
176
196
 
@@ -0,0 +1,56 @@
1
+ export default WmsChildContentTreeItem;
2
+ export type WMSChildItemOptions = import("./contentTreeItem.js").ContentTreeItemOptions & {
3
+ wmsEntry: import("./wmsGroupContentTreeItem.js").WMSEntry;
4
+ };
5
+ /**
6
+ * @typedef {import("./contentTreeItem.js").ContentTreeItemOptions &
7
+ * { wmsEntry:import("./wmsGroupContentTreeItem.js").WMSEntry }} WMSChildItemOptions
8
+ * @property {import("./wmsGroupContentTreeItem.js").WMSEntry} wmsEntry - the wmsEntry
9
+ * @property {boolean} showStyleSelector - show the style selector
10
+ */
11
+ /**
12
+ * A WMS child layer. Toggles this child in the parent WMS layer.
13
+ * @extends {ContentTreeItem}
14
+ * @class
15
+ */
16
+ declare class WmsChildContentTreeItem extends ContentTreeItem {
17
+ /**
18
+ * @param {WMSChildItemOptions} options
19
+ * @param {import("../vcsUiApp.js").default} app
20
+ */
21
+ constructor(options: WMSChildItemOptions, app: import("../vcsUiApp.js").default);
22
+ /**
23
+ * @type {import("./wmsGroupContentTreeItem.js").WMSEntry}
24
+ */
25
+ _wmsEntry: import("./wmsGroupContentTreeItem.js").WMSEntry;
26
+ /**
27
+ * @type {() => void}
28
+ */
29
+ _stateWatcher: () => void;
30
+ /**
31
+ * Event fires if the Item has been clicked
32
+ * @type {VcsEvent<void>}
33
+ */
34
+ clickedEvent: VcsEvent<void>;
35
+ /**
36
+ * Event fires if a style has been selected
37
+ * @type {VcsEvent<string>}
38
+ */
39
+ styleSelected: VcsEvent<string>;
40
+ /**
41
+ * @type {() => void}
42
+ */
43
+ _destroyStyleAction: () => void;
44
+ /**
45
+ * @type {import("./wmsGroupContentTreeItem.js").WMSEntry}
46
+ */
47
+ get wmsEntry(): import("./wmsGroupContentTreeItem.js").WMSEntry;
48
+ /**
49
+ * @param {number[]} [extent]
50
+ * @private
51
+ */
52
+ private _setExtentAction;
53
+ _setStyleAction(): void;
54
+ }
55
+ import ContentTreeItem from './contentTreeItem.js';
56
+ import { VcsEvent } from '@vcmap/core';
@@ -0,0 +1,159 @@
1
+ import { VcsEvent, Viewpoint } from '@vcmap/core';
2
+ import { reactive, computed, watch } from 'vue';
3
+ import {
4
+ createGoToViewpointAction,
5
+ createModalAction,
6
+ } from '../actions/actionHelper.js';
7
+ import { StateActionState } from '../actions/stateRefAction.js';
8
+ import ContentTreeItem from './contentTreeItem.js';
9
+ import VcsActionList from '../components/lists/VcsActionList.vue';
10
+ import { vcsAppSymbol } from '../pluginHelper.js';
11
+
12
+ /**
13
+ * @typedef {import("./contentTreeItem.js").ContentTreeItemOptions &
14
+ * { wmsEntry:import("./wmsGroupContentTreeItem.js").WMSEntry }} WMSChildItemOptions
15
+ * @property {import("./wmsGroupContentTreeItem.js").WMSEntry} wmsEntry - the wmsEntry
16
+ * @property {boolean} showStyleSelector - show the style selector
17
+ */
18
+
19
+ /**
20
+ * A WMS child layer. Toggles this child in the parent WMS layer.
21
+ * @extends {ContentTreeItem}
22
+ * @class
23
+ */
24
+ class WmsChildContentTreeItem extends ContentTreeItem {
25
+ static get className() {
26
+ return 'WmsChildContentTreeItem';
27
+ }
28
+
29
+ /**
30
+ * @param {WMSChildItemOptions} options
31
+ * @param {import("../vcsUiApp.js").default} app
32
+ */
33
+ constructor(options, app) {
34
+ super(options, app);
35
+
36
+ /**
37
+ * @type {import("./wmsGroupContentTreeItem.js").WMSEntry}
38
+ */
39
+ this._wmsEntry = options.wmsEntry;
40
+
41
+ /**
42
+ * @type {() => void}
43
+ */
44
+ this._stateWatcher = watch(
45
+ this._wmsEntry.active,
46
+ () => {
47
+ if (this._wmsEntry.active.value) {
48
+ this.state = StateActionState.ACTIVE;
49
+ } else {
50
+ this.state = StateActionState.INACTIVE;
51
+ }
52
+ },
53
+ { immediate: true },
54
+ );
55
+
56
+ /**
57
+ * Event fires if the Item has been clicked
58
+ * @type {VcsEvent<void>}
59
+ */
60
+ this.clickedEvent = new VcsEvent();
61
+
62
+ /**
63
+ * Event fires if a style has been selected
64
+ * @type {VcsEvent<string>}
65
+ */
66
+ this.styleSelected = new VcsEvent();
67
+
68
+ /**
69
+ * @type {() => void}
70
+ */
71
+ this._destroyStyleAction = () => {};
72
+
73
+ this._setExtentAction(this._wmsEntry.extent);
74
+ if (options.showStyleSelector) {
75
+ this._setStyleAction();
76
+ }
77
+ }
78
+
79
+ /**
80
+ * @type {import("./wmsGroupContentTreeItem.js").WMSEntry}
81
+ */
82
+ get wmsEntry() {
83
+ return this._wmsEntry;
84
+ }
85
+
86
+ /**
87
+ * @param {number[]} [extent]
88
+ * @private
89
+ */
90
+ _setExtentAction(extent) {
91
+ const name = 'content.layerExtentAction.name';
92
+ this.removeAction(name);
93
+ if (extent) {
94
+ const viewpoint = Viewpoint.createViewpointFromExtent(extent);
95
+ const action = createGoToViewpointAction(
96
+ {
97
+ name,
98
+ title: 'content.layerExtentAction.title',
99
+ },
100
+ viewpoint,
101
+ this._app.viewpoints,
102
+ this._app.maps,
103
+ );
104
+ this.addAction(action, 8);
105
+ }
106
+ }
107
+
108
+ _setStyleAction() {
109
+ const name = 'content.wmsStyleAction.name';
110
+ this.removeAction(name);
111
+ let modalAction = null;
112
+ if (this._wmsEntry.styles.length > 1) {
113
+ const styleActions = this._wmsEntry.styles.map((style) => {
114
+ return reactive({
115
+ name: style.title,
116
+ active: computed(
117
+ () => style.name === this.wmsEntry.activeStyle.value,
118
+ ),
119
+ callback: () => {
120
+ this.styleSelected.raiseEvent(style.name);
121
+ modalAction?.callback();
122
+ },
123
+ });
124
+ });
125
+ const { action, destroy } = createModalAction(
126
+ {
127
+ name,
128
+ icon: '$vcsColorSwatch',
129
+ title: 'content.styleAction.title',
130
+ },
131
+ {
132
+ component: VcsActionList,
133
+ position: { width: 200 },
134
+ props: { actions: styleActions },
135
+ },
136
+ this._app,
137
+ vcsAppSymbol,
138
+ );
139
+ modalAction = action;
140
+ this._destroyStyleAction = destroy;
141
+ this.addAction(action);
142
+ }
143
+ }
144
+
145
+ async clicked() {
146
+ await super.clicked();
147
+ this.clickedEvent.raiseEvent();
148
+ }
149
+
150
+ destroy() {
151
+ super.destroy();
152
+ this._stateWatcher();
153
+ this.clickedEvent.destroy();
154
+ this.styleSelected.destroy();
155
+ this._destroyStyleAction();
156
+ }
157
+ }
158
+
159
+ export default WmsChildContentTreeItem;