@geode/opengeodeweb-front 10.44.0-rc.1 → 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,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
 
@@ -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();
@@ -442,7 +443,7 @@ const attributeSchemas = {
442
443
  </script>
443
444
 
444
445
  <template>
445
- <OptionsSection title="Surfaces Options" class="mt-4" data-testid="modelComponentTypeOptions">
446
+ <div v-show="!activeTab || activeTab === 'type'" data-testid="modelComponentTypeOptions">
446
447
  <VisibilitySwitch data-testid="modelSurfacesVisibilitySwitch" v-model="surfacesVisibility" />
447
448
  <ViewerOptionsColoringTypeSelector
448
449
  :id="modelId"
@@ -465,12 +466,11 @@ const attributeSchemas = {
465
466
  :schemas="attributeSchemas"
466
467
  :allowRandom="true"
467
468
  />
468
- </OptionsSection>
469
+ </div>
469
470
 
470
- <OptionsSection
471
+ <div
471
472
  v-if="surfaceId"
472
- title="Component Options"
473
- class="mt-4"
473
+ v-show="!activeTab || activeTab === 'component'"
474
474
  data-testid="modelComponentOptions"
475
475
  >
476
476
  <VisibilitySwitch v-model="surfaceVisibility" />
@@ -495,5 +495,5 @@ const attributeSchemas = {
495
495
  :schemas="attributeSchemas"
496
496
  :allowRandom="true"
497
497
  />
498
- </OptionsSection>
498
+ </div>
499
499
  </template>
@@ -0,0 +1,86 @@
1
+ import { type Ref, computed, ref, watch } from "vue";
2
+
3
+ interface ModelTabItem {
4
+ label: string;
5
+ value: string;
6
+ testId: string;
7
+ }
8
+
9
+ interface ModelTabsOptions {
10
+ componentType: Ref<string | undefined>;
11
+ componentId: Ref<string | undefined>;
12
+ isTypeSupported?: (type: string) => boolean;
13
+ hasComponentsOptions?: Ref<boolean>;
14
+ }
15
+
16
+ const COMPONENT_TYPE_PLURALS: Record<string, string> = {
17
+ Surface: "Surfaces",
18
+ Line: "Lines",
19
+ Corner: "Corners",
20
+ Block: "Blocks",
21
+ };
22
+
23
+ function getComponentTypePlural(type: string): string {
24
+ return COMPONENT_TYPE_PLURALS[type] ?? `${type}s`;
25
+ }
26
+
27
+ function isFilled(value: string | undefined): value is string {
28
+ return value !== undefined && value !== "";
29
+ }
30
+
31
+ // Tabs depend on where the menu was opened: data, a component type or one component.
32
+ // Example: a picked surface gives Model | Surfaces | Surface, with Surface active.
33
+ // oxlint-disable-next-line typescript/explicit-function-return-type, typescript/explicit-module-boundary-types
34
+ function useModelTabs(options: ModelTabsOptions) {
35
+ const { componentType, componentId, isTypeSupported, hasComponentsOptions } = options;
36
+
37
+ const supportedType = computed<string | undefined>(() => {
38
+ const type = componentType.value;
39
+ if (!isFilled(type)) {
40
+ return undefined;
41
+ }
42
+ if (isTypeSupported && !isTypeSupported(type)) {
43
+ return undefined;
44
+ }
45
+ return type;
46
+ });
47
+ const isModelContext = computed<boolean>(
48
+ () => !isFilled(componentType.value) && !isFilled(componentId.value),
49
+ );
50
+
51
+ const tabs = computed<ModelTabItem[]>(() => {
52
+ const items: ModelTabItem[] = [{ label: "Model", value: "model", testId: "modelTab_model" }];
53
+ const type = supportedType.value;
54
+ if (isModelContext.value && (hasComponentsOptions?.value ?? true)) {
55
+ items.push({
56
+ label: "Components Options",
57
+ value: "components",
58
+ testId: "modelTab_components",
59
+ });
60
+ } else if (type !== undefined) {
61
+ items.push({ label: getComponentTypePlural(type), value: "type", testId: "modelTab_type" });
62
+ if (isFilled(componentId.value)) {
63
+ items.push({ label: type, value: "component", testId: "modelTab_component" });
64
+ }
65
+ }
66
+ return items;
67
+ });
68
+
69
+ const activeTab = ref<string>("model");
70
+ watch(
71
+ [supportedType, componentId],
72
+ ([type, id]) => {
73
+ if (type === undefined) {
74
+ activeTab.value = "model";
75
+ } else {
76
+ activeTab.value = isFilled(id) ? "component" : "type";
77
+ }
78
+ },
79
+ { immediate: true },
80
+ );
81
+
82
+ return { tabs, activeTab };
83
+ }
84
+
85
+ export { getComponentTypePlural, useModelTabs };
86
+ export type { ModelTabItem };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geode/opengeodeweb-front",
3
- "version": "10.44.0-rc.1",
3
+ "version": "10.44.0-rc.2",
4
4
  "description": "OpenSource Vue/Nuxt/Pinia/Vuetify framework for web applications",
5
5
  "homepage": "https://github.com/Geode-solutions/OpenGeodeWeb-Front",
6
6
  "bugs": {
@@ -1,76 +0,0 @@
1
- <script setup lang="ts">
2
- interface Props {
3
- title: string;
4
- }
5
-
6
- const { title } = defineProps<Props>();
7
-
8
- const isCollapsed = ref<boolean>(false);
9
- </script>
10
-
11
- <template>
12
- <div class="options-section">
13
- <div class="section-badge" @click="isCollapsed = !isCollapsed">
14
- {{ title }}
15
- <v-icon class="collapse-icon" :class="{ rotated: isCollapsed }" size="12">
16
- mdi-chevron-down
17
- </v-icon>
18
- </div>
19
- <v-container v-show="!isCollapsed" class="pa-0">
20
- <slot />
21
- </v-container>
22
- </div>
23
- </template>
24
-
25
- <style scoped>
26
- .options-section {
27
- position: relative;
28
- border: 1px solid rgba(255, 255, 255, 0.2);
29
- border-radius: 8px;
30
- padding: 8px 4px 6px 4px;
31
- }
32
-
33
- .section-badge {
34
- position: absolute;
35
- top: -10px;
36
- left: 12px;
37
- background-color: rgba(255, 255, 255, 0.1);
38
- backdrop-filter: blur(8px);
39
- padding: 1px 8px;
40
- font-size: 0.65rem;
41
- font-weight: 700;
42
- text-transform: uppercase;
43
- letter-spacing: 0.5px;
44
- color: white;
45
- border: 1px solid rgba(255, 255, 255, 0.2);
46
- border-radius: 20px;
47
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
48
- cursor: pointer;
49
- user-select: none;
50
- display: flex;
51
- align-items: center;
52
- gap: 4px;
53
- }
54
-
55
- .section-badge:hover {
56
- background-color: rgba(255, 255, 255, 0.2);
57
- }
58
-
59
- .collapse-icon {
60
- transition: transform 0.2s ease;
61
- }
62
-
63
- .collapse-icon.rotated {
64
- transform: rotate(-90deg);
65
- }
66
-
67
- .v-theme--light .options-section {
68
- border-color: rgba(0, 0, 0, 0.12);
69
- }
70
-
71
- .v-theme--light .section-badge {
72
- background-color: white;
73
- color: #444;
74
- border-color: rgba(0, 0, 0, 0.12);
75
- }
76
- </style>