Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

Fixed: Tree window in Mobile mode #847

Merged
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
55 changes: 37 additions & 18 deletions components/ADempiere/PanelDefinition/TreePanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<template>
<el-row class="tree-panel-definition" :gutter="10">
<el-col :span="6" class="tree-col" style="height: 100%;">
<el-col :span="isMobile ? 24 : 6" class="tree-col" style="height: 100%;">
<div class="tree-panel-container">
<el-input
v-model="filterValue"
Expand All @@ -45,7 +45,7 @@
</div>
</el-col>

<el-col class="tree-col-standard-panel" :span="18">
<el-col class="tree-col-standard-panel" :span="isMobile ? 24 : 18">
<draggable-panel
v-if="panelMetadata.isEditSecuence"
:parent-uuid="parentUuid"
Expand Down Expand Up @@ -119,9 +119,27 @@ export default defineComponent({
},

setup(props) {
/**
* Ref
*/
const treePanel = ref(null)
const filterValue = ref('')

/**
* Const
*/
const nodeName = 'name'
const defaultProps = {
children: 'childs',
label: nodeName
}

/**
* Computed Properties
*/
const isMobile = computed(() => {
return store.getters.device === 'mobile'
})

const storedTreeNodes = computed({
set(newNodes) {
Expand All @@ -134,11 +152,6 @@ export default defineComponent({
}
})

const defaultProps = {
children: 'childs',
label: nodeName
}

const recordUuid = computed(() => {
return store.getters.getValueOfFieldOnContainer({
parentUuid: props.parentUuid,
Expand All @@ -162,6 +175,20 @@ export default defineComponent({
})
})

/**
* Get the panel object with all its attributes as well as
* the fields it contains
*/
const panelMetadata = computed(() => {
return props.containerManager.getPanel({
parentUuid: props.parentUuid,
containerUuid: props.containerUuid
}) || {}
})

/**
* Watch works directly on a ref
*/
watch(filterValue, (newValue, oldValue) => {
treePanel.value.filter(newValue)
})
Expand All @@ -183,16 +210,8 @@ export default defineComponent({
})

/**
* Get the panel object with all its attributes as well as
* the fields it contains
* Methods
*/
const panelMetadata = computed(() => {
return props.containerManager.getPanel({
parentUuid: props.parentUuid,
containerUuid: props.containerUuid
}) || {}
})

function handleNodeClick(nodeData) {
setRecord(nodeData.record_uuid)
}
Expand Down Expand Up @@ -320,7 +339,6 @@ export default defineComponent({
return data[nodeName].toLowerCase().indexOf(value.toLowerCase()) !== -1
}

// loadData()
setTimeout(() => {
treePanel.value.setCurrentKey(recordUuid.value)
}, 500)
Expand All @@ -331,10 +349,11 @@ export default defineComponent({
defaultProps,
storedTreeNodes,
// computeds
isMobile,
elementId,
recordUuid,
expandedTree,
panelMetadata,
recordUuid,
// methods
handleNodeClick,
handleDragEnd,
Expand Down