@geode/opengeodeweb-front 10.43.1-rc.2 → 10.43.2-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.
@@ -148,6 +148,22 @@ function handleItemClick(
148
148
  }
149
149
  }
150
150
 
151
+ function selectAllLeaves(): void {
152
+ const leafIds = displayItems.value
153
+ .filter((rowItem) => rowItem.isLeaf)
154
+ .map((rowItem) => rowItem.raw[actualItemProps.value.value]);
155
+ emit("update:active", leafIds);
156
+ }
157
+
158
+ function clearActive(): boolean {
159
+ if (active.length === 0) {
160
+ return false;
161
+ }
162
+ lastActiveIndex.value = -1;
163
+ emit("update:active", []);
164
+ return true;
165
+ }
166
+
151
167
  const { handleKeyDown } = useTreeKeyboardNav(
152
168
  displayItems,
153
169
  emit as EmitFn,
@@ -156,6 +172,8 @@ const { handleKeyDown } = useTreeKeyboardNav(
156
172
  handleItemClick,
157
173
  getScrollInfo,
158
174
  focusedIndex,
175
+ selectAllLeaves,
176
+ clearActive,
159
177
  );
160
178
  </script>
161
179
 
@@ -17,6 +17,8 @@ type ReadonlyDisplayItem = Omit<DisplayItem, "raw"> & {
17
17
 
18
18
  interface KeyboardEventLike {
19
19
  readonly key: string;
20
+ readonly ctrlKey: boolean;
21
+ readonly metaKey: boolean;
20
22
  preventDefault: () => void;
21
23
  }
22
24
 
@@ -56,6 +58,8 @@ export function useTreeKeyboardNav(
56
58
  handleItemClick: (item: ReadonlyDisplayItem, index: number) => void,
57
59
  getScrollInfo: (() => ScrollInfo | undefined) | undefined,
58
60
  externalFocusedIndex: Ref<number> | undefined,
61
+ selectAll: () => void,
62
+ clearActive: () => boolean,
59
63
  ): UseTreeKeyboardNavReturn {
60
64
  const focusedIndex = externalFocusedIndex ?? ref(-1);
61
65
 
@@ -143,8 +147,21 @@ export function useTreeKeyboardNav(
143
147
  return currentIndex;
144
148
  }
145
149
 
150
+ function handleSelectionShortcut(event: KeyboardEventLike): boolean {
151
+ if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === "a") {
152
+ event.preventDefault();
153
+ selectAll();
154
+ return true;
155
+ }
156
+ if (event.key === "Escape" && clearActive()) {
157
+ event.preventDefault();
158
+ return true;
159
+ }
160
+ return false;
161
+ }
162
+
146
163
  function handleKeyDown(event: KeyboardEventLike): void {
147
- if (displayItems.value.length === 0) {
164
+ if (handleSelectionShortcut(event) || displayItems.value.length === 0) {
148
165
  return;
149
166
  }
150
167
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geode/opengeodeweb-front",
3
- "version": "10.43.1-rc.2",
3
+ "version": "10.43.2-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": {