@geode/opengeodeweb-front 10.44.0-rc.2 → 10.44.0-rc.4
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/.build/server/utils/cleanup.js +7 -2
- package/.build/server/utils/microservices.js +9 -81
- package/.build/server/utils/microservices_process.js +85 -0
- package/.build/server/utils/typed_handler.js +5 -1
- package/.build/server/utils/ws_client.js +7 -2
- package/.build/shared/utils/fetch_raw.js +2 -2
- package/.build/shared/utils/parse_boolean.js +2 -1
- package/app/components/ClippingPlanes.vue +22 -78
- package/app/components/DragAndDrop.vue +16 -79
- package/app/components/FileSelector.vue +9 -6
- package/app/components/HybridViewerTooltip.vue +8 -2
- package/app/components/MissingFilesSelector.vue +10 -6
- package/app/components/ObjectSelector.vue +6 -3
- package/app/components/Screenshot.vue +9 -2
- package/app/components/ThresholdCard.vue +205 -0
- package/app/components/ThresholdFilter.vue +81 -216
- package/app/components/ViewToolbar.vue +15 -231
- package/app/components/Viewer/EdgedCurve/SpecificEdgesColoring.vue +209 -0
- package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +3 -191
- package/app/components/Viewer/Generic/Mesh/CellsColoring.vue +228 -0
- package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +3 -210
- package/app/components/Viewer/Generic/Mesh/EdgesColoring.vue +211 -0
- package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +3 -192
- package/app/components/Viewer/Generic/Mesh/PolygonsColoring.vue +234 -0
- package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +3 -215
- package/app/components/Viewer/Generic/Mesh/PolyhedraColoring.vue +221 -0
- package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +3 -203
- package/app/components/Viewer/Generic/Model/BlocksOptions.vue +7 -5
- package/app/components/Viewer/Generic/Model/ComponentPointsOptions.vue +2 -18
- package/app/components/Viewer/Generic/Model/CornerComponentOptions.vue +145 -0
- package/app/components/Viewer/Generic/Model/CornersOptions.vue +13 -292
- package/app/components/Viewer/Generic/Model/CornersTypeOptions.vue +173 -0
- package/app/components/Viewer/Generic/Model/LineComponentOptions.vue +218 -0
- package/app/components/Viewer/Generic/Model/LinesOptions.vue +13 -425
- package/app/components/Viewer/Generic/Model/LinesTypeOptions.vue +229 -0
- package/app/components/Viewer/Generic/Model/ModelEdgesCard.vue +12 -10
- package/app/components/Viewer/Generic/Model/ModelPointsCard.vue +12 -10
- package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +9 -5
- package/app/components/Viewer/ObjectTree/Base/ComponentRelations.vue +4 -1
- package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +6 -1
- package/app/components/Viewer/Options/AttributeRangeSelector.vue +11 -4
- package/app/components/Viewer/Options/AttributeSelector.vue +40 -136
- package/app/components/Viewer/Options/ColorPicker.vue +4 -1
- package/app/components/Viewer/Options/ColoringTypeSelector.vue +36 -74
- package/app/components/Viewer/Options/ColormapQuickPicker.vue +13 -7
- package/app/components/Viewer/Options/NoDataColorInfo.vue +56 -0
- package/app/components/Viewer/Solid/SpecificPolyhedraColoring.vue +217 -0
- package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +4 -199
- package/app/components/Viewer/Surface/PolygonsColoring.vue +231 -0
- package/app/components/Viewer/Surface/PolygonsOptions.vue +3 -213
- package/app/components/csv-preview/CsvPreviewer.vue +4 -1
- package/app/composables/attribute_coloring_style.ts +8 -2
- package/app/composables/attribute_selector.ts +126 -0
- package/app/composables/clipping_slices.ts +166 -0
- package/app/composables/global_attribute_style.ts +4 -3
- package/app/composables/hover_highlight.ts +6 -5
- package/app/composables/project_manager.ts +5 -5
- package/app/composables/stepper_tree.ts +10 -2
- package/app/composables/tree_filter.ts +11 -2
- package/app/composables/tree_keyboard_nav.ts +4 -2
- package/app/composables/use_overlapping_picker.ts +5 -5
- package/app/composables/view_toolbar_options.ts +126 -0
- package/app/composables/view_toolbar_tool_options.ts +115 -0
- package/app/composables/view_toolbar_tools.ts +108 -0
- package/app/composables/virtual_tree.ts +20 -131
- package/app/composables/virtual_tree_flatten.ts +86 -0
- package/app/composables/virtual_tree_types.ts +81 -0
- package/app/stores/app.ts +8 -55
- package/app/stores/app_helpers/extension.ts +1 -1
- package/app/stores/app_helpers/registry.ts +69 -0
- package/app/stores/feedback.ts +2 -2
- package/app/stores/hybrid_viewer.ts +1 -1
- package/app/stores/menu.ts +1 -124
- package/app/stores/menu_helpers/menus_data.ts +127 -0
- package/app/stores/treeview.ts +17 -10
- package/app/stores/viewer.ts +17 -78
- package/app/stores/viewer_helpers/actions.ts +68 -0
- package/app/stores/viewer_helpers/request.ts +61 -0
- package/app/utils/clipping_planes.ts +4 -131
- package/app/utils/clipping_planes_scene.ts +131 -0
- package/app/utils/coloring_styles.ts +101 -0
- package/app/utils/default_styles/mesh_components.ts +168 -0
- package/app/utils/default_styles/meshes.ts +13 -153
- package/app/utils/default_styles/model_components.ts +170 -0
- package/app/utils/default_styles/models.ts +16 -153
- package/app/utils/drag_and_drop.ts +80 -0
- package/app/utils/extension.ts +1 -1
- package/app/utils/import_workflow.ts +6 -4
- package/app/utils/model_component_coloring.ts +46 -0
- package/app/utils/threshold.ts +33 -0
- package/app/utils/threshold_sources.ts +51 -0
- package/app/utils/upload_path.ts +15 -9
- package/internal/database/database.ts +4 -1
- package/internal/stores/data_style/mesh/cells/cell.ts +27 -150
- package/internal/stores/data_style/mesh/cells/cell_attribute.ts +74 -0
- package/internal/stores/data_style/mesh/cells/cell_config.ts +152 -0
- package/internal/stores/data_style/mesh/cells/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/cells/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/cells/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/edges/edge.ts +27 -150
- package/internal/stores/data_style/mesh/edges/edge_attribute.ts +74 -0
- package/internal/stores/data_style/mesh/edges/edge_config.ts +152 -0
- package/internal/stores/data_style/mesh/edges/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/edges/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/edges/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/points/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/points/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/points/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/polygons/polygon.ts +27 -152
- package/internal/stores/data_style/mesh/polygons/polygon_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/polygons/polygon_config.ts +148 -0
- package/internal/stores/data_style/mesh/polygons/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/polygons/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/polygons/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/polyhedra/polyhedron.ts +27 -160
- package/internal/stores/data_style/mesh/polyhedra/polyhedron_attribute.ts +82 -0
- package/internal/stores/data_style/mesh/polyhedra/polyhedron_config.ts +157 -0
- package/internal/stores/data_style/mesh/polyhedra/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/polyhedra/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/polyhedra/vertex_config.ts +152 -0
- package/internal/stores/data_style/model/blocks/apply_coloring.ts +173 -0
- package/internal/stores/data_style/model/blocks/coloring_groups.ts +18 -0
- package/internal/stores/data_style/model/blocks/index.ts +12 -140
- package/internal/stores/data_style/model/blocks/polyhedron.ts +14 -10
- package/internal/stores/data_style/model/blocks/vertex.ts +14 -10
- package/internal/stores/data_style/model/common.ts +10 -119
- package/internal/stores/data_style/model/common_mutations.ts +184 -0
- package/internal/stores/data_style/model/corners/vertex.ts +14 -10
- package/internal/stores/data_style/model/lines/apply_coloring.ts +154 -0
- package/internal/stores/data_style/model/lines/coloring_groups.ts +18 -0
- package/internal/stores/data_style/model/lines/edge.ts +14 -10
- package/internal/stores/data_style/model/lines/index.ts +10 -134
- package/internal/stores/data_style/model/lines/vertex.ts +14 -10
- package/internal/stores/data_style/model/surfaces/apply_coloring.ts +186 -0
- package/internal/stores/data_style/model/surfaces/coloring_groups.ts +18 -0
- package/internal/stores/data_style/model/surfaces/index.ts +16 -160
- package/internal/stores/data_style/model/surfaces/polygon.ts +14 -10
- package/internal/stores/data_style/model/surfaces/vertex.ts +14 -10
- package/internal/stores/data_style/model/visibility.ts +3 -156
- package/internal/stores/data_style/model/visibility_dispatch.ts +160 -0
- package/internal/stores/data_style/state.ts +1 -181
- package/internal/stores/data_style/state_shared.ts +191 -0
- package/internal/stores/hybrid_viewer/brightness.ts +8 -2
- package/internal/stores/hybrid_viewer/camera.ts +7 -161
- package/internal/stores/hybrid_viewer/camera_animation.ts +4 -3
- package/internal/stores/hybrid_viewer/camera_helpers.ts +120 -0
- package/internal/stores/hybrid_viewer/camera_orientation.ts +60 -0
- package/internal/stores/hybrid_viewer/filters.ts +54 -11
- package/internal/stores/hybrid_viewer/highlight.ts +10 -9
- package/internal/stores/hybrid_viewer/ruler.ts +4 -3
- package/internal/utils/ws_client.ts +8 -1
- package/package.json +2 -2
- package/server/api/local/extensions/run.post.ts +6 -4
- package/server/utils/cleanup.ts +12 -2
- package/server/utils/microservices.ts +10 -102
- package/server/utils/microservices_process.ts +127 -0
- package/server/utils/typed_handler.ts +8 -1
- package/server/utils/ws_client.ts +15 -2
- package/shared/utils/fetch_raw.ts +2 -2
- package/shared/utils/parse_boolean.ts +4 -1
|
@@ -1,72 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
type ReadonlyMaybeRefOrGetter
|
|
5
|
-
|
|
6
|
-
type TreeItem
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
height: number;
|
|
13
|
-
[key: string]: unknown;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
interface SelectionConfig {
|
|
17
|
-
selectable: boolean;
|
|
18
|
-
strategy: string;
|
|
19
|
-
[key: string]: unknown;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
interface VirtualTreeProps {
|
|
23
|
-
readonly items?: readonly TreeItem[];
|
|
24
|
-
readonly opened?: readonly unknown[];
|
|
25
|
-
readonly selected?: readonly unknown[];
|
|
26
|
-
readonly active?: readonly unknown[];
|
|
27
|
-
readonly itemProps?: Partial<ItemPropsConfig>;
|
|
28
|
-
readonly selection?: Partial<SelectionConfig>;
|
|
29
|
-
readonly search?: string;
|
|
30
|
-
readonly customFilter?: (id: unknown, search: string, context: { raw: TreeItem }) => boolean;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
interface DisplayItem {
|
|
34
|
-
raw: TreeItem;
|
|
35
|
-
id: unknown;
|
|
36
|
-
depth: number;
|
|
37
|
-
isOpen: boolean;
|
|
38
|
-
isActive: boolean;
|
|
39
|
-
isLeaf: boolean;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
type EmitFn = (event: string, ...args: readonly unknown[]) => void;
|
|
43
|
-
|
|
44
|
-
interface UseVirtualTreeReturn {
|
|
45
|
-
actualItemProps: ComputedRef<ItemPropsConfig>;
|
|
46
|
-
actualSelection: ComputedRef<SelectionConfig>;
|
|
47
|
-
displayItems: ComputedRef<DisplayItem[]>;
|
|
48
|
-
toggleOpen: (item: TreeItem) => void;
|
|
49
|
-
toggleSelect: (item: TreeItem) => void;
|
|
50
|
-
isSelected: (item: TreeItem) => boolean;
|
|
51
|
-
getIndeterminate: (item: TreeItem) => boolean;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Real runtime check (rather than an `as TreeItem[]` cast) for the duck-typed "children" field:
|
|
55
|
-
// Item shapes vary across callers (treeview groups, model component/collection groups, ...), so
|
|
56
|
-
// This only verifies it is actually an array, same as the assumption the old cast silently made.
|
|
57
|
-
function isTreeItemArray(value: unknown): value is TreeItem[] {
|
|
58
|
-
return Array.isArray(value);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Extracted so we never call String() directly on a value typed as `unknown` (ids and titles can
|
|
62
|
-
// Be anything at runtime): only stringify primitives that have a sane toString, and fall back to
|
|
63
|
-
// "" for anything else instead of risking "[object Object]".
|
|
64
|
-
function toDisplayString(value: unknown): string {
|
|
65
|
-
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
66
|
-
return String(value);
|
|
67
|
-
}
|
|
68
|
-
return "";
|
|
69
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
type EmitFn,
|
|
3
|
+
type ItemPropsConfig,
|
|
4
|
+
type ReadonlyMaybeRefOrGetter,
|
|
5
|
+
type SelectionConfig,
|
|
6
|
+
type TreeItem,
|
|
7
|
+
type UseVirtualTreeReturn,
|
|
8
|
+
type VirtualTreeProps,
|
|
9
|
+
isTreeItemArray,
|
|
10
|
+
} from "./virtual_tree_types";
|
|
11
|
+
import { flattenTree } from "./virtual_tree_flatten";
|
|
70
12
|
|
|
71
13
|
function useVirtualTree(
|
|
72
14
|
propsIn: ReadonlyMaybeRefOrGetter<VirtualTreeProps>,
|
|
@@ -171,66 +113,6 @@ function useVirtualTree(
|
|
|
171
113
|
emit("update:selected", [...newSelected]);
|
|
172
114
|
}
|
|
173
115
|
|
|
174
|
-
function flattenTree(itemsList: readonly TreeItem[], depth = 0): DisplayItem[] {
|
|
175
|
-
const { search, customFilter } = props.value;
|
|
176
|
-
const result: DisplayItem[] = [];
|
|
177
|
-
|
|
178
|
-
for (const item of itemsList) {
|
|
179
|
-
const id = item[actualItemProps.value.value];
|
|
180
|
-
const children = getChildrenOf(item);
|
|
181
|
-
const hasChildren = Boolean(children && children.length > 0);
|
|
182
|
-
|
|
183
|
-
const isOpen = openedSet.value.has(id);
|
|
184
|
-
const isActive = activeSet.value.has(id);
|
|
185
|
-
|
|
186
|
-
if (search !== undefined && search !== "") {
|
|
187
|
-
const lowerSearch = search.toLowerCase();
|
|
188
|
-
const matches = customFilter
|
|
189
|
-
? customFilter(id, search, { raw: item })
|
|
190
|
-
: toDisplayString(item[actualItemProps.value.title])
|
|
191
|
-
.toLowerCase()
|
|
192
|
-
.includes(lowerSearch) || toDisplayString(id).toLowerCase().includes(lowerSearch);
|
|
193
|
-
|
|
194
|
-
if (hasChildren) {
|
|
195
|
-
const subtree = flattenTree(children ?? [], depth + 1);
|
|
196
|
-
if (subtree.length === 0 && !matches) {
|
|
197
|
-
continue;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
result.push({
|
|
201
|
-
raw: item,
|
|
202
|
-
id,
|
|
203
|
-
depth,
|
|
204
|
-
isOpen,
|
|
205
|
-
isActive,
|
|
206
|
-
isLeaf: false,
|
|
207
|
-
});
|
|
208
|
-
if (isOpen) {
|
|
209
|
-
result.push(...subtree);
|
|
210
|
-
}
|
|
211
|
-
continue;
|
|
212
|
-
}
|
|
213
|
-
if (!matches) {
|
|
214
|
-
continue;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
result.push({
|
|
219
|
-
raw: item,
|
|
220
|
-
id,
|
|
221
|
-
depth,
|
|
222
|
-
isOpen,
|
|
223
|
-
isActive,
|
|
224
|
-
isLeaf: !hasChildren,
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
if (isOpen && hasChildren) {
|
|
228
|
-
result.push(...flattenTree(children ?? [], depth + 1));
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
return result;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
116
|
function collectNonLeafIds(itemsList: readonly TreeItem[]): unknown[] {
|
|
235
117
|
const allIds: unknown[] = [];
|
|
236
118
|
for (const item of itemsList) {
|
|
@@ -242,7 +124,8 @@ function useVirtualTree(
|
|
|
242
124
|
return allIds;
|
|
243
125
|
}
|
|
244
126
|
|
|
245
|
-
const
|
|
127
|
+
const flattenContext = { props, actualItemProps, openedSet, activeSet, getChildrenOf };
|
|
128
|
+
const displayItems = computed(() => flattenTree(flattenContext, props.value.items ?? []));
|
|
246
129
|
|
|
247
130
|
watch(
|
|
248
131
|
() => props.value.search,
|
|
@@ -267,5 +150,11 @@ function useVirtualTree(
|
|
|
267
150
|
};
|
|
268
151
|
}
|
|
269
152
|
|
|
153
|
+
export type {
|
|
154
|
+
DisplayItem,
|
|
155
|
+
EmitFn,
|
|
156
|
+
ItemPropsConfig,
|
|
157
|
+
SelectionConfig,
|
|
158
|
+
TreeItem,
|
|
159
|
+
} from "./virtual_tree_types";
|
|
270
160
|
export { useVirtualTree };
|
|
271
|
-
export type { TreeItem, ItemPropsConfig, SelectionConfig, DisplayItem, EmitFn };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { ComputedRef, Ref } from "vue";
|
|
2
|
+
import {
|
|
3
|
+
type DisplayItem,
|
|
4
|
+
type ItemPropsConfig,
|
|
5
|
+
type TreeItem,
|
|
6
|
+
type VirtualTreeProps,
|
|
7
|
+
toDisplayString,
|
|
8
|
+
} from "./virtual_tree_types";
|
|
9
|
+
|
|
10
|
+
interface FlattenContext {
|
|
11
|
+
props: Ref<VirtualTreeProps>;
|
|
12
|
+
actualItemProps: ComputedRef<ItemPropsConfig>;
|
|
13
|
+
openedSet: ComputedRef<Set<unknown>>;
|
|
14
|
+
activeSet: ComputedRef<Set<unknown>>;
|
|
15
|
+
getChildrenOf: (item: TreeItem) => TreeItem[] | undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function matchesSearch(ctx: FlattenContext, item: TreeItem, id: unknown, search: string): boolean {
|
|
19
|
+
const { customFilter } = ctx.props.value;
|
|
20
|
+
if (customFilter) {
|
|
21
|
+
return customFilter(id, search, { raw: item });
|
|
22
|
+
}
|
|
23
|
+
const lowerSearch = search.toLowerCase();
|
|
24
|
+
return (
|
|
25
|
+
toDisplayString(item[ctx.actualItemProps.value.title]).toLowerCase().includes(lowerSearch) ||
|
|
26
|
+
toDisplayString(id).toLowerCase().includes(lowerSearch)
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function flattenTree(ctx: FlattenContext, nodes: readonly TreeItem[], depth = 0): DisplayItem[] {
|
|
31
|
+
const { search } = ctx.props.value;
|
|
32
|
+
const result: DisplayItem[] = [];
|
|
33
|
+
|
|
34
|
+
for (const item of nodes) {
|
|
35
|
+
const id = item[ctx.actualItemProps.value.value];
|
|
36
|
+
const children = ctx.getChildrenOf(item);
|
|
37
|
+
const hasChildren = Boolean(children && children.length > 0);
|
|
38
|
+
|
|
39
|
+
const isOpen = ctx.openedSet.value.has(id);
|
|
40
|
+
const isActive = ctx.activeSet.value.has(id);
|
|
41
|
+
|
|
42
|
+
if (search !== undefined && search !== "") {
|
|
43
|
+
const matches = matchesSearch(ctx, item, id, search);
|
|
44
|
+
|
|
45
|
+
if (hasChildren) {
|
|
46
|
+
const subtree = flattenTree(ctx, children ?? [], depth + 1);
|
|
47
|
+
if (subtree.length === 0 && !matches) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
result.push({
|
|
52
|
+
raw: item,
|
|
53
|
+
id,
|
|
54
|
+
depth,
|
|
55
|
+
isOpen,
|
|
56
|
+
isActive,
|
|
57
|
+
isLeaf: false,
|
|
58
|
+
});
|
|
59
|
+
if (isOpen) {
|
|
60
|
+
result.push(...subtree);
|
|
61
|
+
}
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (!matches) {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
result.push({
|
|
70
|
+
raw: item,
|
|
71
|
+
id,
|
|
72
|
+
depth,
|
|
73
|
+
isOpen,
|
|
74
|
+
isActive,
|
|
75
|
+
isLeaf: !hasChildren,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
if (isOpen && hasChildren) {
|
|
79
|
+
result.push(...flattenTree(ctx, children ?? [], depth + 1));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { flattenTree };
|
|
86
|
+
export type { FlattenContext };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { ComputedRef, Ref } from "vue";
|
|
2
|
+
|
|
3
|
+
// Same shape as Vue's MaybeRefOrGetter<T>, kept as a local alias for readability at call sites.
|
|
4
|
+
type ReadonlyMaybeRefOrGetter<Value> = Value | Ref<Value> | (() => Value);
|
|
5
|
+
|
|
6
|
+
type TreeItem = Record<string, unknown>;
|
|
7
|
+
|
|
8
|
+
interface ItemPropsConfig {
|
|
9
|
+
value: string;
|
|
10
|
+
title: string;
|
|
11
|
+
children: string;
|
|
12
|
+
height: number;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface SelectionConfig {
|
|
17
|
+
selectable: boolean;
|
|
18
|
+
strategy: string;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface VirtualTreeProps {
|
|
23
|
+
readonly items?: readonly TreeItem[];
|
|
24
|
+
readonly opened?: readonly unknown[];
|
|
25
|
+
readonly selected?: readonly unknown[];
|
|
26
|
+
readonly active?: readonly unknown[];
|
|
27
|
+
readonly itemProps?: Partial<ItemPropsConfig>;
|
|
28
|
+
readonly selection?: Partial<SelectionConfig>;
|
|
29
|
+
readonly search?: string;
|
|
30
|
+
readonly customFilter?: (id: unknown, search: string, context: { raw: TreeItem }) => boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface DisplayItem {
|
|
34
|
+
raw: TreeItem;
|
|
35
|
+
id: unknown;
|
|
36
|
+
depth: number;
|
|
37
|
+
isOpen: boolean;
|
|
38
|
+
isActive: boolean;
|
|
39
|
+
isLeaf: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
type EmitFn = (event: string, ...args: readonly unknown[]) => void;
|
|
43
|
+
|
|
44
|
+
interface UseVirtualTreeReturn {
|
|
45
|
+
actualItemProps: ComputedRef<ItemPropsConfig>;
|
|
46
|
+
actualSelection: ComputedRef<SelectionConfig>;
|
|
47
|
+
displayItems: ComputedRef<DisplayItem[]>;
|
|
48
|
+
toggleOpen: (item: TreeItem) => void;
|
|
49
|
+
toggleSelect: (item: TreeItem) => void;
|
|
50
|
+
isSelected: (item: TreeItem) => boolean;
|
|
51
|
+
getIndeterminate: (item: TreeItem) => boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Real runtime check (rather than an `as TreeItem[]` cast) for the duck-typed "children" field:
|
|
55
|
+
// Item shapes vary across callers (treeview groups, model component/collection groups, ...), so
|
|
56
|
+
// This only verifies it is actually an array, same as the assumption the old cast silently made.
|
|
57
|
+
function isTreeItemArray(value: unknown): value is TreeItem[] {
|
|
58
|
+
return Array.isArray(value);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Extracted so we never call String() directly on a value typed as `unknown` (ids and titles can
|
|
62
|
+
// Be anything at runtime): only stringify primitives that have a sane toString, and fall back to
|
|
63
|
+
// "" for anything else instead of risking "[object Object]".
|
|
64
|
+
function toDisplayString(value: unknown): string {
|
|
65
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
66
|
+
return String(value);
|
|
67
|
+
}
|
|
68
|
+
return "";
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { isTreeItemArray, toDisplayString };
|
|
72
|
+
export type {
|
|
73
|
+
DisplayItem,
|
|
74
|
+
EmitFn,
|
|
75
|
+
ItemPropsConfig,
|
|
76
|
+
ReadonlyMaybeRefOrGetter,
|
|
77
|
+
SelectionConfig,
|
|
78
|
+
TreeItem,
|
|
79
|
+
UseVirtualTreeReturn,
|
|
80
|
+
VirtualTreeProps,
|
|
81
|
+
};
|
package/app/stores/app.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { consola } from "consola";
|
|
2
|
-
|
|
3
1
|
// Local imports
|
|
2
|
+
import {
|
|
3
|
+
type RegisterableStore,
|
|
4
|
+
exportRegisteredStores,
|
|
5
|
+
importRegisteredStores,
|
|
6
|
+
} from "./app_helpers/registry.js";
|
|
4
7
|
import { getRestApiPort, getRestApiProtocol, isCloudMode } from "@ogw_front/utils/stores.js";
|
|
5
8
|
import { Status } from "@ogw_front/utils/status";
|
|
6
9
|
import { api_fetch } from "@ogw_internal/utils/api_fetch.js";
|
|
@@ -27,16 +30,6 @@ declare module "pinia" {
|
|
|
27
30
|
}
|
|
28
31
|
}
|
|
29
32
|
|
|
30
|
-
interface RegisterableStore {
|
|
31
|
-
$id: string;
|
|
32
|
-
$patch?: (partial: Record<string, unknown>) => void;
|
|
33
|
-
exportStores?: (params?: Record<string, unknown>) => Promise<unknown>;
|
|
34
|
-
importStores?: (snapshot: unknown) => Promise<void> | void;
|
|
35
|
-
connect?: () => Promise<void>;
|
|
36
|
-
kill?: () => Promise<void>;
|
|
37
|
-
[key: string]: unknown;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
33
|
// oxlint-disable-next-line max-lines-per-function, max-statements
|
|
41
34
|
export const useAppStore = defineStore("app", () => {
|
|
42
35
|
const stores: RegisterableStore[] = [];
|
|
@@ -85,52 +78,12 @@ export const useAppStore = defineStore("app", () => {
|
|
|
85
78
|
async function exportStores(
|
|
86
79
|
params: Record<string, unknown> = {},
|
|
87
80
|
): Promise<Record<string, unknown>> {
|
|
88
|
-
const snapshot
|
|
89
|
-
|
|
90
|
-
await Promise.all(
|
|
91
|
-
stores.map(async (store: RegisterableStore) => {
|
|
92
|
-
if (!store.exportStores) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
const storeId = store.$id;
|
|
96
|
-
try {
|
|
97
|
-
snapshot[storeId] = await store.exportStores(params);
|
|
98
|
-
} catch {
|
|
99
|
-
// Ignore stores that fail to export; other stores still complete independently.
|
|
100
|
-
}
|
|
101
|
-
}),
|
|
102
|
-
);
|
|
81
|
+
const snapshot = await exportRegisteredStores(stores, params);
|
|
103
82
|
return snapshot;
|
|
104
83
|
}
|
|
105
84
|
|
|
106
85
|
async function importStores(snapshot: Record<string, unknown> | undefined): Promise<void> {
|
|
107
|
-
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const missingStoreIds: string[] = [];
|
|
112
|
-
|
|
113
|
-
await Promise.all(
|
|
114
|
-
stores.map(async (store: RegisterableStore) => {
|
|
115
|
-
if (!store.importStores) {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
const storeId = store.$id;
|
|
119
|
-
if (snapshot[storeId] === undefined) {
|
|
120
|
-
missingStoreIds.push(storeId);
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
try {
|
|
124
|
-
await store.importStores(snapshot[storeId]);
|
|
125
|
-
} catch {
|
|
126
|
-
// Ignore stores that fail to import; other stores still complete independently.
|
|
127
|
-
}
|
|
128
|
-
}),
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
if (missingStoreIds.length > 0) {
|
|
132
|
-
consola.warn(`Stores not found in snapshot: ${missingStoreIds.join(", ")}`);
|
|
133
|
-
}
|
|
86
|
+
await importRegisteredStores(stores, snapshot);
|
|
134
87
|
}
|
|
135
88
|
|
|
136
89
|
const {
|
|
@@ -253,4 +206,4 @@ export const useAppStore = defineStore("app", () => {
|
|
|
253
206
|
};
|
|
254
207
|
});
|
|
255
208
|
|
|
256
|
-
export type { RegisterableStore };
|
|
209
|
+
export type { RegisterableStore } from "./app_helpers/registry.js";
|
|
@@ -80,7 +80,7 @@ export function useAppExtensions(): {
|
|
|
80
80
|
const store = extensionModule.metadata.store();
|
|
81
81
|
store.$patch?.({
|
|
82
82
|
default_local_port: extensionPort,
|
|
83
|
-
...(serverPort
|
|
83
|
+
...(serverPort !== undefined && { nitro_port: serverPort }),
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
if (finalURL !== path && finalURL.startsWith("blob:")) {
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { consola } from "consola";
|
|
2
|
+
|
|
3
|
+
interface RegisterableStore {
|
|
4
|
+
$id: string;
|
|
5
|
+
$patch?: (partial: Record<string, unknown>) => void;
|
|
6
|
+
exportStores?: (params?: Record<string, unknown>) => Promise<unknown>;
|
|
7
|
+
importStores?: (snapshot: unknown) => Promise<void> | void;
|
|
8
|
+
connect?: () => Promise<void>;
|
|
9
|
+
kill?: () => Promise<void>;
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async function exportRegisteredStores(
|
|
14
|
+
stores: readonly RegisterableStore[],
|
|
15
|
+
params: Record<string, unknown> = {},
|
|
16
|
+
): Promise<Record<string, unknown>> {
|
|
17
|
+
const snapshot: Record<string, unknown> = {};
|
|
18
|
+
|
|
19
|
+
await Promise.all(
|
|
20
|
+
stores.map(async (store: RegisterableStore) => {
|
|
21
|
+
if (!store.exportStores) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const storeId = store.$id;
|
|
25
|
+
try {
|
|
26
|
+
snapshot[storeId] = await store.exportStores(params);
|
|
27
|
+
} catch {
|
|
28
|
+
// Ignore stores that fail to export; other stores still complete independently.
|
|
29
|
+
}
|
|
30
|
+
}),
|
|
31
|
+
);
|
|
32
|
+
return snapshot;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async function importRegisteredStores(
|
|
36
|
+
stores: readonly RegisterableStore[],
|
|
37
|
+
snapshot: Record<string, unknown> | undefined,
|
|
38
|
+
): Promise<void> {
|
|
39
|
+
if (!snapshot) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const missingStoreIds: string[] = [];
|
|
44
|
+
|
|
45
|
+
await Promise.all(
|
|
46
|
+
stores.map(async (store: RegisterableStore) => {
|
|
47
|
+
if (!store.importStores) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const storeId = store.$id;
|
|
51
|
+
if (snapshot[storeId] === undefined) {
|
|
52
|
+
missingStoreIds.push(storeId);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
await store.importStores(snapshot[storeId]);
|
|
57
|
+
} catch {
|
|
58
|
+
// Ignore stores that fail to import; other stores still complete independently.
|
|
59
|
+
}
|
|
60
|
+
}),
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
if (missingStoreIds.length > 0) {
|
|
64
|
+
consola.warn(`Stores not found in snapshot: ${missingStoreIds.join(", ")}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { exportRegisteredStores, importRegisteredStores };
|
|
69
|
+
export type { RegisterableStore };
|
package/app/stores/feedback.ts
CHANGED
|
@@ -47,7 +47,7 @@ export const useFeedbackStore = defineStore("feedback", {
|
|
|
47
47
|
id: feedbackId,
|
|
48
48
|
type: "success",
|
|
49
49
|
description,
|
|
50
|
-
...(action
|
|
50
|
+
...(action !== undefined && { action }),
|
|
51
51
|
});
|
|
52
52
|
setTimeout(() => {
|
|
53
53
|
this.delete_feedback(feedbackId);
|
|
@@ -59,7 +59,7 @@ export const useFeedbackStore = defineStore("feedback", {
|
|
|
59
59
|
id: feedbackId,
|
|
60
60
|
type: "warning",
|
|
61
61
|
description,
|
|
62
|
-
...(action
|
|
62
|
+
...(action !== undefined && { action }),
|
|
63
63
|
});
|
|
64
64
|
setTimeout(() => {
|
|
65
65
|
this.delete_feedback(feedbackId);
|
|
@@ -111,7 +111,7 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
111
111
|
const camera = renderer?.getActiveCamera();
|
|
112
112
|
return {
|
|
113
113
|
zScale: sceneStore.zScale.value,
|
|
114
|
-
camera_options: (camera
|
|
114
|
+
camera_options: (camera && getCameraOptions(camera)) ?? cameraStore.camera_options,
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
117
|
|
package/app/stores/menu.ts
CHANGED
|
@@ -1,46 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import PointSetPointsOptions from "@ogw_front/components/Viewer/PointSet/SpecificPointsOptions.vue";
|
|
3
|
-
|
|
4
|
-
// EdgedCurve components
|
|
5
|
-
import EdgedCurveEdgesOptions from "@ogw_front/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue";
|
|
6
|
-
import EdgedCurvePointsOptions from "@ogw_front/components/Viewer/EdgedCurve/PointsOptions.vue";
|
|
7
|
-
|
|
8
|
-
// Surface components
|
|
9
|
-
import SurfaceEdgesOptions from "@ogw_front/components/Viewer/Surface/EdgesOptions.vue";
|
|
10
|
-
import SurfacePointsOptions from "@ogw_front/components/Viewer/Surface/PointsOptions.vue";
|
|
11
|
-
import SurfacePolygonsOptions from "@ogw_front/components/Viewer/Surface/PolygonsOptions.vue";
|
|
12
|
-
|
|
13
|
-
// TriangulatedSurface components
|
|
14
|
-
import TriangulatedSurfaceTrianglesOptions from "@ogw_front/components/Viewer/Surface/Triangulated/TrianglesOptions.vue";
|
|
15
|
-
|
|
16
|
-
// Grid 2D components
|
|
17
|
-
import Grid2DCellsOptions from "@ogw_front/components/Viewer/Grid/2D/CellsOptions.vue";
|
|
18
|
-
import Grid2DEdgesOptions from "@ogw_front/components/Viewer/Grid/2D/EdgesOptions.vue";
|
|
19
|
-
import Grid2DPointsOptions from "@ogw_front/components/Viewer/Grid/2D/PointsOptions.vue";
|
|
20
|
-
|
|
21
|
-
// Grid 3D components
|
|
22
|
-
import Grid3DCellsOptions from "@ogw_front/components/Viewer/Grid/3D/CellsOptions.vue";
|
|
23
|
-
import Grid3DEdgesOptions from "@ogw_front/components/Viewer/Grid/3D/EdgesOptions.vue";
|
|
24
|
-
import Grid3DPointsOptions from "@ogw_front/components/Viewer/Grid/3D/PointsOptions.vue";
|
|
25
|
-
|
|
26
|
-
// Solid components
|
|
27
|
-
import SolidEdgesOptions from "@ogw_front/components/Viewer/Solid/EdgesOptions.vue";
|
|
28
|
-
import SolidPointsOptions from "@ogw_front/components/Viewer/Solid/PointsOptions.vue";
|
|
29
|
-
import SolidPolygonsOptions from "@ogw_front/components/Viewer/Solid/PolygonsOptions.vue";
|
|
30
|
-
import SolidPolyhedraOptions from "@ogw_front/components/Viewer/Solid/SpecificPolyhedraOptions.vue";
|
|
31
|
-
|
|
32
|
-
// TetrahedralSolid components
|
|
33
|
-
import TetrahedralSolidTetrahedraOptions from "@ogw_front/components/Viewer/TetrahedralSolid/TetrahedraOptions.vue";
|
|
34
|
-
import TetrahedralSolidTrianglesOptions from "@ogw_front/components/Viewer/TetrahedralSolid/TrianglesOptions.vue";
|
|
35
|
-
|
|
36
|
-
// Model components
|
|
37
|
-
import ModelEdgesOptions from "@ogw_front/components/Viewer/Generic/Model/EdgesOptions.vue";
|
|
38
|
-
import ModelPointsOptions from "@ogw_front/components/Viewer/Generic/Model/PointsOptions.vue";
|
|
39
|
-
import ModelStyleOptions from "@ogw_front/components/Viewer/Generic/Model/ModelStyleOptions.vue";
|
|
40
|
-
|
|
41
|
-
import type { Component } from "vue";
|
|
42
|
-
|
|
43
|
-
type MenuItems = Component[];
|
|
1
|
+
import { type MenuItems, menusData } from "./menu_helpers/menus_data.js";
|
|
44
2
|
|
|
45
3
|
interface MenuMetaData {
|
|
46
4
|
viewer_type?: string;
|
|
@@ -60,87 +18,6 @@ interface OpenMenuOptions {
|
|
|
60
18
|
readonly meta_data: MenuMetaData | undefined;
|
|
61
19
|
}
|
|
62
20
|
|
|
63
|
-
const PointSet_menu = [PointSetPointsOptions];
|
|
64
|
-
|
|
65
|
-
const EdgedCurve_menu = [EdgedCurvePointsOptions, EdgedCurveEdgesOptions];
|
|
66
|
-
|
|
67
|
-
const PolygonalSurface_menu = [SurfacePointsOptions, SurfaceEdgesOptions, SurfacePolygonsOptions];
|
|
68
|
-
|
|
69
|
-
const TriangulatedSurface_menu = [
|
|
70
|
-
SurfacePointsOptions,
|
|
71
|
-
SurfaceEdgesOptions,
|
|
72
|
-
TriangulatedSurfaceTrianglesOptions,
|
|
73
|
-
];
|
|
74
|
-
|
|
75
|
-
const Grid2D_menu = [Grid2DPointsOptions, Grid2DEdgesOptions, Grid2DCellsOptions];
|
|
76
|
-
const Grid3D_menu = [
|
|
77
|
-
Grid3DPointsOptions,
|
|
78
|
-
Grid3DEdgesOptions,
|
|
79
|
-
// Grid3DFacetsOptions,
|
|
80
|
-
Grid3DCellsOptions,
|
|
81
|
-
];
|
|
82
|
-
|
|
83
|
-
const Solid_menu = [
|
|
84
|
-
SolidPointsOptions,
|
|
85
|
-
SolidEdgesOptions,
|
|
86
|
-
SolidPolygonsOptions,
|
|
87
|
-
SolidPolyhedraOptions,
|
|
88
|
-
];
|
|
89
|
-
|
|
90
|
-
const TetrahedralSolid_menu = [
|
|
91
|
-
SolidPointsOptions,
|
|
92
|
-
SolidEdgesOptions,
|
|
93
|
-
TetrahedralSolidTrianglesOptions,
|
|
94
|
-
TetrahedralSolidTetrahedraOptions,
|
|
95
|
-
];
|
|
96
|
-
|
|
97
|
-
const BRep_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
|
|
98
|
-
|
|
99
|
-
const CrossSection_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
|
|
100
|
-
|
|
101
|
-
const ImplicitCrossSection_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
|
|
102
|
-
const ImplicitStructuralModel_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
|
|
103
|
-
|
|
104
|
-
const Section_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
|
|
105
|
-
|
|
106
|
-
const StructuralModel_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
|
|
107
|
-
|
|
108
|
-
const ModelComponent_menu = [ModelEdgesOptions, ModelPointsOptions, ModelStyleOptions];
|
|
109
|
-
|
|
110
|
-
const menusData: Record<string, Record<string, MenuItems>> = {
|
|
111
|
-
mesh: {
|
|
112
|
-
EdgedCurve2D: EdgedCurve_menu,
|
|
113
|
-
EdgedCurve3D: EdgedCurve_menu,
|
|
114
|
-
HybridSolid3D: Solid_menu,
|
|
115
|
-
LightRegularGrid2D: Grid2D_menu,
|
|
116
|
-
LightRegularGrid3D: Grid3D_menu,
|
|
117
|
-
PointSet2D: PointSet_menu,
|
|
118
|
-
PointSet3D: PointSet_menu,
|
|
119
|
-
PolygonalSurface2D: PolygonalSurface_menu,
|
|
120
|
-
PolygonalSurface3D: PolygonalSurface_menu,
|
|
121
|
-
PolyhedralSolid3D: Solid_menu,
|
|
122
|
-
RegularGrid2D: Grid2D_menu,
|
|
123
|
-
RegularGrid3D: Grid3D_menu,
|
|
124
|
-
TetrahedralSolid3D: TetrahedralSolid_menu,
|
|
125
|
-
TriangulatedSurface2D: TriangulatedSurface_menu,
|
|
126
|
-
TriangulatedSurface3D: TriangulatedSurface_menu,
|
|
127
|
-
},
|
|
128
|
-
model: {
|
|
129
|
-
BRep: BRep_menu,
|
|
130
|
-
CrossSection: CrossSection_menu,
|
|
131
|
-
ImplicitCrossSection: ImplicitCrossSection_menu,
|
|
132
|
-
ImplicitStructuralModel: ImplicitStructuralModel_menu,
|
|
133
|
-
Section: Section_menu,
|
|
134
|
-
StructuralModel: StructuralModel_menu,
|
|
135
|
-
},
|
|
136
|
-
model_component_type: {
|
|
137
|
-
type: ModelComponent_menu,
|
|
138
|
-
},
|
|
139
|
-
model_component: {
|
|
140
|
-
component: ModelComponent_menu,
|
|
141
|
-
},
|
|
142
|
-
};
|
|
143
|
-
|
|
144
21
|
export const useMenuStore = defineStore("menu", () => {
|
|
145
22
|
const menus = shallowRef(menusData);
|
|
146
23
|
const display_menu = ref(false);
|