@vcmap/ui 6.2.2 → 6.2.4

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 (54) hide show
  1. package/config/dev.config.json +366 -2
  2. package/dist/assets/cesium.js +1 -1
  3. package/dist/assets/{core-4cd2e30d.js → core-b61fb7c0.js} +10577 -8847
  4. package/dist/assets/core-workers/panoramaImageWorker.js +1 -1
  5. package/dist/assets/core.js +1 -1
  6. package/dist/assets/ol.js +1 -1
  7. package/dist/assets/{ui-b13e28a1.css → ui-f33a5ee2.css} +1 -1
  8. package/dist/assets/{ui-b13e28a1.js → ui-f33a5ee2.js} +6864 -6737
  9. package/dist/assets/ui.js +1 -1
  10. package/dist/assets/vue.js +1 -1
  11. package/dist/assets/{vuetify-a1930526.js → vuetify-2fc014c4.js} +1 -1
  12. package/dist/assets/vuetify.js +1 -1
  13. package/index.d.ts +5 -1
  14. package/index.js +2 -1
  15. package/package.json +1 -1
  16. package/plugins/@vcmap-show-case/extent-example/src/ExtentExample.vue +28 -0
  17. package/plugins/@vcmap-show-case/extent-example/src/index.js +3 -14
  18. package/src/actions/actionHelper.d.ts +0 -1
  19. package/src/actions/actionHelper.js +3 -3
  20. package/src/application/VcsSettings.vue +4 -0
  21. package/src/components/extent/VcsExtent.vue +12 -1
  22. package/src/components/extent/VcsExtent.vue.d.ts +1 -0
  23. package/src/components/flight/VcsFlightAnchorsComponent.vue +2 -2
  24. package/src/components/lists/VcsList.vue +10 -18
  25. package/src/components/lists/VcsTreeNode.vue +8 -3
  26. package/src/components/lists/VcsTreeNode.vue.d.ts +4 -0
  27. package/src/components/lists/VcsTreeview.vue +2 -6
  28. package/src/components/lists/VcsTreeview.vue.d.ts +0 -1
  29. package/src/components/lists/dragHelper.d.ts +9 -2
  30. package/src/components/lists/dragHelper.js +47 -21
  31. package/src/contentTree/LayerSwap.vue +15 -4
  32. package/src/contentTree/LayerSwap.vue.d.ts +4 -4
  33. package/src/contentTree/contentTreeItem.js +1 -1
  34. package/src/contentTree/wmsGroupContentTreeItem.d.ts +74 -9
  35. package/src/contentTree/wmsGroupContentTreeItem.js +250 -88
  36. package/src/i18n/de.d.ts +1 -0
  37. package/src/i18n/de.js +1 -0
  38. package/src/i18n/en.d.ts +1 -0
  39. package/src/i18n/en.js +1 -0
  40. package/src/manager/collectionManager/CollectionComponentContent.vue +4 -4
  41. package/src/manager/collectionManager/CollectionComponentList.vue +2 -24
  42. package/src/manager/collectionManager/CollectionComponentList.vue.d.ts +0 -8
  43. package/src/manager/collectionManager/CollectionManager.vue +14 -1
  44. package/src/search/SearchComponent.vue +9 -11
  45. package/src/search/SearchComponent.vue.d.ts +2 -1
  46. package/src/state.d.ts +14 -0
  47. package/src/state.js +41 -0
  48. package/src/vcsUiApp.d.ts +9 -36
  49. package/src/vcsUiApp.js +45 -11
  50. /package/dist/assets/{cesium-b021f072.js → cesium-bc979301.js} +0 -0
  51. /package/dist/assets/core-workers/{panoramaImageWorker.js-90c60e81.js → panoramaImageWorker.js-2cf50d2d.js} +0 -0
  52. /package/dist/assets/{ol-c927b883.js → ol-28f9c83c.js} +0 -0
  53. /package/dist/assets/{vue-6a295c0b.js → vue-004523e0.js} +0 -0
  54. /package/dist/assets/{vuetify-a1930526.css → vuetify-2fc014c4.css} +0 -0
@@ -1,11 +1,3 @@
1
- /**
2
- * Moves an item to a new position.
3
- * New position is derived from a target item in the collection.
4
- * This ensures correct movement, if rendered list is only a subset of the collection.
5
- * @param {import("./collectionComponentClass.js").default<Object>} collectionComponent
6
- * @param {import("../../components/lists/dragHelper.js").ItemMovedEvent} event
7
- */
8
- export function moveItem(collectionComponent: import("./collectionComponentClass.js").default<Object>, { item, targetItem, position }: import("../../components/lists/dragHelper.js").ItemMovedEvent): void;
9
1
  declare const _default: import("vue").DefineComponent<{
10
2
  showLessButton: {
11
3
  type: BooleanConstructor;
@@ -28,7 +28,7 @@
28
28
  </template>
29
29
 
30
30
  <script>
31
- import { computed, inject, ref } from 'vue';
31
+ import { computed, inject, onUnmounted, ref } from 'vue';
32
32
  import { VExpansionPanels, VContainer } from 'vuetify/components';
33
33
  import CollectionComponentProvider from './CollectionComponentProvider.vue';
34
34
  import CollectionComponentList from './CollectionComponentList.vue';
@@ -57,6 +57,19 @@
57
57
  * @type {import("vue").Ref<string|null>}
58
58
  */
59
59
  const componentView = ref(null);
60
+
61
+ const removedListener = collectionManager.removed.addEventListener(
62
+ (collectionComponent) => {
63
+ if (componentView.value === collectionComponent.id) {
64
+ componentView.value = null;
65
+ }
66
+ },
67
+ );
68
+
69
+ onUnmounted(() => {
70
+ removedListener();
71
+ });
72
+
60
73
  /**
61
74
  * @type {import("vue").WritableComputedRef<number[]>}
62
75
  */
@@ -21,11 +21,7 @@
21
21
  </span>
22
22
  <template v-if="results.length > 0">
23
23
  <v-divider class="mt-1 base-darken-1" />
24
- <ResultsComponent
25
- :query="query"
26
- :results="results"
27
- :show-selected-only="showSelectedOnly"
28
- />
24
+ <ResultsComponent :query="query" :results="results" />
29
25
  <v-divider />
30
26
 
31
27
  <v-row no-gutters>
@@ -33,9 +29,10 @@
33
29
  <div class="button-container d-flex align-center px-2 pt-2 pb-1">
34
30
  <VcsFormButton
35
31
  class="fixed-button"
36
- @click="showSelectedOnly = !showSelectedOnly"
32
+ tooltip="search.hideWindow"
33
+ @click="closeWindow"
37
34
  >
38
- <v-icon icon="mdi-arrow-collapse-vertical" />
35
+ <v-icon icon="mdi-minus-box-multiple-outline" />
39
36
  </VcsFormButton>
40
37
  <VcsFormButton
41
38
  @click="zoomToAll"
@@ -71,6 +68,8 @@
71
68
  import VcsFormButton from '../components/buttons/VcsFormButton.vue';
72
69
  import { useFontSize } from '../vuePlugins/vuetify.js';
73
70
 
71
+ export const searchComponentId = 'searchId';
72
+
74
73
  /**
75
74
  * @description Stylized search component providing an input field for search inputs.
76
75
  * Renders a list of results using {@link ResultsComponent }
@@ -98,8 +97,6 @@
98
97
  const { xs } = useDisplay();
99
98
  let queryPreSuggestion = '';
100
99
 
101
- const showSelectedOnly = ref(false);
102
-
103
100
  let suggestionTimeout;
104
101
 
105
102
  const onInput = () => {
@@ -140,7 +137,6 @@
140
137
  suggesting.value = '';
141
138
  suggestions.value = [];
142
139
  queryPreSuggestion = '';
143
- showSelectedOnly.value = false;
144
140
  };
145
141
 
146
142
  const search = async () => {
@@ -163,7 +159,6 @@
163
159
  return fontSize.value + 11;
164
160
  });
165
161
  return {
166
- showSelectedOnly,
167
162
  xs,
168
163
  query,
169
164
  searching,
@@ -193,6 +188,9 @@
193
188
  query.value = queryPreSuggestion;
194
189
  }
195
190
  },
191
+ closeWindow() {
192
+ app.windowManager.remove(searchComponentId);
193
+ },
196
194
  };
197
195
  },
198
196
  };
@@ -1,5 +1,5 @@
1
+ export const searchComponentId: "searchId";
1
2
  declare const _default: import("vue").DefineComponent<{}, {
2
- showSelectedOnly: import("vue").Ref<boolean>;
3
3
  xs: import("vue").Ref<boolean>;
4
4
  query: import("vue").Ref<string>;
5
5
  searching: import("vue").Ref<boolean>;
@@ -15,5 +15,6 @@ declare const _default: import("vue").DefineComponent<{}, {
15
15
  selectedSuggestion: import("vue").Ref<number>;
16
16
  onInput: () => void;
17
17
  selectSuggestion(value: any): void;
18
+ closeWindow(): void;
18
19
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
19
20
  export default _default;
package/src/state.d.ts CHANGED
@@ -14,6 +14,20 @@ export function parseUrlProjectedViewpointState(state: UrlViewpointState, module
14
14
  * @returns {import("@vcmap/core").ViewpointOptions|null}
15
15
  */
16
16
  export function parseUrlExtentState(state: UrlExtentState, moduleId: string): import("@vcmap/core").ViewpointOptions | null;
17
+ /**
18
+ * @param {string} style
19
+ * @returns {{layers: string, styles: string}}
20
+ */
21
+ export function parseWMSStyle(style: string): {
22
+ layers: string;
23
+ styles: string;
24
+ };
25
+ /**
26
+ * @param {import("@vcmap/core").WMSLayer} layer
27
+ * @param {import("@vcmap/core").VcsModuleConfig=} moduleConfig
28
+ * @returns {string|undefined}
29
+ */
30
+ export function writeWMSStyleForLayer(layer: import("@vcmap/core").WMSLayer, moduleConfig?: import("@vcmap/core").VcsModuleConfig | undefined): string | undefined;
17
31
  /**
18
32
  * @param {(URL)=} url
19
33
  * @returns {AppState}
package/src/state.js CHANGED
@@ -203,6 +203,47 @@ export function parseUrlExtentState(state, moduleId) {
203
203
  }
204
204
  }
205
205
 
206
+ /**
207
+ * @param {string} style
208
+ * @returns {{layers: string, styles: string}}
209
+ */
210
+ export function parseWMSStyle(style) {
211
+ const [layerLengthString, parts] = style.split(';');
212
+ const layerLength = parseInt(layerLengthString, 10);
213
+ return {
214
+ layers: parts.substring(0, layerLength),
215
+ styles: parts.substring(layerLength),
216
+ };
217
+ }
218
+
219
+ /**
220
+ * @param {import("@vcmap/core").WMSLayer} layer
221
+ * @param {import("@vcmap/core").VcsModuleConfig=} moduleConfig
222
+ * @returns {string|undefined}
223
+ */
224
+ export function writeWMSStyleForLayer(layer, moduleConfig) {
225
+ const config = moduleConfig?.layers?.find((m) => m.name === layer.name) ?? {
226
+ layers: '',
227
+ parameters: {},
228
+ };
229
+ let currentLayers = layer.getLayers().join(',');
230
+ if (currentLayers === config.layers) {
231
+ currentLayers = '';
232
+ }
233
+
234
+ let currentStyle = layer.parameters.STYLES || '';
235
+ if (
236
+ currentStyle === config.parameters.STYLES ||
237
+ currentStyle === config.parameters.styles
238
+ ) {
239
+ currentStyle = '';
240
+ }
241
+ if (currentLayers || currentStyle) {
242
+ return `${currentLayers.length};${currentLayers}${currentStyle}`;
243
+ }
244
+ return undefined;
245
+ }
246
+
206
247
  /**
207
248
  * @param {UrlLayerState} state
208
249
  * @returns {LayerState}
package/src/vcsUiApp.d.ts CHANGED
@@ -256,7 +256,10 @@ declare class VcsUiApp extends VcsApp {
256
256
  defaults: import("vue").Ref<import("vuetify").DefaultsInstance>;
257
257
  display: import("vuetify").DisplayInstance;
258
258
  theme: import("vuetify").ThemeInstance & {
259
- install: (app: import("vue").App<any>) => void;
259
+ install: (app: import("vue").App<any>) => void; /**
260
+ * @type {WindowManager}
261
+ * @private
262
+ */
260
263
  };
261
264
  icons: {
262
265
  defaultSet: string;
@@ -282,33 +285,7 @@ declare class VcsUiApp extends VcsApp {
282
285
  formats?: any;
283
286
  }) => import("vuetify").DateInstance) | import("vuetify").DateInstance;
284
287
  formats?: Record<string, any> | undefined;
285
- locale: Record<string, any>; /**
286
- * Interface for VcsPlugins.
287
- * The function implementing the interface should not throw!
288
- * @typedef {{
289
- * name: string,
290
- * version: string,
291
- * mapVersion: string,
292
- * i18n?: Object<string, unknown>,
293
- * initialize?: function(import("@src/vcsUiApp.js").default, S=):void|Promise<void>,
294
- * onVcsAppMounted?: function(import("@src/vcsUiApp.js").default):void,
295
- * toJSON?: function(): C,
296
- * getDefaultOptions?: function(): C,
297
- * getState?: function(boolean=):S|Promise<S>,
298
- * getConfigEditors?: function():Array<PluginConfigEditor<object>>,
299
- * destroy?: function(): void
300
- * }} VcsPlugin
301
- * @template {Object} C - plugin config
302
- * @template {Object} S - plugin state
303
- * @property {Object<string, *>} [i18n] - the i18n messages of this plugin
304
- * @property {function(import("@src/vcsUiApp.js").default, S=)} initialize - called on plugin added. Is passed the VcsUiApp and optionally, the state for the plugin
305
- * @property {function(import("@src/vcsUiApp.js").default)} onVcsAppMounted - called on mounted of VcsApp.vue
306
- * @property {function():C} [toJSON] - should return the plugin's serialization excluding all default values
307
- * @property {function():C} [getDefaultOptions] - should return the plugin's default options
308
- * @property {function(boolean=):S|Promise<S>} [getState] - should return the plugin's state or a promise for said state. is passed a "for url" flag. If true, only the state relevant for sharing a URL should be passed and short keys shall be used
309
- * @property {Array<PluginConfigEditor>} [getConfigEditors] - should return components for configuring the plugin or custom items defined by the plugin
310
- * @api
311
- */
288
+ locale: Record<string, any>;
312
289
  };
313
290
  instance: {
314
291
  locale?: any;
@@ -323,10 +300,6 @@ declare class VcsUiApp extends VcsApp {
323
300
  endOfWeek: (date: unknown) => unknown;
324
301
  startOfMonth: (date: unknown) => unknown;
325
302
  endOfMonth: (date: unknown) => unknown;
326
- /**
327
- * @type {ContextMenuManager}
328
- * @private
329
- */
330
303
  startOfYear: (date: unknown) => unknown;
331
304
  endOfYear: (date: unknown) => unknown;
332
305
  isAfter: (date: unknown, comparing: unknown) => boolean;
@@ -348,9 +321,7 @@ declare class VcsUiApp extends VcsApp {
348
321
  getDiff: (date: unknown, comparing: unknown, unit?: string | undefined) => number;
349
322
  getWeekArray: (date: unknown, firstDayOfWeek?: string | number | undefined) => unknown[][];
350
323
  getWeekdays: (firstDayOfWeek?: string | number | undefined) => string[];
351
- getMonth: (date: unknown) => number; /**
352
- * @type {import("@vcmap/core").OverrideClassRegistry<typeof AbstractFeatureInfoView>}
353
- */
324
+ getMonth: (date: unknown) => number;
354
325
  setMonth: (date: unknown, month: number) => unknown;
355
326
  getDate: (date: unknown) => number;
356
327
  setDate: (date: unknown, day: number) => unknown;
@@ -358,7 +329,9 @@ declare class VcsUiApp extends VcsApp {
358
329
  getPreviousMonth: (date: unknown) => unknown;
359
330
  getHours: (date: unknown) => number;
360
331
  setHours: (date: unknown, hours: number) => unknown;
361
- getMinutes: (date: unknown) => number;
332
+ getMinutes: (date: unknown) => number; /**
333
+ * @returns {PanelManager}
334
+ */
362
335
  setMinutes: (date: unknown, minutes: number) => unknown;
363
336
  };
364
337
  };
package/src/vcsUiApp.js CHANGED
@@ -11,6 +11,7 @@ import {
11
11
  VcsEvent,
12
12
  Viewpoint,
13
13
  volatileModuleId,
14
+ WMSLayer,
14
15
  } from '@vcmap/core';
15
16
  import { getLogger as getLoggerByName } from '@vcsuite/logger';
16
17
  import { deserializePlugin, serializePlugin } from './pluginHelper.js';
@@ -36,7 +37,12 @@ import FeatureInfo, {
36
37
  featureInfoClassRegistry,
37
38
  } from './featureInfo/featureInfo.js';
38
39
  import UiConfig from './uiConfig.js';
39
- import { createEmptyState, getStateFromURL } from './state.js';
40
+ import {
41
+ createEmptyState,
42
+ getStateFromURL,
43
+ parseWMSStyle,
44
+ writeWMSStyleForLayer,
45
+ } from './state.js';
40
46
  import { version } from '../package.json';
41
47
  import Search from './search/search.js';
42
48
  import Notifier from './notifier/notifier.js';
@@ -557,9 +563,17 @@ class VcsUiApp extends VcsApp {
557
563
  */
558
564
  async getState(forUrl) {
559
565
  const state = createEmptyState();
560
- state.moduleIds = this.modules
561
- .filter(({ _id }) => _id !== defaultDynamicModuleId)
562
- .map(({ _id }) => _id);
566
+ const nonDynamicModules = this.modules.filter(
567
+ ({ _id }) => _id !== defaultDynamicModuleId,
568
+ );
569
+
570
+ if (nonDynamicModules.some((m) => !m.config._id)) {
571
+ getLogger().warning(
572
+ 'Some modules you are creating are missing a stable _id property. This may lead to issues while restoring application state.',
573
+ );
574
+ }
575
+
576
+ state.moduleIds = nonDynamicModules.map(({ _id }) => _id);
563
577
 
564
578
  state.activeMap = this.maps.activeMap.name;
565
579
  const viewpoint = await this.maps.activeMap.getViewpoint();
@@ -591,6 +605,12 @@ class VcsUiApp extends VcsApp {
591
605
  l.style[moduleIdSymbol] !== volatileModuleId
592
606
  ) {
593
607
  layerState.styleName = l.style.name;
608
+ } else if (l instanceof WMSLayer) {
609
+ const module = this.getModuleById(l[moduleIdSymbol]);
610
+ const styleName = writeWMSStyleForLayer(l, module?.config);
611
+ if (styleName) {
612
+ layerState.styleName = styleName;
613
+ }
594
614
  }
595
615
  return layerState;
596
616
  });
@@ -642,6 +662,11 @@ class VcsUiApp extends VcsApp {
642
662
  */
643
663
  async _parseModule(module) {
644
664
  const { config } = module;
665
+ if (!config._id) {
666
+ getLogger().warning(
667
+ 'A module is missing a stable _id property. This may lead to issues while restoring application state.',
668
+ );
669
+ }
645
670
  if (Array.isArray(config.plugins)) {
646
671
  await this._plugins.parseItems(config.plugins, module._id);
647
672
  }
@@ -667,7 +692,7 @@ class VcsUiApp extends VcsApp {
667
692
  if (layer) {
668
693
  if (layerState.active) {
669
694
  layer.activate().catch((e) => {
670
- getLogger().warn(
695
+ getLogger().warning(
671
696
  'Failed to activate cached app state. layer failed: ',
672
697
  layer.name,
673
698
  );
@@ -677,12 +702,21 @@ class VcsUiApp extends VcsApp {
677
702
  layer.deactivate();
678
703
  }
679
704
 
680
- if (
681
- layerState.styleName &&
682
- this.styles.hasKey(layerState.styleName) &&
683
- layer.setStyle
684
- ) {
685
- layer.setStyle(this.styles.getByKey(layerState.styleName));
705
+ if (layerState.styleName) {
706
+ if (this.styles.hasKey(layerState.styleName) && layer.setStyle) {
707
+ layer.setStyle(this.styles.getByKey(layerState.styleName));
708
+ } else if (layer instanceof WMSLayer) {
709
+ const { layers, styles } = parseWMSStyle(layerState.styleName);
710
+ if (styles) {
711
+ layer.parameters.STYLES = styles;
712
+ }
713
+ layer.setLayers(layers || layer.getLayers()).catch((err) => {
714
+ getLogger().warning(
715
+ `Failed to set WMS layers ${layers} on layer ${layer.name}`,
716
+ err,
717
+ );
718
+ });
719
+ }
686
720
  }
687
721
  }
688
722
  });
File without changes