@geode/opengeodeweb-front 10.14.0 → 10.14.1-rc.1
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.
|
@@ -31,8 +31,15 @@ const {
|
|
|
31
31
|
availableFilterOptions,
|
|
32
32
|
toggleSort,
|
|
33
33
|
customFilter,
|
|
34
|
+
applySearchFilter,
|
|
34
35
|
} = useTreeFilter(toRef(() => treeviewStore.items));
|
|
35
36
|
|
|
37
|
+
function onUpdateSelection(val) {
|
|
38
|
+
treeviewStore.selection = applySearchFilter(val, treeviewStore.selection);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const visibleSelection = computed(() => applySearchFilter(treeviewStore.selection, []));
|
|
42
|
+
|
|
36
43
|
watch(
|
|
37
44
|
() => treeviewStore.selection,
|
|
38
45
|
async (current, previous) => {
|
|
@@ -94,7 +101,7 @@ function handleHoverLeave(item) {
|
|
|
94
101
|
/>
|
|
95
102
|
|
|
96
103
|
<v-treeview
|
|
97
|
-
|
|
104
|
+
:selected="visibleSelection"
|
|
98
105
|
v-model:opened="opened"
|
|
99
106
|
:items="processedItems"
|
|
100
107
|
:search="search"
|
|
@@ -104,6 +111,7 @@ function handleHoverLeave(item) {
|
|
|
104
111
|
select-strategy="classic"
|
|
105
112
|
selectable
|
|
106
113
|
items-registration="props"
|
|
114
|
+
@update:selected="onUpdateSelection"
|
|
107
115
|
>
|
|
108
116
|
<template #title="{ item }">
|
|
109
117
|
<ObjectTreeItemLabel
|
|
@@ -36,9 +36,11 @@ const {
|
|
|
36
36
|
availableFilterOptions,
|
|
37
37
|
toggleSort,
|
|
38
38
|
customFilter,
|
|
39
|
+
applySearchFilter,
|
|
39
40
|
} = useTreeFilter(items);
|
|
40
41
|
|
|
41
|
-
async function onSelectionChange(
|
|
42
|
+
async function onSelectionChange(newSelection) {
|
|
43
|
+
const current = applySearchFilter(newSelection, mesh_components_selection.value);
|
|
42
44
|
const previous = mesh_components_selection.value;
|
|
43
45
|
const { added, removed } = compareSelections(current, previous);
|
|
44
46
|
|
|
@@ -55,6 +57,8 @@ async function onSelectionChange(current) {
|
|
|
55
57
|
hybridViewerStore.remoteRender();
|
|
56
58
|
}
|
|
57
59
|
|
|
60
|
+
const visibleSelection = computed(() => applySearchFilter(mesh_components_selection.value, []));
|
|
61
|
+
|
|
58
62
|
function showContextMenu(event, item) {
|
|
59
63
|
const actualItem = item.raw || item;
|
|
60
64
|
emit("show-menu", {
|
|
@@ -93,14 +97,14 @@ function handleHoverLeave() {
|
|
|
93
97
|
|
|
94
98
|
<v-treeview
|
|
95
99
|
v-else
|
|
96
|
-
:selected="
|
|
100
|
+
:selected="visibleSelection"
|
|
97
101
|
v-model:opened="opened"
|
|
98
102
|
:items="processedItems"
|
|
99
103
|
:search="search"
|
|
100
104
|
:custom-filter="customFilter"
|
|
101
105
|
class="transparent-treeview"
|
|
102
106
|
item-value="id"
|
|
103
|
-
select-strategy="
|
|
107
|
+
select-strategy="classic"
|
|
104
108
|
selectable
|
|
105
109
|
items-registration="props"
|
|
106
110
|
@update:selected="onSelectionChange"
|
|
@@ -3,9 +3,8 @@ function customFilter(value, searchQuery, item) {
|
|
|
3
3
|
return true;
|
|
4
4
|
}
|
|
5
5
|
const query = searchQuery.toLowerCase();
|
|
6
|
-
const title =
|
|
7
|
-
|
|
8
|
-
return title.includes(query) || idValue.includes(query);
|
|
6
|
+
const { title = "", id = value } = item.raw || {};
|
|
7
|
+
return [title, id].some((field) => String(field).toLowerCase().includes(query));
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
function sortAndFormatItems(items, sortType) {
|
|
@@ -21,8 +20,6 @@ function sortAndFormatItems(items, sortType) {
|
|
|
21
20
|
});
|
|
22
21
|
return {
|
|
23
22
|
...category,
|
|
24
|
-
id: category.id,
|
|
25
|
-
title: category.title || category.id,
|
|
26
23
|
children,
|
|
27
24
|
};
|
|
28
25
|
});
|
|
@@ -56,19 +53,58 @@ function useTreeFilter(rawItems, options = {}) {
|
|
|
56
53
|
if (!rawItems.value) {
|
|
57
54
|
return [];
|
|
58
55
|
}
|
|
59
|
-
|
|
56
|
+
const sorted = sortAndFormatItems(
|
|
60
57
|
rawItems.value.filter((category) => {
|
|
61
58
|
const key = category.title || category.id;
|
|
62
59
|
return filterOptions.value[key] !== false;
|
|
63
60
|
}),
|
|
64
61
|
sortType.value,
|
|
65
62
|
);
|
|
63
|
+
if (!search.value) {
|
|
64
|
+
return sorted;
|
|
65
|
+
}
|
|
66
|
+
return sorted
|
|
67
|
+
.map((category) => {
|
|
68
|
+
category.children = (category.children || []).filter((child) =>
|
|
69
|
+
customFilter(child.id, search.value, { raw: child }),
|
|
70
|
+
);
|
|
71
|
+
return category;
|
|
72
|
+
})
|
|
73
|
+
.filter((category) => category.children.length > 0);
|
|
66
74
|
});
|
|
67
75
|
|
|
68
76
|
function toggleSort() {
|
|
69
77
|
sortType.value = sortType.value === "name" ? "id" : "name";
|
|
70
78
|
}
|
|
71
79
|
|
|
80
|
+
const allItems = computed(() => {
|
|
81
|
+
const map = new Map();
|
|
82
|
+
function traverse(items) {
|
|
83
|
+
for (const item of items) {
|
|
84
|
+
map.set(item.id, item);
|
|
85
|
+
if (item.children) {
|
|
86
|
+
traverse(item.children);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
traverse(rawItems.value || []);
|
|
91
|
+
return map;
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
function applySearchFilter(newSelection, previousSelection = []) {
|
|
95
|
+
if (!search.value) {
|
|
96
|
+
return newSelection;
|
|
97
|
+
}
|
|
98
|
+
const allItemsMap = allItems.value;
|
|
99
|
+
function matches(id) {
|
|
100
|
+
const item = allItemsMap.get(id);
|
|
101
|
+
return item && customFilter(id, search.value, { raw: item });
|
|
102
|
+
}
|
|
103
|
+
const hidden = previousSelection.filter((id) => !matches(id));
|
|
104
|
+
const visible = newSelection.filter((id) => matches(id));
|
|
105
|
+
return [...new Set([...hidden, ...visible])];
|
|
106
|
+
}
|
|
107
|
+
|
|
72
108
|
return {
|
|
73
109
|
search,
|
|
74
110
|
sortType,
|
|
@@ -77,6 +113,7 @@ function useTreeFilter(rawItems, options = {}) {
|
|
|
77
113
|
availableFilterOptions,
|
|
78
114
|
toggleSort,
|
|
79
115
|
customFilter,
|
|
116
|
+
applySearchFilter,
|
|
80
117
|
};
|
|
81
118
|
}
|
|
82
119
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geode/opengeodeweb-front",
|
|
3
|
-
"version": "10.14.
|
|
3
|
+
"version": "10.14.1-rc.1",
|
|
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": {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"build": ""
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@geode/opengeodeweb-back": "
|
|
38
|
-
"@geode/opengeodeweb-viewer": "
|
|
37
|
+
"@geode/opengeodeweb-back": "next",
|
|
38
|
+
"@geode/opengeodeweb-viewer": "next",
|
|
39
39
|
"@google-cloud/run": "3.2.0",
|
|
40
40
|
"@kitware/vtk.js": "33.3.0",
|
|
41
41
|
"@mdi/font": "7.4.47",
|