From a91d027920dc4c6a19aa25173cad29ae9eb55ad2 Mon Sep 17 00:00:00 2001 From: Elsio Sanchez <45974454+elsiosanchez@users.noreply.github.com> Date: Wed, 7 Apr 2021 11:35:31 -0400 Subject: [PATCH] add context menu field mode mobile (#705) * add context menu field mode mobile * minimal change * minimal changes * minimal changes * minimal changes * style button * change style Co-authored-by: Elsio Sanchez --- .../ContextMenu/contextMenuDesktop.vue | 416 ++++++++++++------ .../ADempiere/ContextMenu/index.vue | 10 + .../calculator/buttons.js | 0 .../calculator/index.vue | 201 +++++---- .../contextInfo/index.vue} | 61 +-- .../preference/index.vue | 179 ++++---- .../preference/preferenceFields.js | 0 .../translated/index.vue} | 109 +++-- src/components/ADempiere/Field/index.vue | 239 ++++++++-- src/components/ADempiere/RightPanel/index.vue | 32 +- src/components/RightPanel/index.vue | 2 +- src/lang/ADempiere/en.js | 17 +- src/lang/ADempiere/es.js | 17 +- src/layout/components/Settings/index.vue | 100 ++--- src/store/modules/ADempiere/contextMenu.js | 14 + src/views/ADempiere/Window/index.vue | 11 + .../ADempiere/Window/windowLogicComponent.js | 27 ++ src/views/profile/index.vue | 28 +- 18 files changed, 939 insertions(+), 524 deletions(-) rename src/components/ADempiere/Field/{popover => contextMenuField}/calculator/buttons.js (100%) rename src/components/ADempiere/Field/{popover => contextMenuField}/calculator/index.vue (59%) rename src/components/ADempiere/Field/{popover/contextInfo.vue => contextMenuField/contextInfo/index.vue} (55%) rename src/components/ADempiere/Field/{popover => contextMenuField}/preference/index.vue (72%) rename src/components/ADempiere/Field/{popover => contextMenuField}/preference/preferenceFields.js (100%) rename src/components/ADempiere/Field/{popover/translated.vue => contextMenuField/translated/index.vue} (65%) diff --git a/src/components/ADempiere/ContextMenu/contextMenuDesktop.vue b/src/components/ADempiere/ContextMenu/contextMenuDesktop.vue index dfc655cc..5a985461 100644 --- a/src/components/ADempiere/ContextMenu/contextMenuDesktop.vue +++ b/src/components/ADempiere/ContextMenu/contextMenuDesktop.vue @@ -1,131 +1,125 @@ @@ -133,9 +127,181 @@ import contextMixin from './contextMenuMixin.js' export default { - name: 'ContextMenuDesktop', + name: 'ContextMenuMobile', mixins: [ contextMixin - ] + ], + data() { + return { + openedsMenu: [ + 'actions' + ] + } + }, + computed: { + isPanelTypeMobile() { + if (['process', 'report'].includes(this.$route.meta.type)) { + return true + } + return false + }, + isUndoAction() { + if (this.isWindow) { + if (!this.isWithRecord) { + return true + } + } + return false + }, + typeOfAction() { + if (this.isUndoAction) { + return 'warning' + } + return 'default' + }, + isPlain() { + if (this.isUndoAction) { + return true + } + return false + }, + defaultActionToRun() { + if (this.isUndoAction) { + return this.actions[2] + } + return this.actions[0] + }, + defaultActionName() { + if (this.isWindow) { + if (this.isWithRecord) { + return this.$t('window.newRecord') + } + return this.$t('data.undo') + } + return this.$t('components.RunProcess') + }, + iconDefault() { + if (this.isPanelTypeMobile) { + return 'component' + } + return 'skill' + } + }, + methods: { + clickRelation(item) { + this.$router.push({ + name: item.name, + query: { + tabParent: 0 + } + }, () => {}) + }, + clickRunAction(action) { + if (action === 'refreshData') { + this.refreshData() + } else { + this.runAction(action) + } + }, + clickReferences(reference) { + this.openReference(reference) + }, + iconAction(action) { + let icon + if (action.type === 'dataAction') { + switch (action.action) { + case 'setDefaultValues': + icon = 'el-icon-news' + break + case 'deleteEntity': + icon = 'el-icon-delete' + break + case 'undoModifyData': + icon = 'el-icon-refresh-left' + break + case 'lockRecord': + icon = 'el-icon-lock' + break + case 'unlockRecord': + icon = 'el-icon-unlock' + break + case 'recordAccess': + icon = 'el-icon-c-scale-to-original' + break + } + } else if (action.type === 'process') { + icon = 'el-icon-setting' + } else { + icon = 'el-icon-setting' + } + return icon + }, + styleLabelAction(value) { + if (value) { + return 'font-size: 14px;margin-top: 0% !important;margin-left: 0px;margin-bottom: 10%;display: contents;' + } else { + return 'font-size: 14px;margin-top: 1.5% !important;margin-left: 2%;margin-bottom: 5%;display: contents;' + } + } + } } + + diff --git a/src/components/ADempiere/ContextMenu/index.vue b/src/components/ADempiere/ContextMenu/index.vue index d6de5b1e..1bb1416c 100644 --- a/src/components/ADempiere/ContextMenu/index.vue +++ b/src/components/ADempiere/ContextMenu/index.vue @@ -77,6 +77,16 @@ export default { diff --git a/src/components/RightPanel/index.vue b/src/components/RightPanel/index.vue index 8def6d47..9367a549 100644 --- a/src/components/RightPanel/index.vue +++ b/src/components/RightPanel/index.vue @@ -1,5 +1,5 @@