@data-fair/lib-vuetify 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/date-match-filter.vue +104 -0
- package/date-match-filter.vue.d.ts +32 -0
- package/date-match-filter.vue.js +133 -0
- package/date-range-picker.vue +76 -0
- package/date-range-picker.vue.d.ts +11 -0
- package/date-range-picker.vue.js +134 -0
- package/index.d.ts +2 -0
- package/index.js +53 -0
- package/owner-avatar.vue +44 -0
- package/owner-avatar.vue.d.ts +7 -0
- package/owner-avatar.vue.js +103 -0
- package/owner-pick.vue +123 -0
- package/owner-pick.vue.d.ts +11 -0
- package/owner-pick.vue.js +186 -0
- package/package.json +22 -0
- package/personal-menu.vue +260 -0
- package/personal-menu.vue.d.ts +19 -0
- package/personal-menu.vue.js +484 -0
- package/search-address.vue +75 -0
- package/search-address.vue.d.ts +14 -0
- package/search-address.vue.js +125 -0
- package/tutorial-alert.vue +131 -0
- package/tutorial-alert.vue.d.ts +70 -0
- package/tutorial-alert.vue.js +138 -0
- package/user-avatar.vue +85 -0
- package/user-avatar.vue.d.ts +7 -0
- package/user-avatar.vue.js +112 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-toolbar-items class="personal-menu">
|
|
3
|
+
<v-btn
|
|
4
|
+
v-if="!user || !account"
|
|
5
|
+
v-t="'login'"
|
|
6
|
+
depressed
|
|
7
|
+
color="primary"
|
|
8
|
+
:href="session.loginUrl()"
|
|
9
|
+
/>
|
|
10
|
+
<v-menu
|
|
11
|
+
v-else
|
|
12
|
+
offset-y
|
|
13
|
+
nudge-left
|
|
14
|
+
max-height="700"
|
|
15
|
+
>
|
|
16
|
+
<template #activator="{props: activatorProps}">
|
|
17
|
+
<v-btn
|
|
18
|
+
class="px-0"
|
|
19
|
+
:title="t('openPersonalMenu')"
|
|
20
|
+
v-bind="activatorProps"
|
|
21
|
+
>
|
|
22
|
+
<user-avatar show-account />
|
|
23
|
+
<v-icon
|
|
24
|
+
v-if="user.pd"
|
|
25
|
+
color="warning"
|
|
26
|
+
style="position:absolute;"
|
|
27
|
+
>
|
|
28
|
+
mdi-alert
|
|
29
|
+
</v-icon>
|
|
30
|
+
</v-btn>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<v-list
|
|
34
|
+
outlined
|
|
35
|
+
class="py-0"
|
|
36
|
+
>
|
|
37
|
+
<!-- current account, not actionable -->
|
|
38
|
+
<v-list-item
|
|
39
|
+
disabled
|
|
40
|
+
:style="account.type !== 'user' ? 'padding-left:0' : ''"
|
|
41
|
+
class="text--secondary"
|
|
42
|
+
>
|
|
43
|
+
<template #prepend>
|
|
44
|
+
<user-avatar
|
|
45
|
+
show-account
|
|
46
|
+
style="margin-right: 16px;"
|
|
47
|
+
/>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<v-list-item-title>
|
|
51
|
+
{{ account.type === 'user' ? t('personalAccount') : account.name }}
|
|
52
|
+
</v-list-item-title>
|
|
53
|
+
<v-list-item-subtitle v-if="account.department">
|
|
54
|
+
{{ account.departmentName || account.department }}
|
|
55
|
+
</v-list-item-subtitle>
|
|
56
|
+
<v-list-item-subtitle>{{ user.name }}</v-list-item-subtitle>
|
|
57
|
+
</v-list-item>
|
|
58
|
+
|
|
59
|
+
<!-- cancel a planned deletion ? -->
|
|
60
|
+
<template v-if="user.pd">
|
|
61
|
+
<v-alert
|
|
62
|
+
:value="true"
|
|
63
|
+
type="warning"
|
|
64
|
+
tile
|
|
65
|
+
:outlined="theme.current.value.dark"
|
|
66
|
+
style="max-width:440px;"
|
|
67
|
+
>
|
|
68
|
+
{{ t('plannedDeletion', {name: user.name, plannedDeletion: $d(new Date(user.pd))}) }}
|
|
69
|
+
</v-alert>
|
|
70
|
+
|
|
71
|
+
<v-row class="justify-center ma-0 mb-2">
|
|
72
|
+
<v-btn
|
|
73
|
+
color="warning"
|
|
74
|
+
@click="session.cancelDeletion"
|
|
75
|
+
>
|
|
76
|
+
{{ t('cancelDeletion') }}
|
|
77
|
+
</v-btn>
|
|
78
|
+
</v-row>
|
|
79
|
+
</template>
|
|
80
|
+
|
|
81
|
+
<!-- account switching (personal account and organizations) -->
|
|
82
|
+
<template v-if="user.organizations.length > 1 || (user.organizations.length === 1 && (!user.ipa || account.type === 'user'))">
|
|
83
|
+
<v-list-subheader
|
|
84
|
+
v-t="'switchAccount'"
|
|
85
|
+
style="height: 24px"
|
|
86
|
+
/>
|
|
87
|
+
<v-list-item
|
|
88
|
+
v-if="account.type !== 'user' && !user.ipa"
|
|
89
|
+
id="toolbar-menu-switch-user"
|
|
90
|
+
@click="session.switchOrganization(null)"
|
|
91
|
+
>
|
|
92
|
+
<template #prepend>
|
|
93
|
+
<v-avatar :size="28">
|
|
94
|
+
<img :src="`${session.options.directoryUrl}/api/avatars/user/${user.id}/avatar.png`">
|
|
95
|
+
</v-avatar>
|
|
96
|
+
</template>
|
|
97
|
+
<v-list-item-title v-t="'personalAccount'" />
|
|
98
|
+
</v-list-item>
|
|
99
|
+
<v-list-item
|
|
100
|
+
v-for="organization in switchableOrganizations"
|
|
101
|
+
:id="'toolbar-menu-switch-orga-' + organization.id"
|
|
102
|
+
:key="organization.id"
|
|
103
|
+
@click="session.switchOrganization(organization.id , organization.department)"
|
|
104
|
+
>
|
|
105
|
+
<template #prepend>
|
|
106
|
+
<v-avatar :size="28">
|
|
107
|
+
<img
|
|
108
|
+
v-if="organization.department"
|
|
109
|
+
:src="`${session.options.directoryUrl}/api/avatars/organization/${organization.id}/${organization.department}/avatar.png`"
|
|
110
|
+
>
|
|
111
|
+
<img
|
|
112
|
+
v-else
|
|
113
|
+
:src="`${session.options.directoryUrl}/api/avatars/organization/${organization.id}/avatar.png`"
|
|
114
|
+
>
|
|
115
|
+
</v-avatar>
|
|
116
|
+
</template>
|
|
117
|
+
<v-list-item-title>
|
|
118
|
+
{{ organization.name }}
|
|
119
|
+
</v-list-item-title>
|
|
120
|
+
<v-list-item-subtitle v-if="organization.department">
|
|
121
|
+
{{ organization.departmentName || organization.department }}
|
|
122
|
+
</v-list-item-subtitle>
|
|
123
|
+
</v-list-item>
|
|
124
|
+
</template>
|
|
125
|
+
|
|
126
|
+
<v-divider />
|
|
127
|
+
|
|
128
|
+
<slot name="actions-before" />
|
|
129
|
+
|
|
130
|
+
<!-- toggle admin mode -->
|
|
131
|
+
<v-list-item
|
|
132
|
+
v-if="user.isAdmin"
|
|
133
|
+
density="compact"
|
|
134
|
+
class="personal-menu-switch-list-item"
|
|
135
|
+
>
|
|
136
|
+
<template #prepend>
|
|
137
|
+
<v-icon>mdi-shield-alert</v-icon>
|
|
138
|
+
</template>
|
|
139
|
+
<v-list-item-title>
|
|
140
|
+
<v-switch
|
|
141
|
+
v-model="user.adminMode"
|
|
142
|
+
color="admin"
|
|
143
|
+
hide-details
|
|
144
|
+
class="mt-0"
|
|
145
|
+
density="compact"
|
|
146
|
+
:label="t('adminMode')"
|
|
147
|
+
@change="session.setAdminMode"
|
|
148
|
+
/>
|
|
149
|
+
</v-list-item-title>
|
|
150
|
+
</v-list-item>
|
|
151
|
+
|
|
152
|
+
<!-- get back to normal admin session after impersonating a user -->
|
|
153
|
+
<v-list-item
|
|
154
|
+
v-if="user.asAdmin"
|
|
155
|
+
color="admin"
|
|
156
|
+
density="compact"
|
|
157
|
+
@click="session.asAdmin(null)"
|
|
158
|
+
>
|
|
159
|
+
<template #prepend>
|
|
160
|
+
<v-icon>mdi-account-switch-outline</v-icon>
|
|
161
|
+
</template>
|
|
162
|
+
<v-list-item-title>{{ t('backToAdmin') }}</v-list-item-title>
|
|
163
|
+
</v-list-item>
|
|
164
|
+
|
|
165
|
+
<!-- switch dark mode -->
|
|
166
|
+
<v-list-item
|
|
167
|
+
v-if="darkModeSwitch"
|
|
168
|
+
density="compact"
|
|
169
|
+
class="personal-menu-switch-list-item"
|
|
170
|
+
>
|
|
171
|
+
<template #prepend>
|
|
172
|
+
<v-icon>mdi-weather-night</v-icon>
|
|
173
|
+
</template>
|
|
174
|
+
<v-list-item-title>
|
|
175
|
+
<v-switch
|
|
176
|
+
:input-value="session.state.dark"
|
|
177
|
+
hide-details
|
|
178
|
+
class="mt-0"
|
|
179
|
+
density="compact"
|
|
180
|
+
:label="t('darkMode')"
|
|
181
|
+
color="white"
|
|
182
|
+
@change="() => session.switchDark(!session.state.dark)"
|
|
183
|
+
/>
|
|
184
|
+
</v-list-item-title>
|
|
185
|
+
</v-list-item>
|
|
186
|
+
|
|
187
|
+
<!-- logout button -->
|
|
188
|
+
<v-divider />
|
|
189
|
+
<v-list-item
|
|
190
|
+
@click="() => session.logout()"
|
|
191
|
+
>
|
|
192
|
+
<template #prepend>
|
|
193
|
+
<v-icon>mdi-logout</v-icon>
|
|
194
|
+
</template>
|
|
195
|
+
<v-list-item-title v-t="'logout'" />
|
|
196
|
+
</v-list-item>
|
|
197
|
+
</v-list>
|
|
198
|
+
</v-menu>
|
|
199
|
+
</v-toolbar-items>
|
|
200
|
+
</template>
|
|
201
|
+
|
|
202
|
+
<i18n lang="yaml">
|
|
203
|
+
fr:
|
|
204
|
+
login: Se connecter / S'inscrire
|
|
205
|
+
logout: Se déconnecter
|
|
206
|
+
openPersonalMenu: Ouvrez le menu personnel
|
|
207
|
+
personalAccount: Compte personnel
|
|
208
|
+
switchAccount: Changer de compte
|
|
209
|
+
adminMode: mode admin
|
|
210
|
+
backToAdmin: Revenir à ma session administrateur
|
|
211
|
+
darkMode: mode nuit
|
|
212
|
+
plannedDeletion: La suppression de l'utilisateur {name} et toutes ses informations est programmée le {plannedDeletion}.
|
|
213
|
+
cancelDeletion: Annuler la suppression de l'utilisateur
|
|
214
|
+
en:
|
|
215
|
+
login: Login / Sign up
|
|
216
|
+
logout: Logout
|
|
217
|
+
openPersonalMenu: Open personal menu
|
|
218
|
+
personalAccount: Personal account
|
|
219
|
+
switchAccount: Switch account
|
|
220
|
+
adminMode: admin mode
|
|
221
|
+
backToAdmin: Return to administrator session
|
|
222
|
+
darkMode: night mode
|
|
223
|
+
plannedDeletion: The deletion of the user {name} and all its data is planned on the {plannedDeletion}.
|
|
224
|
+
cancelDeletion: Cancel the deletion of the user
|
|
225
|
+
</i18n>
|
|
226
|
+
|
|
227
|
+
<script setup>
|
|
228
|
+
import { computed, toRefs } from 'vue'
|
|
229
|
+
import { useI18n } from 'vue-i18n'
|
|
230
|
+
import { useSession } from '@data-fair/lib/vue/session.js'
|
|
231
|
+
import { useTheme } from 'vuetify'
|
|
232
|
+
import UserAvatar from './user-avatar.vue'
|
|
233
|
+
|
|
234
|
+
const theme = useTheme()
|
|
235
|
+
const session = useSession()
|
|
236
|
+
|
|
237
|
+
defineProps({
|
|
238
|
+
darkModeSwitch: {
|
|
239
|
+
type: Boolean,
|
|
240
|
+
default: false
|
|
241
|
+
}
|
|
242
|
+
})
|
|
243
|
+
|
|
244
|
+
const { t } = useI18n({ useScope: 'local' })
|
|
245
|
+
const { user, account } = toRefs(session.state)
|
|
246
|
+
const switchableOrganizations = computed(() => {
|
|
247
|
+
const { user, account } = session.state
|
|
248
|
+
if (!user || !account) return
|
|
249
|
+
return user.organizations.filter(o => account.type === 'user' || account.id !== o.id || (account.department || null) !== (o.department || null))
|
|
250
|
+
})
|
|
251
|
+
</script>
|
|
252
|
+
|
|
253
|
+
<style>
|
|
254
|
+
.personal-menu-switch-list-item .v-list-item__content {
|
|
255
|
+
overflow: visible!important;
|
|
256
|
+
}
|
|
257
|
+
.personal-menu-switch-list-item .v-list-item__content .v-list-item-title {
|
|
258
|
+
overflow: visible!important;
|
|
259
|
+
}
|
|
260
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
2
|
+
export default _default;
|
|
3
|
+
type __VLS_WithTemplateSlots<T, S> = T & (new () => {
|
|
4
|
+
$slots: S;
|
|
5
|
+
});
|
|
6
|
+
declare const __VLS_component: import("vue").DefineComponent<{}, {
|
|
7
|
+
darkModeSwitch: boolean;
|
|
8
|
+
$props: {
|
|
9
|
+
readonly darkModeSwitch?: boolean | undefined;
|
|
10
|
+
};
|
|
11
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
12
|
+
type __VLS_TemplateResult = {
|
|
13
|
+
slots: {
|
|
14
|
+
"actions-before"?(_: {}): any;
|
|
15
|
+
};
|
|
16
|
+
refs: {};
|
|
17
|
+
attrs: Partial<typeof __VLS_inheritedAttrs>;
|
|
18
|
+
};
|
|
19
|
+
declare var __VLS_inheritedAttrs: {};
|