Skip to content

Commit

Permalink
Merge pull request #181 from lcnetdev/hide-from-action-button
Browse files Browse the repository at this point in the history
Hide from action button
  • Loading branch information
f-osorio authored Jan 16, 2025
2 parents 307ca16 + 63ad82b commit 5bf5d59
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
20 changes: 19 additions & 1 deletion src/components/panels/edit/fields/helpers/ActionButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@
</button>
</template>

<template v-if="showHideElementButton()">
<button style="width:100%" :id="`action-button-command-${fieldGuid}-0`" class="" @click="hideElement()">
<span class="">🙈</span>Hide Element
</button>
</template>

<button style="width:100%" :id="`action-button-command-${fieldGuid}-0`" class="" @click="showDebug()">
<span class="button-shortcut-label">0</span>
Debug
Expand Down Expand Up @@ -229,7 +235,7 @@
...mapWritableState(usePreferenceStore, ['debugModalData','showDebugModal']),
...mapWritableState(useProfileStore, ['showAutoDeweyModal', 'deweyData']),
...mapWritableState(useProfileStore, ['showAutoDeweyModal', 'deweyData', 'emptyComponents']),
scriptShifterOptionsForMenu(){
Expand Down Expand Up @@ -842,6 +848,18 @@
this.profileStore.deleteComponent(this.guid)
},
showHideElementButton: function(){
let component = this.profileStore.returnStructureByComponentGuid(this.guid)
let empty = this.profileStore.isEmptyComponent(component)
return empty
},
// Hide empty element in ad hoc mode
hideElement: function(){
let structure = this.profileStore.returnStructureByComponentGuid(this.guid)
this.emptyComponents[structure.parentId].push(structure.id)
},
},
watch: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/nav/Nav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
)
}
if(this.$route.path.startsWith('/edit/')){
if(this.$route.path.startsWith('/edit/') && this.preferenceStore.returnValue('--c-general-ad-hoc')){
for (let sub in menu){
if (menu[sub].text == 'Tools'){
menu[sub].menu.push(
Expand Down
2 changes: 1 addition & 1 deletion src/stores/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const useConfigStore = defineStore('config', {

versionMajor: 0,
versionMinor: 17,
versionPatch: 17,
versionPatch: 18,

regionUrls: {

Expand Down
2 changes: 2 additions & 0 deletions src/stores/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4538,13 +4538,15 @@ export const useProfileStore = defineStore('profile', {

//Check if the component's userValue is empty
isEmptyComponent: function(c){
console.info("isEmpty? ", c)
const component = c
const emptyArray = new Array("@root")
const userValue = JSON.parse(JSON.stringify(component["userValue"]))


// if there is only a @root
if (JSON.stringify(Object.keys(component.userValue)) == JSON.stringify(emptyArray)){
console.info("only has root")
return true
} else {
// if the children only have "@..." properties
Expand Down

0 comments on commit 5bf5d59

Please sign in to comment.