|
|
|
@ -1,32 +1,60 @@
|
|
|
|
|
<script> |
|
|
|
|
<script lang="ts" setup> |
|
|
|
|
import { useToast } from 'vue-toastification' |
|
|
|
|
|
|
|
|
|
interface Props { |
|
|
|
|
modelValue?: LockType |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const props = defineProps<Props>() |
|
|
|
|
|
|
|
|
|
const emits = defineEmits(['update:modelValue']) |
|
|
|
|
|
|
|
|
|
enum LockType { |
|
|
|
|
Personal = 'personal', |
|
|
|
|
Locked = 'locked', |
|
|
|
|
Collaborative = 'collaborative', |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const vModel = useVModel(props, 'modelValue', emits) |
|
|
|
|
|
|
|
|
|
const { $e } = useNuxtApp() |
|
|
|
|
|
|
|
|
|
const toast = useToast() |
|
|
|
|
|
|
|
|
|
function changeLockType(type: LockType) { |
|
|
|
|
$e('a:grid:lockmenu', { lockType: type }) |
|
|
|
|
|
|
|
|
|
if (type === 'personal') { |
|
|
|
|
return toast.info('Coming soon', { timeout: 3000 }) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
vModel.value = type |
|
|
|
|
|
|
|
|
|
toast.success(`Successfully Switched to ${type} view`, { timeout: 3000 }) |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<script lang="ts"> |
|
|
|
|
export default { |
|
|
|
|
name: 'LockMenu', |
|
|
|
|
props: ['value'], |
|
|
|
|
data: () => ({}), |
|
|
|
|
methods: { |
|
|
|
|
changeLockType(type) { |
|
|
|
|
this.$e('a:grid:lockmenu', { lockType: type }) |
|
|
|
|
if (type === 'personal') { |
|
|
|
|
return this.$toast.info('Coming soon').goAway(3000) |
|
|
|
|
} |
|
|
|
|
this.$emit('input', type) |
|
|
|
|
this.$toast.success(`Successfully Switched to ${type} view`).goAway(3000) |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
|
<v-menu offset-y max-width="350"> |
|
|
|
|
<template #activator="{ on }"> |
|
|
|
|
<v-icon v-if="value === 'locked'" small class="mx-1 nc-view-lock-menu" v-on="on"> mdi-lock-outline </v-icon> |
|
|
|
|
<v-icon v-else-if="value === 'personal'" small class="mx-1 nc-view-lock-menu" v-on="on"> mdi-account </v-icon> |
|
|
|
|
<v-icon v-else small class="mx-1 nc-view-lock-menu" v-on="on"> mdi-account-group-outline </v-icon> |
|
|
|
|
<template #activator="{ props: menuProps }"> |
|
|
|
|
<v-icon v-if="vModel === LockType.Locked" small class="mx-1 nc-view-lock-menu" v-bind="menuProps.onClick"> |
|
|
|
|
mdi-lock-outline |
|
|
|
|
</v-icon> |
|
|
|
|
<v-icon v-else-if="vModel === LockType.Personal" small class="mx-1 nc-view-lock-menu" v-bind="menuProps.onClick"> |
|
|
|
|
mdi-account |
|
|
|
|
</v-icon> |
|
|
|
|
<v-icon v-else small class="mx-1 nc-view-lock-menu" v-bind="menuProps.onClick"> mdi-account-group-outline </v-icon> |
|
|
|
|
</template> |
|
|
|
|
<v-list maxc-width="350"> |
|
|
|
|
<v-list-item two-line class="pb-4" @click="changeLockType('collaborative')"> |
|
|
|
|
<v-list-item two-line class="pb-4" @click="changeLockType(LockType.Collaborative)"> |
|
|
|
|
<v-list-item-icon class="mr-1 align-self-center"> |
|
|
|
|
<v-icon v-if="!value || value === 'collaborative'" small> mdi-check-bold </v-icon> |
|
|
|
|
<v-icon v-if="!vModel || vModel === LockType.Collaborative" small> mdi-check-bold </v-icon> |
|
|
|
|
</v-list-item-icon> |
|
|
|
|
<v-list-item-content class="pb-1"> |
|
|
|
|
<v-list-item-title> |
|
|
|
@ -39,9 +67,9 @@ export default {
|
|
|
|
|
</v-list-item-subtitle> |
|
|
|
|
</v-list-item-content> |
|
|
|
|
</v-list-item> |
|
|
|
|
<v-list-item two-line class="pb-4" @click="changeLockType('locked')"> |
|
|
|
|
<v-list-item two-line class="pb-4" @click="changeLockType(LockType.Locked)"> |
|
|
|
|
<v-list-item-icon class="mr-1 align-self-center"> |
|
|
|
|
<v-icon v-if="value === 'locked'" small> mdi-check-bold </v-icon> |
|
|
|
|
<v-icon v-if="vModel === LockType.Locked" small> mdi-check-bold </v-icon> |
|
|
|
|
</v-list-item-icon> |
|
|
|
|
|
|
|
|
|
<v-list-item-content class="pb-1"> |
|
|
|
@ -56,9 +84,9 @@ export default {
|
|
|
|
|
<span class="caption mt-3"><v-icon class="mr-1 mt-n1" x-small color="#fcb401"> mdi-star</v-icon>Locked view.</span> |
|
|
|
|
</v-list-item-content> |
|
|
|
|
</v-list-item> |
|
|
|
|
<v-list-item three-line @click="changeLockType('personal')"> |
|
|
|
|
<v-list-item three-line @click="changeLockType(LockType.Personal)"> |
|
|
|
|
<v-list-item-icon class="mr-1 align-self-center"> |
|
|
|
|
<v-icon v-if="value === 'personal'" small> mdi-check-bold </v-icon> |
|
|
|
|
<v-icon v-if="vModel === LockType.Personal" small> mdi-check-bold </v-icon> |
|
|
|
|
</v-list-item-icon> |
|
|
|
|
|
|
|
|
|
<v-list-item-content> |
|
|
|
|