@vcmap/ui 5.0.0-rc.15 → 5.0.0-rc.16

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 (75) hide show
  1. package/config/base.config.json +4 -0
  2. package/config/dev.config.json +5 -1
  3. package/config/www.config.json +5 -3
  4. package/dist/assets/{cesium.2e288a.js → cesium.430460.js} +0 -0
  5. package/dist/assets/cesium.js +1 -1
  6. package/dist/assets/{core.8014d3.js → core.5089ba.js} +5925 -4374
  7. package/dist/assets/core.js +1 -1
  8. package/dist/assets/{index.3f74fa92.js → index.854f8e2b.js} +1 -1
  9. package/dist/assets/{ol.31c3a5.js → ol.9be53a.js} +0 -0
  10. package/dist/assets/ol.js +1 -1
  11. package/dist/assets/ui.49010a.css +1 -0
  12. package/dist/assets/{ui.36f84f.js → ui.49010a.js} +3907 -3232
  13. package/dist/assets/ui.js +1 -1
  14. package/dist/assets/{vue.a39c10.js → vue.247c1c.js} +0 -0
  15. package/dist/assets/vue.js +2 -2
  16. package/dist/assets/{vuetify.378637.css → vuetify.735e58.css} +1 -1
  17. package/dist/assets/{vuetify.378637.js → vuetify.735e58.js} +1 -1
  18. package/dist/assets/vuetify.js +2 -2
  19. package/dist/index.html +1 -1
  20. package/index.html +77 -0
  21. package/index.js +4 -0
  22. package/package.json +4 -2
  23. package/plugins/@vcmap/create-link/fallbackCreateLink.vue +4 -1
  24. package/plugins/@vcmap/create-link/index.js +4 -1
  25. package/plugins/@vcmap/pluginExample/exampleActions.js +45 -0
  26. package/plugins/@vcmap/pluginExample/index.js +24 -1
  27. package/plugins/@vcmap/pluginExample/pluginExampleComponent.vue +70 -42
  28. package/plugins/@vcmap/search-nominatim/nominatim.js +1 -1
  29. package/plugins/@vcmap/theme-changer/ThemeChangerComponent.vue +4 -2
  30. package/plugins/notifier/index.js +31 -0
  31. package/plugins/notifier/notifierTester.vue +88 -0
  32. package/plugins/package.json +1 -1
  33. package/plugins/test/allIconsComponent.vue +2 -2
  34. package/plugins/test/emptyComponent.vue +1 -1
  35. package/plugins/test/index.js +22 -0
  36. package/plugins/test/myCustomHeader.vue +9 -1
  37. package/plugins/test/testList.vue +287 -0
  38. package/plugins/test/windowManagerExample.vue +3 -0
  39. package/plugins/wizardExample/index.js +41 -0
  40. package/plugins/wizardExample/wizardExample.vue +77 -0
  41. package/src/application/VcsApp.vue +18 -8
  42. package/src/components/form-inputs-controls/VcsFormSection.vue +10 -10
  43. package/src/components/form-inputs-controls/VcsSelect.vue +33 -1
  44. package/src/components/form-inputs-controls/VcsTextField.vue +11 -3
  45. package/src/components/form-inputs-controls/VcsWizard.vue +133 -0
  46. package/src/components/imageElementInjector.vue +22 -0
  47. package/src/components/lists/VcsList.vue +466 -0
  48. package/src/components/lists/VcsTreeview.vue +1 -2
  49. package/src/components/lists/VcsTreeviewLeaf.vue +18 -50
  50. package/src/components/lists/VcsTreeviewSearchbar.vue +1 -23
  51. package/src/components/tables/VcsTable.vue +13 -1
  52. package/src/contentTree/LayerTree.vue +1 -1
  53. package/src/contentTree/contentTreeItem.js +13 -13
  54. package/src/contentTree/subContentTreeItem.js +1 -1
  55. package/src/contentTree/vcsObjectContentTreeItem.js +1 -1
  56. package/src/featureInfo/BalloonComponent.vue +10 -8
  57. package/src/featureInfo/balloonFeatureInfoView.js +14 -14
  58. package/src/featureInfo/balloonHelper.js +4 -0
  59. package/src/featureInfo/featureInfo.js +13 -0
  60. package/src/featureInfo/featureInfoInteraction.js +1 -1
  61. package/src/i18n/de.js +7 -0
  62. package/src/i18n/en.js +7 -0
  63. package/src/icons/+all.js +4 -0
  64. package/src/icons/WandIcon.vue +63 -0
  65. package/src/manager/window/WindowComponent.vue +9 -2
  66. package/src/manager/window/WindowComponentHeader.vue +33 -7
  67. package/src/manager/window/WindowManager.vue +1 -0
  68. package/src/manager/window/windowManager.js +11 -1
  69. package/src/navigation/overviewMap.js +10 -9
  70. package/src/notifier/notifier.js +121 -0
  71. package/src/notifier/notifierComponent.vue +84 -0
  72. package/src/styles/variables.scss +19 -3
  73. package/src/vcsUiApp.js +19 -1
  74. package/src/vuePlugins/vuetify.js +2 -0
  75. package/dist/assets/ui.36f84f.css +0 -1
@@ -0,0 +1,121 @@
1
+ import { ref, shallowRef } from 'vue';
2
+ import { v4 as uuidv4 } from 'uuid';
3
+
4
+ /**
5
+ * @typedef {Object} NotificationOptions
6
+ * @property {string} message
7
+ * @property {NotificationType} type
8
+ * @property {string} [title]
9
+ * @property {number} [timeout=5000]
10
+ */
11
+
12
+ /**
13
+ * @typedef {Object} Notification
14
+ * @property {string} id
15
+ * @property {string} message
16
+ * @property {NotificationType} type
17
+ * @property {string} [title]
18
+ * @property {number} timeout
19
+ * @property {import("vue").Ref<boolean>} open
20
+ * @property {function():void} close
21
+ */
22
+
23
+ /**
24
+ * @enum {string}
25
+ */
26
+ export const NotificationType = {
27
+ ERROR: 'error',
28
+ WARNING: 'warning',
29
+ INFO: 'info',
30
+ SUCCESS: 'success',
31
+ };
32
+
33
+ /**
34
+ * @param {NotificationOptions} options
35
+ * @param {Notifier} notifier
36
+ * @returns {Notification}
37
+ */
38
+ function createNotification(options, notifier) {
39
+ const {
40
+ type,
41
+ title,
42
+ message,
43
+ timeout,
44
+ } = options;
45
+ const id = uuidv4();
46
+ const open = ref(true);
47
+
48
+ return {
49
+ get id() { return id; },
50
+ get type() { return type; },
51
+ get title() { return title; },
52
+ get message() { return message; },
53
+ get timeout() { return timeout ?? 5000; },
54
+ get open() { return open; },
55
+ set open(value) {
56
+ open.value = value?.value ?? value; // when used as a v-model, this is set as a boolean
57
+ if (!open.value) {
58
+ this.close();
59
+ }
60
+ },
61
+ close() {
62
+ open.value = false;
63
+ setTimeout(() => {
64
+ notifier.remove(this);
65
+ }, 100);
66
+ },
67
+ };
68
+ }
69
+
70
+ /**
71
+ * API for adding snackbar notification to the VcsUiApp. This is simply a container and on its own will not render anything.
72
+ * Typically, you do not need to instantiate this yourself, but use the notifier on the {@see VcsUiApp}.
73
+ * @class
74
+ */
75
+ class Notifier {
76
+ constructor() {
77
+ /**
78
+ * @type {import("vue").Ref<Array<Notification>>}
79
+ * @private
80
+ */
81
+ this._notifications = shallowRef([]);
82
+ }
83
+
84
+ /**
85
+ * @type {import("vue").Ref<Array<Notification>>}
86
+ * @readonly
87
+ */
88
+ get notifications() {
89
+ return this._notifications;
90
+ }
91
+
92
+ /**
93
+ * @param {NotificationOptions} notification
94
+ * @returns {Notification}
95
+ */
96
+ add(notification) {
97
+ const note = createNotification(notification, this);
98
+ this._notifications.value.push(note);
99
+ return note;
100
+ }
101
+
102
+ /**
103
+ * @param {Notification} notification
104
+ */
105
+ remove(notification) {
106
+ const index = this._notifications.value.indexOf(notification);
107
+ if (index > -1) {
108
+ this._notifications.value.splice(index, 1);
109
+ }
110
+ }
111
+
112
+ /**
113
+ * @param {Notification} notification
114
+ * @returns {boolean}
115
+ */
116
+ has(notification) {
117
+ return this._notifications.value.includes(notification);
118
+ }
119
+ }
120
+
121
+ export default Notifier;
@@ -0,0 +1,84 @@
1
+ <template>
2
+ <div>
3
+ <v-snackbar
4
+ dark
5
+ v-for="(notification) in notifications"
6
+ :key="notification.id"
7
+ v-model="notification.open"
8
+ :timeout="notification.timeout"
9
+ >
10
+ <v-icon
11
+ :color="notification.type"
12
+ >
13
+ {{ icon[notification.type] }}
14
+ </v-icon>
15
+ <span class="snack-title">{{ $t(notification.title || defaultTitle[notification.type]) }}</span>
16
+ <template #action="{ attrs }">
17
+ <VcsButton
18
+ icon="mdi-close"
19
+ small
20
+ v-bind="attrs"
21
+ @click="notification.open = false"
22
+ />
23
+ </template>
24
+ <span>{{ $t(notification.message) }}</span>
25
+ </v-snackbar>
26
+ </div>
27
+ </template>
28
+
29
+ <script>
30
+ import { VSnackbar, VIcon } from 'vuetify/lib';
31
+ import { inject } from 'vue';
32
+ import VcsButton from '../components/buttons/VcsButton.vue';
33
+ import { NotificationType } from './notifier.js';
34
+
35
+ export default {
36
+ components: {
37
+ VSnackbar,
38
+ VcsButton,
39
+ VIcon,
40
+ },
41
+ name: 'NotifierComponent',
42
+ setup() {
43
+ const app = inject('vcsApp');
44
+
45
+ return {
46
+ notifications: app.notifier.notifications,
47
+ icon: {
48
+ [NotificationType.ERROR]: 'mdi-alert-box',
49
+ [NotificationType.WARNING]: 'mdi-alert',
50
+ [NotificationType.INFO]: 'mdi-information',
51
+ [NotificationType.SUCCESS]: 'mdi-check-circle',
52
+ },
53
+ defaultTitle: {
54
+ [NotificationType.ERROR]: 'notification.error',
55
+ [NotificationType.WARNING]: 'notification.warning',
56
+ [NotificationType.INFO]: 'notification.information',
57
+ [NotificationType.SUCCESS]: 'notification.success',
58
+ },
59
+ };
60
+ },
61
+ };
62
+ </script>
63
+
64
+ <style lang="scss" scoped>
65
+ .v-snack{
66
+ ::v-deep{
67
+ .v-snack__content{
68
+ display: grid;
69
+ gap: 8px 4px;
70
+ grid-template-columns: 20px auto;
71
+ .v-icon{
72
+ grid-row-start: 1;
73
+ grid-row-end: 3;
74
+ align-self: start;
75
+ font-size: 17px;
76
+ }
77
+ }
78
+ .v-snack__action{
79
+ align-self: flex-start;
80
+ margin-top: 4px;
81
+ }
82
+ }
83
+ }
84
+ </style>
@@ -47,7 +47,6 @@ $icon-size: 20px; // 24px !default;
47
47
  $icon-size-dense: 16px; // 20px !default;
48
48
 
49
49
  /** VcsSelect **/
50
-
51
50
  $select-dense-selections-margin: 4px 4px 3px 0; // 5px 4px 3px 0 !default;
52
51
 
53
52
  // list box
@@ -61,10 +60,10 @@ $list-item-min-height: 32px; // 48px !default;
61
60
  $list-dense-min-height: 24px; // 40px !default;
62
61
  $list-item-content-padding: 4px 0; // 12px 0 !default;
63
62
  $list-dense-content-padding: 0 0; // 8px 0 !default;
64
- $list-item-action-icon-margin: 0 0; //32px !default;
63
+ $list-item-action-icon-margin: 0; //32px !default;
65
64
  $list-item-action-margin: 0 0; // 12px 0 !default;
66
65
  $list-item-icon-margin: auto 0; // 16px 0 !default;
67
-
66
+ $list-item-content-children-margin-bottom: 0; // 2px !default;
68
67
 
69
68
  /** Treeview **/
70
69
  $treeview-node-level-width: 16px;
@@ -79,3 +78,20 @@ $expansion-panel-content-padding: 0 0 4px; // 0 24px 16px !default;
79
78
 
80
79
  /** Footer **/
81
80
  $footer-padding: 0 8px; // 6px 16px !default;
81
+
82
+ /** Wizard **/
83
+ $stepper-vertical-padding-bottom: 16px; // 36px !default;
84
+ $stepper-vertical-step-padding: 12px 8px;
85
+ $stepper-vertical-content-ltr-margin: -14px 0 -14px 13px; // -8px -36px -16px 36px !default;
86
+ $stepper-vertical-content-ltr-padding: 16px 8px 16px 16px; // 16px 23px 16px 60px !default;
87
+ $stepper-vertical-step-step-margin: 8px;
88
+ $stepper-step-step-min-width: 12px;
89
+ $stepper-step-step-width: 12px;
90
+ $stepper-step-step-height: 12px;
91
+
92
+ /** Snackbar **/
93
+ $snackbar-bottom: 36px;
94
+ $snackbar-background-color: rgba(0, 0, 0, 0.8);
95
+ $snackbar-content-padding: 8px;
96
+ $snackbar-action-margin: 8px;
97
+ $snackbar-wrapper-min-height: 36px;
package/src/vcsUiApp.js CHANGED
@@ -31,6 +31,7 @@ import UiConfig from './uiConfig.js';
31
31
  import { createEmptyState, getStateFromURL } from './state.js';
32
32
  import { version } from '../package.json';
33
33
  import Search from './search/search.js';
34
+ import Notifier from './notifier/notifier.js';
34
35
 
35
36
  /**
36
37
  * @typedef {import("@vcmap/core").VcsAppConfig} VcsUiAppConfig
@@ -135,7 +136,11 @@ class VcsUiApp extends VcsApp {
135
136
  if (this._cachedAppState.contextIds.includes(plugin[contextIdSymbol])) {
136
137
  state = this._cachedAppState.plugins.find(s => s.name === plugin.name);
137
138
  }
138
- plugin.initialize(this, state?.state);
139
+ try {
140
+ plugin.initialize(this, state?.state);
141
+ } catch (e) {
142
+ getLogger().error(`Error in plugin ${plugin.name} initialize hook`, e);
143
+ }
139
144
  }
140
145
  }),
141
146
  this._plugins.removed.addEventListener(async (plugin) => {
@@ -219,6 +224,12 @@ class VcsUiApp extends VcsApp {
219
224
  */
220
225
  this._search = new Search(this);
221
226
 
227
+ /**
228
+ * @type {Notifier}
229
+ * @private
230
+ */
231
+ this._notifier = new Notifier();
232
+
222
233
  /**
223
234
  * @type {AppState}
224
235
  * @private
@@ -304,6 +315,12 @@ class VcsUiApp extends VcsApp {
304
315
  */
305
316
  get uiConfig() { return this._uiConfig; }
306
317
 
318
+ /**
319
+ * @type {Notifier}
320
+ * @readonly
321
+ */
322
+ get notifier() { return this._notifier; }
323
+
307
324
  /**
308
325
  * Get the state of the application. When passed the forUrl flag, only a minimal set of states shall be provided for a sharable link to the current state (to ensure
309
326
  * the maximum URL length is not exceeded). This includes: layer active state & styling, active map, active viewpoint,
@@ -335,6 +352,7 @@ class VcsUiApp extends VcsApp {
335
352
  active: l.active || l.loading,
336
353
  };
337
354
  if (
355
+ l.style &&
338
356
  l.style.name !== l.defaultStyle.name &&
339
357
  this.styles.has(l.style) &&
340
358
  l.style[contextIdSymbol] !== defaultDynamicContextId &&
@@ -46,6 +46,8 @@ export function createVuetify() {
46
46
  accent: '#757575',
47
47
  warning: '#FFCE00',
48
48
  error: '#FF5252',
49
+ info: '#2196F3',
50
+ success: '#4CAF50',
49
51
  },
50
52
  },
51
53
  },