-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'pu/sd/personasInModals' into '2024.11'
Personas in modals. See merge request tine20/tine20!4576
- Loading branch information
Showing
12 changed files
with
223 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
tine20/Tinebase/js/ux/vue/PersonaContainer/PersonaContainer.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<!-- | ||
/* | ||
* Tine 2.0 | ||
* | ||
* @license http://www.gnu.org/licenses/agpl.html AGPL Version 3 | ||
* @author Sohan Deshar <s.deshar@metaways.de> | ||
* @copyright Copyright (c) 2022-2023 Metaways Infosystems GmbH (http://www.metaways.de) | ||
*/ | ||
--> | ||
<template> | ||
<div v-html="rawSvg" class="dark-reverse vue-msg-box-svg-container" :style="`--skin-color: ${skinColor}`"></div> | ||
</template> | ||
|
||
<script setup> | ||
import { onBeforeMount, ref } from 'vue' | ||
|
||
import getIconPath from './helpers' | ||
|
||
const props = defineProps({ | ||
iconName: { | ||
type: String, | ||
required: true | ||
}, | ||
skinColor: { | ||
type: String, | ||
required: false | ||
} | ||
}) | ||
|
||
const rawSvg = ref(null) | ||
const skinColor = ref(null) | ||
|
||
const skinShades = ['#ffffff', '#fad9b4', '#fcbf89', '#ec8f2e', '#d97103', '#b75b01', '#924500'] | ||
const init = async function () { | ||
const { default: img } = await import(/* webpackChunkName: "Tinebase/js/[request]" */`images/dialog-personas/${getIconPath(props.iconName)}.svg`) | ||
skinColor.value = props.skinColor ? props.skinColor : skinShades[Math.floor(Math.random() * skinShades.length)] | ||
rawSvg.value = window.atob(img.split(',')[1]) | ||
} | ||
|
||
onBeforeMount(async () => { | ||
await init() | ||
}) | ||
</script> | ||
|
||
<style lang="scss"> | ||
.vue-msg-box-svg-container { | ||
svg{ | ||
height: 100%; | ||
width: auto; | ||
} | ||
.skin { | ||
fill: var(--skin-color) !important; | ||
} | ||
} | ||
</style> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
Ext.ns("Tine.ux.vue") | ||
Ext.ns("Tine.personas") | ||
|
||
export const Personas = Object.freeze({ | ||
INFO : 'info_default', | ||
INFO_INSTRUCTION: 'info_instruction', | ||
INFO_FAILURE: 'info_failure', | ||
INFO_SUCCESS: 'info_success', | ||
INFO_WAIT: 'info_wait', | ||
|
||
WARNING : 'warning', | ||
|
||
QUESTION : 'question_default', | ||
QUESTION_INPUT: 'question_input', | ||
QUESTION_OPTION: 'question_option', | ||
QUESTION_CONFIRM: 'question_confirm', | ||
QUESTION_WARN: 'question_warn', | ||
|
||
ERROR : 'error_default', | ||
ERROR_MILD: 'error_mild', | ||
ERROR_SEVERE: 'error_severe', | ||
}) | ||
|
||
export const PersonaContainer = Ext.extend(Ext.BoxComponent, { | ||
width: 100, | ||
height: 200, | ||
persona: Personas.INFO, | ||
|
||
onRender: async function (ct, position){ | ||
Ext.BoxComponent.superclass.onRender.call(this, ct, position) | ||
window.vue = window.vue || await import(/* webpackChunkName: "Tinebase/js/Vue-Runtime" */"tine-vue") | ||
const { default: PersonaContainer } = await import("./PersonaContainer.vue") | ||
this.app = vue.createApp( | ||
PersonaContainer, | ||
{ | ||
iconName: this.initialConfig.persona, | ||
skinColor: this.initialConfig.skinColor | ||
}) | ||
this.app.mount(`#${this.id}`) | ||
}, | ||
}) | ||
|
||
Tine.personas = Personas | ||
Tine.ux.vue.PersonaContainer = PersonaContainer | ||
Ext.reg('vpersona', Tine.ux.vue.PersonaContainer) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.