Skip to content

Commit

Permalink
feat: Make Collapse/Expand All affects child elements (#715)
Browse files Browse the repository at this point in the history
* make Collapse All and Expand All affect child elements

* ignore yarn-error.log

* fix: put a depth limit on expand all

* fix: reset forceCollapse when changing target

* fix: user select none on data type
  • Loading branch information
hootlex authored and Akryum committed Jul 31, 2018
1 parent a3c9db3 commit 8477e94
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
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 @@ -164,6 +173,7 @@ export default {
display flex
align-items baseline
padding-left 9px
user-select none
.vue-ui-dark-mode &
color lighten(#486887, 30%)
Expand Down

0 comments on commit 8477e94

Please sign in to comment.