Skip to content

Make Collapse/Expand All affects child elements #715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ selenium-debug.log
TODOs.md
.idea
.web-extension-id
yarn-error.log
19 changes: 19 additions & 0 deletions src/devtools/components/DataField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
:editable="isEditable"
:removable="isSubfieldsEditable"
:renamable="editable && valueType === 'plain-object'"
:force-collapse="forceCollapse"
/>
<span
v-if="formattedSubFields.length > limit"
Expand All @@ -197,6 +198,7 @@
:depth="depth + 1"
:path="`${path}.${newField.key}`"
:renamable="valueType === 'plain-object'"
:force-collapse="forceCollapse"
editable
removable
@cancel-edit="addingValue = false"
Expand Down Expand Up @@ -255,6 +257,10 @@ export default {
path: {
type: String,
required: true
},
forceCollapse: {
type: String,
default: null
}
},

Expand Down Expand Up @@ -431,6 +437,19 @@ export default {
}
},

watch: {
forceCollapse: {
handler (value) {
if (value === 'expand' && this.depth < 4) {
this.expanded = true
} else if (value === 'collapse') {
this.expanded = false
}
},
immediate: true
}
},

methods: {
copyToClipboard () {
copyToClipboard(this.field.value)
Expand Down
12 changes: 11 additions & 1 deletion src/devtools/components/StateInspector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
:depth="0"
:path="field.key"
:editable="field.editable"
:force-collapse="forceCollapse"
/>
</template>
<template v-else>
Expand Down Expand Up @@ -77,7 +78,8 @@ export default {

data () {
return {
expandedState: {}
expandedState: {},
forceCollapse: null
}
},

Expand All @@ -101,6 +103,12 @@ export default {
}
},

watch: {
state () {
this.forceCollapse = null
}
},

methods: {
toDisplayType (dataType, asClass) {
return dataType === 'undefined'
Expand Down Expand Up @@ -128,6 +136,7 @@ export default {

setExpandToAll (value) {
this.dataTypes.forEach(key => {
this.forceCollapse = value ? 'expand' : 'collapse'
Vue.set(this.expandedState, key, value)
})
}
Expand Down Expand Up @@ -166,6 +175,7 @@ export default {
display flex
align-items baseline
padding-left 9px
user-select none

.vue-ui-dark-mode &
color lighten(#486887, 30%)
Expand Down