File tree Expand file tree Collapse file tree 2 files changed +22
-7
lines changed
packages/app-frontend/src/features/components Expand file tree Collapse file tree 2 files changed +22
-7
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,14 @@ export default defineComponent({
140
140
}
141
141
}
142
142
143
+ function switchToggle (event ) {
144
+ if (event .altKey ) {
145
+ toggle (true , ! expanded .value )
146
+ } else {
147
+ toggle ()
148
+ }
149
+ }
150
+
143
151
return {
144
152
toggleEl ,
145
153
sortedChildren ,
@@ -148,7 +156,7 @@ export default defineComponent({
148
156
selected ,
149
157
select ,
150
158
expanded ,
151
- toggle ,
159
+ switchToggle ,
152
160
highlight ,
153
161
unhighlight ,
154
162
selectNextSibling ,
@@ -180,7 +188,7 @@ export default defineComponent({
180
188
:class =" {
181
189
'invisible': !instance.hasChildren
182
190
}"
183
- @click.stop =" toggle() "
191
+ @click.stop =" switchToggle "
184
192
>
185
193
<span
186
194
:class =" {
Original file line number Diff line number Diff line change @@ -136,11 +136,18 @@ export function useComponent (instance: Ref<ComponentTreeNode>) {
136
136
const isExpanded = computed ( ( ) => isComponentOpen ( instance . value . id ) )
137
137
const isExpandedUndefined = computed ( ( ) => expandedMap . value [ instance . value . id ] == null )
138
138
139
- function toggleExpand ( ) {
140
- if ( ! instance . value . hasChildren ) return
141
- setComponentOpen ( instance . value . id , ! isExpanded . value )
142
- if ( isComponentOpen ( instance . value . id ) ) {
143
- requestComponentTree ( instance . value . id )
139
+ function toggleExpand ( recursively = false , value ?, child ?) {
140
+ const treeNode = child || instance . value
141
+ if ( ! treeNode . hasChildren ) return
142
+ const isOpen = value === undefined ? ! isExpanded . value : value
143
+ setComponentOpen ( treeNode . id , isOpen )
144
+ if ( isComponentOpen ( treeNode . id ) ) {
145
+ requestComponentTree ( treeNode . id )
146
+ }
147
+ if ( recursively ) {
148
+ treeNode . children . forEach ( child => {
149
+ toggleExpand ( recursively , value , child )
150
+ } )
144
151
}
145
152
}
146
153
You can’t perform that action at this time.
0 commit comments