@geode/opengeodeweb-front 10.44.0-rc.1 → 10.44.0-rc.3

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 (69) hide show
  1. package/.build/server/utils/cleanup.js +7 -2
  2. package/.build/server/utils/microservices.js +5 -1
  3. package/.build/server/utils/typed_handler.js +5 -1
  4. package/.build/server/utils/ws_client.js +7 -2
  5. package/.build/shared/utils/fetch_raw.js +2 -2
  6. package/.build/shared/utils/parse_boolean.js +2 -1
  7. package/app/components/ClippingPlanes.vue +14 -4
  8. package/app/components/DragAndDrop.vue +18 -8
  9. package/app/components/FileSelector.vue +9 -6
  10. package/app/components/HybridViewerTooltip.vue +8 -2
  11. package/app/components/MissingFilesSelector.vue +10 -6
  12. package/app/components/ObjectSelector.vue +6 -3
  13. package/app/components/Screenshot.vue +9 -2
  14. package/app/components/ThresholdFilter.vue +5 -1
  15. package/app/components/Viewer/Generic/Model/BlocksOptions.vue +14 -12
  16. package/app/components/Viewer/Generic/Model/CornersOptions.vue +14 -12
  17. package/app/components/Viewer/Generic/Model/LinesOptions.vue +15 -15
  18. package/app/components/Viewer/Generic/Model/ModelCardTabs.vue +35 -0
  19. package/app/components/Viewer/Generic/Model/ModelEdgesCard.vue +34 -25
  20. package/app/components/Viewer/Generic/Model/ModelPointsCard.vue +34 -25
  21. package/app/components/Viewer/Generic/Model/ModelStyleCard.vue +17 -5
  22. package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +16 -12
  23. package/app/components/Viewer/ObjectTree/Base/ComponentRelations.vue +4 -1
  24. package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +6 -1
  25. package/app/components/Viewer/Options/AttributeRangeSelector.vue +11 -4
  26. package/app/components/Viewer/Options/AttributeSelector.vue +24 -13
  27. package/app/components/Viewer/Options/ColorPicker.vue +4 -1
  28. package/app/components/Viewer/Options/ColormapQuickPicker.vue +13 -7
  29. package/app/components/csv-preview/CsvPreviewer.vue +4 -1
  30. package/app/composables/attribute_coloring_style.ts +8 -2
  31. package/app/composables/global_attribute_style.ts +4 -3
  32. package/app/composables/hover_highlight.ts +6 -5
  33. package/app/composables/model_tabs.ts +86 -0
  34. package/app/composables/project_manager.ts +5 -5
  35. package/app/composables/stepper_tree.ts +10 -2
  36. package/app/composables/tree_filter.ts +11 -2
  37. package/app/composables/tree_keyboard_nav.ts +4 -2
  38. package/app/composables/use_overlapping_picker.ts +5 -5
  39. package/app/composables/virtual_tree.ts +14 -7
  40. package/app/stores/app_helpers/extension.ts +1 -1
  41. package/app/stores/feedback.ts +2 -2
  42. package/app/stores/hybrid_viewer.ts +1 -1
  43. package/app/stores/treeview.ts +17 -10
  44. package/app/utils/clipping_planes.ts +4 -3
  45. package/app/utils/extension.ts +1 -1
  46. package/app/utils/import_workflow.ts +6 -4
  47. package/app/utils/upload_path.ts +15 -9
  48. package/internal/database/database.ts +4 -1
  49. package/internal/stores/data_style/model/blocks/polyhedron.ts +14 -10
  50. package/internal/stores/data_style/model/blocks/vertex.ts +14 -10
  51. package/internal/stores/data_style/model/corners/vertex.ts +14 -10
  52. package/internal/stores/data_style/model/lines/edge.ts +14 -10
  53. package/internal/stores/data_style/model/lines/vertex.ts +14 -10
  54. package/internal/stores/data_style/model/surfaces/polygon.ts +14 -10
  55. package/internal/stores/data_style/model/surfaces/vertex.ts +14 -10
  56. package/internal/stores/hybrid_viewer/brightness.ts +8 -2
  57. package/internal/stores/hybrid_viewer/camera_animation.ts +4 -3
  58. package/internal/stores/hybrid_viewer/highlight.ts +10 -9
  59. package/internal/stores/hybrid_viewer/ruler.ts +4 -3
  60. package/internal/utils/ws_client.ts +8 -1
  61. package/package.json +2 -2
  62. package/server/api/local/extensions/run.post.ts +6 -4
  63. package/server/utils/cleanup.ts +12 -2
  64. package/server/utils/microservices.ts +11 -4
  65. package/server/utils/typed_handler.ts +8 -1
  66. package/server/utils/ws_client.ts +15 -2
  67. package/shared/utils/fetch_raw.ts +2 -2
  68. package/shared/utils/parse_boolean.ts +4 -1
  69. package/app/components/Viewer/Options/OptionsSection.vue +0 -76
@@ -3,7 +3,7 @@ import {
3
3
  type ModelMenuItemProps,
4
4
  useModelMenuContext,
5
5
  } from "@ogw_front/composables/model_menu_context";
6
- import OptionsSection from "@ogw_front/components/Viewer/Options/OptionsSection.vue";
6
+ import ModelCardTabs from "./ModelCardTabs.vue";
7
7
  import ViewerGenericModelComponentEdgesOptions from "@ogw_front/components/Viewer/Generic/Model/ComponentEdgesOptions.vue";
8
8
  import ViewerOptionsWidthSlider from "@ogw_front/components/Viewer/Options/Sliders/Width.vue";
9
9
  import VisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch.vue";
@@ -11,6 +11,7 @@ import { useBatchStyle } from "@ogw_front/composables/batch_style";
11
11
  import { useDataStore } from "@ogw_front/stores/data";
12
12
  import { useDataStyleStore } from "@ogw_front/stores/data_style";
13
13
  import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
14
+ import { useModelTabs } from "@ogw_front/composables/model_tabs";
14
15
 
15
16
  // Lines are edges themselves and corners have none: no edges options for them
16
17
  const EDGES_TYPE_TITLES = {
@@ -87,67 +88,75 @@ watch(
87
88
  { immediate: true },
88
89
  );
89
90
 
90
- const typeTargets = computed(() =>
91
- edgesComponentType.value === undefined
92
- ? []
93
- : [{ componentType: edgesComponentType.value, componentIds: targetComponentIds.value }],
94
- );
91
+ const typeTargets = computed(() => {
92
+ if (edgesComponentType.value === undefined) {
93
+ return [];
94
+ }
95
+ return [{ componentType: edgesComponentType.value, componentIds: targetComponentIds.value }];
96
+ });
95
97
  const typeReferenceId = computed<string | undefined>(() =>
96
98
  collections.value ? targetComponentIds.value[0] : undefined,
97
99
  );
98
100
 
99
- const componentTargets = computed(() =>
100
- edgesComponentType.value === undefined || componentId.value === undefined
101
- ? []
102
- : [{ componentType: edgesComponentType.value, componentIds: [componentId.value] }],
103
- );
101
+ const componentTargets = computed(() => {
102
+ if (edgesComponentType.value === undefined || componentId.value === undefined) {
103
+ return [];
104
+ }
105
+ return [{ componentType: edgesComponentType.value, componentIds: [componentId.value] }];
106
+ });
107
+
108
+ const { tabs, activeTab } = useModelTabs({
109
+ componentType,
110
+ componentId,
111
+ isTypeSupported: (type) => isEdgesComponentType(type),
112
+ hasComponentsOptions: computed(() => allComponentsTargets.value.length > 0),
113
+ });
104
114
  </script>
105
115
 
106
116
  <template>
107
117
  <v-sheet class="model-edges-card" color="transparent">
108
- <OptionsSection title="Model Edges Options">
118
+ <ModelCardTabs v-model="activeTab" :tabs="tabs" />
119
+
120
+ <div v-show="activeTab === 'model'">
109
121
  <VisibilitySwitch data-testid="modelEdgesVisibilitySwitch" v-model="modelEdgesVisibility" />
110
122
  <ViewerOptionsWidthSlider
111
123
  v-if="modelEdgesVisibility"
112
124
  data-testid="modelEdgesWidthSlider"
113
125
  v-model="modelEdgesWidth"
114
126
  />
115
- </OptionsSection>
127
+ </div>
116
128
 
117
- <OptionsSection
129
+ <div
118
130
  v-if="!componentType && !componentId && allComponentsTargets.length > 0"
119
- title="Components Edges Options"
131
+ v-show="activeTab === 'components'"
120
132
  data-testid="modelEdgesComponentsOptions"
121
- class="mt-4"
122
133
  >
123
134
  <ViewerGenericModelComponentEdgesOptions :modelId="modelId" :targets="allComponentsTargets" />
124
- </OptionsSection>
135
+ </div>
125
136
 
126
- <OptionsSection
137
+ <div
127
138
  v-if="edgesComponentType"
128
- :title="EDGES_TYPE_TITLES[edgesComponentType]"
139
+ v-show="activeTab === 'type'"
129
140
  data-testid="modelEdgesComponentTypeOptions"
130
- class="mt-4"
131
141
  >
132
142
  <ViewerGenericModelComponentEdgesOptions
133
143
  :modelId="modelId"
134
144
  :targets="typeTargets"
135
145
  :referenceComponentId="typeReferenceId"
136
146
  />
137
- </OptionsSection>
147
+ </div>
138
148
 
139
- <OptionsSection
149
+ <div
140
150
  v-if="edgesComponentType && componentId"
141
- title="Component Edges Options"
151
+ v-show="activeTab === 'component'"
142
152
  data-testid="modelEdgesComponentOptions"
143
- class="mt-4"
144
153
  >
145
154
  <ViewerGenericModelComponentEdgesOptions
146
155
  :modelId="modelId"
147
156
  :targets="componentTargets"
148
157
  :referenceComponentId="componentId"
149
158
  />
150
- </OptionsSection>
159
+ </div>
151
160
  </v-sheet>
152
161
  </template>
153
162
 
@@ -3,13 +3,14 @@ import {
3
3
  type ModelMenuItemProps,
4
4
  useModelMenuContext,
5
5
  } from "@ogw_front/composables/model_menu_context";
6
- import OptionsSection from "@ogw_front/components/Viewer/Options/OptionsSection.vue";
6
+ import ModelCardTabs from "./ModelCardTabs.vue";
7
7
  import ViewerGenericModelComponentPointsOptions from "@ogw_front/components/Viewer/Generic/Model/ComponentPointsOptions.vue";
8
8
  import VisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch.vue";
9
9
  import { useBatchStyle } from "@ogw_front/composables/batch_style";
10
10
  import { useDataStore } from "@ogw_front/stores/data";
11
11
  import { useDataStyleStore } from "@ogw_front/stores/data_style";
12
12
  import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
13
+ import { useModelTabs } from "@ogw_front/composables/model_tabs";
13
14
 
14
15
  // Corners have no points options: their points are the corners themselves
15
16
  const POINTS_TYPE_TITLES = {
@@ -71,65 +72,73 @@ watch(
71
72
  { immediate: true },
72
73
  );
73
74
 
74
- const typeTargets = computed(() =>
75
- pointsComponentType.value === undefined
76
- ? []
77
- : [{ componentType: pointsComponentType.value, componentIds: targetComponentIds.value }],
78
- );
75
+ const typeTargets = computed(() => {
76
+ if (pointsComponentType.value === undefined) {
77
+ return [];
78
+ }
79
+ return [{ componentType: pointsComponentType.value, componentIds: targetComponentIds.value }];
80
+ });
79
81
  const typeReferenceId = computed<string | undefined>(() =>
80
82
  collections.value ? targetComponentIds.value[0] : undefined,
81
83
  );
82
84
 
83
- const componentTargets = computed(() =>
84
- pointsComponentType.value === undefined || componentId.value === undefined
85
- ? []
86
- : [{ componentType: pointsComponentType.value, componentIds: [componentId.value] }],
87
- );
85
+ const componentTargets = computed(() => {
86
+ if (pointsComponentType.value === undefined || componentId.value === undefined) {
87
+ return [];
88
+ }
89
+ return [{ componentType: pointsComponentType.value, componentIds: [componentId.value] }];
90
+ });
91
+
92
+ const { tabs, activeTab } = useModelTabs({
93
+ componentType,
94
+ componentId,
95
+ isTypeSupported: (type) => isPointsComponentType(type),
96
+ hasComponentsOptions: computed(() => allComponentsTargets.value.length > 0),
97
+ });
88
98
  </script>
89
99
 
90
100
  <template>
91
101
  <v-sheet class="model-points-card" color="transparent">
92
- <OptionsSection title="Model Points Options">
102
+ <ModelCardTabs v-model="activeTab" :tabs="tabs" />
103
+
104
+ <div v-show="activeTab === 'model'">
93
105
  <VisibilitySwitch data-testid="modelPointsVisibilitySwitch" v-model="modelPointsVisibility" />
94
- </OptionsSection>
106
+ </div>
95
107
 
96
- <OptionsSection
108
+ <div
97
109
  v-if="!componentType && !componentId && allComponentsTargets.length > 0"
98
- title="Components Points Options"
110
+ v-show="activeTab === 'components'"
99
111
  data-testid="modelPointsComponentsOptions"
100
- class="mt-4"
101
112
  >
102
113
  <ViewerGenericModelComponentPointsOptions
103
114
  :modelId="modelId"
104
115
  :targets="allComponentsTargets"
105
116
  />
106
- </OptionsSection>
117
+ </div>
107
118
 
108
- <OptionsSection
119
+ <div
109
120
  v-if="pointsComponentType"
110
- :title="POINTS_TYPE_TITLES[pointsComponentType]"
121
+ v-show="activeTab === 'type'"
111
122
  data-testid="modelPointsComponentTypeOptions"
112
- class="mt-4"
113
123
  >
114
124
  <ViewerGenericModelComponentPointsOptions
115
125
  :modelId="modelId"
116
126
  :targets="typeTargets"
117
127
  :referenceComponentId="typeReferenceId"
118
128
  />
119
- </OptionsSection>
129
+ </div>
120
130
 
121
- <OptionsSection
131
+ <div
122
132
  v-if="pointsComponentType && componentId"
123
- title="Component Points Options"
133
+ v-show="activeTab === 'component'"
124
134
  data-testid="modelPointsComponentOptions"
125
- class="mt-4"
126
135
  >
127
136
  <ViewerGenericModelComponentPointsOptions
128
137
  :modelId="modelId"
129
138
  :targets="componentTargets"
130
139
  :referenceComponentId="componentId"
131
140
  />
132
- </OptionsSection>
141
+ </div>
133
142
  </v-sheet>
134
143
  </template>
135
144
 
@@ -6,7 +6,7 @@ import {
6
6
  import BlocksOptions from "./BlocksOptions.vue";
7
7
  import CornersOptions from "./CornersOptions.vue";
8
8
  import LinesOptions from "./LinesOptions.vue";
9
- import OptionsSection from "@ogw_front/components/Viewer/Options/OptionsSection.vue";
9
+ import ModelCardTabs from "./ModelCardTabs.vue";
10
10
  import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
11
11
  import SurfacesOptions from "./SurfacesOptions.vue";
12
12
  import ViewerOptionsColoringTypeSelector from "@ogw_front/components/Viewer/Options/ColoringTypeSelector.vue";
@@ -14,6 +14,7 @@ import VisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwi
14
14
  import { useBatchStyle } from "@ogw_front/composables/batch_style";
15
15
  import { useDataStyleStore } from "@ogw_front/stores/data_style";
16
16
  import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
17
+ import { useModelTabs } from "@ogw_front/composables/model_tabs";
17
18
 
18
19
  const dataStyleStore = useDataStyleStore();
19
20
  const hybridViewerStore = useHybridViewerStore();
@@ -27,6 +28,11 @@ const { itemProps } = defineProps<Props>();
27
28
 
28
29
  const { modelId, componentId, componentType, collections, targetComponentIds } =
29
30
  useModelMenuContext(() => itemProps);
31
+
32
+ const { tabs, activeTab } = useModelTabs({
33
+ componentType,
34
+ componentId,
35
+ });
30
36
  function visibleComponents(targetId: string): string[] {
31
37
  return dataStyleStore.visibleMeshComponents(targetId).value || [];
32
38
  }
@@ -87,11 +93,13 @@ const modelComponentsActiveColoring = computed<string | undefined>({
87
93
 
88
94
  <template>
89
95
  <v-sheet class="model-style-card" color="transparent">
90
- <OptionsSection title="Model Options">
96
+ <ModelCardTabs v-model="activeTab" :tabs="tabs" />
97
+
98
+ <div v-show="activeTab === 'model'">
91
99
  <VisibilitySwitch data-testid="modelStyleVisibilitySwitch" v-model="modelVisibility" />
92
- </OptionsSection>
100
+ </div>
93
101
 
94
- <OptionsSection v-if="!componentType && !componentId" title="Components Options" class="mt-4">
102
+ <div v-if="!componentType && !componentId" v-show="activeTab === 'components'">
95
103
  <ViewerOptionsColoringTypeSelector
96
104
  :id="modelId"
97
105
  v-model:coloring_style_key="modelComponentsActiveColoring"
@@ -99,7 +107,7 @@ const modelComponentsActiveColoring = computed<string | undefined>({
99
107
  :capabilities="{ color: { available: true } }"
100
108
  :allowRandom="true"
101
109
  />
102
- </OptionsSection>
110
+ </div>
103
111
 
104
112
  <BlocksOptions
105
113
  v-if="componentType === 'Block'"
@@ -107,6 +115,7 @@ const modelComponentsActiveColoring = computed<string | undefined>({
107
115
  :blockId="componentId"
108
116
  :targetBlockIds="targetComponentIds"
109
117
  :collections="collections"
118
+ :activeTab="activeTab"
110
119
  />
111
120
  <SurfacesOptions
112
121
  v-else-if="componentType === 'Surface'"
@@ -114,6 +123,7 @@ const modelComponentsActiveColoring = computed<string | undefined>({
114
123
  :surfaceId="componentId"
115
124
  :targetSurfaceIds="targetComponentIds"
116
125
  :collections="collections"
126
+ :activeTab="activeTab"
117
127
  />
118
128
  <LinesOptions
119
129
  v-else-if="componentType === 'Line'"
@@ -121,6 +131,7 @@ const modelComponentsActiveColoring = computed<string | undefined>({
121
131
  :lineId="componentId"
122
132
  :targetLineIds="targetComponentIds"
123
133
  :collections="collections"
134
+ :activeTab="activeTab"
124
135
  />
125
136
  <CornersOptions
126
137
  v-else-if="componentType === 'Corner'"
@@ -128,6 +139,7 @@ const modelComponentsActiveColoring = computed<string | undefined>({
128
139
  :cornerId="componentId"
129
140
  :targetCornerIds="targetComponentIds"
130
141
  :collections="collections"
142
+ :activeTab="activeTab"
131
143
  />
132
144
  </v-sheet>
133
145
  </template>
@@ -1,7 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  // oxlint-disable eslint/max-lines
3
3
  import type { CollectionComponent } from "@ogw_front/stores/data_helpers/collections";
4
- import OptionsSection from "@ogw_front/components/Viewer/Options/OptionsSection.vue";
5
4
  import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
6
5
  import ViewerOptionsColoringTypeSelector from "@ogw_front/components/Viewer/Options/ColoringTypeSelector.vue";
7
6
  import VisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch.vue";
@@ -14,6 +13,7 @@ interface Props {
14
13
  surfaceId?: string;
15
14
  targetSurfaceIds: string[];
16
15
  collections?: CollectionComponent[];
16
+ activeTab?: string;
17
17
  }
18
18
 
19
19
  const {
@@ -21,6 +21,7 @@ const {
21
21
  surfaceId = undefined,
22
22
  targetSurfaceIds,
23
23
  collections = undefined,
24
+ activeTab = undefined,
24
25
  } = defineProps<Props>();
25
26
 
26
27
  const dataStyleStore = useDataStyleStore();
@@ -30,14 +31,18 @@ const referenceSurfaceId = computed<string | undefined>(() =>
30
31
  collections ? targetSurfaceIds[0] : undefined,
31
32
  );
32
33
 
33
- const surfaceComponentIds = computed<string[]>(() => (surfaceId === undefined ? [] : [surfaceId]));
34
+ const surfaceComponentIds = computed<string[]>(
35
+ () => (surfaceId !== undefined && [surfaceId]) || [],
36
+ );
34
37
 
35
38
  // Visibility
36
39
  const surfacesVisibility = computed<boolean>({
37
- get: () =>
38
- collections
39
- ? targetSurfaceIds.every((id) => dataStyleStore.modelSurfaceVisibility(modelId, id))
40
- : dataStyleStore.modelComponentTypeVisibility(modelId, "Surface"),
40
+ get: () => {
41
+ if (collections) {
42
+ return targetSurfaceIds.every((id) => dataStyleStore.modelSurfaceVisibility(modelId, id));
43
+ }
44
+ return dataStyleStore.modelComponentTypeVisibility(modelId, "Surface");
45
+ },
41
46
  set: async (newValue) => {
42
47
  await dataStyleStore.setModelSurfacesVisibility(modelId, targetSurfaceIds, newValue);
43
48
  hybridViewerStore.remoteRender();
@@ -442,7 +447,7 @@ const attributeSchemas = {
442
447
  </script>
443
448
 
444
449
  <template>
445
- <OptionsSection title="Surfaces Options" class="mt-4" data-testid="modelComponentTypeOptions">
450
+ <div v-show="!activeTab || activeTab === 'type'" data-testid="modelComponentTypeOptions">
446
451
  <VisibilitySwitch data-testid="modelSurfacesVisibilitySwitch" v-model="surfacesVisibility" />
447
452
  <ViewerOptionsColoringTypeSelector
448
453
  :id="modelId"
@@ -465,12 +470,11 @@ const attributeSchemas = {
465
470
  :schemas="attributeSchemas"
466
471
  :allowRandom="true"
467
472
  />
468
- </OptionsSection>
473
+ </div>
469
474
 
470
- <OptionsSection
475
+ <div
471
476
  v-if="surfaceId"
472
- title="Component Options"
473
- class="mt-4"
477
+ v-show="!activeTab || activeTab === 'component'"
474
478
  data-testid="modelComponentOptions"
475
479
  >
476
480
  <VisibilitySwitch v-model="surfaceVisibility" />
@@ -495,5 +499,5 @@ const attributeSchemas = {
495
499
  :schemas="attributeSchemas"
496
500
  :allowRandom="true"
497
501
  />
498
- </OptionsSection>
502
+ </div>
499
503
  </template>
@@ -31,7 +31,10 @@ function summarize(components: readonly FormattedComponent[]): string {
31
31
  return MESH_COMPONENT_TYPES.filter((type) => counts.has(type))
32
32
  .map((type) => {
33
33
  const count = counts.get(type) ?? 0;
34
- return `${count} ${count > 1 ? pluralize(type) : type}`;
34
+ if (count > 1) {
35
+ return `${count} ${pluralize(type)}`;
36
+ }
37
+ return `${count} ${type}`;
35
38
  })
36
39
  .join(", ");
37
40
  }
@@ -126,7 +126,12 @@ function handleHoverEnter({
126
126
 
127
127
  onHoverEnter(
128
128
  actualItem.id,
129
- async () => (is_model ? await dataStore.getAllModelComponentsViewerIds(actualItem.id) : []),
129
+ async () => {
130
+ if (is_model) {
131
+ return await dataStore.getAllModelComponentsViewerIds(actualItem.id);
132
+ }
133
+ return [];
134
+ },
130
135
  is_model ? "model" : "mesh",
131
136
  immediate,
132
137
  );
@@ -11,10 +11,17 @@ const maximum = defineModel<number>("maximum");
11
11
  const minimumText = ref<string>("");
12
12
  const maximumText = ref<string>("");
13
13
 
14
- watch(minimum, (value) => (minimumText.value = value === undefined ? "" : String(value)), {
14
+ function formatValue(value: number | undefined): string {
15
+ if (value === undefined) {
16
+ return "";
17
+ }
18
+ return String(value);
19
+ }
20
+
21
+ watch(minimum, (value) => (minimumText.value = formatValue(value)), {
15
22
  immediate: true,
16
23
  });
17
- watch(maximum, (value) => (maximumText.value = value === undefined ? "" : String(value)), {
24
+ watch(maximum, (value) => (maximumText.value = formatValue(value)), {
18
25
  immediate: true,
19
26
  });
20
27
 
@@ -27,7 +34,7 @@ function parseValue(text: string): number | undefined {
27
34
  function commitMinimum(): void {
28
35
  const value = parseValue(minimumText.value);
29
36
  if (value === undefined) {
30
- minimumText.value = minimum.value === undefined ? "" : String(minimum.value);
37
+ minimumText.value = formatValue(minimum.value);
31
38
  return;
32
39
  }
33
40
  minimum.value = value;
@@ -36,7 +43,7 @@ function commitMinimum(): void {
36
43
  function commitMaximum(): void {
37
44
  const value = parseValue(maximumText.value);
38
45
  if (value === undefined) {
39
- maximumText.value = maximum.value === undefined ? "" : String(maximum.value);
46
+ maximumText.value = formatValue(maximum.value);
40
47
  return;
41
48
  }
42
49
  maximum.value = value;
@@ -139,24 +139,35 @@ function requestParams(): { id: string; component_ids?: string[] } | undefined {
139
139
  if (schemaProperties?.component_ids === undefined) {
140
140
  return { id };
141
141
  }
142
- return hasSelectedComponent(componentIds) ? { id, component_ids: componentIds } : undefined;
142
+ if (!hasSelectedComponent(componentIds)) {
143
+ return undefined;
144
+ }
145
+ return { id, component_ids: componentIds };
146
+ }
147
+
148
+ function getRangeTargets(
149
+ name: string,
150
+ ): [string, { id: string; component_ids?: string[] } | undefined][] {
151
+ if (groupTargetIds.value) {
152
+ return [...attributesPerTarget]
153
+ .filter(([, targetAttributes]) =>
154
+ targetAttributes.some((attribute) => attribute.attribute_name === name),
155
+ )
156
+ .map(([targetId]) => [targetId, { id: targetId }]);
157
+ }
158
+ return [[id, requestParams()]];
143
159
  }
144
160
 
145
161
  // Ranges are computed by the back for the selected attribute only, as scanning every step of every series is slow
146
162
  async function requestRanges(name: string): Promise<void> {
147
- const targets: [string, { id: string; component_ids?: string[] } | undefined][] =
148
- groupTargetIds.value
149
- ? [...attributesPerTarget]
150
- .filter(([, targetAttributes]) =>
151
- targetAttributes.some((attribute) => attribute.attribute_name === name),
152
- )
153
- .map(([targetId]) => [targetId, { id: targetId }])
154
- : [[id, requestParams()]];
163
+ const targets = getRangeTargets(name);
155
164
  const entries = await Promise.all(
156
- targets.map(async ([targetId, params]): Promise<[string, AttributeRangeInfo | undefined]> => [
157
- targetId,
158
- params ? await fetchAttributeRange(schemas.range, params, name) : undefined,
159
- ]),
165
+ targets.map(async ([targetId, params]): Promise<[string, AttributeRangeInfo | undefined]> => {
166
+ if (!params) {
167
+ return [targetId, undefined];
168
+ }
169
+ return [targetId, await fetchAttributeRange(schemas.range, params, name)];
170
+ }),
160
171
  );
161
172
  if (rangesName !== name) {
162
173
  return;
@@ -50,7 +50,10 @@ function onPickerUpdate(color: VuetifyColor): void {
50
50
  const red = Math.round(color.r);
51
51
  const green = Math.round(color.g);
52
52
  const blue = Math.round(color.b);
53
- const alpha = disabledAlpha ? 1 : Number(color.a.toFixed(2));
53
+ let alpha = 1;
54
+ if (!disabledAlpha) {
55
+ alpha = Number(color.a.toFixed(2));
56
+ }
54
57
 
55
58
  vuetifyColor.value = { r: red, g: green, b: blue, a: alpha };
56
59
  updateInputTextFromColor(red, green, blue, alpha);
@@ -19,6 +19,18 @@ const { dataId = undefined, blockIds = undefined, x, y } = defineProps<Props>();
19
19
  const show = defineModel<boolean>("show", { default: false });
20
20
 
21
21
  const dataIdRef = computed<string>(() => dataId);
22
+ function useAttributeStyle():
23
+ | ReturnType<typeof useGlobalAttributeStyle>
24
+ | ReturnType<typeof useModelAttributeStyle> {
25
+ if (blockIds === undefined) {
26
+ return useGlobalAttributeStyle(dataIdRef);
27
+ }
28
+ return useModelAttributeStyle(
29
+ dataIdRef,
30
+ computed<number[]>(() => blockIds),
31
+ );
32
+ }
33
+
22
34
  // The parent keys this picker on the picked data: a mesh or a model, so the style is chosen once here
23
35
  const {
24
36
  currentColormap,
@@ -28,13 +40,7 @@ const {
28
40
  currentTimeSteps,
29
41
  currentTimeStep,
30
42
  loadTimeSteps,
31
- } =
32
- blockIds === undefined
33
- ? useGlobalAttributeStyle(dataIdRef)
34
- : useModelAttributeStyle(
35
- dataIdRef,
36
- computed<number[]>(() => blockIds),
37
- );
43
+ } = useAttributeStyle();
38
44
 
39
45
  watch(show, async (isShown) => {
40
46
  if (isShown) {
@@ -105,7 +105,10 @@ function parseContent(): string[] {
105
105
 
106
106
  const allLines = rawContent.value.split(/\r?\n/u).filter((line) => line.trim() !== "");
107
107
  const headerLine = allLines[headerRow.value];
108
- const rawHeaders = headerLine ? splitLine(headerLine) : [];
108
+ let rawHeaders: string[] = [];
109
+ if (headerLine) {
110
+ rawHeaders = splitLine(headerLine);
111
+ }
109
112
 
110
113
  previewHeaders.value = rawHeaders.map((header, index) => ({
111
114
  title: header || `Column ${index + 1}`,
@@ -78,7 +78,10 @@ function useAttributeColoringStyle(colorings: Ref<AttributeColoring[]>): Attribu
78
78
 
79
79
  const currentColormap = computed((): string => {
80
80
  const [coloring] = colorings.value;
81
- return coloring ? String(coloring.read("ColorMap")) : "batlow";
81
+ if (!coloring) {
82
+ return "batlow";
83
+ }
84
+ return String(coloring.read("ColorMap"));
82
85
  });
83
86
 
84
87
  async function applyGlobalColormap(colorMap: string): Promise<void> {
@@ -152,7 +155,10 @@ function useAttributeColoringStyle(colorings: Ref<AttributeColoring[]>): Attribu
152
155
  const currentTimeStep = computed<number>({
153
156
  get(): number {
154
157
  const coloring = temporalColoring.value;
155
- return coloring ? Number(coloring.read("TimeStep") ?? 0) : 0;
158
+ if (!coloring) {
159
+ return 0;
160
+ }
161
+ return Number(coloring.read("TimeStep") ?? 0);
156
162
  },
157
163
  // Setter cannot be async (see `currentRange`), so the write is delegated.
158
164
  set: (step: number): void => {
@@ -61,9 +61,10 @@ export function useGlobalAttributeStyle(
61
61
  return MESH_ELEMENTS.flatMap((element) => {
62
62
  const coloring: unknown = style[element.styleKey]?.coloring;
63
63
  const activeColoring = isColoring(coloring) ? coloring.active : undefined;
64
- return activeColoring !== undefined && ATTRIBUTE_COLORINGS.has(activeColoring)
65
- ? [meshColoring(dataId, element, activeColoring)]
66
- : [];
64
+ if (activeColoring !== undefined && ATTRIBUTE_COLORINGS.has(activeColoring)) {
65
+ return [meshColoring(dataId, element, activeColoring)];
66
+ }
67
+ return [];
67
68
  });
68
69
  });
69
70
 
@@ -40,11 +40,12 @@ export function useHoverhighlight(): {
40
40
  return;
41
41
  }
42
42
 
43
- let block_ids: number[] = [
44
- ...(typeof block_ids_provider === "function"
45
- ? await block_ids_provider()
46
- : block_ids_provider),
47
- ];
43
+ let block_ids: number[] = [];
44
+ if (typeof block_ids_provider === "function") {
45
+ block_ids = [...(await block_ids_provider())];
46
+ } else {
47
+ block_ids = [...block_ids_provider];
48
+ }
48
49
 
49
50
  block_ids = (Array.isArray(block_ids) ? block_ids : [])
50
51
  .map((blockId) => Math.trunc(blockId))