12
12
@mouseleave =" handleEntryMouseLeave(entry)"
13
13
:data-hover-menu-spawner-extend =" entry.children && []"
14
14
>
15
- <IconLabel :icon =" entry.icon" v-if =" entry.icon && drawIcon" />
16
- <div class =" no-icon" v-else-if =" drawIcon" />
15
+ <CheckboxInput v-if =" entry.checkbox" v-model:checked =" entry.checked" :outlineStyle =" true" :class =" 'entry-checkbox'" />
16
+ <IconLabel v-else-if =" entry.icon && drawIcon" :icon =" entry.icon" :class =" 'entry-icon'" />
17
+ <div v-else-if =" drawIcon" class =" no-icon" />
18
+
17
19
<span class =" entry-label" >{{ entry.label }}</span >
18
- <IconLabel :icon =" 'Info'" v-if =" entry.shortcutRequiresLock && !fullscreen.keyboardLocked" :title =" keyboardLockInfoMessage" />
20
+
21
+ <IconLabel v-if =" entry.shortcutRequiresLock && !fullscreen.keyboardLocked" :icon =" 'Info'" :title =" keyboardLockInfoMessage" />
19
22
<UserInputLabel v-else-if =" entry.shortcut && entry.shortcut.length" :inputKeys =" [entry.shortcut]" />
23
+
20
24
<div class =" submenu-arrow" v-if =" entry.children && entry.children.length" ></div >
21
25
<div class =" no-submenu-arrow" v-else ></div >
26
+
22
27
<MenuList
23
28
v-if =" entry.children"
24
29
:direction =" MenuDirection.TopRight"
50
55
flex : 0 0 auto ;
51
56
}
52
57
53
- .icon-label svg {
58
+ .entry-icon svg {
54
59
fill : var (--color-e-nearwhite );
55
60
}
56
61
63
68
margin-left : 8px ;
64
69
}
65
70
66
- .icon-label ,
71
+ .entry-checkbox ,
72
+ .entry-icon ,
67
73
.no-icon {
68
74
margin : 0 4px ;
69
75
112
118
color : var (--color-f-white );
113
119
}
114
120
}
121
+
122
+ & :hover .entry-checkbox label .checkbox-box {
123
+ border : 1px solid var (--color-f-white );
124
+
125
+ svg {
126
+ fill : var (--color-f-white );
127
+ }
128
+ }
115
129
}
116
130
}
117
131
}
@@ -125,6 +139,7 @@ import { SeparatorDirection, SeparatorType } from "@/components/widgets/widgets"
125
139
import FloatingMenu , { MenuDirection , MenuType } from " @/components/widgets/floating-menus/FloatingMenu.vue" ;
126
140
import Separator from " @/components/widgets/separators/Separator.vue" ;
127
141
import IconLabel from " @/components/widgets/labels/IconLabel.vue" ;
142
+ import CheckboxInput from " @/components/widgets/inputs/CheckboxInput.vue" ;
128
143
import UserInputLabel from " @/components/widgets/labels/UserInputLabel.vue" ;
129
144
130
145
export type MenuListEntries = Array <MenuListEntry >;
@@ -134,14 +149,14 @@ interface MenuListEntryData {
134
149
value? : string ;
135
150
label? : string ;
136
151
icon? : string ;
137
- // TODO: Add `checkbox` (which overrides any `icon`)
152
+ checkbox ? : boolean ;
138
153
shortcut? : Array <string >;
139
154
shortcutRequiresLock? : boolean ;
140
155
action? : Function ;
141
156
children? : SectionsOfMenuListEntries ;
142
157
}
143
158
144
- export type MenuListEntry = MenuListEntryData & { ref? : typeof FloatingMenu | typeof MenuList };
159
+ export type MenuListEntry = MenuListEntryData & { ref? : typeof FloatingMenu | typeof MenuList ; checked ? : boolean };
145
160
146
161
const KEYBOARD_LOCK_USE_FULLSCREEN = " This hotkey is reserved by the browser, but becomes available in fullscreen mode" ;
147
162
const KEYBOARD_LOCK_SWITCH_BROWSER = " This hotkey is reserved by the browser, but becomes available in Chrome, Edge, and Opera which support the Keyboard.lock() API" ;
@@ -164,6 +179,8 @@ const MenuList = defineComponent({
164
179
handleEntryClick(menuEntry : MenuListEntry ) {
165
180
(this .$refs .floatingMenu as typeof FloatingMenu ).setClosed ();
166
181
182
+ if (menuEntry .checkbox ) menuEntry .checked = ! menuEntry .checked ;
183
+
167
184
if (menuEntry .action ) menuEntry .action ();
168
185
else if (this .defaultAction ) this .defaultAction ();
169
186
else this .$emit (" update:activeEntry" , menuEntry );
@@ -259,6 +276,7 @@ const MenuList = defineComponent({
259
276
FloatingMenu ,
260
277
Separator ,
261
278
IconLabel ,
279
+ CheckboxInput ,
262
280
UserInputLabel ,
263
281
},
264
282
});
0 commit comments