@vcmap/ui 6.3.9 → 6.3.11

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/dist/assets/ui.js CHANGED
@@ -1 +1 @@
1
- export * from "./ui-932f5e80.js";
1
+ export * from "./ui-da598216.js";
@@ -1 +1 @@
1
- export * from "./vue-f70f4573.js";
1
+ export * from "./vue-20dd2b78.js";
@@ -10,7 +10,7 @@ function loadCss(href) {
10
10
  elem.onerror = reject;
11
11
  document.head.appendChild(elem);
12
12
  });
13
- } await loadCss('./assets/vuetify-9288f7c7.css');import { watch as Q, onScopeDispose as Ze, effectScope as Zl, shallowRef as K, reactive as it, computed as b, watchEffect as Fe, toRefs as Yt, capitalize as Nn, unref as ot, Fragment as ie, isVNode as Rc, Comment as Nc, warn as ja, getCurrentInstance as Hc, ref as j, provide as De, inject as ye, defineComponent as zc, h as Gt, camelize as Ir, toRaw as Be, createVNode as r, mergeProps as O, onBeforeUnmount as Qe, readonly as Ql, onMounted as Ye, onDeactivated as _r, onActivated as Wc, nextTick as we, TransitionGroup as Jl, Transition as jt, isRef as Tn, toRef as $, onBeforeMount as ra, withDirectives as $e, resolveDirective as gt, vShow as Ct, onUpdated as jc, Text as Uc, resolveDynamicComponent as Yc, markRaw as Gc, Teleport as Kc, cloneVNode as qc, createTextVNode as Tt, onUnmounted as Tr, onBeforeUpdate as Xc, withModifiers as Tl, toDisplayString as Zc, vModelText as Qc, resolveComponent as Jc, render as Ar } from "./vue-f70f4573.js";
13
+ } await loadCss('./assets/vuetify-1429f242.css');import { watch as Q, onScopeDispose as Ze, effectScope as Zl, shallowRef as K, reactive as it, computed as b, watchEffect as Fe, toRefs as Yt, capitalize as Nn, unref as ot, Fragment as ie, isVNode as Rc, Comment as Nc, warn as ja, getCurrentInstance as Hc, ref as j, provide as De, inject as ye, defineComponent as zc, h as Gt, camelize as Ir, toRaw as Be, createVNode as r, mergeProps as O, onBeforeUnmount as Qe, readonly as Ql, onMounted as Ye, onDeactivated as _r, onActivated as Wc, nextTick as we, TransitionGroup as Jl, Transition as jt, isRef as Tn, toRef as $, onBeforeMount as ra, withDirectives as $e, resolveDirective as gt, vShow as Ct, onUpdated as jc, Text as Uc, resolveDynamicComponent as Yc, markRaw as Gc, Teleport as Kc, cloneVNode as qc, createTextVNode as Tt, onUnmounted as Tr, onBeforeUpdate as Xc, withModifiers as Tl, toDisplayString as Zc, vModelText as Qc, resolveComponent as Jc, render as Ar } from "./vue-20dd2b78.js";
14
14
  function rt(e, n) {
15
15
  let t;
16
16
  function a() {
@@ -1 +1 @@
1
- export * from "./vuetify-9288f7c7.js";
1
+ export * from "./vuetify-1429f242.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vcmap/ui",
3
- "version": "6.3.9",
3
+ "version": "6.3.11",
4
4
  "author": "Virtual City Systems",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -55,7 +55,7 @@
55
55
  },
56
56
  "peerDependencies": {
57
57
  "@vcmap-cesium/engine": "^11.0.5",
58
- "@vcmap/core": "^6.3.8",
58
+ "@vcmap/core": "^6.3.9",
59
59
  "ol": "^10.4.0",
60
60
  "vue": "~3.4.38",
61
61
  "vuetify": "~3.7.14"
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div>
3
3
  <VcsHelp
4
- text="Below all config editors provided by plugins are listed. Important Note: Changes made in editors are not applied!"
4
+ text="Below all config editors provided by plugins are listed. Changes made in editors are applied by removing and re-adding the plugin with the new config."
5
5
  ></VcsHelp>
6
6
  <VcsList :items="plugins" :show-title="false" />
7
7
  </div>
@@ -10,6 +10,7 @@
10
10
  <script>
11
11
  import { inject, onUnmounted, ref } from 'vue';
12
12
  import { VcsList, createToggleAction, WindowSlot, VcsHelp } from '@vcmap/ui';
13
+ import deepEqual from 'fast-deep-equal';
13
14
  import { name } from '../package.json';
14
15
 
15
16
  export default {
@@ -42,14 +43,35 @@
42
43
  getConfig: () => {
43
44
  return vcsApp.plugins.getSerializedByKey(plugin.name);
44
45
  },
45
- setConfig(config) {
46
+ async setConfig(config) {
46
47
  if (config) {
47
- vcsApp.notifier.add({
48
- type: 'info',
49
- title: plugin.name,
50
- message: JSON.stringify(config, null, 2),
51
- });
52
- console.log(config);
48
+ const currentPlugin = vcsApp.plugins.getByKey(
49
+ plugin.name,
50
+ );
51
+ const oldSerialized = currentPlugin?.toJSON?.() ?? {};
52
+ if (currentPlugin) {
53
+ currentPlugin.destroy?.();
54
+ vcsApp.plugins.remove(currentPlugin);
55
+ }
56
+ await vcsApp.plugins.parseItems(
57
+ [config],
58
+ vcsApp.dynamicModuleId,
59
+ );
60
+ const newPlugin = vcsApp.plugins.getByKey(config.name);
61
+ const serialized = newPlugin?.toJSON?.() ?? {};
62
+ if (!deepEqual(oldSerialized, serialized)) {
63
+ vcsApp.notifier.add({
64
+ type: 'info',
65
+ title: plugin.name,
66
+ message: JSON.stringify(serialized, null, 2),
67
+ });
68
+ console.log(serialized);
69
+ } else {
70
+ vcsApp.notifier.add({
71
+ type: 'warning',
72
+ message: `${plugin.name}: no config changes were made. Did you implement toJSON correctly?`,
73
+ });
74
+ }
53
75
  } else {
54
76
  vcsApp.notifier.add({
55
77
  type: 'warning',
@@ -3,7 +3,7 @@
3
3
  "@vcmap/print": "^4.0.0",
4
4
  "@vcmap/walk": "^2.0.0",
5
5
  "@vcmap/clipping-tool": "^4.0.0",
6
- "@vcmap/transparent-terrain": "^3.0.0",
6
+ "@vcmap/transparent-terrain": "^4.0.0",
7
7
  "@vcmap/height-profile": "^3.0.0",
8
8
  "@vcmap/flight": "^3.0.0",
9
9
  "@vcmap/swipe-tool": "^4.0.0",
@@ -30,7 +30,7 @@
30
30
  "@vcmap/sensorthings": "^1.0.0",
31
31
  "@vcmap/cesium-inspector": "^2.0.0",
32
32
  "@vcmap/event-control": "^1.0.1",
33
- "@vcmap/dynamic-layer": "^3.0.0",
33
+ "@vcmap/dynamic-layer": "^4.0.0",
34
34
  "@vcmap/geofence": "^1.0.2",
35
35
  "@vcmap/panorama": "^1.0.0",
36
36
  "@vcmap/layer-settings": "^1.0.1"
@@ -22,7 +22,7 @@
22
22
  variant="text"
23
23
  :disabled="item.children.length === 0"
24
24
  :icon="isOpen ? 'mdi-chevron-down' : 'mdi-chevron-right'"
25
- @click="bubbleItemToggled(item.name)"
25
+ @click="toggleCurrentItem"
26
26
  />
27
27
  <slot name="prepend" v-bind="{ item }">
28
28
  <span
@@ -43,7 +43,7 @@
43
43
  <VcsTreeviewTitle
44
44
  :item="item"
45
45
  :cursor-pointer="item.clickable || (openOnClick && isGroup)"
46
- @click="(event) => $emit('click', item, event)"
46
+ @click="handleTitleClick"
47
47
  />
48
48
  </slot>
49
49
  <slot name="append" v-bind="{ item }">
@@ -68,6 +68,9 @@
68
68
  :item="child"
69
69
  :search="search"
70
70
  :custom-filter="customFilter"
71
+ :show-all-children="
72
+ showAllChildren || (isGroup && matchesSelf && !hasDescendantMatch)
73
+ "
71
74
  :level="level + 1"
72
75
  :open-on-click="openOnClick"
73
76
  :item-children="itemChildren"
@@ -115,7 +118,7 @@
115
118
  </template>
116
119
 
117
120
  <script>
118
- import { computed, ref, getCurrentInstance } from 'vue';
121
+ import { computed, ref, getCurrentInstance, watch } from 'vue';
119
122
  import { VBtn, VExpandTransition, VIcon, VRow } from 'vuetify/components';
120
123
  import { useIconSize } from '../../vuePlugins/vuetify.js';
121
124
  import { getForwardSlots } from '../composables.js';
@@ -204,6 +207,10 @@
204
207
  type: Function,
205
208
  default: undefined,
206
209
  },
210
+ showAllChildren: {
211
+ type: Boolean,
212
+ default: false,
213
+ },
207
214
  },
208
215
  emits: [
209
216
  'itemToggled',
@@ -219,33 +226,85 @@
219
226
  const iconSize = useIconSize();
220
227
  const forwardSlots = getForwardSlots(slots);
221
228
  const treenodeRef = ref(null);
222
-
223
- const isOpen = computed(
224
- () =>
225
- props.opened.includes(props.item.name) &&
226
- props.item[props.itemChildren]?.length,
227
- );
229
+ const searchOpenOverride = ref(undefined);
228
230
  const children = computed(() => props.item[props.itemChildren] ?? []);
229
231
 
230
- const matchFilter = computed(() => {
232
+ const translatedTitle = (item) =>
233
+ item.title ? vm.$t(item.title) : item.name;
234
+
235
+ const doesItemMatch = (item) => {
231
236
  if (!props.search) {
232
237
  return true;
233
238
  }
234
239
  if (props.customFilter) {
235
- return props.customFilter(props.item, props.search);
240
+ return props.customFilter(item, props.search);
236
241
  }
237
- const translatedTitle = (item) =>
238
- item.title ? vm.$t(item.title) : item.name;
239
242
 
240
- const hasText = (item) =>
243
+ return (
241
244
  translatedTitle(item)
242
245
  .toLocaleLowerCase()
243
- .indexOf(props.search.toLocaleLowerCase()) > -1 ||
244
- item[props.itemChildren]?.some(hasText);
246
+ .indexOf(props.search.toLocaleLowerCase()) > -1
247
+ );
248
+ };
249
+
250
+ const doesDescendantMatch = (item) =>
251
+ item[props.itemChildren]?.some(
252
+ (child) => doesItemMatch(child) || doesDescendantMatch(child),
253
+ );
254
+
255
+ const matchesSelf = computed(() => doesItemMatch(props.item));
256
+ const hasDescendantMatch = computed(() =>
257
+ doesDescendantMatch(props.item),
258
+ );
245
259
 
246
- return hasText(props.item);
260
+ const matchFilter = computed(() => {
261
+ if (!props.search || props.showAllChildren) {
262
+ return true;
263
+ }
264
+ return matchesSelf.value || hasDescendantMatch.value;
247
265
  });
248
266
 
267
+ const searchOpen = computed(
268
+ () => searchOpenOverride.value ?? hasDescendantMatch.value,
269
+ );
270
+
271
+ const isOpen = computed(
272
+ () =>
273
+ children.value.length > 0 &&
274
+ (props.search
275
+ ? searchOpen.value
276
+ : props.opened.includes(props.item.name)),
277
+ );
278
+
279
+ watch(
280
+ () => props.search,
281
+ () => {
282
+ searchOpenOverride.value = undefined;
283
+ },
284
+ );
285
+
286
+ function toggleCurrentItem() {
287
+ if (props.search) {
288
+ searchOpenOverride.value = !isOpen.value;
289
+ return;
290
+ }
291
+ emit('itemToggled', props.item.name);
292
+ }
293
+
294
+ function handleTitleClick(event) {
295
+ emit('click', props.item, event);
296
+
297
+ if (
298
+ props.search &&
299
+ !props.item?.clickable &&
300
+ props.openOnClick &&
301
+ !props.item?.disabled &&
302
+ (children.value.length > 0 || props.item.forceNodeDisplay)
303
+ ) {
304
+ toggleCurrentItem();
305
+ }
306
+ }
307
+
249
308
  function bubbleEvent(eventName) {
250
309
  return (...args) => {
251
310
  emit(eventName, ...args);
@@ -259,7 +318,11 @@
259
318
  isGroup: computed(
260
319
  () => children.value.length > 0 || props.item.forceNodeDisplay,
261
320
  ),
321
+ matchesSelf,
322
+ hasDescendantMatch,
262
323
  matchFilter,
324
+ toggleCurrentItem,
325
+ handleTitleClick,
263
326
  iconSize,
264
327
  children,
265
328
  // Bubble up events for the nested tree-items
@@ -66,9 +66,6 @@
66
66
  feature.setStyle(style);
67
67
  feature[originalStyle] = style;
68
68
  const styleOptions = getStyleOptions(style);
69
- if (styleOptions.text?.text) {
70
- styleOptions.label = styleOptions.text.text;
71
- }
72
69
  feature[vectorStyleSymbol] = new VectorStyleItem(styleOptions);
73
70
  }
74
71
 
@@ -7,7 +7,7 @@
7
7
  :value-default="valueDefault[key]"
8
8
  v-bind="specificProps[key]"
9
9
  v-model="localValue[key]"
10
- @update:model-value="(v) => $emit(`update:${key}`, v)"
10
+ @update:model-value="(v) => updateSection(key, v)"
11
11
  />
12
12
  </v-sheet>
13
13
  </template>
@@ -97,6 +97,12 @@
97
97
  localValue,
98
98
  specificProps,
99
99
  componentMap,
100
+ updateSection(key, value) {
101
+ if (key === 'text') {
102
+ localValue.value.label = value?.text;
103
+ }
104
+ emit(`update:${key}`, value);
105
+ },
100
106
  };
101
107
  },
102
108
  };
@@ -44,6 +44,7 @@ declare const _default: import("vue").DefineComponent<{
44
44
  image: string;
45
45
  text: string;
46
46
  };
47
+ updateSection(key: any, value: any): void;
47
48
  }, any, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
48
49
  modelValue: {
49
50
  type: ObjectConstructor;
File without changes