@geode/opengeodeweb-front 10.43.2 → 10.44.0-rc.2

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.
@@ -1,63 +1,45 @@
1
1
  <script setup lang="ts">
2
- import schemas, { type CRSList } from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
3
- import { useBackStore } from "@ogw_front/stores/back";
4
-
5
- const schema = schemas.opengeodeweb_back.geographic_coordinate_systems;
6
-
7
- interface Emits {
8
- update_values: [values: Record<string, unknown>];
9
- increment_step: [];
10
- decrement_step: [];
11
- }
12
-
13
- const emit = defineEmits<Emits>();
2
+ import type { CRSList } from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
3
+ import { useCrsStore } from "@ogw_front/stores/crs";
14
4
 
15
5
  interface Props {
16
6
  geodeObjectType: string;
17
- keyToUpdate: string;
7
+ // Narrow containers: one "AUTHORITY:CODE" column and a truncated name
8
+ compact?: boolean;
18
9
  }
19
10
 
20
- const { geodeObjectType, keyToUpdate } = defineProps<Props>();
11
+ const { geodeObjectType, compact = false } = defineProps<Props>();
12
+ const selectedCrs = defineModel<CRSList | undefined>();
21
13
 
22
14
  const search = ref<string>("");
23
15
  const data_table_loading = ref<boolean>(false);
24
- const crs_list = ref<CRSList[]>([]);
25
- const selected_crs = ref<unknown[]>([]);
16
+ // Thousands of rows that are never mutated: no deep reactivity
17
+ const crs_list = shallowRef<CRSList[]>([]);
18
+ // Keys of the selected rows: the item-value of the table, "AUTHORITY:CODE"
19
+ const selected_crs = ref<string[]>([]);
26
20
  const toggle_loading = useToggle(data_table_loading);
27
- const backStore = useBackStore();
21
+ const crsStore = useCrsStore();
22
+
23
+ // Codes are only unique within an authority (e.g. EPSG:4812 and ESRI:4812)
24
+ function crs_key(crs: CRSList): string {
25
+ return `${crs.authority}:${crs.code}`;
26
+ }
28
27
 
29
- function get_selected_crs(crs_code: unknown): unknown {
30
- for (const crs of crs_list.value) {
31
- if (crs.code === crs_code) {
32
- return crs;
33
- }
34
- }
28
+ function get_selected_crs(key: string | undefined): CRSList | undefined {
29
+ return crs_list.value.find((crs) => crs_key(crs) === key);
35
30
  }
36
31
 
37
32
  watch(selected_crs, (new_value) => {
38
- const crs = get_selected_crs(new_value[0]);
39
- const keys_values_object = {
40
- [keyToUpdate]: crs,
41
- };
42
- emit("update_values", keys_values_object);
43
- emit("increment_step");
33
+ selectedCrs.value = get_selected_crs(new_value[0]);
44
34
  });
45
35
 
46
- async function get_crs_table(): void {
47
- const params = { geode_object_type: geodeObjectType };
36
+ async function get_crs_table(): Promise<void> {
48
37
  toggle_loading();
49
- await backStore.request(
50
- { schema, params },
51
- {
52
- response_function: (response) => {
53
- crs_list.value = response.crs_list;
54
- },
55
- },
56
- );
38
+ crs_list.value = await crsStore.geographicList(geodeObjectType);
57
39
  toggle_loading();
58
40
  }
59
41
 
60
- const headers = [
42
+ const full_headers = [
61
43
  {
62
44
  title: "Authority",
63
45
  align: "start",
@@ -68,24 +50,41 @@ const headers = [
68
50
  { title: "Name", align: "end", key: "name" },
69
51
  ] as const;
70
52
 
71
- // oxlint-disable-next-line no-top-level-await
72
- await get_crs_table();
53
+ // A max width of 0 lets the name take the remaining space and truncate instead of wrapping
54
+ const compact_headers = [
55
+ { title: "Code", align: "start", key: "code", value: crs_key, width: 110, nowrap: true },
56
+ { title: "Name", align: "start", key: "name", maxWidth: 0, nowrap: true },
57
+ ] as const;
58
+
59
+ // "All" would render the whole list (thousands of rows) at once
60
+ // oxlint-disable-next-line no-magic-numbers -- the page sizes Vuetify offers by default, "All" aside
61
+ const items_per_page_options = [10, 25, 50, 100];
62
+
63
+ const headers = computed(() => (compact ? compact_headers : full_headers));
64
+
65
+ // Not awaited in setup: the table renders right away with its loader
66
+ onMounted(async () => {
67
+ await get_crs_table();
68
+ });
73
69
  </script>
74
70
 
75
71
  <template>
76
72
  <v-text-field
77
73
  v-model="search"
78
- append-icon="mdi-magnify"
74
+ data-testid="crsSearchInput"
75
+ :append-icon="compact ? undefined : 'mdi-magnify'"
76
+ :prepend-inner-icon="compact ? 'mdi-magnify' : undefined"
79
77
  label="Search"
80
78
  single-line
81
79
  hide-details
82
80
  ></v-text-field>
83
81
  <v-data-table
84
82
  v-model="selected_crs"
85
- :v-model:items-per-page="10"
83
+ :items-per-page="10"
84
+ :items-per-page-options="items_per_page_options"
86
85
  :headers="headers"
87
86
  :items="crs_list"
88
- item-value="code"
87
+ :item-value="crs_key"
89
88
  class="elevation-1"
90
89
  density="compact"
91
90
  fixed-header
@@ -94,5 +93,13 @@ await get_crs_table();
94
93
  :search="search"
95
94
  :loading="data_table_loading"
96
95
  loading-text="Loading... Please wait"
97
- ></v-data-table>
96
+ >
97
+ <template v-if="compact" #[`item.name`]="{ value }">
98
+ <v-tooltip :text="value" location="top">
99
+ <template #activator="{ props: tooltipProps }">
100
+ <span v-bind="tooltipProps">{{ value }}</span>
101
+ </template>
102
+ </v-tooltip>
103
+ </template>
104
+ </v-data-table>
98
105
  </template>
@@ -10,6 +10,15 @@ const show = ref<boolean>(true);
10
10
  function calc_margin(index: number): string {
11
11
  return `${index * MARGIN_BETWEEN_SNACKERS + FIRST_SNACKER_MARGIN}px`;
12
12
  }
13
+
14
+ function runAction(feedback: (typeof feedbackStore.feedbacks)[number]): void {
15
+ try {
16
+ feedback.action?.onClick();
17
+ } finally {
18
+ // The snackbar closes even when the action fails
19
+ feedbackStore.delete_feedback(feedback.id);
20
+ }
21
+ }
13
22
  </script>
14
23
 
15
24
  <template>
@@ -62,9 +71,27 @@ function calc_margin(index: number): string {
62
71
  </v-tooltip>
63
72
  </v-col>
64
73
  <v-spacer />
74
+ <v-col v-if="feedback.action" cols="auto">
75
+ <v-tooltip location="top" :text="feedback.action.label">
76
+ <template #activator="{ props }">
77
+ <v-btn
78
+ v-bind="props"
79
+ icon
80
+ variant="flat"
81
+ size="20"
82
+ :color="feedback.type"
83
+ data-testid="feedbackActionBtn"
84
+ @click.stop="runAction(feedback)"
85
+ >
86
+ <v-icon icon="mdi-pencil" size="20" color="white" />
87
+ </v-btn>
88
+ </template>
89
+ </v-tooltip>
90
+ </v-col>
65
91
  <v-col cols="auto">
66
92
  <v-btn
67
93
  icon
94
+ data-testid="feedbackCloseBtn"
68
95
  variant="flat"
69
96
  size="20"
70
97
  :color="feedback.type"
@@ -0,0 +1,37 @@
1
+ <script setup lang="ts">
2
+ import { formatCrs, formatCrsCode } from "@ogw_front/utils/crs";
3
+ import { useCrsStore } from "@ogw_front/stores/crs";
4
+
5
+ const crsStore = useCrsStore();
6
+ const label = computed<string>(() =>
7
+ crsStore.projectCrs
8
+ ? `CRS: ${formatCrsCode(crsStore.projectCrs)} · ${crsStore.projectCrs.name}`
9
+ : "No CRS",
10
+ );
11
+ </script>
12
+
13
+ <template>
14
+ <!-- Under the XYZ axes, drawn by the viewer in the bottom right corner -->
15
+ <v-btn
16
+ data-testid="projectCrs"
17
+ class="project-crs text-none"
18
+ size="small"
19
+ variant="tonal"
20
+ prepend-icon="mdi-earth"
21
+ :disabled="!crsStore.crsEditEnabled"
22
+ v-tooltip="formatCrs(crsStore.projectCrs)"
23
+ @click="crsStore.requestProjectCrsEdit()"
24
+ >
25
+ <span class="text-truncate">{{ label }}</span>
26
+ </v-btn>
27
+ </template>
28
+
29
+ <style scoped>
30
+ .project-crs {
31
+ position: absolute;
32
+ right: 16px;
33
+ bottom: 12px;
34
+ z-index: 1;
35
+ max-width: 360px;
36
+ }
37
+ </style>
@@ -1,9 +1,12 @@
1
1
  <script setup lang="ts">
2
+ import { formatCrs, formatCrsCode } from "@ogw_front/utils/crs";
2
3
  import GlassCard from "@ogw_front/components/GlassCard.vue";
3
4
  import { consola } from "consola";
4
5
  import { middleTruncate } from "@ogw_front/utils/string";
5
6
  import { useCopyToClipboard } from "@ogw_front/composables/copy_to_clipboard";
7
+ import { useCrsStore } from "@ogw_front/stores/crs";
6
8
  import { useDataStore } from "@ogw_front/stores/data";
9
+ import { useLiveDataItem } from "@ogw_front/composables/live_data_item";
7
10
  import { useMenuStore } from "@ogw_front/stores/menu";
8
11
 
9
12
  interface Props {
@@ -126,6 +129,13 @@ function formatId(id: string | undefined): string {
126
129
  }
127
130
 
128
131
  const formattedId = computed<string>(() => formatId(metaData.id));
132
+
133
+ const crsStore = useCrsStore();
134
+ // A model component shares the model CRS: the CRS row is only shown for a data
135
+ const isData = computed<boolean>(() => metaData.id !== undefined && metaData.modelId === undefined);
136
+ // The menu metadata is a snapshot taken when it opened: read the item live so a CRS edit shows at once
137
+ const liveItem = useLiveDataItem(() => (isData.value ? metaData.id : undefined));
138
+ const liveCrs = computed(() => liveItem.value?.crs ?? metaData.crs);
129
139
  </script>
130
140
 
131
141
  <template>
@@ -168,6 +178,26 @@ const formattedId = computed<string>(() => formatId(metaData.id));
168
178
  class="ml-1"
169
179
  />
170
180
  </v-col>
181
+ <v-col
182
+ v-if="isData"
183
+ class="mt-1 d-inline-flex align-center px-2 py-0.5 text-caption"
184
+ style="font-size: 0.6rem"
185
+ >
186
+ <span class="font-weight-black text-secondary mr-1">CRS</span>
187
+ <span class="id-text" data-testid="infoCrsValue">{{ formatCrsCode(liveCrs) }}</span>
188
+ <v-tooltip activator="parent" location="top">{{ formatCrs(liveCrs) }}</v-tooltip>
189
+ <v-btn
190
+ v-if="crsStore.crsEditEnabled"
191
+ data-testid="infoEditCrsBtn"
192
+ icon="mdi-pencil"
193
+ variant="text"
194
+ density="compact"
195
+ size="x-small"
196
+ color="white"
197
+ class="ml-1"
198
+ @click.stop="crsStore.requestCrsEdit(metaData.id)"
199
+ />
200
+ </v-col>
171
201
 
172
202
  <template v-if="componentItem">
173
203
  <v-divider class="w-100 my-2" opacity="0.2" />
@@ -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
  blockId?: string;
15
14
  targetBlockIds: string[];
16
15
  collections?: CollectionComponent[];
16
+ activeTab?: string;
17
17
  }
18
18
 
19
19
  const {
@@ -21,6 +21,7 @@ const {
21
21
  blockId = undefined,
22
22
  targetBlockIds,
23
23
  collections = undefined,
24
+ activeTab = undefined,
24
25
  } = defineProps<Props>();
25
26
 
26
27
  const dataStyleStore = useDataStyleStore();
@@ -472,7 +473,7 @@ const attributeSchemas = {
472
473
  </script>
473
474
 
474
475
  <template>
475
- <OptionsSection title="Blocks Options" class="mt-4" data-testid="modelComponentTypeOptions">
476
+ <div v-show="!activeTab || activeTab === 'type'" data-testid="modelComponentTypeOptions">
476
477
  <VisibilitySwitch data-testid="modelBlocksVisibilitySwitch" v-model="blocksVisibility" />
477
478
  <ViewerOptionsColoringTypeSelector
478
479
  :id="modelId"
@@ -495,12 +496,11 @@ const attributeSchemas = {
495
496
  :schemas="attributeSchemas"
496
497
  :allowRandom="true"
497
498
  />
498
- </OptionsSection>
499
+ </div>
499
500
 
500
- <OptionsSection
501
+ <div
501
502
  v-if="blockId"
502
- title="Component Options"
503
- class="mt-4"
503
+ v-show="!activeTab || activeTab === 'component'"
504
504
  data-testid="modelComponentOptions"
505
505
  >
506
506
  <VisibilitySwitch v-model="blockVisibility" />
@@ -525,5 +525,5 @@ const attributeSchemas = {
525
525
  :schemas="attributeSchemas"
526
526
  :allowRandom="true"
527
527
  />
528
- </OptionsSection>
528
+ </div>
529
529
  </template>
@@ -1,6 +1,5 @@
1
1
  <script setup lang="ts">
2
2
  import type { CollectionComponent } from "@ogw_front/stores/data_helpers/collections";
3
- import OptionsSection from "@ogw_front/components/Viewer/Options/OptionsSection.vue";
4
3
  import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
5
4
  import ViewerOptionsColoringTypeSelector from "@ogw_front/components/Viewer/Options/ColoringTypeSelector.vue";
6
5
  import VisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch.vue";
@@ -13,6 +12,7 @@ interface Props {
13
12
  cornerId?: string;
14
13
  targetCornerIds: string[];
15
14
  collections?: CollectionComponent[];
15
+ activeTab?: string;
16
16
  }
17
17
 
18
18
  const {
@@ -20,6 +20,7 @@ const {
20
20
  cornerId = undefined,
21
21
  targetCornerIds,
22
22
  collections = undefined,
23
+ activeTab = undefined,
23
24
  } = defineProps<Props>();
24
25
 
25
26
  const dataStyleStore = useDataStyleStore();
@@ -270,7 +271,7 @@ const attributeSchemas = {
270
271
  </script>
271
272
 
272
273
  <template>
273
- <OptionsSection title="Corners Options" class="mt-4" data-testid="modelComponentTypeOptions">
274
+ <div v-show="!activeTab || activeTab === 'type'" data-testid="modelComponentTypeOptions">
274
275
  <VisibilitySwitch data-testid="modelCornersVisibilitySwitch" v-model="cornersVisibility" />
275
276
  <ViewerOptionsColoringTypeSelector
276
277
  :id="modelId"
@@ -287,12 +288,11 @@ const attributeSchemas = {
287
288
  :schemas="attributeSchemas"
288
289
  :allowRandom="true"
289
290
  />
290
- </OptionsSection>
291
+ </div>
291
292
 
292
- <OptionsSection
293
+ <div
293
294
  v-if="cornerId"
294
- title="Component Options"
295
- class="mt-4"
295
+ v-show="!activeTab || activeTab === 'component'"
296
296
  data-testid="modelComponentOptions"
297
297
  >
298
298
  <VisibilitySwitch v-model="cornerVisibility" />
@@ -311,5 +311,5 @@ const attributeSchemas = {
311
311
  :schemas="attributeSchemas"
312
312
  :allowRandom="true"
313
313
  />
314
- </OptionsSection>
314
+ </div>
315
315
  </template>
@@ -1,6 +1,5 @@
1
1
  <script setup lang="ts">
2
2
  import type { CollectionComponent } from "@ogw_front/stores/data_helpers/collections";
3
- import OptionsSection from "@ogw_front/components/Viewer/Options/OptionsSection.vue";
4
3
  import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
5
4
  import ViewerOptionsColoringTypeSelector from "@ogw_front/components/Viewer/Options/ColoringTypeSelector.vue";
6
5
  import VisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch.vue";
@@ -13,6 +12,7 @@ interface Props {
13
12
  lineId?: string;
14
13
  targetLineIds: string[];
15
14
  collections?: CollectionComponent[];
15
+ activeTab?: string;
16
16
  }
17
17
 
18
18
  const {
@@ -20,6 +20,7 @@ const {
20
20
  lineId = undefined,
21
21
  targetLineIds,
22
22
  collections = undefined,
23
+ activeTab = undefined,
23
24
  } = defineProps<Props>();
24
25
 
25
26
  const dataStyleStore = useDataStyleStore();
@@ -391,7 +392,7 @@ const attributeSchemas = {
391
392
  </script>
392
393
 
393
394
  <template>
394
- <OptionsSection title="Lines Options" class="mt-4" data-testid="modelComponentTypeOptions">
395
+ <div v-show="!activeTab || activeTab === 'type'" data-testid="modelComponentTypeOptions">
395
396
  <VisibilitySwitch data-testid="modelLinesVisibilitySwitch" v-model="linesVisibility" />
396
397
  <ViewerOptionsColoringTypeSelector
397
398
  :id="modelId"
@@ -414,12 +415,11 @@ const attributeSchemas = {
414
415
  :schemas="attributeSchemas"
415
416
  :allowRandom="true"
416
417
  />
417
- </OptionsSection>
418
+ </div>
418
419
 
419
- <OptionsSection
420
+ <div
420
421
  v-if="lineId"
421
- title="Component Options"
422
- class="mt-4"
422
+ v-show="!activeTab || activeTab === 'component'"
423
423
  data-testid="modelComponentOptions"
424
424
  >
425
425
  <VisibilitySwitch v-model="lineVisibility" />
@@ -444,5 +444,5 @@ const attributeSchemas = {
444
444
  :schemas="attributeSchemas"
445
445
  :allowRandom="true"
446
446
  />
447
- </OptionsSection>
447
+ </div>
448
448
  </template>
@@ -0,0 +1,35 @@
1
+ <script setup lang="ts">
2
+ import type { ModelTabItem } from "@ogw_front/composables/model_tabs";
3
+
4
+ interface Props {
5
+ tabs: ModelTabItem[];
6
+ }
7
+
8
+ const { tabs } = defineProps<Props>();
9
+ const activeTab = defineModel<string>({ required: true });
10
+ </script>
11
+
12
+ <template>
13
+ <v-row v-if="tabs.length > 0" justify="center" dense class="mb-2">
14
+ <v-col cols="12" class="py-0 d-flex justify-center">
15
+ <v-btn-toggle
16
+ v-model="activeTab"
17
+ mandatory
18
+ color="primary"
19
+ variant="outlined"
20
+ density="compact"
21
+ >
22
+ <v-btn
23
+ v-for="tab in tabs"
24
+ :key="tab.value"
25
+ :value="tab.value"
26
+ :data-testid="tab.testId"
27
+ size="small"
28
+ class="text-caption text-none"
29
+ >
30
+ {{ tab.label }}
31
+ </v-btn>
32
+ </v-btn-toggle>
33
+ </v-col>
34
+ </v-row>
35
+ </template>
@@ -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 = {
@@ -101,53 +102,59 @@ const componentTargets = computed(() =>
101
102
  ? []
102
103
  : [{ componentType: edgesComponentType.value, componentIds: [componentId.value] }],
103
104
  );
105
+
106
+ const { tabs, activeTab } = useModelTabs({
107
+ componentType,
108
+ componentId,
109
+ isTypeSupported: (type) => isEdgesComponentType(type),
110
+ hasComponentsOptions: computed(() => allComponentsTargets.value.length > 0),
111
+ });
104
112
  </script>
105
113
 
106
114
  <template>
107
115
  <v-sheet class="model-edges-card" color="transparent">
108
- <OptionsSection title="Model Edges Options">
116
+ <ModelCardTabs v-model="activeTab" :tabs="tabs" />
117
+
118
+ <div v-show="activeTab === 'model'">
109
119
  <VisibilitySwitch data-testid="modelEdgesVisibilitySwitch" v-model="modelEdgesVisibility" />
110
120
  <ViewerOptionsWidthSlider
111
121
  v-if="modelEdgesVisibility"
112
122
  data-testid="modelEdgesWidthSlider"
113
123
  v-model="modelEdgesWidth"
114
124
  />
115
- </OptionsSection>
125
+ </div>
116
126
 
117
- <OptionsSection
127
+ <div
118
128
  v-if="!componentType && !componentId && allComponentsTargets.length > 0"
119
- title="Components Edges Options"
129
+ v-show="activeTab === 'components'"
120
130
  data-testid="modelEdgesComponentsOptions"
121
- class="mt-4"
122
131
  >
123
132
  <ViewerGenericModelComponentEdgesOptions :modelId="modelId" :targets="allComponentsTargets" />
124
- </OptionsSection>
133
+ </div>
125
134
 
126
- <OptionsSection
135
+ <div
127
136
  v-if="edgesComponentType"
128
- :title="EDGES_TYPE_TITLES[edgesComponentType]"
137
+ v-show="activeTab === 'type'"
129
138
  data-testid="modelEdgesComponentTypeOptions"
130
- class="mt-4"
131
139
  >
132
140
  <ViewerGenericModelComponentEdgesOptions
133
141
  :modelId="modelId"
134
142
  :targets="typeTargets"
135
143
  :referenceComponentId="typeReferenceId"
136
144
  />
137
- </OptionsSection>
145
+ </div>
138
146
 
139
- <OptionsSection
147
+ <div
140
148
  v-if="edgesComponentType && componentId"
141
- title="Component Edges Options"
149
+ v-show="activeTab === 'component'"
142
150
  data-testid="modelEdgesComponentOptions"
143
- class="mt-4"
144
151
  >
145
152
  <ViewerGenericModelComponentEdgesOptions
146
153
  :modelId="modelId"
147
154
  :targets="componentTargets"
148
155
  :referenceComponentId="componentId"
149
156
  />
150
- </OptionsSection>
157
+ </div>
151
158
  </v-sheet>
152
159
  </template>
153
160
 
@@ -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 = {
@@ -85,51 +86,57 @@ const componentTargets = computed(() =>
85
86
  ? []
86
87
  : [{ componentType: pointsComponentType.value, componentIds: [componentId.value] }],
87
88
  );
89
+
90
+ const { tabs, activeTab } = useModelTabs({
91
+ componentType,
92
+ componentId,
93
+ isTypeSupported: (type) => isPointsComponentType(type),
94
+ hasComponentsOptions: computed(() => allComponentsTargets.value.length > 0),
95
+ });
88
96
  </script>
89
97
 
90
98
  <template>
91
99
  <v-sheet class="model-points-card" color="transparent">
92
- <OptionsSection title="Model Points Options">
100
+ <ModelCardTabs v-model="activeTab" :tabs="tabs" />
101
+
102
+ <div v-show="activeTab === 'model'">
93
103
  <VisibilitySwitch data-testid="modelPointsVisibilitySwitch" v-model="modelPointsVisibility" />
94
- </OptionsSection>
104
+ </div>
95
105
 
96
- <OptionsSection
106
+ <div
97
107
  v-if="!componentType && !componentId && allComponentsTargets.length > 0"
98
- title="Components Points Options"
108
+ v-show="activeTab === 'components'"
99
109
  data-testid="modelPointsComponentsOptions"
100
- class="mt-4"
101
110
  >
102
111
  <ViewerGenericModelComponentPointsOptions
103
112
  :modelId="modelId"
104
113
  :targets="allComponentsTargets"
105
114
  />
106
- </OptionsSection>
115
+ </div>
107
116
 
108
- <OptionsSection
117
+ <div
109
118
  v-if="pointsComponentType"
110
- :title="POINTS_TYPE_TITLES[pointsComponentType]"
119
+ v-show="activeTab === 'type'"
111
120
  data-testid="modelPointsComponentTypeOptions"
112
- class="mt-4"
113
121
  >
114
122
  <ViewerGenericModelComponentPointsOptions
115
123
  :modelId="modelId"
116
124
  :targets="typeTargets"
117
125
  :referenceComponentId="typeReferenceId"
118
126
  />
119
- </OptionsSection>
127
+ </div>
120
128
 
121
- <OptionsSection
129
+ <div
122
130
  v-if="pointsComponentType && componentId"
123
- title="Component Points Options"
131
+ v-show="activeTab === 'component'"
124
132
  data-testid="modelPointsComponentOptions"
125
- class="mt-4"
126
133
  >
127
134
  <ViewerGenericModelComponentPointsOptions
128
135
  :modelId="modelId"
129
136
  :targets="componentTargets"
130
137
  :referenceComponentId="componentId"
131
138
  />
132
- </OptionsSection>
139
+ </div>
133
140
  </v-sheet>
134
141
  </template>
135
142